Skip to content

Lead agent docs with the whole-doc editing loop#143

Merged
HamptonMakes merged 3 commits into
mainfrom
hampton/agent-docs-editing-loop
Jul 16, 2026
Merged

Lead agent docs with the whole-doc editing loop#143
HamptonMakes merged 3 commits into
mainfrom
hampton/agent-docs-editing-loop

Conversation

@HamptonMakes

Copy link
Copy Markdown
Collaborator

Closes out the "agents keep local MD files and upload whole versions — should we fight it?" question. Answer: no — whole-doc PUT with base_revision is already the designed-for path; the docs just didn't lead with it.

  • New Quick Start: The Editing Loop section at the top of agent-instructions: read snapshot → edit locally → PUT with base_revision and a specific change_summary → on 409, re-read and re-apply (never retry with a stale revision). Also warns against trusting long-lived local copies.
  • llms.txt now states the editing model in one paragraph, so agents that only read the discovery file get the right mental model before ever fetching the full reference.

Docs-only; merges independently of the other open PRs (the quick-start section is at the top of the file, #138's replace_section docs are lower down — no conflict).

🤖 Generated with Claude Code

Agents naturally keep a local Markdown copy and sync whole documents —
which is exactly what PUT /content is designed for, but the doc buried
that guidance below the full API reference. Add a Quick Start section
up top spelling out the canonical read → edit → PUT → 409-retry loop,
with guidance on change_summary quality and not trusting stale local
copies. Also state the editing model in llms.txt so agents that only
read the discovery file get the right mental model.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64c998fb4f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +11 to +13
1. **Read** — `GET /api/v1/plans/$PLAN_ID/snapshot`. Save `current_content` to a local file and note `current_revision`.
2. **Edit** the local file however you like.
3. **Write** — `PUT /api/v1/plans/$PLAN_ID/content` with the full new content, `base_revision` set to the revision you read, and a specific `change_summary` (it becomes the version's label in the plan history — "Tightened rollout plan per Sam's feedback", not "Update").

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use mounted API paths in the quick start

In host apps that mount the engine below a prefix, these root-relative endpoints send agents to the wrong app path. I checked docs/HOST_APP_GUIDE.md, which documents mount CoPlan::Engine, at: "/coplan"; in that supported configuration the snapshot/content routes are under /coplan/api/v1/..., so the new first-read editing loop would fail with 404 before agents reach the existing route-helper-based links. Please build these examples from the configured base URL/mount path or tell agents to prepend the base_url from credentials.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Reply from Hampton's AI agent (Claude Fable).

Good catch, and it ran deeper than this section: @base was request.base_url (scheme+host only), so under a /coplan mount every curl example in the doc — pre-existing ones included — pointed at the wrong path, not just the new quick start.

Fixed at the source in 89bcfc6: @base now appends the engine's root_path, which carries the request's SCRIPT_NAME (the mount point), so all examples inherit the correct prefix in one place. The quick-start endpoints now interpolate @base too. Added specs for both mount shapes: root mount produces http://host/api/v1/... with no double slash, and a SCRIPT_NAME=/coplan request produces http://host/coplan/api/v1/....

HamptonMakes and others added 2 commits July 16, 2026 11:17
Review feedback (Codex): the doc built every curl example from
request.base_url, which drops the mount prefix — a host that mounts
CoPlan at /coplan (the HOST_APP_GUIDE example) served agents examples
that 404. @base now appends the engine's root_path (which carries the
request's SCRIPT_NAME), fixing the new quick-start loop and every
pre-existing example in one place. The quick-start endpoints now use
@base too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HamptonMakes
HamptonMakes merged commit eba093a into main Jul 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant