refactor: question-triggered skill, npx skills install path#57
Merged
Conversation
The previous shape asked Claude Code to call `prov log` before any non-trivial edit. That created context bloat: the skill description matched broad "refactor / debug / extend" intent, so the skill loaded into context for almost every substantive code change, and the agent spent tool calls on `prov log` lookups the user never asked for. This rewrites the skill so it activates only when the user asks an origin / intent / history question — "why does this do X", "what was the prompt that wrote this", "what's the history of this file", "find the prompts where we decided Y", "is this drifted". The description, the trigger reference, and the smoke-test plan all reinforce the same boundary: edit / refactor / debug asks should NOT preemptively run `prov log`; only explicit provenance questions should. Capture hooks are unchanged — they write to staging only and don't inject anything into the agent's prompt, so they don't cause the bloat this rewrite targets.
…in/ → agent-hooks/ Splits the two responsibilities that the Claude Code plugin layout conflated: capture hooks and the read-side skill. Each now has one canonical install path with no overlap, so users can't accidentally double-register hooks the way the prior `/plugin install prov` plus `prov install --agent claude` combination could. - Capture hooks: bundled at `agent-hooks/hooks.json`, still embedded into the `prov` binary and merged into `.claude/settings.json` by `prov install --agent claude`. The directory is the canonical home; the old `plugin/.claude-plugin/plugin.json` marketplace manifest is deleted. - Skill: moved to `skills/prov/` so the Vercel skills CLI auto-discovers it via the bare shorthand `npx skills add mattfogel/prov` (the CLI walks `skills/<name>/SKILL.md` from the repo root by default). - `prov install --plugin` flag and `print_plugin_instructions()` are gone, along with the `install_plugin_flag_does_not_touch_repo` test that asserted their behavior. - `cli_plugin_layout.rs` renamed to `cli_agent_hooks_layout.rs`; the plugin-manifest test is dropped; the hooks-bundle and README tests are updated to the new paths. - README updates: drop the "two install paths" framing on the plugin README (now `agent-hooks/README.md`); add the optional `npx skills add` step to the top-level quick start; replace the `plugin/` directory pointer with `agent-hooks/` and `skills/`. Smoke-test plan setup updated to describe installing the skill via `npx skills add` instead of the now-defunct `/plugin install` path.
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
The prov skill stops bloating agent context, and the duplicate install paths collapse into one mechanism per responsibility.
Skill is now question-triggered. It no longer runs
prov logbefore edits, refactors, or debugging. It activates only when the user asks an origin/intent/history question — "why does this do X", "what was the prompt for this line", "what's the history of this file". The old shape pulled provenance into context on every substantive edit, even when the user never asked for it.Install paths split by responsibility. Capture hooks live at
agent-hooks/hooks.jsonand install viaprov install --agent claude(unchanged behavior from a user's perspective). The skill moves toskills/prov/and installs separately vianpx skills add mattfogel/prov— Vercel'sskillsCLI auto-discoversskills/<name>/SKILL.mdfrom the repo root, so no path suffix is needed. The Claude Code plugin manifest is gone, eliminating the/plugin install provplusprov install --agent claudeoverlap that could register the same four hooks twice.Skill content changes
description:triggers on provenance questions only, with an explicit "Do NOT auto-run before edits" line.paths:glob — triggering is the question, not the file.provis, three query shapes (point lookup, whole-file,prov search), and how to compose the answer (cite the prompt verbatim; surface drift state; handle no-provenance plainly).references/triggers.mdrewritten from "is this edit substantive" to "what phrasings should fire this skill and what query maps to each", with a clear "should NOT trigger" section.prov log. Those are the regression this rewrite exists to prevent.Install path changes
plugin/→agent-hooks/.plugin/hooks/hooks.jsonflattened toagent-hooks/hooks.json; the embeddedinclude_str!path ininstall.rsfollows.plugin/.claude-plugin/plugin.jsondeleted — no marketplace install surface anymore.plugin/skills/prov/→skills/prov/sonpx skills add mattfogel/provworks with no path suffix.prov install --pluginflag andprint_plugin_instructions()removed, along with theinstall_plugin_flag_does_not_touch_repotest that gated them.cli_plugin_layout.rs→cli_agent_hooks_layout.rs; the plugin-manifest test is gone, hooks-bundle and README tests point at the new flat path.npx skills add mattfogel/provas an optional follow-up toprov install --agent claude; the newagent-hooks/README.mddescribes just the hooks bundle and points atskills/for the read surface.Capture hooks unchanged
The four Claude Code hooks (
SessionStart,UserPromptSubmit,PostToolUse,Stop) write to<git-dir>/prov-staging/only — nothing they emit reaches the agent's prompt — so they aren't part of the context-bloat problem this PR fixes. They keep firing exactly as before, andprov install --agent claudestill merges them into.claude/settings.jsonfrom the same embedded source.Verification
./scripts/check.shpasses (build, test, fmt, clippy). The skill content lints incli_skill_layout.rsand the renamedcli_agent_hooks_layout.rsgate the load-bearing on-disk shape. The behavioral skill triggers (fires on "why does this do X", stays silent on "refactor this") are verified manually perskills/prov/tests/skill_smoke.md— there is no automated harness for trigger fidelity.