Skip to content

docs(agents): state commit-then-revert as the required order for reverse verification (#4301) - #4339

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-4301-agents-md-commit-then-revert
Aug 11, 2026
Merged

docs(agents): state commit-then-revert as the required order for reverse verification (#4301)#4339
yinlianghui merged 1 commit into
mainfrom
claude/issue-4301-agents-md-commit-then-revert

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Closes#4301

One bullet added to AGENTS.md. No code, no other files.

Where it landed, and why not where the card pointed

The card asked for "the verification/reverse-verification section of AGENTS.md (and/or the worktree section, wherever the revert idiom git checkout origin/main -- is shown)". Measured against origin/main first: AGENTS.md contains no such section and does not show the revert idiom at all — it has no occurrence of checkout origin/main, stash, revert, or a reverse-verification ladder. Repo-wide, that idiom and the stash ban live in exactly three places, none of them AGENTS.md:

  • CLAUDE.md — the stash ban plus the three sanctioned substitutes
  • .claude/hooks/guard-shared-stash.sh and its selftest

So the paragraph went to the card's own stated fallback, the worktree section: §9 Operational Rules → 多 agent 协作纪律, immediately after the shared-file commit-hygiene bullet (编辑→git add→commit 一气呵成) and before the merge-queue bullet. That is the same family — the bullets around it are the ones about not losing your own in-flight work — and it is where the mandatory-worktree rule already sits, which is the rule an agent is following when it reaches for a raw checkout.

Language

The target section is Chinese throughout, and Commandment #-1 explicitly exempts this instruction file's operational sections from the English-only rule ("this rule governs the codebase; this instruction file may use Chinese in operational sections"). The paragraph is therefore written in Chinese to match the surrounding bullets, with the git commands verbatim in English as every neighbouring bullet spells them. Citation form follows the file's existing style (#3193, objectui#3430, 先例 PR #3458).

The added text

Placeholders are shown spaced below (< path >) only because GitHub's body sanitizer eats a < followed by a letter — the issue body itself lost its placeholders that way. The file carries the normal unspaced form; see the diff for the exact bytes.

The stash clause points at CLAUDE.md rather than restating the ban, since that is where it is documented and duplicating it would create a second copy to drift.

The two incidents were verified, not copied

Both cited PRs were read at their merged state rather than taken from the card:

Verification

Docs-only, so the gates that touch this surface — not a whole-repo sweep:

node scripts/check-control-bytes.mjs
OK (scanned 4066 tracked text file(s); skipped 85 binary)
node scripts/check-doc-links.mjs
Links are valid across 13 scan roots.
node scripts/check-changeset-presence.mjs
Compared the working tree with 7f1cb3323 (merge-base with origin/main):
1 file(s) changed, 0 of them under the src/ of a package the release covers,
0 under a package changesets ignores, 0 changeset(s) added.
No source of a released package changed in this range, so no changeset is owed.

Plus a self-scan beyond the gate for control bytes in the edited file (grep -naP over the C0 range plus 0x7f) — no match.

No changeset, on the gate's own verdict quoted above: the guarded surface is the src/ of packages in the fixed group of .changeset/config.json, and a repo-root markdown file is not in it. Nothing is released by this PR, so there is nothing to declare.

Diff is one line: 1 file changed, 1 insertion(+).


Generated by Claude Code

)
Reverse verification (remove the fix, watch the predicted pins go red,
restore) is standard in this repo's dev loop, but AGENTS.md never said
when to commit. Twice on 2026-08-11 an agent ran the removal step against
UNCOMMITTED work — #4278 (PR #4293) and #4243 (PR #4299) — and the edits
were gone, recoverable only by replaying the session transcript.
The restore only works against a commit that exists, and `git stash` is
banned here for the shared-stack reasons CLAUDE.md documents, so the
working tree is the only copy. State the order explicitly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
@vercel

vercelBot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 11, 2026 5:28pm

Request Review

@github-actionsgithub-actionsBot added the documentation Improvements or additions to documentation label Aug 11, 2026
@yinlianghui
yinlianghui marked this pull request as ready for review August 11, 2026 17:40
@yinlianghui
yinlianghui added this pull request to the merge queueAug 11, 2026
Merged via the queue into main with commit c880799Aug 11, 2026
18 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-4301-agents-md-commit-then-revert branch August 11, 2026 17:40
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentation

Projects

None yet

2 participants

@yinlianghui@claude