From b483e66c3bff196e312b3b33252c13f7d597aca8 Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Tue, 23 Jun 2026 08:44:57 -0700 Subject: [PATCH] fix(quick-dev): backport dev auto prompt fixes (#2501) * fix(quick-dev): tighten ready standard Add sufficiency and coherence criteria so approval does not mask unresolved gaps, ambiguities, or contradictions in generated specs. * fix(quick-dev): verify acceptance before review Make the active session verify both tasks and acceptance criteria before review, and remove the redundant acceptance auditor review layer. * fix(quick-dev): persist review loop counter Store the review loop counter in spec frontmatter so loopbacks cannot reset it by re-reading the review step file. * style(quick-dev): normalize subagent spelling Use subagent and subagents consistently across Quick Dev step files. * docs(quick-dev): clarify customization comments Replace internal merge jargon and stale workflow comments with plain descriptions of the Quick Dev customization file behavior. * fix(quick-dev): structure deferred work entries Make Quick Dev append deferred work as source_spec, summary, and evidence entries without modifying existing entries or deduplicating during the run. --- .../4-implementation/bmad-quick-dev/SKILL.md | 2 + .../bmad-quick-dev/customize.toml | 38 ++++++++----------- .../bmad-quick-dev/spec-template.md | 1 + .../step-01-clarify-and-route.md | 11 ++++-- .../bmad-quick-dev/step-02-plan.md | 9 ++++- .../bmad-quick-dev/step-03-implement.md | 8 ++-- .../bmad-quick-dev/step-04-review.md | 13 ++++--- .../bmad-quick-dev/step-oneshot.md | 9 ++++- 8 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/SKILL.md b/src/bmm-skills/4-implementation/bmad-quick-dev/SKILL.md index 554a5cf27..2fa020094 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/SKILL.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/SKILL.md @@ -20,6 +20,8 @@ A specification is "Ready for Development" when: - **Logical**: Tasks ordered by dependency. - **Testable**: All ACs use Given/When/Then. - **Complete**: No placeholders or TBDs. +- **Sufficient**: No known requirement, acceptance, dependency, or implementation gaps remain unresolved. +- **Coherent**: No unresolved ambiguities or internal contradictions. ## SCOPE STANDARD diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/customize.toml b/src/bmm-skills/4-implementation/bmad-quick-dev/customize.toml index 351465443..4f6a4e868 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/customize.toml +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/customize.toml @@ -1,41 +1,33 @@ # DO NOT EDIT -- overwritten on every update. # -# Workflow customization surface for bmad-quick-dev. Mirrors the -# agent customization shape under the [workflow] namespace. +# Default customization values for bmad-quick-dev. +# Override in _bmad/custom/bmad-quick-dev.toml or +# _bmad/custom/bmad-quick-dev.user.toml. +# +# Merge rules: +# - Strings replace the default. +# - Lists append to the default list. +# - Tables merge key by key. [workflow] -# --- Configurable below. Overrides merge per BMad structural rules: --- -# scalars: override wins • arrays (persistent_facts, activation_steps_*): append -# arrays-of-tables with `code`/`id`: replace matching items, append new ones. - -# Steps to run before the standard activation (config load, greet). -# Overrides append. Use for pre-flight loads, compliance checks, etc. +# Extra instructions to run before config is loaded and before the user is greeted. activation_steps_prepend = [] -# Steps to run after greet but before the workflow begins. -# Overrides append. Use for context-heavy setup that should happen -# once the user has been acknowledged. +# Extra instructions to run after the greeting and before step 01. activation_steps_append = [] -# Persistent facts the workflow keeps in mind for the whole run -# (standards, compliance constraints, stylistic guardrails). -# Distinct from the runtime memory sidecar — these are static context -# loaded on activation. Overrides append. -# -# Each entry is either: -# - a literal sentence, e.g. "All stories must include testable acceptance criteria." -# - a file reference prefixed with `file:`, e.g. "file:{project-root}/docs/standards.md" -# (glob patterns are supported; the file's contents are loaded and treated as facts). +# Facts kept in context for the whole run. +# Entries are literal text or file references prefixed with "file:". +# File entries may use globs and are loaded during activation. persistent_facts = [ "file:{project-root}/**/project-context.md", ] -# Scalar: executed when the workflow reaches its final step, -# after implementation is complete and explanations are provided. Override wins. -# Leave empty for no custom post-completion behavior. +# Instruction run after Quick Dev completes. +# Empty means no extra completion behavior. on_complete = "" diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md b/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md index b0e4f53d3..7849094ba 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/spec-template.md @@ -3,6 +3,7 @@ title: '{title}' type: 'feature' # feature | bugfix | refactor | chore created: '{date}' status: 'draft' # draft | ready-for-dev | in-progress | in-review | done +review_loop_iteration: 0 # incremented by step-04 before each review loopback context: [] # optional: `{project-root}/`-prefixed paths to project-wide standards/docs the implementation agent should load. Keep short — only what isn't already distilled into the spec body. --- diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md index d0f5ac9cc..910a93381 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-01-clarify-and-route.md @@ -59,8 +59,8 @@ If the spec is an epic story and `{sprint_status}` exists: find the `development - **If missing, empty, or invalid:** continue to step 3. 3. **Compile epic context.** Produce `{implementation_artifacts}/epic--context.md` by following `./compile-epic-context.md`, in order of preference: - - **Preferred — sub-agent:** 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--context.md`. - - **Fallback — inline** (for runtimes without sub-agent support, e.g. Copilot, Codex, local Ollama, older Claude): if your runtime cannot spawn sub-agents, or the spawn fails/times out, read `./compile-epic-context.md` yourself and follow its instructions to produce the same output file. + - **Preferred — subagent:** spawn a subagent 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--context.md`. + - **Fallback — inline** (for runtimes without subagent support, e.g. Copilot, Codex, local Ollama, older Claude): if your runtime cannot spawn subagents, or the spawn fails/times out, read `./compile-epic-context.md` yourself and follow its instructions to produce the same output file. 4. **Verify.** After compilation, verify the output file exists, is non-empty, and starts with `# Epic Context:`. If valid, load it. If verification fails, HALT and report the failure. @@ -82,7 +82,12 @@ If the spec is an epic story and `{sprint_status}` exists: find the `development - Present detected distinct goals as a bullet list. - Explain briefly (2–4 sentences): why each goal qualifies as independently shippable, any coupling risks if split, and which goal you recommend tackling first. - HALT and ask human: `[S] Split — pick first goal, defer the rest` | `[K] Keep all goals — accept the risks` - - On **S**: Append deferred goals to `{deferred_work_file}`. Narrow scope to the first-mentioned goal. Continue routing. + - On **S**: For each deferred goal, append one new entry to `{deferred_work_file}` using this format. Do not modify existing entries or look for duplicates. Narrow scope to the first-mentioned goal. Continue routing. + ```markdown + - source_spec: none + summary: + evidence: + ``` - On **K**: Proceed as-is. 5. Route — choose exactly one: diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-02-plan.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-02-plan.md index 7385e634a..90b96a123 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-02-plan.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-02-plan.md @@ -12,14 +12,19 @@ deferred_work_file: '{implementation_artifacts}/deferred-work.md' ## INSTRUCTIONS 1. Draft resume check. If `{spec_file}` exists with `status: draft`, read it and capture the verbatim `...` block as `preserved_intent`. Otherwise `preserved_intent` is empty. -2. Investigate codebase. _Isolate deep exploration in sub-agents/tasks where available. To prevent context snowballing, instruct subagents to give you distilled summaries only._ +2. Investigate codebase. _Isolate deep exploration in subagents/tasks where available. To prevent context snowballing, instruct subagents to give you distilled summaries only._ 3. Read `./spec-template.md` fully. Fill it out based on the intent and investigation. If `{preserved_intent}` is non-empty, substitute it for the `` block in your filled spec before writing. Write the result to `{spec_file}`. 4. Self-review against READY FOR DEVELOPMENT standard. 5. If intent gaps exist, do not fantasize, do not leave open questions, HALT and ask the human. 6. Token count check (see SCOPE STANDARD). If spec exceeds 1600 tokens: - Show user the token count. - HALT and ask human: `[S] Split — carve off secondary goals` | `[K] Keep full spec — accept the risks` - - On **S**: Propose the split — name each secondary goal. Append deferred goals to `{deferred_work_file}`. Rewrite the current spec to cover only the main goal — do not surgically carve sections out; regenerate the spec for the narrowed scope. Continue to checkpoint. + - On **S**: Propose the split — name each secondary goal. For each deferred goal, append one new entry to `{deferred_work_file}` using this format. Do not modify existing entries or look for duplicates. Rewrite the current spec to cover only the main goal — do not surgically carve sections out; regenerate the spec for the narrowed scope. Continue to checkpoint. + ```markdown + - source_spec: `{spec_file}` + summary: + evidence: + ``` - On **K**: Continue to checkpoint with full spec. ### CHECKPOINT 1 diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md index fa2db516d..dae76bb26 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md @@ -26,15 +26,15 @@ Change `{spec_file}` status to `in-progress` in the frontmatter before starting Follow `./sync-sprint-status.md` with `{target_status}` = `in-progress`. -If `{spec_file}` has a non-empty `context:` list in its frontmatter, load those files before implementation begins. When handing to a sub-agent, include them in the sub-agent prompt so it has access to the referenced context. +If `{spec_file}` has a non-empty `context:` list in its frontmatter, load those files before implementation begins. When handing to a subagent, include them in the subagent prompt so it has access to the referenced context. -Hand `{spec_file}` to a sub-agent/task and let it implement. If no sub-agents are available, implement directly. +Hand `{spec_file}` to a subagent/task and let it implement. If no subagents are available, implement directly. **Path formatting rule:** Any markdown links written into `{spec_file}` must use paths relative to `{spec_file}`'s directory so they are clickable in VS Code. Any file paths displayed in terminal/conversation output must use CWD-relative format with `:line` notation (e.g., `src/path/file.ts:42`) for terminal clickability. No leading `/` in either case. -### Self-Check +### Tasks & Acceptance Verification -Before leaving this step, verify every task in the `## Tasks & Acceptance` section of `{spec_file}` is complete. Mark each finished task `[x]`. If any task is not done, finish it before proceeding. +Before leaving this step, verify every task in the `## Tasks & Acceptance` section of `{spec_file}` is complete and every acceptance criterion is satisfied. Mark each finished task `[x]`. If any task is not done or any acceptance criterion is not satisfied, finish the missing work before proceeding. ## NEXT diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md index 3151191d8..919f9d17d 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-04-review.md @@ -1,6 +1,5 @@ --- deferred_work_file: '{implementation_artifacts}/deferred-work.md' -specLoopIteration: 1 --- # Step 4: Review @@ -23,11 +22,10 @@ Do NOT `git add` anything — this is read-only inspection. ### Review -Launch three subagents without conversation context. If no sub-agents are available, generate three review prompt files in `{implementation_artifacts}` — one per reviewer role below — and HALT. Ask the human to run each in a separate session (ideally a different LLM) and paste back the findings. +Launch two subagents without conversation context. If no subagents are available, generate two review prompt files in `{implementation_artifacts}` — one per reviewer role below — and HALT. Ask the human to run each in a separate session (ideally a different LLM) and paste back the findings. - **Blind hunter** — receives inline `{diff_output}` only. No spec, no context docs, no project access. Invoke via the `bmad-review-adversarial-general` skill. - **Edge case hunter** — receives `{diff_output}` and read access to the project. Invoke via the `bmad-review-edge-case-hunter` skill. -- **Acceptance auditor** — receives `{diff_output}`, `{spec_file}`, and read access to the project. Must also read the docs listed in `{spec_file}` frontmatter `context`. Checks for violations of acceptance criteria, rules, and principles from the spec and context docs. ### Classify @@ -38,11 +36,16 @@ Launch three subagents without conversation context. If no sub-agents are availa - **patch** — caused by the change; trivially fixable without human input. Just part of the diff. - **defer** — pre-existing issue not caused by this story, surfaced incidentally by the review. Collect for later focused attention. - **reject** — noise. Drop silently. When unsure between defer and reject, prefer reject — only defer findings you are confident are real. -3. Process findings in cascading order. If intent_gap or bad_spec findings exist, they trigger a loopback — lower findings are moot since code will be re-derived. If neither exists, process patch and defer normally. Increment `{specLoopIteration}` on each loopback. If it exceeds 5, HALT and escalate to the human. +3. Process findings in cascading order. If intent_gap or bad_spec findings exist, they trigger a loopback — lower findings are moot since code will be re-derived. If neither exists, process patch and defer normally. Before each loopback, read `{spec_file}` frontmatter `review_loop_iteration` (missing means `0`), increment it by 1, and write it back. If it exceeds 5, HALT and escalate to the human. - **intent_gap** — Root cause is inside ``. Revert code changes. Loop back to the human to resolve. Once resolved, read fully and follow `./step-02-plan.md` to re-run steps 2–4. - **bad_spec** — Root cause is outside ``. Before reverting code: extract KEEP instructions for positive preservation (what worked well and must survive re-derivation). Revert code changes. Read the `## Spec Change Log` in `{spec_file}` and strictly respect all logged constraints when amending the non-frozen sections that contain the root cause. Append a new change-log entry recording: the triggering finding, what was amended, the known-bad state avoided, and the KEEP instructions. Read fully and follow `./step-03-implement.md` to re-derive the code, then this step will run again. - **patch** — Auto-fix. These are the only findings that survive loopbacks. - - **defer** — Append to `{deferred_work_file}`. + - **defer** — Append one new entry to `{deferred_work_file}` using this format. Do not modify existing entries or look for duplicates. + ```markdown + - source_spec: `{spec_file}` + summary: + evidence: + ``` - **reject** — Drop silently. ## NEXT diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md index 72078b34d..45e78b24e 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md @@ -19,14 +19,19 @@ Implement the clarified intent directly. ### Review -Invoke the `bmad-review-adversarial-general` skill in a subagent with the changed files. The subagent gets NO conversation context — to avoid anchoring bias. Launch at the same model capability as the current session. If no sub-agents are available, write the changed files to a review prompt file in `{implementation_artifacts}` and HALT. Ask the human to run the review in a separate session and paste back the findings. +Invoke the `bmad-review-adversarial-general` skill in a subagent with the changed files. The subagent gets NO conversation context — to avoid anchoring bias. Launch at the same model capability as the current session. If no subagents are available, write the changed files to a review prompt file in `{implementation_artifacts}` and HALT. Ask the human to run the review in a separate session and paste back the findings. ### Classify Deduplicate all review findings. Three categories only: - **patch** — trivially fixable. Auto-fix immediately. -- **defer** — pre-existing issue not caused by this change. Append to `{deferred_work_file}`. +- **defer** — pre-existing issue not caused by this change. Append one new entry to `{deferred_work_file}` using this format. Do not modify existing entries or look for duplicates. + ```markdown + - source_spec: `{spec_file}` + summary: + evidence: + ``` - **reject** — noise. Drop silently. If a finding is caused by this change but too significant for a trivial patch, HALT and present it to the human for decision before proceeding.