diff --git a/skills/run/SKILL.md b/skills/run/SKILL.md index 78035b8..de6ab2c 100644 --- a/skills/run/SKILL.md +++ b/skills/run/SKILL.md @@ -128,7 +128,15 @@ LOOP_CMD=".loop/loop.sh" tmux kill-session -t agent-loop 2>/dev/null; tmux new-session -d -s agent-loop -c "$LOOP_CMD" ``` -7. Tell the user: +7. Start a **background watcher** that waits for the loop to finish. Use the Bash tool with `run_in_background: true`: + +```bash +while tmux has-session -t agent-loop 2>/dev/null; do sleep 10; done; echo "LOOP_COMPLETE" +``` + +This runs silently. When the tmux session exits, Claude Code gets notified automatically. + +8. Tell the user: > **Loop launched.** Watch it live: > ``` @@ -139,36 +147,39 @@ tmux kill-session -t agent-loop 2>/dev/null; tmux new-session -d -s agent-loop - > - **Detach** (return to Claude Code): `Ctrl+B` then `D` > - **Stop the loop**: `Ctrl+C` > - Ask me "status" anytime and I'll check progress. +> +> I'll notify you when the loop finishes. --- -## Monitoring +## When Background Watcher Completes -If the user asks about progress (e.g., "status", "how's it going", "check progress"): +When you receive the background task notification (the watcher prints "LOOP_COMPLETE"), the loop has finished. Automatically: 1. Read `.loop/prd.json` — count passed/failed/blocked stories 2. Read `.loop/progress.md` — show the latest session log entries -3. Capture recent tmux output: +3. Check `git log --oneline` for commits made during the run +4. Present a summary: -```bash -tmux capture-pane -t agent-loop -p | tail -30 -``` - -4. Report: - -> **Loop Status** +> **Loop Complete** > - Stories: {passed}/{total} complete, {blocked} blocked -> - Current: {last story from progress.md} -> - tmux session: {running/stopped} +> - Iterations: {from progress.md} +> - Commits: {list from git log} +> +> {If any stories blocked: "Some stories need human review. Run /agent-loop:triage for details."} +> {If all passed: "All stories complete. Review the code and test it."} --- -## When Loop Completes +## Monitoring (if user asks mid-run) -The tmux session exits when `loop.sh` finishes. If the user asks for a summary: +If the user asks about progress (e.g., "status", "how's it going"): -1. Read `.loop/prd.json` for final story statuses -2. Read `.loop/progress.md` for the full session log -3. Check git log for commits made during the run +1. Read `.loop/prd.json` — count passed/failed/blocked +2. Capture recent tmux output: -Report the final status and suggest `/agent-loop:triage` if any stories are blocked. +```bash +tmux capture-pane -t agent-loop -p | tail -20 +``` + +3. Report current status.