fix: plugin hooks always invoke deepwork via uvx#390
Merged
Conversation
Switches plugin hook scripts to `uvx deepwork ...` unconditionally, matching how the MCP server is launched in plugins/claude/.mcp.json. Rationale: a `command -v deepwork` fallback was not enough. A user-level `uv tool install deepwork` pinned to an older release (observed: 0.10.0 on a system where the plugin MCP server uses 0.13.8) still wins PATH lookup outside the project's nix/direnv shell, and that stale binary lacks newer hook modules — producing "Hook '...' not found" errors on every Bash tool use, which Claude Code surfaces as a failed hook. By always using `uvx deepwork`, hooks resolve against the same uvx cache the MCP server populated, so the hook version is guaranteed to match the server. Also adds formal requirement PLUG-REQ-001.15 (Hook Script CLI Invocation) and tightens the `claude_plugin_hook_deepwork_invocation` review rule to enforce `uvx deepwork` (not just presence of a fallback). Fills out header comments and adds `set -euo pipefail` to the two hook scripts that lacked them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The editable uv tool install is unnecessary now that plugin hooks invoke deepwork via uvx directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The plugin structure tree only listed hooks.json and post_commit_reminder.sh, missing deepschema_write.sh, post_compact.sh, and startup_context.sh. Surfaced by the update_documents_relating_to_src_deepwork review rule. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7350035 to
7332b2d
Compare
The reviewer subagent's `tools:` frontmatter used `mcp__deepwork-dev__*` and `mcp__plugin_deepwork_deepwork__*` wildcards. Runtime observation (PR #390 e2e merge-queue run): the wildcards are accepted at parse time but do not reliably match deferred MCP tools when the subagent tries to invoke them — the runtime responds with `Error: No such tool available: mcp__deepwork-dev__mark_review_as_passed` even though the parent agent could call other tools from the same MCP server. Replace the wildcards with the single MCP tool the reviewer actually uses (`mark_review_as_passed`) under both prefixes. Also add a root `.deepreview` rule `agent_tools_fully_qualified` that flags any Claude Code agent definition file (`**/agents/*.md`) whose `tools:` frontmatter contains a wildcard, so the same footgun cannot regress. Co-Authored-By: Claude Opus 4.7 (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.
Summary
Follow-up to #386 (shipped in v0.13.9). The fallback-based approach in #386 only covered the "
deepworknot on PATH" failure mode. In practice a second failure mode is common: a user-leveluv tool install deepworkpinned to an older release (observed: 0.10.0) wins PATH lookup outside the project's direnv/nix shell and lacks the hook modules the plugin is asking for — producingError: Hook 'post_commit_reminder' not foundon every Bash tool use.This PR switches plugin hook scripts to always invoke the CLI via
uvx deepwork, matching the MCP server launch inplugins/claude/.mcp.json. Hooks now resolve against the sameuvxcache the MCP server populated, so they are guaranteed to match the server's version.Changes
plugins/claude/hooks/post_commit_reminder.sh,deepschema_write.sh,post_compact.sh: removecommand -v deepworkguard; always useuvx deepwork …. Also addsset -euo pipefailand fills out header comments on the two scripts that lacked them.plugins/claude/.deepreview: tightens theclaude_plugin_hook_deepwork_invocationrule from "must have auvx deepworkfallback" to "must invoke viauvx deepwork".PLUG-REQ-001.15: Hook Script CLI Invocationrequirement indoc/specs/deepwork/cli_plugins/PLUG-REQ-001-claude-code-plugin.md.flake.nix: dropsuv tool install -efrom the dev shell — the editable user-level install is redundant now that hooks go throughuvx, and it was the mechanism causing the stale~/.local/bin/deepworkobserved on one developer machine.doc/platforms/claude/cli_configuration.md: updates the plugin structure tree to list all five files underplugins/claude/hooks/(was listing only two). Surfaced by theupdate_documents_relating_to_src_deepworkreview rule.CHANGELOG.md: entries under[Unreleased].Test plan
uv run pytest tests/unit/test_post_commit_reminder_hook.py tests/unit/test_hook_cli.py tests/unit/plugins/test_claude_plugin.py— 68 passedPATHstripped ofdeepworkbut includinguvx— returns{}/ exit 0 for non-commit Bash invocations.deepreviewfiles againstdeepreview_schema.jsonrequirements_file/deepschema.yml(RFC 2119 keywords on every numbered item)/reviewloop iteratively; all in-scope reviews PASS🤖 Generated with Claude Code