@kata-sh/cli 0.1.0 → 0.1.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 (199) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/dist/app-paths.d.ts +4 -0
  4. package/dist/app-paths.js +6 -0
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +56 -0
  7. package/dist/loader.d.ts +2 -0
  8. package/dist/loader.js +95 -0
  9. package/dist/resource-loader.d.ts +18 -0
  10. package/dist/resource-loader.js +50 -0
  11. package/dist/wizard.d.ts +15 -0
  12. package/dist/wizard.js +159 -0
  13. package/package.json +50 -21
  14. package/pkg/dist/modes/interactive/theme/dark.json +85 -0
  15. package/pkg/dist/modes/interactive/theme/light.json +84 -0
  16. package/pkg/dist/modes/interactive/theme/theme-schema.json +335 -0
  17. package/pkg/dist/modes/interactive/theme/theme.d.ts +78 -0
  18. package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  19. package/pkg/dist/modes/interactive/theme/theme.js +949 -0
  20. package/pkg/dist/modes/interactive/theme/theme.js.map +1 -0
  21. package/pkg/package.json +8 -0
  22. package/scripts/postinstall.js +45 -0
  23. package/src/resources/AGENTS.md +108 -0
  24. package/src/resources/KATA-WORKFLOW.md +661 -0
  25. package/src/resources/agents/researcher.md +29 -0
  26. package/src/resources/agents/scout.md +56 -0
  27. package/src/resources/agents/worker.md +31 -0
  28. package/src/resources/extensions/ask-user-questions.ts +200 -0
  29. package/src/resources/extensions/bg-shell/index.ts +2758 -0
  30. package/src/resources/extensions/browser-tools/BROWSER-TOOLS-V2-PROPOSAL.md +1277 -0
  31. package/src/resources/extensions/browser-tools/core.js +1057 -0
  32. package/src/resources/extensions/browser-tools/index.ts +4916 -0
  33. package/src/resources/extensions/browser-tools/package.json +20 -0
  34. package/src/resources/extensions/context7/index.ts +428 -0
  35. package/src/resources/extensions/context7/package.json +11 -0
  36. package/src/resources/extensions/get-secrets-from-user.ts +352 -0
  37. package/src/resources/extensions/github/formatters.ts +207 -0
  38. package/src/resources/extensions/github/gh-api.ts +537 -0
  39. package/src/resources/extensions/github/index.ts +778 -0
  40. package/src/resources/extensions/kata/activity-log.ts +88 -0
  41. package/src/resources/extensions/kata/auto.ts +2786 -0
  42. package/src/resources/extensions/kata/commands.ts +355 -0
  43. package/src/resources/extensions/kata/crash-recovery.ts +85 -0
  44. package/src/resources/extensions/kata/dashboard-overlay.ts +516 -0
  45. package/src/resources/extensions/kata/docs/preferences-reference.md +103 -0
  46. package/src/resources/extensions/kata/doctor.ts +683 -0
  47. package/src/resources/extensions/kata/files.ts +730 -0
  48. package/src/resources/extensions/kata/gitignore.ts +165 -0
  49. package/src/resources/extensions/kata/guided-flow.ts +976 -0
  50. package/src/resources/extensions/kata/index.ts +556 -0
  51. package/src/resources/extensions/kata/metrics.ts +397 -0
  52. package/src/resources/extensions/kata/observability-validator.ts +408 -0
  53. package/src/resources/extensions/kata/package.json +11 -0
  54. package/src/resources/extensions/kata/paths.ts +346 -0
  55. package/src/resources/extensions/kata/preferences.ts +695 -0
  56. package/src/resources/extensions/kata/prompt-loader.ts +50 -0
  57. package/src/resources/extensions/kata/prompts/complete-milestone.md +25 -0
  58. package/src/resources/extensions/kata/prompts/complete-slice.md +27 -0
  59. package/src/resources/extensions/kata/prompts/discuss.md +151 -0
  60. package/src/resources/extensions/kata/prompts/doctor-heal.md +29 -0
  61. package/src/resources/extensions/kata/prompts/execute-task.md +64 -0
  62. package/src/resources/extensions/kata/prompts/guided-complete-slice.md +1 -0
  63. package/src/resources/extensions/kata/prompts/guided-discuss-milestone.md +3 -0
  64. package/src/resources/extensions/kata/prompts/guided-discuss-slice.md +59 -0
  65. package/src/resources/extensions/kata/prompts/guided-execute-task.md +1 -0
  66. package/src/resources/extensions/kata/prompts/guided-plan-milestone.md +23 -0
  67. package/src/resources/extensions/kata/prompts/guided-plan-slice.md +1 -0
  68. package/src/resources/extensions/kata/prompts/guided-research-slice.md +11 -0
  69. package/src/resources/extensions/kata/prompts/guided-resume-task.md +1 -0
  70. package/src/resources/extensions/kata/prompts/plan-milestone.md +47 -0
  71. package/src/resources/extensions/kata/prompts/plan-slice.md +63 -0
  72. package/src/resources/extensions/kata/prompts/queue.md +85 -0
  73. package/src/resources/extensions/kata/prompts/reassess-roadmap.md +48 -0
  74. package/src/resources/extensions/kata/prompts/replan-slice.md +39 -0
  75. package/src/resources/extensions/kata/prompts/research-milestone.md +37 -0
  76. package/src/resources/extensions/kata/prompts/research-slice.md +28 -0
  77. package/src/resources/extensions/kata/prompts/run-uat.md +109 -0
  78. package/src/resources/extensions/kata/prompts/system.md +341 -0
  79. package/src/resources/extensions/kata/session-forensics.ts +550 -0
  80. package/src/resources/extensions/kata/skill-discovery.ts +137 -0
  81. package/src/resources/extensions/kata/state.ts +509 -0
  82. package/src/resources/extensions/kata/templates/context.md +76 -0
  83. package/src/resources/extensions/kata/templates/decisions.md +8 -0
  84. package/src/resources/extensions/kata/templates/milestone-summary.md +73 -0
  85. package/src/resources/extensions/kata/templates/plan.md +133 -0
  86. package/src/resources/extensions/kata/templates/preferences.md +15 -0
  87. package/src/resources/extensions/kata/templates/project.md +31 -0
  88. package/src/resources/extensions/kata/templates/reassessment.md +28 -0
  89. package/src/resources/extensions/kata/templates/requirements.md +81 -0
  90. package/src/resources/extensions/kata/templates/research.md +46 -0
  91. package/src/resources/extensions/kata/templates/roadmap.md +118 -0
  92. package/src/resources/extensions/kata/templates/slice-context.md +58 -0
  93. package/src/resources/extensions/kata/templates/slice-summary.md +99 -0
  94. package/src/resources/extensions/kata/templates/state.md +19 -0
  95. package/src/resources/extensions/kata/templates/task-plan.md +52 -0
  96. package/src/resources/extensions/kata/templates/task-summary.md +57 -0
  97. package/src/resources/extensions/kata/templates/uat.md +54 -0
  98. package/src/resources/extensions/kata/tests/activity-log-prune.test.ts +327 -0
  99. package/src/resources/extensions/kata/tests/auto-preflight.test.ts +97 -0
  100. package/src/resources/extensions/kata/tests/auto-supervisor.test.mjs +53 -0
  101. package/src/resources/extensions/kata/tests/complete-milestone.test.ts +317 -0
  102. package/src/resources/extensions/kata/tests/cost-projection.test.ts +160 -0
  103. package/src/resources/extensions/kata/tests/derive-state-deps.test.ts +477 -0
  104. package/src/resources/extensions/kata/tests/derive-state.test.ts +1013 -0
  105. package/src/resources/extensions/kata/tests/doctor.test.ts +718 -0
  106. package/src/resources/extensions/kata/tests/idle-recovery.test.ts +490 -0
  107. package/src/resources/extensions/kata/tests/metrics-io.test.ts +254 -0
  108. package/src/resources/extensions/kata/tests/metrics.test.ts +217 -0
  109. package/src/resources/extensions/kata/tests/must-have-parser.test.ts +309 -0
  110. package/src/resources/extensions/kata/tests/parsers.test.ts +1257 -0
  111. package/src/resources/extensions/kata/tests/plan-milestone.test.ts +185 -0
  112. package/src/resources/extensions/kata/tests/plan-quality-validator.test.ts +386 -0
  113. package/src/resources/extensions/kata/tests/reassess-prompt.test.ts +208 -0
  114. package/src/resources/extensions/kata/tests/replan-slice.test.ts +686 -0
  115. package/src/resources/extensions/kata/tests/requirements.test.ts +151 -0
  116. package/src/resources/extensions/kata/tests/resolve-ts-hooks.mjs +17 -0
  117. package/src/resources/extensions/kata/tests/resolve-ts.mjs +11 -0
  118. package/src/resources/extensions/kata/tests/run-uat.test.ts +383 -0
  119. package/src/resources/extensions/kata/tests/unit-runtime.test.ts +388 -0
  120. package/src/resources/extensions/kata/tests/workspace-index.test.ts +118 -0
  121. package/src/resources/extensions/kata/tests/worktree.test.ts +222 -0
  122. package/src/resources/extensions/kata/types.ts +159 -0
  123. package/src/resources/extensions/kata/unit-runtime.ts +163 -0
  124. package/src/resources/extensions/kata/workspace-index.ts +203 -0
  125. package/src/resources/extensions/kata/worktree.ts +182 -0
  126. package/src/resources/extensions/mac-tools/index.ts +852 -0
  127. package/src/resources/extensions/mac-tools/swift-cli/Package.swift +22 -0
  128. package/src/resources/extensions/mac-tools/swift-cli/Sources/main.swift +1318 -0
  129. package/src/resources/extensions/search-the-web/cache.ts +78 -0
  130. package/src/resources/extensions/search-the-web/format.ts +258 -0
  131. package/src/resources/extensions/search-the-web/http.ts +238 -0
  132. package/src/resources/extensions/search-the-web/index.ts +68 -0
  133. package/src/resources/extensions/search-the-web/tool-fetch-page.ts +519 -0
  134. package/src/resources/extensions/search-the-web/tool-llm-context.ts +404 -0
  135. package/src/resources/extensions/search-the-web/tool-search.ts +503 -0
  136. package/src/resources/extensions/search-the-web/url-utils.ts +91 -0
  137. package/src/resources/extensions/shared/confirm-ui.ts +126 -0
  138. package/src/resources/extensions/shared/interview-ui.ts +822 -0
  139. package/src/resources/extensions/shared/next-action-ui.ts +235 -0
  140. package/src/resources/extensions/shared/progress-widget.ts +282 -0
  141. package/src/resources/extensions/shared/thinking-widget.ts +107 -0
  142. package/src/resources/extensions/shared/ui.ts +400 -0
  143. package/src/resources/extensions/shared/wizard-ui.ts +551 -0
  144. package/src/resources/extensions/slash-commands/audit.ts +92 -0
  145. package/src/resources/extensions/slash-commands/create-extension.ts +375 -0
  146. package/src/resources/extensions/slash-commands/create-slash-command.ts +280 -0
  147. package/src/resources/extensions/slash-commands/index.ts +12 -0
  148. package/src/resources/extensions/slash-commands/kata-run.ts +34 -0
  149. package/src/resources/extensions/subagent/agents.ts +126 -0
  150. package/src/resources/extensions/subagent/index.ts +1293 -0
  151. package/src/resources/skills/debug-like-expert/SKILL.md +231 -0
  152. package/src/resources/skills/debug-like-expert/references/debugging-mindset.md +253 -0
  153. package/src/resources/skills/debug-like-expert/references/hypothesis-testing.md +373 -0
  154. package/src/resources/skills/debug-like-expert/references/investigation-techniques.md +337 -0
  155. package/src/resources/skills/debug-like-expert/references/verification-patterns.md +425 -0
  156. package/src/resources/skills/debug-like-expert/references/when-to-research.md +361 -0
  157. package/src/resources/skills/frontend-design/SKILL.md +45 -0
  158. package/src/resources/skills/swiftui/SKILL.md +208 -0
  159. package/src/resources/skills/swiftui/references/animations.md +921 -0
  160. package/src/resources/skills/swiftui/references/architecture.md +1561 -0
  161. package/src/resources/skills/swiftui/references/layout-system.md +1186 -0
  162. package/src/resources/skills/swiftui/references/navigation.md +1492 -0
  163. package/src/resources/skills/swiftui/references/networking-async.md +214 -0
  164. package/src/resources/skills/swiftui/references/performance.md +1706 -0
  165. package/src/resources/skills/swiftui/references/platform-integration.md +204 -0
  166. package/src/resources/skills/swiftui/references/state-management.md +1443 -0
  167. package/src/resources/skills/swiftui/references/swiftdata.md +297 -0
  168. package/src/resources/skills/swiftui/references/testing-debugging.md +247 -0
  169. package/src/resources/skills/swiftui/references/uikit-appkit-interop.md +218 -0
  170. package/src/resources/skills/swiftui/workflows/add-feature.md +191 -0
  171. package/src/resources/skills/swiftui/workflows/build-new-app.md +311 -0
  172. package/src/resources/skills/swiftui/workflows/debug-swiftui.md +192 -0
  173. package/src/resources/skills/swiftui/workflows/optimize-performance.md +197 -0
  174. package/src/resources/skills/swiftui/workflows/ship-app.md +203 -0
  175. package/src/resources/skills/swiftui/workflows/write-tests.md +235 -0
  176. package/dist/commands/task.d.ts +0 -9
  177. package/dist/commands/task.d.ts.map +0 -1
  178. package/dist/commands/task.js +0 -129
  179. package/dist/commands/task.js.map +0 -1
  180. package/dist/commands/task.test.d.ts +0 -2
  181. package/dist/commands/task.test.d.ts.map +0 -1
  182. package/dist/commands/task.test.js +0 -169
  183. package/dist/commands/task.test.js.map +0 -1
  184. package/dist/e2e/task-e2e.test.d.ts +0 -2
  185. package/dist/e2e/task-e2e.test.d.ts.map +0 -1
  186. package/dist/e2e/task-e2e.test.js +0 -173
  187. package/dist/e2e/task-e2e.test.js.map +0 -1
  188. package/dist/index.d.ts +0 -3
  189. package/dist/index.d.ts.map +0 -1
  190. package/dist/index.js +0 -93
  191. package/dist/index.js.map +0 -1
  192. package/dist/slug.d.ts +0 -2
  193. package/dist/slug.d.ts.map +0 -1
  194. package/dist/slug.js +0 -12
  195. package/dist/slug.js.map +0 -1
  196. package/dist/slug.test.d.ts +0 -2
  197. package/dist/slug.test.d.ts.map +0 -1
  198. package/dist/slug.test.js +0 -32
  199. package/dist/slug.test.js.map +0 -1
