Skip to content

feat(evolution): three-layer defense against doc-codebase drift#17

Merged
SamPlvs merged 1 commit into
mainfrom
claude/interesting-driscoll
Apr 10, 2026
Merged

feat(evolution): three-layer defense against doc-codebase drift#17
SamPlvs merged 1 commit into
mainfrom
claude/interesting-driscoll

Conversation

@SamPlvs
Copy link
Copy Markdown
Owner

@SamPlvs SamPlvs commented Apr 10, 2026

Summary

  • Root cause fix: Adding Research Scout (17th agent) left 10+ files with stale counts. CLAUDE.md cascade protocol had zero enforcement. Self-evolution protocol applied: fix the symptom AND the rule.
  • Layer 1: scripts/validate-docs.sh — 7 programmatic checks (agent count, names, commands, version, tiers, tests, setup.sh). Runs in <2s, blocks commit on failure.
  • Layer 2: Claude Code hooks in .claude/settings.json — SessionStart auto-loads memory context, PreToolUse blocks git commit if validation fails, PostToolUse injects cascade reminders, Stop checks for uncommitted drift.
  • Layer 3: CLAUDE.md cascade protocol replaced with explicit file-to-file mappings. PR-005 added to PRIORS.md.
  • Also fixed: agent count 16→17 across 10 files, version 1.0.0→1.0.1, test badge 295→298, Model Builder/Backend Engineer tiers to Opus, Research Scout added to specs/agents.md roster.

Test plan

  • Run ./scripts/validate-docs.sh — all 10 checks should pass
  • Run ./setup.sh — agent count should validate at 17
  • Verify hooks: edit an agent file, observe cascade reminder in Claude session
  • Verify hooks: attempt git commit after breaking a count, observe blocked commit
  • Start new Claude session — verify STATE.md + PRIORS auto-loaded

🤖 Generated with Claude Code

SessionStart hook (.claude/hooks/session-start.sh):
  Auto-loads project context at the start of every Claude Code session.
  Injects STATE.md, PRIORS.md, last 10 DECISION_LOG entries, and session
  reminders as additionalContext. No more manual "read the memory files"
  at session start — Claude starts every session already knowing where
  we are, what we've learned, and what decisions were made.

Stop hook (.claude/hooks/stop-check.sh):
  After every Claude turn, checks for uncommitted changes in cascade-trigger
  files (.claude/agents/, .claude/commands/, pyproject.toml, etc.) and
  reminds about running validate-docs.sh. Catches the gap where a session
  might end with uncommitted drift.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SamPlvs SamPlvs merged commit 1613752 into main Apr 10, 2026
@SamPlvs SamPlvs deleted the claude/interesting-driscoll branch April 10, 2026 13:44
SamPlvs added a commit that referenced this pull request Apr 30, 2026
feat(evolution): three-layer defense against doc-codebase drift
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