buildkeel 0.7.0 → 0.7.2

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 (158) hide show
  1. package/README.md +33 -4
  2. package/antigravity/agents/bk-break-it-pro.md +25 -0
  3. package/antigravity/agents/bk-designer-pro.md +20 -0
  4. package/antigravity/agents/bk-edge-cases-pro.md +31 -0
  5. package/antigravity/agents/bk-final-quality-reviewer-pro.md +47 -0
  6. package/antigravity/agents/bk-final-spec-reviewer-pro.md +37 -0
  7. package/antigravity/agents/bk-implementer-pro.md +40 -0
  8. package/antigravity/agents/bk-note-checker-pro.md +26 -0
  9. package/antigravity/agents/bk-quality-reviewer-pro.md +47 -0
  10. package/antigravity/agents/bk-readiness-reader-pro.md +28 -0
  11. package/antigravity/agents/bk-spec-reviewer-pro.md +37 -0
  12. package/antigravity/dist/hooks/main.js +208 -143
  13. package/antigravity/dist/server/main.js +653 -595
  14. package/antigravity/package.json +1 -1
  15. package/antigravity/plugin.json +1 -1
  16. package/antigravity/rules/buildkeel.md +1 -1
  17. package/antigravity/skills/bk-build/SKILL.md +3 -3
  18. package/antigravity/skills/bk-done/SKILL.md +1 -1
  19. package/antigravity/skills/bk-init/SKILL.md +4 -0
  20. package/antigravity/skills/bk-models/SKILL.md +16 -0
  21. package/antigravity/skills/bk-review/SKILL.md +1 -1
  22. package/cli.mjs +151 -142
  23. package/cursor/.cursor-plugin/plugin.json +16 -0
  24. package/cursor/LICENSE +49 -0
  25. package/cursor/THIRD-PARTY-NOTICES +231 -0
  26. package/cursor/agents/bk-break-it.md +17 -0
  27. package/cursor/agents/bk-designer.md +12 -0
  28. package/cursor/agents/bk-edge-cases.md +23 -0
  29. package/cursor/agents/bk-final-quality-reviewer.md +39 -0
  30. package/cursor/agents/bk-final-spec-reviewer.md +29 -0
  31. package/cursor/agents/bk-implementer.md +32 -0
  32. package/cursor/agents/bk-note-checker.md +18 -0
  33. package/cursor/agents/bk-quality-reviewer.md +39 -0
  34. package/cursor/agents/bk-readiness-reader.md +20 -0
  35. package/cursor/agents/bk-spec-reviewer.md +29 -0
  36. package/cursor/agents/index.json +99 -0
  37. package/cursor/bin/bk-launch +34 -0
  38. package/cursor/bin/bk-launch.cmd +36 -0
  39. package/cursor/bin/bk-start.cjs +28 -0
  40. package/cursor/dist/hooks/main.js +232 -0
  41. package/cursor/dist/server/main.js +834 -0
  42. package/cursor/hooks/hooks.json +36 -0
  43. package/cursor/mcp.json +24 -0
  44. package/cursor/package.json +8 -0
  45. package/cursor/practices/P-01.md +7 -0
  46. package/cursor/practices/P-02.md +7 -0
  47. package/cursor/practices/P-03.md +7 -0
  48. package/cursor/practices/P-04.md +7 -0
  49. package/cursor/practices/P-05.md +7 -0
  50. package/cursor/practices/P-06.md +7 -0
  51. package/cursor/practices/P-07.md +7 -0
  52. package/cursor/practices/P-08.md +7 -0
  53. package/cursor/practices/P-09.md +7 -0
  54. package/cursor/practices/P-10.md +7 -0
  55. package/cursor/practices/P-11.md +7 -0
  56. package/cursor/practices/P-12.md +7 -0
  57. package/cursor/practices/P-13.md +7 -0
  58. package/cursor/practices/P-14.md +7 -0
  59. package/cursor/practices/P-15.md +7 -0
  60. package/cursor/project/commands/bk-approve.md +50 -0
  61. package/cursor/project/commands/bk-build.md +248 -0
  62. package/cursor/project/commands/bk-capture.md +207 -0
  63. package/cursor/project/commands/bk-done.md +112 -0
  64. package/cursor/project/commands/bk-impact.md +48 -0
  65. package/cursor/project/commands/bk-init.md +92 -0
  66. package/cursor/project/commands/bk-migrate.md +71 -0
  67. package/cursor/project/commands/bk-models.md +9 -0
  68. package/cursor/project/commands/bk-new.md +121 -0
  69. package/cursor/project/commands/bk-onboard.md +134 -0
  70. package/cursor/project/commands/bk-pause.md +49 -0
  71. package/cursor/project/commands/bk-resume.md +28 -0
  72. package/cursor/project/commands/bk-review.md +49 -0
  73. package/cursor/project/commands/bk-settings.md +11 -0
  74. package/cursor/project/commands/bk-stats.md +33 -0
  75. package/cursor/project/commands/bk-status.md +11 -0
  76. package/cursor/project/rules/buildkeel.mdc +80 -0
  77. package/cursor/skills/buildkeel/SKILL.md +80 -0
  78. package/cursor/templates/adhoc.md +15 -0
  79. package/cursor/templates/adr.md +31 -0
  80. package/cursor/templates/defect.md +35 -0
  81. package/cursor/templates/design.md +49 -0
  82. package/cursor/templates/epic.md +31 -0
  83. package/cursor/templates/idea.md +35 -0
  84. package/cursor/templates/spec-driven/capability.md +28 -0
  85. package/cursor/templates/spec-driven/proposal.md +41 -0
  86. package/cursor/templates/spec-driven/spec-change.md +43 -0
  87. package/cursor/templates/spec-driven/tasks.md +25 -0
  88. package/cursor/templates/story.md +31 -0
  89. package/cursor/templates/task.md +43 -0
  90. package/cursor/templates/test-plan.md +29 -0
  91. package/cursor/templates/thread.md +41 -0
  92. package/package.json +17 -3
  93. package/pi/LICENSE +49 -0
  94. package/pi/THIRD-PARTY-NOTICES +231 -0
  95. package/pi/agents/bk-break-it.md +17 -0
  96. package/pi/agents/bk-designer.md +12 -0
  97. package/pi/agents/bk-edge-cases.md +23 -0
  98. package/pi/agents/bk-final-quality-reviewer.md +39 -0
  99. package/pi/agents/bk-final-spec-reviewer.md +29 -0
  100. package/pi/agents/bk-implementer.md +32 -0
  101. package/pi/agents/bk-note-checker.md +18 -0
  102. package/pi/agents/bk-quality-reviewer.md +39 -0
  103. package/pi/agents/bk-readiness-reader.md +20 -0
  104. package/pi/agents/bk-spec-reviewer.md +29 -0
  105. package/pi/agents/index.json +135 -0
  106. package/pi/bin/bk-launch +34 -0
  107. package/pi/bin/bk-launch.cmd +36 -0
  108. package/pi/bin/bk-start.cjs +28 -0
  109. package/pi/dist/hooks/main.js +232 -0
  110. package/pi/dist/server/main.js +834 -0
  111. package/pi/extension.js +241 -0
  112. package/pi/package.json +8 -0
  113. package/pi/practices/P-01.md +7 -0
  114. package/pi/practices/P-02.md +7 -0
  115. package/pi/practices/P-03.md +7 -0
  116. package/pi/practices/P-04.md +7 -0
  117. package/pi/practices/P-05.md +7 -0
  118. package/pi/practices/P-06.md +7 -0
  119. package/pi/practices/P-07.md +7 -0
  120. package/pi/practices/P-08.md +7 -0
  121. package/pi/practices/P-09.md +7 -0
  122. package/pi/practices/P-10.md +7 -0
  123. package/pi/practices/P-11.md +7 -0
  124. package/pi/practices/P-12.md +7 -0
  125. package/pi/practices/P-13.md +7 -0
  126. package/pi/practices/P-14.md +7 -0
  127. package/pi/practices/P-15.md +7 -0
  128. package/pi/prompts/bk-approve.md +53 -0
  129. package/pi/prompts/bk-build.md +251 -0
  130. package/pi/prompts/bk-capture.md +210 -0
  131. package/pi/prompts/bk-done.md +115 -0
  132. package/pi/prompts/bk-impact.md +51 -0
  133. package/pi/prompts/bk-init.md +95 -0
  134. package/pi/prompts/bk-migrate.md +73 -0
  135. package/pi/prompts/bk-models.md +11 -0
  136. package/pi/prompts/bk-new.md +124 -0
  137. package/pi/prompts/bk-onboard.md +137 -0
  138. package/pi/prompts/bk-pause.md +52 -0
  139. package/pi/prompts/bk-resume.md +31 -0
  140. package/pi/prompts/bk-review.md +52 -0
  141. package/pi/prompts/bk-settings.md +13 -0
  142. package/pi/prompts/bk-stats.md +36 -0
  143. package/pi/prompts/bk-status.md +13 -0
  144. package/pi/skills/buildkeel/SKILL.md +68 -0
  145. package/pi/templates/adhoc.md +15 -0
  146. package/pi/templates/adr.md +31 -0
  147. package/pi/templates/defect.md +35 -0
  148. package/pi/templates/design.md +49 -0
  149. package/pi/templates/epic.md +31 -0
  150. package/pi/templates/idea.md +35 -0
  151. package/pi/templates/spec-driven/capability.md +28 -0
  152. package/pi/templates/spec-driven/proposal.md +41 -0
  153. package/pi/templates/spec-driven/spec-change.md +43 -0
  154. package/pi/templates/spec-driven/tasks.md +25 -0
  155. package/pi/templates/story.md +31 -0
  156. package/pi/templates/task.md +43 -0
  157. package/pi/templates/test-plan.md +29 -0
  158. package/pi/templates/thread.md +41 -0
