A self-running AI coding assistant that works through your product requirements document until every task is complete. Each cycle starts fresh with a clean slate, while knowledge persists through version control history, a progress log, and a task tracking file.
- Claude Code CLI installed and authenticated
jqcommand-line JSON processor (brew install jqon macOS)- A git-initialized project directory
Copy the agent files directly into your project:
# From your project root
mkdir -p scripts/agent
cp /path/to/agent/agent.sh scripts/agent/
cp /path/to/agent/prompt.md scripts/agent/
chmod +x scripts/agent/agent.shInstall the skills for use across multiple projects:
cp -r skills/prd ~/.claude/skills/
cp -r skills/agent ~/.claude/skills/The agent runs with --dangerously-skip-permissions to allow autonomous operation. Make sure you trust the codebase before running.
Use the PRD skill to generate a detailed requirements document:
Load the prd skill and create a PRD for [your feature description]
Answer the clarifying questions. Output saves to tasks/prd-[feature-name].md.
Use the agent skill to convert the markdown PRD to JSON:
Load the agent skill and convert tasks/prd-[feature-name].md to prd.json
This creates prd.json with user stories structured for autonomous execution.
./scripts/agent/agent.sh [max_iterations]Default is 10 iterations.
The agent will:
- Create a feature branch (from PRD
branchName) - Select the highest priority story where
passes: false - Implement that single story
- Run quality checks (typecheck, tests)
- Commit if checks pass
- Update
prd.jsonto mark story aspasses: true - Record learnings to
progress.txt - Repeat until all stories pass or max iterations reached
| File | Purpose |
|---|---|
agent.sh |
Main loop that spawns fresh AI instances |
prompt.md |
Instructions provided to each AI instance |
prd.json |
User stories with completion status |
prd.json.example |
Example format for reference |
progress.txt |
Append-only log of learnings across iterations |
skills/prd/ |
Skill for generating PRDs |
skills/agent/ |
Skill for converting PRDs to JSON |
flowchart/ |
Interactive visualization of the workflow |
The flowchart/ directory contains an interactive diagram showing how the agent works. To run locally:
cd flowchart
npm install
npm run devEach iteration spawns a new AI instance with clean context. The only persistence between iterations is:
- Git history (commits from previous iterations)
progress.txt(learnings and context)prd.json(which stories are done)
Each PRD item should be small enough to complete in one context window. If a task is too big, the AI runs out of context before finishing and produces poor code.
Well-sized stories:
- Add a database column and migration
- Add a UI component to an existing page
- Update a server action with new logic
- Add a filter dropdown to a list
Too large (split these):
- "Build the entire dashboard"
- "Add authentication"
- "Refactor the API"
After each iteration, the agent updates relevant AGENTS.md files with learnings. This is important because the AI automatically reads these files, so future iterations (and human developers) benefit from discovered patterns, gotchas, and conventions.
Examples of what to add to AGENTS.md:
- Patterns discovered ("this codebase uses X for Y")
- Gotchas ("do not forget to update Z when changing W")
- Useful context ("the settings panel is in component X")
The agent only works with proper feedback loops:
- Typecheck catches type errors
- Tests verify behavior
- CI must stay green (broken code compounds across iterations)
Frontend stories must include "Verify in browser using dev-browser skill" in acceptance criteria. The agent will use the dev-browser skill to navigate to the page, interact with the UI, and confirm changes work.
When all stories have passes: true, the agent outputs <promise>COMPLETE</promise> and the loop exits.
Check current state:
# See which stories are done
cat prd.json | jq '.userStories[] | {id, title, passes}'
# See learnings from previous iterations
cat progress.txt
# Check git history
git log --oneline -10Edit prompt.md to customize the agent's behavior for your project:
- Add project-specific quality check commands
- Include codebase conventions
- Add common gotchas for your stack
The agent automatically archives previous runs when you start a new feature (different branchName). Archives are saved to archive/YYYY-MM-DD-feature-name/.