@eeshaai/code 1.0.0 → 1.0.1

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 (150) hide show
  1. package/LICENSE.md +3 -3
  2. package/README.md +335 -322
  3. package/dist/cli.js +4 -4
  4. package/dist/resources/styles/custom/instructions/design.md +283 -283
  5. package/dist/resources/styles/custom/instructions/requirements.md +161 -161
  6. package/dist/resources/styles/custom/instructions/tasks-implement.md +90 -90
  7. package/dist/resources/styles/custom/instructions/tasks.md +159 -159
  8. package/dist/resources/styles/custom/process.md +49 -49
  9. package/dist/resources/styles/custom/prompts/first.md +29 -29
  10. package/dist/resources/styles/custom/prompts/implement.md +27 -27
  11. package/dist/resources/styles/custom/prompts/rewrite-note.md +40 -40
  12. package/dist/resources/styles/custom/prompts/rewrite.md +32 -32
  13. package/dist/resources/styles/custom/style.yml +46 -46
  14. package/dist/resources/styles/grammar.md +727 -731
  15. package/dist/resources/styles/kiro/style.yml +63 -0
  16. package/dist/resources/styles/speckit/style.yml +59 -0
  17. package/dist/server.js +473 -477
  18. package/dist/web/chunks/{abnfDiagram-VCTEODGH-6KC3BO47.js → abnfDiagram-VCTEODGH-P6AZFXJU.js} +2 -2
  19. package/dist/web/chunks/architecture-7GRP2DOG-K6PMPK7N.js +2 -0
  20. package/dist/web/chunks/{architectureDiagram-5GKGNRK7-QKPCVOD2.js → architectureDiagram-5GKGNRK7-JB5DD7KL.js} +2 -2
  21. package/dist/web/chunks/{blockDiagram-I7D4REHJ-4XZWNXLB.js → blockDiagram-I7D4REHJ-ARCDWS5D.js} +2 -2
  22. package/dist/web/chunks/{c4Diagram-7LVT6UL2-4HJHKNE3.js → c4Diagram-7LVT6UL2-57CIXPJZ.js} +2 -2
  23. package/dist/web/chunks/{chunk-GQPX4EIC.js → chunk-3EZ2OKHV.js} +2 -2
  24. package/dist/web/chunks/{chunk-37NHO5VO.js → chunk-4KJ2U3VQ.js} +2 -2
  25. package/dist/web/chunks/{chunk-OXLTOJNY.js → chunk-4ZUFUR3U.js} +2 -2
  26. package/dist/web/chunks/{chunk-46RPN6IE.js → chunk-63W35XXT.js} +2 -2
  27. package/dist/web/chunks/{chunk-LSVIQRSY.js → chunk-6YVFH4BZ.js} +2 -2
  28. package/dist/web/chunks/{chunk-6VRLULJH.js → chunk-7PUK2GON.js} +2 -2
  29. package/dist/web/chunks/{chunk-TPXX77KB.js → chunk-7Q4TXKAS.js} +2 -2
  30. package/dist/web/chunks/{chunk-4S2DRQJ6.js → chunk-7QRY2XB7.js} +2 -2
  31. package/dist/web/chunks/{chunk-2DLEMZHM.js → chunk-CA2KMNVI.js} +2 -2
  32. package/dist/web/chunks/{chunk-LHNPPNB7.js → chunk-CFMSYLIK.js} +2 -2
  33. package/dist/web/chunks/{chunk-4TORDSRR.js → chunk-CKJRXIX7.js} +2 -2
  34. package/dist/web/chunks/{chunk-L34PKG4P.js → chunk-CXXG5KL5.js} +2 -2
  35. package/dist/web/chunks/chunk-EFBAEJZJ.js +2 -0
  36. package/dist/web/chunks/{chunk-LQ6CTWX6.js → chunk-FKTXB6RJ.js} +2 -2
  37. package/dist/web/chunks/{chunk-TXNHMPKM.js → chunk-FU7R4QOG.js} +2 -2
  38. package/dist/web/chunks/{chunk-DIRT34TZ.js → chunk-GEV6X2TZ.js} +2 -2
  39. package/dist/web/chunks/{chunk-II6WN3ZG.js → chunk-GPW7TXQS.js} +2 -2
  40. package/dist/web/chunks/{chunk-5KNOHX5X.js → chunk-I6RMTJPN.js} +2 -2
  41. package/dist/web/chunks/{chunk-6TGTE6CF.js → chunk-IKC3ZQV7.js} +2 -2
  42. package/dist/web/chunks/{chunk-LDXBIOBF.js → chunk-ITN3D7RJ.js} +2 -2
  43. package/dist/web/chunks/{chunk-OODDZ447.js → chunk-J6N7AUC2.js} +2 -2
  44. package/dist/web/chunks/{chunk-FGASMJTA.js → chunk-J7VDGOTK.js} +2 -2
  45. package/dist/web/chunks/chunk-KVRWT2YT.js +2 -0
  46. package/dist/web/chunks/{chunk-6URXM4C4.js → chunk-NBC6B3KN.js} +2 -2
  47. package/dist/web/chunks/{chunk-HBEUVMXY.js → chunk-NLHJT4GD.js} +2 -2
  48. package/dist/web/chunks/{chunk-HNYXDXPN.js → chunk-NOVL2262.js} +2 -2
  49. package/dist/web/chunks/{chunk-FPLIRG3U.js → chunk-NQ2XP5EN.js} +2 -2
  50. package/dist/web/chunks/chunk-P44J6WNO.js +2 -0
  51. package/dist/web/chunks/{chunk-6KSWTVXD.js → chunk-QBOSTM7Q.js} +2 -2
  52. package/dist/web/chunks/{chunk-HAKJ3AUV.js → chunk-QKU4ZFG5.js} +2 -2
  53. package/dist/web/chunks/{chunk-T4HEWXAQ.js → chunk-RINQGKTH.js} +2 -2
  54. package/dist/web/chunks/{chunk-TPYBIPJG.js → chunk-RK4EOCHJ.js} +2 -2
  55. package/dist/web/chunks/{chunk-YM7LHP34.js → chunk-S4X6ERXI.js} +2 -2
  56. package/dist/web/chunks/{chunk-VY4GEFSG.js → chunk-SE57RN36.js} +2 -2
  57. package/dist/web/chunks/{chunk-6FQEBIA3.js → chunk-SGL7WI35.js} +3 -3
  58. package/dist/web/chunks/chunk-SOAWGUAD.js +2 -0
  59. package/dist/web/chunks/{chunk-7XAOOQR4.js → chunk-U6ILIHMR.js} +2 -2
  60. package/dist/web/chunks/{chunk-M3SWKTLZ.js → chunk-USZ3ZJYA.js} +2 -2
  61. package/dist/web/chunks/{chunk-MBZYSJFT.js → chunk-UU7BHEBD.js} +2 -2
  62. package/dist/web/chunks/{chunk-QNEZP2TE.js → chunk-WL4ZMLPV.js} +2 -2
  63. package/dist/web/chunks/{chunk-MZEMPN3C.js → chunk-XE4RLI22.js} +2 -2
  64. package/dist/web/chunks/{chunk-VAKN3BTM.js → chunk-XJ6FSQEO.js} +2 -2
  65. package/dist/web/chunks/{chunk-XBYCKXUJ.js → chunk-XM7VXEGI.js} +2 -2
  66. package/dist/web/chunks/{chunk-2RFQIKC6.js → chunk-XO4SHRSO.js} +2 -2
  67. package/dist/web/chunks/{chunk-BUZPUGIT.js → chunk-XOZZFIHV.js} +2 -2
  68. package/dist/web/chunks/{chunk-FNIFXWXL.js → chunk-YYJ5VFH5.js} +2 -2
  69. package/dist/web/chunks/{chunk-JOSXY3EP.js → chunk-ZX45GMMJ.js} +2 -2
  70. package/dist/web/chunks/{chunk-4IPDIKAU.js → chunk-ZXMMITLE.js} +2 -2
  71. package/dist/web/chunks/classDiagram-ZZMXUADV-ALD5ECFE.js +2 -0
  72. package/dist/web/chunks/classDiagram-v2-VYDZK3BY-IMIEVQNX.js +2 -0
  73. package/dist/web/chunks/{cose-bilkent-JH36ORCC-ZPRW5JRW.js → cose-bilkent-JH36ORCC-YVEPG7XZ.js} +2 -2
  74. package/dist/web/chunks/cynefin-OW5HDTMX-5G3MG4ZJ.js +2 -0
  75. package/dist/web/chunks/{cynefinDiagram-5FMLGOSQ-O7GURHJG.js → cynefinDiagram-5FMLGOSQ-A3E3NM6X.js} +2 -2
  76. package/dist/web/chunks/{dagre-GXQ25YYZ-WK67O4N6.js → dagre-GXQ25YYZ-WKL3XLC6.js} +2 -2
  77. package/dist/web/chunks/{diagram-S7CK7UJ4-2CEO2EN2.js → diagram-S7CK7UJ4-AENTNBTM.js} +2 -2
  78. package/dist/web/chunks/{diagram-UQ7AKVKN-2Z4VHGF3.js → diagram-UQ7AKVKN-BN6IVDBP.js} +2 -2
  79. package/dist/web/chunks/{diagram-VSXAHHWV-AN4BOWYB.js → diagram-VSXAHHWV-X7IW7FU6.js} +2 -2
  80. package/dist/web/chunks/{diagram-VX7I27RA-VEZ2GXCM.js → diagram-VX7I27RA-4V6RQ6IS.js} +2 -2
  81. package/dist/web/chunks/{diagram-Z3DM3KII-TGGNDSLW.js → diagram-Z3DM3KII-ODYVRYAT.js} +2 -2
  82. package/dist/web/chunks/{ebnfDiagram-PWID7BFC-7RM57IJV.js → ebnfDiagram-PWID7BFC-2KD46JNN.js} +2 -2
  83. package/dist/web/chunks/{erDiagram-RLTQ6QDP-LCATC3YT.js → erDiagram-RLTQ6QDP-6MYZ2NRT.js} +2 -2
  84. package/dist/web/chunks/eventmodeling-NTZA5JFV-QZXC5VKS.js +2 -0
  85. package/dist/web/chunks/flowDiagram-HODETNUW-BILJ37ZX.js +2 -0
  86. package/dist/web/chunks/{ganttDiagram-EL5Y4UJY-5VPBBF2V.js → ganttDiagram-EL5Y4UJY-LVA23DND.js} +2 -2
  87. package/dist/web/chunks/gitGraph-4MIJSDKK-H43S2MKN.js +2 -0
  88. package/dist/web/chunks/{gitGraphDiagram-WWUBYQGX-HZMAGPIJ.js → gitGraphDiagram-WWUBYQGX-JRB4SUZI.js} +2 -2
  89. package/dist/web/chunks/info-A6RAGUB7-DKS7Q63Q.js +2 -0
  90. package/dist/web/chunks/infoDiagram-27XIBGKW-JLOVILVF.js +3 -0
  91. package/dist/web/chunks/{ishikawaDiagram-5VMMS53U-A54WWBPX.js → ishikawaDiagram-5VMMS53U-SUA2YN5D.js} +2 -2
  92. package/dist/web/chunks/{journeyDiagram-3NMN7TZE-XRCTMTR7.js → journeyDiagram-3NMN7TZE-ORMC2WB2.js} +2 -2
  93. package/dist/web/chunks/{kanban-definition-UXKFOSKX-UW2PQXZF.js → kanban-definition-UXKFOSKX-TPRG3VMF.js} +2 -2
  94. package/dist/web/chunks/{katex-B7HWCVTN.js → katex-DLHJF5VS.js} +2 -2
  95. package/dist/web/chunks/{mermaid.core-VL5SQK5M.js → mermaid.core-ZM3JSPVU.js} +3 -3
  96. package/dist/web/chunks/{mindmap-definition-YA3MSWOX-2H2Z6CVN.js → mindmap-definition-YA3MSWOX-BLW6WWFS.js} +2 -2
  97. package/dist/web/chunks/packet-AYTQ26CC-FIXQVEDM.js +2 -0
  98. package/dist/web/chunks/{pegDiagram-XKGWAZYB-KC4BYUN7.js → pegDiagram-XKGWAZYB-BYMP3YHY.js} +2 -2
  99. package/dist/web/chunks/pie-WAS4IAKB-R4EUNVPB.js +2 -0
  100. package/dist/web/chunks/{pieDiagram-E7YTZNPT-54T6XSU5.js → pieDiagram-E7YTZNPT-XOJE3H3L.js} +2 -2
  101. package/dist/web/chunks/{quadrantDiagram-AXDQQJYC-3G3RXSTE.js → quadrantDiagram-AXDQQJYC-23VSADTC.js} +2 -2
  102. package/dist/web/chunks/radar-RG4KPBEZ-O6Y2TENX.js +2 -0
  103. package/dist/web/chunks/railroad-74A4TZTK-PHWZ7KVH.js +2 -0
  104. package/dist/web/chunks/railroad-abnf-HS5TGJTU-DZ4OSJAN.js +2 -0
  105. package/dist/web/chunks/railroad-ebnf-LZEXJU2U-GYBLRQUL.js +2 -0
  106. package/dist/web/chunks/railroad-peg-WCYAUIDC-ZK4ZOBSX.js +2 -0
  107. package/dist/web/chunks/{railroadDiagram-O6MQD6OU-3LHKFF5N.js → railroadDiagram-O6MQD6OU-Z5IEAZJK.js} +2 -2
  108. package/dist/web/chunks/{requirementDiagram-BXWQKSXE-M4LF54YT.js → requirementDiagram-BXWQKSXE-MNP4O73E.js} +2 -2
  109. package/dist/web/chunks/{sankeyDiagram-P5KCCOFB-USCKKKNT.js → sankeyDiagram-P5KCCOFB-PADI35QR.js} +2 -2
  110. package/dist/web/chunks/{sequenceDiagram-WJ2MYXX4-QZ2O4KWV.js → sequenceDiagram-WJ2MYXX4-FGWOVXU4.js} +2 -2
  111. package/dist/web/chunks/{sizeCapture-INFHLROL-DZI5JWEV.js → sizeCapture-INFHLROL-Y6H3VQLE.js} +2 -2
  112. package/dist/web/chunks/{stateDiagram-D77RDMKH-EQJNTBF3.js → stateDiagram-D77RDMKH-7PRO4WYR.js} +2 -2
  113. package/dist/web/chunks/stateDiagram-v2-MP3YSRHH-2Y6SWEJW.js +2 -0
  114. package/dist/web/chunks/{swimlanes-42K2YHIH-H7SZ2HG6.js → swimlanes-42K2YHIH-DXVTFB6Q.js} +2 -2
  115. package/dist/web/chunks/swimlanesDiagram-VR7AAH4N-U2LP4OEE.js +9 -0
  116. package/dist/web/chunks/{timeline-definition-24CTP7MA-4Q2ARIQ6.js → timeline-definition-24CTP7MA-7ZIALE6C.js} +2 -2
  117. package/dist/web/chunks/treeView-Q6P3EWNA-VSJ7TJ36.js +2 -0
  118. package/dist/web/chunks/treemap-WGGIJYW6-JZWFGRKS.js +2 -0
  119. package/dist/web/chunks/{vennDiagram-4TSXK5OY-WMJVK74C.js → vennDiagram-4TSXK5OY-IPXNDYWM.js} +2 -2
  120. package/dist/web/chunks/wardley-WFR3VGLG-PAUUFL5N.js +2 -0
  121. package/dist/web/chunks/{wardleyDiagram-VM6X3IG4-CLB324RQ.js → wardleyDiagram-VM6X3IG4-4Z2U2NNR.js} +2 -2
  122. package/dist/web/chunks/{xychartDiagram-S5SC5T6Z-G5C2R7C2.js → xychartDiagram-S5SC5T6Z-NAEIWN4K.js} +2 -2
  123. package/dist/web/page.css +1 -1
  124. package/dist/web/page.js +155 -123
  125. package/package.json +3 -1
  126. package/dist/web/chunks/architecture-7GRP2DOG-JLXNDD4H.js +0 -2
  127. package/dist/web/chunks/chunk-4KP3BIPB.js +0 -2
  128. package/dist/web/chunks/chunk-HX7W7GSO.js +0 -2
  129. package/dist/web/chunks/chunk-PR453BYT.js +0 -2
  130. package/dist/web/chunks/chunk-R7TFKRNM.js +0 -2
  131. package/dist/web/chunks/classDiagram-ZZMXUADV-4J5HHZD6.js +0 -2
  132. package/dist/web/chunks/classDiagram-v2-VYDZK3BY-X6WY2DAS.js +0 -2
  133. package/dist/web/chunks/cynefin-OW5HDTMX-SVVTQRRB.js +0 -2
  134. package/dist/web/chunks/eventmodeling-NTZA5JFV-2SR57JAH.js +0 -2
  135. package/dist/web/chunks/flowDiagram-HODETNUW-HU6Y2EYQ.js +0 -2
  136. package/dist/web/chunks/gitGraph-4MIJSDKK-25JPIQP7.js +0 -2
  137. package/dist/web/chunks/info-A6RAGUB7-72MROTVX.js +0 -2
  138. package/dist/web/chunks/infoDiagram-27XIBGKW-BQYTPGNG.js +0 -3
  139. package/dist/web/chunks/packet-AYTQ26CC-NEGDW4B6.js +0 -2
  140. package/dist/web/chunks/pie-WAS4IAKB-OT3EMGHT.js +0 -2
  141. package/dist/web/chunks/radar-RG4KPBEZ-DCHU5FOQ.js +0 -2
  142. package/dist/web/chunks/railroad-74A4TZTK-RZX6D7H6.js +0 -2
  143. package/dist/web/chunks/railroad-abnf-HS5TGJTU-STTFN7R4.js +0 -2
  144. package/dist/web/chunks/railroad-ebnf-LZEXJU2U-RBXU3IBK.js +0 -2
  145. package/dist/web/chunks/railroad-peg-WCYAUIDC-OD5BXOH6.js +0 -2
  146. package/dist/web/chunks/stateDiagram-v2-MP3YSRHH-WSCDKLG6.js +0 -2
  147. package/dist/web/chunks/swimlanesDiagram-VR7AAH4N-DFYTBPVS.js +0 -9
  148. package/dist/web/chunks/treeView-Q6P3EWNA-ADCP6RPT.js +0 -2
  149. package/dist/web/chunks/treemap-WGGIJYW6-NEV7DUDY.js +0 -2
  150. package/dist/web/chunks/wardley-WFR3VGLG-4QZOFDI5.js +0 -2
