Create a master plan that decomposes a system into independent modules. Each module will be implemented as a separate plan in its own git worktree.
You are creating a master plan — a high-level decomposition of a system into
independent modules. Each module will later be implemented as a separate plan
(using plan+) in its own git worktree by an autonomous agent.
Workflow context: This master plan will not be implemented all at once.
plan+), and executes the code.Regular plan (plan+) | Master plan (plan+master) | |
|---|---|---|
| Granularity | Implementation steps | Module decomposition |
| Testable code checkpoints |
| Independent modules |
| Steps | Code changes with snippets | Module brief (scope, interfaces, dependencies) |
| Verification | pytest, build commands | Module implemented and merged |
| Who implements | Same agent, same session | Separate agent per module, in its own worktree |
| Detail level | Low-level (code snippets, exact files) | High-level (briefs, not step-by-step instructions) |
/tmp — see Workflow step 2.)The master plan has these top-level sections, written as markdown headings in the plan file:
A clear summary of the system's purpose, core functionality, and the primary technologies/stack. This gives every downstream agent the big picture.
Phase 0 is special — it is implemented directly in the main repo before spawning any worktrees. It sets up the shared foundation that unblocks parallel module development:
.env.example)Phase 0 uses ## [ ] Phase 0: Scaffolding format and can have sub-steps like a regular plan phase since it will be implemented directly.
Each module is a ## [ ] Phase N of M containing a functional brief — not a step-by-step implementation plan. The downstream agent will use this brief to create its own detailed plan.
Module brief format:
## [ ] Phase 1 of 4: User Authentication Module
### Scope
What this module does, its responsibilities, and boundaries.
What is NOT in scope (belongs to another module).
### Interfaces
- **Provides**: APIs, types, functions this module exposes to others
- **Depends on**: What it needs from other modules or existing code
### Data & state
Database tables, caches, or state stores this module owns or interacts with.
### Key design decisions
Important architectural choices the implementing agent should follow.
### Complexities & edge cases
Specific technical challenges, security concerns, or business rules
the downstream agent must handle.
### Verification
- [ ] Module implemented and tests pass
- [ ] Merged back to main
After all module briefs, include a section mapping out orchestration:
Define the standards that all downstream agents must follow. Only include sections relevant to the project — skip what doesn't apply:
The overarching testing philosophy all module agents must follow:
## Verification
- [ ] All modules implemented and merged
- [ ] Integration tests pass across module boundaries
- [ ] E2E tests pass for critical user journeys
## [ ] Phase 0: Scaffolding
### [ ] 1. Project setup and core contracts
Set up directory structure, build tooling, and define shared types:
- Database schemas for User, Project, Task
- API contract types and error format
- Test fixtures and helpers
### Files
- `src/models/` — ORM model definitions
- `src/api/contracts.py` — shared API types
- `tests/conftest.py` — shared test fixtures
### Verification
- [ ] Project builds cleanly
- [ ] Base test suite passes
## [ ] Phase 1 of 3: Database Schema and Models
### Scope
Migrations, ORM models, and data access layer. Owns all direct
database interaction.
### Interfaces
- **Provides**: SQLAlchemy models (`User`, `Project`, `Task`), repository classes
- **Depends on**: Phase 0 (schema definitions, base classes)
### Data & state
- Tables: `users`, `projects`, `tasks`
- Owns all migrations in `src/db/migrations/`
### Key design decisions
- Use Alembic for migrations
- Repository pattern for data access
### Complexities & edge cases
- Cascading deletes between projects and tasks
- Soft-delete support for users
### Verification
- [ ] Module implemented and tests pass
- [ ] Merged back to main
## [ ] Phase 2 of 3: REST API Layer
...
## [ ] Phase 3 of 3: Authentication and Authorization
...
## Dependencies & parallelization
- **Sequential**: Phase 0 → then all others
- **Parallel**: Phases 1, 2, 3 can run in parallel (all depend only on Phase 0 contracts)
- **Note**: Phase 3 uses User model from Phase 1, but only via the shared interface defined in Phase 0
## Shared engineering standards
### Error handling
- All API errors use `{error: string, code: string, details: object}` format
- Business logic raises domain exceptions; API layer converts to HTTP responses
### Security
- All inputs validated with Pydantic models
- SQL injection prevented by ORM-only database access
## Testing strategy
### Unit testing
- All business logic tested in isolation with mocked repositories
- Target: every public function has at least one test
### Integration testing
- Each module tests against a real test database
- Use shared fixtures from Phase 0
### E2E testing
- After integration: test user registration → create project → add tasks flow
## Verification
- [ ] All modules implemented and merged
- [ ] Integration tests pass across module boundaries
- [ ] E2E tests pass for critical user journeys
Run the plan CLI to create draft files:
plan.py create <slug> --prompt="<user's original request>" --agent=<your-agent-name>
auth-system, data-pipeline, plugin-framework).--prompt captures the user's original request for the log.--agent identifies you as an AI agent in the log.Use Glob, Grep, Read, and Explore agents to understand:
Think at the system level: what are the natural seams? What can be developed independently? What has ordering constraints?
If you're unsure whether an approach will work, write a proof of concept in /tmp. Don't modify the project during planning.
As you discover things, immediately write them to the appendix file:
The appendix is especially important for master plans — each worktree agent will read it to understand the broader system context.
Write the master plan following the structure above:
Each module should be implementable by a fresh agent that only reads:
Minimize coupling between modules. When coupling is unavoidable, define clear interfaces in Phase 0.
When the plan is complete, summarize it for the user. Include:
The user will either:
/plan-mode:plan+approve to approve it