Skip to content

feat(hooks): analysis-paralysis-guard — cherry-pick #1 from GSD-Instar spike#335

Open
JKHeadley wants to merge 1 commit into
mainfrom
echo/gsd-cherrypicks
Open

feat(hooks): analysis-paralysis-guard — cherry-pick #1 from GSD-Instar spike#335
JKHeadley wants to merge 1 commit into
mainfrom
echo/gsd-cherrypicks

Conversation

@JKHeadley
Copy link
Copy Markdown
Owner

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

  • Hook script generated by PostUpdateMigrator.getAnalysisParalysisGuardHook() — 5+ consecutive read-only tool calls without an action tool → injects an "act or report blocked" checklist into the next prompt.
  • Signal-only — never blocks a tool call. Action tools (Edit/Write/Bash/NotebookEdit) reset the counter. Sessions tracked independently. Malformed input never blocks.
  • Wired into 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:

  • Counter increments on read-only, resets on action
  • Sessions tracked independently
  • Malformed input → exit 0, no warning
  • Warning includes the recent-tool sequence
  • State file persists at expected path

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-claim 4-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 test green locally (9 new tests pass)
  • TypeScript clean
  • CI green on this PR
  • Smoke after merge: trigger 5 consecutive Read calls in a fresh session, verify the warning fires

🤖 Generated with Claude Code

…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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
instar Ready Ready Preview, Comment May 23, 2026 2:13am

Request Review

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