Canon revision

From tonydzi/second-brain-starter-kit · View interactive version

Canon revision is an AI agent skill from the GitHub repository tonydzi/second-brain-starter-kit. Restructure an always-loaded rules file such as CLAUDE.md or MEMORY.md: build a top block of key rules plus numbered categories, move rule bodies verbatim with a script that proves zero byte loss, fold heavy mechanics into trigger-plus-pointer form, then guards, a canary window and fleet rollout. Fo

How to use this skill

Skill file

canon-revision — revising an always-loaded rules file

The pain: the rules file grows through intake, the structure drifts, and the important parts drown in the middle. The owner's decision (2026-07-22): live in cycles — free growth up to the yellow zone, then a FULL structural revision. This procedure is that revision, battle-tested on CLAUDE.md v2.

Roles: the LLM decides ONLY (a) the mapping of sections into categories, (b) the contents of the TOP block, (c) which sections to fold, plus pinpoint edits from the owner's explicit decisions. The bytes are moved by the SCRIPT, which proves by itself that nothing was lost. Never retype the file by hand.

Step 0 — RECALL + the frame

Step 1 — Measure BEFORE

python ~/.claude/scripts/claude_md_guard.py + byte size + section counter (^## / ^### ). Record: bytes, sections, md5.

Step 2 — Coordination and safety net

  1. onair.py check --zone canon-skills (for MEMORY.md: memory-index) → clear → onair.py declare --mode exclusive.
  2. canon_write_gate.py <file> → GO + an automatic backup; plus your own *.bak-<date>-revision.
  3. ⚠️ The two-ends pitfall (memory compression-contract): before publishing, verify (a) the md5 of the canon base, (b) the diff of the assembled file against YOUR live file — parallel sessions keep appending through intake.

Step 3 — Assembly (deterministic)

Take references/restructure_claude_md.py (the working sample from 07-22) and adapt the mapping:

Step 4 — Threshold control and folds

Guard RED / a fat yellow → structurally fold the fattest PROCESS sections (sample references/fold_four.py): what remains is trigger + gist + pointer, and the body must ALREADY live in the house rulebook / memory (verify that the canon exists, otherwise write it there first). Do not fold the owner's top rules without showing him a before→after. Do not re-compress at the word level.

Step 5 — Verification (the /tt layer)

Step 6 — Publication and homes

  1. publish_canon.py (for CLAUDE.md); MEMORY.md travels by file sync on its own.
  2. New/changed rules → their homes: memory + a MEMORY.md line (+ the house rulebook if the rule is human-executable); rule_home_guard.py <slug>.
  3. onair close, then a before→after report to the owner (bytes, sections, what was folded, how to roll back).

Step 7 — The "did it get worse" sensor + rollout

Boundaries

<!--kit-footer-->


Like this skill? It is part of second-brain-starter-kit: the second brain we built for ourselves and run every day at Palo Alto AI Research Lab. Install the whole set with npx skills add tonydzi/second-brain-starter-kit. Everything is open source and free, so take what you need.

Flagships worth a look on their own: secondop-panel (a second opinion from a panel of external models), claude-memory-tidy (stop your agent's memory from rotting), telegram-mcp-kit (your own Telegram over MCP in about 15 minutes).

Author: Anton Dziatkovskii, Palo Alto AI Research Lab. Telegram @tonydzi - WhatsApp +1 341 222 9178 - X @Tony_Stef_

Engineers: want to test-drive this setup? Message me. I hand out free starter seeds to engineers who test and report back, and custom skill requests are welcome.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.