@pknx/waterfall-cli 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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/bin/waterfall.mjs +14 -0
  4. package/lib/cli/agent/agent-message.ts +71 -0
  5. package/lib/cli/agent/agent-translators.ts +145 -0
  6. package/lib/cli/agent/backend-invoke.ts +133 -0
  7. package/lib/cli/agent/backends.ts +100 -0
  8. package/lib/cli/agent/global-prompts.ts +55 -0
  9. package/lib/cli/commands/bug-start.ts +115 -0
  10. package/lib/cli/commands/comment-add.ts +47 -0
  11. package/lib/cli/commands/cr-all.ts +18 -0
  12. package/lib/cli/commands/cr-finish.ts +176 -0
  13. package/lib/cli/commands/cr-start.ts +105 -0
  14. package/lib/cli/commands/cr-to-rq.ts +18 -0
  15. package/lib/cli/commands/export-pdf.ts +193 -0
  16. package/lib/cli/commands/horizontal/horizontal.ts +232 -0
  17. package/lib/cli/commands/horizontal-create.ts +34 -0
  18. package/lib/cli/commands/horizontal-update.ts +32 -0
  19. package/lib/cli/commands/join-hint.ts +4 -0
  20. package/lib/cli/commands/registry.ts +59 -0
  21. package/lib/cli/commands/resolve-operator-hint.ts +120 -0
  22. package/lib/cli/commands/rq-all.ts +18 -0
  23. package/lib/cli/commands/rq-to-uc.ts +18 -0
  24. package/lib/cli/commands/story-close.ts +124 -0
  25. package/lib/cli/commands/sync-work-items.ts +59 -0
  26. package/lib/cli/commands/sys-start.ts +96 -0
  27. package/lib/cli/commands/test-all.ts +18 -0
  28. package/lib/cli/commands/test-to-story.ts +18 -0
  29. package/lib/cli/commands/types.ts +33 -0
  30. package/lib/cli/commands/uc-all.ts +18 -0
  31. package/lib/cli/commands/uc-to-story.ts +18 -0
  32. package/lib/cli/commands/uc-to-test.ts +18 -0
  33. package/lib/cli/comments/item-comments.ts +285 -0
  34. package/lib/cli/config/dot-waterfall.ts +404 -0
  35. package/lib/cli/config/global-cli.ts +21 -0
  36. package/lib/cli/config/sync-work-item-config.ts +34 -0
  37. package/lib/cli/core/cli-help-spec.ts +833 -0
  38. package/lib/cli/core/cli-log.ts +124 -0
  39. package/lib/cli/core/exec-file.ts +8 -0
  40. package/lib/cli/core/prompt-map.ts +64 -0
  41. package/lib/cli/core/slug.ts +44 -0
  42. package/lib/cli/entry.ts +4 -0
  43. package/lib/cli/export/collect-md.ts +41 -0
  44. package/lib/cli/export/export-items.ts +104 -0
  45. package/lib/cli/export/export-pdf-path.ts +88 -0
  46. package/lib/cli/export/merge-md.ts +37 -0
  47. package/lib/cli/export/mermaid-run.ts +104 -0
  48. package/lib/cli/export/pandoc-pdf.ts +90 -0
  49. package/lib/cli/export/pdf-bundled-worker.mjs +73 -0
  50. package/lib/cli/export/pdf-bundled.ts +36 -0
  51. package/lib/cli/git/cr-agent-context.ts +62 -0
  52. package/lib/cli/git/git-branch-guards.ts +60 -0
  53. package/lib/cli/git/git-cli-mock.ts +191 -0
  54. package/lib/cli/git/git-cli.ts +24 -0
  55. package/lib/cli/main.ts +434 -0
  56. package/lib/cli/paths.ts +9 -0
  57. package/lib/cli/project/pom-json.ts +55 -0
  58. package/lib/cli/spec/spec-init.ts +216 -0
  59. package/lib/cli/spec/spec-root.ts +93 -0
  60. package/lib/cli/sync/apply-remote-comments.ts +87 -0
  61. package/lib/cli/sync/attachment-category.ts +43 -0
  62. package/lib/cli/sync/diff-work-items.ts +113 -0
  63. package/lib/cli/sync/materialize-remote-bugs.ts +66 -0
  64. package/lib/cli/sync/provider-types.ts +43 -0
  65. package/lib/cli/sync/providers/direct-provider.ts +27 -0
  66. package/lib/cli/sync/providers/jira-provider.ts +34 -0
  67. package/lib/cli/sync/providers/registry.ts +26 -0
  68. package/lib/cli/sync/run-sync-work-items.ts +202 -0
  69. package/lib/cli/sync/spec-work-items.ts +226 -0
  70. package/lib/cli/sync/sync-hint-json.ts +163 -0
  71. package/lib/cli/sync/work-item-meta.ts +117 -0
  72. package/lib/cli/work-items/infer-bug-sys.ts +147 -0
  73. package/lib/cli/work-items/remote-bug-import-scaffold.ts +32 -0
  74. package/lib/cli/work-items/write-bug-to-spec.ts +158 -0
  75. package/package.json +54 -0
  76. package/prompts/commands/bug-start.md +46 -0
  77. package/prompts/commands/cr-finish.md +44 -0
  78. package/prompts/commands/cr-start.md +65 -0
  79. package/prompts/commands/cr-to-rq.md +62 -0
  80. package/prompts/commands/horizontal-create.md +27 -0
  81. package/prompts/commands/horizontal-update.md +39 -0
  82. package/prompts/commands/rq-to-uc.md +62 -0
  83. package/prompts/commands/story-close-all.md +34 -0
  84. package/prompts/commands/story-close.md +44 -0
  85. package/prompts/commands/sync-bugs-refine-imports.md +33 -0
  86. package/prompts/commands/sys-start.md +63 -0
  87. package/prompts/commands/test-to-story.md +64 -0
  88. package/prompts/commands/uc-to-story.md +85 -0
  89. package/prompts/commands/uc-to-test.md +58 -0
  90. package/prompts/global/before-changing-spec.md +62 -0
  91. package/prompts/global/content-requirements-vs-use-cases.md +116 -0
  92. package/prompts/global/cursor-overview.md +31 -0
  93. package/prompts/global/git-usage.md +46 -0
  94. package/prompts/global/horizontal-structure.md +75 -0
  95. package/prompts/global/workflows-index.md +59 -0
  96. package/prompts/items/bug-document-structure.md +23 -0
  97. package/prompts/items/cr-document-structure.md +45 -0
  98. package/prompts/items/rq-theme-document-structure.md +36 -0
  99. package/prompts/items/story-document-structure.md +49 -0
  100. package/prompts/items/sys-document-structure.md +36 -0
  101. package/prompts/items/tst-document-structure.md +55 -0
  102. package/prompts/items/uc-document-structure.md +38 -0
  103. package/spec-template/README.md +11 -0
  104. package/spec-template/full/doc/spec-structure.md +16 -0
  105. package/spec-template/full/prompts/before-changing-spec.md +7 -0
  106. package/spec-template/full/prompts/workflows.md +25 -0
