/bonsai:intakefrom bonsai
Records pull request review threads as local evidence for feed and bake. Run after a review round with the PR number or URL, or with `--search` over a reviewer's past PRs to start from history, `--export` to share candidates through the repo. Never commits, never touches the threads.
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 review thread against one question: which CLAUDE.md line or automated check would have prevented this? A finding with no such answer is not evidence for bonsai, however valid it was as a review comment. The goal is a small set of verified candidates that feed and bake can act on once the same mistake recurs.
Throughout, "record" means writing an entry file. Proposing rules is feed's job. Wiring checks is bake's job.
Entries live under ~/.claude/bonsai/intake/<repository key>/pr<number>.md, outside every repository. Review threads quote customer names, internal service names, and unreleased design, so the ledger never leaves the machine. With --export, the candidate sections alone (rule text, target, symbols, ratio, evidence links) are also written to .claude/bonsai/candidates/pr<number>.md inside the target repository, uncommitted, so the team's recurrence count is shared. Before exporting, check that no candidate's Mistake or Rule names a customer, a person, or a system that the target repository does not itself name.
The repository key, the file layout, and what a rerun may change are defined once in ${CLAUDE_PLUGIN_ROOT}/references/intake-entry.md. Read it before writing anything.
<repository key> is the repository the candidate targets, which is not always the repository under review: a review on a client library can surface a rule for its host application. Write each candidate under its target, so feed run there finds it.
Recurrence counts distinct PRs, so a rule reaches feed and bake only once two reviews show it. To start from history instead of waiting for it, intake takes several PRs of one repository: numbers or URLs, or --search "<query>". Entries are named by PR number alone, so two repositories' PR 7 would share a file under one target: refuse a list that mixes repositories, and run one batch per repository.
--search resolves with gh pr list --repo <key> --state all --search "<query>" --limit <n> --json number,title,state,mergedAt, where <key> is the repository key of the current directory, so a fork clone searches the canonical repository. --limit defaults to 20.
The query takes GitHub's search syntax, for example is:merged reviewed-by:jdoe merged:>=2026-09-01. A review bot that is a GitHub App takes reviewed-by:app/<slug>, its login without [bot] (acme-review[bot] is reviewed-by:app/acme-review), since the bare login fails the search.
source_pr is the PR's URL), unless the user passes --rerun. Its candidates may target another repository, so the current key alone can miss it. A batch run twice then reads nothing new.Resolve the PR from the argument (a number resolves against the repository key of the current directory). Read the PR body, the final base-to-head diff (gh pr diff), and the merge state (gh pr view --json state,mergedAt). Inline review threads and their resolved state are GraphQL-only: query reviewThreads with isResolved, isOutdated, path, and each thread's comments, paging with after until hasNextPage is false. gh pr view --comments returns issue comments and review bodies only, so an intake built on it classifies an empty thread list. Add the review bodies and issue comments from gh pr view --json reviews,comments for context.
Read each whole thread before judging any comment in it. The last reviewer message decides the thread's state, and a request the reviewer later withdrew leaves no task.
Before classifying anything, read every existing entry under the target repository key. For each candidate whose status is frozen-until: <PR>, check that PR's merge state with gh. When it has merged, re-verify the candidate's symbols against the default branch (step 5) and set it open. When it was closed without merging, set rejected: <PR URL> closed unmerged: the symbol the rule names never landed, and a later PR that lands it produces its own intake. Either way, add a dated History line. This sweep runs on every intake, whatever PR it targets, so a frozen candidate does not depend on anyone remembering to rerun intake on the PR that froze it.
Classify every thread, one row each, with its outcome:
The outcome column holds either the slug of the candidate the thread feeds or the reason it feeds none. On a rerun, the ledger is what tells intake which threads it already processed, so a thread appears once and only here.
Keep the threads where the fix would be a CLAUDE.md line or an automated check in some repository. Drop the rest with the reason in the ledger:
A preference the codebase seems to teach already is not dropped: the loaded session's guess about what a fresh session derives is not evidence, and a wrongly skipped rule is gone for good. It becomes a watch candidate, and feed's probe decides.
Verification runs against the target repository's default branch at a recorded commit, because the PR may not merge, and a rule that cites code only the PR adds teaches a symbol that does not exist.
For each surviving finding, record:
Every candidate gets one class and one status.
Class:
Status, in precedence order (the first that applies wins):
watch and runs its probe.open when the author fixed the instance and the PR merged: the code teaches the wrong pattern, so the line is the only corrective, and the recorded ratio shows feed how wrong. A contradicted rule whose fix was declined is watch, because the disagreement is a design decision the proposal must surface.Feed and bake later write encoded, baked, or rejected. Intake writes rejected only from the sweep, and never overwrites a status feed or bake set.
The slug names the mistake a session makes, such as bridge-import-outside-facade. The mechanism the reviewer saw (store-imports-comlink-directly) stays out of it. Two findings share a slug when a fresh session would make both by ignoring the same rule, even when file, symptom, and reviewer differ. Read the slugs already present under the target key and reuse one before minting another. Recurrence is never stored: feed and bake count entries carrying the slug when they read.
Write each candidate's rule text or check shape in final form, following ${CLAUDE_PLUGIN_ROOT}/references/rule-writing.md. Feed copies this text into its proposal, so it must already be a CLAUDE.md line. Never record the reviewer's wording as the rule: the correction is evidence.
Close with a compact table: candidate slug, class, status, target file, and the count of entries under the key that share the slug. Then one line per dropped thread with its reason. Say which candidates feed or bake will pick up on their next run, which are frozen and on what, and which the sweep reopened.
--export candidate file, and never commit.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub publicala/claude-plugins --plugin bonsaiOther plugins' skills for the same job
6 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./bakeConverts 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./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.