Long-running Agent
Initializer + Coding Agent
Core idea: split one Agent into two roles — one responsible for planning, one for execution. Every handoff leaves a clean state.
Dual-role Solution
Two Agents, clear division of responsibility
Runs on first round only
Initializer Agent
Responsible for bootstrapping: set up environment, define the plan, make the first commit
- Create
init.shscript to set up the dev environment - Write
claude-progress.txtprogress file - Expand user's high-level prompt into a detailed feature checklist (JSON format)
- Make the first git commit, ensuring the repo is in a clean state
Runs every round
Coding Agent
Responsible for continuous progress: implement features one by one, keep moving forward
- Read the progress file to understand the current state
- Do one feature at a time
- Update the progress file after completion
- git commit with a clear message of what was done
Feature Checklist Design
A proven approach is to use JSON format for the feature checklist — Markdown is not suitable for this purpose. The reason: models are less likely to accidentally modify structured JSON, whereas Markdown tends to get rewritten by the model.
// feature checklist in claude-progress.txt
{
"features": [
{
"category": "authentication",
"description": "Email/password login with session management",
"steps": [
"Create login form component",
"Implement auth API endpoint",
"Add session cookie handling",
"Write end-to-end test"
],
"passes": false
},
{
"category": "chat",
"description": "Real-time streaming chat with Claude API",
"steps": ["..."],
"passes": false
}
]
}
Use strong wording in the Prompt: explicitly tell the Agent "do not delete or modify existing test content." Otherwise the Agent will lower test standards just to make tests pass.
Incremental Progress: One Feature at a Time
Why "one at a time" is the key
- 1 After completing each feature, the code is in a mergeable state: no half-baked work, no syntax errors
- 2 Git commits provide rollback points: if the next round breaks something, you can return to the last clean state
- 3 The progress file provides context: a new Agent doesn't have to guess where things are — just read the file
- 4 The context window won't overflow: each round only needs context for one feature, preventing accumulation to the limit
Test Verification
Agents often think they're done but haven't done end-to-end verification. It says "login feature is implemented," but the button doesn't actually click. Solution:
Explicitly require the Agent to do end-to-end testing with browser automation.
You need to actually open a browser, click buttons, and verify results — unit tests alone are not enough. Have the Agent write E2E tests with Puppeteer / Playwright as the criterion for whether a feature truly "passes."
You need to actually open a browser, click buttons, and verify results — unit tests alone are not enough. Have the Agent write E2E tests with Puppeteer / Playwright as the criterion for whether a feature truly "passes."
Final Result
200+ feature claude.ai clone successfully built
Using the Initializer + Coding Agent dual-role pattern, the Agent successfully autonomously built a complete web application with 200+ features. Every feature has a corresponding E2E test, and the code always remains in a mergeable state.
Good handoff mechanism = good long-running Agent. Progress files, feature checklists, incremental commits — these are the most basic guarantees for an Agent to keep moving forward. Nothing fancy.