@@ -0,0 +1,210 @@
1
+ ---
2
+ description: "BuildKeel: Turn what you discussed into a plan: a plain summary, then the artifacts your process needs, agreed one by one or all at once, as you choose."
3
+ argument-hint: "[which part of the conversation to capture; all of it when left out]"
4
+ ---
5
+
6
+ Turn the conversation into a plan the team's process can build from, with the user agreeing at each step: the summary, the list of what will be created, the pace, then each artifact. Nothing is saved that the user has not agreed to, and everything saved stays a draft until it is approved.
7
+
8
+ The user typed: $ARGUMENTS
9
+
10
+ **Before anything else**, call the BuildKeel `query` tool with `view: "process"`, and do not show its result. If it says this repository is not set up for BuildKeel, tell the user so, and that /bk-init sets it up, then stop: ask nothing else. Otherwise go on straight away.
11
+
12
+ If BuildKeel's session report, or `query` with `view: "process"`, says this spec tree is Spec-driven, follow step 1, then "In a Spec-driven tree" at the end in place of steps 2 to 6.
13
+
14
+ ## How each review goes
15
+
16
+ The summary, the plan and each artifact are reviewed the same way: shown in full in your reply, with your question in plain text at its end. The user's reply decides what follows:
17
+
18
+ - **Agreement**, such as "looks good", "yes" or "next": go on, and for an artifact, save it.
19
+ - **"Draft the rest"**: draft what is left in one go, and show it as a set, as "All at once" says.
20
+ - **Anything else is feedback**, "ok, but…" included: discuss it for as long as the user wants. Then list each point they raised with how you addressed it, or why you did not, show the final version, and ask again. Save nothing until they agree. When the only change is small, the final version may be just the changed parts, with a note that nothing else changed. When you cannot tell whether a reply agrees, ask.
21
+
22
+ When later discussion in this capture would change something the user already agreed, such as a story agreed before a decision on the next one, say so openly: which artifact, what changes and why. Show the change and take it through the same review, and save it with `save_draft` only once the user agrees. In a Spec-driven tree, read one file of the change with `query`, `view: "changes"`, its `id` and `file`, and save a change to one requirement with `save_draft`, `type: "spec-change"`, the change's `id`, its `capability` and `requirement`, rather than resending the whole file. Never change an agreed artifact silently, and never add a requirement, criterion or test case that was not discussed.
23
+
24
+ ## 1. Say what you heard
25
+
26
+ Once that check is done, and before any other tool call, sum up the discussion in plain words, with no BuildKeel terms yet (no stages, IDs or templates):
27
+
28
+ - **What you set out to do**: the user's intent, in a sentence.
29
+ - **The idea**: what it is, and who it is for.
30
+ - **The approaches**: the ways weighed, the one chosen and why, or that only one was discussed.
31
+ - **The design choices**: the decisions discussed, and what was left open.
32
+ - **Pitfalls and constraints raised**: each one the conversation surfaced, such as a limit, a failure to handle or a detail easy to get wrong, in the user's terms, marked settled or open. Leave the list out when nothing was raised; never add one the conversation did not raise.
33
+
34
+ Keep what the user said apart from what you proposed, so they can tell them apart: mark each point "you said" or "I proposed". When this session resumed a thread with /bk-resume, draw on the thread's brief and on the conversation since, and say which thread it is.
35
+
36
+ If the user typed something above, sum up that part of the conversation. If there is nothing to capture yet, say so, ask what they want to plan, and stop. If the conversation was compacted, say that its earlier parts may be missing from the summary, and ask the user to add anything left out.
37
+
38
+ Then ask whether to go on, with the summary in that same reply. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. The choices:
39
+
40
+ 1. **Create the artifacts** (the default, listed first).
41
+ 2. **Change something.** Take it as feedback, as "How each review goes" says, and show the summary again.
42
+ 3. **Keep talking.** Stop here: nothing is drafted, and the conversation goes on.
43
+
44
+ Any other answer, such as a correction or a new thought, is more conversation: answer it as you would, and draft nothing.
45
+
46
+ ### A problem someone reported
47
+
48
+ When the discussion is about a problem someone reported with how the system behaves, sort it once the user chooses to create the artifacts, before step 2.
49
+
50
+ **Sorting a report.** When someone reports that the system does something wrong, check it before recording anything: what the spec says about that behavior now (in a Spec-driven tree, `query` with `view: "capabilities"` and the capability's `id`; otherwise the stories and their acceptance criteria, with `query`), and the code linked to it (`query` with `view: "describes"` and the files involved). Then propose one reading, labelled as yours, such as "My reading: a defect", with what it rests on:
51
+
52
+ - **A defect**: the code does not do what the spec says. The code is fixed and the spec keeps its version. It is recorded as a defect with `source: reported`.
53
+ - **A change in behavior**: the code does what the spec says, and the user wants something else. The spec changes and gets a new version: in a Spec-driven tree through a change, otherwise through a new version of the story, or a new item of the team's kind for it, such as an enhancement.
54
+ - **A gap**: the spec says nothing about it. Settle with the user what it should do; that goes into the spec as a change in behavior.
55
+ - **Nothing describes this code yet**: `describes` finds no artifact for it. In Full SDLC, draft version 0 of the story the code belongs to first, stating the intended behavior, and record the defect with that draft as its parent; both are reviewed and approved together, version 0 first. In a Spec-driven tree, ask **Record it standalone** (the default) or **Document this code first**, as version 0 of a capability spec, then link the defect to its requirement.
56
+
57
+ Ask with your tool for asking a question with choices, your reading first, then the other readings, so the user confirms or overrides it. Record nothing until they answer. A defect found while building, such as a failing test of the work under way, needs no sorting: it is a defect of that work.
58
+
59
+ A defect is recorded as /bk-new defect records one: `get_template` for `defect`, then `save_draft` with `type: "defect"`, `source: reported` and the parent agreed. A change in behavior or a gap goes on to step 2 as work to plan, with the reading the user confirmed.
60
+
61
+ ## 2. Propose the plan
62
+
63
+ 1. Call the BuildKeel `query` tool with `view: "process"` for the stages and the documents each requires, and with `view: "tree"` for what exists. Read an existing artifact with `view: "artifact"` when you need to know what it covers.
64
+ 2. Work out the artifacts the work needs, level by level, from the business idea down to the tasks, in the team's stage names: which already exist, which are new, and the documents each stage requires, such as a design document for a new epic and a test plan for each new story. For each task, work out which of its story's test cases its tests will implement. A task whose tests implement none of them, such as a building block (a client, a data model, a migration), needs a test plan of its own, or it can never be finished: put it in the table.
65
+ 3. Recommend where the work fits in the tree, and say why: under an existing business idea or epic, or as something new.
66
+ 4. If the work changes how something already built behaves, and a document describes how it works today (such as EP-01's design document for password reset), the plan includes a new version of that document.
67
+ 5. When a stage holds more than one kind of work (`view: "process"` lists the kinds at each stage), propose a kind for each new artifact at that stage, from where the work came from, and say why in the table: an enhancement when it improves existing behavior, a feature when it adds something new, as the team's kinds are named. The user confirms or changes each kind as part of the plan; never draft one as a kind the user has not agreed to. Each is drafted with its kind as `type`, from that kind's template, and numbered in that kind's sequence.
68
+ 6. If the work changes code that already exists, work out which files it will change, from the discussion and the code, and call `query` with `view: "describes"` and their `paths`. Where an artifact describes them, the work builds on it. Where nothing describes the behavior the work changes, the plan includes a **version 0**: one artifact, usually a story, describing only what the work touches, as it works today, before the change. The change is then its version 1, or an artifact under it. A version 0 is a proposal: the user can drop it.
69
+
70
+ Show the plan as a table, top down, each row with a one-line purpose, and say where the work fits and why, in a sentence:
71
+
72
+ | Level | Kind | Artifact | Status | Purpose |
73
+ |---|---|---|---|---|
74
+ | Business idea | business idea | BI-01 "Self-service account recovery" | exists | the goal this serves |
75
+ | Epic | epic | "Reset by text message" | new | the new capability |
76
+ | Design document | | of the new epic | new, required | how it is built |
77
+ | Story | user story | "Request a code by text" | new | one per user-facing behavior |
78
+ | Test plan | | one per story | new, required | covers every criterion |
79
+ | Task | task | "SMS gateway client" | new | one per piece of code, with its repository |
80
+ | Test plan | | of "SMS gateway client" | new | its tests are none of the story's test cases |
81
+ | Design document | | EP-01-DD | new version | password reset now works differently |
82
+ | Story | user story | "Password reset" | version 0, then the change as version 1 | how reset by email works today, which nothing describes yet |
83
+
84
+ The Kind column names each artifact's kind; when every stage holds one kind, it is the stage's name, and you may leave the column out.
85
+
86
+ Then ask, the same way, with the table and that sentence in your reply. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. The choices:
87
+
88
+ 1. **Looks right** (the default).
89
+ 2. **Place it somewhere else.** Ask where. The new artifact is drafted where the user says, with a link to the one you recommended (`related: [EP-01]`).
90
+ 3. **Change the plan.** Take it as feedback, as "How each review goes" says, and show the table again.
91
+ 4. **Keep talking.** Stop here; nothing is drafted.
92
+
93
+ When the plan holds a version 0, offer **Looks right, without the version 0** in place of the second choice; placing the work somewhere else is then a change to the plan. Without the version 0, the change is drafted as version 1 of a new artifact, as for any new work.
94
+
95
+ ## 3. Ask the pace
96
+
97
+ Ask, every time, how the user wants to go through the drafts. Never assume it, and never carry it over from an earlier capture. The choices:
98
+
99
+ 1. **Step by step** (the default, listed first): each artifact is shown and agreed before the next is drafted.
100
+ 2. **All at once**: everything is drafted, then shown as a set.
101
+
102
+ ## 4. Draft
103
+
104
+ Before drafting, call `query` with `view: "planning"`, once in this capture: it says, by the team's switches, what to do about edge-case suggestions and design options, off, ask or auto. Follow it as "Edge-case suggestions" and "Design options" say.
105
+
106
+ **When agents can't be started,** the same everywhere:
107
+ 1. **Say why, once,** in a line: you have no tool for starting agents here, it is turned off, or the model tier the settings name is not available.
108
+ 2. **Retry once** when an agent started but failed, before treating agents as unavailable.
109
+ 3. **Follow the step's switch:** off, nothing happens; ask, the offer says it would run here, without a fresh reader; auto, or a step with no switch (an implementer or a reviewer), do it here and say so in a line.
110
+ 4. **Label what you did here** as done here, not by an independent agent: in what you show, and in the record (`by: "author"` for a review), and present a question or proposal as your own reading.
111
+ 5. **Never count it where independence is the point:** a final review done here does not satisfy the review-findings check, so say the work was not independently reviewed.
112
+
113
+ ### How to draft
114
+
115
+ - Draft top down, parents before children, so each child names its parent's draft ID. Call `get_template` once for each type you draft, and follow it.
116
+ - Fill each artifact from the conversation, keeping its meaning and the user's words. Turn each settled pitfall or constraint into the requirement, criterion or test case it calls for, in the artifact it belongs to. Put what fits no section in the section for further material, such as Notes.
117
+ - Never invent a requirement, a criterion, a decision or a pitfall that was not discussed. What a draft needs and the conversation did not settle is a gap: see "Gaps" below.
118
+ - Write `{{id}}` where the artifact's own ID goes and `{{new}}` as the number of each new entry, as `/bk-new` does: `- **{{id}}-AC{{new}}** ...` for criteria, `### {{id}}-TC{{new}} ...` for test cases.
119
+ - Every story gets a test plan whose test cases cover all its criteria (`covers: [<story ID>-AC1]`). A task names its `repo` and, when you can tell, its `scope`. A task whose tests will not each be one of its story's test cases, such as a building block, gets its own test plan, with test cases that cover the task itself (`covers: [<task ID>]`): without one it cannot be finished.
120
+ - A design document has no `id`; its `parent` is the artifact it describes. Add an offered section (`get_template` lists them) only when the discussion covered it.
121
+ - When the work changes how an existing capability works: save the new version of that capability's document with `save_draft` and its ID, and give the new artifact `changes: [<that document's ID>]`, so it cannot be finished until that version is approved.
122
+ - A **version 0** in the plan is drafted before the change, by the rules below, with `save_draft` and `version: 0`. Name the paths it covers in its `scope`. Then draft the change: as its version 1, with `save_draft`, the version 0's draft ID as `id` and no `version`, holding the whole artifact as it will be after the change. Start from version 0's text as saved, with its entry IDs: keep the ID of every entry that stays, changed or not (a criterion whose limit changes keeps its ID), and write `{{new}}` only for an entry the change adds. Or, when the change is new work under it, as a new artifact whose `parent` is that draft ID.
123
+ - **Approaches.** Fill the design document's Approaches section from the conversation: the approaches considered, the one chosen and why, and the non-goals and things to avoid. When no other approach was weighed, say so there. Add no approach, reason or goal the conversation did not raise. When the set has no design document, show the approaches as working notes on the top new artifact, in the same review, and once the user agrees, save them after it with `save_draft`, `type: "working-notes"`, its ID, `apply: true` and each one's source (the user's words as `quote`).
124
+ - **Edge-case suggestions.** After drafting each story's test plan, and before showing it, have edge-case suggestions look for the cases nobody has written yet, as the planning view says: when it runs, start the edge-cases agent, in the edge-case suggestions role as `query` with `view: "settings"` names it, with the plan, the criteria it covers and the team's practices (`get_context` with `role: "planning"` and the story's ID), and nothing else. When it cannot be started, follow "When agents can't be started": look for them yourself, and label them as your own reading. Show its proposals in the same review as the plan: at most five, ranked by risk, each with the criterion it belongs to, the case and a one-line reason, and how many more it found at lower risk, to show if the user asks. The user answers once, such as "add 1 and 3", "all" or "none": add those to the plan, and ask nothing more about them. It proposes nothing a practice already covers.
125
+ - Save each one with `save_draft`, with `capture: true`, and only once the user has agreed to it.
126
+
127
+ ### Step by step
128
+
129
+ Go through the plan in this order, leaving out what already exists: a version 0 before the change built on it, then the business idea or epic, then its design document, then each story together with its test plan, then the tasks, with their own test plans, as one batch. Before the tasks, follow "Design options" when they are due. For each one:
130
+
131
+ 1. Draft it against the artifacts already saved in this capture.
132
+ 2. Show it, with a line naming the pitfalls and constraints from the summary that it covers. Ask about each gap it has, as "Gaps" says, before going on.
133
+ 3. Ask, with it in your reply. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. The choices: **Looks good, next** (the default), **Change something** (feedback, as "How each review goes" says: the points with how each was addressed, then the final version), and **Draft the rest at once** (draft what is left in one go, then show it as a set).
134
+ 4. Save it with `save_draft` once the user agrees, before drafting the next.
135
+ 5. **The approaches, when the set has no design document:** right after saving the top new artifact, show the approaches weighed as working notes on it (each a decision, with the user's words as its `quote`), and keep them once the user agrees with `save_draft`, `type: "working-notes"`, its ID and `apply: true`. Keep them out of its Notes section: working notes are what later work and reviews find.
136
+
137
+ If the user stops partway, what they agreed to stays saved as drafts; draft nothing more.
138
+
139
+ ### All at once
140
+
141
+ Draft everything, asking about gaps as you go. Show the set in full, each artifact with the pitfalls it covers, then a table of them all: title and the pitfalls each covers. Take the set through the review: feedback on any of them is answered as "How each review goes" says, with the final version of each artifact it changed. Once the user agrees, save them with `save_draft`, top down, each child naming the draft ID its parent was given. When the set has no design document, show the approaches as working notes on the top new artifact in the same review, and keep them after it is saved, as step 5 of "Step by step" says.
142
+
143
+ ### Design options
144
+
145
+ Design options are due before the tasks are drafted, for the interface the set's work shares most, when three or more tasks would use it or it crosses from one code repository to another. Then do as the planning view says: offer them once in one line (ask), start them and say why in one line (auto), or nothing (off). The offer is a line of plain text at the end of your reply, on its own: never in your tool for asking a question with choices, and never together with a gap or another question. If the user declines the offer, offer nothing more in this capture, and draft the tasks against it as discussed. The user can ask for design options for any interface at any time.
146
+
147
+ When they run, start as many designer agents as the settings give for design options (2 by default), in the designers role as `query` with `view: "settings"` names it, at the same time, each with the interface, the work that uses it, and its own angle: the smallest interface, then one built for the most common use, then the most flexible one, then others of your choosing. When they cannot be started, follow "When agents can't be started": draft the designs yourself, and label them as your own. Compare them on how much each hides behind a small interface, where changes and defects would collect, and where the seams go, and recommend one, saying why. Record the one chosen and those set aside in the Approaches section, as approaches, with the user's reason for the choice.
148
+
149
+ ### Gaps
150
+
151
+ A gap is what a draft needs that the conversation did not settle: a required section, a pitfall raised but left open, or a detail the artifact cannot do without. For each gap, tell the user what is missing and where, and ask, with no recommendation, since only the user knows. Ask about one gap at a time, and wait for the answer before the next: never several gaps in one question, or in one use of your tool for asking a question with choices. The choices, in this order:
152
+
153
+ 1. **Put it in the spec as stated**: write it as a requirement, criterion or test case, in the user's words.
154
+ 2. **Record it as an open question**: add it to the artifact's Open questions section, to settle later. It does not block approval.
155
+ 3. **Flesh it out now**: discuss it until the user settles it, then draft it.
156
+ 4. **Not relevant: leave it out.**
157
+
158
+ A version 0 is the exception: list the sections it leaves empty, and ask nothing about them.
159
+
160
+ ### Drafting a version 0
161
+
162
+ Version 0 describes what the code does today, as if BuildKeel had been used from the start: the template's sections, filled from the code and from what the user brings about it, such as a ticket or a wiki page read through their own tools, a file, or what they say.
163
+
164
+ - Reword what the code and the sources say into the template's form, such as a ticket's description written as testable criteria. Add nothing they do not support.
165
+ - Describe only what the work touches, not the whole area around it.
166
+ - Keep each source as you read it: pass it to `save_draft` in `sources`, with where it came from, its key and link, and its text exactly as your tool returned it (description, fields and comments). Never copy code into a source: the baseline commit names the code.
167
+ - When a source and the code disagree, or two sources do (a ticket says a reset link lasts 30 minutes, the code makes it 60), ask the user which is intended, before drafting that part. Only the user knows, so recommend neither answer, and offer both as equals: **The code is right; the source is out of date** and **The source is right; the code has a defect**. When the code is wrong, version 0 states the intended behavior, and the defect is recorded against it with /bk-new defect once version 0 is approved. When the source is out of date, version 0 follows the code. Offer a third answer after those two, still with no recommendation: **Not sure: leave it open**. Then keep the question in the version 0 draft's front matter, under `openQuestions`, with an `id` (Q1, Q2, ...), what it is `about`, what the `code` does, what the `source` says and the `sources`' keys, and leave the part it concerns out of version 0: BuildKeel records who left it open, and version 0 waits for an answer before it can be approved. Someone who knows answers it later with /bk-onboard: add `answer: code` or `answer: source` to it, save the draft, and draft the part it concerns.
168
+ - Supported means the code or a source says it. A plausible guess is not support: who a story is for and why, a business idea's problem and goals, or a design's context are rarely in the code. Leave a required section empty when nothing supports it, and do not ask about it here: `save_draft` lists what version 0 leaves empty, and the reviewer sees it.
169
+
170
+ ## 5. Close
171
+
172
+ 1. **The readiness check.** Call `query` with `view: "readiness"` and `ids` set to every artifact agreed in this capture, and do as its line says, by the team's switch: offer the check in one line of plain text, on its own, saying why (ask), run it and say why in one line (auto), or say nothing about it (off). Small work is skipped, with a line saying so. When it runs, or the user agrees to it or asks for it ("run the readiness check"), start the readiness readers as the result says, one round only. When they cannot be started, follow "When agents can't be started": ask the questions yourself, from each reader's angle, labeled as your own reading. Merge the questions more than one reader asked into one, naming the readers who asked it. Sort the questions:
173
+ - **already answered** in the set or the conversation: show the answer as an edit to the artifact it belongs in, and save it once the user agrees;
174
+ - **minor:** settle it yourself, and show it labeled "my call", as an edit taken through the same review;
175
+ - **the user's to answer:** list them all together, the most important first, then ask them one at a time, each with your recommendation.
176
+
177
+ It changes nothing the user has not agreed to.
178
+ 2. **Gaps.** List each pitfall or constraint from the summary that no saved artifact covers, and treat each as a gap, as above. Then show what was drafted as a table: ID, title, and its open questions, if any.
179
+ 3. **A resumed thread.** When this capture started from a thread, close it with `save_draft`, `type: "thread"`, its `id` and `captured` set to the top artifact saved, and say so in a line: the thread links to what it became.
180
+ 4. **Compacting.** Call `query` with `view: "conversation"` and do as it says: when the conversation is long, it says to offer compacting it once, with a line to paste that keeps what was saved and drops the discussion. What was agreed is saved in the drafts already; save any working notes first. Otherwise say nothing about it.
181
+
182
+ ## 6. Approve them, or leave them as drafts
183
+
184
+ Agreeing to an artifact here does not approve it: approving is a separate choice, with permanent numbers and frozen versions. Once the close is done, ask in plain text, at the end of the reply with the table: **Approve them now** (the default), or **Leave them as drafts**, for another approver to approve later with /bk-approve.
185
+
186
+ - **Approve them now:** call the BuildKeel `approve` tool with `ids` set to every artifact agreed in this capture, without `apply`. Name a version 0 with `@v0`, such as `US-draft-k3x9@v0`, and keep the version built on it in the set too. A task's own test plan is not in the set unless the process approves task plans: it is recorded when its task is approved. Show the set as `approve` gives it, in the order it will be approved, with what each will become and anything that would not pass, and why. Then ask: **Approve them** (the default; any that would not pass stay drafts), **Fix what would not pass first** (each fix shown and saved with `save_draft` once the user agrees, then the set checked again), or **Stop**. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. Only when the user confirms, call `approve` again with the same `ids` and `apply: true`, and show the result as it is.
187
+ - **Leave them as drafts:** approve nothing. Say that the drafts wait for /bk-approve, which shows them as one set.
188
+
189
+ Never approve anything the user has not confirmed in this conversation.
190
+
191
+ Do not create or edit spec tree files yourself; `save_draft` does all writing.
192
+
193
+ ## In a Spec-driven tree
194
+
195
+ The plan is one change: a proposal, a spec change for each capability whose behavior it alters, a design only when needed, and tasks. Nothing is approved.
196
+
197
+ 1. **Read the capability specs first.** Call `query` with `view: "capabilities"`, then with the `id` of each capability the work touches, so the change starts from how the system behaves now. Check `view: "changes"` for an open change that already covers the work.
198
+ - **A late addition.** When the work would add a requirement to an open change with more than half its tasks ticked, ask once, in plain text, before drafting anything: does it belong in that change, or in a new one? Draft nothing until the user answers, and go on with the change they choose.
199
+ 2. **Propose the change**, showing a table of the capabilities it adds or modifies, by code, with what changes in each, and say in a sentence whether it needs a design: only when it makes decisions worth recording, such as a new component, data, an interface or a trade-off. A change that alters no behavior, such as a refactor, says so and has no spec changes. For a new capability, propose a short code from its name, such as SMS, which the user can change before anything is saved. Then ask, the same way as in step 1, with the table and that sentence in your reply. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. The choices: **Looks right** (the default), **Change the plan**, **Keep talking**.
200
+ - **Revising an open change.** When the work revises a change that is already open, call `query` with `view: "changes"` and its `id` first: besides its files, it gives what the work so far traces to, the files each ticked task's commits changed and the tests tagged with each requirement's scenarios. Add an **Affected** part to the table, for each requirement the revision removes or modifies: the tests tagged with its scenarios, the tasks that name it with the files their commits changed, and which ticked tasks no longer apply or now build on a changed requirement. Take the code from that trace, never from file names. Then ask the user about each affected ticked task, one at a time: **Keep it ticked**, **Rework it** (untick it and reword it as the revision needs), or **Drop it** (take it out of the tasks, with the code it leaves to remove named as a task when the user wants one). What the user decides goes into the tasks through the review.
201
+ - **A new title.** When the revision changes what the change is about, show its current title beside the one you propose, and ask whether to change it. Change it only when the user agrees: the proposal is saved with the new title, and the change's folder is renamed with it. If the user says the title still fits, keep it.
202
+ 3. **Ask the pace**, as in step 3 above: **Step by step** (the default) or **All at once**, every time.
203
+ 4. **Draft the change.** Call `get_template` for proposal, spec-change, tasks and, when needed, design. Draft by "How to draft" and "Gaps" above: each settled pitfall becomes a requirement or scenario, and nothing is invented. A modified requirement keeps its ID and holds its full new text; a removed one says why and what replaces it. Each task says how its completion is verified, and each group holds the tests and docs its work needs.
204
+ - **Approaches.** Fill the proposal's Approaches section from the conversation, as "How to draft" says, and its Non-goals with what the change deliberately leaves out.
205
+ - **Edge-case suggestions for scenarios.** After drafting each spec change, have edge-case suggestions look for the scenarios nobody has written yet, as "How to draft" says for a test plan, with the change's requirements and their scenarios, and show its proposals in the same review.
206
+ - **Design options**, before the tasks, as "Design options" says.
207
+ - **Step by step:** show the proposal, with the pitfalls it covers, and save it once the user agrees, with `save_draft`, `type: "change"`, `capture: true`, the proposal as `content`, and, when this capture started from a thread, `thread` with its ID: that creates the change, which names the thread. Then each spec change, then the design if one is needed, then the tasks, each shown, agreed and saved in turn with `save_draft`, its `type` (`spec-change`, `design` or `tasks`) and the change's `id`. Offer **Looks good, next** (the default), **Change something** and **Draft the rest at once** at each step, and answer feedback as "How each review goes" says.
208
+ - **All at once:** show the whole change in full and take it through the review. Once the user agrees, save it in one `save_draft` call with `type: "change"`, `capture: true`, the proposal as `content`, the others in `files`, and `thread` when it started from one.
209
+ 5. **Close**, as step 5 above says, with `query`, `view: "readiness"` and the change's `id` for the readiness check; a thread the change names is closed with it.
210
+ 6. **Show what was saved**: the change's ID, its files, the IDs given, and anything `save_draft` lists as worth fixing. Treat each pitfall from the summary that no file covers as a gap, and each missing part `save_draft` names. Then name the change with its title, and offer /bk-build with the change's ID as the next step. Nothing in a Spec-driven tree is approved.
@@ -0,0 +1,115 @@
1
+ ---
2
+ description: "BuildKeel: Finish the active unit, or a story or epic once everything under it is done: check its tests pass, then write its completion record. Only the user starts it, by typing it."
3
+ argument-hint: "[ID], e.g. TK-001, or US-001 for a story built through tasks; the active unit when left out"
4
+ ---
5
+
6
+ Finish a BuildKeel unit with the user. Finishing writes a permanent record of what was built, against which approved versions and with which test results, so it is the user's decision: never finish a unit they have not confirmed in this conversation.
7
+
8
+ The user typed: $ARGUMENTS
9
+
10
+ **Before anything else**, call the BuildKeel `query` tool with `view: "process"`, and do not show its result. If it says this repository is not set up for BuildKeel, tell the user so, and that /bk-init sets it up, then stop: ask nothing else. Otherwise go on straight away.
11
+
12
+ If BuildKeel's session report, or `query` with `view: "process"`, says this spec tree is Spec-driven, follow "In a Spec-driven tree" at the end for a change.
13
+
14
+ ## Choose the unit
15
+
16
+ If the user named a unit above, use it.
17
+
18
+ If the user typed nothing, ask straight away: "What do you want to finish?" Offer the choices with your tool for asking a question with choices, if you have one, so the user can pick with the arrow keys and Enter:
19
+
20
+ 1. **The active unit in this working tree** (the default, listed first).
21
+ 2. **Another unit, or a story or epic whose work is all done: type its ID.** If they pick this, ask for the ID.
22
+
23
+ A story built through tasks, an epic, or a stage the team added above its stories, is never the active unit: it is finished once every unit under it is done and its own test cases pass, here or in the completion records of units finished in other repos.
24
+
25
+ ## Check it
26
+
27
+ 1. If the code changed since the tests last ran, run them again with a JUnit XML report (BuildKeel's instructions list the reporter for each test runner) and record the report with the BuildKeel `test_results` tool.
28
+ 2. Draft the unit's working notes since the last checkpoint, and check them, as "Working notes" below says, steps 1 and 2; and draft what its context adds to them: departures from the plan (spec changes made while building included), known limitations, follow-ups with their IDs, and notes for the next person who touches the code, each from this conversation or the records, never invented.
29
+ 3. Call the BuildKeel `finish_work` tool without `apply`, with `id` if the user named a unit, `notes` with the notes the checker supports, and `context` with what it adds (`departures`, `limitations`, `followUps`, `forNext`). It runs the done gate and writes nothing.
30
+ - **A check on the tests not run yet:** when the result says the revert check, or mutation testing, has not run yet, run it first, once, without asking, then call `finish_work` without `apply` again. For the revert check: call `manage` with `action: "revert-check"`, run the unit's tagged tests in the worktree it prepares, from that directory, with a JUnit XML report written there (it links the dependencies the main checkout has installed: never install, update or remove a package through a link, and install in the worktree only where it says to), and record it with `test_results` and `purpose: "revert-check"`; when the tests cannot run there, remove the worktree with `remove: true` and say why. For mutation testing: run the command the result names, and record its report with `test_results` and `purpose: "mutation"`.
31
+ - **Refused only because tests have no current result** (not run, or run before the code last changed): run the tests with a JUnit XML report, record it with `test_results`, and call `finish_work` without `apply` again. Do this once, without asking.
32
+ - **Refused by the done gate** for anything else: show every failing check with its fix, as it is, and where each test case stands. Offer the fix that comes first: commit uncommitted changes (ending the message with the unit's line, `BuildKeel-Unit: <ID>` or `Refs: <ID>`), write a test that is missing its tag, fix a failing test, or run the tests again. Do not finish anything else in its place.
33
+ - **Not the active unit, or no active unit:** show the message and its fix.
34
+ - **A story or epic refused because work under it is open:** show every open unit with its fix, and where each test case stands. Offer to start the first open unit with /bk-build.
35
+ - **The final review not run yet:** when the result says the unit has no final review, review it now, before showing anything else, as "The final review" says, then call `finish_work` without `apply` again. It always runs, whatever the settings say of reviews after each task.
36
+ - **Ready:** show what finishing will record: the commits, the files, each test case's result, the findings and how each was answered, the context part (decisions, those replaced, departures, dead ends, limitations, follow-ups and notes for the next person), and any test cases left for the story. For a story or epic: the units under it and where each test case passed.
37
+ - **A standalone defect,** in a Spec-driven tree: the result names the requirements the files it changed implement. Ask which requirement to link it to, with your tool for asking a question with choices: **the requirement it suggests** (the default), then each other one it names, then **leave it standalone**. Pass the chosen requirement in `link` when you finish.
38
+
39
+ ## The final review
40
+
41
+ Review the whole unit, or the whole change, with `kind: "final"`, as follows. In a Spec-driven tree, the reviewers judge the change's code against its requirements, scenarios and design.
42
+
43
+ A review is done by three fresh agents: the spec reviewer, the quality reviewer and the break-it agent. None of them is the agent that wrote the code, and none sees this conversation.
44
+
45
+ 1. **The packages.** Call `review` with `action: "input"`, the `id` (and in a change, the `task` when one task is reviewed), and the `kind` of this review: `kind: "after-task"` in a run, `kind: "final"` at finishing, `kind: "on-demand"` when the user asks. It says which reviewers to start, and only those: each reviewer that is switched on, and at finishing only the commits since the last review, with one spec-compliance review of the whole change when its tasks were reviewed in a run. It writes each one's package, the diff and the reviewer's view, to a folder, and prepares the break-it agent's worktree when break-it runs. When it says nothing is to be reviewed, review nothing, and say so in a line, with why.
46
+ 2. **The reviewers.** Call `query` with `view: "settings"`, if you have not in this conversation: it names the agent to start for each role, with the model and effort to pass on this host. Start the reviewers the input names, saying the reviewers' line the settings view gives: after a task, the spec reviewer and the quality reviewer; at finishing, the final spec reviewer and the final quality reviewer; and the break-it agent. Give each the folder the input names for it and nothing else, and the break-it agent its worktree too. They can run at the same time.
47
+ 3. **Record each report as it is,** with `review`, `action: "record"`, the same `id` (and `task`), the `reviewer` (spec, quality or break-it), the `kind` of this review, and the report's lists: its verdicts, findings, proposed additions, what was done well and its verdict, or the break-it agent's failing tests. Never change a finding's severity or wording.
48
+ 4. **When a reviewer cannot be started,** follow "When agents can't be started": review it here, as each reviewer's instructions would, and record each report with `by: "author"`. Say in a line that it was reviewed by the author, so it does not count as an independent review.
49
+ 5. **Answer each finding.** Check it against the code first: never accept a finding only because a reviewer made it. Then answer it with `review`, `action: "answer"` and the `finding`'s ID:
50
+ - **fixed,** with the `commit` that fixed it;
51
+ - **parked,** once the user agrees to handle it later: record it as a defect found while building the unit with /bk-new defect (in Spec-driven mode, linked to the change), then answer with `parkedAs` set to its ID;
52
+ - **rejected,** with the `evidence`: the code, a test or the spec that shows it is wrong. Show the user each finding you reject, with its evidence.
53
+
54
+ A Low finding may stay open: name it at the end.
55
+ 6. **The break-it agent's failing tests** count only through their test. For each, ask the user, recommending one: **a defect found while building** (record it as in "parked", with the test as its regression test) or **a question about the spec**, where the agreed behavior is what is wrong. Tests that pass are discarded, never committed.
56
+ 7. **Proposed additions to the spec** are behavior the spec is silent on. Show them apart, never as a requirement not met: the user decides whether to add each, and an addition goes through the same review as any change to the spec.
57
+
58
+ **When agents can't be started,** the same everywhere:
59
+ 1. **Say why, once,** in a line: you have no tool for starting agents here, it is turned off, or the model tier the settings name is not available.
60
+ 2. **Retry once** when an agent started but failed, before treating agents as unavailable.
61
+ 3. **Follow the step's switch:** off, nothing happens; ask, the offer says it would run here, without a fresh reader; auto, or a step with no switch (an implementer or a reviewer), do it here and say so in a line.
62
+ 4. **Label what you did here** as done here, not by an independent agent: in what you show, and in the record (`by: "author"` for a review), and present a question or proposal as your own reading.
63
+ 5. **Never count it where independence is the point:** a final review done here does not satisfy the review-findings check, so say the work was not independently reviewed.
64
+
65
+ A High or Medium finding still open is shown with the finish, which reports it: offer **Fix first** as the default. Fix it as the build's fix loop does, then preview again.
66
+
67
+ ## A defect closed without a fix
68
+
69
+ When the unit is a defect, offer closing it without a fix beside finishing it, with your tool for asking a question with choices, whether or not it is started: **Finish <ID>** (the default when its regression test passes, or when the user has not said it is not one) or **Close without a fix**, for a defect that turns out not to be one (a duplicate, one that cannot be reproduced, behavior that works as intended, a test that was wrong, or a change in behavior: the code does what the spec says, and the spec is what must change; the default when the user says so). To close, ask for the reason with the same tool, then for a duplicate which defect it duplicates, for a change in behavior the change, version or item that takes it over (draft it first if there is none yet, such as a change, or a story's next version, with /bk-new), and for an optional note in the user's words. Call `finish_work` with `close` (`reason`, `duplicateOf`, `takenOverBy`, `note`) and without `apply`, show what it says with the defect's title, and ask the user to confirm. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. Only when they confirm, call it again with `apply: true`. Never close a defect the user has not confirmed in this conversation. When the test was wrong, offer to correct the test case as a new version of its test plan.
70
+
71
+ ## Confirm
72
+
73
+ Ask the user, the default first, with what the result said in your reply. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. The choices:
74
+
75
+ - If the result lists commits without the unit's line, ask what to do with them:
76
+ 1. **Count them all as <ID> work and finish** (the default).
77
+ 2. **Choose which to leave out.** Then ask which ones, allowing several, and finish with those left out.
78
+ 3. **Stop, and do not finish yet.**
79
+ - Otherwise ask:
80
+ 1. **Finish <ID>** (the default).
81
+ 2. **Stop, and do not finish yet.**
82
+
83
+ Only when the user confirms, call `finish_work` again with `apply: true` (and the same `id` if you passed one), with `exclude` listing the IDs of any commits they left out, with `link` when they chose a requirement for a standalone defect, and with the same `notes` and `context` as the preview. If it is refused because the preview was not seen or something changed since, call it again without `apply`, show the new result, and ask again.
84
+
85
+ ### Working notes
86
+
87
+ Finishing is a checkpoint.
88
+
89
+ **Working notes.** At this checkpoint, draft the working notes since the last checkpoint or pause: what the work learned that the code and the spec do not say. Each is one of these: a decision and why (with `replaces` naming an earlier decision it replaces), a constraint or pitfall, a dead end (what was tried, and why it failed), an open question, or the next step. Rulings are kept already. Give each its source: the user's own words, copied exactly, as `quote`; a `file` and `line`; or a `record`, such as a requirement, a finding or a commit. Never record an inference about a person, such as what they seem to prefer. With nothing new to note, leave notes out.
90
+ 1. **BuildKeel's check:** call `save_draft` with `type: "working-notes"`, the unit's or change's `id` and the `notes`, without `apply`. It says which pass, and drops the rest with the reason.
91
+ 2. **The note checker:** give it the notes that passed in one batch, with their sources and nothing else, started in the note checker role as `query` with `view: "settings"` names it. When it cannot be started, follow "When agents can't be started": check each yourself as the checker would, and say the notes were checked here. Keep only the notes it supports, and tell the user each one dropped, with why.
92
+ 3. **Keep them** as this step says. At a checkpoint, the result lists what was kept: show that list in the same reply, without asking first; the user may ask to correct or drop any of it. A pause shows them first, and keeps them once the user agrees.
93
+
94
+ ## Afterwards
95
+
96
+ Show the result as it is: the completion record, the commit in the spec repo, and whether it was pushed. Remind the user to push the unit's branch and open a pull request as usual, and to push the spec repo when the record is not pushed. If test cases were left for the story, name them: the story cannot be finished until they pass.
97
+
98
+ If the result names the next unit ready under the same parent, offer to start it, with your tool for asking a question with choices: **Start <ID>** (the default), or **Not now**. If the user agrees, call `start_work` with its `id` and `stack: true`, so its branch starts from this unit's branch and has this work before it is merged, and carry on as /bk-build does. Otherwise call `query` with `view: "startable"`, show what can be started next, and offer to build it with /bk-build.
99
+
100
+ Do not create or edit spec tree files yourself: `finish_work` writes the record, and completion records are never edited.
101
+
102
+ ## In a Spec-driven tree
103
+
104
+ A change is finished by archiving it, and need not be the active unit. With none named and none active, `finish_work` lists the open changes: ask which to finish, allowing several, those with every task ticked first. Call `finish_work` without `apply` (with `ids` for several; for one change, with `notes` and `context` drafted as "Check it" step 2 says) and follow its result step by step:
105
+
106
+ 1. **Checks on the tests.** When the result says the revert check, or mutation testing, has not run yet, run it first, once, without asking, as "Check it" says above, then preview again.
107
+ 2. **Unticked tasks first.** When it lists unticked tasks, check each against the code and the test results before showing anything else. Say in a line each which now pass their verification, and offer to tick them. Tick those the user agrees to with `save_draft`, `type: "tasks"`, the change's `id` and `tick`, then preview again.
108
+ 3. **The final review, and show.** Review the change as "The final review" says, if it has no final review yet. Then show each requirement and scenario as met, partly met or not met with its evidence, the findings with how each was answered, and the break-it agent's failing tests. In the same reply, show what finishing will write, as the result gives it: its context part, the capability specs after the merge, with the requirements the change adds or modifies in full and the others by name.
109
+ 4. **Ask.** End that reply with the choice, in plain text: **Fix first** or **Finish anyway**, fix first being the default when a High or Medium finding is open or anything is reported missing. When your review finds a gap where the code is right and the spec is not, also offer **Reword the spec, then finish**. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. Nothing blocks the finish but uncommitted work.
110
+ - **Fix first:** help fix it.
111
+ - **Reword the spec:** show the requirement's new text in full, with why, and save it only once the user agrees, with `save_draft`, `type: "spec-change"`, the change's `id`, its `capability` and `requirement`.
112
+ - After any commit or change, call `finish_work` without `apply` again, and ask on the new preview, never on the old one.
113
+ 5. **Finish.** Call `finish_work` with `apply: true` as the result says, with `review` holding a line per change that sums up the final review as you showed it, and, when one change is finished, the same `notes` and `context` as its preview, as "Check it" and "Working notes" above say: its context part is shown in the preview and kept with its archive. When the change was finished anyway with tasks or gaps left open, the result lists them: offer a follow-up change holding them. If the user agrees, draft it as /bk-capture drafts a change, from its proposal, through the review; if not, they stay recorded with the archived change.
114
+
115
+ Defects and ad-hoc units finish as above.
@@ -0,0 +1,51 @@
1
+ ---
2
+ description: "BuildKeel: Review what a change to an approved artifact affects: preview a new version before approving it, or decide on each suspect with the user."
3
+ argument-hint: "[ID], e.g. US-001 to preview its new version in draft, or US-001-TC2 to review one suspect; every suspect when left out"
4
+ ---
5
+
6
+ Review change impact in BuildKeel with the user. A suspect is a task, story, epic, defect or test case built against an older version of something that has changed since, in what it relies on. Deciding on a suspect is the user's choice: never record a decision they have not confirmed in this conversation.
7
+
8
+ The user typed: $ARGUMENTS
9
+
10
+ **Before anything else**, call the BuildKeel `query` tool with `view: "process"`, and do not show its result. If it says this repository is not set up for BuildKeel, tell the user so, and that /bk-init sets it up, then stop: ask nothing else. Otherwise go on straight away.
11
+
12
+ If BuildKeel's session report, or `query` with `view: "process"`, says this spec tree is Spec-driven, follow "In a Spec-driven tree" at the end as well.
13
+
14
+ ## Choose what to review
15
+
16
+ If the user named an artifact or test case above, use it.
17
+
18
+ If the user typed nothing, ask straight away: "What do you want to review?" Offer the choices with your tool for asking a question with choices, if you have one, so the user can pick with the arrow keys and Enter:
19
+
20
+ 1. **Every suspect** (the default, listed first).
21
+ 2. **Type an ID:** an artifact with a new version in draft, to see what approving it would affect, or an artifact or test case to review on its own. If they pick this, ask for the ID.
22
+
23
+ ## Show the impact
24
+
25
+ Call the BuildKeel `impact` tool, with `id` if there is one. Show its result as it is.
26
+
27
+ - **A preview of a draft:** nothing is marked yet. Say what approving it would make suspect and which coverage gaps it would open, then stop. Offer to approve it with /bk-approve when the user is ready, or to change the draft first.
28
+ - **Nothing suspect:** say so and stop.
29
+
30
+ ## Review each suspect, one at a time
31
+
32
+ For each suspect in the result, in order:
33
+
34
+ 1. Show what it is and what changed, in the same reply as the question in step 3, never in a choice's label or description. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. For a test case, read its plan with `query` (`view: "artifact"` and the plan's ID) and show the test case with the old and new text of what it covers. For a task, story, epic or defect, show its own text (`query`, `view: "artifact"`) with the old and new text of what changed above it. For a finished unit, show the commits and files its completion record lists.
35
+ 2. Propose a decision, saying why in a sentence or two:
36
+ - **Still valid** when the change does not affect what it says, builds or checks, such as a rewording, or a change to something it does not rely on in substance.
37
+ - **Needs change** when what it says, builds or checks no longer matches the new text, such as a test case checking a 30-minute expiry when the criterion now says 15 minutes. For finished work, name the files that likely need to change.
38
+ 3. Ask the user to decide, in plain text at the end of that reply: your proposal first, then the other decision, then **Skip it for now**.
39
+ 4. Record only what the user chose: call `resolve_suspect` with the `id` and the `decision` (`still-valid` or `needs-change`), and show its result as it is.
40
+ - After **needs change**, offer to make the change now: read the draft it opened with `query`, show the change you would make, in full, and ask. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. Save it with `save_draft` only once the user agrees, and approve it with /bk-approve only when they confirm. For a unit already finished, its new version can be started again with /bk-build once approved, to change the code.
41
+ - For a **defect**, needs change on an open defect means changing its file with the user, shown and agreed as above, and saving it with `save_draft`: the save records the decision. For a finished defect, `resolve_suspect` records a new defect to check it: show it, and offer to start it with /bk-build.
42
+
43
+ ## Afterwards
44
+
45
+ Call `impact` without `id` and say how many suspects are left. If a test plan is still written against an older version of its story, suggest updating it to cover any new criteria.
46
+
47
+ Do not create or edit spec tree files yourself: `resolve_suspect` and `save_draft` do all writing, and re-pin records are never edited.
48
+
49
+ ## In a Spec-driven tree
50
+
51
+ Suspects are tests tagged with a scenario, and archived changes, built against a requirement that a later capability version modified or removed. With an open change's ID, `impact` previews what archiving it would make suspect: decide each then or after it is archived, as its result says, passing that change in `change` to `resolve_suspect`. Needs change adds a task to revisit it: in the previewed change, or after archiving, in an open change the user picks (draft a new change with `save_draft` first if they want one). Show the task it added.
@@ -0,0 +1,95 @@
1
+ ---
2
+ description: "BuildKeel: Set up BuildKeel in this repository, with a new spec tree or an existing one. Only the user starts it, by typing it."
3
+ argument-hint: "[path of an existing spec tree]"
4
+ ---
5
+
6
+ Set up BuildKeel in this repository using the BuildKeel `manage` tool with `action: "init"`. Ask the user one question at a time, each with your recommendation, and wait for the answer before asking the next.
7
+
8
+ The user typed: $ARGUMENTS
9
+
10
+ Ask each question with your tool for asking a question with choices, if you have one, with your recommendation as the first choice, so the user can pick it with Enter, except where a step says to ask in prose or in plain text.
11
+
12
+ ## 1. Check the folder
13
+
14
+ Before any question, call `manage` with `action: "init"` and nothing else. It only reads.
15
+
16
+ - When it says the folder is not a git repository, ask before anything else, with your tool for asking a question with choices, so the user can pick an answer: **Run git init for me** (the default) or **Stop**. Only when the user agrees, call `manage` with `action: "init"`, `apply: true` and nothing else: it runs `git init`, so never run it yourself. Then say in one line that `git init` ran, before the next question. Ask nothing else until this is settled.
17
+ - When it says the repository is already set up, show that, and stop.
18
+
19
+ ## 2. Keep BuildKeel out of this repository?
20
+
21
+ Explain in two lines: kept out, nothing in this repository names BuildKeel (no file, no hook, no line in commits), so the product can be released with no trace of it; the plan lives in a spec repository of its own, and each clone of this repository is pointed at it once with /bk-init. Set up in the repository, `.buildkeel.yaml` and a `.gitignore` line are committed, so teammates are set up by cloning, and commits carry a `BuildKeel-Unit` line. Ask, with your tool for asking a question with choices: **Keep BuildKeel out of this repository** (the default, listed first) or **Set it up in the repository, for the team**. Pass `keepOut: false` in every call to `manage` below only when they choose the second.
22
+
23
+ ## 3. Where the spec tree lives
24
+
25
+ If the user gave a path above, use it as an existing spec tree and skip this question; if `manage` then reports there is no spec tree there, ask whether to create a new spec repository at that path instead. Otherwise ask, in the order the first `manage` call gave, which follows whether this repository has a remote:
26
+
27
+ - **A new spec repository**, a repository of its own that several code repositories and the team share: first and recommended when this repository has a remote. Ask for its folder, outside this repository, such as `../specs`: a folder that does not exist yet, an empty folder, or an empty repository the user has cloned. Use `location: "new-repo"` with that `path`. When the first call said gh is signed in, offer next to create it as a private GitHub repository with the name it gave, using the user's own gh sign-in and pushing nothing; pass `github` with that name only on a yes.
28
+ - **In this repository**, in a `specs/` folder, only when BuildKeel is set up in the repository: first then when this repository has no remote, labeled for trying BuildKeel out, with a line that /bk-migrate can move it to a repository of its own later. Kept out, do not offer it: a new spec repository is first, as a folder beside this one, such as `../<this repository's name>-specs`.
29
+ - **An existing spec tree**, usually its own repository shared by several code repositories. Ask for its local path. If it is not cloned yet, tell the user to clone it first.
30
+
31
+ ## 4. The mode
32
+
33
+ For a new spec tree only: an existing tree keeps its own, and `manage` says which. Ask, with a line on each:
34
+
35
+ - **Spec-driven** (the default, listed first): capability specs say how the system behaves, and each piece of work is a change to them, with no approvals or gates.
36
+ - **Full SDLC**: work goes through the team's stages, from business idea down, with approvals and gates.
37
+
38
+ Pass the choice as `mode` (`spec-driven` or `full-sdlc`) in every call to `manage` below.
39
+
40
+ ## 5. Stamping their own commits
41
+
42
+ Only when BuildKeel is set up in the repository; kept out, skip this step: no hook is installed, and commits carry the work's ID as `Refs: <id>`. Explain: while a unit of work is active, BuildKeel adds a line `BuildKeel-Unit: <id>` to commits the agent makes. Stamping is on by default: setup installs a git hook that adds the same line to commits they make themselves, for example in a terminal. It changes nothing when no unit is active, and can be turned off later, which uninstalls the hook. If the repository already manages its git hooks with another tool, nothing is installed and BuildKeel shows the lines to add. Ask, with your tool for asking a question with choices: **Stamp my commits** (the default, listed first) or **Don't stamp them**. Pass `stampCommits: false` only when they turn it off.
43
+
44
+ Then call `manage` with `action: "init"`, the `location` (`this-repo`, `existing` or `new-repo`), the `path` if there is one, `keepOut: false` when they chose to set it up in the repository, `stampCommits` and, for a new tree, `mode`, without `apply`. Show the list it returns, as it is, in your reply as normal text.
45
+
46
+ ## 6. The process, for a new Full SDLC spec tree
47
+
48
+ Topics for this step, in this order:
49
+
50
+ - **stages**: what each stage is called, and any stage added between the business idea and the user story, with where it sits.
51
+ - **kinds**: whether a stage holds more than one kind of work, such as features and enhancements beside user stories. Each kind is numbered in its own sequence, has its own template and documents, and behaves as its stage does.
52
+ - **prefixes**: the ID prefix and digits of each stage and kind, such as `US-001`, `FEAT-0001` or `PROJ-12`.
53
+ - **documents**: what each stage and kind needs approved before work under it starts: a test plan, a design document, or a document of the team's own, such as a security review.
54
+ - **test-plans**: whether a task's own test plan is recorded as it is saved (the default) or approved like any other plan.
55
+ - **gates**: each gate's mode: block stops the action, warn lets it go ahead with a warning, off skips the check. The approve gate checks an artifact before it is approved: it follows its template, and its parent is approved. The start gate checks before work starts: everything above the unit is approved and not suspect, and its required documents are approved. The done gate checks before a unit is finished: its test cases pass. The lock gate checks before the agent edits approved versions and records.
56
+
57
+ Work from the topics listed for this step. The user may answer in their own words, several topics at once or part of one. After each answer, say which topics it settled, with what you understood for each, and which are left; then ask the next one left, one topic per message. Where a topic has a default, list keeping it first, naming its actual value, and give examples where they help. Anything you work out that the user did not say is a proposal: ask it as that topic's question, with it as the default, and never use it without the user's answer. Ask about an unclear answer; name a conflicting one beside the earlier answer and ask which holds. Never guess. When every topic is settled, show all of it, as a review.
58
+
59
+ The list shows the process as a table: BuildKeel's default, or the organization's when the tree takes its templates from one. Show it as it is, in your reply as normal text. Then ask in prose, not with your tool for asking a question with choices, whether the team uses this process as it is, or works differently and how: they can describe it in their own words, all at once or in part. If they only say it works differently, ask in one line how their team works.
60
+
61
+ - **Used as it is**: every topic is settled. Pass `settled: ["all"]`, and go on to the review below.
62
+ - **Works differently**: settle the topics their description covers, and ask each topic left, in the order above, with the default's actual value from the table as the first answer. Build `process` as in buildkeel.yaml's process section from what the user said or confirmed, nothing else. An added stage or kind needs a prefix: propose one, such as `FEAT` for feature, and say it is a suggestion they can change. When the user names a stage the default process does not have, ask whether it is a stage of its own, between two stages, or a kind of work beside one, such as features beside user stories, before you settle stages: a list of stage names in order does not say which. Name anything the process cannot express, such as a stage after the code is built, with the closest setting it has, such as the done gate's checks; never drop it silently, and never invent a setting. After each answer, call `manage` again without `apply`, with the same values as before, the `process` so far and every topic settled in `settled`: it lists the topics left.
63
+
64
+ When no topic is left, call `manage` again without `apply` and show the whole table it returns, as it is, with its line on what each stage or kind the team added means, and ask whether to go ahead with it. Never ask about a table the user has not seen. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool. The answers: go ahead with this process (the default); change something, which you take in, then call `manage` again and show the whole table again, in the same layout; or stop, and write nothing.
65
+
66
+ **Templates.** Once the user agrees the table, settle a template for each one the list says the process needs, one at a time, in the order listed. For each, ask: **The agent drafts it** (the default) or **I'll provide a file**. Nothing is left for later: if the user asks to leave one, say that the tree needs it to check what is drafted from it, and ask again with the same two answers.
67
+
68
+ - **The agent drafts it**: call `get_template` for the closest built-in type: `story` for a kind at the user story stage, `epic` for a stage between the epic and the user story or a kind at one, `idea` for a kind at the business idea stage, `task` for a kind at the task stage, `design` for a document of the team's own. Change its `template:` line to the new type, and its description and sections to what the user said about it. Show it in full, and ask whether to use it or change something. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool.
69
+ - **I'll provide a file**: read the file the user names with your own tools, and pass its text. When `manage` says it fails the template check, show what is wrong, and ask: **The agent fixes it** (the default) or **Use another file**. Show a fixed template in full, and ask whether to use it. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool.
70
+
71
+ Pass each agreed template in `templates`, by type, and call `manage` again without `apply`: it checks each one. Nothing is written until every template the list names is given and passes.
72
+
73
+ ## 7. Numbering, for a new Spec-driven spec tree
74
+
75
+ Topics for this step: **numbering**, how the tree's IDs read.
76
+
77
+ Work from the topics listed for this step. The user may answer in their own words, several topics at once or part of one. After each answer, say which topics it settled, with what you understood for each, and which are left; then ask the next one left, one topic per message. Where a topic has a default, list keeping it first, naming its actual value, and give examples where they help. Anything you work out that the user did not say is a proposal: ask it as that topic's question, with it as the default, and never use it without the user's answer. Ask about an unclear answer; name a conflicting one beside the earlier answer and ask which holds. Never guess. When every topic is settled, show all of it, as a review.
78
+
79
+ The list shows the tree's IDs, each with an example: changes, capability codes, requirements, scenarios, defects and ad-hoc units. Show them as they are, then ask in plain text whether to keep them (the default) or change them, with examples of other numbering, such as `RFC-0012` or `PROJ-12` for changes, or `AUTH-REQ1` for requirements. A change of change, defect or ad-hoc prefix or digits goes in `process`, such as `{ change: { prefix: RFC, width: 4 } }`; a change of the letters in requirement or scenario IDs goes in `markers`. Call `manage` again without `apply` with them, show the IDs it returns, and ask the user to confirm them. Pass `settled: ["numbering"]` once they keep or confirm the numbering.
80
+
81
+ ## 8. Confirm and set up
82
+
83
+ Show the last list `manage` returned in full and ask whether to set up with it, change something or stop. An existing spec tree keeps its own process and numbering: just ask the user to confirm the list. Show it in full in your reply, as normal text: the document, table or list itself. End the message with your question in plain text, and take the user's next message as the answer. Never put what you show inside your question tool.
84
+
85
+ Only when the user confirms, call `manage` again with the same values (the same `process`, `settled`, `templates` and `markers`, when there are any) and `apply: true`. Show the result as it is, including any lines the user must add to their hook manager, and, for a new spec repository, that it needs a remote and a push before others can use it.
86
+
87
+ ## 9. The guide
88
+
89
+ For a Spec-driven tree, new or existing, the result asks it. Ask **Guide me through my first change** (the default) or **Jump right in**, and record the answer with `manage`, `action: "guide"`, `guide: "on"` or `"off"`.
90
+
91
+ ## 10. Models for the agents
92
+
93
+ Last, and optional: offer to choose the models for BuildKeel's agents. Call `query` with `view: "models"`, and ask, with your tool for asking a question with choices, as its last line says: **Keep the defaults** first, then **Choose models now**; where the result says choosing comes first (on Pi), **Choose models now** first. If the user chooses models, go on as /bk-models does. Keeping the defaults changes nothing.
94
+
95
+ Do not create or edit any BuildKeel files yourself; the `manage` tool does all of it. If `manage` reports a problem, show it with its fix and ask how to continue.