Repository navigation
feat(hooks): turn a subagent call into a lich session through lich's /subagent veto - #108
Merged
Merged
Conversation
…/subagent veto Every harness but opencode 2 asks lich before its own subagent tool runs and turns lich's deny into the harness's own veto, with lich's reason untouched; every failure to get an answer within 10 seconds lets the native subagent run. hooks/veto-subagent.sh serves Claude Code (and Cursor CLI), Codex, Antigravity, Kiro CLI and Crush, and the opencode and omp modules do the same in process. The Claude Code mod's agent-cards and worker answer are retired with it, along with their prompt texts, docs and the footer's worker count. The subagent-cards fixture is read at lich d33b02a8, in no release yet.
This was referenced Nov 23, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The plugin side of lich's subagent-cards contract (
docs/hooks/subagent-cards.mdin lich, merged at d33b02a8), and the first cut of the Claude Code mod's removal that comes with it.Before the agent's own subagent tool runs, the plugin asks lich at
/subagent. lich opens the task as a card and answersdeny; the client turns that into the harness's own veto with lich's reason untouched, so the native subagent never runs and the model reads why. Every failure to get an answer (no lich, nojqfor the script, a refused connection, 10 seconds without one, a non-200, a body that is not a decision) lets the call run. The client writes no text of its own.hooks/veto-subagent.sh <harness>: one script for Claude Code (Agent, and Cursor CLI'sTaskthrough the same install), Codex (spawn_agent;collaborationspawn_agentsentsealed;collaborationwait_agentas await), Antigravity (invoke_subagent), Kiro CLI (subagent,use_subagentwithInvokeSubagents) and Crush (agent). Tasks are mapped per the contract's table. The token rides theAuthorization: Bearerheader, which lich's/subagenttakes (tokenOf).hooks/hooks.json(matcherAgent|Task),hooks/codex-hooks.json(the three Codex tools; on Windows through the newhooks/win-veto.cmd, sincewin-run.cmddrops the stdout the veto rides),hooks/crush-hooks.json(^agent$), and Antigravity'shooks.json, where the veto is chained after the tool report in the onePreToolUsecommand so a call gets one verdict. Every entry gets 15 seconds, more than the 10 the hook waits. Kiro's are lich's to write (docs/subagent-cards.md, Registration lich writes).opencode/lich.js(1.x,tool.execute.before, throws on deny) andomp/lich.js(tool_call, returns{block: true, reason}) do the same in process. opencode 2 is left out: its tool issubagent, and the contract has no row for it.hooks/agent-cards.js) and worker answer (hooks/worker-answer.js,/mod/answer), the prompt texts only they used, the footer's worker count, their docs and tests, and the vendoredmod-answer.jsonl.tests/fixtures/subagent-cards.jsonlis read at lich d33b02a8, which no release ships yet, the wayrefresh-fixtures.shalready pins mod-commands.What is not measured is listed in
docs/subagent-cards.md:tool_use_idoutside Claude Code, Kiro's payload envelope and itsuse_subagentshape, how omp'scontextjoins a prompt, Cursor CLI's payload, andwin-veto.cmdon Windows. Each one fails to an allow or an empty field when it is wrong. A Codex user has to trust the changed hooks again with/hooks, or Codex skips them silently.Version spots stay at 0.22.0, the release this whole feature ships as; the CHANGELOG's [Unreleased] entry is rewritten into the net change.
Test plan
node --test tests/*.test.mjs: 499 pass, includingtests/subagent.test.mjs: every harness's body for its own call, every fixture answer replayed through each harness's veto (plus a non-ASCII reason with a newline), and the fail-open cases including a lich that never answers.claude plugin test .: 20 pass.claude plugin validate .claude-plugin/plugin.jsonandagy plugin validate .: pass with the warnings they had before.tests/refresh-fixtures.shleaves no diff.