Repository navigation
Closed
Labels
enhancementNew feature or request
Milestone
Description
Problem
AI agents write rules and context into vendor config files (CLAUDE.md, .cursorrules, agents.md, GEMINI.md) during normal operation. Even with thin pointers in place, agents treat these files as writable scratchpads. The content accumulates silently because nothing in the commit pipeline catches it.
The pre-commit hook currently gates on TypeScript checks and ADF evidence ceilings, but does not detect or correct vendor file bloat.
Proposed Solution
Extend the pre-commit hook to detect and auto-correct vendor file bloat:
- Detect: When a vendor config file is in the git staging area, check if it contains content beyond the thin pointer
- Auto-tidy: If bloat is detected, run
charter adf tidyon the staged vendor files to extract, classify, and route content to.adfmodules - Re-stage: Stage the tidied vendor files (restored to thin pointers) and the modified
.adfmodule files - Continue: The commit proceeds with content in the right place — the agent never knows its writes were redirected
Hook Behavior
[pre-commit] Running TypeScript check...
[pre-commit] Running ADF evidence check...
[pre-commit] Checking vendor config files...
[pre-commit] CLAUDE.md has 8 items beyond thin pointer — auto-tidying...
[pre-commit] Routed: core.adf (5), frontend.adf (3). Pointer restored.
[pre-commit] Re-staged: CLAUDE.md, .ai/core.adf, .ai/frontend.adf
Opt-out
--no-tidyflag oncharter hook install --pre-committo skip vendor file interception- Respects
CHARTER_SKIP_TIDY=1env var for emergency bypass
Acceptance Criteria
- Pre-commit hook detects staged vendor files with content beyond thin pointer
- Auto-runs
charter adf tidyon bloated files - Re-stages modified files (vendor + .adf modules) so the commit includes the corrections
- Reports what was moved in pre-commit output
- Opt-out via install flag and env var
- No-op when vendor files are clean or not staged
- Works with both
npx charter(consuming repos) andpnpm exec charter(this repo)
Dependencies
- Requires feat(adf): add
charter adf tidycommand to sweep vendor file bloat back into ADF modules #23 (charter adf tidycommand) as the underlying primitive - Extends existing pre-commit hook at
.githooks/pre-commit/charter hook install --pre-commit
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
feat(adf): add `charter adf tidy` command for vendor file bloat extra…
feat(hook): pre-commit auto-tidy for vendor file bloat (#24)
SmartBrandStrategies commentedon Mar 4, 2026
Shipped in da8f197. Pre-commit hook now auto-tidies staged vendor files. Bypass with CHARTER_SKIP_TIDY=1. Both .githooks/pre-commit and
charter hook install --pre-commitupdated. Next: #26 (doctor bloat detection).