@@ -0,0 +1,661 @@
1
+ # Kata Workflow — Manual Bootstrap Protocol
2
+
3
+ > This document teaches you how to operate the Kata planning methodology manually using files on disk.
4
+ >
5
+ > **When to read this:** At the start of any session working on Kata-managed work, or when told `read @KATA-WORKFLOW.md`.
6
+ >
7
+ > **After reading this, always read `.kata/state.md` to find out what's next.**
8
+ > If the milestone has a `context.md`, read that too — it contains project-specific decisions, reference paths, and implementation guidance that this generic methodology doc does not.
9
+
10
+ ---
11
+
12
+ ## Quick Start: "What's next?"
13
+
14
+ Read these files in order and act on what they say:
15
+
16
+ 1. **`.kata/state.md`** — Where are we? What's the next action?
17
+ 2. **`.kata/milestones/<active>/roadmap.md`** — What's the plan? Which slices are done? (state.md tells you which milestone is active)
18
+ 3. **`.kata/milestones/<active>/context.md`** — Project-specific decisions, reference paths, constraints. Read this before doing implementation work.
19
+ 4. If a slice is active, read its **`plan.md`** — Which tasks exist? Which are done?
20
+ 5. If a task was interrupted, check for **`continue.md`** in the active slice directory — Resume from there.
21
+
22
+ Then do the thing `state.md` says to do next.
23
+
24
+ ---
25
+
26
+ ## The Hierarchy
27
+
28
+ ```
29
+ Milestone → a shippable version (4-10 slices)
30
+ Slice → one demoable vertical capability (1-7 tasks)
31
+ Task → one context-window-sized unit of work (fits in one session)
32
+ ```
33
+
34
+ **The iron rule:** A task MUST fit in one context window. If it can't, it's two tasks.
35
+
36
+ ---
37
+
38
+ ## File Locations
39
+
40
+ All artifacts live in `.kata/` at the project root:
41
+
42
+ ```
43
+ .kata/
44
+ state.md # Dashboard — always read first
45
+ decisions.md # Append-only decisions register
46
+ milestones/
47
+ M001/
48
+ roadmap.md # Milestone plan (checkboxes = state)
49
+ context.md # Optional: user decisions from discuss phase
50
+ research.md # Optional: codebase/tech research
51
+ summary.md # Milestone rollup (updated as slices complete)
52
+ slices/
53
+ S01/
54
+ plan.md # Task decomposition for this slice
55
+ context.md # Optional: slice-level user decisions
56
+ research.md # Optional: slice-level research
57
+ summary.md # Slice summary (written on completion)
58
+ uat.md # Non-blocking human test script (written on completion)
59
+ continue.md # Ephemeral: resume point if interrupted
60
+ tasks/
61
+ T01-plan.md # Individual task plan
62
+ T01-summary.md # Task summary with frontmatter
63
+ ```
64
+
65
+ ---
66
+
67
+ ## File Format Reference
68
+
69
+ ### `roadmap.md`
70
+
71
+ ```markdown
72
+ # M001: Title of the Milestone
73
+
74
+ **Vision:** One paragraph describing what this milestone delivers.
75
+
76
+ **Success Criteria:**
77
+ - Observable outcome 1
78
+ - Observable outcome 2
79
+
80
+ ---
81
+
82
+ ## Slices
83
+
84
+ - [ ] **S01: Slice Title** `risk:low` `depends:[]`
85
+ > After this: what the user can demo when this slice is done.
86
+
87
+ - [ ] **S02: Another Slice** `risk:medium` `depends:[S01]`
88
+ > After this: demo sentence.
89
+
90
+ - [x] **S03: Completed Slice** `risk:low` `depends:[S01]`
91
+ > After this: demo sentence.
92
+ ```
93
+
94
+ **Parsing rules:** `- [x]` = done, `- [ ]` = not done. The `risk:` and `depends:[]` tags are inline metadata parsed from the line. `depends:[]` lists slice IDs this slice requires to be complete first.
95
+
96
+ **Boundary Map** (required section in roadmap.md):
97
+
98
+ After the slices section, include a `## Boundary Map` that shows what each slice produces and consumes:
99
+
100
+ ```markdown
101
+ ## Boundary Map
102
+
103
+ ### S01 → S02
104
+ Produces:
105
+ types.ts → User, Session, AuthToken (interfaces)
106
+ auth.ts → generateToken(), verifyToken(), refreshToken()
107
+
108
+ Consumes: nothing (leaf node)
109
+
110
+ ### S02 → S03
111
+ Produces:
112
+ api/auth/login.ts → POST handler
113
+ api/auth/signup.ts → POST handler
114
+ middleware.ts → authMiddleware()
115
+
116
+ Consumes from S01:
117
+ auth.ts → generateToken(), verifyToken()
118
+ ```
119
+
120
+ The boundary map is a **planning artifact** — not runnable code. It:
121
+ - Forces upfront thinking about slice boundaries before implementation
122
+ - Gives downstream slices a concrete target to code against
123
+ - Enables deterministic verification that slices actually connect
124
+ - Gets updated during slice planning if new interfaces emerge
125
+
126
+ ### `plan.md` (slice-level)
127
+
128
+ ```markdown
129
+ # S01: Slice Title
130
+
131
+ **Goal:** What this slice achieves.
132
+ **Demo:** What the user can see/do when this is done.
133
+
134
+ ## Must-Haves
135
+ - Observable outcome 1 (used for verification)
136
+ - Observable outcome 2
137
+
138
+ ## Tasks
139
+
140
+ - [ ] **T01: Task Title**
141
+ Description of what this task does.
142
+
143
+ - [ ] **T02: Another Task**
144
+ Description.
145
+
146
+ ## Files Likely Touched
147
+ - path/to/file.ts
148
+ - path/to/another.ts
149
+ ```
150
+
151
+ ### `TNN-plan.md` (task-level)
152
+
153
+ ```markdown
154
+ # T01: Task Title
155
+
156
+ **Slice:** S01
157
+ **Milestone:** M001
158
+
159
+ ## Goal
160
+ What this task accomplishes in one sentence.
161
+
162
+ ## Must-Haves
163
+
164
+ ### Truths
165
+ Observable behaviors that must be true when this task is done:
166
+ - "User can sign up with email and password"
167
+ - "Login returns a JWT token"
168
+
169
+ ### Artifacts
170
+ Files that must exist with real implementation (not stubs):
171
+ - `src/lib/auth.ts` — JWT helpers (min 30 lines, exports: generateToken, verifyToken)
172
+ - `src/app/api/auth/login/route.ts` — Login endpoint (exports: POST)
173
+
174
+ ### Key Links
175
+ Critical wiring between artifacts:
176
+ - `login/route.ts` → `auth.ts` via import of `generateToken`
177
+ - `middleware.ts` → `auth.ts` via import of `verifyToken`
178
+
179
+ ## Steps
180
+ 1. First thing to do
181
+ 2. Second thing to do
182
+ 3. Third thing to do
183
+
184
+ ## Context
185
+ - Relevant prior decisions or patterns to follow
186
+ - Key files to read before starting
187
+ ```
188
+
189
+ **Must-haves are what make verification mechanically checkable.** Truths are checked by running commands or reading output. Artifacts are checked by confirming files exist with real content. Key links are checked by confirming imports/references actually connect the pieces.
190
+
191
+ ### `state.md`
192
+
193
+ ```markdown
194
+ # Kata State
195
+
196
+ **Active Milestone:** M001 — Title
197
+ **Active Slice:** S02 — Slice Title
198
+ **Active Task:** T01 — Task Title
199
+ **Phase:** Executing
200
+
201
+ ## Recent Decisions
202
+ - Decision 1
203
+ - Decision 2
204
+
205
+ ## Blockers
206
+ - None (or list blockers)
207
+
208
+ ## Next Action
209
+ Exact next thing to do.
210
+ ```
211
+
212
+ ### `context.md` (from discuss phase)
213
+
214
+ ```markdown
215
+ # S01: Slice Title — Context
216
+
217
+ **Gathered:** 2026-03-07
218
+ **Status:** Ready for planning
219
+
220
+ ## Implementation Decisions
221
+ - Decision on gray area 1
222
+ - Decision on gray area 2
223
+
224
+ ## Agent's Discretion
225
+ - Areas where the user said "you decide"
226
+
227
+ ## Deferred Ideas
228
+ - Ideas that came up but belong in other slices
229
+ ```
230
+
231
+ ### `decisions.md` (append-only register)
232
+
233
+ ```markdown
234
+ # Decisions Register
235
+
236
+ <!-- Append-only. Never edit or remove existing rows.
237
+ To reverse a decision, add a new row that supersedes it.
238
+ Read this file at the start of any planning or research phase. -->
239
+
240
+ | # | When | Scope | Decision | Choice | Rationale | Revisable? |
241
+ | ---- | -------- | ---------- | ------------------ | --------------------------- | ---------------------------------------- | --------------------- |
242
+ | D001 | M001/S01 | library | Validation library | Zod | Type inference, already in deps | No |
243
+ | D002 | M001/S01 | arch | Session storage | HTTP-only cookies | Security, SSR compat | Yes — if mobile added |
244
+ | D003 | M001/S02 | api | API versioning | URL prefix /v1 | Simple, fits scale | Yes |
245
+ | D004 | M001/S03 | convention | Error format | RFC 7807 | Standard, client-friendly | No |
246
+ | D005 | M002/S01 | arch | Session storage | JWT in Authorization header | Mobile client needs it (supersedes D002) | No |
247
+ ```
248
+
249
+ **Rules:**
250
+ - **Append-only** — rows are never edited or removed. To reverse a decision, add a new row that supersedes it (reference the old ID).
251
+ - **#** — Sequential ID (`D001`, `D002`, ...), never reused.
252
+ - **When** — Where the decision was made: `M001`, `M001/S01`, or `M001/S01/T02`.
253
+ - **Scope** — Category tag: `arch`, `pattern`, `library`, `data`, `api`, `scope`, `convention`.
254
+ - **Revisable?** — `No`, or `Yes — trigger condition`.
255
+
256
+ **When to read:** At the start of any planning or research phase.
257
+ **When to write:** During discussion (seed from context), during planning (structural choices), during task execution (if an architectural choice was made), and during slice completion (catch-all for missed decisions).
258
+
259
+ ---
260
+
261
+ ## The Phases
262
+
263
+ Work flows through these phases. Each phase produces a file.
264
+
265
+ ### Phase 1: Discuss (Optional)
266
+
267
+ **Purpose:** Capture user decisions on gray areas before planning.
268
+ **Produces:** `context.md` at milestone or slice level.
269
+ **When to use:** When the scope has ambiguities the user should weigh in on.
270
+ **When to skip:** When the user already knows exactly what they want, or told you to just go.
271
+
272
+ **How to do it manually:**
273
+ 1. Read the roadmap to understand the scope.
274
+ 2. Identify 3-5 gray areas — implementation decisions the user cares about.
275
+ 3. Use `ask_user_questions` to discuss each area.
276
+ 4. Write decisions to `context.md`.
277
+ 5. Do NOT discuss how to implement — only what the user wants.
278
+
279
+ ### Phase 2: Research (Optional)
280
+
281
+ **Purpose:** Scout the codebase and relevant docs before planning.
282
+ **Produces:** `research.md` at milestone or slice level.
283
+ **When to use:** When working in unfamiliar code, with unfamiliar libraries, or on complex integrations.
284
+ **When to skip:** When the codebase is familiar and the work is straightforward.
285
+
286
+ **How to do it manually:**
287
+ 1. Read `context.md` if it exists — know what decisions are locked.
288
+ 2. Scout relevant code: `rg`, `find`, read key files.
289
+ 3. Use `resolve_library` / `get_library_docs` if needed.
290
+ 4. Write findings to `research.md` with these sections:
291
+
292
+ ```markdown
293
+ # S01: Slice Title — Research
294
+
295
+ **Researched:** 2026-03-07
296
+ **Domain:** Primary technology/problem domain
297
+ **Confidence:** HIGH/MEDIUM/LOW
298
+
299
+ ## Summary
300
+ 2-3 paragraph executive summary. Primary recommendation.
301
+
302
+ ## Don't Hand-Roll
303
+ | Problem | Don't Build | Use Instead | Why |
304
+ | ------- | ----------- | ----------- | --- |
305
+ Problems that look simple but have existing solutions.
306
+
307
+ ## Common Pitfalls
308
+ ### Pitfall 1: Name
309
+ **What goes wrong:** ...
310
+ **Why it happens:** ...
311
+ **How to avoid:** ...
312
+ **Warning signs:** ...
313
+
314
+ ## Relevant Code
315
+ Existing files, patterns, reusable assets, integration points.
316
+
317
+ ## Sources
318
+ - Context7: /library/id — topics fetched (HIGH confidence)
319
+ - WebSearch: finding — verified against docs (MEDIUM confidence)
320
+ ```
321
+
322
+ The **Don't Hand-Roll** and **Common Pitfalls** sections prevent the most expensive mistakes.
323
+
324
+ ### Phase 3: Plan
325
+
326
+ **Purpose:** Decompose work into context-window-sized tasks with must-haves.
327
+ **Produces:** `plan.md` + individual `T01-plan.md` files.
328
+
329
+ **For a milestone (roadmap):**
330
+ 1. Read `context.md`, `research.md`, and `.kata/decisions.md` if they exist.
331
+ 2. Decompose the vision into 4-10 demoable vertical slices.
332
+ 3. Order by risk (high-risk first to validate feasibility early).
333
+ 4. Write `roadmap.md` with checkboxes, risk levels, dependencies, demo sentences.
334
+ 5. **Write the boundary map** — for each slice, specify what it produces (functions, types, interfaces, endpoints) and what it consumes from upstream slices. This forces interface thinking before implementation and enables deterministic verification that slices actually connect.
335
+
336
+ **For a slice (task decomposition):**
337
+ 1. Read the slice's entry in `roadmap.md` **and its boundary map section** — know what interfaces this slice must produce and consume.
338
+ 2. Read `context.md`, `research.md`, and `.kata/decisions.md` if they exist for this slice.
339
+ 3. Read summaries from dependency slices (check `depends:[]` in roadmap).
340
+ 4. Verify that upstream slices' actual outputs match what the boundary map says this slice consumes. If they diverge, update the boundary map.
341
+ 5. Decompose into 1-7 tasks, each fitting one context window.
342
+ 6. Each task needs: title, description, steps (3-10), must-haves (observable verification criteria).
343
+ 7. Must-haves should reference boundary map contracts — e.g. "exports `generateToken()` as specified in boundary map S01→S02".
344
+ 8. Write `plan.md` and individual `TNN-plan.md` files.
345
+
346
+ ### Phase 4: Execute
347
+
348
+ **Purpose:** Do the work for one task.
349
+ **Produces:** Code changes + `[DONE:n]` markers.
350
+
351
+ **How to do it manually:**
352
+ 1. Read the task's `TNN-plan.md`.
353
+ 2. Read relevant summaries from prior tasks (for context on what's already built).
354
+ 3. Execute each step. Mark progress with `[DONE:n]` in responses.
355
+ 4. If you made an architectural, pattern, or library decision, append it to `.kata/decisions.md`.
356
+ 5. If interrupted or context is getting full, write `continue.md` (see below).
357
+
358
+ ### Phase 5: Verify
359
+
360
+ **Purpose:** Check that the task's must-haves are actually met.
361
+ **Produces:** Pass/fail determination.
362
+
363
+ **Verification ladder — use the strongest tier you can reach:**
364
+ 1. **Static:** Files exist, exports present, wiring connected, not stubs.
365
+ 2. **Command:** Tests pass, build succeeds, lint clean, blocked command works.
366
+ 3. **Behavioral:** Browser flows work, API responses correct.
367
+ 4. **Human:** Ask the user only when you genuinely can't verify yourself.
368
+
369
+ **The rule:** "All steps done" is NOT verification. Check the actual outcomes.
370
+
371
+ **Verification report format** (written into the summary or surfaced on failure):
372
+
373
+ ```
374
+ ### Observable Truths
375
+ | # | Truth | Status | Evidence |
376
+ | --- | ----------------- | ------ | --------------------------------- |
377
+ | 1 | User can sign up | ✓ PASS | POST /api/auth/signup returns 201 |
378
+ | 2 | Login returns JWT | ✗ FAIL | Returns 500 — missing env var |
379
+
380
+ ### Artifacts
381
+ | File | Expected | Status | Evidence |
382
+ | ---------------- | ------------------------- | ------------- | --------------------------------------- |
383
+ | src/lib/auth.ts | JWT helpers, min 30 lines | ✓ SUBSTANTIVE | 87 lines, exports generateTokens |
384
+ | src/lib/email.ts | Email sending | ✗ STUB | 8 lines, console.log instead of sending |
385
+
386
+ ### Key Links
387
+ | From | To | Via | Status |
388
+ | -------------- | ---------- | --------------------- | ----------- |
389
+ | login/route.ts | auth.ts | import generateTokens | ✓ WIRED |
390
+ | email.ts | Resend API | resend.emails.send() | ✗ NOT WIRED |
391
+
392
+ ### Anti-Patterns Found
393
+ | File | Line | Pattern | Severity |
394
+ | ---------------- | ---- | ---------------- | --------- |
395
+ | src/lib/email.ts | 5 | console.log stub | 🛑 Blocker |
396
+ ```
397
+
398
+ When verification finds gaps, include a **Gaps** section with what's missing, impact, and suggested fix.
399
+
400
+ ### Phase 6: Summarize
401
+
402
+ **Purpose:** Record what happened for downstream tasks.
403
+ **Produces:** `TNN-summary.md`, and when slice completes, `summary.md`.
404
+
405
+ **Task summary format:**
406
+ ```markdown
407
+ ---
408
+ id: T01
409
+ parent: S01
410
+ milestone: M001
411
+ provides:
412
+ - What this task built (~5 items)
413
+ requires:
414
+ - slice: S00
415
+ provides: What that prior slice built that this task used
416
+ affects: [S02, S03]
417
+ key_files:
418
+ - path/to/important/file.ts
419
+ key_decisions:
420
+ - "Decision made: reasoning"
421
+ patterns_established:
422
+ - "Pattern name and where it lives"
423
+ drill_down_paths:
424
+ - .kata/milestones/M001/slices/S01/tasks/T01-plan.md
425
+ duration: 15min
426
+ verification_result: pass
427
+ completed_at: 2026-03-07T16:00:00Z
428
+ ---
429
+
430
+ # T01: Task Title
431
+
432
+ **Substantive one-liner — NOT "task complete" but what actually shipped**
433
+
434
+ ## What Happened
435
+
436
+ Concise prose narrative of what was built, why key decisions were made,
437
+ and what matters for future work.
438
+
439
+ ## Deviations
440
+ What differed from the plan and why (or "None").
441
+
442
+ ## Files Created/Modified
443
+ - `path/to/file.ts` — What it does
444
+ ```
445
+
446
+ The one-liner must be substantive: "JWT auth with refresh rotation using jose" not "Authentication implemented."
447
+
448
+ **Slice summary:** Written when all tasks in a slice complete. Compresses all task summaries. Includes `drill_down_paths` to each task summary. During slice completion, review task summaries for `key_decisions` and ensure any significant ones are captured in `.kata/decisions.md`.
449
+
450
+ **Milestone summary:** Updated each time a slice completes. Compresses all slice summaries. This is what gets injected into later slice planning instead of loading many individual summaries.
451
+
452
+ ### Phase 7: Advance
453
+
454
+ **Purpose:** Mark work done and move to the next thing.
455
+
456
+ **After a task completes:**
457
+ 1. Mark the task done in `plan.md` (checkbox).
458
+ 2. Check if there's a next task in the slice → execute it.
459
+ 3. If slice is complete → write slice summary, mark slice done in `roadmap.md`.
460
+
461
+ **After a slice completes:**
462
+ 1. Write slice `summary.md` (compresses all task summaries).
463
+ 2. Write slice `uat.md` — a non-blocking human test script derived from the slice's must-haves and demo sentence. The agent does NOT wait for UAT results.
464
+ 3. Mark the slice checkbox in `roadmap.md` as `[x]`.
465
+ 4. Update `state.md` with new position.
466
+ 5. Update milestone `summary.md` with the completed slice's contributions.
467
+ 6. Continue to next slice immediately. The user tests the UAT whenever convenient.
468
+ 7. If the user reports UAT failures later, create fix tasks in the current or a new slice.
469
+ 8. If all slices done → milestone complete.
470
+
471
+ ---
472
+
473
+ ## Continue-Here Protocol
474
+
475
+ **When to write `continue.md`:**
476
+ - You're about to lose context (compaction, session end, Ctrl+C).
477
+ - The current task isn't done yet.
478
+ - You want to pause and come back later.
479
+
480
+ **What to capture:**
481
+ ```markdown
482
+ ---
483
+ milestone: M001
484
+ slice: S01
485
+ task: T02
486
+ step: 3
487
+ total_steps: 7
488
+ saved_at: 2026-03-07T15:30:00Z
489
+ ---
490
+
491
+ ## Completed Work
492
+ - What's already done in this task and prior tasks in the slice.
493
+
494
+ ## Remaining Work
495
+ - What steps remain, with enough detail to resume.
496
+
497
+ ## Decisions Made
498
+ - Key decisions and WHY (so next session doesn't re-debate).
499
+
500
+ ## Context
501
+ The "vibe" — what you were thinking, what's tricky, what to watch out for.
502
+
503
+ ## Next Action
504
+ The EXACT first thing to do when resuming. Not vague. Specific.
505
+ ```
506
+
507
+ **How to resume:**
508
+ 1. Read `continue.md`.
509
+ 2. Delete `continue.md` (it's consumed, not permanent).
510
+ 3. Pick up from "Next Action".
511
+
512
+ ---
513
+
514
+ ## State Management
515
+
516
+ ### `state.md` is a derived cache
517
+
518
+ It is NOT the source of truth. It's a convenience dashboard.
519
+
520
+ **Sources of truth:**
521
+ - `roadmap.md` → which slices exist and which are done
522
+ - `plan.md` → which tasks exist within a slice
523
+ - `TNN-summary.md` → what happened during a task
524
+ - `summary.md` (slice/milestone) → compressed outcomes
525
+
526
+ **Update `state.md`** after every significant action:
527
+ - Active milestone/slice/task
528
+ - Recent decisions (last 3-5)
529
+ - Blockers
530
+ - Next action (most important — this is what a fresh session reads first)
531
+
532
+ ### Reconciliation
533
+
534
+ If files disagree, **pause and surface to the user**:
535
+ - Roadmap says slice done but task summaries missing → inconsistency
536
+ - Task marked done but no summary → treat as incomplete
537
+ - Continue file exists for completed task → delete continue file
538
+ - State points to nonexistent slice/task → rebuild state from files
539
+
540
+ ---
541
+
542
+ ## Git Strategy: Branch-Per-Slice with Squash Merge
543
+
544
+ **Principle:** Main is always clean and working. Each slice gets an isolated branch. The user never runs a git command — the agent handles everything.
545
+
546
+ ### Branch Lifecycle
547
+
548
+ 1. **Slice starts** → create branch `kata/M001/S01` from main
549
+ 2. **Per-task commits** on the branch — atomic, descriptive, bisectable
550
+ 3. **Slice completes** → squash merge to main as one clean commit
551
+ 4. **Branch kept** — not deleted, available for per-task history
552
+
553
+ ### What Main Looks Like
554
+
555
+ ```
556
+ feat(M001/S03): milestone and slice discuss commands
557
+ feat(M001/S02): extension scaffold and command routing
558
+ feat(M001/S01): file I/O foundation
559
+ ```
560
+
561
+ One commit per slice. Individually revertable. Reads like a changelog.
562
+
563
+ ### What the Branch Looks Like
564
+
565
+ ```
566
+ kata/M001/S01:
567
+ test(S01): round-trip tests passing
568
+ feat(S01/T03): file writer with round-trip fidelity
569
+ checkpoint(S01/T03): pre-task
570
+ feat(S01/T02): markdown parser for plan files
571
+ checkpoint(S01/T02): pre-task
572
+ feat(S01/T01): core types and interfaces
573
+ checkpoint(S01/T01): pre-task
574
+ ```
575
+
576
+ ### Commit Conventions
577
+
578
+ | When | Format | Example |
579
+ | -------------------- | --------------------------------- | -------------------------- |
580
+ | Before each task | `checkpoint(S01/T02): pre-task` | Safety net for `git reset` |
581
+ | After task verified | `feat(S01/T02): <what was built>` | The real work |
582
+ | Plan/docs committed | `docs(S01): add slice plan` | Bundled with first task |
583
+ | Slice squash to main | `feat(M001/S01): <slice title>` | Clean one-liner on main |
584
+
585
+ Commit types: `feat`, `fix`, `test`, `refactor`, `docs`, `chore`
586
+
587
+ ### Squash Merge Message
588
+
589
+ ```
590
+ feat(M001/S01): file I/O foundation
591
+
592
+ Agent can parse, format, load, and save all Kata file types with round-trip fidelity.
593
+
594
+ Tasks completed:
595
+ - T01: core types and interfaces
596
+ - T02: markdown parser for plan files
597
+ - T03: file writer with round-trip fidelity
598
+ ```
599
+
600
+ ### Rollback
601
+
602
+ | Problem | Fix |
603
+ | ----------------------- | ------------------------------------------------------------------------ |
604
+ | Bad task | `git reset --hard` to checkpoint on the branch |
605
+ | Bad slice | `git revert <squash commit>` on main |
606
+ | UAT failure after merge | Fix tasks on `kata/M001/S01-fix` branch, squash as `fix(M001/S01): <fix>` |
607
+
608
+ ---
609
+
610
+ ## Summary Injection for Downstream Tasks
611
+
612
+ When planning or executing a task, load relevant prior context:
613
+
614
+ 1. Check the current slice's `depends:[]` in `roadmap.md`.
615
+ 2. Load summaries from those dependency slices.
616
+ 3. Start with the **highest available level** — milestone `summary.md` first.
617
+ 4. Only drill down to slice/task summaries if you need specific detail.
618
+ 5. Stay within **~2500 tokens** of total injected summary context.
619
+ 6. If the dependency chain is too large, drop the oldest/least-relevant summaries first.
620
+
621
+ **Aim for:**
622
+ - ~5 provides per summary
623
+ - ~10 key_files per summary
624
+ - ~5 key_decisions per summary
625
+ - ~3 patterns_established per summary
626
+
627
+ These are soft caps — exceed them when genuinely needed, but don't let summaries become essays.
628
+
629
+ ---
630
+
631
+ ## Project-Specific Context
632
+
633
+ This methodology doc is generic. Project-specific guidance belongs in the milestone's `context.md`:
634
+
635
+ - **`.kata/milestones/<active>/context.md`** — Architecture decisions, reference file paths, per-slice doc reading guides, implementation constraints, and any project-specific protocols (worktrees, testing, etc.)
636
+
637
+ **Always read the active milestone's `context.md` before starting implementation work.** It tells you what decisions are locked, what files to reference, and how to verify your work in this specific project.
638
+
639
+ ---
640
+
641
+ ## Checklist for a Fresh Session
642
+
643
+ 1. Read `.kata/state.md` — what's the next action?
644
+ 2. Check for `continue.md` in the active slice — is there interrupted work?
645
+ 3. If resuming: read `continue.md`, delete it, pick up from "Next Action".
646
+ 4. If starting fresh: read the active slice's `plan.md`, find the next incomplete task.
647
+ 5. If in a planning or research phase, read `.kata/decisions.md` — respect existing decisions.
648
+ 6. Read relevant summaries from prior tasks/slices for context.
649
+ 7. Do the work.
650
+ 8. Verify the must-haves.
651
+ 9. Write the summary.
652
+ 10. Mark done, update `state.md`, advance.
653
+ 11. If context is getting full or you're done for now: write `continue.md` if mid-task, or update `state.md` with next action if between tasks.
654
+
655
+ ## When Context Gets Large
656
+
657
+ If you sense context pressure (many files read, long execution, lots of tool output):
658
+
659
+ 1. **If mid-task:** Write `continue.md` with exact resume state. Tell the user: "Context is getting full. I've saved progress to continue.md. Start a new session and say `read @KATA-WORKFLOW.md - what's next?`"
660
+ 2. **If between tasks:** Just update `state.md` with the next action. No continue file needed — the next session will read state.md and pick up the next task cleanly.
661
+ 3. **Don't fight it.** The whole system is designed for this. A fresh session with the right files loaded is better than a stale session with degraded reasoning.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: researcher
3
+ description: Web researcher that finds and synthesizes current information using Brave Search
4
+ tools: web_search, bash
5
+ ---
6
+
7
+ You are a web researcher. You find current, accurate information using web search and synthesize it into a clear, well-structured report.
8
+
9
+ ## Strategy
10
+
11
+ 1. Search for the topic with 2-3 targeted queries to get breadth
12
+ 2. Synthesize findings into a coherent summary
13
+ 3. Cite sources with URLs
14
+
15
+ ## Output format
16
+
17
+ ## Summary
18
+
19
+ Brief 2-3 sentence overview.
20
+
21
+ ## Key Findings
22
+
23
+ Bullet points of the most important information, each with a source URL.
24
+
25
+ ## Sources
26
+
27
+ Numbered list of sources used with titles and URLs.
28
+
29
+ Be factual. Do not speculate beyond what the sources say. If results conflict, note it.