Repository navigation
Description
Discussion issue. No work is committed to yet; this collects the review and the decisions it needs so the team can rule on them in one place.
Full review with ranked candidates, constraints and a worked guard example: https://claude.ai/artifact/GDdfPdEmmyrAkpuMdqBy5B
Capability claims below were re-verified on 2026-10-05 against every page of the mods documentation (overview, interface, events, api, reference, admin, test, troubleshoot). The reference page is now written against 2.1.289.
What changed
Claude Code 2.1.287 (1 Oct 2026) added mods: plugins whose JavaScript/TypeScript event handlers run inside the Claude Code process. A handler sits in a middleware chain and can observe an event, rewrite it, or answer it. Everything it does outside its own code goes through one API object ($), which is what lets claude plugin validate list a mod's events and calls before it runs. Mods are on by default; this repo's machines are on 2.1.288.
What they can do that settings hooks, skills and MCP cannot:
- Draw: a pane beside the transcript, a band above the prompt, the status line, and replace Claude Code's own rows (spinner, tool-call rows, the question dialog). Not the permission prompt.
- Step into a tool call or a request: hold it while asking the user, deny it with a reason Claude reads, or return
allow/ask/denyontool.check. - Keep state across hooks and across hot reloads (
$.state), and per machine ($.store).$.stateresets on/clear,/resumeand/branch, andsession.startdoes not fire again after them; a mod reloads saved values in aclassic.SessionStarthook filtered onsource. - Run a
/commandimmediately without a Claude turn; register tools the model can call; call a model; run timers; message other sessions ($.session.send,session.receive); submit a prompt that waits for idle ($.prompt.submit).$.prompt.submitprefixes a sentence naming the mod as the sender unlessasUser: true, and resolves only when the new turn starts, so it is never awaited while Claude is working. - Fail closed: a
.catchhandler answers when the hook throws or times out.
The hooks module has no Node APIs, no timer globals and no I/O of its own; every file, process, network and UI action goes through $. That fits codev-sdk's zero-dependency, environment-agnostic design (an adapter over $.http) and rules out node-flavoured imports.
Where mods run: hooks run everywhere a plugin loads (terminal, Desktop app, VS Code chat panel, claude -p, Agent SDK, cloud). Drawing works only in the terminal and the Desktop app. Codev's VS Code terminals are xterm views onto Tower PTYs running claude, so panes and bands do draw inside Codev's terminal tabs; an auto-opened pane needs 144 columns (110 once the user has opened it themselves), so the band is the safe surface there.
Not sandboxed: a mod runs with the user's permissions and can approve a tool call that an ask rule or a non-managed PreToolUse hook would stop. It can lift a deny rule too, except where the built-in guard loads (a machine with managed settings, or a Team/Enterprise sign-in). The guard's options (allowManagedModsOnly, allowModsToOverrideDenyRules) and disableSideloadFlags are read from managed settings only. prependPlugins is also honoured from user settings on a machine with no managed settings and no Team/Enterprise sign-in.
Codev today, in mod terms
| Codev mechanism | Today | Mod equivalent | Change |
|---|---|---|---|
| Worktree write guard (#1018) | PreToolUse command hook written into each builder's .claude/settings.local.json by the Claude harness |
tool.call + .catch |
Fails closed instead of open; also sees Bash writes |
| Role injection | --append-system-prompt from HarnessProvider |
prompt.section / prompt.context |
No gain; keep the flag (cross-harness) |
Skills in four copies (.claude/.codex × root/skeleton) |
File copy, parity-tested | One codev plugin holding skills + mods + hooks |
Collapses the two Claude copies; Codex copies stay |
afx send delivery (Spec 1313, #1664) |
Mailbox in global.db, then PTY keystrokes onto a render-gate-verified empty composer | $.prompt.submit waits for idle; session.receive/$.session.send |
The measured gate rule becomes a native wait; contract surface for main |
| Attention / liveness (#1595, #1446) | PTY-silence inference, lastDataAt |
turn.start/turn.complete, tool.check resolving to ask, session.end, classic.Notification |
Ground truth from the harness; this is #1595's own design |
| Status line | Unused | $.ui.status, AbovePrompt band, Spinner suffix |
Per-session place for held mail, gate state, context fullness |
Candidates, ranked
- Gate and git discipline guard (high value, low effort).
tool.callon Bash denyinggit add -A|--all|.,git reset --hard,git checkout -- .,git clean -fd,git stash,git worktree remove,git branch -D builder/*,gh pr merge --squash; holdsporch approvebehind$.ui.ask("Did the human give the word?")..catchdenies on failure. Serves the irreversible-acts rules in CLAUDE.md and Builder worktree write-guard: prevent writes anchored at the main checkout root #1018.$.ui.askrejects inclaude -pand when the user dismisses it, so the default answer is refuse. - Lifecycle reporter for Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 (high, medium). Posts working / needs-input / idle / dead to Tower's keyed workspace API via
$.http.fetch. Fail-open: no data must never read as idle. Filter subagent turns one.agentId. - Last-ask capture for lane card: capture and surface the user's last ask per lane (hook-based, latest-only, loopback-only) #1674 (high, low).
prompt.submitobserver, latest only, loopback only, returnsnext(e)unchanged. - Lane Card terminal renderer for lane card: per-lane status card for fast re-orientation across architect and builder terminals #1672 (high, medium). A third renderer of the same
LaneCardJSON: band chip everywhere, pane on wide terminals; polls Tower on$.clock.every, never spawnsgh. - Context-fullness band + refresh prompt (medium, low).
$.session.usage()percent in the band with the /arch-save threshold;session.measurefires after each turn and when a plan-limit percent changes, so no polling.session.compacttoast, optionally{ skip }once for architects. Any value kept in$.stateis reloaded onclassic.SessionStartafter/clear.$.ui.statusoutput is prefixed with a warning glyph and the mod's name, so the band is the cleaner surface. - Attribution scrub (medium, trivial).
attribution.textreturning empty enforces the no-AI-attribution rule at the source. - Mailbox delivery over native session messaging (high value, high effort, main's contract surface). Keep the mailbox in global.db as the record; deliver to Claude harnesses with
$.prompt.submit; Codex/Antigravity keep the render gate. Open questions: does Claude Code's "idle" match mailbox gate: a recipient that is producing output holds mail until its turn ends — only a human draft should hold (Claude Code queues input mid-turn) #1664's "human not at the line"; and which framing the builder should read, since$.prompt.submitcarries a sender sentence unlessasUser: true. - Arch-init on clear (medium, low).
classic.SessionStartwithsource: clearsubmits/arch-init <name>afterafx whoamiconfirms an architect. Unverified: whether a mod-submitted/arch-init <name>expands as a slash command at all. Spike item. - Codev tools for the model (low).
$.tool.registerfor porch/lane queries (Claude sees them asmcp__codev__<name>); defer. - Thread Now-line writer: do not build. The Now line is the one authored field by design; a mod writing it from
e.answeris self-report without judgment. - Fleet policy mod: conditional.
plugin.registerrefusing builder-installed mods from a prepend-tier mod. On a solo machineprependPluginsin user settings puts it first, but a builder can edit that file, so it is a rule, not a lock; a lock needs managed settings, so documentation for team adopters. - Consult SDK runs: watch item. Hooks fire in Agent SDK sessions; load Codev mods only via the spawn path so consult never sees them, or filter on surface at
session.start. - Issue peek (high, low; owner use case, detail in the 2026-10-05 comment).
turn.completeandprompt.submitscan for#N; the band shows one chip per reference with a digit hotkey; the digit alone opens a user-opened pane (any width, inline above the prompt in a VS Code tab) with title, state, labels, body and newest comments from Tower'sgetIssuepath over$.http.fetch, cached in$.store./issue Nregisteredimmediate: trueopens the same pane mid-turn. Cross-harness floor: an async terminal-link tooltip in apps/vscode (vscode: TerminalLinkProvider — make #N / PR #N references in terminals clickable (issue viewer / browser) #1412 baseline).
Constraints that shape any plan
- Claude-only. Every mod is a Claude-harness optimisation behind HarnessProvider; shell hook, role flag and render gate remain the cross-harness floor. No Codev behaviour may require a mod.
- Load path:
CLAUDE_CODE_PLUGIN_DIRSloads a plugin directory where--plugin-dircannot be passed, so the Claude harness can add it at spawn without touching the user's plugin list; architects install the same plugin from a marketplace. A directory-loaded plugin is addressed as<name>@inlineinpluginConfigs. - Trust: in an interactive session no mod loads in a directory the user has not trusted. Builder worktrees are fresh directories, so the spawn path's trust handling must be checked before a
codevplugin is relied on in builders. - Budgets: 10 s of own time per hook (time inside
nextand mods API calls excluded, except$.clock.sleep),.catchhandlers 1 s,prompt.edithooks 50 ms,$.process.run30 s default (argv list, no shell),$.store4 MiB per machine and non-atomic, one plugin test 5 s default. Tower stays the state owner. - Network policy covers
$.http.fetch: with web fetching off for the org or session, Tower posts from candidates 2 and 4 are refused.$.process.runis not covered. - Failure mode: three hooks-worker crashes unload every non-built-in mod for the session until
/reload-plugins;--safe-modeand--baredisable installed mods. A mod guard is a second line; porch, branch protection and the human stay authoritative. - Ordering: managed
PreToolUsehooks run before any mod; other settings hooks run after the last mod and are skipped if a mod answers withoutnext. If the write guard stays a shell hook while a Codev mod answers Bash calls, the hook is bypassed for those calls. Migrate both into one mod or always callnextfor file tools. - Testing:
claude plugin testruns without a session, stubs Claude Code's answers, mounts drawings, and exits 1 on failure; fits the CI matrix.
Proposed sequence (for discussion)
- Spike, run as EXPERIMENT Spike: Claude Code mods for Codev (guard, attribution scrub, context band, issue peek) as an EXPERIMENT for #1761 #1782 (owner-directed 2026-10-05; replaces the earlier "uncommitted, in an architect session" plan so the hypothesis, method and numbers leave a record under
codev/experiments/): candidates 6, 1, the band from 5, and 13 (13 proves the band-chip-to-pane pattern that 4 depends on). The builder writes, validates and plugin-tests the mod; the two live-session questions are answered by a handoff command the vscode architect runs in a Tower terminal, so no builder loads a mod into its own session. Questions to answer: does the$.ui.askhold behave inside a Codev PTY under Tower while the render gate is holding mail; does a mod-submitted/arch-init <name>expand as a slash command; how does a fresh worktree's trust prompt interact with mod loading; and does a digit-hotkey band chip reach a user-opened inline pane acceptably inside a Codev VS Code terminal tab. - Ship a
codevplugin from the package; Claude harness setsCLAUDE_CODE_PLUGIN_DIRSat spawn, version-gated on 2.1.287; write guard migrated in with the shell hook kept as fallback; plugin tests in CI. AIR or PIR under area/tower (touches harness.ts). - Re-scope Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 and lane card: capture and surface the user's last ask per lane (hook-based, latest-only, loopback-only) #1674 to mods and build them as one lane posting to Tower. lane card: per-lane status card for fast re-orientation across architect and builder terminals #1672 is at its spec gate and treats Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 as its ground-truth feed, so its plan should know the feed is a mod.
- Lane Card pane as 1672's third renderer, at plan time, after
afx cardproves the data model. - Spec candidate 7 as a SPIR under main's contract seat, after 2 and 3 have shown a Codev mod living reliably in every Claude session.
Decisions needed
- Distribution: ship a
codevClaude Code plugin from the package (also collapsing the two Claude skill copies)? - Builder trust stance: state in the builder role that builders do not install or author mods, and that the spawn path is the only loader. Rule, not lock, for solo use.
- Re-scope Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 and lane card: capture and surface the user's last ask per lane (hook-based, latest-only, loopback-only) #1674 to mods now, before 1672 plans against them? The split already proposed on Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 fits; only the mechanism line moves.
Where the first spike runs: an architect session withRetired 2026-10-05: the spike runs as EXPERIMENT Spike: Claude Code mods for Codev (guard, attribution scrub, context band, issue peek) as an EXPERIMENT for #1761 #1782 with a live-session handoff to the vscode architect.--plugin-dir.- Codex/OpenCode parity: accept Claude-harness-only features with the existing mechanisms as the floor, and say so in the skeleton docs.
Refs: #1018, #1595, #1674, #1672, #1729, #1446, #1664, Spec 1313, #1365, #1473.
Activity
amrmelsayed commentedon Oct 5, 2026
Codex: do these extension points exist there?
Checked 2026-10-05 against the Codex docs and tracker. Short answer: no in-process extension point and nothing that draws in the Codex TUI. Every surface a mod adds or redraws (pane, band, toast, log line, redrawn message and tool rows, spinner, question dialog, hint line) has no Codex counterpart. The non-visual half of the value is reachable through three out-of-process routes.
What Codex has
requirements.toml) are trusted by policy.model,approval,context_usage,session_id,sandbox,cwd,spinner; terminal title items, themes, keymaps, and notifications via anotifycommand or OSC 9 / bell. No custom text, no command-backed items. A command-backed status line is an open request since April (#17827; #20244 closed as its duplicate).--remote. Whether a second client can observe the same thread beside the TUI is undocumented.Candidates on Codex
$.ui.askhold: no. Fail-closed on hook failure: unstated.continue: false). No threshold marker, no band.codex exectoo (12).So the framing above holds: mods are a Claude-harness optimisation, the shell hook and render gate stay the floor, and a Codex session in Codev gets the reporter and the deny half of the guard, not the visuals or the hold.
Owner use case: peek at an issue referenced as
#1234without leaving the terminalToday (#1412) a
#Nin a terminal is a VS Code terminal link: cmd+click resolves it through the forge and opens the in-editor issue viewer or the browser. That is a separate view every time. The only in-place affordance the VS Code terminal-link API offers is a plain-string tooltip, so richer peeking has to come from one of the points above.Mod route (Claude harness, any terminal: Tower web, VS Code tab, plain shell). Proposed as candidate 13, Issue peek (high value, low effort), and the strongest spike exercise so far because it touches band, pane and a fetch in one small mod:
turn.completescanse.answer, andprompt.submitthe typed text, for#NandPR #N. The band shows one chip per reference with a digit hotkey:1 #1672 Lane Card · spec gate 2 #1131 resolve state · plan gate. A digit hotkey on a band button fires when the user types the digit alone into an empty prompt and pauses, so the peek costs one keystroke and no mouse.$.ui.openwithfocus: trueandcloseOnEscape: true. Because the user opened it, the pane appears at any width: beside the transcript on a wide terminal, inline above the prompt in a VS Code tab. The pane draws title, state, labels, body asMarkdown, and the newest comments; hotkeysoopens the forge page,ccopies the URL, Esc closes.getIssuepath over$.http.fetch, the same path vscode: TerminalLinkProvider — make #N / PR #N references in terminals clickable (issue viewer / browser) #1412's click uses, cached in$.storefor the session. Noghspawned per session./issue 1234command registered withimmediate: trueopens the same pane while Claude is working.AssistantMessageasMarkdownwithpressableLinksso the#1234text itself is pressable. That replaces Claude Code's own rendering of every reply, and whetheronLinkPressreceives the href is unverified.Cross-harness floor (area/vscode, both harnesses).
provideTerminalLinksmay return asynchronously, so the tooltip on hover can carry#1672 · Lane Card · open · spec gatefrom a cached Tower lookup. One line, not a body, but it answers "which issue is this" without a click. Worth its own small item regardless of the mods decision.Codex: nothing in the TUI; the VS Code tooltip is the only peek.
Proposed change to the sequence: the spike runs candidates 6, 1, the band from 5, and 13, since 13 is the owner's own daily friction and proves the band-chip-to-pane pattern that candidate 4 depends on.
[Spec 1782] Spike: Claude Code mods for Codev (guard, attribution scr…
[Spec 1782] Record Q3/Q4, trust from spawn code, findings 12-13, conc…
amrmelsayed commentedon Oct 5, 2026
Visual review (public artifact, updated with the spike outcome): https://claude.ai/artifact/GDdfPdEmmyrAkpuMdqBy5B
Spike #1782 complete: hypothesis held. Recommendation on decisions 1 and 2
Phase 1 of the sequence above ran as EXPERIMENT #1782 (PR #1786 merged, 0c4d1fc; record in
codev/experiments/1782-claude-code-mods-spike/notes.md). Engine-side: validate passes, 16 tests pass on both surfaces, every hook's own time 0 to 1 ms. Live, in an 80-column Codev VS Code tab: the hold draws and fails closed, the digit chip opens the issue peek inline,/issueworks mid-turn, re-init after/clearworks through$.command.run, and the mod is live after the trust prompt with no reload.Decision 1, ship a
codevplugin: the spike says yes, staged. Guard and attribution scrub first (no drawing risk); band and issue peek second with labels fitted tobodyColumns, the workspace root sent to Tower, and a prefetch or Tower-side cache for the ~1 s cold issue lookup; the plugin loads from the installed package folder, never a path a session writes; CI warmsclaudewith one networked run beforeclaude plugin testand adds aclaude -p "/cmd" --plugin-dirprobe. Before relying on it in builders, check the one trust case left open: a builder launched without skip-permissions in a worktree outside a trusted parent (afx spawndoes not pre-trust).Decision 2, builders neither install nor author mods and the spawn path is the only loader: the spike says yes, strengthened. During the live run a session with the spike mod loaded, hot reload on, rewrote that mod in the builder's worktree and the change applied at once. The rule costs authoring nothing: the whole spike was built, validated and tested without loading a mod into a builder session.
Corrections to the review from the spike: candidate 8 uses
$.command.run, not$.prompt.submit(a host check rejects any submitted text beginning with/); a.catchhandler must do nothing that can fail, since one that throws leaves the hook absent and the command runs; the render-gate-under-hold question stays open and moves to candidate 7.Decisions 3 and 5 are unchanged by the spike and still open.