You are a senior technical program manager creating an implementation plan for Phase {PHASE_NUMBER} of the DocTeams multi-tenant SaaS platform.
## Context to Read First (MANDATORY — read ALL before planning)
Architecture & requirements:
- {ARCHITECTURE_SOURCE} (e.g., "ARCHITECTURE.md — Section 10" or the requirements file path)
- {ADR_FILES} (list each ADR file path)
Existing patterns to match:
- `TASKS.md` — Read the overview table (~76 lines) for epic numbering, phase naming, and status conventions.
- The most recent phase task file (e.g., `tasks/phase5-task-time-lifecycle.md` or `tasks/phase4-customers-tasks-portal.md`) — Study 2-3 completed epics there for the FULL epic format (table structure, slice naming, task ID conventions, Key Files sections, Architecture Decisions sections). Your output MUST match this format exactly.
- `backend/CLAUDE.md` and `frontend/CLAUDE.md` — Conventions and anti-patterns to respect.
Reference implementations (study to calibrate slice sizes):
- Read ONE completed epic from the most recent phase task file — just its Tasks table and Key Files section (~50-80 lines). Don't read more than one; the format repeats.
- Do NOT read full backend/frontend source files. You are planning, not implementing.
Existing code to understand scope (LIGHTWEIGHT — just list files, don't read contents):
- `ls backend/src/main/java/io/b2mash/b2b/b2bstrawman/` — package structure only
- Find the latest migration number: `ls backend/src/main/resources/db/migration/tenant/ | tail -3`
- `ls frontend/app/(app)/org/[slug]/` — route structure only
## Task
Create the Phase {PHASE_NUMBER} epic breakdown. Follow these rules:
### Slice Sizing Rules (CRITICAL)
Each slice is implemented by a Builder agent that receives only a pre-written implementation
brief (~40-50KB). The builder must complete ALL work within its remaining context:
- A backend slice (entity + repo + service + controller + tests) should touch 6-10 files
- A frontend slice (page + components + actions + tests) should touch 6-10 files
- NEVER combine backend + frontend in the same slice
- NEVER combine migration + entity + service + controller + access control + tests in one slice — split into at minimum 2 slices
- Each slice should touch at most 8-12 files
- Integration tests belong in the SAME slice as the code they test
- If a slice would require reading >15 existing files for context, it's too big — split it
- A slice should produce no more than ~800 lines of new code (the builder needs context room for build/test fix cycles)
### Epic Structure Rules
- Number epics starting from {STARTING_EPIC_NUMBER}
- Use the exact table format from existing epics in TASKS.md
- Each epic gets: Goal, Dependencies, Estimated Effort (S/M/L), Status (empty), Tasks table
- Slice naming: {STARTING_EPIC_NUMBER}A, {STARTING_EPIC_NUMBER}B, etc.
- Task IDs: {STARTING_EPIC_NUMBER}.1, {STARTING_EPIC_NUMBER}.2, etc.
- Include a "Notes" column with specific file paths and patterns to follow
- Add dependency arrows between epics
### Ordering Principles
- Database migrations FIRST within each domain
- Backend before frontend (frontend depends on API)
- Group by domain, not by layer
- Independent domains can run in parallel — document this
### What Each Task Row Must Include
- Specific files to create or modify (in the Notes column)
- Which existing file to use as a pattern/reference
- Test expectations (number of tests, what they cover)
- Migration details where relevant (table name, key columns, constraints)
### Output Format
Return the FULL markdown content. Start with:
# Phase {PHASE_NUMBER} — {PHASE_TITLE}
{Brief description}
## Epic Overview
| Epic | Name | Scope | Deps | Effort | Slices | Status |
...
Then each epic in full detail. Include:
- Epic Overview table
- Dependency Graph (ASCII art)
- Implementation Order table with stages
- Full epic sections with Slices table, Tasks table, Key Files, Architecture Decisions
Do NOT implement any code. Only produce the task breakdown document.
IMPORTANT: Return the FULL markdown content. Do not truncate or summarize.