/bonsai:bakefrom bonsai
Converts CLAUDE.md rules and recurring review findings into automated checks, and removes the prose once a check holds the rule. Run once enough rules have accumulated to be worth automating.
Ships in bonsai. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Judge every CLAUDE.md rule against one question: which tool could enforce this before code lands? A rule a committed check enforces is context spent on nothing, because the violation never reaches review. The check's failure message is where a session meets the rule, so the message carries what the prose carried: what is wrong and what to write instead. The goal is a file where every remaining line needs judgment no tool can express.
Read ${CLAUDE_PLUGIN_ROOT}/references/enforcement.md before the pass. It defines when a check holds a rule, and why no line stays next to one.
Throughout, "automate" means recording a proposal in the report. No config edits and no CLAUDE.md edits before approval, no exceptions.
Every CLAUDE.md file in the project and every enforcement surface it already has: linters and formatters, static analysis, architecture tests, package scripts, git hooks, CI workflows, and the project's committed .claude/settings.json. When the project has more than one CLAUDE.md file, fan out instead of loading them all: build the tool inventory once and hand it with one file to each clean-context agent, the root file included, then merge the verdicts in the main session. A single window holding every file blurs rules across scopes and crowds the tool configurations out of attention.
${CLAUDE_PLUGIN_ROOT}/references/enforcement.md defines it, on the current tree.List the enforcement surfaces present, with the paths each one covers. For a tool that takes custom rules, note how the project tests them (a PHPStan RuleTestCase, ESLint's RuleTester, ast-grep test). Everything later is expressed through these surfaces, in the order of rung R2's kinds in ${CLAUDE_PLUGIN_ROOT}/references/delivery.md:
A rule about how a command is invoked (a required flag, a banned subcommand) that no git event sees takes a PreToolUse deny rule in the project's committed .claude/settings.json, under the tool-hook condition in ${CLAUDE_PLUGIN_ROOT}/references/delivery.md. It holds the rule only for the invocations it sees: when a package script or another command can run the same tool without the flag, the rule is held with a gap and its prose stays. A custom script comes last, only when nothing above can express the check. A redesign of domain code (a state machine) belongs to /bonsai:guard.
Sort every rule into one of four.
delete grouped by cause (class bake:delete:tool-enforced). So does every line or clause that only names the check holding a rule./bonsai:intake records check-shaped candidates (Class: bake) under ~/.claude/bonsai/intake/<key>/ and, when exported, under the project's .claude/bonsai/candidates/. Read ${CLAUDE_PLUGIN_ROOT}/references/intake-entry.md for the key and the format. Read every bake candidate with Status: open or watch under this project's key, and report "no intake entries under <path>" when the directory is missing. Treat a candidate as a rule to automate when its slug appears in two or more source PRs, or when the user names it: a check costs CI time, false positives, and tolerance for the tool, so it earns its place the way prose does. The Check line names the tool and shape intake verified. When a CLAUDE.md line already states the candidate's rule (its Existing coverage may name it), the candidate and the line are one change, which removes the line. Otherwise the change adds the check alone.
Before the report, run the planted-violation check in ${CLAUDE_PLUGIN_ROOT}/references/probe.md for every proposed check. It must fail on the planted violation, and its message must name the fix: read it as a session that never saw the rule would. A formatter needs no message: it must rewrite the planted violation.
Then run it over the untouched tree and sort every hit:
Revise a check that misses the planted violation or flags compliant code once, and drop it to prose with the reason when it still does.
A custom rule ships with its own test, through the harness step 1 noted: the planted violation and a compliant twin. A tool upgrade, a renamed path or a config change can silence a check, and once the prose is gone nothing else would notice. A stock rule turned on in a config needs no test of its own.
Time every proposed check that runs over the tree, and every existing one that holds a rule and runs only in CI. A PreToolUse deny rule for how a command is invoked keeps its tool-hook timing (step 1), since no git event sees it. Propose the earliest moment its time fits, as "The moment a check runs" in ${CLAUDE_PLUGIN_ROOT}/references/delivery.md sets it: a check that takes seconds also runs at pre-commit through lefthook or the repository's hook manager, a slower suite at pre-push, and CI keeps running every one of them. An earlier moment is its own automate change, with the measured time as evidence. Flag on the same pass any check whose failure message names no fix: it holds its rule with a gap (step 2).
Present the decisions in rounds as ${CLAUDE_PLUGIN_ROOT}/references/rounds.md prescribes, at most 5 checks per round, ranked by how often the rule was broken. Every check is a call: it costs CI time and false positives, so the user decides each one. Present the round before touching anything: which rules will be automated and by which tool, which stay prose and why. Read ${CLAUDE_PLUGIN_ROOT}/references/decision-memory.md before routing, then pick the delivery as ${CLAUDE_PLUGIN_ROOT}/references/decision-artifact.md prescribes under "Delivery". For the page, build it with the renderer that reference names.
automate change, titled with the rule it holds ("Format money only through Money::format()"). Its tool names the check's tool and its runs the command, hook or CI job that runs it, and the card shows both in a band under the title. Its edits hold the check, its test, the fix of every violation it found, and the removal of the rule's prose when it has any.delete changes. Rules that stay prose go to kept with the reason.After approval, implement each check with its test, apply its fixes or its baseline, run the project's lint and test commands, and only then remove its prose, under the conditions in "Never". One commit per rule holds its check, its test, its fixes or baseline, and the prose removal, so a reviewer reads one rule's fixes at a time and one revert takes the rule out whole.
Then update the intake entries: after a check lands, set baked: <check> (<PR URL or commit>) on every entry carrying the slug. When you decline because no tool can express it, or the check is not worth its cost, set Class: prose and keep open, with the reason in History, so /bonsai:feed can still propose the prose. Set rejected: <reason> only when the rule itself is wrong or already enforced. Append a dated History line either way.
On a first run, split comes after bake: until the repository has a finished split run (${CLAUDE_PLUGIN_ROOT}/references/rounds.md, "Continue a run"), next holds /bonsai:split, to place the rules the bake left as prose.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub publicala/claude-plugins --plugin bonsai6 skills in this plugin
/auditPrunes CLAUDE.md files to the lines a fresh session cannot derive, every cut backed by evidence. Run when the files have grown without review./feedTurns recurring corrections (conversation, intake entries, recent commits) into CLAUDE.md rules. Run after a working session or a review round./guardTurns review findings into guardrails, one pull request per check, cut from the default branch. Run with PR numbers or URLs after a review round, or once over every PR of a finished run, while the PRs are open or after they merged. A follow-up pass over review threads hands its PRs here before replying. Opens pull requests and replies on review threads.