Document the repo tool execution contract (docs audit) - #957
Merged
Conversation
Repo Tools deep-dive against repo-tools.ts, shared/mcp/server.ts, lifecycle-hooks.ts and run-command.ts. The built-in tool list checked out in both directions; the gaps were all in how `.dispatch/tools.json` actually behaves: - Commands are spawned directly, not through a shell, so pipes/globs/`&&` silently don't work. - `name`, `description` and a non-empty `command` are required, and one malformed entry throws during the manifest load — every `repo_` tool disappears, with nothing that reads like a parse error. - Repo tools allow every exit code (allowedExitCodes 0-255), so stdout comes back as the text result with exit code/stdout/stderr alongside; a non-zero exit is something the agent reads, not an error. Dispatch sets no timeout on them, unlike the 15s lifecycle hooks. - The manifest is re-read per tool listing (only hooks are mtime-cached), but the agent's CLI holds the list it fetched at session start, so a newly added tool needs a new session while an edited command does not. Also adds an ambient tip for `.dispatch/tools.json` — the feature has no UI surface at all and had no tip — and fixes the plugin skill's claim that a colliding tool name is rejected at load: BUILTIN_TOOL_NAMES holds unprefixed names and the check tests the `repo_`-prefixed one, so it can never fire. The prefix is what prevents collisions. CLAUDE.md's project tree gains plugins/ and release-notes/. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Nightly docs audit — Repo Tools deep-dive (the
next_focuscarried over three runs), checked againstapps/server/src/shared/mcp/repo-tools.ts,shared/mcp/server.ts,agents/lifecycle-hooks.tsandshared/lib/run-command.ts.Verified clean: the docs-pane built-in tools list matches
AGENT_TOOLSas a set in both directions (63 entries), therepo_prefixing and dot-sanitization claim, the "runs at the root of the agent's checkout" claim (toolsRoot = worktreeRoot ?? repoRoot), theagent/jobscope pair (reviewerremains reachable inVALID_SCOPESbut is never set — deliberately undocumented), and the hooks' 15s / best-effort claims.Fixed — docs-pane
tools.tsx:&&don't work.name,descriptionand a non-emptycommandarray are required, and one malformed entry throws during the manifest load, which surfaces as everyrepo_tool disappearing rather than as a parse error.allowedExitCodes0–255), so stdout is the text result with exit code/stdout/stderr alongside — a non-zero exit is something the agent reads, not an error. Dispatch imposes no timeout on them, unlike hooks.name/type/flagrequired,descriptionis what the agent reads.Fixed —
plugins/dispatch/skills/repo-tools/SKILL.md: the claim that a name colliding with a built-in is "rejected at load" is false —BUILTIN_TOOL_NAMESholds unprefixed names while the check tests therepo_-prefixed one, so it can never fire. Reworded to say the prefix is what prevents collisions. Also tightened "run from the repo root" to the agent's checkout root, and noted the no-shell spawn and the hook's 15s timeout.Tip (Phase 2b): added an ambient
repo-toolstip..dispatch/tools.jsonhas no UI surface whatsoever and had no tip, which is exactly the discovery gap tips exist for. Links to the Repo Tools docs section.CLAUDE.md: project tree gainsplugins/(new in #952) andrelease-notes/(referenced by a whole section but absent from the tree).Deferred to next run: the Dispatch plugin (#952) has README coverage but zero in-app docs — a docs-pane section plus a matching install tip is the next focus. Also backlogged: the dead
BUILTIN_TOOL_NAMEScollision check, and the deadexitCode !== 0warn branch inlifecycle-hooks.ts(runCommand defaults toallowedExitCodes: [0], so a failing hook rejects before that branch is reached — the documented behavior is unaffected).Verified:
pnpm run format:write,pnpm run check,apps/webtips tests,apps/serverplugin-manifest tests.