@@ -0,0 +1,62 @@
1
+ # Before changing spec artifacts — review the actual delta
2
+
3
+ ## Important: cross-references in spec **content** (compact ids)
4
+
5
+ In **prose inside** **`CR-*`**, **`RQ-*`**, **`UC-*`**, **`STORY-*`**, **`TST-*`**, **`HOR-*`**, **`BUG-*`**, and **`SYS-*`** bodies:
6
+
7
+ - **Never** refer to another artifact by **file path** (no `` `technical/...` ``, no `` `requirements/...` `` in running text).
8
+ - **Always** use the **typed id** only: **`CR-001`**, **`RQ-002`**, **`UC-003`**, **`STORY-004`**, **`TST-005`**, **`SYS-006`**, **`HOR-007`**, **`BUG-008`** (and stable **`TC-*`** ids inside a UC).
9
+
10
+ **Why:** paths churn with refactors and bloat the spec; ids stay stable and grep-friendly. **Git** and **diff** commands are for **your** review process — they are not how readers should cite dependencies in markdown.
11
+
12
+ **Horizontals (`HOR-*`):** **`## Aggregated definitions`** must hold **substance** (models, contracts, rules), not catalogs of paths. At **most one** optional **traceability** line per logical topic may cite a single **`STORY-<NNN>`** (id only) if needed — do not dump path lists into horizontal body text.
13
+
14
+ **No “upstream” graph in markdown:** Do **not** add **`**Upstream:**`** identity fields or **`### Upstream`** under **`## Links and dependencies`**. Trace parents with **typed fields** (**`CR:`**, **`UC:`**) or prose ids, and use **`### Downstream references`** for children only — see **`prompts/items/*-document-structure.md`**.
15
+
16
+ **`### Downstream references` and similar lists:** List children as **typed ids only** (e.g. `- RQ-002`, `- STORY-014`, `- TST-003`). Do **not** use markdown links whose targets are repository paths — paths churn and duplicate what the id already names. Readers and search jump on **`RQ-002`** / **`STORY-014`**; optional tooling may resolve ids without embedding paths in spec text.
17
+
18
+ **`*Source:*` lines (e.g. in `TST-*`):** Cite **`UC-<NNN>`** and the matching **`TC-<NNN>-<seq>`** by **id only** (e.g. `*Source: UC-004 / TC-004-01*`), never a path to **`UC-<NNN>.md`**.
19
+
20
+ ## Operator hints and prompt **structure** (not spec body text)
21
+
22
+ - **Operator hint** — text the **Waterfall CLI** injects before a workflow (including blocks like **CR branch — changed paths** or **`waterfall horizontal update`** path lists) is **steering context** for that run. **Interpret** it (what to read, what changed, what to reconcile). Do **not** paste it **verbatim** into **`## Summary`**, **`## Purpose`**, titles, **identity** blocks, or other artifact sections unless you are deliberately keeping a single polished sentence as the canonical description.
23
+ - **Create-command scaffolds** — **`waterfall cr start`**, **`sys start`**, and **`horizontal create`** write **`## Draft steering (CLI)`** (raw operator text) plus italic placeholders in canonical sections. Treat that block as **scratch input**: **rephrase** into structured content per the relevant **`prompts/items/*-document-structure.md`** (or **`horizontal-structure.md`** for **HOR**), then **remove** **Draft steering** when done. Canonical sections must **not** stay a 1:1 copy of the steering text.
24
+ - **`SYS-*` / `HOR-*` — `## Purpose`:** write scope in **plain language** without **CR-***, **SYS-*** (siblings), **STORY-***, **RQ-***, **UC-***, **HOR-*** (peers), or **TST-***. Traceability uses **`### Downstream references`** and (for horizontals) **`## Aggregated definitions`** when appropriate — not the Purpose paragraph.
25
+ - **CLI wire: read order** — When the primary workflow is attached as a **file** segment in **system** (reference delivery), read that workflow from disk **first**, then use the **user** text segments (operator hint, then any separate **CR branch — paths changed** block) as steering. When the workflow is inlined under **user** (embed delivery), read **user** top to bottom: operator hint and scope segments, then the workflow body.
26
+ - **Prompts are not filler** — files under **`prompts/global/`**, **`prompts/items/`**, and **`prompts/commands/`** define **shape, rules, and process**. They are **not** meant to be copied into **`CR-*`**, **`RQ-*`**, **`UC-*`**, **`STORY-*`**, **`TST-*`**, **`HOR-*`**, or **`SYS-*`** bodies as boilerplate or “Purpose” text. Write **substance** for the product; cite **typed ids** where traceability is needed.
27
+
28
+ ---
29
+
30
+ ## Rule
31
+
32
+ **Before** you edit **`UC-*`**, **`RQ-*`**, **`CR-*`**, **`TST-*`**, or **`STORY-*`** files, inspect the current repository state so your change matches what is already there, not an assumed older version.
33
+
34
+ ## Baseline: always **`develop`**
35
+
36
+ For **`waterfall-spec`**, **Git diff review is always anchored to `develop`** — the integration branch defined in **[`CURSOR.md`](../CURSOR.md)**. Do **not** use **`main`**, a generic **`HEAD`-only** review, or another default as the comparison line unless the team has **explicitly** documented an exception.
37
+
38
+ 1. **`git fetch origin develop`** (when you use a remote named **`origin`**) so local **`develop`** matches the shared line where possible.
39
+ 2. **Working tree vs `develop`** — **`git diff develop`** (optionally **`git diff develop -- <path>…`**) — everything that differs from the tip of **`develop`** to your **current files** (includes **staged** and **unstaged** changes on top of whatever branch you are on).
40
+ 3. **Commits on your branch vs `develop`** — **`git diff develop...HEAD`** (optionally with **`-- <path>…`**) — changes **reachable from `HEAD`** since the **merge base** with **`develop`** (useful on **`feature/…`** branches without mixing in unstaged noise).
41
+ 4. **Single file** — same refs: e.g. **`git diff develop -- requirements/…/UC-002.md`** or **`git diff develop...HEAD -- path/to/file`**.
42
+ 5. **History** — **`git log -p develop..HEAD -- path/to/file`** (or **`develop...HEAD`** with three dots for symmetric difference) when you need prior commits on the branch without contradicting **`develop`**.
43
+
44
+ **If you are on `develop` with only local (uncommitted) edits:** **`git diff`** and **`git diff --staged`** still show your pending delta vs the last commit; after **`git fetch`**, **`git log HEAD..origin/develop`** (or **`git diff HEAD origin/develop`**) checks whether **`develop`** moved upstream before you edit.
45
+
46
+ ## Workflow prompts: one action, one artifact set
47
+
48
+ Each edge guide under **`prompts/`** (**CR → RQ**, **RQ → UC**, **UC → STORY**, **UC → TEST**, **TEST → STORY**) includes **Scope of edits (strict)** — **only** the **target types** for that transition may be modified in that run. **Do not** mix layers (e.g. no **`UC`** body edits inside **CR → RQ**). If multiple layers need updates, **finish** one prompt’s scope, commit or hand off, then run the next prompt.
49
+
50
+ ## Why
51
+
52
+ - Avoids blind overwrites of links or markdown sections someone else refined.
53
+ - Makes **incremental** updates (new testcase, tightened scope) easier to phrase consistently.
54
+ - Surfaces **merge residue** or **duplicate** sections before you add more text.
55
+ - Keeps review **comparable** with the same integration line the team merges to (**`develop`**).
56
+
57
+ ## When applying prompts from an agent
58
+
59
+ Instruct the agent to **read the file from disk** and to show or run **`git diff`** **against `develop`** (per Baseline above) **before** proposing edits — especially for **`UC`** / **`RQ`** / **`TST`** where tables and ids must stay aligned.
60
+
61
+ This complements (does not replace) **`CURSOR.md`** Git branch rules: still work on **`feature/CR-<NNN>`** (or **`feature/<short-slug>`** for non-CR work) as required; **diff** is for **awareness of content** relative to **`develop`**, not a substitute for branching.
62
+
@@ -0,0 +1,116 @@
1
+ # Content rules — RQ (requirement theme) vs UC (use case)
2
+
3
+ These rules describe **what to write** at each layer. Process steps live in the edge-specific prompt files.
4
+
5
+ ---
6
+
7
+ ## Requirement (`RQ-*` / `RQ-<NNN>.md` under the RQ folder)
8
+
9
+ **Purpose:** State the **general** intent of a **functionality area** — the “why” and “what kind of capability” — **without** prescribing a single user click-path.
10
+
11
+ **Include:**
12
+
13
+ - **General purpose** — what capability the theme delivers, in **broad terms** (product language, not UI steps).
14
+ - **Scope** — what **is** in the RQ: themes, sub-areas, major boundaries.
15
+ - **Constraints** — policy, non-goals, dependencies on other RQs or CRs, quality bars (e.g. security posture, “local-only”, “OIDC only”) when they apply to the **whole theme**.
16
+ - **Out of scope** — explicit exclusions so UCs do not sprawl.
17
+ - **Links** — optional owning **CR-<NNN>** in identity or **Summary** (typed id); **`### Downstream references`** for UCs and related summaries as the graph grows. Do **not** maintain an **`### Upstream`** subsection.
18
+
19
+ **Avoid:**
20
+
21
+ - Step-by-step “user does X then Y” unless that is the **only** way to express a constraint (rare at RQ level).
22
+ - Duplicating full testcase tables (those belong in **`UC-<NNN>.md`**).
23
+
24
+ ---
25
+
26
+ ## Use case (`UC-<NNN>.md`)
27
+
28
+ **Purpose:** Describe **one specific, actionable** slice of behavior: a **flow** actors can perform or a **system behaviour** you can verify — **and** how acceptance is proven.
29
+
30
+ **Behaviour sections (same file) must include:**
31
+
32
+ - **Actors** and **goal** tied to a **concrete** outcome.
33
+ - **Main flow** (numbered or structured) — **actions** and **system responses** someone could **execute** or **test** (login, start stack, open page, …).
34
+ - **Preconditions / postconditions** that make the flow **testable**.
35
+ - **Exceptions** — error paths with expected handling.
36
+ - **Context** sections as needed (still inside this file — see [`uc-document-structure.md`](../items/uc-document-structure.md)).
37
+
38
+ **Acceptance sections (same file)** — use stable headings **`## TC-<NNN>-<seq> — …`**:
39
+
40
+ - **Acceptance tests** — each testcase id (e.g. **TC-002-01**) with objective, preconditions, **steps**, and **expected outcome** so **completion of the UC** can be judged objectively.
41
+ - Coverage aligned to the **main flow** and **critical exceptions**; add or change cases when the UC changes.
42
+
43
+ **Avoid:**
44
+
45
+ - Vague goals (“good UX”) without observable criteria — tie them to **`TC-*`** sections or measurable checks.
46
+
47
+ ---
48
+
49
+ ## Relationship
50
+
51
+ | Layer | Question it answers |
52
+ |-------|---------------------|
53
+ | **RQ** | What **area** of the product are we building, under what **constraints** and **scope**? |
54
+ | **UC** | What **specific** flow or behaviour must work, and **how do we know** it is done (**`TC-*`** ids in **`UC-<NNN>.md`**)? |
55
+
56
+ If an idea is still “fuzzy,” keep it in **RQ** or **CR** until it can be written as an **actionable** UC plus **`TC-*`** acceptance.
57
+
58
+ ---
59
+
60
+ ## Granularity: breaking an **RQ** into **multiple UCs**
61
+
62
+ One **RQ** theme should usually become **several** UCs, not one oversized document.
63
+
64
+ **Prefer a separate `UC-*` for each:**
65
+
66
+ - **Separable user- or system-visible outcome** (e.g. “search catalog” vs “add line item to cart” vs “submit order”) — not one UC titled “everything checkout.”
67
+ - **Distinct actor or channel** when behaviour or rules differ materially (guest vs authenticated, API vs web).
68
+ - **Independent test surface** — if acceptance would be a huge single **`TC-*`** list, split so each UC has a tight, reviewable testcase set.
69
+ - **Different failure / policy envelope** (e.g. payment retry vs inventory reservation).
70
+
71
+ **Anti-patterns:**
72
+
73
+ - A single UC that lists ten unrelated flows in one **main flow** — split into multiple UCs and link them under the same **RQ** `### Downstream references`.
74
+ - Copy-pasting **RQ** prose into **UC** without actionable steps — the UC must be executable/testable.
75
+
76
+ Cross-references between UCs use **ids only** (`UC-002`, `UC-003`), not paths — see **[`before-changing-spec.md`](before-changing-spec.md)**.
77
+
78
+ ---
79
+
80
+ ## Granularity: multiple RQ themes from one CR
81
+
82
+ A **CR** often spans **several product themes**. Prefer **several RQs** over one umbrella RQ that tries to cover everything in the change.
83
+
84
+ **Prefer a separate `RQ-*` for each:**
85
+
86
+ - **Separable product or customer-facing theme** (e.g. catalog search vs cart/checkout vs account orders) — not one RQ titled “bookstore” that lists every subsystem in one file.
87
+ - **Different constraint or policy envelope** (e.g. guest vs authenticated commerce rules, public vs admin-only capabilities).
88
+ - **Independent downstream planning** — if different teams or phases could ship different themes, split RQs so **RQ → UC** can run per theme without dragging unrelated scope into every UC pass.
89
+
90
+ **Anti-patterns:**
91
+
92
+ - One **RQ** whose **Scope** reads like a CR dump of every file you might touch — refine into themes or defer explicit “phase 2” RQs with a short note on the **CR**.
93
+ - Skipping **RQ** split because “it is all one feature” when acceptance and ownership clearly diverge (still one **CR**, multiple **RQ** children).
94
+
95
+ Link every **RQ** from the source **CR** `### Downstream references` (**typed ids only**).
96
+
97
+ ---
98
+
99
+ ## Granularity: multiple STORY items from one UC
100
+
101
+ **UC → STORY** is where work becomes **implementation-sized**. One **UC** usually becomes **several** stories, not one “implement the whole UC” mega-story.
102
+
103
+ **Prefer a separate `STORY-*` for each:**
104
+
105
+ - **Separable delivery slice** — API endpoint group, persistence layer, storefront page flow, background job, migration, or infra — that you could review, estimate, or ship in a meaningful chunk.
106
+ - **Different SYS ownership** when the same UC touches multiple subsystems (each SYS gets its own stories where possible).
107
+ - **Different risk or sequencing** — foundation (schema, auth hook) before UI; read path before write path when the UC describes both.
108
+ - **Bounded acceptance** — if one story would need ten unrelated acceptance bullets, split so each **STORY** traces to a **subset** of **TC-*** ids or UC sections.
109
+
110
+ **Anti-patterns:**
111
+
112
+ - One **STORY** whose **Goal** restates the entire UC title with no narrowing — decompose into vertical slices with explicit **out of scope** on each story for the remainder.
113
+ - Folding **unrelated** UC changes into a single story because “we are already editing that SYS” — split by concern; link both under the UC `### Downstream references`.
114
+
115
+ See **[`story-document-structure.md`](../items/story-document-structure.md)** and the **UC → STORY** command prompt for process steps.
116
+
@@ -0,0 +1,31 @@
1
+ # CURSOR.md overview — spec “law” pointer
2
+
3
+ Authoritative source in the spec tree: `waterfall-spec/CURSOR.md`.
4
+
5
+ ## Role of `CURSOR.md`
6
+
7
+ `CURSOR.md` is the normative document for:
8
+
9
+ - **Directory layout** of `waterfall-spec` (where CR, RQ, UC, SYS, STORY, TST live),
10
+ - **Naming conventions** (id formats, folder names, `_STORY-*` closure rule),
11
+ - **Branching rules** (work on `feature/...`, no direct `develop` edits),
12
+ - **Graph discipline** (how artifacts reference each other),
13
+ - **Immutability constraints** for closed artifacts.
14
+
15
+ All prompt files and CLI behavior must stay consistent with `CURSOR.md`. If there is ever a conflict, `CURSOR.md` wins.
16
+
17
+ **File names (CLI + `prompts/items/*`):** each primary artifact lives in a **typed folder** with a matching **`ITEM-<NNN>.md`** file — e.g. **`changerequests/CR-001-slug/CR-001.md`**, **`requirements/RQ-002-slug/RQ-002.md`**, **`technical/SYS-003-slug/SYS-003.md`**, **`technical/horizontals/HOR-004-slug/HOR-004.md`**.
18
+
19
+ ## When to read `CURSOR.md`
20
+
21
+ Agents and operators should consult `CURSOR.md` when:
22
+
23
+ - introducing new artifacts (CR/RQ/UC/STORY/TST),
24
+ - changing directory structure or file naming,
25
+ - changing downstream references between artifacts,
26
+ - interpreting rules around closed stories/tests.
27
+
28
+ Prompt files under `prompts/commands/` and structure guides under `prompts/items/` assume the rules from `CURSOR.md` as their baseline.
29
+
30
+ **CLI operator hints** and **prompts/** wording: see **[`before-changing-spec.md`](./before-changing-spec.md)** — hints are steering only (not verbatim Summary/Purpose); structure guides are not copied into artifact bodies as filler.
31
+
@@ -0,0 +1,46 @@
1
+ # Git usage for `waterfall-spec` (from CLI)
2
+
3
+ This prompt summarizes how to use Git safely when editing **`waterfall-spec`** while you are operating via the **`waterfall` CLI**. The **authoritative** rules still live in **`CURSOR.md`** inside `waterfall-spec`; if anything here disagrees, **`CURSOR.md` wins**.
4
+
5
+ ## 1. Diff discipline — always compare against `develop`
6
+
7
+ Before you edit **`CR-*`**, **`RQ-*`**, **`UC-*`**, **`STORY-*`**, or **`TST-*`**:
8
+
9
+ - Review the **actual delta** on disk anchored to **`develop`**.
10
+ - Recommended commands (see **`before-changing-spec.md`** in this same `global/` folder for full details):
11
+ - `git fetch origin develop`
12
+ - `git diff develop` (or `git diff develop -- <path>…`)
13
+ - `git diff develop...HEAD` for branch-range changes
14
+ - `git log -p develop..HEAD -- <path>` when you need history
15
+
16
+ **Do not** rely on intuition about “what probably changed”; always inspect the real diff first.
17
+
18
+ ## 2. One transition, one artifact set
19
+
20
+ Lifecycle prompts and CLI commands follow **strict scopes**:
21
+
22
+ - **CR → RQ**
23
+ - **RQ → UC**
24
+ - **UC → STORY**
25
+ - **UC → TEST**
26
+ - **TEST → STORY**
27
+
28
+ In each run, only the **target types** for that edge may be changed (plus `number.json` where required). If multiple layers need updates, **finish one edge, commit or hand off, then run the next**. Do not mix CR, RQ, UC, STORY, TST edits into a single unstructured commit driven by one prompt.
29
+
30
+ ## 3. Branching rules (summary — see `CURSOR.md` for full law)
31
+
32
+ - **No working commits on `develop`**: author spec changes on a non‑`develop` branch, then integrate via merge.
33
+ - **CR‑scoped work**:
34
+ - Use branches named **`feature/CR-<NNN>`** or **`feature/CR-<NNN>-<slug>`**.
35
+ - Keep all commits for that CR on its `feature/CR-<NNN>…` branch until integration.
36
+ - Do **not** use `cr-<NNN>-...` or `CR-<NNN>-...` without the `feature/` prefix.
37
+ - **Non‑CR cleanup / maintenance work**:
38
+ - Use short-lived branches like **`feature/<short-slug>`**.
39
+ - Do not use **`chore/*`** branch names.
40
+
41
+ For the complete set of Git rules (including recovery guidance), read **`CURSOR.md` → “Git workflow (this repository)”** in the `waterfall-spec` repository.
42
+
43
+ ## Spec body text vs git paths
44
+
45
+ **Git** commands (`git diff develop`, path-scoped diffs) are for **operators and agents** to **inspect** the tree. **Inside** markdown artifacts (**`CR`**, **`RQ`**, **`UC`**, **`STORY`**, **`HOR`**, etc.), **cross-references must use typed ids** (`STORY-001`, `UC-002`) — **not** repository paths. See **[`before-changing-spec.md`](before-changing-spec.md)**.
46
+
@@ -0,0 +1,75 @@
1
+ # Horizontal artifacts (**HOR-***) — structure and patterns
2
+
3
+ **Horizontals** live under **`technical/horizontals/HOR-<NNN>-<slug>/HOR-<NNN>.md`**. They are **cross-cutting** views: one document that **aggregates** a concern (schemas, APIs, **technical stack**, security rules, etc.) **across many anchored items** (today: **story**).
4
+
5
+ CLI: **`waterfall horizontal create …`**, **`waterfall horizontal update HOR-NNN`**. Both run only on a **change-request branch** **`feature/CR-<NNN>-…`** (same rule as **`sys start`** and lifecycle prompts), not on **`develop`**.
6
+
7
+ **Scaffold from `horizontal create`:** the file may ship **`## Draft steering (CLI)`** (raw operator purpose text) and an italic placeholder under **Purpose**. **Synthesize** a tight **Purpose** and later fill **`## Aggregated definitions`** from story substance (especially after **`horizontal update`**) — **not** by leaving **Purpose** as a verbatim copy of steering. **`## Purpose`** should **not** cite **CR-***, **SYS-***, **STORY-***, etc. — plain-language scope only; ids live in **Aggregated definitions** when needed for traceability. Remove **Draft steering** when the doc stands on its own.
8
+
9
+ **Reference rule:** In **`HOR-<NNN>.md`**, **`## Aggregated definitions`** is **substance** (models, contracts, invariants in prose or tables). Do **not** fill it with file paths, directory trees, or bullet lists of paths. Cite sources by **typed id** only (**`STORY-012`**, **`UC-003`**) — **at most one** such id per logical subsection when traceability is needed; prefer **zero** if the definition is self-contained. See **[`before-changing-spec.md`](before-changing-spec.md)**.
10
+
11
+ **Git signal:** **`waterfall horizontal update`** prints **`develop...HEAD`** path lists in the **operator hint** only. Use them to find what to read; **fold** facts into **`## Aggregated definitions`** — the horizontal markdown file itself should not accumulate raw git listings.
12
+
13
+ ## When to use a horizontal
14
+
15
+ - Several **STORY** artifacts (or future anchors) each mention the **same concern** (e.g. persistence, REST shapes).
16
+ - You want a **single place** to reconcile naming, types, and invariants **in words and tables**, not a second copy of every story path.
17
+ - The horizontal **does not replace** stories; it **summarizes** the agreed cross-cutting truth.
18
+
19
+ ## `## Aggregated definitions` — what “good” looks like
20
+
21
+ - **Database / `database-model`:** follow **Database model — required shape** under **`database-model`** below (full table inventory, datatypes, Mermaid ER) — not “see `technical/...`”.
22
+ - **API / `api-model`:** resources, methods, request/response field summaries, errors, versioning — written out.
23
+ - **Technical stack / `technical-stack`:** follow **Technical stack — required shape** under **`technical-stack`** below (languages, frameworks, libraries, tooling — one reconciled inventory).
24
+ - **Bad:** paragraphs that are mostly `` `path/to/file` `` bullets; **good:** compact definitions with **optional** single **`STORY-<NNN>`** pointer only where one story owns an edge case.
25
+
26
+ ## Common horizontal kinds (examples)
27
+
28
+ ### `database-model`
29
+
30
+ - **Collects:** every persisted **table** (or equivalent store) in scope, **all columns** with **datatypes**, keys, nullability / defaults where normative, relationships, migration notes, and **persistence** rules — as **written definitions** inside **`## Aggregated definitions`**.
31
+ - **Process:** After **`horizontal update`**, use the **hint** path list, then **merge facts** into **## Aggregated definitions**.
32
+
33
+ #### Database model (`database-model`) — required shape
34
+
35
+ Inside **`## Aggregated definitions`**, a **`database-model`** horizontal **must** include:
36
+
37
+ 1. **Entity-relationship diagram** — one fenced **`mermaid`** block using **`erDiagram`**. **Every** in-scope table appears as an entity; **every** foreign-key (or equivalent) relationship appears with correct cardinality. Entity blocks **must list all attributes** with types (same logical names and types as the per-table tables below — no orphan columns in prose only).
38
+ 2. **Per-table definitions** — for **each** table, a subsection headed with the **table name** containing a **markdown table** with at least **Field** and **Type** columns for **every** column; add **Null**, **Default**, and **Notes** columns when the team needs them. No hand-wavy “see stories”; the horizontal is the **inventory of record** for the datamodel.
39
+
40
+ Optional short prose before or after is fine for narrative (e.g. engine, schema name); it does not replace the diagram or column tables.
41
+
42
+ - **Quality bar:** Stories stay detailed; the horizontal stays **one reconciled summary** that is **machine-checkable** (complete column list + ER).
43
+
44
+ ### `api-model`
45
+
46
+ - **Collects:** resource paths, methods, request/response shapes, error conventions, versioning — as **contract text**, not link farms.
47
+ - **Process:** Same — **`horizontal update`** supplies the path list in the hint; you **author** the consolidated contract in **## Aggregated definitions**.
48
+
49
+ ### `technical-stack`
50
+
51
+ - **Collects:** the **single inventory of record** for **technologies** the system actually uses: languages and runtimes, application frameworks, major **libraries** and SDKs, databases and clients, message brokers, HTTP/gRPC stacks, front-end UI kits, test runners, build tools, linters, container base images, CI actions — whatever **STORY** artifacts commit to for this product or CR.
52
+ - **Process:** After **`horizontal update`**, use the **hint** path list, read relevant **STORY** **`## Technology`** / **`## Data and validation`** sections, and **deduplicate** into **`## Aggregated definitions`**.
53
+
54
+ #### Technical stack (`technical-stack`) — required shape
55
+
56
+ Inside **`## Aggregated definitions`**, a **`technical-stack`** horizontal **must** include:
57
+
58
+ 1. **Grouped inventory** — one **`###`** subsection per **category** your team uses (adapt names as needed), for example: **Languages & runtimes**, **Backend frameworks & servers**, **Frontend & UI**, **Data stores & clients**, **Messaging & integration**, **Auth & security libraries**, **Testing**, **Build, packaging & CI**, **Observability & ops tooling**. Empty categories may be omitted or marked *not used*.
59
+ 2. **Tables, not prose-only lists** — under each category, a **markdown table** with at least **Component** (product or library name) and **Role** (what it does in *this* system). Add **Version** (or version policy, e.g. “LTS Node 20”) and **Notes** when stories specify them. **Every** technology that remains in active use across in-scope stories should appear **once** in the right group (no duplicates across groups unless intentionally distinct deployments).
60
+
61
+ Optional one-line **narrative** (e.g. “Primary backend is Node; storefront is Next.js”) is fine above the tables; it does not replace the inventory.
62
+
63
+ - **Quality bar:** A new engineer can answer “what do we run and import?” from this file alone; stories stay the **source of detail**, the horizontal is the **reconciled catalog**.
64
+
65
+ ### Other slugs
66
+
67
+ Use a **short kebab-case** name (`security-model`, `event-model`, …). Describe in **## Purpose** what is in scope and what is out of scope.
68
+
69
+ ## Anchor item type
70
+
71
+ Today the CLI supports **`story`** only: path filters in **`horizontal update`** look for **`STORY-*`** / **`_STORY-*`** segments in paths changed vs **`develop`**. More anchors may be added later.
72
+
73
+ ## Related prompts
74
+
75
+ - **`prompts/commands/horizontal-update.md`** — agent pass after **`horizontal update`** to refresh **aggregated** content (not path indexes).
@@ -0,0 +1,59 @@
1
+ # Workflows index — prompt families (CR ↔ RQ ↔ UC ↔ STORY ↔ TEST, with SYS as manual structure)
2
+
3
+ Authoritative source in the spec tree: `waterfall-spec/prompts/workflows.md`.
4
+
5
+ ## Purpose
6
+
7
+ Give operators and agents a single place to see:
8
+
9
+ - which lifecycle *edges* exist (CR→RQ, RQ→UC, UC→STORY, UC→TEST, TEST→STORY),
10
+ - which prompt file backs each edge,
11
+ - which CLI commands should be used against those prompts.
12
+
13
+ `SYS-*` artifacts are part of technical structure, but SYS creation is manual and not a dedicated lifecycle edge command.
14
+
15
+ **HOR-*** (horizontals) aggregate cross-cutting definitions across anchored items (e.g. **story**) — kinds include **`database-model`**, **`api-model`**, **`technical-stack`**, and others in **`horizontal-structure.md`**.
16
+
17
+ ## Edges and prompts
18
+
19
+ - **CR → RQ** — `prompts/commands/cr-to-rq.md`
20
+ - **RQ → UC** — `prompts/commands/rq-to-uc.md`
21
+ - **UC → STORY** — `prompts/commands/uc-to-story.md`
22
+ - **UC → TEST** — `prompts/commands/uc-to-test.md`
23
+ - **TEST → STORY** — `prompts/commands/test-to-story.md`
24
+
25
+ Each of these prompt files includes:
26
+
27
+ - a **Scope of edits (strict)** section, and
28
+ - a **CLI orchestration** section (for the corresponding `... all` command).
29
+
30
+ ## CLI-oriented workflows
31
+
32
+ For any command that invokes an agent from a **change-request branch** (`feature/CR-<NNN>-…`), the wire payload uses **two `user` text segments**: first the operator’s own hint, then a separate **“CR branch — paths changed vs develop”** block from `git diff develop...HEAD --name-only`, so agents see the CR’s touched paths without running git themselves. That second block is **operational context** only — **interpret** it; do **not** paste it verbatim into **`## Summary`**, **`## Purpose`**, or titles. **Spec markdown** must still cite dependencies by **typed id** (`RQ-001`, `STORY-003`), not paths (**[`before-changing-spec.md`](before-changing-spec.md)**).
33
+
34
+ Entry points and their backing prompts:
35
+
36
+ - `waterfall cr start` → `prompts/commands/cr-start.md`
37
+ - `waterfall sys start` → `prompts/commands/sys-start.md`
38
+ - `waterfall horizontal create …` → mechanical scaffold + **`Draft steering (CLI)`**; patterns in **`horizontal-structure.md`**; refinement checklist **`horizontal-create.md`**
39
+ - `waterfall horizontal update HOR-NNN` → `prompts/commands/horizontal-update.md` (after CLI adds git path lists to the operator hint)
40
+ - `waterfall cr to rq` → `prompts/commands/cr-to-rq.md`
41
+ - `waterfall rq to uc` → `prompts/commands/rq-to-uc.md`
42
+ - `waterfall uc to story` → `prompts/commands/uc-to-story.md`
43
+ - `waterfall uc to test` → `prompts/commands/uc-to-test.md`
44
+ - `waterfall test to story` → `prompts/commands/test-to-story.md`
45
+ - `waterfall story close STORY-NNN` → `prompts/commands/story-close.md`
46
+ - `waterfall story close all` → `prompts/commands/story-close-all.md`
47
+ - `waterfall cr finish` → `prompts/commands/cr-finish.md`
48
+
49
+ For the `... all` commands, see the **CLI orchestration** section inside the relevant edge prompt.
50
+
51
+ ## CLI wire: prompt delivery (**embed** vs **reference**)
52
+
53
+ The Waterfall CLI may send the primary command workflow in one of two shapes:
54
+
55
+ - **Embed (default)** — the workflow markdown body is inlined as a **user** text segment (after operator hint and any CR branch path list). Read **user** top to bottom.
56
+ - **Reference** — the primary workflow is **not** duplicated under **user**; it appears only as a **file** segment in **system** (absolute path under the CLI install). Open that file and follow it; **user** carries hint and scope only.
57
+
58
+ **Reference mode — paths and links:** Resolve relative links in each markdown file from **that file’s directory**. Global and command prompts live under the CLI install, **outside** the spec workspace; your environment must allow reading those absolute paths. For the Cursor CLI backend, use **sandbox disabled** so those prompt files are readable.
59
+
@@ -0,0 +1,23 @@
1
+ # BUG document structure
2
+
3
+ Canonical path: `technical/SYS-<NNN>-<slug>/BUG-<NNN>-<slug>/BUG-<NNN>.md`
4
+
5
+ ## Identity block
6
+
7
+ 1. Title heading like `# BUG-<NNN> — <short defect title>`
8
+ 2. One line each:
9
+ - `**Id:** BUG-<NNN>`
10
+ - `**SYS:** SYS-<NNN>` (parent subsystem)
11
+ - `**Status:** <draft|open|in progress|closed|…>`
12
+
13
+ ## Summary
14
+
15
+ The **Summary** section is the defect narrative: what breaks, how to reproduce, expected vs actual behavior, scope/severity, and links to related **STORY-***, **UC-***, or **TC-*** by **typed id only** (no file paths — see **[`before-changing-spec.md`](../global/before-changing-spec.md)**).
16
+
17
+ Optional subsections (when useful):
18
+
19
+ - `### Reproduction`
20
+ - `### Expected vs actual`
21
+ - `### Related work items`
22
+
23
+ Do **not** leave long-term **Draft steering (CLI)** blocks in finished specs; they are operator scratch input from `waterfall bug start`.
@@ -0,0 +1,45 @@
1
+ # CR document structure — required sections & fields
2
+
3
+ This guide defines the canonical *markdown shape* of a change request:
4
+ `changerequests/CR-<NNN>-<slug>/CR-<NNN>.md`
5
+
6
+ ## Rule
7
+
8
+ A CR markdown file is a single human-readable artifact whose identity and lifecycle state are clearly extractable near the top, with the rest of the proposal describing the change.
9
+
10
+ ## Required identity block
11
+
12
+ Your CR markdown should start with:
13
+
14
+ 1. A title heading like `# CR-<NNN> — <human description>`
15
+ 2. Identity fields (present verbatim, one per line):
16
+ - `**Id:** CR-<NNN>`
17
+ - `**Status:** draft` (or the current lifecycle status)
18
+
19
+ Do **not** add an **Upstream** field or **`### Upstream`** subsection — use **`### Downstream references`** only under **`## Links and dependencies`**. Optional peer or product context belongs in **`## Summary`** as prose citing **typed ids** (`CR-001`), not a separate “upstream” graph.
20
+
21
+ ## Required sections
22
+
23
+ The following sections should exist (names may vary slightly in subsections, but the anchors/meaning should be stable):
24
+
25
+ 1. `## Summary`
26
+ - Short, high-signal description of what the CR introduces at the conceptual level.
27
+ 2. A “proposal” section (commonly `## Proposed change`)
28
+ - Break the proposal into subsections (`### ...`) as needed.
29
+
30
+ 3. `## Links and dependencies` (commonly)
31
+ - Include a `### Downstream references` subsection listing produced artifact **ids** (for CR, usually **`RQ-*`** — see **[`before-changing-spec.md`](../global/before-changing-spec.md)**).
32
+
33
+ ## Allowed and disallowed content (structure guidance)
34
+
35
+ 1. Allowed: detailed proposal and rationale, organized into subsections.
36
+ 2. Allowed: links to related typed artifacts by **id** in prose or in **`### Downstream references`** only (no **`### Upstream`**).
37
+ 3. Allowed: out-of-scope bullet lists.
38
+ 4. Disallowed: mixing in full step-by-step lifecycle edits for later artifact layers. Keep those for the transition prompts.
39
+
40
+ ## Downstream references (required)
41
+
42
+ Under `## Links and dependencies`, keep a `### Downstream references` list with **one bullet per produced artifact id** (e.g. `- RQ-001`). Prefer **typed ids only** — no path-based markdown links (**[`before-changing-spec.md`](../global/before-changing-spec.md)**).
43
+
44
+ For CRs, this is where new **`RQ-*`** entries are appended during CR → RQ transitions.
45
+
@@ -0,0 +1,36 @@
1
+ # RQ theme document structure — required sections & fields
2
+
3
+ This guide defines the canonical markdown shape of an RQ *theme*:
4
+ `requirements/RQ-<NNN>-<slug>/RQ-<NNN>.md`
5
+
6
+ ## Rule
7
+
8
+ An RQ theme is the general-purpose “what/why/scope” layer for an RQ. It must be readable and navigable on its own, and link **forward** via **`### Downstream references`** only (no upstream sections).
9
+
10
+ ## Required header identity block
11
+
12
+ Your `RQ-<NNN>.md` should start with:
13
+
14
+ 1. A title heading like `# RQ-<NNN> — <human description>`
15
+ 2. Identity fields (present verbatim, one per line):
16
+ - `**Id:** RQ-<NNN>`
17
+ - `**Status:** <...>` (e.g. draft/active)
18
+ - Optional: `**CR:** CR-<NNN>` — the **change request** this theme belongs to (**typed id only**, not “upstream” wording)
19
+
20
+ ## Required sections
21
+
22
+ 1. `## Summary`
23
+ - A concise explanation of what the RQ delivers at a thematic level.
24
+ 2. `## Links and dependencies`
25
+ - Must include:
26
+ - `### Downstream references` list — **one bullet per child id** (**`UC-*`**, **`STORY-*`**, etc.); ids only, no path-based links (**[`before-changing-spec.md`](../global/before-changing-spec.md)**)
27
+ - `### Other dependencies` if there are non-spec inputs (frameworks, infra, etc.)
28
+ - Do **not** add **`### Upstream`** — owning **CR** is optional in the identity block or **Summary**, by **id** only.
29
+ 3. Optional but common `## In scope` / `## Out of scope`
30
+ - Explicit inclusions/exclusions that prevent RQ drift.
31
+
32
+ ## Structural constraints
33
+
34
+ 1. No step-by-step user flows: the *flow* narrative lives in UC; the theme stays general and constraint-oriented.
35
+ 2. Keep `### Downstream references` current whenever this RQ produces new child artifacts.
36
+
@@ -0,0 +1,49 @@
1
+ # STORY document structure — required sections & fields
2
+
3
+ This guide defines the canonical markdown shape of a STORY:
4
+ `technical/SYS-<NNN>-<...>/STORY-<NNN>-<slug>/STORY-<NNN>.md`
5
+
6
+ ## Rule
7
+
8
+ STORY markdown must be a standalone implementation contract for a meaningful slice of work, with its identity, **UC** traceability (**typed id**), and acceptance criteria clearly extractable from the top sections.
9
+
10
+ **Horizontals:** Where **`HOR-*`** artifacts define the cross-cutting **data model**, **API model**, or **technical stack** for the CR, this STORY **must respect** their **`## Aggregated definitions`** — align entities, fields, types, public contracts, and **named technologies** (frameworks, libraries, runtimes). **Extend** those concepts **only** when this slice needs something **not** already captured; call out extensions in prose (and **`HOR-<NNN>`** by id if helpful). See **[`horizontal-structure.md`](../global/horizontal-structure.md)**.
11
+
12
+ ## Required identity block
13
+
14
+ Your `STORY-<NNN>.md` should start with:
15
+
16
+ 1. A title heading like `# STORY-<NNN> — <human description>`
17
+ 2. Identity fields (present verbatim, one per line):
18
+ - `**Id:** STORY-<NNN>`
19
+ - `**SYS:** SYS-<NNN>` (owning technical subsystem)
20
+ - `**Status:** <draft|closed>` (or the current lifecycle status)
21
+ - `**UC:** UC-<NNN>` — primary use case this story implements (**typed id only**; do **not** use **`**Upstream:**`**)
22
+ 3. Optional: `**Closed:** YYYY-MM-DD — ...` when status is closed
23
+
24
+ ## Required sections
25
+
26
+ 1. `## Goal`
27
+ - What this STORY implements/updates, in one coherent statement.
28
+ 2. `## Data and validation`
29
+ - **Concrete** structures: entities, fields, types or schema notes; **validity** and invariants; error/edge behaviour for this slice. No hand-waving — enough detail to implement and review. Stay **consistent** with applicable **`HOR-*`** definitions; document any **necessary** extension beyond the horizontal.
30
+ 3. `## Technology`
31
+ - **Named** stack for this slice: runtime, frameworks, APIs/protocols, storage class, major libraries — what implementers actually use. Stay **consistent** with **`technical-stack`** **`HOR-*`** when one exists; document any **necessary** new or differing choice.
32
+ 4. `## Acceptance criteria`
33
+ - Observable criteria that prove completion for this slice; trace to **`UC-<NNN>`** / **`TC-*`** by **id only** (see **[`before-changing-spec.md`](../global/before-changing-spec.md)** — no file paths in prose).
34
+ 5. `## Out of scope` (recommended)
35
+ - What the next STORY should pick up; keeps scope boundaries clean.
36
+ 6. Implementation notes (optional)
37
+ - E.g. `## Implementation notes` for wiring, env flags, or follow-ups — still use **typed ids** for cross-refs, not paths.
38
+
39
+ ## Structural constraints
40
+
41
+ 1. Don’t rewrite full UC behaviour or testcase tables inside STORY — summarize only what this slice implements; point to **`UC-<NNN>`** / **`TC-*`** by id.
42
+ 2. When closing a story, the *folder* must be renamed to `_STORY-.../` while the inner filename remains `STORY-<NNN>.md`.
43
+
44
+ ## Downstream references (required)
45
+
46
+ Inside `## Links and dependencies`, include a `### Downstream references` subsection.
47
+
48
+ List directly produced follow-up artifacts (**`TST-*`**, follow-up **`STORY-*`** / **`BUG-*`**) as **typed id bullets only**, one-way from this story — **[`before-changing-spec.md`](../global/before-changing-spec.md)**.
49
+
@@ -0,0 +1,36 @@
1
+ # SYS document structure — required sections & fields
2
+
3
+ This guide defines the canonical markdown shape of a subsystem:
4
+ `technical/SYS-<NNN>-<slug>/SYS-<NNN>.md`
5
+
6
+ ## Rule
7
+
8
+ A SYS document defines one technical boundary that groups implementation stories. It should describe **purpose** and a maintained **`### Downstream references`** list of produced stories. Do **not** use **`### Upstream`**.
9
+
10
+ SYS creation is a manual maintenance action, not a lifecycle chain step. The lifecycle command `uc -> story` can target one or many existing SYS documents, but it does not create SYS entities.
11
+
12
+ ## Required identity block
13
+
14
+ Your `SYS-<NNN>.md` should start with:
15
+
16
+ 1. A title heading like `# SYS-<NNN> — <human description>`
17
+ 2. Identity fields (present verbatim, one per line):
18
+ - `**Id:** SYS-<NNN>`
19
+ - `**Status:** <draft|active|closed>`
20
+
21
+ ## Required sections
22
+
23
+ 1. `## Links and dependencies`
24
+ - Include:
25
+ - `### Downstream references` — **`STORY-*`** ids produced under this SYS (ids only; **[`before-changing-spec.md`](../global/before-changing-spec.md)**)
26
+ - Traceability to **CR** / **RQ** / **UC** / other **SYS** belongs here (or in **`## Implementation notes`** if you add it) using **typed ids** — **not** inside **`## Purpose`**.
27
+ 2. `## Purpose`
28
+ - One clear paragraph for subsystem scope and intent in **plain product and technical language**.
29
+ - **Do not** cite **CR-***, **RQ-***, **UC-***, **SYS-*** (other than this file’s own identity in the title block), **STORY-***, **HOR-***, or **TST-*** in **`## Purpose`** — describe boundaries without artifact ids; readers infer links from **`### Downstream references`** and folder placement.
30
+
31
+ ## Structural constraints
32
+
33
+ 1. Keep SYS focused on technical ownership and boundaries, not detailed acceptance logic.
34
+ 2. Put implementation detail in `STORY-<NNN>.md` files under this SYS.
35
+ 3. Keep `### Downstream references` current as stories are added/closed/moved.
36
+