Skip to content

fix: stop committing volatile graph stats (AGENTS/CLAUDE/arch-doc churn)#3

Merged
ReidenXerx merged 1 commit into
mainfrom
fix/stop-committing-volatile-graph-stats
Jul 8, 2026
Merged

fix: stop committing volatile graph stats (AGENTS/CLAUDE/arch-doc churn)#3
ReidenXerx merged 1 commit into
mainfrom
fix/stop-committing-volatile-graph-stats

Conversation

@ReidenXerx

Copy link
Copy Markdown
Owner

Problem

Teammates who pull see committed agent docs perpetually "modified" — even with no real change. Root cause: three committed files embed live graph stats that regenerate on every re-index, and each machine's graph differs slightly:

  • docs/ARCHITECTURE.gitnexus.md — kit-generated (generate-arch-doc, runs on refresh)
  • the <!-- gitnexus:start -->…<!-- gitnexus:end --> block the GitNexus analyze tool injects into AGENTS.md / CLAUDE.md (symbol / relationship / per-area counts)

Example diff a teammate hit after a routine refresh:

- indexed as enter-control (49749 symbols, 117601 relationships, 231 flows)
+ indexed as enter-control (50592 symbols, 119358 relationships, 232 flows)
- Components area (1103 symbols) ... Hooks (358)
+ Components area (1115 symbols) ... Hooks (368)

Fix

  • Arch doc: gitignore docs/ARCHITECTURE.gitnexus.md (still regenerated locally, just not committed).
  • AGENTS.md / CLAUDE.md: new .gnkit/lib/stabilize-agent-docs.mjs strips the volatile gitnexus:start block while preserving the user's own content and the kit's stable gitnexus-agent-kit contract block (can't gitignore these files — they hold real user instructions).
  • Runs where analyze re-injects the block: sync-teaching (install + autonomous agent-refresh) and the pre-commit hook (after full-pdg), so both the working tree and commits stay clean.

Verified

  • Unit tests: strip removes block + stats, keeps user + kit content, idempotent; gitignore includes the arch doc. 56/56 pass.
  • Real-world: a 626-line CLAUDE.md (325 lines of user rules) → block + stats gone, user content and kit block intact.

🤖 Generated with Claude Code

Committed agent docs churned on every teammate's machine because they embed
live graph stats that regenerate per re-index:
- docs/ARCHITECTURE.gitnexus.md — kit-generated arch doc (generate-arch-doc)
- the <!-- gitnexus:start -->..<!-- gitnexus:end --> block the GitNexus `analyze`
  tool injects into AGENTS.md/CLAUDE.md (symbol/relationship/per-area counts)

Each teammate's graph differs slightly, so these showed as perpetually "modified"
after any refresh — noise for everyone who pulls.

Fix:
- gitignore docs/ARCHITECTURE.gitnexus.md (kept local, still regenerated)
- new .gnkit/lib/stabilize-agent-docs.mjs strips the volatile gitnexus:start block
  from AGENTS.md/CLAUDE.md, preserving the user's content and the kit's stable
  gitnexus-agent-kit contract block
- run it in sync-teaching (install + autonomous agent-refresh) and in the
  pre-commit hook (after full-pdg re-injects the block) so commits stay clean

Verified on a real 626-line CLAUDE.md: block + stats removed, user content and
kit block intact. 56/56 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ReidenXerx
ReidenXerx merged commit d30d028 into main Jul 8, 2026
1 check 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