@dtlabs/ai-toolkit 0.17.4 → 0.18.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/CHANGELOG.md +30 -0
- package/lib/agent-registry.js +39 -0
- package/lib/workflow-control.js +65 -13
- package/package.json +1 -1
- package/src/claude/agents/gaia-generate-requirements-use-case.md +97 -0
- package/src/claude/agents/gaia-generate-requirements.md +22 -27
- package/src/claude/agents/gaia-generate-tech-spec-component.md +93 -0
- package/src/claude/agents/gaia-generate-tech-spec.md +47 -103
- package/src/claude/agents/gaia-generate-work-breakdown-task.md +151 -0
- package/src/claude/agents/gaia-generate-work-breakdown.md +94 -100
- package/src/claude/agents/gaia-validate-feature-docs.md +13 -8
- package/src/claude/commands/assemble-docs.md +16 -0
- package/src/claude/commands/feature-status.md +9 -4
- package/src/claude/scripts/ac-task-matrix.js +87 -0
- package/src/claude/scripts/assemble-docs.js +66 -0
- package/src/claude/scripts/req-assembler.js +127 -0
- package/src/claude/scripts/req-graph-checks.js +71 -0
- package/src/claude/scripts/req-skeleton-check.js +64 -0
- package/src/claude/scripts/tech-spec-assembler.js +188 -0
- package/src/claude/scripts/tech-spec-graph-checks.js +84 -0
- package/src/claude/scripts/templates/gaia-component-template.md +64 -0
- package/src/claude/scripts/templates/gaia-dependency-graph-template.md +85 -0
- package/src/claude/scripts/templates/gaia-requirements-index-template.md +144 -0
- package/src/claude/scripts/templates/gaia-task-template.md +92 -0
- package/src/claude/scripts/templates/gaia-tech-spec-index-template.md +137 -0
- package/src/claude/scripts/templates/gaia-use-case-template.md +56 -0
- package/src/claude/scripts/templates/gaia-user-story-template.md +61 -0
- package/src/claude/scripts/wb-graph-checks.js +754 -0
- package/src/claude/scripts/wb-render.js +6 -11
- package/src/claude/scripts/wb-skeleton-check.js +99 -0
- package/src/claude/scripts/wb-validate.js +49 -655
- package/src/claude/scripts/wbs-assembler.js +368 -0
- package/src/claude/skills/implement-feature/SKILL.md +12 -6
- package/src/claude/workflows/pm-phase1.js +342 -16
- package/src/claude/workflows/pm-phase2.js +277 -14
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
DEPENDENCY GRAPH TEMPLATE — developer-plan/dependency-graph.md
|
|
3
|
+
|
|
4
|
+
STATUS (as of FTR-025): reference/design-only. No generator currently produces this file — grep
|
|
5
|
+
for "dependency-graph"/"dependencyGraph" across lib/ and src/claude/ turns up nothing that writes
|
|
6
|
+
it. Kept here, moved and renamed alongside the other six templates, for whenever the
|
|
7
|
+
developer-plan/dependency-graph.md concept is actually implemented; do not assume it is wired into
|
|
8
|
+
any real pipeline today.
|
|
9
|
+
|
|
10
|
+
Human-readable companion to developer-plan/plan.json, produced BY THE SAME GENERATOR that writes
|
|
11
|
+
plan.json — never hand-authored per feature, and never a place to restate plan.json's own arrays.
|
|
12
|
+
This file is pure output: nothing reads it back programmatically (unlike the wbs/ task and phase
|
|
13
|
+
templates, there is no parsing contract here — delete this whole comment block in a generated
|
|
14
|
+
instance, there is nothing downstream to keep honest).
|
|
15
|
+
|
|
16
|
+
Structure, in this fixed order: (1) a one-line pointer note, (2) the Mermaid dependency graph —
|
|
17
|
+
the ONLY data visualization this file keeps, because a diagram is a genuinely different
|
|
18
|
+
representation of plan.json's `readyQueue[].dependsOn`, not the same facts reformatted as another
|
|
19
|
+
table, (3) a fixed "Sequence and waves" section that explicitly refuses to reprint
|
|
20
|
+
`readyQueue`/`phaseWaves` as Markdown tables, (4) a fixed "Integrity" section. An earlier draft of
|
|
21
|
+
this file DID reprint the ready-queue and phase-waves as tables and was reverted after review —
|
|
22
|
+
same facts in two places drifts the moment plan.json regenerates and this file doesn't. Do not
|
|
23
|
+
reintroduce those tables.
|
|
24
|
+
|
|
25
|
+
Placeholders:
|
|
26
|
+
{FEATURE} feature ID, e.g. FTR-020
|
|
27
|
+
{PHASE_ID} a phase ID from plan.json's phases[].id
|
|
28
|
+
{TASK_ID} a task ID from plan.json's readyQueue[].id
|
|
29
|
+
{NODE_ID} {TASK_ID} with every hyphen removed/underscored so it's a legal Mermaid node
|
|
30
|
+
name (Mermaid node IDs can't contain hyphens) — drop the phase prefix once the
|
|
31
|
+
node already lives inside that phase's subgraph, drop the literal "TASK", keep
|
|
32
|
+
it short and unique within the subgraph (e.g. US-02-TASK-BE-01 -> US02_BE01)
|
|
33
|
+
{sourceDigest} plan.json's own sourceDigest value, copied verbatim, including the "sha256:"
|
|
34
|
+
prefix
|
|
35
|
+
-->
|
|
36
|
+
|
|
37
|
+
# {FEATURE} — Dependency Graph & Implementation Sequence
|
|
38
|
+
|
|
39
|
+
> Human-readable companion to [`plan.json`](plan.json) — the machine-readable file is
|
|
40
|
+
> authoritative; this is a rendered view of the same data, regenerated alongside it, never
|
|
41
|
+
> hand-edited independently (same convention as `{PREFIX}-Work-Breakdown.md` being generated
|
|
42
|
+
> from the JSON it describes — see `wb-render.js`).
|
|
43
|
+
|
|
44
|
+
## Dependency graph
|
|
45
|
+
|
|
46
|
+
<!--
|
|
47
|
+
One `subgraph {PHASE_ID}` block per phase, in plan.json's phases[] order, listing that phase's
|
|
48
|
+
own taskIds as Mermaid nodes ({NODE_ID}[{TASK_ID}]). Below every subgraph block, one
|
|
49
|
+
`{FROM_NODE_ID} --> {TO_NODE_ID}` edge per (task, dependency) pair found by walking every
|
|
50
|
+
readyQueue[].dependsOn entry — one edge per dependency, not one edge per task (a task with 3
|
|
51
|
+
entries in dependsOn gets 3 edges). Edge order: by readyQueue[].sequence, then by the order the
|
|
52
|
+
dependency appears inside that task's own dependsOn array. A task with an empty dependsOn
|
|
53
|
+
contributes no edges, only its node.
|
|
54
|
+
-->
|
|
55
|
+
|
|
56
|
+
```mermaid
|
|
57
|
+
graph TD
|
|
58
|
+
subgraph {PHASE_ID}
|
|
59
|
+
{NODE_ID}[{TASK_ID}]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
{FROM_NODE_ID} --> {TO_NODE_ID}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Sequence and waves
|
|
66
|
+
|
|
67
|
+
The dispatch order (`readyQueue`), the per-task dependencies (`dependsOn`), and the phase
|
|
68
|
+
waves (`phaseWaves`) are **not repeated here** — they already exist as structured data in
|
|
69
|
+
[`plan.json`](plan.json) and reprinting them as a Markdown table would just be the same facts
|
|
70
|
+
in a second place, free to drift the moment `plan.json` is regenerated and this file isn't.
|
|
71
|
+
Read them straight from there; the Mermaid diagram above is the only rendering kept in this
|
|
72
|
+
file, because it's a genuinely different representation (visual graph) rather than the same
|
|
73
|
+
rows reformatted.
|
|
74
|
+
|
|
75
|
+
## Integrity
|
|
76
|
+
|
|
77
|
+
- **Source digest:** `{sourceDigest}` — computed over every file under `wbs/` (sorted by
|
|
78
|
+
relative path, each length-prefixed before hashing, same technique as
|
|
79
|
+
`lib/task-executor/plan.js`'s own `_computePlanDigest`, extended from "two byte blobs" to
|
|
80
|
+
"every file in a directory"). A re-run of the same computation against the current `wbs/`
|
|
81
|
+
must reproduce this exact value, or this plan is stale and must be regenerated before
|
|
82
|
+
implementation proceeds — mirrors `plan.js`'s existing resume-safety contract, made an
|
|
83
|
+
explicit, reviewable file instead of an internal runtime-only check.
|
|
84
|
+
- Per-task and per-phase checksums in `plan.json` let a drift check point at the *specific*
|
|
85
|
+
file that changed, not just "something changed somewhere."
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
REQUIREMENTS INDEX TEMPLATE — req/index.md
|
|
3
|
+
|
|
4
|
+
Canonical structure for the Requirements index in the split format (FTR-021). Holds everything
|
|
5
|
+
that is NOT naturally owned by a single Use Case — i.e. everything except each Use Case's own flow
|
|
6
|
+
body, which gets its own file under use-cases/{UC-ID}.md (see gaia-use-case-template.md).
|
|
7
|
+
|
|
8
|
+
This is the REAL, currently-implemented 9-section contract — authoritative source:
|
|
9
|
+
`src/claude/agents/gaia-generate-requirements.md`'s own "Output Structure" section, and
|
|
10
|
+
`src/claude/scripts/req-skeleton-check.js`/`req-assembler.js`, which require exactly these 9
|
|
11
|
+
numbered top-level `## N. ` headings, in order, to exist. An earlier FTR-020 exploratory draft of
|
|
12
|
+
this template used a different 7-section numbering (no "UI Requirements" or "Open Questions" as
|
|
13
|
+
their own sections) that was never what Requirements generation actually shipped — this file
|
|
14
|
+
reflects the real, current format, not that earlier draft.
|
|
15
|
+
|
|
16
|
+
SPLITTING PRINCIPLE (apply this test to any new section before deciding where it goes): does this
|
|
17
|
+
content belong to exactly one UC, or does it reference/apply to several? A Business Rule that
|
|
18
|
+
applies to 3 UCs, a Data Requirement describing a schema used by the whole feature, an NFR that
|
|
19
|
+
constrains the feature as a whole — none of these are owned by one UC any more than a shared setup
|
|
20
|
+
module is owned by one Work Breakdown task. Only split out content that is genuinely per-item;
|
|
21
|
+
everything cross-cutting stays here, in one place.
|
|
22
|
+
|
|
23
|
+
EVERY table in this document (and in every use-case file) MUST be followed immediately by a
|
|
24
|
+
one-line legend (blockquote) explaining each column.
|
|
25
|
+
|
|
26
|
+
Fill in every placeholder (angle brackets) and delete every HTML comment block (including this
|
|
27
|
+
one) before treating the file as finished.
|
|
28
|
+
-->
|
|
29
|
+
|
|
30
|
+
# {PREFIX} — Functional Requirements (Index)
|
|
31
|
+
|
|
32
|
+
## 1. Introduction
|
|
33
|
+
|
|
34
|
+
### 1.1 Purpose
|
|
35
|
+
|
|
36
|
+
<prose: brief description of what this requirements document covers>
|
|
37
|
+
|
|
38
|
+
### 1.2 Scope
|
|
39
|
+
|
|
40
|
+
<prose: what is in scope and out of scope>
|
|
41
|
+
|
|
42
|
+
### 1.3 Actors
|
|
43
|
+
|
|
44
|
+
| Actor | Description |
|
|
45
|
+
|-------|-------------|
|
|
46
|
+
| <actor> | <description> |
|
|
47
|
+
|
|
48
|
+
## 2. Use Cases
|
|
49
|
+
|
|
50
|
+
<!-- One row per UC. This table is the single place that lists every UC that exists — the
|
|
51
|
+
use-cases/ directory listing must match it exactly. Title here is a short label, NOT the
|
|
52
|
+
full flow description — that's in the UC's own file (FTR-021: a separate call per UC fills
|
|
53
|
+
in each row's full detail after this skeleton is accepted). -->
|
|
54
|
+
|
|
55
|
+
| UC ID | Title | Actor | Priority | File |
|
|
56
|
+
|-------|-------|-------|----------|------|
|
|
57
|
+
| UC-{NN} | <short title> | <actor(s)> | <Must \| Should \| Could> | [use-cases/UC-{NN}.md](use-cases/UC-{NN}.md) |
|
|
58
|
+
|
|
59
|
+
> **Legend:** **UC ID** — unique identifier, referenced from Business Rules' `Applies to` and
|
|
60
|
+
> Acceptance Criteria's `Related UC` columns. **Title** — short label; full flow is in the linked
|
|
61
|
+
> file. **Actor** — who/what initiates or participates. **Priority** — MoSCoW; drives downstream
|
|
62
|
+
> Must-coverage checks. **File** — this UC's own detail file.
|
|
63
|
+
|
|
64
|
+
## 3. Business Rules
|
|
65
|
+
|
|
66
|
+
| ID | Rule | Applies to |
|
|
67
|
+
|----|------|-----------|
|
|
68
|
+
| BR-{NN} | <rule statement> | <UC-ID, UC-ID, ... \| All UCs> |
|
|
69
|
+
|
|
70
|
+
> **Legend:** **ID** — unique identifier. **Rule** — the constraint itself. **Applies to** —
|
|
71
|
+
> which UC(s) this rule constrains, or "All UCs" if universal.
|
|
72
|
+
|
|
73
|
+
## 4. Data Requirements
|
|
74
|
+
|
|
75
|
+
### 4.1 Entities
|
|
76
|
+
|
|
77
|
+
<!-- For each entity: fields, types, constraints, relationships. -->
|
|
78
|
+
|
|
79
|
+
<prose>
|
|
80
|
+
|
|
81
|
+
### 4.2 Validation Rules
|
|
82
|
+
|
|
83
|
+
| Field | Rule |
|
|
84
|
+
|-------|------|
|
|
85
|
+
| <field> | <rule> |
|
|
86
|
+
|
|
87
|
+
## 5. Non-Functional Requirements
|
|
88
|
+
|
|
89
|
+
| ID | Category | Requirement |
|
|
90
|
+
|----|----------|-------------|
|
|
91
|
+
| NFR-{NN} | <Security \| Performance \| Usability \| ...> | <requirement statement> |
|
|
92
|
+
|
|
93
|
+
## 6. UI Requirements
|
|
94
|
+
|
|
95
|
+
<!-- N/A — internal/technical feature; no UI surface is introduced or changed, if that's true for
|
|
96
|
+
this feature — otherwise fill in both subsections below. -->
|
|
97
|
+
|
|
98
|
+
### 6.1 Pages / Screens
|
|
99
|
+
|
|
100
|
+
<!-- For each page: purpose, layout description, components, interactions. -->
|
|
101
|
+
|
|
102
|
+
<prose>
|
|
103
|
+
|
|
104
|
+
### 6.2 Navigation Flow
|
|
105
|
+
|
|
106
|
+
<prose: how pages connect and how the user moves between them>
|
|
107
|
+
|
|
108
|
+
## 7. Acceptance Criteria
|
|
109
|
+
|
|
110
|
+
<!--
|
|
111
|
+
Column contract: first three columns MUST be exactly "ID", "Criterion", "Related UC" in that
|
|
112
|
+
order — parsed as-is by wb-graph-checks.js's parseAcTable (do not reinvent the column format).
|
|
113
|
+
"Related UC" must be a single UC-ID, a comma-separated list, or the literal "All UCs".
|
|
114
|
+
-->
|
|
115
|
+
|
|
116
|
+
| ID | Criterion | Related UC | Priority |
|
|
117
|
+
|----|-----------|-------------|----------|
|
|
118
|
+
| AC-{NN} | <Given/When/Then or plain testable statement> | <UC-ID \| UC-ID, UC-ID \| All UCs> | <Must \| Should \| Could> |
|
|
119
|
+
|
|
120
|
+
> **Legend:** **ID** — unique identifier; the anchor used across the whole
|
|
121
|
+
> feature.md↔req↔spec↔Work-Breakdown traceability chain. **Criterion** — a testable Given/When/Then
|
|
122
|
+
> statement. **Related UC** — which UC(s) this AC belongs to, or "All UCs"; machine-parsed by
|
|
123
|
+
> `wb-graph-checks.js`'s `parseAcTable`, not just descriptive. **Priority** — MoSCoW; every Must AC
|
|
124
|
+
> must be covered by ≥1 WB task.
|
|
125
|
+
|
|
126
|
+
## 8. Dependencies and Assumptions
|
|
127
|
+
|
|
128
|
+
<!-- External prerequisites, prior features this one builds on, fixed constraints, and anything
|
|
129
|
+
that must be resolved before Gate 1. -->
|
|
130
|
+
|
|
131
|
+
<prose / bullet list>
|
|
132
|
+
|
|
133
|
+
## 9. Open Questions
|
|
134
|
+
|
|
135
|
+
| # | Question | Impact | Suggested resolution |
|
|
136
|
+
|---|----------|--------|---------------------|
|
|
137
|
+
| <N> | <question> | <impact if unresolved> | <suggested resolution, or "open — deferred"> |
|
|
138
|
+
|
|
139
|
+
<!--
|
|
140
|
+
PARSING CONTRACT — req-skeleton-check.js/req-assembler.js require exactly these 9 numbered
|
|
141
|
+
`## N. ` headings, in order, to exist (assertCompleteSections's truncation guard in pm-phase1.js
|
|
142
|
+
checks the same 9 headings). Section 2's table is the index into use-cases/{UC-ID}.md — never
|
|
143
|
+
write a UC's flow body inline here.
|
|
144
|
+
-->
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
TASK DETAIL TEMPLATE — wbs/tasks/{TASK_ID}.md
|
|
3
|
+
|
|
4
|
+
Canonical structure for a task file in the FTR-020 split Work Breakdown format. Every task file
|
|
5
|
+
has exactly three parts, in this order: (1) the field block, (2) Implementation notes,
|
|
6
|
+
(3) Verification commands. Fill in every placeholder below (angle brackets) and delete every
|
|
7
|
+
HTML comment block (including this one) before treating the file as finished. Do not add, remove,
|
|
8
|
+
or reorder the 14 fields — they are parsed positionally as the contiguous run immediately after
|
|
9
|
+
the heading (see "Parsing contract" at the bottom of this file).
|
|
10
|
+
-->
|
|
11
|
+
<a id="task-{TASK_ID}"></a>
|
|
12
|
+
### {TASK_ID}
|
|
13
|
+
|
|
14
|
+
- **Task ID:** {TASK_ID}
|
|
15
|
+
- **Title:** <Short, specific, action-oriented. Not a restatement of the outcome.>
|
|
16
|
+
- **Outcome:** <The ONE observable thing that exists/changed after this task is done — one
|
|
17
|
+
factual, verifiable sentence. If you need "and" to describe it, the task is probably not
|
|
18
|
+
atomic — split it (see Atomicity Contract in gaia-generate-work-breakdown.md).>
|
|
19
|
+
- **Domain:** <one of: BE | FE | DB | DevOps | INFRA | TEST>
|
|
20
|
+
- **Agent type:** <one of: developer-backend | developer-frontend | developer-testing | review-solution>
|
|
21
|
+
- **Dependencies:** <comma-separated task IDs this task's work requires to exist first, or `—` if none>
|
|
22
|
+
- **Acceptance criteria:** <comma-separated AC IDs from Requirements that this task covers, scoped
|
|
23
|
+
to this task's own phase — or `—` if none>
|
|
24
|
+
- **Estimate — agent minutes:** <integer. Target ≤15 (no flag); 16–20 acceptable (no flag);
|
|
25
|
+
21–30 is a non-blocking warning — justify in Grouping rationale below; >30 is rejected, split
|
|
26
|
+
the task instead.>
|
|
27
|
+
- **Estimate — tokens:** <integer, rough order of magnitude for the agent invocation>
|
|
28
|
+
- **Output count:** <integer ≥1. Almost always 1 — see Atomicity Contract. >1 requires a non-null
|
|
29
|
+
Grouping rationale below.>
|
|
30
|
+
- **Grouping rationale:** <required (non-`—`) only when Output count >1 or the estimate is in the
|
|
31
|
+
21–30 min warning band; otherwise `—`>
|
|
32
|
+
- **Commit type:** <conventional-commit type: feat | fix | refactor | test | chore | docs | ...>
|
|
33
|
+
- **Commit scope:** <optional conventional-commit scope, or `—`>
|
|
34
|
+
- **Commit subject:** <imperative, concise, no trailing period — the renderer prepends
|
|
35
|
+
`type(scope): ` automatically, do not include it here>
|
|
36
|
+
|
|
37
|
+
**Implementation notes:**
|
|
38
|
+
|
|
39
|
+
<!--
|
|
40
|
+
This is the part that makes a task file self-sufficient: someone (human or agent) reading ONLY
|
|
41
|
+
this file — not the whole Tech-Spec — should know exactly what to do and how.
|
|
42
|
+
|
|
43
|
+
Write:
|
|
44
|
+
- If this task RELOCATES or MODIFIES existing code: name the exact file(s) and, if you know
|
|
45
|
+
them, the exact current line ranges to copy from or change. Show a before/after snippet, not
|
|
46
|
+
just a description of the change.
|
|
47
|
+
- If this task CREATES something new: give its real signature(s) (function names, parameters,
|
|
48
|
+
return shape) and the actual algorithm as pseudocode or real code — not just a description of
|
|
49
|
+
what it should do.
|
|
50
|
+
- If this task is a TEST: show at least one concrete `test()`/`describe()` block with real
|
|
51
|
+
assertions against the real function/CLI being tested, not a prose list of "things to check".
|
|
52
|
+
- Length target: not 10 lines (too thin to act on without re-deriving the design yourself), not
|
|
53
|
+
10 pages (defeats the point of a small, bounded, independently generated task). A few concrete
|
|
54
|
+
snippets plus the reasoning that connects them is usually right.
|
|
55
|
+
- It is fine — often good — to include a literal example of this exact task-file format inside a
|
|
56
|
+
fenced code block (e.g. to show another agent's expected output shape). If you do, see the
|
|
57
|
+
parsing-contract warning at the bottom of this file: it is specifically about this situation.
|
|
58
|
+
-->
|
|
59
|
+
|
|
60
|
+
<prose + pseudocode/code here>
|
|
61
|
+
|
|
62
|
+
**Verification commands:**
|
|
63
|
+
|
|
64
|
+
<!--
|
|
65
|
+
One or more real shell commands (use AGENTS.md's actual build/test commands for this project)
|
|
66
|
+
that verify this task's output. Must be non-empty. Each command gets its own fenced block,
|
|
67
|
+
preserved byte-for-byte verbatim — never edited, escaped, or "cleaned up" by any tool that
|
|
68
|
+
touches this file; this is what lets a command contain `|`, backticks, or other shell syntax
|
|
69
|
+
safely.
|
|
70
|
+
-->
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
<command>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
<!--
|
|
77
|
+
PARSING CONTRACT (do not delete this section from the real template file; delete only from a
|
|
78
|
+
filled-in task instance) — read by wbs-assembler.js's parseTaskDetailBlock:
|
|
79
|
+
1. Field values are read from the CONTIGUOUS RUN of `- **Label:** value` lines starting
|
|
80
|
+
immediately after the `### {TASK_ID}` heading. Scanning STOPS at the first line that is not
|
|
81
|
+
in that shape — so an example block further down in Implementation notes that happens to
|
|
82
|
+
contain `- **Task ID:** ...`-shaped lines is never mistaken for the real fields. (A real bug,
|
|
83
|
+
found and fixed during this feature's own definition — see US-03-TASK-INFRA-01.md and
|
|
84
|
+
Tech-Spec §4.)
|
|
85
|
+
2. The verification commands are the fenced block(s) after the LAST occurrence of
|
|
86
|
+
"**Verification commands:**" in the file — not the first — for the same reason: an
|
|
87
|
+
illustrative example earlier in the file must never be mistaken for the real section.
|
|
88
|
+
3. Conclusion for anyone writing Implementation notes: you may safely show an example of this
|
|
89
|
+
format inside your own notes. You may NOT rely on your example being the last occurrence of
|
|
90
|
+
"**Verification commands:**" in the file — the real one (at the bottom) always is, by
|
|
91
|
+
construction, as long as you don't add a second real verification section.
|
|
92
|
+
-->
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
TECH-SPEC INDEX TEMPLATE — spec/index.md
|
|
3
|
+
|
|
4
|
+
Canonical structure for the Tech-Spec index (skeleton) in the split format (FTR-024). Holds every
|
|
5
|
+
section genuinely feature-wide, PLUS the Section 9 Components index table — one row per file the
|
|
6
|
+
feature creates or modifies. Each component's own Backend/Frontend/External-Integration/Testing
|
|
7
|
+
detail is produced separately, one call per component (see gaia-component-template.md); this
|
|
8
|
+
skeleton never contains that per-component content inline.
|
|
9
|
+
|
|
10
|
+
This is the REAL, currently-implemented 12-section contract — authoritative source:
|
|
11
|
+
`src/claude/agents/gaia-generate-tech-spec.md`'s own "Output Structure" section, and
|
|
12
|
+
`src/claude/scripts/tech-spec-assembler.js`/`tech-spec-graph-checks.js`. An earlier FTR-020
|
|
13
|
+
exploratory draft of this template used a completely different 6-section numbering (Baseline /
|
|
14
|
+
Resolution of Open Questions / Components index / Traceability / feature-wide guarantees / Shared
|
|
15
|
+
test fixtures) that predates the Tech-Spec split entirely and was never what generation actually
|
|
16
|
+
shipped — this file reflects the real, current 12-section format, not that earlier draft.
|
|
17
|
+
|
|
18
|
+
Fill in every placeholder (angle brackets) and delete every HTML comment block (including this
|
|
19
|
+
one) before treating the file as finished.
|
|
20
|
+
-->
|
|
21
|
+
|
|
22
|
+
# Technical Specification — {Feature Title}
|
|
23
|
+
|
|
24
|
+
## Document Info
|
|
25
|
+
| Field | Value |
|
|
26
|
+
|-------|-------|
|
|
27
|
+
| Feature | {PREFIX and title} |
|
|
28
|
+
| Version | 1.0 |
|
|
29
|
+
| Date | {today} |
|
|
30
|
+
| Status | Draft |
|
|
31
|
+
|
|
32
|
+
## 1. Overview
|
|
33
|
+
|
|
34
|
+
<prose: brief technical summary — what is being built, which systems are affected>
|
|
35
|
+
|
|
36
|
+
## 2. Architecture
|
|
37
|
+
|
|
38
|
+
### 2.1 System Context
|
|
39
|
+
|
|
40
|
+
<prose: where this feature sits in the overall architecture>
|
|
41
|
+
|
|
42
|
+
### 2.2 Component Diagram
|
|
43
|
+
|
|
44
|
+
<!-- Text-based diagram showing components and their interactions. -->
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
[Component A] --(protocol)--> [Component B]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2.3 Sequence Diagrams
|
|
51
|
+
|
|
52
|
+
<!-- For key flows, show the sequence of calls between components (text-based or Mermaid). -->
|
|
53
|
+
|
|
54
|
+
## 3. Backend
|
|
55
|
+
|
|
56
|
+
_Per-component detail — see Section 9's Components table and each component's own design file
|
|
57
|
+
(generated separately, one call per component). Do not write any content here._
|
|
58
|
+
|
|
59
|
+
## 4. Frontend
|
|
60
|
+
|
|
61
|
+
_Per-component detail — see Section 9's Components table and each component's own design file
|
|
62
|
+
(generated separately, one call per component). Do not write any content here._
|
|
63
|
+
|
|
64
|
+
## 5. External Integrations
|
|
65
|
+
|
|
66
|
+
_Per-component detail — see Section 9's Components table and each component's own design file
|
|
67
|
+
(generated separately, one call per component). Do not write any content here._
|
|
68
|
+
|
|
69
|
+
## 6. Security Considerations
|
|
70
|
+
|
|
71
|
+
<!-- Authentication & authorization requirements, input validation boundaries, sensitive data
|
|
72
|
+
handling, CORS implications (if applicable). -->
|
|
73
|
+
|
|
74
|
+
<prose / bullet list>
|
|
75
|
+
|
|
76
|
+
## 7. Database Changes
|
|
77
|
+
|
|
78
|
+
<!-- New tables/columns, indexes recommended, seed data, migration strategy. -->
|
|
79
|
+
|
|
80
|
+
<prose / bullet list>
|
|
81
|
+
|
|
82
|
+
## 8. Configuration
|
|
83
|
+
|
|
84
|
+
<!-- New environment variables, app settings changes, feature flags (if applicable). -->
|
|
85
|
+
|
|
86
|
+
<prose / bullet list>
|
|
87
|
+
|
|
88
|
+
## 9. File Inventory
|
|
89
|
+
|
|
90
|
+
Complete list of files to create or modify:
|
|
91
|
+
|
|
92
|
+
### New files
|
|
93
|
+
| Path | Purpose | Addresses | Domain | Spec |
|
|
94
|
+
|------|---------|-----------|--------|------|
|
|
95
|
+
| {real file path} | {purpose} | {AC-IDs, comma-separated, or —} | {BE \| FE \| DB \| DevOps \| INFRA \| TEST} | [components/{fileSlug}](components/{fileSlug}) |
|
|
96
|
+
|
|
97
|
+
### Modified files
|
|
98
|
+
| Path | Change description | Addresses | Domain | Spec |
|
|
99
|
+
|------|-------------------|-----------|--------|------|
|
|
100
|
+
| {real file path} | {change description} | {AC-IDs, comma-separated, or —} | {BE \| FE \| DB \| DevOps \| INFRA \| TEST} | [components/{fileSlug}](components/{fileSlug}) |
|
|
101
|
+
|
|
102
|
+
<!--
|
|
103
|
+
Column order matters: `Addresses` MUST stay the 3rd column (immediately after
|
|
104
|
+
`Purpose`/`Change description`) — this is the exact position `tech-spec-graph-checks.js`'s
|
|
105
|
+
existing, positional parser reads from, and it reads positionally, not by header name. `Domain`
|
|
106
|
+
and `Spec` are new TRAILING columns, safely ignored by that parser. Do not reorder them. `Domain`
|
|
107
|
+
is the same enum Work Breakdown tasks already use. `Spec` is a provisional link to this file's own
|
|
108
|
+
design file — `components/{the file's own basename, with its extension kept}.md` — the host may
|
|
109
|
+
rewrite this link if two files share a basename, so treat it as provisional, not final.
|
|
110
|
+
-->
|
|
111
|
+
|
|
112
|
+
## 10. Testing Strategy
|
|
113
|
+
|
|
114
|
+
_Per-component detail — see each component's own design file's own Tests section (generated
|
|
115
|
+
separately, one call per component). Do not write any content here._
|
|
116
|
+
|
|
117
|
+
## 11. Implementation Order
|
|
118
|
+
|
|
119
|
+
<!-- Numbered, dependency-aware sequence of components/tasks. -->
|
|
120
|
+
|
|
121
|
+
1. {component/task} — depends on: nothing
|
|
122
|
+
2. {component/task} — depends on: 1
|
|
123
|
+
|
|
124
|
+
## 12. Risks & Mitigations
|
|
125
|
+
|
|
126
|
+
| Risk | Impact | Mitigation |
|
|
127
|
+
|------|--------|-----------|
|
|
128
|
+
| {risk} | {impact} | {mitigation} |
|
|
129
|
+
|
|
130
|
+
<!--
|
|
131
|
+
PARSING CONTRACT — tech-spec-assembler.js's tech-spec-graph-checks.js's parsers require exactly
|
|
132
|
+
these 12 numbered `## N. ` headings, in order, to exist (assertCompleteSections's truncation guard
|
|
133
|
+
in pm-phase1.js checks the same 12 headings), plus Section 9's two subtables in the exact column
|
|
134
|
+
order above. Sections 3/4/5/10 must keep their heading even though their real content is deferred
|
|
135
|
+
to per-component generation — the assembler's spliceSectionBody requires the heading to already
|
|
136
|
+
exist to splice into.
|
|
137
|
+
-->
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
USE CASE TEMPLATE — req/use-cases/{UC-ID}.md
|
|
3
|
+
|
|
4
|
+
Canonical structure for one Use Case file in the split Requirements format. Every UC file has
|
|
5
|
+
exactly three parts, in this order: (1) the heading + field table, (2) the flow/description
|
|
6
|
+
body, (3) cross-references back to the index (Business Rules and Acceptance Criteria that apply
|
|
7
|
+
to this UC). Fill in every placeholder (angle brackets) and delete every HTML comment block
|
|
8
|
+
(including this one) before treating the file as finished.
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
### {UC-ID}: <Title — short, matches the Title column in index.md's Use Cases table exactly>
|
|
12
|
+
|
|
13
|
+
| Field | Value |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Actor | <who/what initiates or participates in this use case> |
|
|
16
|
+
| Priority | <Must \| Should \| Could> |
|
|
17
|
+
| Preconditions | <what must already be true before this use case can start> |
|
|
18
|
+
| Trigger | <the event that starts this use case> |
|
|
19
|
+
|
|
20
|
+
> **Legend:** **Actor** — who/what initiates or participates in this use case. **Priority** —
|
|
21
|
+
> MoSCoW (Must/Should/Could). **Preconditions** — what must already be true before this use case
|
|
22
|
+
> can start. **Trigger** — the event that starts it.
|
|
23
|
+
|
|
24
|
+
<!--
|
|
25
|
+
The body: describe the actual flow. For a technical/internal feature (most of this toolkit's
|
|
26
|
+
own features), this is usually a numbered or prose description of what happens, in enough detail
|
|
27
|
+
that someone reading ONLY this file — not the whole Requirements document — understands exactly
|
|
28
|
+
what this use case requires, without having to infer it from the Tech-Spec or the Work Breakdown.
|
|
29
|
+
Length target: proportional to the use case's real complexity, not padded — a one-paragraph UC is
|
|
30
|
+
fine if that's genuinely all there is to say; a multi-step UC can run longer, but if it's
|
|
31
|
+
sprawling across unrelated concerns, that's a sign it should be two UCs, not one file trying to
|
|
32
|
+
cover both (same atomicity instinct as a Work Breakdown task, just at a coarser grain).
|
|
33
|
+
-->
|
|
34
|
+
|
|
35
|
+
<prose describing the flow>
|
|
36
|
+
|
|
37
|
+
**Related Business Rules:** <comma-separated BR-IDs that apply to this UC, derived from the
|
|
38
|
+
`Applies to` column in [index.md](../index.md#3-business-rules) — include any `All UCs` rule
|
|
39
|
+
too, or `—` if none>
|
|
40
|
+
|
|
41
|
+
**Related Acceptance Criteria:** <comma-separated AC-IDs whose `Related UC` column includes this
|
|
42
|
+
UC (always include any `All UCs` AC too), derived from
|
|
43
|
+
[index.md](../index.md#6-acceptance-criteria). `—` is only valid if index.md's AC table
|
|
44
|
+
genuinely has no AC referencing this UC yet — treat that as a flag worth double-checking, not a
|
|
45
|
+
normal/expected state: per the feature.md<->req<->spec bidirectional traceability check (see
|
|
46
|
+
[index.md](../index.md#traceability)), every UC should normally trace to at least one AC, or
|
|
47
|
+
nothing downstream can verify this UC's Work Breakdown tasks actually satisfy it.
|
|
48
|
+
|
|
49
|
+
<!--
|
|
50
|
+
Both cross-reference lines above are DERIVED data — they must match what index.md's tables
|
|
51
|
+
actually say. Don't invent a BR/AC reference here that doesn't exist in the index, and don't let
|
|
52
|
+
this line go stale if the index changes later (whatever generates/maintains this file is
|
|
53
|
+
responsible for keeping it in sync — this is the same "which side is authoritative" question the
|
|
54
|
+
Work Breakdown's skeleton/detail split had to answer: here, index.md's tables are authoritative,
|
|
55
|
+
this line is a convenience projection of them, not a second source of truth).
|
|
56
|
+
-->
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
PHASE / USER-STORY DETAIL TEMPLATE — wbs/user-stories/{PHASE_ID}.md
|
|
3
|
+
|
|
4
|
+
Canonical structure for a phase file (the INFRA phase and every US-NN phase both use this same
|
|
5
|
+
template — INFRA is not a user story, but lives in the same directory and format; see "Type"
|
|
6
|
+
below). Every phase file has exactly four parts, in this order: (1) the field block,
|
|
7
|
+
(2) Context, (3) Tasks in this phase, (4) Depends on phases. Fill in every placeholder (angle
|
|
8
|
+
brackets) and delete every HTML comment block (including this one) before treating the file as
|
|
9
|
+
finished.
|
|
10
|
+
-->
|
|
11
|
+
<a id="phase-{PHASE_ID}"></a>
|
|
12
|
+
### {PHASE_ID}
|
|
13
|
+
|
|
14
|
+
- **Phase ID:** {PHASE_ID}
|
|
15
|
+
- **Type:** <infrastructure | user-story>
|
|
16
|
+
- **Source UC:** <comma-separated UC-ID(s) this phase's tasks realize, or `—` for a phase with no
|
|
17
|
+
single originating UC (e.g. shared infrastructure). Restated here for human readability from
|
|
18
|
+
`index.json`'s own `sourceUC` array, which is authoritative — this line is a display-only
|
|
19
|
+
projection, not parsed back out by `parsePhaseDetailBlock` (same convention as `Phase ID`/
|
|
20
|
+
`Type` above, which are also restated but not re-extracted). Can be MORE than one UC (an
|
|
21
|
+
orchestration phase) — don't force a single value if that's not true; see Tech-Spec OQ-05.>
|
|
22
|
+
- **Title:** <For `type: user-story`, use the standard form: "As a <role>, I want <capability>,
|
|
23
|
+
so that <benefit>" — derived directly from this phase's source Use Case(s). For `type:
|
|
24
|
+
infrastructure` (the one INFRA phase), there is no user-story grammar — use a short descriptive
|
|
25
|
+
label of what shared setup this phase provides.>
|
|
26
|
+
- **Commit type:** <conventional-commit type, usually `feat`>
|
|
27
|
+
- **Commit scope:** <optional, or `—`>
|
|
28
|
+
- **Commit subject:** <imperative, concise — e.g. "implement {PHASE_ID} <short description>" —
|
|
29
|
+
the renderer prepends `type(scope): ` automatically, do not include it here>
|
|
30
|
+
|
|
31
|
+
**Context:**
|
|
32
|
+
|
|
33
|
+
<!--
|
|
34
|
+
2–4 sentences, no more. Answer: why does this phase exist (which Use Case / need does it map
|
|
35
|
+
to)? How do its own tasks relate to each other? Is there a dependency or sequencing reason other
|
|
36
|
+
phases or tasks need to know about before opening this phase's individual task files? Do NOT
|
|
37
|
+
restate the Title — add information the title doesn't already give.
|
|
38
|
+
-->
|
|
39
|
+
|
|
40
|
+
<prose>
|
|
41
|
+
|
|
42
|
+
**Tasks in this phase:**
|
|
43
|
+
|
|
44
|
+
<!--
|
|
45
|
+
One bullet per task, in the same order as `index.json`'s `taskIds` for this phase. The summary is
|
|
46
|
+
a few words of what the task DOES, not a copy of its full Title (that's one click away via the
|
|
47
|
+
task ID link/filename).
|
|
48
|
+
-->
|
|
49
|
+
|
|
50
|
+
- `{TASK_ID}` — <one-line summary>
|
|
51
|
+
|
|
52
|
+
**Depends on phases:** <comma-separated phase IDs this phase's tasks have a `dependsOn` reference
|
|
53
|
+
into, or `none` if this phase has no cross-phase dependency>
|
|
54
|
+
|
|
55
|
+
<!--
|
|
56
|
+
PARSING CONTRACT — read by wbs-assembler.js's parsePhaseDetailBlock: field values are read from
|
|
57
|
+
the CONTIGUOUS RUN of `- **Label:** value` lines starting immediately after the `### {PHASE_ID}`
|
|
58
|
+
heading, stopping at the first non-matching line. Same rule and same rationale as the task
|
|
59
|
+
template — see task-template.md's parsing-contract note for the full explanation and the real
|
|
60
|
+
bug it fixes.
|
|
61
|
+
-->
|