Repository navigation
feat(claude-code): plannotator tool for agent-initiated opens under the mod - #1673
Merged
Merged
Conversation
…he mod When the user asks Claude to "open this in plannotator", Claude ran the CLI through Bash, which blocks the session and gives Ask AI a separate AI. With the mod on, Claude now gets a real `plannotator` tool ($.tool.register) that goes through the same detached launch as the slash commands: it returns at once, the decision arrives later as a plugin turn, and Ask this session works. - packages/shared/plannotator-tool.ts: the one contract (name, schema, description, strict validation, argument mapping, result text) Pi and OpenCode can adopt later; the mod keeps a byte-for-byte copy with a parity test (hooks modules import only their own folder). - Registered only when the mod is enabled, interactive and not Windows. - A gated tool session delivers a bare Approve as a turn; Done/Close send nothing; slash-command behavior is unchanged. - Core plannotator skill: one host-neutral line to prefer the tool.
…nt; assert no tool in -p sessions
1 task
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.
Why
When the user tells Claude "open this in plannotator", Claude follows the
plannotatorskill and runs the CLI through Bash. That blocks Claude, and Ask AI then uses a separate AI. The mod (#1672) already makes the slash commands non-blocking. This PR gives agent-initiated opens the same behavior: Claude gets a real tool instead of the CLI.What
packages/shared/plannotator-tool.ts: nameplannotator, JSON schema, description, strict validation, argument mapping and result text. Input:{ action: "annotate" | "review" | "last", target?, gate? (annotate), options?: { base? (review --base), markdown? (annotate --markdown) } }. Pi and OpenCode can adopt it later; they are not touched here.apps/hook/hooks/mod/tool.ts, because a hooks module may import only its own folder.tool.test.tsfails if its CONTRACT section differs byte for byte from the shared file.$.tool.registerruns atsession.startonly when the mod is on, the session is interactive and/bin/shexists. With the switch off, in-pruns and on Windows, nothing is registered.tool.callhook and use the same launch as the slash commands (PlannotatorMod.open): detached CLI, host result file, bridge token, session tag, cleanup. The tool returns at once and tells Claude to end its turn and wait. A bad call or a CLI startup error comes back as an error result.gate: true) delivers a bare Approve as a turn, because Claude was told to wait for the sign-off. Done and Close send nothing. Slash-command behavior is unchanged.plannotatorskill: if your agent has aplannotatortool, use it instead of the CLI.Out of scope: Pi, OpenCode, plan review (stays on ExitPlanMode), intercepting Bash
plannotatorcommands. Gated--jsonCLI runs are unchanged.Verification
bun run typecheck, fullbun test(5908 pass, 0 fail),claude plugin validate apps/hook(passes, lists$.tool.register),scripts/test-claude-code-mod.sh(9 pass, including 3 new tool cases).--plugin-dir, a CLI built from this branch on PATH,PLANNOTATOR_CLAUDE_MOD=1and a temp data dir:plannotator - plannotator (MCP), not Bash. The call returned in about 2 s and the page served./api/feedbackarrived as a plugin message, and Claude acted on it.--gate, and Approve arrived as "Plannotator: notes.md — Approved."Known limitation
$.tool.registertools are deferred behind tool search; it cannot setalwaysLoad. Claude sees only the tool's name until it searches. With the updated skill line, Claude searched for the tool and called it. In a profile that still had the older installed skill text, Claude loaded that skill and ran the CLI. Users therefore need the refreshed skill, which the installer provides.