constitution-compact
Skill2 starsChanged 5 months agoMITView on GitHub
Quarterly constitution compaction. Identifies redundant, stale, or over-verbose sections in .claude/CLAUDE.md, proposes a trimmed version under .claude/memory.proposed/constitution-diff.md, and enforces the ≤300-line cap. Never edits the constitution in-place — human applies the diff.
- Deletes or force-pushes
In this repository60 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- analyzeSkill
- animation-disciplineSkill
- api-versioningSkill
- autopilotSkill
- browser-e2eSkill
- characterizeSkill
- clarifySkill
- codemodSkill
- constitutionSkill
- context-budgetSkill
- creative-webSkill
- db-migrationSkill
- debugSkill
- detect-stackSkill
- dispatch-criteriaSkill
- dreamSkill
- experimentSkill
- fastapiSkill
- flag-cleanupSkill
- flag-rolloutSkill
- flask-realtimeSkill
- framework-detectorSkill
- front-end-designSkill
- grill-meSkill
- handoffSkill
- image-generationSkill
- implementSkill
- initiativeSkill
- instinctSkill
- loopSkill
- nextjsSkill
- observabilitySkill
- okr-alignSkill
- parallel-swarmSkill
- pivotSkill
- planSkill
- pr-bodySkill
- prime-disciplineSkill
- prod-observabilitySkill
- react-nodeSkill
- react-viteSkill
- release-trainSkill
- researchSkill
- reviewSkill
- security-guardSkill
- self-healSkill
- shipSkill
- skill-creatorSkill
- specifySkill
- tailwind-disciplineSkill
- tasksSkill
- tdd-loopSkill
- token-budgetSkill
- typographySkill
- verify-loopSkill
- verifySkill
- wip-checkpointSkill
- <kebab-case-skill-name>Skill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Every section added to the constitution displaces something else.
- Distinctive: line 37
Add a brief rationale per removed section (why it's safe to drop).
- Distinctive: line 47
No section that is still load-bearing (active enforcement, security invariant, or unimplemented intent) has been removed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Constitution Compact
The constitution (.claude/CLAUDE.md) accumulates cruft over time: duplicated
rules, superseded round notes, verbose examples that were useful once. Beyond 300
lines, prompt-cache efficiency drops and agents start missing rules buried in the
middle. This skill compacts it.
The 300-line cap
Every section added to the constitution displaces something else. The cap is not arbitrary: with CLAUDE_CODE_AUTO_COMPACT_WINDOW=400K, a 300-line constitution stays in the ~2K token range and keeps the cache warm across turns.
validate.sh checks [constitution-size] and warns at >250 lines, fails at >300.
What compact does
- Read
.claude/CLAUDE.mdin full. - Identify candidates for trimming:
- Numbered "Round N" annotations that are now the settled default (the round label is no longer informative — the behavior is just how it works).
- Rules that duplicate a hook or script (if
pre-bash-guard.shblocksrm -rf, the constitution doesn't need to list it too). - Verbose examples with multi-line code blocks where a one-line reference to the relevant script/skill is sufficient.
- Sections superseded by newer rounds (if Round 5 changed something from Round 3, the Round 3 text can go).
- Propose a compacted version in
.claude/memory.proposed/constitution-diff.md:- Show the diff (removed lines prefixed
−, kept lines as-is). - Add a brief rationale per removed section (why it's safe to drop).
- Show the new line count target.
- Show the diff (removed lines prefixed
- Never write to
.claude/CLAUDE.mddirectly. The operator reviews the proposal via/dream-reviewand applies it withFORCE_CONSTITUTION_EDIT=1.
Done means
.claude/memory.proposed/constitution-diff.mdexists with a−/+diff and a projected line count ≤ 300.validate.sh [constitution-size]will pass after the diff is applied.- No section that is still load-bearing (active enforcement, security invariant, or unimplemented intent) has been removed.
Archive, don't delete
Removed sections go to .claude/memory/decisions/archive/constitution-removed-<date>.md
so the reasoning is preserved if a rule needs to be reinstated.
References
- Cap enforcement:
.claude/scripts/validate.sh[constitution-size]check - Quarterly trigger:
.claude/routines/constitution-compact-cron.yml - Review gate:
/dream-review
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

