claude-code - 💡(How to fix) Fix /goal hook fires "Goal Achieved" while TaskList tasks still pending/in_progress

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The session-scoped /goal Stop hook fires a "Goal Achieved" notification mid-execution, even when the agent still has tracked tasks in pending / in_progress status via TaskCreate / TaskList. This produces user-visible confusion: the UI says the goal is achieved, but the agent reports the work isn't done.

Root Cause

The session-scoped /goal Stop hook fires a "Goal Achieved" notification mid-execution, even when the agent still has tracked tasks in pending / in_progress status via TaskCreate / TaskList. This produces user-visible confusion: the UI says the goal is achieved, but the agent reports the work isn't done.

Fix Action

Fix / Workaround

  • Claude Code CLI
  • Model: claude-opus-4-7
  • Long-running background session with 30+ subagent dispatches
  • Goal text: write plan, implement plan
RAW_BUFFERClick to expand / collapse

Summary

The session-scoped /goal Stop hook fires a "Goal Achieved" notification mid-execution, even when the agent still has tracked tasks in pending / in_progress status via TaskCreate / TaskList. This produces user-visible confusion: the UI says the goal is achieved, but the agent reports the work isn't done.

Repro

  1. Start a long multi-step implementation in a single session.
  2. /goal write plan, implement plan
  3. Agent writes an 11-task plan via writing-plans skill and starts executing through subagent-driven-development.
  4. Tasks 1–8 land as commits. Tasks 9 (parity sweep), 10 (backtest validation), 11 (final verification + handoff) still tracked as pending / in_progress.
  5. UI surfaces "Goal Achieved" while the agent is still mid-execution.
  6. User asks "is this done?" — agent (correctly) answers "no, 3 tasks remain."

Expected

Either:

  • The /goal hook consults TaskList and only fires when no pending / in_progress items remain, OR
  • The notification text is clarified to indicate it's an advisory match against the natural-language condition, not a definitive completion check.

Actual

The hook appears to evaluate the natural-language goal condition against some loose heuristic (presence of plan + most impl commits) without consulting the structured task tracker. Result: false-positive "achieved" while tracked work remains.

Environment

  • Claude Code CLI
  • Model: claude-opus-4-7
  • Long-running background session with 30+ subagent dispatches
  • Goal text: write plan, implement plan

Why it matters

Users rely on hook notifications as a signal of completion. A premature "achieved" undermines that signal and forces users to manually cross-check TaskList to know what's actually done.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING