agentleFS
qyndexqyndex/claude-init/.claude/skills/constitution-compact/SKILL.md

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

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
  1. Very specific:

    Every section added to the constitution displaces something else.

    line 17
  2. Distinctive:

    Add a brief rationale per removed section (why it's safe to drop).

    line 37
  3. Distinctive:

    No section that is still load-bearing (active enforcement, security invariant, or unimplemented intent) has been removed.

    line 47

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Read .claude/CLAUDE.md in full.
  2. 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.sh blocks rm -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).
  3. 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.
  4. Never write to .claude/CLAUDE.md directly. The operator reviews the proposal via /dream-review and applies it with FORCE_CONSTITUTION_EDIT=1.

Done means

  • .claude/memory.proposed/constitution-diff.md exists 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.