Plan · ox plan review × Claude Code mods · draft
Bring plan review feedback into the running Claude Code session
Reviewers already mark up a plan in the browser. Today their comments wait until someone goes back to the terminal. A Claude Code mod can watch for new comments, show them beside the conversation, and hand them to Claude the moment it is free.
TL;DR
Proposal
Ship a Claude Code mod that closes the review loop
The mod watches the plan for new review rounds. It shows open comments in a pane and a one-line band above the prompt.
When Claude is idle, the mod submits the round as a prompt. Claude addresses it, re-renders, and the browser reloads.
Biggest risk
Reviewer text becomes a prompt Claude acts on
A comment that says "delete the tests" must not read as an order. The mod never pastes comment text into the prompt body.
It submits a fixed ox-authored prompt. Comments arrive only as fenced data from ox plan review await.
One review comment, end to end
Follow Avery's comment from the browser to Claude and back. Toggle between today and the mod. Red steps cost a human's attention or block Claude.
Today: Avery submits, the server writes the round, Claude stays idle or blocked, Devon returns to the terminal, Claude resolves, the page reloads. With the mod: the watcher picks up the round and submits it within a second, with no one at the terminal.
What changes for the reviewer
0trips back to the terminal per review round, down from one ~secondsfrom Submit in the browser to Claude starting work, when Claude is idle 0blocking await calls that park Claude for up to ten minutes 1new install step, inside the existing sageox marketplace
Cost and shape
Two small ox CLI changes do most of the work, and they help every coding agent, not only Claude. The mod itself is a thin relay of about 300 lines. It holds no review logic of its own.
Gate before building. Mods are early access. The API may change between releases. They need Claude Code 2.1.287 or later; this machine runs 2.1.281. Phase 0 is a one-day spike that proves the three calls we depend on.
Decisions needed from you
Four calls, each with a proposed default. See the Decisions tab. Two touch ADR-025 vocabulary and need Ryan's review.
What you see
What Devon sees in the terminal
Devon asked Claude to draft a plan and opened the review. Avery leaves two comments in the browser. Click an item in the pane to see what each button does.
/plan-review auth-token-refresh Review open at http://127.0.0.1:52114/ (browser opened) Watching for review rounds. Claude will pick them up when idle. ● ox · review round from Avery · 2 open items Addressing 2 review items on auth-token-refresh. ⎿ Edit plan.html (Rollout section) ⎿ ox plan feedback resolve … h3f9a1c2 --state addressed ⎿ ox plan render (browser reloaded) Both items addressed. Avery's page shows them resolved. Plan review · auth-token-refresh ◆ auth-token-refresh · 1 open from Avery · 1 addressed · not approved > type here; review rounds wait while you are typing
What the mod does when a round arrives
Every round ends in exactly one place. Green paths need no one at the terminal. Gold paths wait for Devon.
The cursor advances on every exit, so a round is never submitted twice. Typing in the prompt box counts as busy.
Surfaces the mod draws on
| Surface | When it shows | What it says |
|---|---|---|
| Band above the prompt | Any plan under review in this session | Slug, open count by reviewer, approval state |
| Review pane | On /plan-review, or the first round that arrives | Each open item, its section, reviewer, and actions |
| Toast | A round arrives while Claude is busy | "Avery sent 2 comments. Claude will pick them up next." |
| Transcript line | The mod submits a round | An attributed line, so the human sees why Claude started |
How the mod works
A mod is a JavaScript module that Claude Code loads once per session. It hooks session events, keeps state, draws UI, and calls back into Claude Code. Ours relays every decision to the ox CLI and keeps none of its own. Click a piece to see what it does.
Why the logic stays in ox
Codex and other agents cannot load mods. If the review rules lived in the mod, those agents would silently get a weaker loop. The mod renders and schedules; ox decides. This is the same thin-relay rule our ox-* skills follow.
Safety
Safety: who can make Claude act
Submitting a prompt on someone's behalf is the most powerful thing the mod does. Each risk below has a guard, and every guard is testable.
| Risk | Likelihood | Guard |
|---|---|---|
| Comment text read as an instruction | High | The submitted prompt is a fixed ox template. Comment text rides in a fenced data block that ox marks untrusted, as ADR-025 requires. |
| A web page in another tab forges a review round | High | Today the server checks no Host or Origin header, and the page hands out its token. A rebinding attack could post a round, and the mod would submit it. Phase 1 adds the header checks before any auto-submit ships. |
| A teammate's comment starts work on my machine | Medium | Reviewer names are typed into the browser, so they prove nothing. The local server stamps its own rounds. Only those auto-submit. Rounds that arrive through Ledger sync show and wait. |
| Claude interrupts the human mid-sentence | Medium | Submit only when no turn runs and the prompt box is empty. Otherwise queue, toast, and offer a suggestion. |
| Unattended token spend | Medium | Auto-submit is armed per plan by /plan-review. A cap of five auto rounds per hour disarms it with a notice. |
| Mod API breaks on a Claude Code update | Medium | Ship as a separate plugin during early access. Classic prime hooks keep working if the mod fails to load. |
| Approval taken as permission to build | Low | The mod reports approval. It never starts implementation on its own. ADR-026 gating stays a separate decision. |
Rollout
Four phases. The CLI work in phase 1 ships value to every agent even if the mod never lands. Gold borders are go or no-go gates.
Phase 0 · spikePhase 1 · CLIPhase 2 · mod MVPPhase 3 · pane + tools ox CLI Harden the server, await only new rounds, run the server in the background, add a status command Fixed prompt text carried in the await JSON Claude mod Prove three calls in a throwaway mod. Idle submit, a long process wait, and both hook kinds in one plugin. /plan-review, the watcher, the band, idle auto-submit, cleanup at session end Review pane with actions, typed tools, re-render on plan edits Tests Go E2E against a real ledger. Red-first. claude plugin test with mocked process and clock BDD capability with a red-first proof Docs and review ADR-025 amendment for the new mechanism. Ryan reviews. Install guide in the marketplace README Dogfood with the SageOx team, then publish
Decisions
Each card proposes a default. A "yes" is enough to proceed.
D1 · Ryan
Is mod auto-submit the "real-time" delivery class?
ADR-025 names three classes. Today real-time means Claude blocks inside await. The mod gives the same agent the comment within seconds, without blocking.
Default: yes. Add it as a second real-time mechanism. No new word.
D2
Whose rounds may auto-submit?
Rounds can come from any teammate through the Ledger. Letting a teammate start work on your machine is a trust step.
Default: only rounds written by this machine's review server. Synced rounds show and wait.
D3
Ship inside the ox plugin, or beside it?
One plugin is one install. But an early-access API break could take down the prime hook with it.
Default: a separate ox-review plugin in the same marketplace. Fold it in once mods leave early access.
D4 · Ryan
Who hosts the review server?
A mod cannot keep a child process alive. Something else must own the server. The daemon could, but ADR-025 keeps the server agent-owned.
Default: ox plan review --detach. It starts a background server and prints its address. No daemon change.
Implementation notes
Implementation notes
What exists today
cmd/ox/plan_review.goserves the page on 127.0.0.1 with a token. The port is stable per plan, and a second start reuses a live server found through/healthz. Port and token persist in the Ledger cache at mode 0600. Routes:/feedback,/accept,/reopen,/approve,/events(SSE reload). It runs in the foreground, with a 30-minute idle timeout.- The server has no Host or Origin check, and
GET /embeds the token without auth (plan_review.go:263-509). cmd/ox/plan_review_await.goblocks on fsnotify until open feedback exists. It returns JSON{slug, status, open[], contested[], counts}. It returns immediately if any item is still open.cmd/ox/plan_feedback.gohasshow --json,resolve <slug> <anchor> --state --commit --note, andapply.internal/plan/feedback.gostores immutablefeedback/round-*.jsonrounds and an append-onlyresolutions.json.AssembleReviewmerges them.- Each
/feedbackPOST also enqueues aKindPlanFeedbackagent task (plan_feedback.go:138-179). It surfaces only on the human's next prompt, through the UserPromptSubmit hook. This is the delegated class. MergedItemfieldsRaisedAt,Resolution, andOpenhave no json tags (feedback.go:122-132), so their keys are capitalized.- The browser sees only an item's state. Claude's resolution note and commit never reach the page (
render.go:97-106). claude-plugin/is theoxplugin in thesageoxmarketplace (.claude-plugin/marketplace.json). It declares classic SessionStart and PreCompact hooks inline inplugin.json.
Phase 0 · spike (one day, throwaway)
- Upgrade to Claude Code 2.1.287 or later. Confirm function hooks are enabled for our accounts.
- Build a scratch mod. A
$.clock.aftercallback calls$.prompt.submitwhile the session is idle. Confirm the turn runs and the transcript attributes it to the plugin. - Call
$.process.run(["sleep","540"], {timeoutMs: 600000})from a background callback. Confirm the session stays responsive. - Put a
hooks/hooks.jsonwithmodulesbeside classic hooks in one plugin. Record whether both load. This settles D3. - Go or no-go. If
prompt.submitfrom a timer fails, fall back to$.prompt.suggestplus the band. That still removes the window switch, but not the keypress.
Phase 1 · ox CLI (helps every agent)
- Harden the server first. Reject requests whose Host is not
127.0.0.1:<port>orlocalhost:<port>. Reject POSTs whose Origin differs. This is a precondition for auto-submit. ox plan review await <slug> --after <cursor>. Block until a round newer than the cursor lands. Returncursorin the JSON. Without the flag, keep today's behavior.- The live server stamps
origin: "local-server"on rounds it writes. Rounds fromfeedback applyor Ledger sync carry no stamp. The await JSON exposes it per item. Supports D2. - Add json tags to
MergedItemso the mod reads stable lowercase keys. - Add a
promptfield to the await JSON. It is the fixed agent-facing text, with items fenced as untrusted data. The mod submits it verbatim. ox plan review <slug> --detach --jsonstarts the server in the background and prints{url, port, pid}.ox plan review stop <slug>stops it. Opening the browser stays inside ox throughcli.OpenInBrowser.ox plan review status [<slug>] --jsonreads the saved server state andAssembleReview. It feeds the band after a reload.- Carry the resolution note into the page state so Avery sees what Claude did, not only a check mark.
- Go E2E tests against a scratch ledger. Prove red-first that
--afterdoes not return already-seen rounds. Prove a forged Host header gets a 403.
Phase 2 · mod MVP
- New plugin
claude-plugin-review/(nameox-review), listed in.claude-plugin/marketplace.json. Layout:.claude-plugin/plugin.jsonwithtypes,hooks/hooks.jsonwithmodules,hooks/register.ts,types/index.d.ts,tests/. - State in
$.store, never module variables, because hot reload re-runsregister. Keys: armed plans, cursor per plan, auto-submit count per hour, queued rounds. /plan-reviewvia$.command.registerand acommand.runhook.- Watcher: a
$.clock.after(0, loop)callback that awaits$.process.runon the await command, then re-schedules itself. Exit codes andstatus: timeoutjust loop. - Idle detection: track
turn.startandturn.complete(main agent only, filtere.agentId). Check$.prompt.read()returns empty text before submitting. - Band via
ui.renderonAbovePrompt. Read props frome.props. session.endcallsox plan review stopfor servers this session started.- Tests with
claude plugin test, usingmock.clockand anon('process.run')stub that returns canned await JSON.
Phase 3 · pane and tools
$.ui.open({id:"plan-review"})and aPanerender hook. Buttons with hotkeys for open, ask, and won't fix. Fall back to the band below 110 columns.$.tool.registerforresolve,render, andstatus, served bytool.callhooks that relay to ox with--json.- Observe
tool.callfor Edit and Write on an armedplan.html. Afterturn.complete, runox plan saveandox plan render. - BDD capability under
tests/acceptance/features/plan/: "Devon's reviewer comment reaches Claude without Devon returning to the terminal." Proof: a Go E2E that writes a round and asserts the await JSON and cursor. The mod half is covered byclaude plugin test. - ADR-025 amendment covering D1, D2, and D4. Ryan reviews.
Gotchas
- The API is early access. Pin the minimum Claude Code version in the README. Re-run
claude plugin validateon every Claude Code bump. - A hook gets 10 seconds of its own time. Never await the watcher inside a hook. Start it from a timer callback.
- Do not put comment text in a
$.ui.toastor the band. Show counts and names only. The pane may show text because it is not sent to the model. - Each round also enqueues a delegated agent task. When the mod has submitted a round, mark that task done, or Claude sees the same feedback twice on the next prompt.
ox plan render --file plan.html --openopens a static page, not the live loop (plan.go:1067-1078)./plan-reviewmust use the slug form. Fix the file form separately.- Two sessions watching one plan would both auto-submit. The cursor is per session, so add a lock in
ox plan review statusthat names the arming session.

