This guide defines a structured approach to help AI Agents continuously, stably, and safely advance projects across multiple context windows in long-cycle software development tasks.
| Document | Purpose |
|---|---|
| Guide: Overview | Core concepts and principles |
| Guide: Project Structure | File organization |
| Guide: Agent Selection | Choosing the right agent |
| Guide: Session Workflow | Day-to-day operations |
| Guide: Security | Command whitelist and constraints |
| IDE Integration | Using ADDS with popular IDEs |
| P0 Roadmap | P0 improvement roadmap |
| Architecture | P0 architecture design |
New to ADDS? Start with the Guide Overview.
P0 Architecture? See Architecture Document.
The biggest problem facing long-running AI tasks is context fragmentation:
- State Loss: At the start of each new session, the Agent is "amnesiac".
- Overreaching: Agents tend to complete all features in one shot, leading to decreased code quality or context overflow.
- Premature Completion: Agents seeing existing code may mistakenly believe tasks are complete.
- Environment Fragmentation: Unconfigured environments or missing dependencies prevent new sessions from starting work immediately.
- Regression Blind Spots: New features break old ones, and Agents continue without noticing.
- Security Out of Control: Agents execute dangerous commands without any constraints.
LangChain Pattern: "The purpose of the harness engineer: prepare and deliver context so agents can autonomously complete work."
We decompose tasks into specialized roles, each executed by a dedicated agent prompt:
- Responsibility: Requirements analysis and task decomposition.
- Trigger Condition: Project first launch, or when
.ai/feature_list.mdfile does not exist. - Tasks:
- Read original requirements (
app_spec.mdorapp_spec.txt). - Break down feature list, generate
.ai/feature_list.md(containing 50-200 atomic test cases). - Assign priorities and dependencies.
- Track progress and manage scope.
- Read original requirements (
- Prompt File:
.ai/prompts/pm_prompt.md
- Responsibility: Technical design and architecture.
- Trigger Condition: PM completes requirement analysis.
- Tasks:
- Design system architecture.
- Select technology stack.
- Generate
.ai/architecture.mdto record technology selection and architecture decisions. - Write
init.shfor automated environment configuration.
- Prompt File:
.ai/prompts/architect_prompt.md
- Responsibility: Feature implementation.
- Trigger Condition: Architecture approved, feature assigned.
- Tasks:
- Implement ONE feature per session.
- Write unit tests.
- Self-verify implementation.
- Update feature status to
testing.
- Prompt File:
.ai/prompts/developer_prompt.md
- Responsibility: Test verification and quality assurance.
- Trigger Condition: Developer completes feature (status:
testing). - Tasks:
- Run all test cases.
- Verify acceptance criteria.
- Run regression tests.
- Document test results.
- Prompt File:
.ai/prompts/tester_prompt.md
- Responsibility: Code review and security audit.
- Trigger Condition: Tests pass.
- Tasks:
- Review code quality.
- Check security vulnerabilities.
- Verify architecture compliance.
- Approve or reject feature.
- Prompt File:
.ai/prompts/reviewer_prompt.md
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ PM │───▶│ Architect │───▶│ Developer │───▶│ Tester │───▶│ Reviewer │
│ │ │ │ │ │ │ │ │ │
│ Requirements│ │ Architecture│ │ Feature │ │ Test │ │ Code Review │
│ Decomposition│ │ Design │ │ Implementation│ │ Verification│ │ Security │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
pending → in_progress → testing → completed
↓
bug → in_progress (fix)
Every project must contain the following "self-descriptive" files:
.ai/feature_list.md: Single Source of Truth for features. Each feature must include:id,category,description,priority,corestatus,dependencies,steps,test_cases,security_checksacceptance_criteria: Atomized completion checklist.
progress.md: Human/Agent-oriented natural language progress summary. Uses incremental append mode, recording "completed", "in progress", "to-do items", and next handoff instructions.CORE_GUIDELINES.md: (New) Minimal self-boosting manual. Placed in project root directory for AI to instantly start and align development process..ai/architecture.md: Records project architecture, technology stack selection, and core data flow..ai/prompts/: Agent prompt files (pm, architect, developer, tester, reviewer).init.sh: Scripted environment. After running this script, any Agent should be able to immediately execute tests or start development.app_spec.md: Original project requirements source.
Every development session must follow these strict steps:
- Execute
pwd,lsto familiarize with structure. - Read
CORE_GUIDELINES.md(quick start). - Read
progress.mdand.ai/feature_list.md. - Check
git log --oneline -10to understand recent changes.
Anthropic Pattern: "Start the session by running a basic test on the development server to catch any undocumented bugs. If the agent had instead started implementing a new feature, it would likely make the problem worse."
- Execute
init.shor run smoke tests to verify environment is healthy. - Check if dependencies are installed (
node_modules/,venv/, etc.). - Check if services are running (
curl localhost:3000/healthetc.). - If anything fails: FIX IT FIRST before proceeding with any feature work.
- This step is MANDATORY - do not skip even for small changes.
Anthropic Pattern: Every session must verify the system hasn't regressed before starting new work.
- Select 2-3 core features from completed features and run their tests.
- This prevents the "agent tends to try to do too much at once" problem.
- If existing features are broken:
- 🛑 STOP - Do NOT proceed with new feature development
- 🔧 Prioritize fixing regression issues BEFORE any new features
- Mark affected features as status:
regressioninfeature_list.md - 📝 Record in
progress.md - Re-run regression check until all pass
- Only then proceed to new features
LangChain Pattern: "Context discovery and search are error prone, so injecting context reduces this error surface and helps onboard the agent into its environment."
- Directory Structure: Map cwd, parent directories, key subdirectories
- Available Tools: Detect installed tools (python, node, npm, pytest, go, cargo, etc.)
- Project Config: Read package.json, requirements.txt, Cargo.toml, go.mod, etc.
- Coding Standards: Check for .eslintrc, .prettierrc, pyproject.toml, etc.
- Test Framework: Identify testing framework (jest, pytest, go test, etc.)
This context should be noted and used throughout the session to ensure compliance with project conventions.
LangChain Pattern: "Agents are famously bad at time estimation so this heuristic helps. Time budgeting nudges the agent to finish work and shift to verification."
- Set a mental time budget for this session (e.g., 15-20 minutes per feature)
- If you approach the time limit:
- Complete current atomic operation
- Run validation tests
- Prioritize committing work over perfect implementation
- Leave clear handoff notes in
progress.md
- Select the highest priority
pendingtask fromfeature_list.md. - Ensure all its
dependenciesare completed. - Update status to
"status": "in_progress".
LangChain Pattern: "Forcing models to conform to testing standards is a powerful strategy to avoid 'slop buildup' over time."
- Write code. Strictly prohibit exceeding the scope of the currently selected task.
- Follow project coding standards, add necessary comments.
- Write corresponding test cases.
- Write Testable Code:
- Follow exact file paths as specified in acceptance criteria
- Test both happy paths AND edge cases
- Write assertions that match automated scoring
- Consider boundary conditions: empty inputs, max values, error states
LangChain Pattern: "Verify: Run tests, read the FULL output, compare against what was asked (not against your own code)."
- Use tools (such as simulators, browsers, unit tests) to verify functionality.
- Evidence-driven: Agent must provide tool execution evidence.
- Only when all
test_casesstatus arepassedandacceptance_criteriaare met can it be marked as complete. - Choose verification method based on project type (see Section 5 for details).
LangChain Pattern: "Agents can be myopic once they've decided on a plan which results in 'doom loops' that make small variations to the same broken approach (10+ times in some traces)."
- Monitor your work during implementation
- If you've edited the same file 5+ times without success:
- 🛑 STOP and reconsider your approach
- Document what you've tried in
progress.md - Ask for help or try a completely different strategy
- Consider if the task is blocked by a dependency
- Execute
git add/git commitwith detailed commit messages. - Update status in
feature_list.md. - Leave handoff instructions for "next developer" in
progress.md.
- Atomic Testing: Each feature point must be independently testable.
- Evidence-driven: All features must provide tool execution results (logs, assertion outputs, screenshots) as completion evidence.
- Test Case Embedding: Each feature must include
test_casesfield infeature_list.md.
- Must use tools like Playwright/Cypress for end-to-end simulation.
- Simulate real user operations (clicks, inputs, scrolling).
- Verify page transitions, error message display, UI rendering.
- Prohibit using API calls to bypass UI verification.
- Verify response status codes, data formats, error handling.
- Verify database status is correct.
- Use pytest / Newman and other tools for automated testing.
- Test command line input/output.
- Verify exit codes are correct.
- Test exception parameter handling.
AI must verify safety before executing any command.
| Category | Commands |
|---|---|
| File Operations | ls, cat, head, tail, wc, grep, find, cp, mv |
| Node.js | npm, node, npx, yarn |
| Python | pip, python, pytest, black, flake8, mypy |
| Go | go, gofmt |
| Rust | cargo, rustc, rustfmt |
| Version Control | git (all subcommands) |
| Process Management | ps, lsof, sleep |
| Category | Commands | Reason |
|---|---|---|
| Privilege Escalation | sudo, su |
System-level risk |
| Permissions | chmod, chown (unless explicitly necessary) |
Permission changes |
| Destructive | rm -rf /, mkfs, fdisk |
Irrecoverable data |
| Network Backdoors | nc, netcat, telnet |
Security risks |
| Firewall | iptables, route |
Network configuration changes |
| Blind Downloads | curl | bash, wget | sh |
Unreviewed scripts |
| System Process Killing | kill -9 (system processes) |
System stability |
Beyond the static whitelist, ADDS implements a dynamic permission system:
| Permission | Behavior |
|---|---|
| Allow | Execute automatically, no confirmation needed |
| Ask | Prompt user for confirmation before execution |
| Deny | Block execution entirely |
Permission priority: Session config > CLI flags > Project settings > User settings
Permission modes:
| Mode | Description |
|---|---|
default |
Sensitive operations require confirmation (recommended) |
plan |
Read-only mode (exploration phase) |
auto |
AI classifier auto-decides (advanced) |
bypass |
All operations auto-approved (dangerous) |
Dead loop protection: Same tool denied 3 consecutive times → 30s cooldown
Each command execution must verify:
- ✅ Is the command in the whitelist?
- ✅ Is the permission level appropriate (Allow/Ask/Deny)?
- ✅ Are the parameters safe?
- ✅ Does it not affect system files?
- ✅ Are irreversible operations backed up?
- ✅ If in doubt, ask the user first.
- ❌ Cannot be deleted
⚠️ Modifications require clear justification and change reasons must be recorded- ✅ Can adjust priority
- ✅ Can be deleted (must record reason)
- ✅ Can modify description/steps
- ✅ Can be postponed
- Update
app_spec.mdto reflect new requirements. - Evaluate impact on existing features.
- Update
feature_list.md(add/modify/postpone). - Record change reasons in
progress.md.
{
"id": "F005",
"status": "regression",
"regression_details": {
"detected_at": "2026-02-26T14:00:00Z",
"symptoms": "Login functionality returns 500 error",
"likely_cause": "F010's database migration broke the user table",
"affected_tests": ["test-005-01"]
}
}- Prioritize fixing regression issues before continuing with new features.
- Update feature status to
"status": "blocked", recordblocked_reason. - Skip the feature, select next executable feature.
- Record blocking details in
progress.md.
- Read
progress.mdto understand history. - Read
.ai/feature_list.mdto check current status. - Execute
git logto see recent commits. - Run environment verification and regression tests.
- Continue with next pending feature.
When an Agent encounters execution errors or test failures, it should follow this protocol:
- Automatic Classification: Determine if it's an environment issue (run
init.sh), code issue (auto-fix), or requirement issue (consult documentation). - Retry Count: Track retry attempts in
feature_list.md. - Backoff and Rollback: If
max_retriesis reached, Agent must:- Execute
git reset --hardto last stable state. - Mark status as
"blocked". - Record specific
blocked_reason. - Skip the task, try next task in queue.
- Record the decision in
progress.md.
- Execute
- Each feature completion must be committed.
- Strictly prohibit committing multiple features at once.
- Commit message format:
<type>(<scope>): <description> [Closes #feature-id]
- Implementation detail 1
- Implementation detail 2
- Add test cases
Type Categories:
feat:New featurefix:Bug fixrefactor:Code refactoringtest:Test relateddocs:Documentation updatechore:Build/tool related
| Dimension | Requirement |
|---|---|
| Feature Completion | All features completed, no blocked or regression |
| Test Coverage | Test coverage ≥ 70% |
| Code Quality | No lint errors, passes type checking |
| Documentation | Complete README, clear API documentation, sufficient code comments |
| Git History | One commit per feature, clear messages, no redundancy |
- Moderate Granularity: One feature completed in 1-4 hours
- Independent Testability: No dependencies on unfinished features
- Clear Value: Each feature has clear business value
- Clear Boundaries: Distinct responsibilities between features
- Test-Driven: Write tests first, then implementation
- Continuous Refactoring: Keep code clean
- Documentation Synchronization: Code and documentation remain consistent
- Version Control: Small, frequent commits
- Timely Updates: Update status immediately after completing features.
- Humanized Logs: Incrementally record each session's decisions and achievements in
progress.md. - Regular Review: Check progress and remaining work
Long-running projects generate increasingly large context files. ADDS implements a two-layer compression strategy combined with a two-layer memory system to manage context efficiently.
Key principles:
- Compress, don't lose: Historical data is archived, never deleted
- Recent context is king: The last session's summary is always injected
- Patterns emerge from data: Failed features and blocked tasks contain valuable lessons
- Memory is immutable: .mem files are APPEND-ONLY, preserving history
Layer 1: In-Session Compression (Real-time, no API call)
Triggered when tool output exceeds threshold (default 2000 chars):
- Save full output to
.logfile - Replace in session with placeholder + summary
- Error signals (exit code != 0, Exception, Traceback) are NEVER compressed (KEEP_FULL)
Layer 2: Session Archive (Triggered at 80% context window)
- Merge session + logs into complete record
- LLM generates structured summary (decisions, code changes, test results, lessons)
- Generate
.memfile (APPEND-ONLY) with summary + full record + chain pointers - Rewrite
.sesfile as summary version
Token Budget Management:
| Budget Region | Ratio | Purpose |
|---|---|---|
| System Prompt | 15% | Static + dynamic instructions |
| Memory | 10% | Fixed memory + last session summary |
| History | 55% | Current session messages |
| Tool Results | 15% | Tool output |
| Reserve | 5% | Safety margin |
Layer 1: Index Layer (always in context)
index.mem contains:
- Fixed memory (upgraded insights: environment facts, lessons, skills, user preferences)
- Memory index (pointers to .mem files)
- Chain pointers (to index-prev.mem when capacity overflows)
Token budget: ~500-1000 tokens
Layer 2: Memory Layer (on-demand loading)
.mem files contain:
- Structured summary (condensed by LLM)
- Full record (APPEND-ONLY, never modified)
- Chain pointers (Prev/Next bidirectional linked list)
Retrieval: chain traversal + rg keyword search
Upgrade flow: Session success → Reflection protocol (role-first-person) → Evaluate upgrade → Write to fixed memory
Detox flow: Session failure → Failure-driven invalidation → Negative penalty → Priority decay → Demotion
Conflict resolution:
- System Prompt vs Fixed Memory → System Prompt wins (automatic)
- User latest vs Fixed Memory → Recency Bias (automatic)
- System Prompt vs User latest → Must confirm with user
adds mem status # Memory system health overview
adds mem audit # Interactive memory review
adds mem prune --module auth # Clean up stale memories
adds mem override <id> # Human correction of memory
adds mem history <id> # View memory lifecycle
adds mem checkpoint --tag v1.0.0 # Snapshot current memory
adds mem checkpoint --tag v1.0.0 --promote # Snapshot + promote to intuition- Layer 1: When tool output exceeds threshold (automatic)
- Layer 2: When context window reaches 80% (automatic)
- Manual:
adds session archiveor checkpoint
Record failure patterns and recovery strategies in .mem files:
## [YYYY-MM-DD HH:MM] Session: Developer Agent
### Lessons Learned
- **Issue**: Database connection timeout during E2E tests
- **Root Cause**: Connection pool not configured for test environment
- **Prevention**: Added health check to init.sh
- **Feature**: F015 - Payment ProcessingCore concept: Anticipating that new models will replace current logic, the architecture must be modular and ready to "rip out" old code at any time. ADDS is designed as a set of independent prompt files and guidelines that can be individually updated or replaced.
Current modules that may evolve as AI capabilities improve:
| Module | Current Status | Likely Future |
|---|---|---|
| Multi-Agent separation | Enabled (models need role specialization) | May consolidate as models improve |
| Regression check | Enabled (models still introduce regressions) | Keep until models self-verify |
| Command whitelist | Enabled (security constraint) | May relax for sandboxed environments |
| Loop detection | Enabled (models still fall into doom loops) | May reduce as models improve |
To update ADDS modules:
- Update the relevant prompt file in
.ai/prompts/ - Update
CORE_GUIDELINES.mdto reflect the change - Run
init-adds.py --upgrade(see upgrade mechanism) to propagate changes - Document the change in CHANGELOG
| Metric | Definition | Target |
|---|---|---|
| Task Completion Rate | Successfully completed features / total features | ≥ 90% |
| Regression Rate | Introduced regression issues / completed features | ≤ 5% |
| Blocking Rate | Blocked features / total features | ≤ 10% |
| Retry Rate | Features requiring retries / total features | ≤ 50% |
| Metric | Definition | Target |
|---|---|---|
| Average Development Time | Actual time per feature | As estimated |
| Estimation Accuracy | Actual time / estimated time | 0.8 - 1.2 |
| Context Utilization | Effective operations / total token usage | Optimizing |
| Metric | Definition | Target |
|---|---|---|
| Test Coverage | Test code lines / total code lines | ≥ 70% |
| Code Quality | Number of lint errors, type errors | 0 |
| Documentation Completeness | Documented features / total features | 100% |
Long-term Stability:
- Context Persistence: Cross-session state retention accuracy
- Environment Consistency: init.sh success rate
- Recovery Capability: Success rate of automatic recovery from errors
Use scripts/adds.py session commands to manage sessions, or manually review progress.md for session-by-session details.
Reports should include:
- Overall performance score
- Reliability metrics (completion rate, regression rate)
- Efficiency metrics (time per feature)
- Quality metrics (test coverage, lint errors)
- Improvement suggestions
- Check Project Status — See if
.ai/feature_list.mdalready exists - Determine Current Agent — Use the Agent Selection Logic (see CORE_GUIDELINES.md)
- Follow the Process — Strictly follow the above specifications
Remember: Your goal is to complete project development with high quality, sustainability, and safety. Follow the specifications, reduce mistakes, and ensure each feature is fully verified.
Let's start! 🚀