计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
autonomous-grind【效率与协作】Activate BEFORE starting any /goal or self-driven autonomous loop. Suppresses end-of-turn status summaries, handoff prose, and "where to pick up next session" wrap-ups that prematurely signal completion. Companion hooks block Stop events when wrap-up patterns appear mid-loop, and block writes to HANDOFF/STATUS/NEXT-SESSION files until the loop is exp…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
start <predicate>; clear on completion with clear. Composes with /goal — does not replace it.
version: 1.0.0Hardens autonomous loops (especially /goal) against the model's RLHF-trained reflex to wrap up at "natural milestones." Without this, the agent writes a clean status report at every phase boundary and stops — even when the loop has hours of work left and the user explicitly asked it to keep going.
Always when:
/goal <predicate> and the loop is expected to span more than 1-2 turnsOptional when:
This skill writes a session-scoped marker file at ~/.claude/state/autonomous-grind/<session-id>.json. While that marker exists:
autonomous-keep-going.sh) scans the agent's last text on every Stop event. If wrap-up patterns appear, the hook blocks the stop and re-prompts the agent to continue with concrete action — no summary prose.autonomous-no-handoff.sh) blocks Write/Edit/MultiEdit on filenames matching HANDOFF*, STATUS*, NEXT-SESSION*, WHERE-WE-LEFT-OFF*, SESSION-NOTES*, RECAP*, SUMMARY*. These are cross-session handoff artifacts — distinct from within-loop progress tracking. PROGRESS* is intentionally NOT blocked (per AX 2026-05-18): logging stage progress to a doc is fine; the real failure mode is stopping-to-check-in, which the Stop hook catches via prose patterns.The marker file is your "I'm in deep work mode" flag. Hooks read it; if absent, they exit cleanly and normal behavior resumes.
Auto-cleanup on stale markers: autonomous-stale-marker-cleanup.sh runs on every SessionStart and removes any marker file older than 24h. Crashed sessions don't permanently lock future sessions into hostile mode.
Verify-before-clear gate: autonomous-verify-before-clear.sh PreToolUse Bash hook intercepts attempts to rm the marker file. It allows the clear ONLY if (a) the most recent user message was an explicit abort (/goal clear, stop, abort, cancel, 停, 清除, 取消, 中断), OR (b) a verification command (pnpm test, pytest, go test, cargo test, vitest, jest, playwright test, tsc, gh pr checks, build) ran in the last 30 Bash invocations. This closes the "fake verify in prose" loophole — the Haiku evaluator reads transcript, but this hook reads actual tool-call history.
Telemetry: every hook fire writes a JSONL event to ~/.claude/state/autonomous-grind/events.jsonl. Events: stop_blocked, write_blocked, clear_blocked, stale_cleanup. Use this to assess actual reliability — tail -f the file during a long loop to see when hooks fire, what they catch, and which patterns trip falsely.
start <predicate> (or no args — extract predicate from recent /goal in conversation)# Claude Code stores transcripts at ~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl
# The session-uuid IS the session ID. Most-recently-modified .jsonl in the encoded project dir is this session.
proj_root="${CLAUDE_PROJECT_DIR:-$PWD}"
# Claude Code encoding: every non-word char ([^a-zA-Z0-9_]) becomes '-'. So
# /Users/you/dev/my-app → -Users-you-dev-my-app; a '.' becomes its own '-'. lint-allow-path
encoded="$(echo "$proj_root" | sed 's|[^a-zA-Z0-9_]|-|g')"
proj_dir="$HOME/.claude/projects/$encoded"
sid="$(ls -1t "$proj_dir"/*.jsonl 2>/dev/null | head -1 | xargs -I{} basename {} .jsonl 2>/dev/null)"
# Fallback only if projects dir lookup completely fails (rare — would mean Claude Code hasn't written a transcript yet)
[ -z "$sid" ] && sid="unscoped-$(date -u +%Y%m%dT%H%M%SZ)-$"
echo "$sid"
Do NOT use a literal default fallback — it collides across concurrent sessions (observed during dogfooding). The timestamp+PID fallback is unique per invocation.mkdir -p ~/.claude/state/autonomous-grind
~/.claude/state/autonomous-grind/<session-id>.json:
{
"predicate": "<the verifiable predicate the agent is grinding toward>",
"started_at": "<ISO 8601 timestamp>",
"session_id": "<the session id>"
}
Grind active — predicate: "all CORE-* phases done, pnpm test green, tsc clean, or 50 turns".clearrm -f ~/.claude/state/autonomous-grind/<session-id>.jsonGrind cleared.statusThese are not suggestions. The Stop hook will catch violations and re-prompt.
English:
## Stats / ## Summary / ## Results / ## Coverage headers as the dominant section of the turn中文 (Chinese — added 2026-05-21 after dogfood showed CN sessions slipped through English-only patterns):
Next: write failing test for round.ts dealing logic.Blocked: pnpm install hanging — need user to check network.gh pr create, the PR body is the right place for stats. Mid-loop chat is the wrong place.The hook blocks wrap-ups; you end the loop by:
pnpm test exit 0 (or equivalent verifiable proof), NOT prose claiming completion.Skill(skill="autonomous-grind", args="clear").Grind cleared — predicate met./goal is the Claude Code built-in that runs a Haiku evaluator after each turn to decide if the predicate holds. autonomous-grind is the discipline layer on top.
Together: the agent writes only tool calls and one-line notes; the evaluator sees only real progress; the loop runs until the predicate genuinely trips or the turn cap is reached.
Always pair them. Don't /goal without autonomous-grind. Don't autonomous-grind without /goal (you'll have no evaluator and no exit condition).
/big-task Tier 4 (superpowers engine): invoke autonomous-grind at the start of each phase. Clear between phases (so wrap-up commit + neat-freak-reminder can run normally) then re-activate for the next phase.
/pr-fix-loop, /audit-fix-loop: these have their own convergence logic; do NOT add autonomous-grind on top (would conflict with their internal end-of-round summaries).
The specific failure pattern the user reported:
CORE-1 Part 2 complete — commit 680235a
Stats
- 226/226 tests green
- ...
Where to pick up next session
1. CORE-2 — game state machine...
This block triggers ALL FIVE Stop-hook patterns (phase-complete header, stats section, commit hash + completion framing, handoff narrative, "next session"). With this skill active, the agent would be re-prompted before that block could close out the turn.
clear after the loop is done — subsequent turns will be hostile to legitimate summaries until cleared.