fix(quick-dev): tighten epic context loading per PR review

- Validate cached epic-<N>-context.md is non-empty and starts with the
  expected header before loading; treat invalid cache as missing.
- Replace inline {N} placeholders with <N> so the skill validator does
  not flag them as unresolved workflow variables.
- Replace ambiguous "fall back to path B" with an explicit instruction
  to scan/load planning artifacts using path B's procedure, with a note
  not to re-evaluate path B's gating clause.

Addresses CodeRabbit and Augment review comments on PR #2218.
This commit is contained in:
Alex Verkhovsky 2026-04-07 13:35:58 -07:00
parent 673fdcd8d6
commit 20737aff91
1 changed files with 3 additions and 3 deletions

View File

@ -45,9 +45,9 @@ Never ask extra questions if you already understand what the user intends.
**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.
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 starts with a `# 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 (empty, truncated, or wrong header), treat it as missing and fall through to the compilation step below.
- **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 loading raw planning artifacts using path B's loading procedure below (scan `{planning_artifacts}` for PRD, architecture, UX, and epics files and load selectively) — apply this fallback even though the intent is an epic story; do not re-evaluate path B's gating clause. 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: