docs(agent-context): clarify refresh/overwrite behavior in the generated always-on doc#184
Merged
Merged
Conversation
… the always-on doc The generated always-on doc (`.metaobjects/CLAUDE.md`/`AGENTS.md`) said the skills were "safe to read and edit" while also telling adopters to "re-run the agent-context scaffold to refresh them" -- a contradiction: an edit followed by a refresh parks the fresh copy at `<path>.new` (or clobbers it with `--force`), which adopting apps trip over with no clear home for project-specific notes. Fix by telling, in the doc itself (no code merge): mark the file as generated, direct project notes to the root `CLAUDE.md`, explain that a refresh never silently destroys edits (it parks `<path>.new`; only `--force` overwrites in place), and give the reconcile procedure for `<path>.new`. Regen the 8 conformance goldens (AGENTS.md + CLAUDE.md across the 4 stacks). Docs-only; no runtime/codegen change. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Fix the meta init --refresh-docs overwrite confusion adopting apps report. The generated always-on agent-context doc (.metaobjects/CLAUDE.md / AGENTS.md) told adopters the metaobjects-* skills were 'safe to read and edit' while also saying 're-run the agent-context scaffold to refresh them' -- a contradiction: an edit then a refresh parks the fresh copy at .new (or clobbers with --force), and there was no clear home for project-specific notes. DECISION: fix this purely by 'telling' in the generated always-on doc -- NO code-level merge mechanism. A marker-delimited tail-preserve in planScaffold was explicitly considered and RULED OUT by the user; do NOT add it or reference it as a future option. The doc now: (1) marks itself generated; (2) directs project notes to the root CLAUDE.md; (3) explains a refresh never silently destroys edits -- it parks .new, only --force overwrites in place, so never --force a file with local edits; (4) gives the reconcile procedure (diff .new vs , keep hand-edits + take upstream changes, write back, delete .new). Regen the 8 conformance goldens (AGENTS.md + CLAUDE.md across the 4 stacks). Docs-only; no runtime/codegen/CLI-behavior change. The scaffold's manifest-hash protection and .new parking are unchanged.
What Changed
always-on.md.mustacheagent-context template to mark itself as generated, direct project-specific notes to the rootCLAUDE.md, and explain that a refresh parks the fresh copy at<path>.new(only--forceoverwrites in place), with a reconcile procedure (diff, keep hand-edits, write back, delete.new).AGENTS.md+CLAUDE.mdacross thecsharp,java-react,python, andts-react-tanstackstacks) from the updated template..newparking logic altered.Risk Assessment
✅ Low: Docs-only template prose rewrite plus regenerated conformance goldens; all behavioral claims verified against the unchanged scaffold/init code, and the byte-for-byte conformance test will pass against the matching goldens.
Testing
Exercised the agent-context conformance corpus (4 stacks, byte-identical goldens), the CLI refresh-docs unit tests (confirming .new parking + manifest-hash + --force behavior are unchanged), and a live end-to-end
meta init/--refresh-docs/ reconcile /--forcewalkthrough against a real scaffolded project that proves the four behaviors the rewritten doc describes are actually true. All green; the generated doc is now internally consistent and its refresh guidance is accurate. Setup issue (missing node_modules) fixed with a one-timebun install; no code fixes needed.Evidence: End-to-end meta init --refresh-docs transcript (scaffold → hand-edit → .new parking → reconcile → --force)
Evidence: e2e.ts — the script driving the real init/refresh/force walkthrough
Drives init({servers:['typescript'],clients:['react','tanstack']}) → reads generated CLAUDE.md, asserts generated-marker + project-notes guidance + .new-parking explanation + reconcile procedure present and old 'safe to read and edit' contradiction gone → hand-edits the doc → init({refreshDocs:true}) asserts edited file preserved + fresh copy parked at CLAUDE.md.new → reconciles (keep hand-edit + take upstream, delete .new) → init({refreshDocs:true,force:true}) asserts in-place overwrite, no .new. All assertions true.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git diff 99dfde2..93f81573 --stat (confirmed docs-only: 1 template + 8 goldens)cd server/typescript && bun test packages/sdk/test/agent-context-conformance.test.ts (4 stacks byte-identical to goldens)cd server/typescript && bun test packages/cli/test/unit/init-agent-context.test.ts packages/cli/test/unit/init-refresh-docs.test.ts (refresh/.new/manifest-hash behavior unchanged)bun /tmp/no-mistakes-evidence/.../e2e.ts — real meta init → hand-edit → --refresh-docs (.new parking) → reconcile → --force overwrite walkthrough✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.