Skip to content

refactor: question-triggered skill, npx skills install path#57

Merged
mattfogel merged 2 commits into
mainfrom
skill/question-triggered-rewrite
May 14, 2026
Merged

refactor: question-triggered skill, npx skills install path#57
mattfogel merged 2 commits into
mainfrom
skill/question-triggered-rewrite

Conversation

@mattfogel

Copy link
Copy Markdown
Owner

Summary

The prov skill stops bloating agent context, and the duplicate install paths collapse into one mechanism per responsibility.

  1. Skill is now question-triggered. It no longer runs prov log before 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.

  2. Install paths split by responsibility. Capture hooks live at agent-hooks/hooks.json and install via prov install --agent claude (unchanged behavior from a user's perspective). The skill moves to skills/prov/ and installs separately via npx skills add mattfogel/provVercel's skills CLI auto-discovers skills/<name>/SKILL.md from the repo root, so no path suffix is needed. The Claude Code plugin manifest is gone, eliminating the /plugin install prov plus prov install --agent claude overlap 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.
  • Dropped the paths: glob — triggering is the question, not the file.
  • Body covers what prov is, 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.md rewritten 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.
  • Smoke-test plan adds two explicit negative scenarios — a refactor request and a greenfield write must NOT invoke prov log. Those are the regression this rewrite exists to prevent.

Install path changes

  • plugin/agent-hooks/. plugin/hooks/hooks.json flattened to agent-hooks/hooks.json; the embedded include_str! path in install.rs follows.
  • plugin/.claude-plugin/plugin.json deleted — no marketplace install surface anymore.
  • plugin/skills/prov/skills/prov/ so npx skills add mattfogel/prov works with no path suffix.
  • prov install --plugin flag and print_plugin_instructions() removed, along with the install_plugin_flag_does_not_touch_repo test that gated them.
  • cli_plugin_layout.rscli_agent_hooks_layout.rs; the plugin-manifest test is gone, hooks-bundle and README tests point at the new flat path.
  • READMEs reworked: top-level lists npx skills add mattfogel/prov as an optional follow-up to prov install --agent claude; the new agent-hooks/README.md describes just the hooks bundle and points at skills/ 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, and prov install --agent claude still merges them into .claude/settings.json from the same embedded source.

Verification

./scripts/check.sh passes (build, test, fmt, clippy). The skill content lints in cli_skill_layout.rs and the renamed cli_agent_hooks_layout.rs gate 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 per skills/prov/tests/skill_smoke.md — there is no automated harness for trigger fidelity.


Compound Engineering
Claude Code

mattfogel added 2 commits May 14, 2026 08:43
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.
@mattfogel
mattfogel merged commit e4a1031 into main May 14, 2026
3 checks passed
@mattfogel
mattfogel deleted the skill/question-triggered-rewrite branch May 14, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant