feat(quick-dev): add epic context compilation to step-01
Fork step-01 context loading: epic stories get a sub-agent that
compiles planning docs into a cached epic-{N}-context.md, while
freeform intents keep the lightweight directory-listing path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
59b07c33e2
commit
673fdcd8d6
|
|
@ -0,0 +1,72 @@
|
|||
# Compile Epic Context
|
||||
|
||||
You are a context-compilation agent. Your job is to read planning artifacts and produce a single, scoped context document for one epic.
|
||||
|
||||
## Inputs
|
||||
|
||||
You will receive:
|
||||
|
||||
- **Epic number** — which epic to compile context for
|
||||
- **Epics file path** — the file containing epic and story definitions
|
||||
- **Planning artifacts directory** — where PRD, architecture, UX, and other planning docs live
|
||||
- **Output path** — where to write the compiled context file
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Load the epics file** and extract the definition for the target epic: its title, goal, and story list.
|
||||
|
||||
2. **Scan the planning artifacts directory** for these standard BMAD files:
|
||||
- PRD (`*prd*`) — product requirements and success criteria
|
||||
- Architecture (`*architecture*`) — technical design decisions and constraints
|
||||
- UX/Design (`*ux*`) — user experience and interaction design
|
||||
- Product Brief (`*brief*`) — project vision and scope
|
||||
|
||||
3. **For each planning doc found**, load it and extract only the sections relevant to this epic. Relevance means: the section describes a constraint, requirement, pattern, or decision that a developer working on any story in this epic needs to know. Skip sections that are about other epics or unrelated features.
|
||||
|
||||
4. **Write the compiled context file** to the output path using the format below.
|
||||
|
||||
## Output format
|
||||
|
||||
```markdown
|
||||
# Epic {N} Context: {Epic Title}
|
||||
|
||||
<!-- Compiled from planning artifacts. Edit freely — regenerate with compile-epic-context if planning docs change. -->
|
||||
|
||||
## Goal
|
||||
|
||||
{One paragraph: what this epic achieves and why it matters.}
|
||||
|
||||
## Stories
|
||||
|
||||
{Numbered list of stories in this epic — ID and title only. No details.}
|
||||
|
||||
## Requirements & Constraints
|
||||
|
||||
{Relevant product requirements, success criteria, and non-functional requirements scoped to this epic. Describe by purpose, not by source document section.}
|
||||
|
||||
## Technical Decisions
|
||||
|
||||
{Architecture decisions, tech stack constraints, API patterns, data models, and conventions relevant to this epic. Include ADR references where applicable.}
|
||||
|
||||
## UX & Interaction Patterns
|
||||
|
||||
{Relevant UX patterns, interaction flows, and design constraints. Omit this section entirely if no UX doc exists or nothing is relevant.}
|
||||
|
||||
## Cross-Story Dependencies
|
||||
|
||||
{Dependencies between stories within this epic, and any dependencies on other epics or external systems. Omit if none.}
|
||||
```
|
||||
|
||||
## Error handling
|
||||
|
||||
- If the epics file does not exist or the target epic number is not found in it, write nothing and report the problem to the calling agent.
|
||||
- If no planning docs match the expected patterns, write the output file with only the Goal and Stories sections populated from the epics file. Note the absence of planning docs in the Goal section.
|
||||
|
||||
## Rules
|
||||
|
||||
- **Scope aggressively.** Include only what a developer working on this epic needs. When in doubt, leave it out — the developer can always read the full planning doc.
|
||||
- **Describe by purpose, not by source.** Write "API responses must include pagination metadata" not "Per PRD section 3.2.1, pagination is required." Planning doc internals will change; the constraint won't.
|
||||
- **No full copies.** Never paste entire planning doc sections. Distill into what matters for implementation.
|
||||
- **No story-level details.** The story list is for orientation only. Individual story specs handle the details.
|
||||
- **No code.** Nothing derivable from reading the codebase belongs here.
|
||||
- **Keep it compact.** Target 800–1500 tokens. This file will be loaded into quick-dev's context alongside other material.
|
||||
|
|
@ -41,19 +41,23 @@ Never ask extra questions if you already understand what the user intends.
|
|||
1. Load context.
|
||||
- List files in `{planning_artifacts}` and `{implementation_artifacts}`.
|
||||
- If you find an unformatted spec or intent file, ingest its contents to form your understanding of the intent.
|
||||
- Planning artifacts are the output of BMAD phases 1-3. Typical files include:
|
||||
- **PRD** (`*prd*`) — product requirements and success criteria
|
||||
- **Architecture** (`*architecture*`) — technical design decisions and constraints
|
||||
- **UX/Design** (`*ux*`) — user experience and interaction design
|
||||
- **Epics** (`*epic*`) — feature breakdown into implementable stories
|
||||
- **Product Brief** (`*brief*`) — project vision and scope
|
||||
- Scan the listing for files matching these patterns. If any look relevant to the current intent, load them selectively — you don't need all of them, but you need the right constraints and requirements rather than guessing from code alone.
|
||||
- **Previous story continuity.** Using the intent and loaded context (especially any epics file), infer whether the current work is a story from an epic. Do not rely on filename patterns or regex — reason about the intent, the artifact listing, and epics content together. If the intent is an epic story:
|
||||
1. Identify the epic and story number.
|
||||
2. Scan `{implementation_artifacts}` for specs from the same epic with `status: done` and a lower story number.
|
||||
3. Load the most recent one (highest story number below current).
|
||||
4. Extract its **Code Map**, **Design Notes**, **Spec Change Log**, and **task list** as continuity context for step-02 planning.
|
||||
If no `done` spec is found but an `in-review` spec exists for the same epic with a lower story number, note it to the user and ask whether to load it. If the intent is not an epic story, or no previous spec exists, skip this silently.
|
||||
- **Determine context strategy.** Using the intent and the artifact listing, infer whether the current work is a story from an epic. Do not rely on filename patterns or regex — reason about the intent, the listing, and any epics file content together.
|
||||
|
||||
**A) Epic story path** — if the intent is an epic story:
|
||||
1. Identify the epic number and story number.
|
||||
2. Check if `{implementation_artifacts}/epic-{N}-context.md` exists (where N is the epic number).
|
||||
- **If it exists**: load it. This is the compiled planning context for the epic — do not load raw planning docs (PRD, architecture, UX, etc.).
|
||||
- **If it does not exist**: spawn a sub-agent with `./compile-epic-context.md` as its prompt. Pass it the epic number, the epics file path, the `{planning_artifacts}` directory, and the output path `{implementation_artifacts}/epic-{N}-context.md`. When the sub-agent completes, verify the output file exists and is non-empty. If the file is missing, empty, or the sub-agent errored, fall back to path B. Otherwise load the compiled file.
|
||||
3. **Previous story continuity.** Scan `{implementation_artifacts}` for specs from the same epic with `status: done` and a lower story number. Load the most recent one (highest story number below current). Extract its **Code Map**, **Design Notes**, **Spec Change Log**, and **task list** as continuity context for step-02 planning. If no `done` spec is found but an `in-review` spec exists for the same epic with a lower story number, note it to the user and ask whether to load it.
|
||||
|
||||
**B) Freeform path** — if the intent is not an epic story:
|
||||
- Planning artifacts are the output of BMAD phases 1-3. Typical files include:
|
||||
- **PRD** (`*prd*`) — product requirements and success criteria
|
||||
- **Architecture** (`*architecture*`) — technical design decisions and constraints
|
||||
- **UX/Design** (`*ux*`) — user experience and interaction design
|
||||
- **Epics** (`*epic*`) — feature breakdown into implementable stories
|
||||
- **Product Brief** (`*brief*`) — project vision and scope
|
||||
- Scan the listing for files matching these patterns. If any look relevant to the current intent, load them selectively — you don't need all of them, but you need the right constraints and requirements rather than guessing from code alone.
|
||||
2. Clarify intent. Do not fantasize, do not leave open questions. If you must ask questions, ask them as a numbered list. When the human replies, verify that every single numbered question was answered. If any were ignored, HALT and re-ask only the missing questions before proceeding. Keep looping until intent is clear enough to implement.
|
||||
3. Version control sanity check. Is the working tree clean? Does the current branch make sense for this intent — considering its name and recent history? If the tree is dirty or the branch is an obvious mismatch, HALT and ask the human before proceeding. If version control is unavailable, skip this check.
|
||||
4. Multi-goal check (see SCOPE STANDARD). If the intent fails the single-goal criteria:
|
||||
|
|
|
|||
Loading…
Reference in New Issue