Merge Standards Updates
Merge Standards Updates
Section titled “Merge Standards Updates”When sync-standards detects that your agent configs have been customized, it stages pending updates in .standards-pending/ instead of overwriting your files. This document explains how to merge those updates.
Claude Code, Cursor and Copilot users: run the merge-standards skill, command or prompt (.claude/skills/merge-standards/SKILL.md, .cursor/commands/merge-standards.md, .github/prompts/merge-standards.prompt.md — setup installs the one for each declared agent) instead of following this guide; it automates the entire process. Codex, Gemini CLI and Aider find the same runbook listed in the ## Skills section of their assembled config.
What Happened
Section titled “What Happened”- You (or a tool like
/claude-md-improver) customized an agent config file (e.g.,CLAUDE.md) sync-standardspulled updated standards blocks- The sync detected your customizations via checksum comparison
- Instead of overwriting, it wrote the updated version to
.standards-pending/<filename>
How to Merge
Section titled “How to Merge”For each file in .standards-pending/:
1. Read Both Files
Section titled “1. Read Both Files”- Current file: The customized version at its normal location (e.g.,
CLAUDE.md) - Pending update: The file in
.standards-pending/(skip the first 3 lines — instruction comment)
2. Merge Section by Section
Section titled “2. Merge Section by Section”Standards sections are marked by ## headers: Architecture, Testing, Security, Naming Conventions, Git Workflow, Documentation, Language Standards, Project Type.
For each standards section:
- Identical content → no change needed
- New rules in pending version → add them to your file
- Changed rules in pending version → update to the new wording
- Your additions within the section → keep them
For content outside standards sections (project overview, key commands, custom sections you added):
-
Always keep your version
-
Persist the overview and commands in
.standards.ymlso the next assembly reproduces them and the checksum stays stable (text edited only in the file is flagged as customized on every later sync).sync-standardsprints the exact YAML when it finds filled-in sections the yml lacks:project_overview: |One paragraph: what this project is and how its pieces fit together.key_commands: |make test # run the test suite -
Keep a file hand-curated with
managed: { CLAUDE.md: false }in.standards.ymlwhen the customisation cannot live in those keys or below the<!-- BEGIN PROJECT-SPECIFICmarker: sync then never regenerates or stages it,doctorreports it as curated, anddiff-standards.shstill shows upstream changes for manual review.
For content below <!-- BEGIN PROJECT-SPECIFIC:
- Keep as-is
3. Update the Checksum
Section titled “3. Update the Checksum”Record the hash of the staged standards version, never of your merged file. Run this before deleting the pending copy:
file="CLAUDE.md" # replace with the actual filenamehash=$(bash -c '. .standards/scripts/lib/checksums.sh && compute_hash "$1"' _ ".standards-pending/$(basename "$file")")echo "$(basename "$file") $hash"# Replace the matching line in .standards-checksums with this outputA merged file then never matches its line, so sync and setup keep it and stage new updates instead. Recording the merged file’s own hash would let the next sync replace it. A file adopted unchanged matches and keeps updating. For .aiderrc use shasum -a 256 .standards-pending/.aiderrc.
4. Clean Up
Section titled “4. Clean Up”Delete the consumed file from .standards-pending/. If the directory is now empty, remove it.
After setup.sh --migrate
Section titled “After setup.sh --migrate”When MERGE_PLAN.md carries a Migration section, the project was set up before the 1.2 safe-setup and setup.sh --migrate has just run (see Renamed Files). The existing files are old hand-rolled configs whose dead standards references were rewritten in place (originals kept as <file>.pre-standards-setup), staged beside the freshly assembled versions. Take the assembled version as the base and carry only project-specific text into its PROJECT-SPECIFIC section — the old files are mostly a stale copy of the standards themselves. For AGENTS.md converted from .codexrc (or .standards-pending/AGENTS.md.from-codexrc), keep any project notes and delete .codexrc once they are in AGENTS.md. Each still cites a removed standard line is a manual decision: delete the sentence or use the replacement named in the map’s Notes column. The recorded checksum of a staged file is the staged assembled version, so adopting it as-is needs no checksum update.
Regenerating Pending Files
Section titled “Regenerating Pending Files”If .standards-pending/ was lost (branch switch, git clean), re-run sync-standards to regenerate pending files.