Feature Epic
Overview
Create a structured, decomposed epic under the tasks role resolved from AGENTS.md for features too large for a single agent session. The template default uses today's date as a directory hierarchy; the file slug begins with epic- (no date prefix in the slug).
When to Use
- Use
epic when feature spans >3 files AND requires >2 sessions, OR has >5 phases
- Use
plan for tasks completable within one agent session
- When unsure: start with
plan; if it outgrows a single task, upgrade to epic
Context
Rules & Constraints
Question Format (FR-UNIVERSAL.QA-FORMAT)
For clarifying / uncertainty-resolution questions asked during research (Step 2):
- Each question MUST be a numbered list item (
1., 2., …) — not a heading, bold-only line, or paragraph.
- For multi-select questions, when the user delegates with
agent's choice (or equivalent), pick the subset yourself, emit a one-line justification of the pick, and proceed without re-asking for confirmation.
Phase approval (Step 4) and critique-points selection (Step 7) are exempt — phase decomposition is a multi-section content presentation (the same prior that drives variant analysis), and critique triage is auto-classified by the agent without asking the user.
Instructions
Initialize
- Use a task management tool (e.g.,
todo_write, todowrite) to create a plan based on these steps.
- Compute today's date in
YYYY-MM-DD format (e.g. via date +%Y-%m-%d). Hold it as <DATE>. Derive <YYYY>, <MM>, <DD> (zero-padded). Resolve tasks from AGENTS.md and derive the eventual epic path from that role's layout.
Deep Context & Research
- Resolve
SRS and SDS from AGENTS.md. If you don't know their current content — read the resolved files now.
- Follow
Proactive Resolution from AGENTS.md: analyze prompt, codebase, search for gaps.
- Use search tools (e.g.,
glob, grep, ripgrep, search, webfetch) for unknowns.
- If uncertainties remain: ask user clarifying questions. STOP and wait.
Draft Spec Header
- Create the resolved epic file's parent directories (use
mkdir -p).
- Write to the resolved epic file the following sections:
- YAML frontmatter with all required keys (rule 12):
date, status: to do, tags, related_tasks, optional implements.
- Title and metadata table (Status: Draft, Created/Updated dates)
- Goal (business/user value — why are we building this?)
- Overview (current state, why now, relevant context)
- Non-Goals (explicit exclusions — critical for AI agents)
- Architecture & Boundaries (three-tier: Always / Ask First / Never)
- Definition of Done (measurable acceptance criteria)
- CRITICAL: Do NOT fill Phases yet.
Decompose into Phases (Chat Only)
- Present phase breakdown in chat:
- Each phase: goal, scope (files/components), dependencies, estimated task count
- Phases ordered by dependency (foundations first)
- Target: ≤30-50 requirements per phase (within ~150-200 instruction limit)
- Present to user. STOP and wait for approval/adjustments.
Detail Phases
- Write approved phases into the resolved epic file. Each phase contains:
- Status (not-started / in-progress / done)
- Prerequisites (which phases must be done first)
- Goal (what this phase achieves)
- Scope (files/components affected, target 1-5 files per task)
- Tasks (numbered list of atomic, testable tasks)
- Verification (specific commands/checks to confirm phase completion)
- Notes (implementation hints, gotchas, references)
Critique
- Present epic to user in chat and offer to critique it before finalizing.
- If user agrees, critically analyze the epic for:
- Missing phases or hidden dependencies
- Tasks too large (should be split) or too small (should be merged)
- Vague verification criteria
- Missing non-goals or boundary gaps
- Over-specification of trivial parts
- Present critique in chat.
Refine & Finalize
- Ask the user which critique points to address.
- Update the resolved epic file with accepted improvements.
- Update the metadata table Status from "Draft" to "Ready". (Frontmatter
status: is auto-derived from DoD; do not change it manually.)
7a. Write SRS-inline **Tasks:** Back-Pointer (FR-DOC-TASK-LINK) — execute immediately, no permission needed. This is a write step.
- For each FR-ID in the epic's
implements: frontmatter, locate the heading ### <FR-ID>: in the resolved SRS.
- If the heading does not exist (new FR introduced by the epic), SKIP this FR and emit a chat note: "FR-XXX SRS section pending — task back-pointer deferred."
- If the heading exists, find the section's
**Description:** bullet. Look at the line(s) immediately following it.
- If a
- **Tasks:** [...] bullet already exists: append , [epic-<name>](tasks/<YYYY>/<MM>/epic-<name>.md) to the comma-separated list. Idempotent: skip if the exact link is already present.
- If no
**Tasks:** bullet exists yet: insert a new line - **Tasks:** [epic-<name>](tasks/<YYYY>/<MM>/epic-<name>.md) immediately AFTER the **Description:** bullet.
- Surgical edit only: rest of the SRS file MUST remain byte-identical.
- TOTAL STOP
Output Format
---
date: YYYY-MM-DD
status: to do
implements:
- FR-XXX
tags: []
related_tasks: []
---
# Epic: {Feature Name}
| Field | Value |
|---------|-----------------------------|
| Status | Draft/Ready/In-Progress/Done |
| Created | YYYY-MM-DD |
| Updated | YYYY-MM-DD |
## Goal
{Why are we building this? Business/user value.}
## Overview
{Current state, why now, relevant context.}
## Non-Goals
<!-- Examples: "No backward compatibility with v1 API", "No UI changes in this phase", "No performance optimization", "No migration of existing data" -->
- {Explicit exclusion 1}
- {Explicit exclusion 2}
## Architecture & Boundaries
### Always (agent autonomy)
- {Things agent can always do}
### Ask First
- {Things requiring user confirmation}
### Never
- {Things agent must never do}
## Definition of Done
- [ ] {Measurable criterion 1}
- [ ] {Measurable criterion 2}
---
## Phase 1: {Name}
**Status:** not-started | **Prerequisites:** none
### Goal
{What this phase achieves.}
### Scope
- {file/component 1}
- {file/component 2}
### Tasks
1. {Atomic, testable task}
2. {Atomic, testable task}
### Verification
- [ ] {Specific check or command}
### Notes
- {Implementation hints, gotchas}
---
## Phase 2: {Name}
...
Verification
1---2name: epic3description: Use when the user asks to plan a LARGE feature that spans multiple sessions or phases — produces an epic under the `tasks` role from AGENTS.md with dependency-ordered phases, atomic tasks, and per-phase status tracking. Use plan for single-session tasks. Do NOT trigger on generic planning, roadmap, or brainstorming requests.4---56# Feature Epic78## Overview910Create a structured, decomposed epic under the `tasks` role resolved from AGENTS.md for features too large for a single agent session. The template default uses today's date as a directory hierarchy; the file slug begins with `epic-` (no date prefix in the slug).1112## When to Use1314- Use `epic` when feature spans >3 files AND requires >2 sessions, OR has >5 phases15- Use `plan` for tasks completable within one agent session16- When unsure: start with `plan`; if it outgrows a single task, upgrade to `epic`1718## Context1920<context>21Principal Software Architect role focused on specification, not implementation.22You are autonomous and proactive. You exhaust all available resources (codebase,23documentation, web) to understand the problem before asking the user.24</context>2526## Rules & Constraints2728<rules>291. **Pure Specification**: MUST NOT write code. Allowed-to-write artifacts:30 - (a) The epic file under the resolved `tasks` role. If the parent directories do not exist, CREATE them (use `mkdir -p`).31 - (b) The resolved `SRS` role — **surgical-edit only**. May insert/extend a single line `- **Tasks:** [epic-<name>](tasks/<relative-epic-path>.md)[, ...]` directly under the existing `**Description:**` bullet of each FR section listed in `implements:` (FR-DOC-TASK-LINK). All other SRS lines MUST remain byte-identical. See step 7a.322. **Planning**: The agent MUST use a task management tool (e.g., `todo_write`, `todowrite`, `Task`) to track execution steps.333. **Chat-First Reasoning**: Phase decomposition MUST be presented in CHAT first, not in the file.344. **No SwitchMode**: Do not call SwitchMode tool.355. **Proactive Resolution**: Follow `Proactive Resolution` rule from `## Planning Rules` in AGENTS.md.366. **Stop-Analysis Protocol**: Follow Stop-Analysis rules from `# YOU MUST` in AGENTS.md.377. **AGENTS.md Planning Rules**: Follow all rules from `## Planning Rules` section in AGENTS.md.388. **Living Document**: Per-phase Status (`not-started` → `in-progress` → `done`) is updated during implementation. Top-level frontmatter `status` is auto-derived from epic-wide `## Definition of Done` checkboxes by `commit` / `review-and-commit`; do NOT update it manually.399. **Phase Size Guard**: Each phase SHOULD contain ≤50 requirements and target ≤5 files per task. If exceeded → split.4010. **Implementation Hints Only in Notes**: Epic describes WHAT and WHY. HOW — only in Notes section as implementation hints (patterns, gotchas, references), not as code.4111. **Traceability**: If task implements known FR-* requirements, add `implements:` YAML frontmatter with FR-* codes from the resolved `SRS`. Optional — omit if FR-* not yet defined.4212. **Frontmatter Shape**: Required keys — `date: <YYYY-MM-DD>` (today's date as quoted ISO string), `status: to do` (initial value; auto-derived later), `tags: [...]` (may be empty `[]`), `related_tasks: [...]` (relative paths to other tasks under the resolved `tasks` role, may be empty). Optional: `implements: [FR-...]`.43</rules>4445## Question Format (FR-UNIVERSAL.QA-FORMAT)4647For **clarifying / uncertainty-resolution questions** asked during research (Step 2):4849- Each question MUST be a numbered list item (`1.`, `2.`, …) — not a heading, bold-only line, or paragraph.50- For multi-select questions, when the user delegates with `agent's choice` (or equivalent), pick the subset yourself, emit a one-line justification of the pick, and proceed without re-asking for confirmation.5152**Phase approval (Step 4) and critique-points selection (Step 7) are exempt** — phase decomposition is a multi-section content presentation (the same prior that drives variant analysis), and critique triage is auto-classified by the agent without asking the user.5354## Instructions5556<step_by_step>57581. **Initialize**59 - Use a task management tool (e.g., `todo_write`, `todowrite`) to create a plan based on these steps.60 - Compute today's date in `YYYY-MM-DD` format (e.g. via `date +%Y-%m-%d`). Hold it as `<DATE>`. Derive `<YYYY>`, `<MM>`, `<DD>` (zero-padded). Resolve `tasks` from AGENTS.md and derive the eventual epic path from that role's layout.61622. **Deep Context & Research**63 - Resolve `SRS` and `SDS` from AGENTS.md. If you don't know their current content — read the resolved files now.64 - Follow `Proactive Resolution` from AGENTS.md: analyze prompt, codebase, search for gaps.65 - Use search tools (e.g., `glob`, `grep`, `ripgrep`, `search`, `webfetch`) for unknowns.66 - If uncertainties remain: ask user clarifying questions. STOP and wait.67683. **Draft Spec Header**69 - Create the resolved epic file's parent directories (use `mkdir -p`).70 - Write to the resolved epic file the following sections:71 - YAML frontmatter with all required keys (rule 12): `date`, `status: to do`, `tags`, `related_tasks`, optional `implements`.72 - Title and metadata table (Status: Draft, Created/Updated dates)73 - Goal (business/user value — why are we building this?)74 - Overview (current state, why now, relevant context)75 - Non-Goals (explicit exclusions — critical for AI agents)76 - Architecture & Boundaries (three-tier: Always / Ask First / Never)77 - Definition of Done (measurable acceptance criteria)78 - **CRITICAL**: Do NOT fill Phases yet.79804. **Decompose into Phases (Chat Only)**81 - Present phase breakdown in chat:82 - Each phase: goal, scope (files/components), dependencies, estimated task count83 - Phases ordered by dependency (foundations first)84 - Target: ≤30-50 requirements per phase (within ~150-200 instruction limit)85 - Present to user. STOP and wait for approval/adjustments.86875. **Detail Phases**88 - Write approved phases into the resolved epic file. Each phase contains:89 - Status (not-started / in-progress / done)90 - Prerequisites (which phases must be done first)91 - Goal (what this phase achieves)92 - Scope (files/components affected, target 1-5 files per task)93 - Tasks (numbered list of atomic, testable tasks)94 - Verification (specific commands/checks to confirm phase completion)95 - Notes (implementation hints, gotchas, references)96976. **Critique**98 - Present epic to user in chat and offer to critique it before finalizing.99 - If user agrees, critically analyze the epic for:100 - Missing phases or hidden dependencies101 - Tasks too large (should be split) or too small (should be merged)102 - Vague verification criteria103 - Missing non-goals or boundary gaps104 - Over-specification of trivial parts105 - Present critique in chat.1061077. **Refine & Finalize**108 - Ask the user which critique points to address.109 - Update the resolved epic file with accepted improvements.110 - Update the metadata table Status from "Draft" to "Ready". (Frontmatter `status:` is auto-derived from DoD; do not change it manually.)1111127a. **Write SRS-inline `**Tasks:**` Back-Pointer (FR-DOC-TASK-LINK)** — execute immediately, no permission needed. This is a write step.113 - For each FR-ID in the epic's `implements:` frontmatter, locate the heading `### <FR-ID>:` in the resolved `SRS`.114 - If the heading does not exist (new FR introduced by the epic), SKIP this FR and emit a chat note: "FR-XXX SRS section pending — task back-pointer deferred."115 - If the heading exists, find the section's `**Description:**` bullet. Look at the line(s) immediately following it.116 - If a `- **Tasks:** [...]` bullet already exists: append `, [epic-<name>](tasks/<YYYY>/<MM>/epic-<name>.md)` to the comma-separated list. Idempotent: skip if the exact link is already present.117 - If no `**Tasks:**` bullet exists yet: insert a new line `- **Tasks:** [epic-<name>](tasks/<YYYY>/<MM>/epic-<name>.md)` immediately AFTER the `**Description:**` bullet.118 - **Surgical edit only**: rest of the SRS file MUST remain byte-identical.1191208. **TOTAL STOP**121122</step_by_step>123124## Output Format125126```markdown127---128date: YYYY-MM-DD129status: to do130implements:131 - FR-XXX132tags: []133related_tasks: []134---135# Epic: {Feature Name}136137| Field | Value |138|---------|-----------------------------|139| Status | Draft/Ready/In-Progress/Done |140| Created | YYYY-MM-DD |141| Updated | YYYY-MM-DD |142143## Goal144145{Why are we building this? Business/user value.}146147## Overview148149{Current state, why now, relevant context.}150151## Non-Goals152153<!-- Examples: "No backward compatibility with v1 API", "No UI changes in this phase", "No performance optimization", "No migration of existing data" -->154- {Explicit exclusion 1}155- {Explicit exclusion 2}156157## Architecture & Boundaries158159### Always (agent autonomy)160161- {Things agent can always do}162163### Ask First164165- {Things requiring user confirmation}166167### Never168169- {Things agent must never do}170171## Definition of Done172173- [ ] {Measurable criterion 1}174- [ ] {Measurable criterion 2}175176---177178## Phase 1: {Name}179180**Status:** not-started | **Prerequisites:** none181182### Goal183184{What this phase achieves.}185186### Scope187188- {file/component 1}189- {file/component 2}190191### Tasks1921931. {Atomic, testable task}1942. {Atomic, testable task}195196### Verification197198- [ ] {Specific check or command}199200### Notes201202- {Implementation hints, gotchas}203204---205206## Phase 2: {Name}207208...209```210211## Verification212213<verification>214- [ ] ONLY the resolved epic file modified, plus optional surgical `**Tasks:**` line edits in the resolved `SRS` (FR-DOC-TASK-LINK), plus optional resolved `index` row updates.215- [ ] Frontmatter contains `date`, `status: to do`, `tags`, `related_tasks` keys216- [ ] For every FR-ID in `implements:` whose SRS section already exists, the corresponding `### FR-XXX:` section now carries a `- **Tasks:**` bullet linking to the epic file. Other SRS lines unchanged.217- [ ] Each phase has: Goal, Prerequisites, Scope, Tasks, Verification218- [ ] Non-Goals section is non-empty219- [ ] Boundaries (Always/Ask First/Never) are specified220- [ ] No phase exceeds 50 requirements221- [ ] Tasks target ≤5 files each222- [ ] All phases have dependency ordering (no circular deps)223</verification>