PreCompact hook fires on /compact and autoCompact. When task_plan.md is
present, surfaces a reminder to flush in-context progress to progress.md
before compaction completes and prints the active Plan-SHA256 if attested.
Stays silent without a plan. Exit 0 always; never blocks compaction.
/plan-goal composes with Claude Code's /goal (v2.1.139, May 12 2026).
Derives a termination condition from the active plan so /goal stops the
agent when the plan-file is genuinely complete, not just when the
conversation looks done.
/plan-loop composes with /loop (v2.1.72+). Default 10-minute tick re-reads
planning files, runs check-complete, nudges a progress.md entry if the
last tick produced no change. templates/loop.md ships a planning-aware
default for ~/.claude/loop.md so bare /loop works grounded in the plan.
OpenCode session-catchup rewritten for the SQLite migration (sst/opencode
dev @ 2026-05-14). Reads ${XDG_DATA_HOME:-~/.local/share}/opencode/opencode.db
read-only via URI, scopes by session.directory, surfaces unsynced planning
edits. Verified against a real 162 MB OpenCode database (94 sessions, 56
unsynced parts correctly extracted from the lovable-at-home directory).
Codex gains a PermissionRequest adapter that surfaces a one-line plan
reminder when an active plan exists. Read-only; never blocks.
Tests: +19 covering PreCompact behavior, slash command file structure,
OpenCode SQLite catchup with a synthetic schema-matching DB, and Codex
PermissionRequest emit/silent behavior. 98 tests passing.
Deliberately not changed: paths glob (auto-invocation behavior risk),
wholesale !command swap (would freeze attestation hash and defeat v2.37
tamper gate), native Plan Mode panel integration (no plugin API
documented), language variant consolidation (separate breaking-change
track). PreCompact lives in the canonical SKILL.md + 5 language variants
+ clawhub-upload; other IDE mirrors keep their existing compaction
hooks until per-IDE PreCompact adapters land in a future release.
38 lines
2.0 KiB
Markdown
38 lines
2.0 KiB
Markdown
---
|
|
description: "Run a planning-aware cadence with Claude Code's /loop. Default tick checks plan status, runs check-complete, nudges progress.md update if stalled. Available since v2.38.0."
|
|
disable-model-invocation: true
|
|
allowed-tools: "Read Bash"
|
|
---
|
|
|
|
Run a planning-aware cadence on top of Claude Code's `/loop` primitive.
|
|
|
|
Steps:
|
|
|
|
1. Parse args:
|
|
- First arg matching `^\d+[smhd]$` is the interval (default `10m`).
|
|
- Remaining args are an optional task prompt.
|
|
2. Resolve the active plan as in `/plan-attest`.
|
|
3. Compose the loop prompt:
|
|
- If user passed a task prompt: use it verbatim.
|
|
- Else: use the default planning tick prompt:
|
|
```
|
|
Read task_plan.md and progress.md. Run scripts/check-complete.sh to see remaining phases.
|
|
If no progress.md entry has been added since the last loop tick, write one summarizing the current state.
|
|
If a phase finished, update its Status: line in task_plan.md.
|
|
Continue the next phase if work remains.
|
|
```
|
|
4. Invoke `/loop <interval> <prompt>`.
|
|
5. Confirm to the user: print the interval, the active plan ID, and remind that bare `/loop` invocation alone (without args) runs Claude Code's built-in maintenance prompt — `/plan-loop` differs by always grounding the tick in the planning files.
|
|
|
|
If `task_plan.md` does not exist, refuse and direct user to run `/plan` first.
|
|
|
|
Why this exists:
|
|
|
|
`/loop` runs prompts on cron without any plan-state contract. `/plan-loop` injects a plan-aware default so the recurring tick always re-reads the planning files first, runs the completion check, and writes a progress entry. Users get "babysit my plan" UX without writing a custom loop prompt.
|
|
|
|
Notes:
|
|
|
|
- `/plan-loop` composes with `/loop`; it does not replace it. `/loop 5m "anything"` still works.
|
|
- For "babysit until plan is done" semantics: combine `/plan-loop 10m` (cadence) with `/plan-goal` (termination criterion). The loop runs every 10 minutes; the goal stops the loop when the plan is complete.
|
|
- The default tick prompt is intentionally short so it stays within compaction-safe length.
|