4.1 KiB
name, description
| name | description |
|---|---|
| run | Agent Loop — single entry point. Scaffolds .loop/ if missing, generates stories if no prd.json, then launches autonomous execution in tmux. |
/run — Agent Loop
Single entry point for the agent loop. Handles setup and planning interactively, then launches autonomous execution in a tmux session.
Usage
/agent-loop:run # Full flow: setup → stories → launch
/agent-loop:run --skip-eval # Skip evaluator pass
Instructions
Follow this sequence. Each phase checks what exists and skips if already done.
Phase 1: Scaffold (if needed)
Check if .loop/config.json exists.
If it does NOT exist, run the setup script:
Ask the user: Mode? (a) Implement (b) Explore (c) Fix — default is Implement.
Then run:
bash "$(ls -d ~/.claude/plugins/cache/agent-loop/agent-loop/*/setup.sh 2>/dev/null | head -1)" <mode>
Show the output. If setup fails, stop.
If it already exists, skip to Phase 2.
Phase 2: Generate Stories (if needed)
Check if .loop/prd.json exists.
If it does NOT exist, generate it:
-
Search for existing specs:
docs/superpowers/specs/*.mddocs/specs/*.mdSPEC.md,PRD.md,DESIGN.mdat project root
If found: "I found a spec at
{path}. Using it to generate stories." If not found: ask "What do you want to build? 1-3 sentences." -
Read the project root and tech stack info.
-
Dispatch the agent-loop:planner agent:
Agent(
subagent_type: "agent-loop:planner",
prompt: "Generate prd.json and sprint contracts.\n\nMode: {mode}\nProject root: {path}\n\nSpec:\n{spec content}\n\nTech stack: {detected stack}",
description: "Planning: generate stories"
)
- After the planner finishes, read
.loop/prd.jsonand present:
Stories generated — Review before running
- US-001: {title}
- US-002: {title} ...
Review:
.loop/prd.json— stories and acceptance criteria.loop/contracts/— done conditions per storyLet me know if you want changes, or say go to start the loop.
- STOP and wait for the user. Do NOT start the loop automatically. The user must say "go", "start", "run", "looks good", or similar before proceeding to Phase 3.
If prd.json already exists, skip to Phase 3.
Phase 3: Validate and Launch
-
Read
.loop/prd.jsonand verify:- Has a
userStoriesarray (NOTsprints,stories, ortasks) - Each story has:
id,title,passes,priority - If invalid, show the error and stop.
- Has a
-
Read
.loop/config.jsonformode,maxIterations. -
Verify
.loop/loop.shexists and is executable. -
Parse arguments for any flags to pass through (e.g.,
--skip-eval). -
Build the loop.sh command with any flags:
LOOP_CMD=".loop/loop.sh"
# Add --skip-eval if requested
# Add --max N if specified
- Launch in tmux:
tmux new-session -d -s agent-loop -c <project_root> "$LOOP_CMD"
- Report to the user:
Loop launched in tmux session
agent-loop
- Stories: {total} to complete
- Mode: {mode}
Monitor:
- Watch live:
tmux attach -t agent-loop- Check progress: read
.loop/progress.md- Check status: read
.loop/prd.json- Stop the loop:
tmux kill-session -t agent-loopI can also check on progress for you — just ask "how's it going?"
Monitoring
If the user asks about progress (e.g., "status", "how's it going", "check progress"):
- Read
.loop/prd.json— count passed/failed/blocked stories - Read
.loop/progress.md— show the latest session log entries - Capture recent tmux output:
tmux capture-pane -t agent-loop -p | tail -30
- Report:
Loop Status
- Stories: {passed}/{total} complete, {blocked} blocked
- Current: {last story from progress.md}
- tmux session: {running/stopped}
When Loop Completes
The tmux session exits when loop.sh finishes. If the user asks for a summary:
- Read
.loop/prd.jsonfor final story statuses - Read
.loop/progress.mdfor the full session log - Check git log for commits made during the run
Report the final status and suggest /agent-loop:triage if any stories are blocked.