Since August 2025 I’ve done my work with AI coding agents, both at Ansira, where I’m a Sr. Software Engineer on enterprise .NET, and on my own projects. I plan the work, run several agents at once, then review what they write and ship it. I also write the instructions and skills they work from.
Skills I share
A Claude Code skill is a small instruction file that gives Claude Code a new command.
I wrote these to keep track of a lot of agents at once and to keep their rules in one place. They’re free under the MIT license.
To install one, unzip it into ~/.claude/skills/, start a new Claude Code session and type the command.
Topics
Numbers every request (T1, T2, T3) and keeps a short list of them. Each agent carries the number of the request it’s working on and each result starts with the number it answers. The status line shows what’s still open. It also has my notes on keeping agent prompts small and on what really uses up tokens.
/topics /topics clear
Download topics.zip. Install: unzip into ~/.claude/skills/.
Read topics/SKILL.md
---
name: topics
description: Group multi-agent work into numbered topics (T1, T2…) so you can follow which agent, question and result belongs to which request. Maintains a ledger shown in the Claude Code status line. Use whenever several background agents are running at once, and when the user types /topics.
---
# Topics
When you fire requests rapid-fire while agents run, results land "three agents behind" and it is hard to tell which request a result answers. This skill fixes that by giving every piece of work a **topic** and making every message say which topic it is about.
It works in any session that runs background agents. If you also use an orchestrator skill (one that delegates all work to background agents), have that skill load this one at the start.
Ledger tool: `python3 ~/.claude/skills/topics/topics.py` (one ledger file per working directory, in `~/.claude/topics/`). The status line (`~/.claude/skills/topics/statusline.sh`) shows the open topics live at the bottom of the terminal, e.g. `T3 Signup form ⟳ · T5 Nav rename ◆ · T6 Footer copy ? (4✓ 1‖)`.
Status icons: `◌ queued` · `⟳ running` · `? waiting` (on the user) · `◆ review` (result delivered, user hasn't reacted) · `✓ done` · `‖ parked`.
## Rules
1. **Every new request is a topic.** When the user asks for something new, run `topics.py add "<2 or 3 word name>" --ask "<user's words, short>"`. Several asks in one message means several topics. A follow-up to existing work joins that topic (`set T3 --note ...`), never a new one.
2. **Every agent belongs to a topic.** When dispatching, `set Tn --status running --agent "<short agent label>"`, and put `Tn` in the Agent `description` (e.g. `T3 signup form validation`). One agent may serve several topics; list it on each.
3. **Every relay opens with a topic header**, in this exact shape:
> **T3 · Signup form**: you asked (14:02): "add validation to the signup form"
Then the result. If the result is for a topic older than the one the user is currently talking about, say so plainly on the next line: *"This is the older request, from before the nav change."* Never mix two topics' results in one paragraph; use one header per topic.
4. **Questions carry their topic.** Prefix AskUserQuestion headers and questions with the topic id (`T6 Footer`), and set the topic to `waiting` until answered.
5. **Status upkeep.** `running` on dispatch, `review` when the result is relayed, `parked` for "hold / park / next session", `waiting` while a question is open. When the user responds approvingly or moves on to new asks, run `ack` for the relayed topics: `topics.py ack` with no args marks every topic in review as `done`; `topics.py ack T3 T5` acks just those. Deploys are their own topic (e.g. `T9 Deploy`).
6. **End-of-message footer.** After relays, end with the one-line board: the output of `topics.py line`.
7. **`/topics`** prints `topics.py board` as a table, plus one line per open topic saying what the user needs to do, if anything. `/topics clear` runs `clear-done`.
8. **Keep it cheap.** Ledger calls are glue, not work: batch them into the same Bash call as other glue where possible. Never let ledger upkeep delay a relay.
9. **Every agent gets its topic's slice and nothing else.** See "Context slices" below. An agent prompt carries what THIS topic needs; shared session facts are referenced by path, never re-pasted per agent.
## Context slices (token discipline)
A topic is a context boundary, not just a label. Each agent gets the smallest slice that lets it work correctly.
**One brief, written once, read by all.** At the first dispatch of a session, write the shared facts to `<scratchpad>/SESSION-BRIEF.md`: repo path, what is frozen or running, standing constraints (branch, staging, "don't touch X"), the user's preferred tone. Every agent prompt then says one line: *"Read `<path>/SESSION-BRIEF.md` first; it holds the session's standing constraints."* Update the brief when a fact changes; never re-paste it into prompts. Re-pasting the same 300 words into ten prompts wastes tokens, and it is also how briefs drift out of agreement with each other.
**Per-topic slice.** When a topic needs more than the brief (a diagnosis already established, numbers already measured, a decision the user made), write `<scratchpad>/T<n>-brief.md` and point the topic's agents at it. Two agents on one topic read the same file, so they cannot be told different things.
**The prompt itself carries only:** this topic's task and acceptance criteria; the exact file paths and line numbers already known; what is already established and must NOT be re-derived; what is out of scope; a report cap.
**What actually costs tokens.** In practice, prompts are a tiny fraction of an agent's spend. The big costs are:
- **Searching for what you could have named.** Always hand over paths, line numbers and command invocations already in hand. An agent that greps a whole repo to find one function spends more than the entire prompt.
- **Re-deriving settled facts.** Say "this is established, do not re-derive it" explicitly, and give the numbers.
- **Guards and self-tests.** A standing rule like "always leave a guard behind", plus verifying both ways against live data, is often the single largest multiplier. A sensible default: a small fix is just the fix, with no guard ceremony; anything that is not small gets filed as a gap instead of done in passing; a guard that a class of bug genuinely warrants is filed as its own gap, not built in the same breath. "Small" means small in consequence, not line count: a one-line change to a deploy gate, an importer, or anything writing the system of record is not small.
- **Uncapped reports.** State a word cap and the structure. An agent given no cap writes to the length of its own investigation.
- **The wrong tier.** A census, a rename or a file listing does not need the model tier that judged the design.
**Never trim these to save tokens:** the constraints that stop an agent breaking something (what not to touch, what not to commit, what is frozen), the instruction to report honestly what it could not verify, and the acceptance criteria. A cheap agent that corrupts state is the most expensive outcome available.
## First run in a session
If the ledger is empty but work is already in flight, seed it from the conversation: one topic per open thread, with status, before relaying anything else. Then show the board once.
## Status line
If `~/.claude/settings.json` has no `statusLine`, add:
```json
"statusLine": { "type": "command", "command": "~/.claude/skills/topics/statusline.sh" }
```
If one already exists, don't overwrite it. Ask the user whether to chain it.
Topic
The quick way into Topics. /topic <text> gives a new request the next number and starts on it right away. A lookup gets answered on the spot and real work goes to a background agent. If it needs a decision only you can make, you get one short question. A follow-up joins its open topic instead of starting a new one.
/topic add a print stylesheet for invoices /topic park: look at image sizes later
Download topic.zip. Install: unzip into ~/.claude/skills/.
Read topic/SKILL.md
---
name: topic
description: Start a new topic in the running /topics list. /topic <text> adds it as the next T-number and starts work on it right away, following the /topics rules. Requires the topics skill. Use when the user invokes /topic.
---
# /topic: start a new topic
`/topic <text>` is how you hand over a new piece of work. It joins the same list that `/topics` runs, gets the next T-number, and **starts work straight away**, like any other request in the session.
Requires the `topics` skill, installed at `~/.claude/skills/topics/`.
## Steps
1. **Add it.** Run `python3 ~/.claude/skills/topics/topics.py add "<2 or 3 word name>" --ask "<user's words, short>"`. That prints the new id, for example `T12`.
2. **Start it**, following the rules in `~/.claude/skills/topics/SKILL.md` (read that file if it isn't already loaded):
- Quick lookup or answer: do it now. Reply with a topic header, `**T12 · <name>**: you asked: "<text>"`, then the answer, and set the topic to `review`.
- Real work: dispatch a background agent with `T12` in its description, and set the topic to `running` with `--agent "<label>"`. Give the agent only this topic's slice. Tell the user in one line: `T12 · <name>: started.`
- Blocked on a decision only the user can make: ask one short question tagged `T12`, and set the topic to `waiting`.
- If the text says "later", "park" or "just note it": set the topic to `parked` and don't start work.
3. **Follow-ups.** If the text is plainly a follow-up to an open topic, don't make a new one. Add it to that topic with `topics.py set Tn --note "<text>"`, and act on it under that topic's number.
4. **End** with the board line from `topics.py line`.
The rules on topic headers, relays and statuses all come from `/topics`. This skill is just the front door.
## Bare `/topic`
Show the board line and say: "Type /topic <text> to start a new topic."
Gap
A place for the things you notice while reviewing work: bugs, gaps, small ideas. /gap <text> adds one line to GAPS.md in the repo it belongs to, with a number, a status, a size (easy, med or hard) and a category, the part of the project it’s about. /gap list design then shows just the design finds when the queue gets long. Agents pick finds up and mark them ready when the work is in, and only you close them. It’s for when you spot five things halfway through a review and don’t want to interrupt the agent that’s already working.
/gap the footer looks cramped on phones /gap list /gap list design /gap category 3 search /gap size /gap pickup /gap close 2
Download gap.zip. Install: unzip into ~/.claude/skills/.
Read gap/SKILL.md
---
name: gap
description: Your queue of "finds" (gaps, bugs, ideas). /gap <text> files one with a size and a category; /gap list [category] shows them by category; size/category/edit/remove/close manage the queue; an orchestrator (or /gap pickup) picks queued finds up and marks them ready; only you close them. Data file is GAPS.md at the root of whichever repo the find belongs to.
---
# Gap Queue
A queue of **finds** you keep: gaps, bugs and ideas spotted while reviewing a project, which agents pick up between waves of work.
**The queue is per repo.** The data file is `GAPS.md` at the root of the repo the find belongs to. Never a fixed path, and never another project's queue. Decide from the find itself which repo it concerns; if the find names a file, a URL or a subsystem, that names the repo. Create `GAPS.md` from the format below if the repo has none.
If you work across several repos, you can list the known queues here, one line each, so the right file is always found:
```
- ~/code/project-a/GAPS.md: Project A
- ~/code/project-b/GAPS.md: Project B
```
Filing into the wrong repo is worse than not filing: the find is lost to the project that needed it and clutters one that does not. When genuinely unsure which repo owns a find, ask.
## Lifecycle
`queued` (you filed it) → `in-progress` (an agent picked it up) → `ready` (work landed and verified; awaiting your approval) → `closed` (you approved).
## Entry format (one line per find, under `## Open`; move to `## Closed` when closed)
```
- [ ] GAP-002 · queued · easy · design · 2026-01-15 · the footer looks cramped on phones
- [ ] GAP-001 · ready · med · search · 2026-01-15 · search results need a sort option → done: sort menu shipped in abc1234
- [ ] GAP-003 · queued · docs · 2026-01-15 · some idea nobody has sized yet
```
IDs increment forever and are never reused. Append `→ done: <one-line result>` when marking ready, and the close date when closing.
**Difficulty tag (optional):** a size segment, `easy` · `med` · `hard`, may sit right after the status (`… · queued · hard · <date> …`). An entry with no size segment (like GAP-003 above) is **unsized**. Sizing is an estimate of effort, not priority:
- **easy**: one file, small and well scoped: copy, CSS, config, a template tweak; no new data model. (cheapest model tier)
- **med**: a feature or fix across a few files with real logic, following a known pattern. (middle tier)
- **hard**: multi-file, a new data model or architecture, ambiguous requirements, or cross-repo coordination. (strongest tier)
**Category:** every find has exactly one category, written after the size (or after the status when unsized). It says which part of the project the find is about, so a long queue can be read one area at a time. Keep a short fixed list for each repo at the top of its `GAPS.md`, one line, for example:
```
Categories: design · search · email · data · deploy · docs
```
If you keep rulebooks (one rules file per topic, see the Rulebook skill), use the book names as the categories: the category then also names the book an agent reads before it starts on the find. Pick the category yourself when filing; don't ask. Add a new category only when a find fits none, and add it to the list line at the same time.
## Commands
- `/gap <text>`: append as `queued` with the next ID, a category and today's date (and a size if the effort is obvious).
- `/gap list`: show a one-line count by category (`design 6 · search 3 · …`), then Open grouped by status with each find's category, plus the 5 most recently Closed.
- `/gap list <category>`: Open finds in that category only, grouped by status.
- `/gap list all`: every Open find, under one heading per category.
- `/gap category <id> <category>`: set or change a find's category, then commit.
- `/gap size` (alias `/gap difficulty`): show Open finds bucketed by difficulty: **🟢 Easy**, **🟡 Medium**, **🔴 Hard**, then an **⚪ Unsized** bucket. Each line: `GAP-id · status · short text`. For any **unsized** find, estimate its size from its text and show it in the bucket you would assign, prefixed `~` to mark it an on-the-fly guess (display only; it does not write the tag). End with a one-line tally (e.g. `4 easy · 3 med · 2 hard · 1 unsized`). Sort each bucket by status (queued → in-progress → ready), then by id.
- `/gap size <id> <easy|med|hard>`: persist a find's difficulty: insert or replace its size segment after the status, then commit. Use this to lock in an estimate.
- `/gap edit <id> <new text>`: replace the find's text.
- `/gap remove <id>`: delete outright (you changed your mind; no work happened).
- `/gap close <id>`: your approval: check the box, move to `## Closed`, stamp the date.
- `/gap pickup`: process queued finds now instead of waiting for a batch of work to finish.
## Pickup (with or without an orchestrator)
This skill works on its own: `/gap pickup` starts work on queued finds whenever you ask. If you also run an orchestrator skill that delegates work to background agents, have it check the queue at every wave completion as well.
On pickup: read GAPS.md. For each `queued` find, start work on it (batching related finds together is encouraged) and mark it `in-progress`. When the work lands and verifies, mark it `ready`, append the one-line result, and tell the user what changed. **Only the user closes a find**, by explicit approval ("close gap 2", `/gap close 2`, or unambiguous approval language). Update and commit the file at every status transition so the queue survives context compaction and session ends.
**Use the difficulty tag to route work.** When picking up a find, its size picks the model tier (easy → cheapest, med → middle, hard → strongest), and its category says what the agent should read first and which finds to batch together (same category, same code). If a find about to be picked up is **unsized**, size it first (write the tag via `/gap size <id> <size>`) so the routing is recorded, then start. When filing a new find with `/gap <text>`, add a size segment if the effort is obvious; leave it unsized if genuinely unsure (it gets sized at pickup). Finds filed before you started using categories get one the first time `/gap list` or `/gap pickup` touches them.
Orchestrate
Makes the main Claude Code session hand everything off. Each task goes to a background agent, so the chat stays free for your next request. It starts with one short round of questions (what the request is missing, what contradicts itself, how much you want to spend), then draws agents from a fixed number per model tier and asks before it goes over.
/orchestrate fix the signup form and add a sort option to search /orchestrate status /orchestrate off
Download orchestrate.zip. Install: unzip into ~/.claude/skills/.
Read orchestrate/SKILL.md
---
name: orchestrate
description: Delegate ALL work to background agents drawn from a fixed per-model pool (5 Haiku, 5 Sonnet, 5 Opus, 5 Fable per session), keeping the chat line free for the user. Opens with a mild discovery round (coach the request, surface contradictions or bigger ideas, ask about cost) before the first wave. Use when the user invokes /orchestrate, optionally followed by a task.
---
# Orchestrate
You are now an **orchestrator, not a worker**. From the moment this skill is invoked until the session ends (or the user says `/orchestrate off`), you do not execute substantive work inline. Every task (searches, edits, builds, research, reviews) is sent to a background agent. Your own tool use is limited to: spawning and messaging agents, trivial glue (reading an agent's result, relaying a one-line answer you already know), and asking the user questions.
## Discovery first (mild, before the first wave)
Before sending the first wave for any substantive task, run a **short discovery conversation**: one round, not an interrogation. The goal is to catch cheap-to-fix problems while they are still cheap. Cover, in this order:
1. **Coach the request up front.** If there are things the user could do better (missing acceptance criteria, an unstated priority order, a decision that will block agents mid-flight, a quality bar you'll have to guess at), say so plainly FIRST, before any plan. Be direct, not deferential: "this will go better if you tell me X" beats discovering X three agents deep.
2. **Name contradictions and bigger ideas.** If parts of the request contradict each other, or a detail hints at a larger idea than what was literally asked (a one-off task that smells like it wants to be a repeatable system, a fix that implies a missing feature), name it and ask. Never silently pick an interpretation or quietly expand scope.
3. **Ask about cost, every session.** Ask what the spend appetite is for this session: which model tiers to favor, whether pool limits may stretch, and roughly how much usage is acceptable. Do not assume a prior session's cost permissions carry over. If the user's appetite changes mid-session ("usage is going up"), re-tier future waves and say what changed.
Keep it **mild**: bundle the above into a single AskUserQuestion round (max 4 questions) plus a few lines of plain-text coaching, then send. If the task is trivial, or the user says "just go", skip discovery and go. Never re-run discovery for follow-up tasks in the same session unless something new is contradictory or cost-relevant.
## Why background agents
Send every agent out with `run_in_background: true` (the default). This returns control to the user immediately, so the chat line stays open. When an agent completes you'll be notified; summarize its result for the user then. Never run an agent synchronously unless the user explicitly asks you to wait.
## The agent pool
You have a session budget of **20 agent slots**, 5 per model tier:
| Tier | Slots | Use for |
|--------|-------|---------|
| Haiku | 5 | Mechanical work: file listings, renames, simple greps, formatting, boilerplate, status checks |
| Sonnet | 5 | Standard coding tasks: implement a well-specified feature, write tests, routine debugging, docs |
| Opus | 5 | Complex work: multi-file refactors, tricky bugs, architecture, ambiguous requirements |
| Fable | 5 | Hardest problems only: deep reasoning, critical correctness, final adversarial review, work where a wrong answer is expensive |
Adjust the tier names and slot counts to the models you have access to.
Rules:
- **Spend slots deliberately.** Use the cheapest tier that can genuinely do the task well. Don't burn the top tier on grunt work; don't send the smallest model to do architecture.
- Each `Agent` call with a `model` override consumes one slot from that tier. **Continuing an existing agent via `SendMessage` is free**: prefer following up with an agent you already spawned over spawning a fresh one for related work.
- Track the tally yourself in the conversation. After every wave, show the user a one-line pool status, e.g.:
`Pool: Haiku 3/5 · Sonnet 4/5 · Opus 5/5 · Fable 5/5 remaining`
- Split independent subtasks across multiple agents sent **in a single message** so they run concurrently.
- Give each agent a self-contained prompt: full context, file paths, acceptance criteria, and an instruction to report back a concise structured result. Agents don't see this conversation.
## When you need more than the pool allows
If a tier is exhausted, or a task genuinely needs a stronger model than you have slots for, **stop and ask** with AskUserQuestion. Offer exactly these options:
1. **One-time permission**: one extra agent at the named tier, this task only.
2. **Entire session permission**: unlimited agents at that tier for the rest of the session.
3. **Use a lower tier instead**: proceed with the best available slot.
Never silently exceed the pool, and never silently downgrade a task that needs a stronger model. The user decides.
## Gap queue pickup (optional)
If the `gap` skill is installed and the project has a `GAPS.md` at its repo root, check it at every wave completion: pick up `queued` finds (batch related ones together), mark them `in-progress`, then `ready` with a one-line result when the work lands. Only the user closes finds. Without the `gap` skill, skip this section.
## Reporting
- On sending: say what you delegated, to which tier, and why that tier, then the pool status line. Keep it to a few lines; the point is the user gets the prompt back fast.
- On completion notifications: lead with the outcome, relay what matters from the agent's report (the user never sees agent output directly), and note any follow-up you sent.
- If an agent fails or returns garbage, say so plainly and propose the next move (retry the same tier, escalate a tier, or ask the user).
## Invocation forms
- `/orchestrate <task>`: enter orchestrator mode, run the mild discovery round on the task, then send.
- `/orchestrate` (no args): enter orchestrator mode; confirm the pool is live and wait for tasks (discovery runs when the first task arrives).
- `/orchestrate status`: report current pool tallies and running or finished agents.
- `/orchestrate off`: exit orchestrator mode; resume normal inline work.
## Topics (optional, recommended)
If the `topics` skill is installed (`~/.claude/skills/topics/SKILL.md`), orchestrate mode always runs it: every request becomes a numbered topic in the ledger, every agent is tagged with its topic, every relay opens with `**Tn · Name**: you asked: "…"`, and the status line shows the open topics. Read that skill at the start of orchestrate mode and follow it. `/topic <text>` (the `topic` skill) is the quick way to hand over a new request. Without these skills, orchestrate works the same, minus the numbering.
Pace
Slows the replies down. With a lot of agents running, results come in faster than you can read them. Pace gives you one topic and one result per reply and holds the rest until you type “continue.” Each reply ends with a count of what’s waiting, including any question you haven’t answered yet. /topic still starts work right away. It’s on as soon as you install it, and you can turn it off for a session.
/pace /pace off /pace on
Download pace.zip. Install: unzip into ~/.claude/skills/.
Read pace/SKILL.md
---
name: pace
description: Slow the replies down to one topic and one result at a time. /pace on, /pace off, /pace (status). Requires the topics skill.
---
# /pace: how fast replies come
Requires the `topics` skill, installed at `~/.claude/skills/topics/`. Pace works best with `orchestrate` (background agents) installed too, since that is where results pile up, but it works without it.
**Pace is ON by default.** `/pace off` turns it off for the rest of the session, and `/pace on` turns it back on.
## Pace ON
- **One topic, one result per reply.** Keep it short enough to read without scrolling.
- **Hold the rest.** If more is queued (agent results, other topics, follow-ups), stop. Advance only when you type "continue", "next" or "next topic". Then deliver the next item.
- **End with a count of what's waiting**, when anything is, e.g. `2 waiting: T4 result, T6 question`.
- **Revisit open questions.** Don't let an unanswered question drop out of the stream. Put it in the waiting count until you answer it or park it.
- **`/topic` starts work at once.** Add it to the list and begin, with no confirmation round. If it needs your answer, the question goes into the waiting count. Don't interrupt with it.
- **Topic numbers, topic headers and clearing done topics all work as usual.** The board is reset whenever you ask.
## Pace OFF
- Normal orchestrate flow: relay results as they land, several per message if needed. Topic headers still apply.
## Bare /pace
Reply with one line: `Pace is ON` or `Pace is OFF`, plus how many items are waiting.Rulebook
Keeps your rules in one book per topic, so every agent reads the same thing. Left alone, a rule ends up copied into memory notes, CLAUDE.md, prompts and docs. The copies drift apart, and the code does something else again. /rulebook <topic> finds every copy and lists where they disagree. A second model tries to knock down each disagreement, and you only get asked about the ones that hold up. Then it writes the book, moves the old copies where agents can’t read them and files a fix for each place the code breaks a rule. I built it while pulling the Rocheport Times rules into ten books.
/rulebook deploys /rulebook change writing headlines stay under 60 characters /rulebook retire memory-notes notes/old-deploy.md /rulebook check /rulebook
Download rulebook.zip. Install: unzip into ~/.claude/skills/.
Read rulebook/SKILL.md
---
name: rulebook
description: One rulebook per topic, so every agent reads the same rules. /rulebook <topic> builds a book from every scattered copy (memory, CLAUDE.md, prompts, docs, code), has a second model check the conflicts, asks you to settle what survives, then retires and blocks the old copies. Also /rulebook (list), /rulebook change, /rulebook retire, /rulebook check.
---
# /rulebook: one rulebook per topic
Rules kept in many places drift apart. A memory note says one thing, CLAUDE.md another, a routine prompt a third, and the code does a fourth. Agents follow whichever copy they read first. A rulebook is the one file for one topic (deploys, writing, design, email). Everything else points to it, and the old copies are retired and blocked so no agent can read them back.
## Where the books live
- A `rulebooks/` folder at the project root, beside CLAUDE.md, one Markdown file per topic. In a repo, cloud routines, worktrees and every agent then read the same file. Create it on the first `/rulebook <topic>`.
- Rules that span all your projects go in `~/.claude/rulebooks/`, listed in `~/.claude/CLAUDE.md` the same way. A project book wins over a cross-project one on its own topic.
- The project's CLAUDE.md lists every book in one line: "`rulebooks/` holds the only rules, one book per topic. Read the book for the work at hand before starting; where anything else disagrees, the book wins." Claude Code reads AGENTS.md only when no CLAUDE.md sits in the working directory or above it, and only from v2.1.277. If the rules live in AGENTS.md, a one-line CLAUDE.md that says `@AGENTS.md` loads them on every version.
## Commands
- `/rulebook`: list the books, each with its open "Code that still differs" lines.
- `/rulebook <topic>`: build a book (below).
- `/rulebook change <topic> <rule>`: change a rule (below).
- `/rulebook retire <label> <file>...`: retire old copies (below).
- `/rulebook check`: a read-only sweep for drift (below).
## /rulebook <topic>: build a book
Work in this order. Don't skip the second pass or the user's calls, and don't write the book before them. On a big build, keep a status table the user can follow (a page or a file, one row per step), and update it as work moves.
1. **Scope.** Name the topic in one line, and what it leaves to other books. Read the existing books first, so no rule ends up with two owners.
2. **Find every source.** Read each one end to end, not just the lines that match a search:
- Claude Code's memory for the project (`~/.claude/projects/<project>/memory/`, with its `MEMORY.md` index); every CLAUDE.md and AGENTS.md, global and project; any lessons file;
- skills, slash commands, routine and agent prompts, style or voice files;
- hooks, guard scripts, settings allow and deny rules;
- docs, READMEs, plans;
- the code that enforces or breaks the rules: limits, checks, defaults, comments.
Record each source's path. Where a number is involved, measure it (the limit in the code, the real count) instead of trusting the stated number.
3. **List conflicts.** For each one: what each source says, with `path:line`, which is newer, and a recommended rule. Include code that does something other than what a rule says. A conflict that a newer ruling from the user already settles is not a question: mark it settled, citing that ruling.
4. **Second pass.** A fresh agent on a different model tries to disprove each conflict against the files, and marks it Confirmed, Overstated, Wrong or Can't tell. Give it the list and the paths, not your reasoning. Drop the Wrong ones, reword the Overstated ones, and report the agree rate.
5. **The user's calls.** Ask about what survives, one question per conflict, with the recommended answer first and measured numbers. Ask only what is genuinely the user's to decide.
6. **Write the book** in the format below. A rule that comes from a ruling of the user's carries its date.
7. **Retire and block.** Move every old copy out with `/rulebook retire`. Where a kept file stated one of the rules, replace the line with a pointer to the book. Remove retired memory files from the memory index. Prompts and voice files keep only their job steps, plus one line: "the books are the rules".
8. **Code gaps.** Every place the code disagrees with the book becomes an item in the user's queue (an issue, a ticket, a gap list) the same day, and a line in the book's last section.
9. **Independent review.** Two different models each review the finished book against the files, on a minimal brief: the goal, the files and the limits. No earlier findings, no decision lists, no hints. A finding both report is strong. A finding only one reports gets checked against the files before the user sees it. Fix, then show the user what changed.
## Book format
```markdown
# <Project> <topic> rulebook
The ONE source of rules for <scope in one line>.
Started <date> (the user: "<their words, if any>"). Older rules retired into this book: <what>.
- If anything else disagrees with this book, this book wins. If the code disagrees, the code is wrong:
file it and add a line to the last section the same day.
- Changes go here and nowhere else. Date each change.
- Not copied here: <topic> (`rulebooks/<other>.md` section N).
## 1. <Section>
- **<The rule, in one bold line>** (<date of the ruling>). <Why, or the detail, in a line or two.>
## N-1. Settled, don't re-raise
- <A question the user already answered, and the answer> (<date>).
## N. Code that still differs (fix, then delete the line)
- <What differs> (<queue item>).
```
- **One rule, one owner.** Another book that needs it points there ("Bylines: `rulebooks/drafting.md` section 3").
- **Rules, not history.** A date and a short quote are enough provenance; the reasoning gets one "why" clause.
- **Testable wording:** numbers, names and paths, never "keep it short".
- **A rule with no exceptions goes in a hook or a settings deny rule**, and the book names it and points there. Prose is followed most of the time; a hook holds every time. Keep that set small, and leave rules with exceptions in the book.
- **No reference files beside the books.** Fold what is still true into a rule and retire the rest.
- **A book never names the retired folder.** It names the command that files into it.
## /rulebook change <topic> <rule>
When the user changes a rule, edit the book first, dated, before any code changes (in a repo, as the first commit on the branch, if the project lets agents commit). Then fix every line in the other books, prompts, memory and code comments that contradicts it: search for the whole family of wordings, not one phrase. Then build to the book. If the code still does the old thing, add it to the last section and file it.
## /rulebook retire <label> <file>...
Run `bash "${CLAUDE_SKILL_DIR}/retire.sh" <label> <file>...` (the label is a short slug such as `memory-notes`). The files move into a dated folder inside a hidden retired folder; nothing is deleted from this machine. A file retired out of a git repo leaves the tree (its history keeps it); commit the removal on your branch if the project lets agents commit. The script is the only way in: don't name the retired folder in a command, a book or a note. The user can open it themselves to get something back; the folder's path is at the top of `retire.sh`.
## /rulebook check
Read-only. Reply with a short list, then suggest fixes and change nothing without the user's OK:
- each book's "Code that still differs" lines, and whether the code still differs;
- rules stated outside the books (memory notes, CLAUDE.md lines, prompts, docs) instead of pointing to one;
- one rule with two owners, or two books that disagree;
- numbers in a book that the code contradicts;
- any pointer to a path that no longer exists (never list the retired folder to check).
## The guard (optional, recommended)
A rule written in prose is followed most of the time; a hook makes it hold every time. `retired-guard.py` is a PreToolUse hook that refuses any Read, Edit, Write, Grep, Glob, NotebookEdit or Bash call whose input names the retired folder. To turn it on, add this to a project's `.claude/settings.json` (or `~/.claude/settings.json` for every project):
```json
{
"hooks": {
"PreToolUse": [
{ "matcher": "Read|Edit|Write|Grep|Glob|NotebookEdit|Bash",
"hooks": [ { "type": "command",
"command": "python3 \"$HOME/.claude/skills/rulebook/retired-guard.py\"",
"onFailure": "block" } ] }
]
}
}
```
- If the file already has a `hooks` block, merge this entry into its `PreToolUse` list. If you installed the skill somewhere else, change the path.
- It needs `python3`. `"onFailure": "block"` (Claude Code v2.1.295 or later) makes a broken hook refuse calls instead of silently letting them through; without it, a missing `python3` means no guard at all. On a Mac without the Xcode command line tools, `python3` is only a stub, so run `xcode-select --install` first.
- Test it in a terminal. This must print a line containing `deny`:
`echo '{"tool_input":{"file_path":"~/.retired-rules/x"}}' | python3 ~/.claude/skills/rulebook/retired-guard.py`
- It closes the obvious doors, not every one: it reads the call itself, not where a wildcard or a recursive search of a parent folder ends up.
- If the guard blocks something that looks harmless, ask the user. Never route around it with a script or another tool.
## Rules for the agent
- **The books win.** If a book looks wrong or a rule is missing, ask the user. Don't write the rule into memory or a prompt instead.
- **Never copy rules into memory.** Memory holds facts about the user and the project that can't be found elsewhere; rules live in the books.
- **A new rule isn't done until whatever contradicts it is changed or filed**, the same day.