/resume — Load Active Pause Thread (TL;DR)
Reads the latest snapshot of the active pause thread and announces its state in chat so the agent and user can pick up seamlessly. Has no effect if there is no active thread.
Step 1: Resolve Active Thread
- If
/resume --task=<slug>was invoked with an explicit slug, validate BEFORE touching the pointer:- If
<slug>is not plain kebab-case (lowercase letters, digits, hyphens only — reject anything with glob or path characters like*,?,[,/) → output "⚠️ Invalid thread name<slug>. Active thread unchanged." and stop. Never interpolate an unvalidated slug into the glob below. - Glob
[logs_folder]/pause/*-{slug}-pause-*.md. ≥1 match → setactive_slug = <slug>and overwrite_active.mdto match (this enables switching from one paused thread to another), then continue to Step 2. If the pointer write fails, output "⚠️ Could not update active pointer. Active thread unchanged." and stop — do not announce a thread the pointer does not record. - 0 matches → output "⚠️ No pause file found for
<slug>. Active thread unchanged." and stop. Do NOT overwrite_active.md— a mistyped slug must not orphan the pointer or silently deactivate the current thread.
- If
- Otherwise read
[logs_folder]/pause/_active.md. If absent or empty → output "No active pause. คุยใหม่ได้เลย" and stop. If present, parse the single-line content asactive_slug.
Step 2: Locate Latest Pause File
- Glob
[logs_folder]/pause/*-{active_slug}-pause-*.md. - Sort by NN descending (tiebreak: date prefix descending). Pick the first.
- If no file matches (orphan pointer): output "⚠️ Active pointer references
<slug>but no pause file found. Run /doctor." and stop.
Step 3: Idempotency Check
- Read the file's frontmatter
session_token. If frontmatter is absent, malformed, orsession_tokencannot be parsed → skip this idempotency check and proceed to Step 4 (treat as a fresh resume). - If
session_tokenparsed cleanly AND equals the current session token → output "Still in active thread<slug>. Already resumed." and stop. Do NOT re-announce content.
Step 4: Load & Announce
Read the file. Extract: ## Where I Stopped, ## Resume With, ## Key Decisions, count of ## Action Items items (lines matching - [ ] ), count of ## Open Questions items.
Output (Interactive profile — full markdown rendering, agent treats this as loaded working context for the next user message):
🔄 Resumed from {slug}-pause-{NN} ({YYYY-MM-DD}) **Where I Stopped:** {text} **Resume With:** {text} **Key Decisions (last pause):** - {bullet} - {bullet} **Open Questions:** {Q_count} · **Action Items:** {A_count} พร้อมทำต่อ — เริ่มเลย
After announcing, the agent treats the loaded content as the active context for the upcoming user turn. Do NOT re-read the pause file on the next user message unless the user explicitly asks for details not announced.


