fix(fp-check): scope completeness hooks to skill/agent frontmatter (#143)#188
Open
dguido wants to merge 1 commit into
Open
fix(fp-check): scope completeness hooks to skill/agent frontmatter (#143)#188dguido wants to merge 1 commit into
dguido wants to merge 1 commit into
Conversation
) The plugin-level hooks/hooks.json registered Stop and SubagentStop hooks with matcher "*". Because plugin hooks are always-on, both fired on every (sub)agent stop in any session where fp-check was merely installed — burning a 30s LLM turn and injecting stop-feedback even when fp-check was never used, then no-opping via the prompt's own fallback. Root-cause fix: move the hooks into skill/agent frontmatter, which per the Claude Code docs is "scoped to the component's lifecycle and only run when that component is active": - Overall verification-completeness Stop hook -> fp-check SKILL.md frontmatter. Fires only when the fp-check skill is loaded. - Per-subagent output checks -> each agent's own frontmatter as a Stop hook, which auto-converts to SubagentStop. data-flow-analyzer checks Phase 1, exploitability-verifier Phase 2, poc-builder Phase 4. Each fires only when that specific agent runs, so the single SubagentStop prompt's "identify which agent type" branching is no longer needed. - Delete plugins/fp-check/hooks/hooks.json. This fixes both hooks (not just Stop) and keeps full coverage including inline fp-check runs, unlike deleting the Stop hook outright. Hook prompts and the {"ok"/"reason"} response schema are carried over unchanged from the current plugin hooks. Bump 1.0.2 -> 1.0.3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5 tasks
Contributor
|
This didn't work for me and the claude docs on https://code.claude.com/docs/en/sub-agents say: |
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
Fixes #143. Supersedes #165 (which is based on stale 1.0.0 code and conflicts with main).
The fp-check plugin ships
plugins/fp-check/hooks/hooks.jsonregistering aStophook and aSubagentStophook, both with"matcher": "*". Plugin-level hooks are always-on, so both fire on every (sub)agent stop in any session where fp-check is merely installed — burning a ~30s LLM turn and injecting stop-feedback even when fp-check was never used, only to no-op via the prompt's own fallback.Why not just delete the
Stophook (the approach in #165)?#165 deletes the top-level
Stophook and keepsSubagentStop. That is a half-fix:SubagentStop— which also usesmatcher: "*"and also relies on its prompt to no-op, so it keeps firing a full LLM turn on every subagent stop in unrelated sessions.Stophook checks the overall verdict assembly (Phase 5's devil's-advocate questions, the 6 gate reviews, the final TRUE/FALSE POSITIVE verdict) — work the main agent does. When fp-check runs inline (no subagents dispatched), deletingStopleaves zero completeness enforcement.Fix: scope the hooks to where they're actionable
Per the Claude Code hooks docs, hooks declared in skill/agent frontmatter are "scoped to the component's lifecycle and only run when that component is active." That addresses the root cause for both hooks:
Overall completeness
Stophook →skills/fp-check/SKILL.mdfrontmatter. Fires only when the fp-check skill is loaded into the session.Per-subagent output checks → each agent's own frontmatter as a
Stophook, which auto-converts toSubagentStopfor subagents:data-flow-analyzer→ Phase 1 checksexploitability-verifier→ Phase 2 checkspoc-builder→ Phase 4 checksEach fires only when that specific agent runs, so the old single
SubagentStopprompt's "identify which agent type this is" branching is no longer needed.Delete
plugins/fp-check/hooks/hooks.json.Hook prompts and the
{"ok"/"reason"}response schema are carried over unchanged from the current plugin hooks (the schema was corrected in #129). Behavior is identical when fp-check is in use; the only change is that the hooks no longer fire in unrelated sessions.Impact
1.0.2→1.0.3.Validation
Plus: YAML frontmatter of all four modified markdown files parses and the hook handlers validate (
type: prompt,timeout: 30,ok/reasonschema, no stale'approve'/'block'or{"decision":...}).CODEOWNERS unchanged (
/plugins/fp-check/ @ahpaleus @dguido).🤖 Generated with Claude Code