Taskmaster
A stop hook that prevents the agent from stopping prematurely. When a response finishes and the agent is about to stop, this hook intercepts and prompts it to re-examine whether all work is truly done.
How It Works
- Agent tries to stop — the stop hook fires.
- The hook checks for incomplete signals (pending tasks, recent errors, blind spots in infra/config work — see reason text in check-completion.sh).
- Agent is prompted to verify: original requests addressed, plan steps completed, tasks resolved, errors fixed, no loose ends.
- If work remains, the agent continues. If truly done, it confirms and the hook allows the stop on the next cycle.
Loop Protection
A session-scoped counter limits continuations to 10 by default. Set
TASKMASTER_MAX environment variable to change:
export TASKMASTER_MAX=20 # allow up to 20 continuations
export TASKMASTER_MAX=0 # infinite — never cap (relies on stop_hook_active check only)
Setup
The hook must be registered in ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "$HOME/.claude/skills/taskmaster/hooks/check-completion.sh",
"timeout": 10
}
]
}
]
}
}
Disabling
To temporarily disable, either:
- Remove or comment out the Stop hook in
~/.claude/settings.json - Set
TASKMASTER_MAX=1to allow only one continuation check
Lighter Alternative: /goal (Claude Code 2.1.139+)
For one-shot autonomous loops where you don't need taskmaster's full
plan + task list + beads + worktree + AI-verify gating, use the built-in
/goal command instead:
/goal all CI checks green and all worktrees pushed
/goal sets a single completion condition and Claude keeps working across
turns until it's met. Useful when:
- You want a specific exit criterion, not "no incomplete signals"
- The work is bounded (one feature, one bug, one cleanup) and beads/worktree state doesn't matter
- You want the agent to stop the moment the goal is met, even if other in_progress beads exist
Use taskmaster (this skill, always-on Stop hook) when:
- Multi-step plans, multiple beads, multiple worktrees in flight
- You want adjacent-safety gating (WORKTREE_BLOCK, AI_VERIFY_BLOCK, BEADS_BLOCK)
- The "done" condition is fuzzy ("ship the feature properly")
The two compose: a /goal session still runs through taskmaster's Stop hook,
so worktree/AI-verify safety still applies even when goal-driven.