feat(hooks): analysis-paralysis-guard — cherry-pick #1 from GSD-Instar spike#335
Open
JKHeadley wants to merge 1 commit into
Open
feat(hooks): analysis-paralysis-guard — cherry-pick #1 from GSD-Instar spike#335JKHeadley wants to merge 1 commit into
JKHeadley wants to merge 1 commit into
Conversation
…r spike New PostToolUse hook that catches a real failure mode: agents stuck in read-only loops without acting. Tracks recent tool calls in a small per-session state file; if 5+ read-only tools (Read/Grep/Glob/WebFetch/ WebSearch) fire in a row without an action tool (Edit/Write/Bash/ NotebookEdit), injects an "act or report blocked" checklist into the next prompt. Signal-only — never blocks. Action tools reset the counter. Sessions tracked independently. Malformed input never blocks (exit 0 on any error). Borrowed verbatim from gsd-executor's prompt, where it was battle-tested on thousands of real sessions to kill the "researched the whole session, never wrote any code" trap. This is cherry-pick #1 of ten items identified during the Topic Intent Layer / GSD integration spike (PR #332). Cherry-pick over runtime integration was the spike's verdict — Echo's Agent tool cannot discover GSD's specialist subagents at runtime, so methodology-only is the structurally sound path. Wired into: - PostToolUse with no matcher (all tools) in settings-template.json - PostUpdateMigrator.installBuiltinHooks (always-overwrite per the Migration Parity Standard, so existing agents get it on next upgrade) - builtin-manifest.json (registered for install-state tracking) - known-builtin-hooks list (orphan-cleanup safe) Tests (9 unit tests, all green): - Single read-only call does not warn - 5 read-only calls in a row trigger the warning - Edit / Write / Bash each reset the counter - Different sessions tracked independently - Tool not in either list passes through silently - Malformed input never blocks (exit 0) - Warning includes the sequence of recent tools - State file persists at expected path Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
First cherry-pick from the GSD-Instar integration spike (PR #332). Adds a PostToolUse hook that catches agents stuck in read-only loops without acting.
What ships
PostUpdateMigrator.getAnalysisParalysisGuardHook()— 5+ consecutive read-only tool calls without an action tool → injects an "act or report blocked" checklist into the next prompt.settings-template.json(PostToolUse, no matcher = all tools),PostUpdateMigrator.installBuiltinHooks(always-overwrite per Migration Parity Standard),builtin-manifest.json, and the known-builtin-hooks list.Tests
9 unit tests, all green:
Spike context
Cherry-pick over runtime integration was the spike's verdict (see PR #332 comparison report v2 — https://echo.dawn-tunnel.dev/view/af91195d-8d97-4c9b-a122-92e8490c86e5?sig=ed240b3521fb50a952fead3448eb21f333206f815c64d8ae4f8b7e1218a0779a). Echo's Agent tool cannot discover GSD's specialist subagents at runtime, so methodology-only is the structurally sound path.
This is item #4 from the spike's ranked cherry-pick list (the small / well-defined safety hooks). Items #5 (slopcheck on package installs), #1 (
/verify-claim4-tier skill), #2 (atomic-commit discipline), and the remaining six items will land as separate PRs.Side-effects review
Full artifact:
upgrades/side-effects/analysis-paralysis-guard.md. Seven-dimension review clean — over-block / under-block / level-of-abstraction / signal-vs-authority / cross-feature interactions / rollback cost / migration parity. Rollback cost is trivial; no new external dependencies.Test plan
npm testgreen locally (9 new tests pass)🤖 Generated with Claude Code