Autonomous task loop that picks ready tasks, implements them, updates progress.txt, commits, and repeats. Use when asked to 'build feature', 'run the loop', or 'implement these tasks'.
Autonomous task execution loop that implements tasks one by one until complete.
Each task must be completable in ONE iteration (~one context window).
Each iteration spawns a fresh subagent with no memory of previous work. If a task is too big, the agent runs out of context before finishing.
Rule of thumb: If you can't describe the change in 2-3 sentences, it's too big.
Check if scripts/build-feature-loop/progress.txt exists:
If it doesn't exist or user is starting a new feature:
# Build Progress Log
Started: [today's date]
Feature: [feature name]
## Codebase Patterns
(Patterns discovered during this feature build)
---
## Tasks
- [ ] Task 1 title
Description: What to do
Files: path/to/file.ts
Depends: none
- [ ] Task 2 title
Description: What to do
Depends: Task 1
- [ ] Task 3 title
Description: What to do
Depends: Task 1
- [ ] Task 4 title
Description: What to do
Depends: Task 2, Task 3
---
## Completed Work
(Entries added as tasks complete)
If it exists: Read it to understand current state.
Parse the tasks from progress.txt and update TodoWrite so the user can see progress:
[ ] tasks → pending[x] tasks → completedin_progressA task is ready when:
[ ] (not completed)Depends: are completed [x]Pick the next task:
Check if all tasks are completed:
If ALL tasks are [x]:
DATE=$(date +%Y-%m-%d)
FEATURE="feature-name-here"
mkdir -p scripts/build-feature-loop/archive/$DATE-$FEATURE
mv scripts/build-feature-loop/progress.txt scripts/build-feature-loop/archive/$DATE-$FEATURE/
git add scripts/build-feature-loop && git commit -m "chore: archive progress for [feature-name]"If some tasks are blocked (dependencies not met): Report which tasks are blocked and why
Use the Task tool to spawn a subagent with this prompt:
Implement and verify: [task-title]
[task-description]
**Files:** [files from task]
FIRST: Read scripts/build-feature-loop/progress.txt - check the "Codebase Patterns" section for important context from previous iterations.
When complete:
1. Run quality checks: `npm run typecheck` and `npm test`
- If either fails, FIX THE ISSUES and re-run until both pass
- Do NOT proceed until quality checks pass
2. Update AGENTS.md files if you learned something important:
- Check for AGENTS.md in directories where you edited files
- Add learnings that future developers/agents should know (patterns, gotchas, dependencies)
- This is LONG-TERM memory - things anyone editing this code should know
3. Update progress.txt:
a. Mark this task complete: change `- [ ] [task-title]` to `- [x] [task-title]`
b. Add entry to "## Completed Work" section:
```
## [Date] - [Task Title]
- What was implemented
- Files changed
- **Learnings for future iterations:**
- Patterns discovered
- Gotchas encountered
---
```
c. If you discovered a reusable pattern, add it to "## Codebase Patterns" at the top
4. Commit all changes with message: `feat: [Task Title]`
The progress file should be at scripts/build-feature-loop/progress.txt.
- [ ] Short task title
Description: Detailed description of what to do
Files: path/to/file1.ts, path/to/file2.ts
Depends: none
- [ ] Another task
Description: What to implement
Files: src/components/Thing.tsx
Depends: Short task title
- [x] Completed task
Description: What was done
Files: src/lib/util.ts
Depends: none
Dependency rules:
Depends: none - Can start immediatelyDepends: Task A - Blocked until Task A is [x]Depends: Task A, Task B - Blocked until both are [x]While working, liberally add new tasks to progress.txt when you discover:
Add them to the ## Tasks section with appropriate Depends: relationships.
Write descriptions that a future iteration can pick up without context:
- [ ] Add priority field to tasks table
Description: Add 'priority' column with values 'high'|'medium'|'low', default 'medium'. Create migration.
Files: prisma/schema.prisma, prisma/migrations/
Depends: none
Acceptance: npm run typecheck passes, migration runs successfully
For UI tasks, specify the right verification method in the task description:
Functional testing (checking behavior, not appearance):
browser_snapshot tool to read page content as accessibility treeVisual testing (checking appearance):
browser_take_screenshot tool to capture visual appearanceBefore marking any task complete:
npm run typecheck must passnpm test must passWhen no ready tasks remain AND all tasks are completed:
Before starting the loop, verify:
Depends: none (can start)