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
This commit is contained in:
2026-04-02 07:40:07 -04:00
parent ce111b4cbe
commit ad58a49182
6 changed files with 157 additions and 12 deletions

View File

@@ -13,6 +13,20 @@ Dispatch the planner agent to decompose a spec into stories. The planner agent c
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:
```bash
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:
```bash
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: