feat(quick-dev): add epic context compilation to step-01#2218
feat(quick-dev): add epic context compilation to step-01#2218
Conversation
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>
📝 WalkthroughWalkthroughThis PR adds a new documentation file defining a context-compilation agent workflow for extracting epic-relevant constraints and decisions from planning artifacts, and refactors step-01's routing logic to implement an explicit two-branch strategy: epic stories load precompiled or freshly compiled epic context, while non-epic intents follow an existing freeform path with selective planning artifact loading. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md`:
- Around line 49-51: The cached epic context load step must validate file
integrity before trusting it: when checking
`{implementation_artifacts}/epic-{N}-context.md` ensure the file both exists and
is non-empty and passes a basic sanity check (e.g., minimum byte/line length and
presence of expected markers like a title or frontmatter token). If the file is
missing, zero-length, below the minimum threshold, or fails the sanity check, do
not load it; instead trigger the `./compile-epic-context.md` sub-agent passing
the epic number, epics file path, `{planning_artifacts}` and the intended output
`{implementation_artifacts}/epic-{N}-context.md`, then verify the produced file
again for existence and integrity before loading; if it still fails, fall back
to path B. Ensure the same validation is applied after sub-agent completion and
that any validation failure causes recompilation or fallback rather than
silently accepting a bad cache.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c322946b-4b5a-4706-937f-1fade57a5e7d
📒 Files selected for processing (2)
src/bmm-skills/4-implementation/bmad-quick-dev/compile-epic-context.mdsrc/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md
| 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. |
There was a problem hiding this comment.
Validate cached epic context before trusting it.
At Line 49-Line 51, existing cache files are loaded without integrity checks. An empty/truncated epic-{N}-context.md would be accepted and prevent recompilation, leading to bad downstream context.
Suggested fix
- 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.).
+ 2. Check if `{implementation_artifacts}/epic-{N}-context.md` exists (where N is the epic number).
+ - **If it exists**: verify it is non-empty and appears valid (contains the expected `# Epic {N} Context` header).
+ - If valid: load it. This is the compiled planning context for the epic — do not load raw planning docs (PRD, architecture, UX, etc.).
+ - If invalid: treat as missing and run compilation (or fall back to path B if compilation fails).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md`
around lines 49 - 51, The cached epic context load step must validate file
integrity before trusting it: when checking
`{implementation_artifacts}/epic-{N}-context.md` ensure the file both exists and
is non-empty and passes a basic sanity check (e.g., minimum byte/line length and
presence of expected markers like a title or frontmatter token). If the file is
missing, zero-length, below the minimum threshold, or fails the sanity check, do
not load it; instead trigger the `./compile-epic-context.md` sub-agent passing
the epic number, epics file path, `{planning_artifacts}` and the intended output
`{implementation_artifacts}/epic-{N}-context.md`, then verify the produced file
again for existence and integrity before loading; if it still fails, fall back
to path B. Ensure the same validation is applied after sub-agent completion and
that any validation failure causes recompilation or fallback rather than
silently accepting a bad cache.
Summary
Test plan
Generated with Claude Code