@@ -1,731 +1,727 @@
1
- # How to write a spec document
2
-
3
- Write every spec document to the shapes below. Eesha Code reads
4
- these shapes to give the reviewer an outline, linked requirement
5
- citations, highlighted acceptance criteria, and a task list it can run.
6
-
7
- Your phase prompt says *what* to write - which sections, and what goes
8
- in them. This file says *how* to write it. Where the two disagree about
9
- the shape of a line, follow this file.
10
-
11
- ---
12
-
13
- ## 1. Headings
14
-
15
- - One `#` H1, the first line of the file (after frontmatter, where a
16
- document has any).
17
- - `##` H2 for every section.
18
- - `###` H3 for numbered items inside a section - a requirement, a
19
- component, a property.
20
- - `####` H4 for `#### Acceptance Criteria`.
21
-
22
- Put a space after the hashes on every heading. Headings inside a fenced
23
- code block are ignored, so an example in a fence is safe.
24
-
25
- ## 2. Requirements and acceptance criteria
26
-
27
- ```markdown
28
- ### Requirement 3: Retry on timeout
29
-
30
- **User Story:** As a (role), I want (capability), so that (benefit).
31
-
32
- #### Acceptance Criteria
33
-
34
- 1. WHEN (trigger) THEN THE (component) SHALL (behaviour).
35
- 2. IF (condition) THEN THE (component) SHALL (behaviour).
36
- ```
37
-
38
- - The heading carries a word followed by a number, then a colon and a
39
- short title. Number from 1. The word is `Requirement`, unless your
40
- prompt told you a `prefix:` for this phase - a stage whose `style.yml`
41
- names one is told so directly ("this phase's own numbered items are
42
- cited `Req-<n>`"), and that word replaces `Requirement` everywhere
43
- below: `### Req-3: Retry on timeout`.
44
- - Put a literal `#### Acceptance Criteria` line above every criteria
45
- list. Nothing else on that line.
46
- - Criteria are a numbered list directly beneath it: `1. `, `2. `.
47
- - **A criterion's id is the requirement's id, a dot, then its own
48
- number** - `3.2` is requirement 3, criterion 2; with a declared prefix,
49
- `Req-3.2` is `Req-3`, criterion 2. Only the requirement half ever
50
- carries the word - a criterion is always a plain number. This is the
51
- id every other document cites.
52
- - Keep the numbers you wrote. The number as written is the id.
53
-
54
- **A document may declare ids of its own.** A gap analysis numbering
55
- `GAP-1..GAP-11`, an ADR numbering `ADR-3` - put the id first in its own
56
- heading, `### GAP-11: A renumbered requirement is silent`, and it
57
- becomes citable like anything else. A stage with no `prefix:` follows
58
- this rule for its requirements too - it is the same mechanism,
59
- `Requirement` is only its default word.
60
-
61
- Eight rules go with that, and they are the whole of it:
62
-
63
- - **At least two letters before the number.** `FT-1`, `GAP-11`,
64
- `ADR-3` - never `F-1`, `G11`, `D3`. One letter does not tell a reader
65
- what the id points at.
66
- - **An id of your own has no criteria under it.** `### FT-1: Login`
67
- declares `FT-1` and nothing more. A numbered list beneath it does not
68
- become `FT-1.1`, `FT-1.2` - those ids do not exist, and every citation
69
- of them reads as stale. Only a requirement heading (`Requirement 3`,
70
- or this phase's `prefix:` word) numbers its criteria. If an item needs
71
- parts that can be cited, give each part its own id at the start of its
72
- line: `- **FT-1.2**: WHEN ... THEN ...`.
73
- - **One item per heading.** Two gaps are two headings, however closely
74
- they are related.
75
- - **One id per heading, and it comes first.** `### GAP-7 + GAP-8 (QN-7, QN-8)`
76
- declares `GAP-7` and nothing else, so every citation of `GAP-8` reads
77
- as stale - the document is accused of drift it does not have.
78
- - **Nothing before the id.** `### Gap GAP-7` and `### Feature flag (GAP-7)`
79
- declare nothing at all.
80
- - **Unique per document.** One run of numbers per document - a second
81
- `GAP-7` is not a new item, it is the same id written twice.
82
- - **Permanent.** A number is assigned once, in the order raised, and is
83
- never renumbered, reused, re-prefixed, or slotted in later. An item
84
- that is answered, retracted, or superseded keeps its number and its
85
- place - §9 says the same thing about a whole document; this is that
86
- rule holding for one item.
87
- - **One token, everywhere.** Never write an id two ways. `GAP-7` and
88
- `Gap 7` are not the same citation, even inside the same document -
89
- pick the spelling and keep it.
90
-
91
- Give an item that genuinely spans two concerns one id and say so in its
92
- body. An id is a name for one thing; a heading that needs two names is
93
- two items.
94
-
95
- ## 3. Citations between documents
96
-
97
- A citation is an ordinary markdown link:
98
-
99
- ```markdown
100
- - [Requirements : 1.2, 3.1](requirements.md)
101
- - [Requirements : Req-1.2, Req-3.1](requirements.md)
102
- [checkout-prd : 3.2](../../docs/product/checkout-prd.md)
103
- ```
104
-
105
- Write it exactly like this:
106
-
107
- 1. **A plain link.** No other syntax, and nothing to learn - a reader on
108
- GitHub gets a link that works.
109
- 2. **The path is relative to the file you are writing.** A document in
110
- the same spec folder is just `requirements.md`; a file elsewhere in
111
- the repository is `../../docs/product/checkout-prd.md`. Count the
112
- `../` from the folder your own document sits in.
113
- 3. **The target is a `.md` file.** Nothing else is a citation. A ticket,
114
- a wiki page or a PDF is worth linking to as ordinary prose, but it is
115
- not this.
116
- 4. **Nothing after `.md`** - no `#heading`, no line number. The ids in
117
- the brackets say where to land.
118
- 5. **Inside the brackets: a name, a space, a colon, then the ids**,
119
- separated by commas.
120
- 6. **The ids are the target document's own.** A requirements document
121
- with no declared prefix numbers `1` and `1.2`, so cite those; one
122
- with `prefix: Req` numbers `Req-1` and `Req-1.2` - cite the id whole,
123
- word and number together. A document that numbers itself some other
124
- way is cited that way too - `GAP-11` for the eleventh gap in a gap
125
- analysis, `FR-1` for a Spec Kit requirement. Copy the id as that
126
- document writes it; never translate it into a number, and never drop
127
- its word.
128
- 7. **The name** is the phase's label where you are citing a phase of
129
- this spec, and the file name without `.md` where you are citing
130
- anything else.
131
- 8. **Two lines are spelled differently, and only these two:** the
132
- `**Validates: …**` line of a correctness property in `design.md`
133
- (section 5) and the `_Requirements: …_` line of a task in `tasks.md`
134
- (section 6). Everywhere else, the link form above.
135
-
136
- Cite only ids that exist in the target document.
137
-
138
- **Point at the id, not at the position.** Prose refers to an item by its
139
- id, never by "the entry above" or "see below" - a reorder or an insert
140
- breaks a positional reference silently, and an id survives one by
141
- construction.
142
-
143
- **Cite backwards, never forwards.** Inside the spec you may cite any
144
- document written before yours, and your own. A document a later phase
145
- has not written yet cannot be cited - there is nothing there to point
146
- at. A file outside the spec has no order, so it may be cited from
147
- anywhere.
148
-
149
- ### Where a citation goes
150
-
151
- - `tasks.md`: the **last detail line** of every task that implements
152
- behaviour, in italics: `_Requirements: 1.2, 3.1_`.
153
- - `design.md`: the last line of every correctness property, in bold:
154
- `**Validates: Requirements 1.2, 2.4**`.
155
-
156
- ```markdown
157
- - _Requirements: 1.2, 3.1_
158
-
159
- **Validates: Requirements 1.2, 2.4**
160
- ```
161
-
162
- ### Citing something outside the spec
163
-
164
- A requirement that exists because of a PRD, or a design that follows an
165
- ADR, cites it the same way - the only difference is the path:
166
-
167
- ```markdown
168
- Traces to [checkout-prd : 3.2](../../docs/product/checkout-prd.md).
169
- ```
170
-
171
- The numbers still mean requirement and criterion, so they only resolve
172
- if that document numbers the way section 2 describes. When it does not,
173
- write the citation anyway and say in prose what it refers to. A document
174
- nobody can number is still worth pointing at.
175
-
176
- ### Pointing at code
177
-
178
- A pointer at repository code is not a citation - a citation lands on an
179
- id in a `.md` file, an anchor lands on a place in a codebase. Write an
180
- anchor as the repo folder name, then the path from that repo's root,
181
- then the symbol, key, or string inside the file:
182
-
183
- ```markdown
184
- - `<repo-folder>/<path from that repo's root>`, `<symbol or string>`
185
- ```
186
-
187
- A long path stays on one line. It is an address, not prose - never
188
- shortened, never elided to `.../`, never wrapped.
189
-
190
- - **Whole path, from the repo root.** Never a fragment, never relative
191
- to a subfolder you happened to be standing in. `src/Auth/...` and
192
- `services/api/src/Auth/...` are not the same claim, and the shorter
193
- one resolves to nothing.
194
- - **Never a line number.** Position rots between writing and execution;
195
- a name survives an edit.
196
- - **Confirm both halves before writing the line.** The file exists at
197
- that path, *and* it contains the symbol named. A file that exists but
198
- does not carry the symbol is not the anchor - it is the wrong file,
199
- and a path-only check passes it every time.
200
- - **A folder is an anchor too.** A test project, a source folder, a
201
- spec area - it carries no symbol, so the path is the whole of the
202
- claim and the path alone is what gets resolved. `test` and `tests`
203
- differ by one character and one of them is a directory that does not
204
- exist.
205
- - **A build target named in prose is an anchor.** A solution, project,
206
- test project or suite named anywhere - a verification step included -
207
- is read from the repository's own project files, never recalled. A
208
- command that names a project nobody opened fails on the first run,
209
- which is the worst place to find out.
210
- - **A count is an anchor.** Seventeen folders, eleven methods, thirty
211
- locales - derive it by listing them as the line is written. Where a
212
- count is corrected anywhere in this spec, every number derived from
213
- it is recomputed, not carried: a total that moves by one moves every
214
- arithmetic built on it.
215
- - **Re-confirm an anchor taken from an earlier document.** A path read
216
- from `code-findings.md` or from a prior phase is a lead, not a
217
- warrant. One wrong path recorded early otherwise reaches every later
218
- phase unchallenged.
219
- - **One anchor names one place.** A line that needs two files is two
220
- lines.
221
-
222
- ## 4. Acceptance criteria are written in EARS
223
-
224
- Five forms, and no others:
225
-
226
- | Form | Use it for |
227
- |---|---|
228
- | `WHEN (trigger) THEN THE (component) SHALL (behaviour).` | An event. |
229
- | `IF (condition) THEN THE (component) SHALL (behaviour).` | A state that may or may not hold. |
230
- | `WHERE (context) THE (component) SHALL (behaviour).` | A feature or configuration only sometimes present. |
231
- | `WHILE (state) THE (component) SHALL (behaviour).` | The whole duration of a state. |
232
- | `THE (component) SHALL (behaviour).` | An invariant, with no trigger. |
233
-
234
- - Keywords are UPPERCASE: `WHEN`, `IF`, `WHILE`, `WHERE`, `THEN THE`,
235
- `THE`, `SHALL`, `SHALL NOT`.
236
- - `SHALL` for an obligation, `SHALL NOT` for a prohibition. Not
237
- "should", "must" or "will".
238
- - One criterion, one behaviour. Two `SHALL`s joined by "and" are two
239
- criteria.
240
- - Name the actor at the level the phase works at: a requirements
241
- document writes `THE SYSTEM` - which component is responsible is
242
- design's decision; a design-level criterion names the component.
243
-
244
- ## 5. Correctness properties
245
-
246
- ```markdown
247
- ### Property 1: (short descriptive name)
248
-
249
- *For any* (universally quantified input), THE (component) SHALL
250
- (guaranteed outcome), regardless of (what does not matter).
251
-
252
- **Validates: Requirements 1.2, 3.1**
253
- ```
254
-
255
- - Number properties from 1.
256
- - The `**Validates: Requirements 1.2, 3.1**` line is the last line of
257
- the property. One bold run: the word `Validates`, a colon, the word
258
- `Requirements`, then the ids separated by commas. No link - this is
259
- one of the two exceptions section 3 names.
260
- - Every acceptance criterion should be named by at least one property.
261
-
262
- ## 6. The plan
263
-
264
- Pick the dialect your style uses and keep to it. The spacing is exact.
265
-
266
- ### Hierarchical
267
-
268
- ```markdown
269
- - [ ] 1. Group title
270
- - [ ] 1.1 An actionable, single-concern task
271
- - an implementation detail
272
- - Files: `src/thing/index.ts`, `src/thing/__tests__/index.test.ts`
273
- - _Requirements: 1.2, 3.1_
274
- ```
275
-
276
- - Top level: `- [ ] N. Title` - dash, space, `[`, space, `]`, space,
277
- number, period, space, title.
278
- - Sub-task: two spaces per level, then `- [ ] N.M Title`. No period
279
- after `N.M`. Nest as deep as the work needs - `1.1.1` under `1.1`,
280
- four spaces in - but no deeper than it needs: a level exists to hold
281
- several tasks, never one.
282
- - A task with tasks under it is a **group**: a heading for them, not
283
- work of its own. A task with none is a **unit of work** - what an
284
- agent is handed. Depth decides nothing; what sits under a row does.
285
- - Optional task: `- [ ]* N.M Title` - asterisk straight after the
286
- closing bracket, no space.
287
- - Done is `- [x]`.
288
- - Detail lines are four spaces, then `- `, then the text. Details never
289
- carry a checkbox.
290
- - **Every unit of work names the files it touches** on one detail line:
291
- `- Files: ` then the paths in backticks, comma-separated, relative to
292
- the repository root. Second to last, just above the citation. Files it
293
- creates and files it edits alike; a task that touches none says
294
- `- Files: none`. The wave graph is built from this line, and the
295
- engine reads it before it lets two tasks run at once - a plan without
296
- it gets no safety check at all. Kiro ignores the line.
297
- - **A task a person or a workflow does, not an agent, says so** on one
298
- more detail line, `- Run: `, straight after `Files:`. Three shapes and
299
- no other:
300
- `- Run: by hand` - a person does it and ticks the box.
301
- ``- Run: `git switch -c feature/4711` `` - one command in backticks; the
302
- panel runs it in the machine's default shell.
303
- `- Run: story-start story=4711` - a workflow under
304
- `.eesha/workflows/` by its file name without the file extension,
305
- then `key=value` pairs for its params, quoted when a value has spaces.
306
- Write `Run:` only for steps no agent should do - an environment to
307
- update, a branch to create, a review to get. Never on a task that
308
- changes code. A task with a `Run:` line is never handed to an agent,
309
- and its box is ticked by the person who did it.
310
- - Give every task a unique id, and give every dotted id its parent -
311
- `1.2.3` needs a `1.2`, which needs a `1`.
312
-
313
- ### Flat
314
-
315
- ```markdown
316
- ## Phase 1: Setup
317
-
318
- - [ ] T001 Add the module skeleton in `src/thing/index.ts`
319
- - [ ] T002 [P] Add the config type in `src/thing/config.ts`
320
- ```
321
-
322
- - `- [ ] T### Title`. Number from `T001` upward across the whole file;
323
- never restart per phase.
324
- - `[P]` straight after the id marks a task that may run beside the other
325
- `[P]` tasks in its `##` phase. Mark it only where the task touches
326
- files no other `[P]` task in that phase touches.
327
- - Group the work under `##` phase headings.
328
- - Name the files a task touches, in backticks.
329
-
330
- ### The wave graph - hierarchical plans
331
-
332
- End the file with a `## Task Dependency Graph` heading and one fenced
333
- `json` block under it. Write the heading exactly - it is how the graph
334
- is found:
335
-
336
- ```markdown
337
- ## Task Dependency Graph
338
- ```
339
-
340
- ```json
341
- {
342
- "waves": [
343
- { "id": 0, "tasks": ["1.1", "1.3"] },
344
- { "id": 1, "tasks": ["1.2", "3.1"] }
345
- ]
346
- }
347
- ```
348
-
349
- - `waves` is ordered, and each `id` is a number counting from 0.
350
- Tasks inside one wave run at the same time. By default waves run one
351
- after another: a wave starts only when every task of the wave before
352
- it is ticked.
353
- - A wave may say which waves it waits for with `after`, a list of wave
354
- ids: `{ "id": 3, "tasks": ["4.1"], "after": [1] }` waits only for
355
- wave 1, not for wave 2. `"after": []` waits for nothing - a starting
356
- point. Two waves that do not wait for each other are branches: two
357
- people can work them at the same time, on the same git branch, from
358
- two laptops. Leave `after` out and the wave waits for the wave before
359
- it.
360
- - `after` names only waves with a smaller id.
361
- - Use `after` only when the work really does not need the waves you
362
- leave out - no code, type, table or contract from them. When in
363
- doubt, leave `after` out. Two branches whose tasks name the same path
364
- on their `Files:` lines will both edit that file; the panel warns, and
365
- the two people merge it by hand.
366
- - Close the fence on a line of its own, with nothing after the
367
- backticks.
368
- - Put every unit of work in exactly one wave. Groups go in none.
369
- - Ids match the checkbox list exactly.
370
- - A task goes in a later wave than another task only when it needs that
371
- task's work first - code it calls, a type it uses, a table it reads, a
372
- contract it consumes. Otherwise put it in the earliest wave it can go
373
- in. Work in different repositories that does not need each other
374
- shares a wave, so it runs at the same time instead of waiting.
375
- - Two tasks share a wave only when their `Files:` lines have no path in
376
- common. When you cannot tell what a task touches, say so on its
377
- `Files:` line as best you can and give it its own wave.
378
- - A task that commits, pushes or tags in git gets a wave of its own,
379
- with no other task in it. It saves the work of the waves before it,
380
- and a person often wants to run up to the commit and stop there -
381
- any other task beside it would be started with it.
382
-
383
- ## 7. Frontmatter
384
-
385
- Write none. Where a document already has frontmatter, leave it as it is.
386
-
387
- ## 8. Diagrams
388
-
389
- Fence a diagram as `mermaid`. Use `flowchart`, `sequenceDiagram`,
390
- `stateDiagram-v2` or `erDiagram`. One diagram per section, around ten
391
- nodes. `<br/>` for a line break inside a label.
392
-
393
- A diagram that does not parse is worse than no diagram - the reader
394
- gets an error box where the explanation should be. Every rule below is
395
- a construct that breaks, or silently corrupts, a real renderer.
396
-
397
- **Quote by diagram, never by habit.** Quoting is syntax in some places
398
- and literal text in others, so one blanket rule cannot be right.
399
-
400
- Quote here - the quotes are syntax and never reach the reader:
401
-
402
- - flowchart node labels: `A["Caller runs greet.ps1"]`. Always, even
403
- when the text looks harmless - an unquoted `(` on its own is a parse
404
- error.
405
- - flowchart edge labels: `B -->|"no"| C`.
406
- - `stateDiagram-v2` state names: `state "In Progress" as ip`.
407
- - `erDiagram` relationship labels and attribute comments:
408
- `ATTEMPT ||--o{ RESULT : "produces"`. Unquoted, such a label breaks on
409
- the first word the parser reserves - `to`, `one` and `many` are the
410
- ones that catch real sentences - so quote it every time.
411
-
412
- Never quote here - the quotes are literal, and render as visible `"`
413
- marks around the text:
414
-
415
- - `sequenceDiagram` message text: `L->>P: Action outcome`, never
416
- `L->>P: "Action outcome"`.
417
- - `sequenceDiagram` participant aliases: `participant L as lobby-service`.
418
- - `sequenceDiagram` block labels: `alt capture fails`, and the same for
419
- `else`, `loop` and `opt`.
420
- - `stateDiagram-v2` transition labels: `A --> B : starts now`.
421
-
422
- **Two characters break `sequenceDiagram` text, and quoting stops
423
- neither.** Both apply to message text, to `alt`/`else`/`loop`/`opt`
424
- labels, and to `Note` lines:
425
-
426
- - `;` ends the statement. What follows is parsed as a new one, and the
427
- diagram dies with `Expecting 'SOLID_ARROW' ... got 'NEWLINE'`. This
428
- is the house prose style walking into a diagram: the semicolon that
429
- joins two clauses everywhere else is a terminator here. Write a
430
- comma, an em dash, or a second message.
431
- - `#` swallows the rest of the line. No error and no warning - the text
432
- after it simply never renders. Write the word instead of the symbol.
433
-
434
- **Ids are not labels.**
435
-
436
- - Node and state ids are short, alphanumeric and capitalised; the words
437
- go in the label.
438
- - No hyphen in a `stateDiagram-v2` state id - `in_progress` parses,
439
- `in-progress` does not.
440
- - Never a lowercase reserved word as a flowchart node id: `end`,
441
- `graph`, `class`, `style` and `subgraph` all fail. Capitalising is
442
- enough to make one safe - `End` parses.
443
-
444
- **Inside a quoted label, use single quotes:**
445
- `D["Write-Host 'Hello'"]`. A nested `"` is swallowed along with the
446
- text it was meant to mark.
447
-
448
- ## 9. Revising a document
449
-
450
- Requirement numbers, criterion numbers, property numbers, question ids
451
- and task ids are what other documents cite.
452
-
453
- - Keep the numbering. Add new requirements and new tasks at the end.
454
- - Give a question an id once. Never reuse it, never renumber it, and
455
- keep it when the question moves from `## Open Questions` to
456
- `## Answered Questions`.
457
- - Say in its body when a requirement is dead, and leave the gap.
458
- - Improve titles freely - they are for readers.
459
- - Keep the text and the id of a task that is still valid, so its tick
460
- survives.
461
- - Give work that was done and is no longer wanted a compensating task.
462
- - Rebuild the wave graph whenever the task list changes.
463
-
464
- **Leave untouched lines untouched.** A reviewer's margin notes are
465
- re-found by the text of the line they were written against, so rewording
466
- a line nobody asked you to change loses the note attached to it. Change
467
- the lines the pass is about and let the rest stand, word for word.
468
-
469
- ## 10. Questions and assumptions
470
-
471
- Three sections, and where each one goes:
472
-
473
- - `## Open Questions` - at the end, directly above
474
- `## Answered Questions`. Questions with no answer yet.
475
- - `## Answered Questions` - next, beside `## Assumptions`. The same
476
- questions once someone has answered them.
477
- - `## Assumptions` - last. What you decided for yourself and proceeded
478
- on.
479
-
480
- An assumption is you guessing and saying so. An answered question is a
481
- person deciding. They are not the same thing and they do not share a
482
- section.
483
-
484
- ### Writing a question
485
-
486
- One list item, a bold id, one clear question - never a table:
487
-
488
- ```markdown
489
- ## Open Questions
490
-
491
- - **QN-1** Do we keep the device-code flow or the browser flow?
492
- - **QN-2** Is the retry budget per request or per session?
493
- ```
494
-
495
- Ids are `QN-1`, `QN-2` and so on, one run of numbers per document.
496
- Never the one-letter `Q1` - §2 asks for two letters in every id. §9 says
497
- they are allocated once and never renumbered. A question belongs to the
498
- document that raised it: it is answered there, and no other document
499
- renumbers or restates it.
500
-
501
- Four rules go with that, and they are the whole of it:
502
-
503
- - **One decision per question.** A question that takes two answers is
504
- two questions, however closely they are related - "what is the
505
- performance target, what authorizes the caller, and what do we log?"
506
- is three questions wearing one id. A compound question gets a partial
507
- answer, and the unanswered half is then invisible: the question has
508
- an `A:` line, so it counts as answered and stops blocking. §2 says
509
- the same thing about an item and its heading; this is that rule
510
- holding for a question.
511
- - **Self-contained.** The question carries what its owner needs to
512
- decide it - what is true today, and what the decision changes. One
513
- that only makes sense beside the paragraph it was raised from cannot
514
- be answered anywhere else, and it is asked somewhere else by
515
- construction.
516
- - **Name the real choice.** Write out the alternatives you can see and
517
- what each one costs. An open "what should we do here?" hands the
518
- thinking back to the person who asked you to do it. §10's asking
519
- rules still hold - the options are a shortcut to an answer, never a
520
- closed list.
521
- - **Ask it in the phase that owns the decision.** A question this
522
- phase cannot act on is not this phase's question. Asked early it
523
- gets an answer to something adjacent - the person answers what they
524
- were shown, the phase that actually needs the decision asks again
525
- properly, and two answers to near-identical questions now sit in
526
- the record.
527
-
528
- ### An answer is an `A:` line
529
-
530
- An answer goes on the next line, indented under its question. Who
531
- decided and when (UTC) is a `**By:**` line of its own, directly under
532
- the answer:
533
-
534
- ```markdown
535
- - **QN-2** Is the retry budget per request or per session?
536
- **A:** Per session.
537
- **By:** R. Vos - 2026-03-04 09:12 UTC
538
- ```
539
-
540
- A question with an `A:` line is answered. A question without one is not.
541
- That is the whole test, and other things read it. `**A:**` is reserved
542
- for answers: never start any other line with `**A:**`, anywhere in a
543
- spec document.
544
-
545
- ### The decision cache
546
-
547
- `decisions.md` in the spec folder preserves a person's answers when a
548
- phase document is regenerated. It contains only question-and-answer
549
- pairs, one current pair for each decision:
550
-
551
- ```markdown
552
- - **Q:** Is the retry budget per request or per session?
553
- **A:** Per session.
554
- ```
555
-
556
- Before asking a person, check it for the same question and reuse its
557
- answer. When a person changes an answer, update that pair instead of
558
- adding another. A person may edit or delete any pair directly; the file
559
- is its current source of truth. Do not add ids, names, timestamps,
560
- sign-offs, or commentary.
561
-
562
- ### Moving an answered question
563
-
564
- When you next work on a document, move every question that has an `A:`
565
- line out of `## Open Questions` and into `## Answered Questions`, id and
566
- answer intact. Delete `## Open Questions` when nothing is left in it.
567
-
568
- Never delete a question. Never delete an answer. They are the record of
569
- what was decided and why the document says what it says.
570
-
571
- ### When to ask at all
572
-
573
- ### Asking a person
574
-
575
- Every question shown to a person has both by default:
576
-
577
- - A **Keep open** choice, marked as the default. Choosing it records no
578
- answer: put or leave the question under `## Open Questions` and stop
579
- that phase at its gate.
580
-
581
- Never make a choice compulsory when asking a person. A proposed option
582
- may make answering quicker, but it is never the only valid answer.
583
-
584
- In order:
585
-
586
- 1. **Can the code answer it?** Read the code. Do not ask.
587
- 2. **Is it about intent** - what this person wants, which of two ways
588
- they would rather have - ? **Ask now**, with your ask tool. Offer
589
- **Keep open** as the default and free-text input alongside any
590
- proposed options so that user can type the answer when he/she cannot select the options you provide.
591
- 3. **If they keep it open or do not answer**, write it under
592
- `## Open Questions`.
593
-
594
- The split is what kind of question it is. Code tells you what exists. It
595
- never tells you what someone wants.
596
-
597
- A question you never asked is worse than a question you asked. And an
598
- open question stops the next phase, so leave one behind only when you
599
- truly could not get it answered.
600
-
601
- ## 11. Sign-offs
602
-
603
- A sign-off is recorded only from explicit confirmation in
604
- conversation - never on someone's behalf, never assumed, never
605
- pre-filled. The line carries the name and the UTC datetime of that
606
- confirmation:
607
-
608
- ```markdown
609
- - **Approved by (PO):** R. Vos - 2026-03-04 09:12 UTC
610
- ```
611
-
612
- Which roles sign which document is each phase's own rule; the shape
613
- and the integrity rule are the same everywhere. Every timestamp in a
614
- spec document - a sign-off, an answer, a stale stamp - is UTC, fetched
615
- at the actual moment it is written, never guessed.
616
-
617
- ## 12. Hygiene
618
-
619
- - UTF-8. LF or CRLF.
620
- - No trailing whitespace.
621
- - One blank line between sections.
622
- - Pure markdown - no raw HTML.
623
- - Tag every fenced code block with its language.
624
- - Give every table its separator row: `|---|---|`.
625
- - A template's instructional prose, writer checklists, and
626
- `<angle bracket>` fill slots never appear in output - generated
627
- documents contain content only.
628
- - The document is the deliverable.
629
-
630
- ## 13. Scope: one document, nothing else
631
-
632
- A phase that drafts a document writes exactly one file: the document
633
- your prompt names, at the path it gives. Do not create or edit any
634
- other file, and do not run terminal commands. Read-only tools are fine
635
- at any time.
636
-
637
- Reading the repository is part of every phase that the instructions
638
- send to the code. Follow the conventions the code already sets,
639
- including any instructions file near what you are writing about
640
- (`CLAUDE.md`, `AGENTS.md`, or whatever this repository uses). A
641
- document written against an imagined codebase describes a system nobody
642
- has.
643
-
644
- Five exceptions: clearing an earlier phase's gate before drafting -
645
- recording an answer as its `**A:**` line, or a given approval in its
646
- sign-off fields; stamping a `> STALE:` notice directly under the H1 of
647
- a later-phase document when an earlier document's content changed;
648
- regenerating a stale document in pipeline order when the process
649
- requires it - rewritten whole, per its own template; and appending to
650
- the spec folder's `code-findings.md`, the shared record of code facts a
651
- later phase would otherwise re-mine; and creating or updating a
652
- question-and-answer pair in `decisions.md`. Outside a regeneration,
653
- nothing else in those documents changes.
654
-
655
- ## 14. What the ask asks for, on a revise
656
-
657
- A `## What to change` section in the ask is what the person typed when
658
- they asked for this pass. It is the specific thing they want done, and
659
- it is about this run alone - everything else about the document still
660
- holds around it, and nothing it does not mention is an invitation to
661
- change something else. When there is no such section, the document's
662
- own edits are the whole of the instruction.
663
-
664
- ## 15. Common item words
665
-
666
- Four words name a kind of item across more than one team's style,
667
- worth stating once rather than reinventing per style:
668
-
669
- - **AC** - Acceptance Criterion. Already what §2's `Req-N.M` is; write
670
- `AC` in prose to name the concept, not as a second id for the same
671
- criterion. §2 decides the id; this is just its name.
672
- - **OQ** - Open Question. Already what §10's `QN-n` is, the same concept
673
- under a longer name. The panel's own parser looks for `**QN-n**`
674
- specifically (§10), so an item written `**OQ-4**` still counts as a
675
- question and still blocks - it just carries no clean id until the
676
- parser reads that spelling too. Use `QN-n` where you want the id to
677
- resolve.
678
- - **DEC** - a decision requiring sign-off. Something `design.md`
679
- proposes that a person must approve before it stands - not every
680
- choice, only the ones nobody downstream should discover after the
681
- fact.
682
- - **DEV** - a proposed deviation from a standard. A `design.md` item
683
- that departs from a convention this team otherwise holds to, named so
684
- the departure is visible rather than silent.
685
-
686
- Neither `DEC` nor `DEV` has a shape of its own yet - no style shipped
687
- here declares one. A style that wants them declares an id for each the
688
- way §2 already allows any document to: `### Dec-1: Cache invalidation
689
- moves to write-through`, cited like anything else once it has one.
690
-
691
- ---
692
-
693
- ## Before you finish
694
-
695
- 1. One H1 on the first line; every section `##`.
696
- 2. `### Requirement N: Title` for each requirement, numbered from 1.
697
- 3. A literal `#### Acceptance Criteria` line above every criteria list.
698
- 4. Criteria in EARS, keywords UPPERCASE, `SHALL` for every obligation.
699
- 5. Citations written as links to a `.md` file, path relative to the file
700
- you are writing, nothing after `.md`:
701
- `[Requirements : 1.2, 3.1](requirements.md)` - except a task's own
702
- `_Requirements: 1.2, 3.1_` line and a property's
703
- `**Validates: Requirements 1.2, 3.1**` line.
704
- 6. Checkbox lines spaced exactly as above; details carry no checkbox;
705
- nesting as deep as needed and no deeper; every unit of work carries
706
- a `Files:` line.
707
- 7. A `## Task Dependency Graph` heading, wave ids matching the checkbox
708
- list, no two tasks in a wave sharing a path on their `Files:`
709
- lines, and every `after` naming only waves with a smaller id.
710
- 8. Every question carries a `**QN-n**` id, and every question with an
711
- `A:` line sits under `## Answered Questions`, not under
712
- `## Open Questions`.
713
- 9. Answers and sign-offs carry a name and a UTC datetime, recorded
714
- only from explicit confirmation.
715
- 10. Walk the finished document and resolve every code anchor one by
716
- one - open the file or folder at that exact path, and find the
717
- symbol inside it. An anchor nobody opened is a guess, however
718
- plausible it reads.
719
- 11. A plan ends with Verification, Documentation and Pull requests as
720
- its final three groups, in that order, one task per repo touched
721
- in each.
722
- 12. Every criterion id in the requirements document appears in at
723
- least one task's citation line. An id that appears nowhere is
724
- dropped work, not a matter of style.
725
- 13. Every number this document states about the codebase was derived
726
- by listing, and every number derived from another was recomputed
727
- from the corrected one. Every solution, project or test suite it
728
- names was read from the repository, not recalled.
729
- 14. Every `mermaid` fence parses. No `;` and no `#` anywhere in a
730
- `sequenceDiagram`; quotes only where §8 calls them syntax; no
731
- lowercase reserved word as a node id.
1
+ # How to write a spec document
2
+
3
+ Write every spec document to the shapes below. Eesha Code reads
4
+ these shapes to give the reviewer an outline, linked requirement
5
+ citations, highlighted acceptance criteria, and a task list it can run.
6
+
7
+ Your phase prompt says *what* to write - which sections, and what goes
8
+ in them. This file says *how* to write it. Where the two disagree about
9
+ the shape of a line, follow this file.
10
+
11
+ ---
12
+
13
+ ## 1. Headings
14
+
15
+ - One `#` H1, the first line of the file (after frontmatter, where a
16
+ document has any).
17
+ - `##` H2 for every section.
18
+ - `###` H3 for numbered items inside a section - a requirement, a
19
+ component, a property.
20
+ - `####` H4 for `#### Acceptance Criteria`.
21
+
22
+ Put a space after the hashes on every heading. Headings inside a fenced
23
+ code block are ignored, so an example in a fence is safe.
24
+
25
+ ## 2. Requirements and acceptance criteria
26
+
27
+ ```markdown
28
+ ### Requirement 3: Retry on timeout
29
+
30
+ **User Story:** As a (role), I want (capability), so that (benefit).
31
+
32
+ #### Acceptance Criteria
33
+
34
+ 1. WHEN (trigger) THEN THE (component) SHALL (behaviour).
35
+ 2. IF (condition) THEN THE (component) SHALL (behaviour).
36
+ ```
37
+
38
+ - The heading carries a word followed by a number, then a colon and a
39
+ short title. Number from 1. The word is `Requirement`, unless your
40
+ prompt told you a `prefix:` for this phase - a stage whose `style.yml`
41
+ names one is told so directly ("this phase's own numbered items are
42
+ cited `Req-<n>`"), and that word replaces `Requirement` everywhere
43
+ below: `### Req-3: Retry on timeout`.
44
+ - Put a literal `#### Acceptance Criteria` line above every criteria
45
+ list. Nothing else on that line.
46
+ - Criteria are a numbered list directly beneath it: `1. `, `2. `.
47
+ - **A criterion's id is the requirement's id, a dot, then its own
48
+ number** - `3.2` is requirement 3, criterion 2; with a declared prefix,
49
+ `Req-3.2` is `Req-3`, criterion 2. Only the requirement half ever
50
+ carries the word - a criterion is always a plain number. This is the
51
+ id every other document cites.
52
+ - Keep the numbers you wrote. The number as written is the id.
53
+
54
+ **A document may declare ids of its own.** A gap analysis numbering
55
+ `GAP-1..GAP-11`, an ADR numbering `ADR-3` - put the id first in its own
56
+ heading, `### GAP-11: A renumbered requirement is silent`, and it
57
+ becomes citable like anything else. A stage with no `prefix:` follows
58
+ this rule for its requirements too - it is the same mechanism,
59
+ `Requirement` is only its default word.
60
+
61
+ Eight rules go with that, and they are the whole of it:
62
+
63
+ - **At least two letters before the number.** `FT-1`, `GAP-11`,
64
+ `ADR-3` - never `F-1`, `G11`, `D3`. One letter does not tell a reader
65
+ what the id points at.
66
+ - **An id of your own has no criteria under it.** `### FT-1: Login`
67
+ declares `FT-1` and nothing more. A numbered list beneath it does not
68
+ become `FT-1.1`, `FT-1.2` - those ids do not exist, and every citation
69
+ of them reads as stale. Only a requirement heading (`Requirement 3`,
70
+ or this phase's `prefix:` word) numbers its criteria. If an item needs
71
+ parts that can be cited, give each part its own id at the start of its
72
+ line: `- **FT-1.2**: WHEN ... THEN ...`.
73
+ - **One item per heading.** Two gaps are two headings, however closely
74
+ they are related.
75
+ - **One id per heading, and it comes first.** `### GAP-7 + GAP-8 (QN-7, QN-8)`
76
+ declares `GAP-7` and nothing else, so every citation of `GAP-8` reads
77
+ as stale - the document is accused of drift it does not have.
78
+ - **Nothing before the id.** `### Gap GAP-7` and `### Feature flag (GAP-7)`
79
+ declare nothing at all.
80
+ - **Unique per document.** One run of numbers per document - a second
81
+ `GAP-7` is not a new item, it is the same id written twice.
82
+ - **Permanent.** A number is assigned once, in the order raised, and is
83
+ never renumbered, reused, re-prefixed, or slotted in later. An item
84
+ that is answered, retracted, or superseded keeps its number and its
85
+ place - §9 says the same thing about a whole document; this is that
86
+ rule holding for one item.
87
+ - **One token, everywhere.** Never write an id two ways. `GAP-7` and
88
+ `Gap 7` are not the same citation, even inside the same document -
89
+ pick the spelling and keep it.
90
+
91
+ Give an item that genuinely spans two concerns one id and say so in its
92
+ body. An id is a name for one thing; a heading that needs two names is
93
+ two items.
94
+
95
+ ## 3. Citations between documents
96
+
97
+ A citation is an ordinary markdown link:
98
+
99
+ ```markdown
100
+ - [Requirements : 1.2, 3.1](requirements.md)
101
+ - [Requirements : Req-1.2, Req-3.1](requirements.md)
102
+ [checkout-prd : 3.2](../../docs/product/checkout-prd.md)
103
+ ```
104
+
105
+ Write it exactly like this:
106
+
107
+ 1. **A plain link.** No other syntax, and nothing to learn - a reader on
108
+ GitHub gets a link that works.
109
+ 2. **The path is relative to the file you are writing.** A document in
110
+ the same spec folder is just `requirements.md`; a file elsewhere in
111
+ the repository is `../../docs/product/checkout-prd.md`. Count the
112
+ `../` from the folder your own document sits in.
113
+ 3. **The target is a `.md` file.** Nothing else is a citation. A ticket,
114
+ a wiki page or a PDF is worth linking to as ordinary prose, but it is
115
+ not this.
116
+ 4. **Nothing after `.md`** - no `#heading`, no line number. The ids in
117
+ the brackets say where to land.
118
+ 5. **Inside the brackets: a name, a space, a colon, then the ids**,
119
+ separated by commas.
120
+ 6. **The ids are the target document's own.** A requirements document
121
+ with no declared prefix numbers `1` and `1.2`, so cite those; one
122
+ with `prefix: Req` numbers `Req-1` and `Req-1.2` - cite the id whole,
123
+ word and number together. A document that numbers itself some other
124
+ way is cited that way too - `GAP-11` for the eleventh gap in a gap
125
+ analysis, `FR-1` for a functional requirement. Copy the id as that
126
+ document writes it; never translate it into a number, and never drop
127
+ its word.
128
+ 7. **The name** is the phase's label where you are citing a phase of
129
+ this spec, and the file name without `.md` where you are citing
130
+ anything else.
131
+ 8. **Two lines are spelled differently, and only these two:** the
132
+ `**Validates: …**` line of a correctness property in `design.md`
133
+ (section 5) and the `_Requirements: …_` line of a task in `tasks.md`
134
+ (section 6). Everywhere else, the link form above.
135
+
136
+ Cite only ids that exist in the target document.
137
+
138
+ **Point at the id, not at the position.** Prose refers to an item by its
139
+ id, never by "the entry above" or "see below" - a reorder or an insert
140
+ breaks a positional reference silently, and an id survives one by
141
+ construction.
142
+
143
+ **Cite backwards, never forwards.** Inside the spec you may cite any
144
+ document written before yours, and your own. A document a later phase
145
+ has not written yet cannot be cited - there is nothing there to point
146
+ at. A file outside the spec has no order, so it may be cited from
147
+ anywhere.
148
+
149
+ ### Where a citation goes
150
+
151
+ - `tasks.md`: the **last detail line** of every task that implements
152
+ behaviour, in italics: `_Requirements: 1.2, 3.1_`.
153
+ - `design.md`: the last line of every correctness property, in bold:
154
+ `**Validates: Requirements 1.2, 2.4**`.
155
+
156
+ ```markdown
157
+ - _Requirements: 1.2, 3.1_
158
+
159
+ **Validates: Requirements 1.2, 2.4**
160
+ ```
161
+
162
+ ### Citing something outside the spec
163
+
164
+ A requirement that exists because of a PRD, or a design that follows an
165
+ ADR, cites it the same way - the only difference is the path:
166
+
167
+ ```markdown
168
+ Traces to [checkout-prd : 3.2](../../docs/product/checkout-prd.md).
169
+ ```
170
+
171
+ The numbers still mean requirement and criterion, so they only resolve
172
+ if that document numbers the way section 2 describes. When it does not,
173
+ write the citation anyway and say in prose what it refers to. A document
174
+ nobody can number is still worth pointing at.
175
+
176
+ ### Pointing at code
177
+
178
+ A pointer at repository code is not a citation - a citation lands on an
179
+ id in a `.md` file, an anchor lands on a place in a codebase. Write an
180
+ anchor as the repo folder name, then the path from that repo's root,
181
+ then the symbol, key, or string inside the file:
182
+
183
+ ```markdown
184
+ - `<repo-folder>/<path from that repo's root>`, `<symbol or string>`
185
+ ```
186
+
187
+ A long path stays on one line. It is an address, not prose - never
188
+ shortened, never elided to `.../`, never wrapped.
189
+
190
+ - **Whole path, from the repo root.** Never a fragment, never relative
191
+ to a subfolder you happened to be standing in. `src/Auth/...` and
192
+ `services/api/src/Auth/...` are not the same claim, and the shorter
193
+ one resolves to nothing.
194
+ - **Never a line number.** Position rots between writing and execution;
195
+ a name survives an edit.
196
+ - **Confirm both halves before writing the line.** The file exists at
197
+ that path, *and* it contains the symbol named. A file that exists but
198
+ does not carry the symbol is not the anchor - it is the wrong file,
199
+ and a path-only check passes it every time.
200
+ - **A folder is an anchor too.** A test project, a source folder, a
201
+ spec area - it carries no symbol, so the path is the whole of the
202
+ claim and the path alone is what gets resolved. `test` and `tests`
203
+ differ by one character and one of them is a directory that does not
204
+ exist.
205
+ - **A build target named in prose is an anchor.** A solution, project,
206
+ test project or suite named anywhere - a verification step included -
207
+ is read from the repository's own project files, never recalled. A
208
+ command that names a project nobody opened fails on the first run,
209
+ which is the worst place to find out.
210
+ - **A count is an anchor.** Seventeen folders, eleven methods, thirty
211
+ locales - derive it by listing them as the line is written. Where a
212
+ count is corrected anywhere in this spec, every number derived from
213
+ it is recomputed, not carried: a total that moves by one moves every
214
+ arithmetic built on it.
215
+ - **Re-confirm an anchor taken from an earlier document.** A path read
216
+ from `code-findings.md` or from a prior phase is a lead, not a
217
+ warrant. One wrong path recorded early otherwise reaches every later
218
+ phase unchallenged.
219
+ - **One anchor names one place.** A line that needs two files is two
220
+ lines.
221
+
222
+ ## 4. Acceptance criteria are written in EARS
223
+
224
+ Five forms, and no others:
225
+
226
+ | Form | Use it for |
227
+ |---|---|
228
+ | `WHEN (trigger) THEN THE (component) SHALL (behaviour).` | An event. |
229
+ | `IF (condition) THEN THE (component) SHALL (behaviour).` | A state that may or may not hold. |
230
+ | `WHERE (context) THE (component) SHALL (behaviour).` | A feature or configuration only sometimes present. |
231
+ | `WHILE (state) THE (component) SHALL (behaviour).` | The whole duration of a state. |
232
+ | `THE (component) SHALL (behaviour).` | An invariant, with no trigger. |
233
+
234
+ - Keywords are UPPERCASE: `WHEN`, `IF`, `WHILE`, `WHERE`, `THEN THE`,
235
+ `THE`, `SHALL`, `SHALL NOT`.
236
+ - `SHALL` for an obligation, `SHALL NOT` for a prohibition. Not
237
+ "should", "must" or "will".
238
+ - One criterion, one behaviour. Two `SHALL`s joined by "and" are two
239
+ criteria.
240
+ - Name the actor at the level the phase works at: a requirements
241
+ document writes `THE SYSTEM` - which component is responsible is
242
+ design's decision; a design-level criterion names the component.
243
+
244
+ ## 5. Correctness properties
245
+
246
+ ```markdown
247
+ ### Property 1: (short descriptive name)
248
+
249
+ *For any* (universally quantified input), THE (component) SHALL
250
+ (guaranteed outcome), regardless of (what does not matter).
251
+
252
+ **Validates: Requirements 1.2, 3.1**
253
+ ```
254
+
255
+ - Number properties from 1.
256
+ - The `**Validates: Requirements 1.2, 3.1**` line is the last line of
257
+ the property. One bold run: the word `Validates`, a colon, the word
258
+ `Requirements`, then the ids separated by commas. No link - this is
259
+ one of the two exceptions section 3 names.
260
+ - Every acceptance criterion should be named by at least one property.
261
+
262
+ ## 6. The plan
263
+
264
+ Pick the dialect your style uses and keep to it. The spacing is exact.
265
+
266
+ ### Hierarchical
267
+
268
+ ```markdown
269
+ - [ ] 1. Group title
270
+ - [ ] 1.1 An actionable, single-concern task
271
+ - an implementation detail
272
+ - Files: `src/thing/index.ts`, `src/thing/__tests__/index.test.ts`
273
+ - _Requirements: 1.2, 3.1_
274
+ ```
275
+
276
+ - Top level: `- [ ] N. Title` - dash, space, `[`, space, `]`, space,
277
+ number, period, space, title.
278
+ - Sub-task: two spaces per level, then `- [ ] N.M Title`. No period
279
+ after `N.M`. Nest as deep as the work needs - `1.1.1` under `1.1`,
280
+ four spaces in - but no deeper than it needs: a level exists to hold
281
+ several tasks, never one.
282
+ - A task with tasks under it is a **group**: a heading for them, not
283
+ work of its own. A task with none is a **unit of work** - what an
284
+ agent is handed. Depth decides nothing; what sits under a row does.
285
+ - Optional task: `- [ ]* N.M Title` - asterisk straight after the
286
+ closing bracket, no space.
287
+ - Done is `- [x]`.
288
+ - Detail lines are four spaces, then `- `, then the text. Details never
289
+ carry a checkbox.
290
+ - **Every unit of work names the files it touches** on one detail line:
291
+ `- Files: ` then the paths in backticks, comma-separated, relative to
292
+ the repository root. Second to last, just above the citation. Files it
293
+ creates and files it edits alike; a task that touches none says
294
+ `- Files: none`. The wave graph is built from this line, and the
295
+ engine reads it before it lets two tasks run at once - a plan without
296
+ it gets no safety check at all.
297
+ - **A task a person or a workflow does, not an agent, says so** on one
298
+ more detail line, `- Run: `, straight after `Files:`. Three shapes and
299
+ no other:
300
+ `- Run: by hand` - a person does it and ticks the box.
301
+ ``- Run: `git switch -c feature/4711` `` - one command in backticks; the
302
+ panel runs it in the machine's default shell.
303
+ `- Run: story-start story=4711` - a workflow under
304
+ `.eesha/workflows/` by its file name without the file extension,
305
+ then `key=value` pairs for its params, quoted when a value has spaces.
306
+ Write `Run:` only for steps no agent should do - an environment to
307
+ update, a branch to create, a review to get. Never on a task that
308
+ changes code. A task with a `Run:` line is never handed to an agent,
309
+ and its box is ticked by the person who did it.
310
+ - Give every task a unique id, and give every dotted id its parent -
311
+ `1.2.3` needs a `1.2`, which needs a `1`.
312
+
313
+ ### Flat
314
+
315
+ ```markdown
316
+ ## Phase 1: Setup
317
+
318
+ - [ ] T001 Add the module skeleton in `src/thing/index.ts`
319
+ - [ ] T002 [P] Add the config type in `src/thing/config.ts`
320
+ ```
321
+
322
+ - `- [ ] T### Title`. Number from `T001` upward across the whole file;
323
+ never restart per phase.
324
+ - `[P]` straight after the id marks a task that may run beside the other
325
+ `[P]` tasks in its `##` phase. Mark it only where the task touches
326
+ files no other `[P]` task in that phase touches.
327
+ - Group the work under `##` phase headings.
328
+ - Name the files a task touches, in backticks.
329
+
330
+ ### The wave graph - hierarchical plans
331
+
332
+ End the file with a `## Task Dependency Graph` heading and one fenced
333
+ `json` block under it. Write the heading exactly - it is how the graph
334
+ is found:
335
+
336
+ ```markdown
337
+ ## Task Dependency Graph
338
+ ```
339
+
340
+ ```json
341
+ {
342
+ "waves": [
343
+ { "id": 0, "tasks": ["1.1", "1.3"] },
344
+ { "id": 1, "tasks": ["1.2", "3.1"] }
345
+ ]
346
+ }
347
+ ```
348
+
349
+ - `waves` is ordered, and each `id` is a number counting from 0.
350
+ Tasks inside one wave run at the same time. By default waves run one
351
+ after another: a wave starts only when every task of the wave before
352
+ it is ticked.
353
+ - A wave may say which waves it waits for with `after`, a list of wave
354
+ ids: `{ "id": 3, "tasks": ["4.1"], "after": [1] }` waits only for
355
+ wave 1, not for wave 2. `"after": []` waits for nothing - a starting
356
+ point. Two waves that do not wait for each other are branches: two
357
+ people can work them at the same time, on the same git branch, from
358
+ two laptops. Leave `after` out and the wave waits for the wave before
359
+ it.
360
+ - `after` names only waves with a smaller id.
361
+ - Use `after` only when the work really does not need the waves you
362
+ leave out - no code, type, table or contract from them. When in
363
+ doubt, leave `after` out. Two branches whose tasks name the same path
364
+ on their `Files:` lines will both edit that file; the panel warns, and
365
+ the two people merge it by hand.
366
+ - Close the fence on a line of its own, with nothing after the
367
+ backticks.
368
+ - Put every unit of work in exactly one wave. Groups go in none.
369
+ - Ids match the checkbox list exactly.
370
+ - A task goes in a later wave than another task only when it needs that
371
+ task's work first - code it calls, a type it uses, a table it reads, a
372
+ contract it consumes. Otherwise put it in the earliest wave it can go
373
+ in. Work in different repositories that does not need each other
374
+ shares a wave, so it runs at the same time instead of waiting.
375
+ - Two tasks share a wave only when their `Files:` lines have no path in
376
+ common. When you cannot tell what a task touches, say so on its
377
+ `Files:` line as best you can and give it its own wave.
378
+ - A task that commits, pushes or tags in git gets a wave of its own,
379
+ with no other task in it. It saves the work of the waves before it,
380
+ and a person often wants to run up to the commit and stop there -
381
+ any other task beside it would be started with it.
382
+
383
+ ## 7. Frontmatter
384
+
385
+ Write none. Where a document already has frontmatter, leave it as it is.
386
+
387
+ ## 8. Diagrams
388
+
389
+ Fence a diagram as `mermaid`. Use `flowchart`, `sequenceDiagram`,
390
+ `stateDiagram-v2` or `erDiagram`. One diagram per section, around ten
391
+ nodes. `<br/>` for a line break inside a label.
392
+
393
+ A diagram that does not parse is worse than no diagram - the reader
394
+ gets an error box where the explanation should be. Every rule below is
395
+ a construct that breaks, or silently corrupts, a real renderer.
396
+
397
+ **Quote by diagram, never by habit.** Quoting is syntax in some places
398
+ and literal text in others, so one blanket rule cannot be right.
399
+
400
+ Quote here - the quotes are syntax and never reach the reader:
401
+
402
+ - flowchart node labels: `A["Caller runs greet.ps1"]`. Always, even
403
+ when the text looks harmless - an unquoted `(` on its own is a parse
404
+ error.
405
+ - flowchart edge labels: `B -->|"no"| C`.
406
+ - `stateDiagram-v2` state names: `state "In Progress" as ip`.
407
+ - `erDiagram` relationship labels and attribute comments:
408
+ `ATTEMPT ||--o{ RESULT : "produces"`. Unquoted, such a label breaks on
409
+ the first word the parser reserves - `to`, `one` and `many` are the
410
+ ones that catch real sentences - so quote it every time.
411
+
412
+ Never quote here - the quotes are literal, and render as visible `"`
413
+ marks around the text:
414
+
415
+ - `sequenceDiagram` message text: `L->>P: Action outcome`, never
416
+ `L->>P: "Action outcome"`.
417
+ - `sequenceDiagram` participant aliases: `participant L as lobby-service`.
418
+ - `sequenceDiagram` block labels: `alt capture fails`, and the same for
419
+ `else`, `loop` and `opt`.
420
+ - `stateDiagram-v2` transition labels: `A --> B : starts now`.
421
+
422
+ **Two characters break `sequenceDiagram` text, and quoting stops
423
+ neither.** Both apply to message text, to `alt`/`else`/`loop`/`opt`
424
+ labels, and to `Note` lines:
425
+
426
+ - `;` ends the statement. What follows is parsed as a new one, and the
427
+ diagram dies with `Expecting 'SOLID_ARROW' ... got 'NEWLINE'`. This
428
+ is the house prose style walking into a diagram: the semicolon that
429
+ joins two clauses everywhere else is a terminator here. Write a
430
+ comma, an em dash, or a second message.
431
+ - `#` swallows the rest of the line. No error and no warning - the text
432
+ after it simply never renders. Write the word instead of the symbol.
433
+
434
+ **Ids are not labels.**
435
+
436
+ - Node and state ids are short, alphanumeric and capitalised; the words
437
+ go in the label.
438
+ - No hyphen in a `stateDiagram-v2` state id - `in_progress` parses,
439
+ `in-progress` does not.
440
+ - Never a lowercase reserved word as a flowchart node id: `end`,
441
+ `graph`, `class`, `style` and `subgraph` all fail. Capitalising is
442
+ enough to make one safe - `End` parses.
443
+
444
+ **Inside a quoted label, use single quotes:**
445
+ `D["Write-Host 'Hello'"]`. A nested `"` is swallowed along with the
446
+ text it was meant to mark.
447
+
448
+ ## 9. Revising a document
449
+
450
+ Requirement numbers, criterion numbers, property numbers, question ids
451
+ and task ids are what other documents cite.
452
+
453
+ - Keep the numbering. Add new requirements and new tasks at the end.
454
+ - Give a question an id once. Never reuse it, never renumber it, and
455
+ keep it when the question moves from `## Open Questions` to
456
+ `## Answered Questions`.
457
+ - Say in its body when a requirement is dead, and leave the gap.
458
+ - Improve titles freely - they are for readers.
459
+ - Keep the text and the id of a task that is still valid, so its tick
460
+ survives.
461
+ - Give work that was done and is no longer wanted a compensating task.
462
+ - Rebuild the wave graph whenever the task list changes.
463
+
464
+ **Leave untouched lines untouched.** A reviewer's margin notes are
465
+ re-found by the text of the line they were written against, so rewording
466
+ a line nobody asked you to change loses the note attached to it. Change
467
+ the lines the pass is about and let the rest stand, word for word.
468
+
469
+ ## 10. Questions and assumptions
470
+
471
+ Three sections, and where each one goes:
472
+
473
+ - `## Open Questions` - at the end, directly above
474
+ `## Answered Questions`. Questions with no answer yet.
475
+ - `## Answered Questions` - next, beside `## Assumptions`. The same
476
+ questions once someone has answered them.
477
+ - `## Assumptions` - last. What you decided for yourself and proceeded
478
+ on.
479
+
480
+ An assumption is you guessing and saying so. An answered question is a
481
+ person deciding. They are not the same thing and they do not share a
482
+ section.
483
+
484
+ ### Writing a question
485
+
486
+ One list item, a bold id, one clear question - never a table:
487
+
488
+ ```markdown
489
+ ## Open Questions
490
+
491
+ - **QN-1** Do we keep the device-code flow or the browser flow?
492
+ - **QN-2** Is the retry budget per request or per session?
493
+ ```
494
+
495
+ Ids are `QN-1`, `QN-2` and so on, one run of numbers per document.
496
+ Never the one-letter `Q1` - §2 asks for two letters in every id. §9 says
497
+ they are allocated once and never renumbered. A question belongs to the
498
+ document that raised it: it is answered there, and no other document
499
+ renumbers or restates it.
500
+
501
+ Four rules go with that, and they are the whole of it:
502
+
503
+ - **One decision per question.** A question that takes two answers is
504
+ two questions, however closely they are related - "what is the
505
+ performance target, what authorizes the caller, and what do we log?"
506
+ is three questions wearing one id. A compound question gets a partial
507
+ answer, and the unanswered half is then invisible: the question has
508
+ an `A:` line, so it counts as answered and stops blocking. §2 says
509
+ the same thing about an item and its heading; this is that rule
510
+ holding for a question.
511
+ - **Self-contained.** The question carries what its owner needs to
512
+ decide it - what is true today, and what the decision changes. One
513
+ that only makes sense beside the paragraph it was raised from cannot
514
+ be answered anywhere else, and it is asked somewhere else by
515
+ construction.
516
+ - **Name the real choice.** Write out the alternatives you can see and
517
+ what each one costs. An open "what should we do here?" hands the
518
+ thinking back to the person who asked you to do it. §10's asking
519
+ rules still hold - the options are a shortcut to an answer, never a
520
+ closed list.
521
+ - **Ask it in the phase that owns the decision.** A question this
522
+ phase cannot act on is not this phase's question. Asked early it
523
+ gets an answer to something adjacent - the person answers what they
524
+ were shown, the phase that actually needs the decision asks again
525
+ properly, and two answers to near-identical questions now sit in
526
+ the record.
527
+
528
+ ### An answer is an `A:` line
529
+
530
+ An answer goes on the next line, indented under its question. Who
531
+ decided and when (UTC) is a `**By:**` line of its own, directly under
532
+ the answer:
533
+
534
+ ```markdown
535
+ - **QN-2** Is the retry budget per request or per session?
536
+ **A:** Per session.
537
+ **By:** R. Vos - 2026-03-04 09:12 UTC
538
+ ```
539
+
540
+ A question with an `A:` line is answered. A question without one is not.
541
+ That is the whole test, and other things read it. `**A:**` is reserved
542
+ for answers: never start any other line with `**A:**`, anywhere in a
543
+ spec document.
544
+
545
+ ### The decision cache
546
+
547
+ `decisions.md` in the spec folder preserves a person's answers when a
548
+ phase document is regenerated. It contains only question-and-answer
549
+ pairs, one current pair for each decision:
550
+
551
+ ```markdown
552
+ - **Q:** Is the retry budget per request or per session?
553
+ **A:** Per session.
554
+ ```
555
+
556
+ Before asking a person, check it for the same question and reuse its
557
+ answer. When a person changes an answer, update that pair instead of
558
+ adding another. A person may edit or delete any pair directly; the file
559
+ is its current source of truth. Do not add ids, names, timestamps,
560
+ sign-offs, or commentary.
561
+
562
+ ### Moving an answered question
563
+
564
+ When you next work on a document, move every question that has an `A:`
565
+ line out of `## Open Questions` and into `## Answered Questions`, id and
566
+ answer intact. Delete `## Open Questions` when nothing is left in it.
567
+
568
+ Never delete a question. Never delete an answer. They are the record of
569
+ what was decided and why the document says what it says.
570
+
571
+ ### When to ask at all
572
+
573
+ Every question shown to a person has this by default:
574
+
575
+ - A **Keep open** choice, marked as the default. Choosing it records no
576
+ answer: put or leave the question under `## Open Questions` and stop
577
+ that phase at its gate.
578
+
579
+ Never make a choice compulsory when asking a person. A proposed option
580
+ may make answering quicker, but it is never the only valid answer.
581
+
582
+ In order:
583
+
584
+ 1. **Can the code answer it?** Read the code. Do not ask.
585
+ 2. **Is it about intent** - what this person wants, which of two ways
586
+ they would rather have - ? **Ask now**, with your ask tool. Offer
587
+ **Keep open** as the default and free-text input alongside any
588
+ proposed options so that user can type the answer when he/she cannot select the options you provide.
589
+ 3. **If they keep it open or do not answer**, write it under
590
+ `## Open Questions`.
591
+
592
+ The split is what kind of question it is. Code tells you what exists. It
593
+ never tells you what someone wants.
594
+
595
+ A question you never asked is worse than a question you asked. And an
596
+ open question stops the next phase, so leave one behind only when you
597
+ truly could not get it answered.
598
+
599
+ ## 11. Sign-offs
600
+
601
+ A sign-off is recorded only from explicit confirmation in
602
+ conversation - never on someone's behalf, never assumed, never
603
+ pre-filled. The line carries the name and the UTC datetime of that
604
+ confirmation:
605
+
606
+ ```markdown
607
+ - **Approved by (PO):** R. Vos - 2026-03-04 09:12 UTC
608
+ ```
609
+
610
+ Which roles sign which document is each phase's own rule; the shape
611
+ and the integrity rule are the same everywhere. Every timestamp in a
612
+ spec document - a sign-off, an answer, a stale stamp - is UTC, fetched
613
+ at the actual moment it is written, never guessed.
614
+
615
+ ## 12. Hygiene
616
+
617
+ - UTF-8. LF or CRLF.
618
+ - No trailing whitespace.
619
+ - One blank line between sections.
620
+ - Pure markdown - no raw HTML.
621
+ - Tag every fenced code block with its language.
622
+ - Give every table its separator row: `|---|---|`.
623
+ - A template's instructional prose, writer checklists, and
624
+ `<angle bracket>` fill slots never appear in output - generated
625
+ documents contain content only.
626
+ - The document is the deliverable.
627
+
628
+ ## 13. Scope: one document, nothing else
629
+
630
+ A phase that drafts a document writes exactly one file: the document
631
+ your prompt names, at the path it gives. Do not create or edit any
632
+ other file, and do not run terminal commands. Read-only tools are fine
633
+ at any time.
634
+
635
+ Reading the repository is part of every phase that the instructions
636
+ send to the code. Follow the conventions the code already sets,
637
+ including any instructions file near what you are writing about
638
+ (`CLAUDE.md`, `AGENTS.md`, or whatever this repository uses). A
639
+ document written against an imagined codebase describes a system nobody
640
+ has.
641
+
642
+ Five exceptions: clearing an earlier phase's gate before drafting -
643
+ recording an answer as its `**A:**` line, or a given approval in its
644
+ sign-off fields; stamping a `> STALE:` notice directly under the H1 of
645
+ a later-phase document when an earlier document's content changed;
646
+ regenerating a stale document in pipeline order when the process
647
+ requires it - rewritten whole, per its own template; and appending to
648
+ the spec folder's `code-findings.md`, the shared record of code facts a
649
+ later phase would otherwise re-mine; and creating or updating a
650
+ question-and-answer pair in `decisions.md`. Outside a regeneration,
651
+ nothing else in those documents changes.
652
+
653
+ ## 14. What the ask asks for, on a revise
654
+
655
+ A `## What to change` section in the ask is what the person typed when
656
+ they asked for this pass. It is the specific thing they want done, and
657
+ it is about this run alone - everything else about the document still
658
+ holds around it, and nothing it does not mention is an invitation to
659
+ change something else. When there is no such section, the document's
660
+ own edits are the whole of the instruction.
661
+
662
+ ## 15. Common item words
663
+
664
+ Four words name a kind of item across more than one team's style,
665
+ worth stating once rather than reinventing per style:
666
+
667
+ - **AC** - Acceptance Criterion. Already what §2's `Req-N.M` is; write
668
+ `AC` in prose to name the concept, not as a second id for the same
669
+ criterion. §2 decides the id; this is just its name.
670
+ - **OQ** - Open Question. Already what §10's `QN-n` is, the same concept
671
+ under a longer name. The panel's own parser looks for `**QN-n**`
672
+ specifically (§10), so an item written `**OQ-4**` still counts as a
673
+ question and still blocks - it just carries no clean id. Use `QN-n` where you want the id to
674
+ resolve.
675
+ - **DEC** - a decision requiring sign-off. Something `design.md`
676
+ proposes that a person must approve before it stands - not every
677
+ choice, only the ones nobody downstream should discover after the
678
+ fact.
679
+ - **DEV** - a proposed deviation from a standard. A `design.md` item
680
+ that departs from a convention this team otherwise holds to, named so
681
+ the departure is visible rather than silent.
682
+
683
+ Neither `DEC` nor `DEV` has a shape of its own - no built-in style declares one. A style that wants them declares an id for each the
684
+ way §2 already allows any document to: `### Dec-1: Cache invalidation
685
+ moves to write-through`, cited like anything else once it has one.
686
+
687
+ ---
688
+
689
+ ## Before you finish
690
+
691
+ 1. One H1 on the first line; every section `##`.
692
+ 2. `### Requirement N: Title` for each requirement, numbered from 1.
693
+ 3. A literal `#### Acceptance Criteria` line above every criteria list.
694
+ 4. Criteria in EARS, keywords UPPERCASE, `SHALL` for every obligation.
695
+ 5. Citations written as links to a `.md` file, path relative to the file
696
+ you are writing, nothing after `.md`:
697
+ `[Requirements : 1.2, 3.1](requirements.md)` - except a task's own
698
+ `_Requirements: 1.2, 3.1_` line and a property's
699
+ `**Validates: Requirements 1.2, 3.1**` line.
700
+ 6. Checkbox lines spaced exactly as above; details carry no checkbox;
701
+ nesting as deep as needed and no deeper; every unit of work carries
702
+ a `Files:` line.
703
+ 7. A `## Task Dependency Graph` heading, wave ids matching the checkbox
704
+ list, no two tasks in a wave sharing a path on their `Files:`
705
+ lines, and every `after` naming only waves with a smaller id.
706
+ 8. Every question carries a `**QN-n**` id, and every question with an
707
+ `A:` line sits under `## Answered Questions`, not under
708
+ `## Open Questions`.
709
+ 9. Answers and sign-offs carry a name and a UTC datetime, recorded
710
+ only from explicit confirmation.
711
+ 10. Walk the finished document and resolve every code anchor one by
712
+ one - open the file or folder at that exact path, and find the
713
+ symbol inside it. An anchor nobody opened is a guess, however
714
+ plausible it reads.
715
+ 11. A plan ends with Verification, Documentation and Pull requests as
716
+ its final three groups, in that order, one task per repo touched
717
+ in each.
718
+ 12. Every criterion id in the requirements document appears in at
719
+ least one task's citation line. An id that appears nowhere is
720
+ dropped work, not a matter of style.
721
+ 13. Every number this document states about the codebase was derived
722
+ by listing, and every number derived from another was recomputed
723
+ from the corrected one. Every solution, project or test suite it
724
+ names was read from the repository, not recalled.
725
+ 14. Every `mermaid` fence parses. No `;` and no `#` anywhere in a
726
+ `sequenceDiagram`; quotes only where §8 calls them syntax; no
727
+ lowercase reserved word as a node id.