@ftrdotdev/pi-qrspi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/extensions/qrspi-artifacts.ts +331 -0
- package/package.json +53 -0
- package/prompts/qrspi-design.md +68 -0
- package/prompts/qrspi-iterate.md +65 -0
- package/prompts/qrspi-plan.md +105 -0
- package/prompts/qrspi-research.md +65 -0
- package/prompts/qrspi-structure.md +62 -0
- package/prompts/qrspi.md +54 -0
- package/skills/planning-workflow/SKILL.md +77 -0
- package/skills/planning-workflow/templates/design-concept.md +100 -0
- package/skills/planning-workflow/templates/iterate.md +42 -0
- package/skills/planning-workflow/templates/outline.md +79 -0
- package/skills/planning-workflow/templates/plan.md +194 -0
- package/skills/planning-workflow/templates/research.md +88 -0
- package/skills/planning-workflow/templates/session-summary.md +21 -0
- package/skills/tdd/SKILL.md +178 -0
- package/skills/tdd/assets/test-template.md +199 -0
- package/skills/tdd/references/dependency-injection.md +183 -0
- package/skills/tdd/references/test-doubles.md +172 -0
- package/skills/tdd/references/test-patterns.md +215 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: QRSPI Plan phase. Turns the outline into a vertically-sliced, TDD-aligned implementation plan for a downstream build agent, written to `.qrspi/plans/`.
|
|
3
|
+
argument-hint: "<outline-path> [research-path] [design-path] [slug]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Load the `planning-workflow` skill → `templates/plan.md`. Load the `tdd` skill.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
- `$1` — outline path: path to the structure outline from the S phase (required).
|
|
11
|
+
- `${2:-}` — research path: path to the research document from the R phase (optional).
|
|
12
|
+
- `${3:-}` — design path: path to the design concept (optional; for additional context).
|
|
13
|
+
- `${4:-}` — slug: session identifier for artifact naming (optional; derive from the outline if absent).
|
|
14
|
+
|
|
15
|
+
If `$1` is not provided, ask the user for it before proceeding.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Orchestrated Mode
|
|
20
|
+
|
|
21
|
+
When invoked as a QRSPI phase subagent from `/qrspi`: skip Step 1 (Clarify) and the Completion Gate interaction — you cannot ask the user directly. State any ambiguity as an explicit assumption in the plan and return it in your output for the orchestrator to relay. Interactive steps apply only when run standalone.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Role
|
|
26
|
+
|
|
27
|
+
Produce a vertically-sliced, TDD-aligned implementation plan for Build Agent to execute.
|
|
28
|
+
|
|
29
|
+
## Workflow
|
|
30
|
+
|
|
31
|
+
### 1 — Clarify
|
|
32
|
+
|
|
33
|
+
If any requirement is ambiguous, ask the user before proceeding. State the ambiguity, list interpretations, give your recommended interpretation, and ask specific questions. Never assume.
|
|
34
|
+
|
|
35
|
+
### 2 — Read Inputs Silently
|
|
36
|
+
|
|
37
|
+
Read the outline (required), research document, and design concept (if provided) silently. Do not summarise them back.
|
|
38
|
+
|
|
39
|
+
### 3 — Skill Gate (REQUIRED)
|
|
40
|
+
|
|
41
|
+
Load every skill relevant to the task domain. At minimum, load:
|
|
42
|
+
|
|
43
|
+
- `planning-workflow` — for the plan template and vertical slice structure
|
|
44
|
+
- `tdd` — for test-first phase authoring and double selection
|
|
45
|
+
|
|
46
|
+
Record what each skill contributes under **Skills Consulted** in the plan output.
|
|
47
|
+
|
|
48
|
+
### 4 — Research Gate (REQUIRED)
|
|
49
|
+
|
|
50
|
+
**Stop before designing any solution.** For any library, framework, API, or pattern not verified in this session: consult skills for domain knowledge and, if web access is available, official docs. Document findings under **Research Summary**. Do not skip even for familiar-seeming technology — versions and best practices change.
|
|
51
|
+
|
|
52
|
+
### 5 — Design
|
|
53
|
+
|
|
54
|
+
Verify a design concept exists for this task. If not, pause and state that the design phase must be completed before a plan can be produced.
|
|
55
|
+
|
|
56
|
+
Evaluate 2–3 approaches to decomposing the work into **vertical slices** — each slice delivering one complete, observable behavior end-to-end. Vertical slicing criteria:
|
|
57
|
+
|
|
58
|
+
- Each slice produces a demonstrable outcome (not a technical layer)
|
|
59
|
+
- The highest-risk or most uncertain behavior appears in an early slice
|
|
60
|
+
- Each slice's tests can be written before its implementation begins
|
|
61
|
+
- Slices are ordered by dependency: no slice relies on behavior from a later slice
|
|
62
|
+
|
|
63
|
+
State your recommended slice ordering and why alternatives were rejected.
|
|
64
|
+
|
|
65
|
+
### 6 — Plan
|
|
66
|
+
|
|
67
|
+
Follow `templates/plan.md` from the `planning-workflow` skill. For each slice's "Tests First" section, consult the `tdd` skill (`references/test-doubles.md`, `assets/test-template.md`) to select appropriate doubles and scaffold the test structure.
|
|
68
|
+
|
|
69
|
+
**CRITICAL**:
|
|
70
|
+
|
|
71
|
+
- Every "Tests First" section must name specific tests with "Arrange / Act / Assert" structure.
|
|
72
|
+
- "Write tests for this component" is not acceptable — the tests must be specified precisely enough that Build Agent can write them without design decisions.
|
|
73
|
+
|
|
74
|
+
Write to `<worktree-root>/.qrspi/plans/{slug}.md` (the package extension stamps the `YYYYMMDD-` prefix).
|
|
75
|
+
|
|
76
|
+
### 7 — Completion Gate
|
|
77
|
+
|
|
78
|
+
Ask the user to confirm the plan is sufficient before proceeding.
|
|
79
|
+
|
|
80
|
+
- If confirmed: finalize and save the plan.
|
|
81
|
+
- If not confirmed: revise according to the requested changes, then re-present for confirmation.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Quality Gate (CRITICAL)
|
|
86
|
+
|
|
87
|
+
Do not save or deliver a plan until every item is satisfied:
|
|
88
|
+
|
|
89
|
+
- [ ] Skill Gate completed: `planning-workflow` and `tdd` loaded and documented
|
|
90
|
+
- [ ] Research Gate completed and documented
|
|
91
|
+
- [ ] Design concept referenced and exists
|
|
92
|
+
- [ ] No ambiguous requirements remaining
|
|
93
|
+
- [ ] All phases are vertical slices — no phase is a technical layer
|
|
94
|
+
- [ ] Each slice has a "Tests First" section with named tests and Arrange/Act/Assert structure
|
|
95
|
+
- [ ] Each slice's Verification Gate leads with "all tests written in Tests First pass"
|
|
96
|
+
- [ ] Every change specifies exact file path and action (create / modify / delete)
|
|
97
|
+
- [ ] Every "implement X" includes enough code context to locate the insertion point
|
|
98
|
+
- [ ] Slice order rationale is documented
|
|
99
|
+
- [ ] All risks have mitigations
|
|
100
|
+
- [ ] Out of Scope section is populated
|
|
101
|
+
- [ ] If an issue is referenced, a clean branch is used and referenced in the ticket upon git push
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
Return the artifact path and a one-paragraph summary of the plan.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: QRSPI Research phase. Documents what exists in the codebase for a topic and produces a dated research artifact in `.qrspi/research/` with an inline summary.
|
|
3
|
+
argument-hint: '"<topic>" [slug] [scope-path]'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Load the `planning-workflow` skill → `templates/research.md`.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
- `$1` — research topic (required). If the topic contains spaces, wrap it in quotes (`/qrspi-research "payment flow"`) — unquoted words split into separate arguments.
|
|
11
|
+
- `${2:-}` — slug: session identifier for artifact naming (e.g. `auth-refactor`). If absent, derive from the topic.
|
|
12
|
+
- `${3:-}` — scope path: optional path to an existing scope document.
|
|
13
|
+
|
|
14
|
+
If invoked without a topic, ask the user: "What area of the codebase should I research?"
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Orchestrated Mode
|
|
19
|
+
|
|
20
|
+
When invoked as a QRSPI phase subagent from `/qrspi`: skip Step 1 (Clarify) and the interactive completion gate — you cannot ask the user directly. Run the research roles inline in this session; do not spawn role subagents (the orchestrator owns subagent orchestration). Return the inline summary and any open questions in your final output for the orchestrator to relay. Interactive steps apply only when run standalone.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Role
|
|
25
|
+
|
|
26
|
+
**Document what exists. Do not suggest improvements. Do not critique. Do not plan.**
|
|
27
|
+
|
|
28
|
+
## Tool Guidance
|
|
29
|
+
|
|
30
|
+
- Use your native file tools for reading and editing files.
|
|
31
|
+
- Use your search tool (e.g. ripgrep) for content search.
|
|
32
|
+
- Use shell commands only for read-only git inspection (`git diff`, `git log`, `git status`, `git show`).
|
|
33
|
+
- Never use shell commands for file operations.
|
|
34
|
+
|
|
35
|
+
## Workflow
|
|
36
|
+
|
|
37
|
+
### Step 1 — Clarify
|
|
38
|
+
|
|
39
|
+
If the topic scope or intent is ambiguous, ask the user before proceeding. Do not load skills or explore the codebase until the topic is confirmed.
|
|
40
|
+
|
|
41
|
+
### Step 2 — Skill Gate
|
|
42
|
+
|
|
43
|
+
Load every skill relevant to the research topic. Record loaded skills under `skills_consulted` in the research document frontmatter.
|
|
44
|
+
|
|
45
|
+
### Step 3 — Explore
|
|
46
|
+
|
|
47
|
+
Determine which research roles are warranted. Run each role as a separate agent session if your environment supports it; otherwise execute them in this session, one after another. Track progress with a task list if available. After all roles complete: resolve conflicts, note gaps, collect git metadata, write the document, and deliver the inline summary.
|
|
48
|
+
|
|
49
|
+
### Research Roles
|
|
50
|
+
|
|
51
|
+
**Locator** — maps where relevant code lives. Use when relevant files are unknown.
|
|
52
|
+
|
|
53
|
+
Mandate: find files related to the topic, return paths with one-line descriptions, omit code excerpts. Maximum 15 files.
|
|
54
|
+
|
|
55
|
+
**Analyzer** — documents responsibilities, interfaces, data structures, control flow, and integration points with `file:line` references. Use for most topics.
|
|
56
|
+
|
|
57
|
+
Mandate: read the most relevant files, document what they do and how they connect, return structured findings with `file:line` references. Do not read additional files unless directly imported by the target files.
|
|
58
|
+
|
|
59
|
+
**Pattern Finder** — identifies conventions: naming, error handling, test structure, abstraction layers. Use when planning requires adherence to existing conventions or the area is broadly unfamiliar.
|
|
60
|
+
|
|
61
|
+
Mandate: identify recurring idioms, cross-reference adjacent areas, return an annotated inventory with `file:line` examples. Maximum 10 entries.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
Write the document to `<worktree-root>/.qrspi/research/{slug}.md` (the package extension stamps the `YYYYMMDD-` prefix), then output the inline summary from the template.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: QRSPI Structure phase. Turns the approved design concept into a component-level structural outline, written to `.qrspi/outlines/`.
|
|
3
|
+
argument-hint: "<design-path> [research-path] [slug]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Load the `planning-workflow` skill → `templates/outline.md`.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
- `$1` — design path: path to the approved design concept from the D phase (required).
|
|
11
|
+
- `${2:-}` — research path: path to the research document from the R phase (optional).
|
|
12
|
+
- `${3:-}` — slug: session identifier for artifact naming (optional; derive from the design document if absent).
|
|
13
|
+
|
|
14
|
+
If `$1` is not provided, ask the user for it before proceeding.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Orchestrated Mode
|
|
19
|
+
|
|
20
|
+
When invoked as a QRSPI phase subagent from `/qrspi`: skip Step 1 (Clarify) and the Completion Gate interaction — you cannot ask the user directly. If a structural decision requires human input, resolve it from the research document when possible; otherwise state it as an explicit assumption in the Decisions Required section and return it in your output for the orchestrator to relay. Interactive steps apply only when run standalone.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Role
|
|
25
|
+
|
|
26
|
+
Produce a component-level structural outline. **No implementation detail — no file paths, no function signatures, no pseudo-code. This is architecture, not tactics.**
|
|
27
|
+
|
|
28
|
+
## Workflow
|
|
29
|
+
|
|
30
|
+
### 1 — Clarify
|
|
31
|
+
|
|
32
|
+
If any requirement is ambiguous, ask the user before proceeding. State the ambiguity, list interpretations, give your recommended interpretation, and ask specific questions. Never assume.
|
|
33
|
+
|
|
34
|
+
### 2 — Read Inputs Silently
|
|
35
|
+
|
|
36
|
+
Read the design concept (required) and research document (if provided) silently. Do not summarise them back.
|
|
37
|
+
|
|
38
|
+
### 3 — Decisions Required Before Planning
|
|
39
|
+
|
|
40
|
+
Identify open questions from the design concept that affect structure. For each: resolve from the research document if possible; ask the user if human input is required. If the design concept has unresolved open questions that affect structure, stop and flag them before writing.
|
|
41
|
+
|
|
42
|
+
### 4 — Produce the Outline
|
|
43
|
+
|
|
44
|
+
Follow `templates/outline.md` from the `planning-workflow` skill:
|
|
45
|
+
|
|
46
|
+
- Declare components, boundaries, and sequencing constraints
|
|
47
|
+
- Every component declaration must map to at least one vertical slice in the subsequent plan
|
|
48
|
+
- Sequencing constraints must state the _reason_, not just the dependency
|
|
49
|
+
- Usually under 350 lines — no hard cap
|
|
50
|
+
|
|
51
|
+
Write to `<worktree-root>/.qrspi/outlines/{slug}.md` (the package extension stamps the `YYYYMMDD-` prefix).
|
|
52
|
+
|
|
53
|
+
### 5 — Completion Gate
|
|
54
|
+
|
|
55
|
+
Ask the user to confirm the outline is sufficient before proceeding.
|
|
56
|
+
|
|
57
|
+
- If confirmed: finalize and save the outline.
|
|
58
|
+
- If not confirmed: revise according to the requested changes, then re-present for confirmation.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
Return the artifact path and a one-paragraph summary of the component structure.
|
package/prompts/qrspi.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Start a full QRSPI planning workflow (Question → Research → Design → Structure → Plan) with a human checkpoint after each phase, and iterate on revision requests.
|
|
3
|
+
argument-hint: '"<topic>" [slug] [ticket]'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Load the `planning-workflow` skill (read its `SKILL.md`; templates live under `templates/`). If your environment provides a subagent extension or skill, load it for environment-specific orchestration mechanics; the contract below is written generically and must not assume any particular one.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
- `$1` — topic to be planned (required). If the topic contains spaces, wrap it in quotes (`/qrspi "add payment flow"`) — unquoted words split into separate arguments.
|
|
11
|
+
- `${2:-}` — slug: short kebab-case identifier for the feature (e.g. `add-payment-flow`). If absent, derive one from the topic after the Q phase.
|
|
12
|
+
- `${3:-}` — ticket: issue reference to attach to all artifacts (e.g. `ENG-123`). Optional.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Role
|
|
17
|
+
|
|
18
|
+
You are the orchestrator. You own the session: questions, checkpoints, and the summary. You do NOT produce phase artifacts yourself — each phase runs in its own fresh-context subagent, so exploration and drafting never pollute your context.
|
|
19
|
+
|
|
20
|
+
## Execution Model
|
|
21
|
+
|
|
22
|
+
Run each phase (R, D, S, P, I) in a **separate fresh-context subagent** when your environment provides subagent execution — use whatever subagent extension or mechanism your platform exposes (the environment's default subagent invocation if none is configured). This is the main flow — fall back to inline execution only when no subagent capability exists.
|
|
23
|
+
|
|
24
|
+
Per phase launch:
|
|
25
|
+
|
|
26
|
+
- One phase per run, sequential: launch the child in the foreground (blocking) and wait for it to finish, then checkpoint. Do not parallelize phases and do not background phase work — every checkpoint is human-gated.
|
|
27
|
+
- Pass `context: 'fresh'` so the child carries no session history, and `cwd: <worktree-root>` so it reads and writes the same tree.
|
|
28
|
+
- Pass `skill: 'planning-workflow'` (add `tdd` for P and I) so the child can load the templates.
|
|
29
|
+
- The task text must be self-contained: the phase, the template to follow, the input artifact paths from prior phases, the slug, the ticket (if any), the output path `.qrspi/<kind>/<slug>.md`, and the return contract (inline summary, open questions, anything the orchestrator must relay to the user).
|
|
30
|
+
- Children write the artifacts themselves. The extension stamps the `YYYYMMDD-` prefix and frontmatter on their writes too — it is shared by the orchestrator session and its subagents.
|
|
31
|
+
|
|
32
|
+
## Artifact Preview Rule
|
|
33
|
+
|
|
34
|
+
After each phase subagent completes, READ the artifact back from disk and present it in full to the user before the checkpoint — stamped frontmatter included. Never ask for checkpoint approval without the artifact content visible in the session.
|
|
35
|
+
|
|
36
|
+
## Phases
|
|
37
|
+
|
|
38
|
+
Execute in order. **Ask the user for approval at each checkpoint — do not advance until approved.** If the user requests changes, revise the phase output and re-present it.
|
|
39
|
+
|
|
40
|
+
**Q — Questions** (you, inline): Gather goal, hard constraints, and out-of-scope items. Do not save a file. Derive the slug if not provided. Checkpoint.
|
|
41
|
+
|
|
42
|
+
**R — Research** (subagent): Launch the research phase agent. Task: load `planning-workflow` → `templates/research.md`, research the topic, write `.qrspi/research/{slug}.md`, return the inline summary and any open questions. Then read the artifact back, present it in full, checkpoint.
|
|
43
|
+
|
|
44
|
+
**D — Design** (subagent with interactive relay): Launch the design phase agent. The child returns its clarifying questions and 2–3 design options in its output instead of asking you. Relay them to the user with the `question` tool. On direction, send the user's choice back to the design agent (resume it if your environment supports resuming, otherwise relaunch with the choice embedded in the task); it writes `.qrspi/designs/{slug}.md` and returns the summary. Then read the artifact back, present it in full, checkpoint.
|
|
45
|
+
|
|
46
|
+
**S — Structure** (subagent): Launch the structure phase agent. Task: load `templates/outline.md`, produce the outline from the approved design, write `.qrspi/outlines/{slug}.md`, return the outline summary and any unresolved structural decisions. Then read the artifact back, present it in full, checkpoint.
|
|
47
|
+
|
|
48
|
+
**P — Plan** (subagent): Launch the plan phase agent with `skill: 'planning-workflow,tdd'`. Task: load `templates/plan.md` and the `tdd` skill, produce the plan from the approved outline, write `.qrspi/plans/{slug}.md`, return the plan summary. Then read the artifact back, present it in full, checkpoint.
|
|
49
|
+
|
|
50
|
+
**I — Iterate** (subagent, only on revision request): Launch the iterate phase agent with the user's feedback as the task. Task: load `templates/iterate.md`, revise surgically, overwrite the plan in place, return the revision summary. Then read the plan back, present the changed sections, checkpoint. If the child reports that the feedback requires a design change, return to the D phase instead of patching the plan.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
On completion, follow the format in `planning-workflow` → `templates/session-summary.md`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: planning-workflow
|
|
3
|
+
description: Guides structured software planning through reusable templates. Covers design concept authoring, implementation plan authoring with vertical slices, and agent configuration. Use when starting a new feature, designing a solution before implementation, producing a phased plan for a build agent, or when the user mentions planning, design phase, implementation plan, QRSPI, or vertical slices.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Planning Workflow
|
|
7
|
+
|
|
8
|
+
Planning produces artifacts that a build agent can execute without ambiguity. The templates in this skill enforce the discipline that separates planning from implementation: design decisions are made before structure is committed, structure is committed before implementation is tasked, and each implementation phase is independently verifiable.
|
|
9
|
+
|
|
10
|
+
The core constraint across all templates: **no implementation detail in the design phase, no design decisions in the plan phase, no new behavior in a verification gate.**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Vertical Slicing
|
|
15
|
+
|
|
16
|
+
All implementation plans produced with this skill decompose work into **vertical slices** — units of change that deliver one complete, observable behavior end-to-end, from the outermost interface to the innermost dependency.
|
|
17
|
+
|
|
18
|
+
A vertical slice is not a layer (not "implement the database layer"). It is a behavior (e.g., "a user can place an order and receive a confirmation").
|
|
19
|
+
|
|
20
|
+
Each slice:
|
|
21
|
+
|
|
22
|
+
- Has a failing test written before any implementation begins (TDD red phase)
|
|
23
|
+
- Delivers something demonstrable at its verification gate
|
|
24
|
+
- Can be deployed or rolled back independently of other slices
|
|
25
|
+
|
|
26
|
+
**IMPORTANT**: Horizontal slicing — grouping changes by technical layer across multiple behaviors — is the primary anti-pattern. A plan where Phase 1 is "all models", Phase 2 is "all services", Phase 3 is "all controllers" cannot be verified incrementally and produces no working software until the final phase.
|
|
27
|
+
|
|
28
|
+
For TDD integration within each slice, load relevant skills before authoring the Tests First section of any phase.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Session Structure (Orchestrated)
|
|
33
|
+
|
|
34
|
+
A QRSPI session runs with one orchestrator and per-phase agents. One phase at a time; every phase ends at a human checkpoint. The orchestrator never drafts artifacts — phase agents do that in fresh contexts, so exploration and drafting stay out of the orchestrator's context.
|
|
35
|
+
|
|
36
|
+
**Orchestrator owns**: the Q phase, launching each phase agent, relaying user answers (Design phase), reading artifacts back from disk and presenting them in full at each checkpoint, approving or denying advancement, coordinating Iterate, and producing the session summary.
|
|
37
|
+
|
|
38
|
+
**Phase agent owns**: loading the current phase's template, reading the prior artifacts, drafting and writing the artifact to `.qrspi/<kind>/<slug>.md`, and returning the inline summary.
|
|
39
|
+
|
|
40
|
+
**Phase agent rules**:
|
|
41
|
+
|
|
42
|
+
- Load only the template for the current phase. Do not draft artifacts for other phases.
|
|
43
|
+
- Do not ask the user questions directly. Return clarifying questions, design options, or unresolved decisions in your final output; the orchestrator relays them.
|
|
44
|
+
- Convert unresolved ambiguities into explicit assumptions in the artifact (Open Questions / Decisions Required sections) rather than blocking.
|
|
45
|
+
- The package extension stamps the `YYYYMMDD-` prefix and the frontmatter on your write; write to `.qrspi/<kind>/<slug>.md` and let it normalize.
|
|
46
|
+
|
|
47
|
+
**Artifact visibility**: the orchestrator reads each artifact back after the phase agent writes it and presents the full content — stamped frontmatter included — before asking for checkpoint approval. Approving blind is not part of this workflow.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Templates
|
|
52
|
+
|
|
53
|
+
One template per phase. Each is self-contained: output schema + production instructions. Load only what the current phase requires.
|
|
54
|
+
|
|
55
|
+
| Template | Phase | Load when |
|
|
56
|
+
| ------------------------------------------------------------ | ----- | --------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| [templates/research.md](templates/research.md) | R | Producing a research document; need the schema, frontmatter fields, and inline summary format |
|
|
58
|
+
| [templates/design-concept.md](templates/design-concept.md) | D | Producing a design concept; need the output schema and production instructions |
|
|
59
|
+
| [templates/outline.md](templates/outline.md) | S | Producing a structure outline; need the component schema, boundary format, and production instructions |
|
|
60
|
+
| [templates/plan.md](templates/plan.md) | P | Producing an implementation plan; need the vertical slice schema, Tests First structure, and verification gates |
|
|
61
|
+
| [templates/iterate.md](templates/iterate.md) | I | Revising an existing plan; need the surgical revision workflow, design escalation rule, and output format |
|
|
62
|
+
| [templates/session-summary.md](templates/session-summary.md) | — | Completing an orchestrated QRSPI session; need the artifact path summary format |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Workflow Position
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Q — Questions → use question tool
|
|
70
|
+
R — Research → templates/research.md
|
|
71
|
+
D — Design → templates/design-concept.md
|
|
72
|
+
S — Structure → templates/outline.md
|
|
73
|
+
P — Plan → templates/plan.md
|
|
74
|
+
I — Iterate → templates/iterate.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
A design concept must exist and be approved before a plan is authored. If the design concept is absent, pause and complete the design phase first.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Design Concept Template
|
|
2
|
+
|
|
3
|
+
**Usage**: Produced during the QRSPI Design (D) phase. The design-discussant sub-agent authors this after the engineer approves a direction. Status remains `draft` until the orchestrator advances the checkpoint to `approved`.
|
|
4
|
+
|
|
5
|
+
**Constraints**:
|
|
6
|
+
|
|
7
|
+
- Usually 150–250 lines — no hard minimum or maximum; the real constraint is completeness, not length
|
|
8
|
+
- No file paths, no function names, no pseudo-code, no code blocks
|
|
9
|
+
- Architecture and boundaries only — no implementation detail
|
|
10
|
+
- Stop when the solution shape is unambiguous; do not pad
|
|
11
|
+
- Status remains `draft` until the orchestrator or user confirms approval
|
|
12
|
+
|
|
13
|
+
## How to Produce This Document
|
|
14
|
+
|
|
15
|
+
1. Read the research document silently. Do not summarise it back.
|
|
16
|
+
2. Identify what is still ambiguous about the solution shape. Use `question` — maximum 3 questions at once. Do not proceed until ambiguities are resolved.
|
|
17
|
+
3. Present 2–3 distinct design options. For each state: what it optimises for, what it gives up, and which constraints from the scope it satisfies.
|
|
18
|
+
4. Use `question`: "Does this direction feel right, or should we adjust?"
|
|
19
|
+
5. Once direction is agreed, write the document using the schema below.
|
|
20
|
+
6. Write to `<worktree-root>/.qrspi/designs/YYYYMMDD-{slug}.md`.
|
|
21
|
+
7. Return the artifact path and a one-paragraph summary of the chosen direction.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Schema
|
|
26
|
+
|
|
27
|
+
**Path**: `<worktree-root>/.qrspi/designs/YYYYMMDD-{slug}.md`
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
# Design Concept: {slug}
|
|
31
|
+
|
|
32
|
+
**Date**: {YYYY-MM-DD}
|
|
33
|
+
**Status**: draft
|
|
34
|
+
**Session**: {qrspi-session-id}
|
|
35
|
+
**Research artifact**: {path to research document}
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Problem Statement
|
|
40
|
+
|
|
41
|
+
{What we are solving, in the engineer's own terms. Taken directly from the scope goal — do not reframe or interpret. 2–4 sentences.}
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Design Direction Chosen
|
|
46
|
+
|
|
47
|
+
**Option selected**: {Name of the chosen option}
|
|
48
|
+
|
|
49
|
+
{Why this option was selected: what it optimises for, which constraints from the scope it satisfies, and what trade-offs are accepted. 3–6 sentences.}
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Alternatives Considered
|
|
54
|
+
|
|
55
|
+
### {Option A name}
|
|
56
|
+
|
|
57
|
+
{What it optimised for and why it was ruled out. 2–3 sentences.}
|
|
58
|
+
|
|
59
|
+
### {Option B name}
|
|
60
|
+
|
|
61
|
+
{What it optimised for and why it was ruled out. 2–3 sentences.}
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Solution Shape
|
|
66
|
+
|
|
67
|
+
{High-level description of the solution: components, their responsibilities, the boundaries between them, and the primary data or control flow. Written as prose — no code, no file paths.}
|
|
68
|
+
|
|
69
|
+
{Each paragraph covers one component or one significant boundary. A boundary is a point where ownership or technology changes — between services, between infrastructure and domain logic, between synchronous and asynchronous processing.}
|
|
70
|
+
|
|
71
|
+
{End with a statement of the observable outputs: what a user or caller sees when the solution is working correctly.}
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Key Decisions
|
|
76
|
+
|
|
77
|
+
| Decision | Choice | Rationale |
|
|
78
|
+
| -------------------------------- | ------------------------------------------- | ---------------------------- |
|
|
79
|
+
| {e.g., persistence strategy} | {e.g., append-only event log} | {why this over alternatives} |
|
|
80
|
+
| {e.g., sync vs async processing} | {e.g., synchronous with async notification} | {why} |
|
|
81
|
+
| {e.g., where validation lives} | {e.g., at the boundary, not in the domain} | {why} |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## What This Explicitly Does Not Do
|
|
86
|
+
|
|
87
|
+
{List behaviors, integrations, or concerns that are out of scope for this solution. Be specific — "no pagination" is better than "limited scope". Each item prevents scope creep during the outline and plan phases.}
|
|
88
|
+
|
|
89
|
+
- {Excluded behavior or concern}
|
|
90
|
+
- {Excluded behavior or concern}
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Open Questions for the Outline Phase
|
|
95
|
+
|
|
96
|
+
{Questions the structure outline must resolve before a plan can be produced. These are structural unknowns — unknowns about component interfaces, sequencing constraints, or external dependencies — not design unknowns. Design unknowns should have been resolved before this document was written.}
|
|
97
|
+
|
|
98
|
+
- {e.g., Does the notification component own its retry logic or delegate to infrastructure?}
|
|
99
|
+
- {e.g., What is the wire format between the gateway and the processing service?}
|
|
100
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Iterate Template
|
|
2
|
+
|
|
3
|
+
**Usage**: Used during the QRSPI Iterate (I) phase when an existing plan needs revision. Updates only the affected slices — never regenerates the full plan. Load relevant skills (e.g., TDD or engineering-related topics) alongside this template.
|
|
4
|
+
|
|
5
|
+
**Constraints**:
|
|
6
|
+
|
|
7
|
+
- Never regenerate the full plan for a partial change — surgical edits only
|
|
8
|
+
- If the feedback requires a new slice, add it; do not repurpose an existing slice to absorb new behavior
|
|
9
|
+
- Re-verify any Quality Gate for all modified slices before saving
|
|
10
|
+
- If two or more rounds of iteration have been applied to the same slice, flag it: repeated revision signals a design ambiguity that should be resolved at the D or S phase rather than patched incrementally
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## How to Execute a Revision
|
|
15
|
+
|
|
16
|
+
1. Read the existing plan, outline, and research documents silently.
|
|
17
|
+
2. Identify which slices the feedback implicates. State them explicitly before making any changes.
|
|
18
|
+
3. Check whether the feedback implies a **design change** — a change to solution shape, component boundaries, or technology choices. If it does, stop and return:
|
|
19
|
+
```
|
|
20
|
+
This feedback requires a design change. Return to the D phase before revising the plan.
|
|
21
|
+
Reason: {specific design decision affected}
|
|
22
|
+
```
|
|
23
|
+
4. For each implicated slice, rewrite it completely. Leave all other slices verbatim.
|
|
24
|
+
5. Add a revision note to the plan header:
|
|
25
|
+
```
|
|
26
|
+
Revised: {YYYY-MM-DD} — {one-line summary of what changed}
|
|
27
|
+
```
|
|
28
|
+
6. Write the revised plan to the same path, overwriting the original.
|
|
29
|
+
7. Return the output below.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Plan revised: {plan path}
|
|
37
|
+
|
|
38
|
+
Slices updated:
|
|
39
|
+
- {Slice name} — {one line: what changed}
|
|
40
|
+
|
|
41
|
+
Reason: {feedback summary}
|
|
42
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Structure Outline Template
|
|
2
|
+
|
|
3
|
+
**Usage**: Produced during the QRSPI Structure (S) phase.
|
|
4
|
+
Declares components, boundaries, and sequencing constraints.
|
|
5
|
+
Plan Agent reads this before authoring the implementation plan.
|
|
6
|
+
No implementation detail; this is architecture, not tactics.
|
|
7
|
+
|
|
8
|
+
**Constraints**:
|
|
9
|
+
|
|
10
|
+
- Usually under 350 lines — no hard cap; the real constraint is that every line earns its place
|
|
11
|
+
- No file paths, no function signatures, no pseudo-code
|
|
12
|
+
- Every component declaration must map to at least one vertical slice in the subsequent plan
|
|
13
|
+
- Sequencing constraints must state the _reason_, not just the dependency — the reason determines whether components can be partially parallelised
|
|
14
|
+
- If the design concept has unresolved open questions that affect structure, stop and flag them before writing
|
|
15
|
+
|
|
16
|
+
## How to Produce This Document
|
|
17
|
+
|
|
18
|
+
1. Read the design concept and research document silently.
|
|
19
|
+
2. Identify `Decisions Required Before Planning` implied by the design concept's open questions. For each: resolve from the research document if possible; use `question` if human input is required.
|
|
20
|
+
3. Write the document using the schema below.
|
|
21
|
+
4. Write to `<worktree-root>/.qrspi/outlines/YYYYMMDD-{slug}.md`.
|
|
22
|
+
5. Return the artifact path and a one-paragraph summary of the component structure.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Schema
|
|
27
|
+
|
|
28
|
+
**Path**: `<worktree-root>/.qrspi/outlines/YYYYMMDD-{slug}.md`
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
---
|
|
32
|
+
date: { ISO datetime }
|
|
33
|
+
slug: { slug }
|
|
34
|
+
design: { path to design concept artifact }
|
|
35
|
+
research: { path to research artifact }
|
|
36
|
+
status: draft
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Structure Outline: {slug}
|
|
40
|
+
|
|
41
|
+
## Components
|
|
42
|
+
|
|
43
|
+
### {Component name}
|
|
44
|
+
|
|
45
|
+
**Responsibility**: {one sentence — what this component owns}
|
|
46
|
+
**Interface**: {what it exposes — inputs, outputs, events emitted; no implementation detail}
|
|
47
|
+
**Dependencies**: {other components it calls or receives from; external dependencies it crosses}
|
|
48
|
+
|
|
49
|
+
### {Next component}
|
|
50
|
+
|
|
51
|
+
...
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Boundaries
|
|
56
|
+
|
|
57
|
+
{Where ownership changes. Each boundary is a point where a different component, team, or technology takes over. Boundaries determine where test doubles are placed in the implementation.}
|
|
58
|
+
|
|
59
|
+
- **{Boundary name}**: {what crosses it, in which direction, and why it is a boundary}
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Sequencing Constraints
|
|
64
|
+
|
|
65
|
+
{Which components must exist — or have their interface defined — before others can be built. This feeds directly into the vertical slice ordering in the plan.}
|
|
66
|
+
|
|
67
|
+
| Component | Depends on | Reason |
|
|
68
|
+
| ----------- | ----------------- | ------ |
|
|
69
|
+
| {component} | {other component} | {why} |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Decisions Required Before Planning
|
|
74
|
+
|
|
75
|
+
{Structural unknowns the planner must either resolve or state as explicit assumptions. These are not design questions — design is closed. These are questions about how the structure maps to implementation.}
|
|
76
|
+
|
|
77
|
+
- {e.g., Does the notification component own its retry logic or delegate it to the queue infrastructure?}
|
|
78
|
+
- {e.g., What is the wire format at the gateway boundary?}
|
|
79
|
+
```
|