Files
loop-loop/skills/stories/SKILL.md
Sheldon Finlay ad58a49182 feat: auto-archive completed runs before starting new features
When /agent-loop:run detects a previous run with all stories passed (or the
feature branch deleted after merge), it archives the old artifacts and resets
.loop/ automatically — no more manual rm -rf .loop.

- Add archive_and_reset() for on-demand archiving from skills
- Add runs.log index tracking all archived runs
- Update /run and /stories skills to detect completed runs
- setup.sh archives instead of hard-failing when prd.json exists
- Bump version to 0.9.0
2026-04-02 07:40:07 -04:00

2.2 KiB

name, description
name description
stories Generate prd.json and sprint contracts by dispatching the planner agent. Does not write source code.

/stories — Generate PRD and Sprint Contracts

Dispatch the planner agent to decompose a spec into stories. The planner agent cannot write source code or run bash commands — it can only write to .loop/.

Instructions

1. Check prerequisites

Verify .loop/config.json exists. If not, tell the user to run /agent-loop:setup first and stop.

If .loop/prd.json already exists, check whether the previous run is complete:

source .loop/lib/state.sh 2>/dev/null; LOOP_DIR=.loop all_stories_pass 2>/dev/null && echo "ALL_PASSED" || echo "IN_PROGRESS"

If ALL_PASSED, archive the completed run before generating new stories:

LOOP_DIR=.loop source .loop/lib/state.sh && source .loop/lib/archive.sh && archive_and_reset .loop

If IN_PROGRESS, warn the user that a run is active and ask whether to archive it or abort.

2. Find the spec

Check these locations:

  • docs/superpowers/specs/*.md
  • docs/specs/*.md
  • SPEC.md, PRD.md, DESIGN.md at project root

If found, read the spec content.

If not found, ask: "What do you want to build? 1-3 sentences." Use their answer as the spec.

3. Read project context

Read the project root listing and any key config files (package.json, etc.) to understand the tech stack. Read .loop/config.json for the mode.

4. Dispatch planner agent

Use the Agent tool to launch the agent-loop:planner agent:

Agent(
  subagent_type: "agent-loop:planner",
  prompt: "Generate prd.json and sprint contracts for this project.\n\nMode: {mode}\nProject root: {path}\n\nSpec:\n{spec content}\n\nProject tech stack: {detected stack}",
  description: "Planning: generate stories"
)

5. Present results

After the planner finishes, read .loop/prd.json and show the user:

Plan Ready — Review Before Running

Stories:

  1. US-001: {title}
  2. US-002: {title} ...

Review:

  • .loop/prd.json — stories and acceptance criteria
  • .loop/contracts/ — done conditions per story

Adjust anything, then:

/agent-loop:run

STOP. Do not start the loop. Do not write source code.