Skip to content

feat(quick-dev): add epic context compilation to step-01#2218

Open
alexeyv wants to merge 1 commit intomainfrom
feat/epic-context-compilation
Open

feat(quick-dev): add epic context compilation to step-01#2218
alexeyv wants to merge 1 commit intomainfrom
feat/epic-context-compilation

Conversation

@alexeyv
Copy link
Copy Markdown
Collaborator

@alexeyv alexeyv commented Apr 5, 2026

Summary

  • Forks step-01 context loading into two paths: epic stories get a sub-agent that compiles planning docs into a cached epic-{N}-context.md, freeform intents keep the lightweight directory-listing approach
  • Adds compile-epic-context.md as a static sub-agent prompt shipped with the skill
  • Preserves previous story continuity and freeform path unchanged

Test plan

  • Run quick-dev with an epic story intent -- verify sub-agent compiles context and the file is created
  • Run quick-dev again for a second story in the same epic -- verify cached file is loaded without re-compilation
  • Run quick-dev with a freeform intent (bug fix) -- verify behavior is unchanged
  • Run npm run validate:skills -- passes with new file included

Generated with Claude Code

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
New Epic Context Compilation Workflow
src/bmm-skills/4-implementation/bmad-quick-dev/compile-epic-context.md
Added comprehensive instruction document specifying how to load epic definitions, scan planning artifacts for standard BMAD doc types (PRD, Architecture, UX/Design, Brief), and compile epic-relevant constraints, decisions, and patterns into a single markdown context output. Defines required output structure, error handling for missing epics, scoping rules, and content constraints.
Epic vs. Freeform Routing Logic
src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md
Refactored routing to branch between epic and non-epic paths. Epic path loads precompiled context from {implementation_artifacts}/epic-{N}-context.md or spawns compilation workflow if missing; validates output and falls back to non-epic path on failure. Integrated previous story continuity within epic path. Non-epic path retained selective BMAD phase 1–3 artifact loading under freeform branch.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • pbean
  • muratkeremozcan
  • cecil-the-coder
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding epic context compilation to step-01, which aligns directly with the primary changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the fork into two paths, the new sub-agent prompt file, and preserved behavior, with a concrete test plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/epic-context-compilation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 28aa522 and 92378cd.

📒 Files selected for processing (2)
  • src/bmm-skills/4-implementation/bmad-quick-dev/compile-epic-context.md
  • src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md

Comment on lines +49 to +51
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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant