@kynetic-ai/spec 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/cli/batch-exec.d.ts +0 -9
  2. package/dist/cli/batch-exec.d.ts.map +1 -1
  3. package/dist/cli/batch-exec.js +16 -4
  4. package/dist/cli/batch-exec.js.map +1 -1
  5. package/dist/cli/commands/derive.d.ts.map +1 -1
  6. package/dist/cli/commands/derive.js +2 -1
  7. package/dist/cli/commands/derive.js.map +1 -1
  8. package/dist/cli/commands/guard.d.ts +43 -0
  9. package/dist/cli/commands/guard.d.ts.map +1 -0
  10. package/dist/cli/commands/guard.js +200 -0
  11. package/dist/cli/commands/guard.js.map +1 -0
  12. package/dist/cli/commands/index.d.ts +1 -0
  13. package/dist/cli/commands/index.d.ts.map +1 -1
  14. package/dist/cli/commands/index.js +1 -0
  15. package/dist/cli/commands/index.js.map +1 -1
  16. package/dist/cli/commands/item.d.ts.map +1 -1
  17. package/dist/cli/commands/item.js +18 -0
  18. package/dist/cli/commands/item.js.map +1 -1
  19. package/dist/cli/commands/log.d.ts.map +1 -1
  20. package/dist/cli/commands/log.js +5 -4
  21. package/dist/cli/commands/log.js.map +1 -1
  22. package/dist/cli/commands/meta.d.ts.map +1 -1
  23. package/dist/cli/commands/meta.js +2 -1
  24. package/dist/cli/commands/meta.js.map +1 -1
  25. package/dist/cli/commands/plan-import.d.ts.map +1 -1
  26. package/dist/cli/commands/plan-import.js +100 -30
  27. package/dist/cli/commands/plan-import.js.map +1 -1
  28. package/dist/cli/commands/ralph.d.ts.map +1 -1
  29. package/dist/cli/commands/ralph.js +143 -330
  30. package/dist/cli/commands/ralph.js.map +1 -1
  31. package/dist/cli/commands/session.d.ts +73 -1
  32. package/dist/cli/commands/session.d.ts.map +1 -1
  33. package/dist/cli/commands/session.js +607 -162
  34. package/dist/cli/commands/session.js.map +1 -1
  35. package/dist/cli/commands/setup.d.ts.map +1 -1
  36. package/dist/cli/commands/setup.js +97 -217
  37. package/dist/cli/commands/setup.js.map +1 -1
  38. package/dist/cli/commands/skill-install.d.ts +4 -1
  39. package/dist/cli/commands/skill-install.d.ts.map +1 -1
  40. package/dist/cli/commands/skill-install.js +62 -5
  41. package/dist/cli/commands/skill-install.js.map +1 -1
  42. package/dist/cli/commands/task.d.ts.map +1 -1
  43. package/dist/cli/commands/task.js +128 -59
  44. package/dist/cli/commands/task.js.map +1 -1
  45. package/dist/cli/commands/tasks.d.ts.map +1 -1
  46. package/dist/cli/commands/tasks.js +2 -4
  47. package/dist/cli/commands/tasks.js.map +1 -1
  48. package/dist/cli/commands/triage.d.ts.map +1 -1
  49. package/dist/cli/commands/triage.js +12 -98
  50. package/dist/cli/commands/triage.js.map +1 -1
  51. package/dist/cli/index.d.ts.map +1 -1
  52. package/dist/cli/index.js +2 -1
  53. package/dist/cli/index.js.map +1 -1
  54. package/dist/cli/output.d.ts.map +1 -1
  55. package/dist/cli/output.js +18 -4
  56. package/dist/cli/output.js.map +1 -1
  57. package/dist/daemon/routes/triage.ts +4 -70
  58. package/dist/parser/config.d.ts +106 -0
  59. package/dist/parser/config.d.ts.map +1 -1
  60. package/dist/parser/config.js +47 -0
  61. package/dist/parser/config.js.map +1 -1
  62. package/dist/parser/file-lock.d.ts +14 -0
  63. package/dist/parser/file-lock.d.ts.map +1 -0
  64. package/dist/parser/file-lock.js +124 -0
  65. package/dist/parser/file-lock.js.map +1 -0
  66. package/dist/parser/index.d.ts +1 -0
  67. package/dist/parser/index.d.ts.map +1 -1
  68. package/dist/parser/index.js +1 -0
  69. package/dist/parser/index.js.map +1 -1
  70. package/dist/parser/plan-document.d.ts +44 -0
  71. package/dist/parser/plan-document.d.ts.map +1 -1
  72. package/dist/parser/plan-document.js +76 -8
  73. package/dist/parser/plan-document.js.map +1 -1
  74. package/dist/parser/plans.d.ts.map +1 -1
  75. package/dist/parser/plans.js +28 -102
  76. package/dist/parser/plans.js.map +1 -1
  77. package/dist/parser/shadow.d.ts.map +1 -1
  78. package/dist/parser/shadow.js +11 -7
  79. package/dist/parser/shadow.js.map +1 -1
  80. package/dist/parser/yaml.d.ts.map +1 -1
  81. package/dist/parser/yaml.js +322 -297
  82. package/dist/parser/yaml.js.map +1 -1
  83. package/dist/ralph/events.d.ts.map +1 -1
  84. package/dist/ralph/events.js +24 -0
  85. package/dist/ralph/events.js.map +1 -1
  86. package/dist/ralph/index.d.ts +1 -1
  87. package/dist/ralph/index.d.ts.map +1 -1
  88. package/dist/ralph/index.js +1 -1
  89. package/dist/ralph/index.js.map +1 -1
  90. package/dist/ralph/subagent.d.ts +12 -1
  91. package/dist/ralph/subagent.d.ts.map +1 -1
  92. package/dist/ralph/subagent.js +22 -3
  93. package/dist/ralph/subagent.js.map +1 -1
  94. package/dist/schema/batch.d.ts +2 -0
  95. package/dist/schema/batch.d.ts.map +1 -1
  96. package/dist/schema/common.d.ts +6 -0
  97. package/dist/schema/common.d.ts.map +1 -1
  98. package/dist/schema/common.js +8 -0
  99. package/dist/schema/common.js.map +1 -1
  100. package/dist/schema/task.d.ts +22 -0
  101. package/dist/schema/task.d.ts.map +1 -1
  102. package/dist/schema/task.js +7 -0
  103. package/dist/schema/task.js.map +1 -1
  104. package/dist/sessions/store.d.ts +226 -1
  105. package/dist/sessions/store.d.ts.map +1 -1
  106. package/dist/sessions/store.js +712 -38
  107. package/dist/sessions/store.js.map +1 -1
  108. package/dist/sessions/types.d.ts +51 -2
  109. package/dist/sessions/types.d.ts.map +1 -1
  110. package/dist/sessions/types.js +25 -0
  111. package/dist/sessions/types.js.map +1 -1
  112. package/dist/strings/errors.d.ts +4 -0
  113. package/dist/strings/errors.d.ts.map +1 -1
  114. package/dist/strings/errors.js +2 -0
  115. package/dist/strings/errors.js.map +1 -1
  116. package/dist/strings/labels.d.ts +2 -0
  117. package/dist/strings/labels.d.ts.map +1 -1
  118. package/dist/strings/labels.js +2 -0
  119. package/dist/strings/labels.js.map +1 -1
  120. package/dist/triage/actions.d.ts +27 -0
  121. package/dist/triage/actions.d.ts.map +1 -0
  122. package/dist/triage/actions.js +95 -0
  123. package/dist/triage/actions.js.map +1 -0
  124. package/dist/triage/constants.d.ts +6 -0
  125. package/dist/triage/constants.d.ts.map +1 -0
  126. package/dist/triage/constants.js +7 -0
  127. package/dist/triage/constants.js.map +1 -0
  128. package/dist/triage/index.d.ts +3 -0
  129. package/dist/triage/index.d.ts.map +1 -0
  130. package/dist/triage/index.js +3 -0
  131. package/dist/triage/index.js.map +1 -0
  132. package/dist/utils/git.d.ts +2 -0
  133. package/dist/utils/git.d.ts.map +1 -1
  134. package/dist/utils/git.js +21 -5
  135. package/dist/utils/git.js.map +1 -1
  136. package/package.json +1 -1
  137. package/plugin/.claude-plugin/marketplace.json +1 -1
  138. package/plugin/.claude-plugin/plugin.json +1 -1
  139. package/plugin/plugins/kspec/skills/create-workflow/SKILL.md +235 -0
  140. package/plugin/plugins/kspec/skills/observations/SKILL.md +143 -0
  141. package/plugin/plugins/kspec/skills/plan/SKILL.md +343 -0
  142. package/plugin/plugins/kspec/skills/reflect/SKILL.md +161 -0
  143. package/plugin/plugins/kspec/skills/review/SKILL.md +230 -0
  144. package/plugin/plugins/kspec/skills/task-work/SKILL.md +319 -0
  145. package/plugin/plugins/kspec/skills/triage-automation/SKILL.md +140 -0
  146. package/plugin/plugins/kspec/skills/triage-inbox/SKILL.md +232 -0
  147. package/plugin/plugins/kspec/skills/writing-specs/SKILL.md +354 -0
  148. package/templates/agents-sections/03-task-lifecycle.md +2 -2
  149. package/templates/agents-sections/04-pr-workflow.md +3 -3
  150. package/templates/agents-sections/05-commit-convention.md +14 -0
  151. package/templates/skills/create-workflow/SKILL.md +228 -0
  152. package/templates/skills/manifest.yaml +45 -0
  153. package/templates/skills/observations/SKILL.md +137 -0
  154. package/templates/skills/plan/SKILL.md +336 -0
  155. package/templates/skills/reflect/SKILL.md +155 -0
  156. package/templates/skills/review/SKILL.md +223 -0
  157. package/templates/skills/task-work/SKILL.md +312 -0
  158. package/templates/skills/triage-automation/SKILL.md +134 -0
  159. package/templates/skills/triage-inbox/SKILL.md +225 -0
  160. package/templates/skills/writing-specs/SKILL.md +347 -0
@@ -0,0 +1,312 @@
1
+ # Task Work
2
+
3
+ Structured workflow for working on tasks. Full lifecycle from start through PR merge.
4
+
5
+ ## When to Use
6
+
7
+ - Starting work on a ready task
8
+ - Continuing in-progress or needs_work tasks
9
+ - Ensuring consistent task lifecycle with notes and audit trail
10
+
11
+ **Not for:** Spec creation (use `/kspec:writing-specs`), plan translation (use `/kspec:plan`), or triage (use `/kspec:triage`).
12
+
13
+ ## Inherit Existing Work First
14
+
15
+ Before starting new work, check for existing work:
16
+
17
+ ```bash
18
+ kspec session start # Shows active work at the top
19
+ ```
20
+
21
+ Priority order:
22
+ 1. **needs_work** — Fix cycle: address review feedback (highest priority)
23
+ 2. **in_progress** — Continue work already started
24
+ 3. **ready (pending)** — New work to start
25
+
26
+ Always inherit existing work unless explicitly told otherwise. This prevents orphaned tasks.
27
+
28
+ ## Task Lifecycle
29
+
30
+ ```
31
+ pending → in_progress → pending_review → completed
32
+ ↓ ↓
33
+ blocked needs_work
34
+ (→ in_progress → pending_review)
35
+ ```
36
+
37
+ | Command | Transition | When |
38
+ |---------|-----------|------|
39
+ | `kspec task start @ref` | → in_progress | Beginning work |
40
+ | `kspec task submit @ref` | → pending_review | Code done, PR created |
41
+ | `kspec task complete @ref --reason "..."` | → completed | PR merged |
42
+ | `kspec task block @ref --reason "..."` | → blocked | External blocker |
43
+
44
+ ## CLI Lookups
45
+
46
+ Use CLI commands to find information. **Do NOT search `.kspec/` YAML files manually** — it wastes time and misses context that CLI commands provide (like inherited trait ACs).
47
+
48
+ | Need | Command |
49
+ |------|---------|
50
+ | Task details | `kspec task get @ref` |
51
+ | Spec + all ACs (own + inherited) | `kspec item get @ref` |
52
+ | Trait definition + ACs | `kspec item get @trait-slug` |
53
+ | Search by keyword | `kspec search "keyword"` |
54
+ | List by type | `kspec item list --type feature` |
55
+ | All traits | `kspec trait list` |
56
+ | Task's linked spec | `kspec task get @ref` → read `spec_ref` field |
57
+
58
+ **Key pattern:** When `kspec item get` output shows "Inherited from @trait-slug", run `kspec item get @trait-slug` to see the trait's ACs. One command — do not grep YAML files.
59
+
60
+ ## Workflow Steps
61
+
62
+ ### 1. Choose Task
63
+
64
+ ```bash
65
+ kspec tasks ready # All ready tasks
66
+ kspec tasks ready --eligible # Automation-eligible only (loop mode)
67
+ ```
68
+
69
+ ### 2. Verify Work Is Needed
70
+
71
+ Before starting, check if work is already done:
72
+
73
+ ```bash
74
+ # Check git history
75
+ git log --oneline --grep="feature-name"
76
+ git log --oneline -- path/to/relevant/files
77
+
78
+ # Check existing implementation
79
+ kspec item get @spec-ref # View spec and ACs
80
+ ```
81
+
82
+ If already implemented: verify tests pass, AC coverage exists, then `kspec task complete @ref --reason "Already implemented"`.
83
+
84
+ **Notes are context, not proof.** If a task has notes saying "already done" — verify independently. Run tests, check code, validate against ACs. If a task is in the ready queue, there's a reason.
85
+
86
+ ### 3. Start Task
87
+
88
+ ```bash
89
+ kspec task start @ref
90
+ ```
91
+
92
+ ### 4. Work and Note
93
+
94
+ Read all ACs (own + trait) before implementing:
95
+
96
+ ```bash
97
+ kspec item get @spec-ref # Shows own ACs AND inherited trait ACs
98
+ ```
99
+
100
+ Add notes during work, not just at the end:
101
+
102
+ ```bash
103
+ # Good: explains decisions and context
104
+ kspec task note @ref "Using retry with exponential backoff. Chose 3 max retries based on API rate limits."
105
+
106
+ # Bad: no context
107
+ kspec task note @ref "Done"
108
+ ```
109
+
110
+ Note when you:
111
+ - Discover something unexpected
112
+ - Make a design decision
113
+ - Encounter a blocker
114
+ - Complete a significant piece
115
+
116
+ ### 5. Commit
117
+
118
+ Include task and spec trailers:
119
+
120
+ ```
121
+ feat: add user authentication
122
+
123
+ Implemented JWT-based auth with refresh tokens.
124
+
125
+ Task: @task-add-auth
126
+ Spec: @auth-feature
127
+ ```
128
+
129
+ Trailers enable `kspec log @ref` to find related commits.
130
+
131
+ ### 6. Local Review
132
+
133
+ Run quality checks before submitting. Verify:
134
+
135
+ - **Own AC coverage** — Each spec AC has a test annotated `// AC: @spec-ref ac-N`
136
+ - **Trait AC coverage** — Each inherited trait AC has a test annotated `// AC: @trait-slug ac-N`
137
+ - **Tests pass** — Full test suite, not just new tests
138
+ - **Code quality** — Matches existing patterns, no duplicated utilities
139
+ - **No regressions** — Existing tests still pass
140
+
141
+ ```bash
142
+ kspec validate # Reports uncovered trait ACs as warnings
143
+ ```
144
+
145
+ ### 7. Submit Task
146
+
147
+ ```bash
148
+ kspec task submit @ref
149
+ ```
150
+
151
+ Moves task to `pending_review`. Create PR after submitting.
152
+
153
+ ### 8. Complete Task
154
+
155
+ After PR is merged:
156
+
157
+ ```bash
158
+ kspec task complete @ref --reason "Merged in PR #N. Summary of what was done."
159
+ ```
160
+
161
+ ## Fix Cycle
162
+
163
+ When inheriting a `needs_work` task:
164
+
165
+ 1. **Find the PR** — Check for review comments
166
+ ```bash
167
+ gh pr list --search "Task: @task-ref" --json number,url
168
+ gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '.[] | {path, line, body}'
169
+ ```
170
+
171
+ 2. **Fix findings** — Address MUST-FIX and SHOULD-FIX items
172
+
173
+ 3. **Push fixes** — Commit with descriptive message
174
+ ```bash
175
+ git add <files> && git commit -m "fix: address review feedback
176
+
177
+ Task: @task-slug"
178
+ git push
179
+ ```
180
+
181
+ 4. **Re-submit** — `kspec task submit @ref` (back to pending_review)
182
+
183
+ You do NOT merge in a fix cycle. The reviewer handles merge decisions.
184
+
185
+ ## Scope Management
186
+
187
+ ### What's In Scope
188
+
189
+ Tasks describe expected outcomes, not rigid boundaries:
190
+
191
+ - **Tests need implementation?** Implementing missing functionality is in scope — the goal is verified behavior
192
+ - **Implementation needs tests?** Proving it works is always in scope
193
+
194
+ ### When to Expand vs Escalate
195
+
196
+ **Expand** (do it yourself):
197
+ - Additional work is clearly implied by the goal
198
+ - Proportional to the original task
199
+ - You have the context
200
+
201
+ **Escalate** (capture separately):
202
+ - Scope expansion is major
203
+ - Uncertain about the right approach
204
+ - Outside your task's domain
205
+
206
+ **When you notice something outside your task:** Capture it separately (`kspec inbox add` or `kspec task note`). Don't fix it inline — even small detours compound into drift.
207
+
208
+ ## AC Test Annotations
209
+
210
+ Link tests to acceptance criteria:
211
+
212
+ ```javascript
213
+ // AC: @spec-item ac-N
214
+ it('should validate input', () => { ... });
215
+ ```
216
+
217
+ ```python
218
+ # AC: @spec-item ac-N
219
+ def test_validates_input():
220
+ ...
221
+ ```
222
+
223
+ Every AC should have at least one test with this annotation.
224
+
225
+ ## Implementation Quality
226
+
227
+ Before submitting:
228
+
229
+ - **Search for existing utilities** — Don't duplicate helpers that already exist
230
+ - **Match neighboring file style** — Naming conventions, error handling, imports
231
+ - **Run full test suite** — Not just your new tests
232
+ - **Validate** — `kspec validate` for spec alignment
233
+
234
+ ## Loop Mode
235
+
236
+ Autonomous task execution without human confirmation.
237
+
238
+ ```bash
239
+ kspec tasks ready --eligible # Only automation-eligible tasks
240
+ ```
241
+
242
+ ### Task Selection Priority
243
+
244
+ 1. `needs_work` — Fix review feedback
245
+ 2. `in_progress` — Continue existing work
246
+ 3. Tasks that unblock others
247
+ 4. Highest priority ready task
248
+
249
+ ### Key Behaviors
250
+
251
+ - Verify work is needed before starting (prevent duplicates)
252
+ - Decisions auto-resolve without prompts
253
+ - PR review handled externally (not this workflow)
254
+ - All actions are logged and auditable
255
+
256
+ ### Blocking Rules
257
+
258
+ **Block only for genuine external blockers:**
259
+ - Human architectural decision needed
260
+ - Spec clarification required
261
+ - External dependency unavailable
262
+ - Formal `depends_on` blocker
263
+
264
+ **Do NOT block for:**
265
+ - Task seems complex (do the work)
266
+ - Tests are failing (fix them)
267
+ - Service needs running (start it)
268
+
269
+ After blocking:
270
+ ```bash
271
+ kspec task block @ref --reason "Reason..."
272
+ kspec tasks ready --eligible # Check for other work
273
+ # If tasks exist: work on the next one
274
+ # If empty: stop responding (ralph auto-exits)
275
+ ```
276
+
277
+ ### Turn Completion
278
+
279
+ After creating a PR, **stop responding**. Ralph continues automatically — it checks for remaining eligible tasks and exits the loop when none remain.
280
+
281
+ **Do NOT call `end-loop`** after creating a PR. That ends ALL remaining iterations. It's a rare escape hatch for when work is stalling across multiple iterations.
282
+
283
+ ## Command Reference
284
+
285
+ ```bash
286
+ # Task lifecycle
287
+ kspec task start @ref
288
+ kspec task note @ref "..."
289
+ kspec task submit @ref
290
+ kspec task complete @ref --reason "..."
291
+ kspec task block @ref --reason "..."
292
+
293
+ # Task discovery
294
+ kspec tasks ready
295
+ kspec tasks ready --eligible
296
+ kspec task get @ref
297
+
298
+ # Validation
299
+ kspec validate
300
+ kspec validate --alignment
301
+
302
+ # Session context
303
+ kspec session start
304
+ ```
305
+
306
+ ## Integration
307
+
308
+ - **`/kspec:writing-specs`** — Create specs before deriving tasks
309
+ - **`/kspec:plan`** — Plans create specs that become tasks
310
+ - **`/kspec:review`** — Review checks AC coverage and code quality
311
+ - **`/kspec:observations`** — Capture friction found during task work
312
+ - **`/kspec:reflect`** — Session reflection after completing tasks
@@ -0,0 +1,134 @@
1
+ # Automation Triage
2
+
3
+ Assess and prepare tasks for automation eligibility. Goal: make tasks self-contained so they can be worked on by automated agents.
4
+
5
+ ## When to Use
6
+
7
+ - During a triage session focused on automation readiness
8
+ - When new tasks need eligibility assessment
9
+ - Before starting an automated work loop (to ensure eligible tasks exist)
10
+
11
+ ## Philosophy
12
+
13
+ - **Eligible is the goal** — Manual-only should be the exception
14
+ - **Criteria are for visibility** — Help identify what's missing, not auto-approve
15
+ - **Fix issues, don't just assess** — Guide toward making tasks automatable
16
+
17
+ ## Eligibility Criteria
18
+
19
+ A task is ready for automation when:
20
+
21
+ 1. Has `spec_ref` pointing to a resolvable spec
22
+ 2. Spec has acceptance criteria (testable outcomes)
23
+ 3. Task type is not `spike` (spikes output knowledge, not code)
24
+
25
+ **Having spec + ACs is necessary but not sufficient** — you must also verify the spec is appropriate and ACs are adequate for the task.
26
+
27
+ **Task type does not determine automation eligibility.** Any non-spike task can be `automation: eligible` — including design tasks, refactoring tasks, documentation tasks, etc. The `automation` field is the definitive source. Once a task is marked `eligible`, do not second-guess it based on type, title, or description.
28
+
29
+ ## Workflow
30
+
31
+ ### 1. Get Assessment Overview
32
+
33
+ ```bash
34
+ # Show unassessed pending tasks with criteria status
35
+ kspec tasks assess automation
36
+
37
+ # See what auto mode would change
38
+ kspec tasks assess automation --auto --dry-run
39
+ ```
40
+
41
+ ### 2. Process Each Task
42
+
43
+ For each task shown:
44
+
45
+ **If spike:**
46
+ - Mark `manual_only` — spikes are inherently human work
47
+ - `kspec task set @ref --automation manual_only --reason "Spike - output is knowledge"`
48
+
49
+ **If missing spec_ref or no ACs:**
50
+ - Ask: "Fix now or mark for later?"
51
+ - **Fix now:**
52
+ 1. Create or find appropriate spec: `kspec item add --under @parent --title "..."`
53
+ 2. Add acceptance criteria: `kspec item ac add @spec --given "..." --when "..." --then "..."`
54
+ 3. Link task to spec: `kspec task set @ref --spec-ref @spec`
55
+ 4. Re-assess and mark eligible if appropriate
56
+ - **Mark for later:**
57
+ - `kspec task set @ref --automation needs_review --reason "Missing spec - needs spec creation"`
58
+
59
+ **If has spec + ACs:**
60
+ - Review for eligibility:
61
+ - Is the spec appropriate for this task?
62
+ - Are the ACs adequate and testable?
63
+ - Does the task have sufficient context?
64
+ - If yes: `kspec task set @ref --automation eligible`
65
+ - If no: Fix issues or mark `needs_review` with specific reason
66
+
67
+ ### 3. Batch Processing with Auto Mode
68
+
69
+ For fast triage of obvious cases:
70
+
71
+ ```bash
72
+ # Apply auto mode (spikes → manual_only, missing → needs_review)
73
+ kspec tasks assess automation --auto
74
+
75
+ # Then manually review the "review_for_eligible" tasks
76
+ kspec tasks ready --unassessed
77
+ ```
78
+
79
+ Auto mode is conservative:
80
+ - Spikes → `manual_only`
81
+ - Missing spec/ACs → `needs_review`
82
+ - Has spec + ACs → **NOT auto-marked** (requires review)
83
+
84
+ ## Commands Reference
85
+
86
+ ```bash
87
+ # Assessment
88
+ kspec tasks assess automation # Show unassessed with criteria
89
+ kspec tasks assess automation @ref # Single task
90
+ kspec tasks assess automation --all # Include already-assessed
91
+ kspec tasks assess automation --auto # Apply obvious cases
92
+ kspec tasks assess automation --dry-run # Preview changes
93
+
94
+ # Setting automation status
95
+ kspec task set @ref --automation eligible
96
+ kspec task set @ref --automation needs_review --reason "Why"
97
+ kspec task set @ref --automation manual_only --reason "Why"
98
+ kspec task set @ref --no-automation # Clear to unassessed
99
+
100
+ # Filtering tasks
101
+ kspec tasks ready --unassessed # Tasks needing assessment
102
+ kspec tasks ready --eligible # Automation-ready tasks
103
+ kspec tasks ready --needs-review # Tasks needing human triage
104
+ ```
105
+
106
+ ## Assessment Output
107
+
108
+ ```
109
+ @task-slug "Task title"
110
+ spec_ref: ✓ @feature-slug
111
+ has_acs: ✓ 3 acceptance criteria
112
+ not_spike: ✓ type: task
113
+ → review_for_eligible (verify spec/AC adequacy)
114
+ ```
115
+
116
+ | Recommendation | Meaning | Auto Mode Action |
117
+ |----------------|---------|------------------|
118
+ | `review_for_eligible` | Passes criteria, needs review | No change (manual review) |
119
+ | `needs_review` | Missing spec or ACs | Sets `needs_review` with reason |
120
+ | `manual_only` | Spike task | Sets `manual_only` |
121
+
122
+ ## Key Principles
123
+
124
+ - **CLI doesn't auto-mark eligible** — Requires agent/human review
125
+ - **Agents CAN mark eligible** — When reviewing based on user instruction
126
+ - **Add notes when setting status** — Document the "why"
127
+ - **Re-assess after fixes** — After adding spec/ACs, check again
128
+ - **Task type is not destiny** — Any non-spike task can be eligible
129
+
130
+ ## Integration
131
+
132
+ - **`/kspec:triage-inbox`** — Inbox triage may promote items to tasks needing assessment
133
+ - **`kspec tasks ready --eligible`** — Used by task-work loop to find automatable work
134
+ - **Ralph loop** — Consumes eligible tasks; automation assessment feeds the pipeline
@@ -0,0 +1,225 @@
1
+ # Inbox Triage
2
+
3
+ Systematically process inbox items using the **record → act** pattern. Records decisions with audit trail, then executes actions.
4
+
5
+ ## When to Use
6
+
7
+ - Processing accumulated inbox items
8
+ - During a triage session (`kspec workflow start @inbox-triage`)
9
+ - When inbox count is growing and needs attention
10
+
11
+ ## Core Concept: Record → Act
12
+
13
+ Triage separates **decision-making** from **execution**:
14
+
15
+ 1. **Record** the decision (what to do + why)
16
+ 2. **Act** on the decision (execute it)
17
+
18
+ This enables review, override, and audit trails.
19
+
20
+ ```bash
21
+ # Step 1: Record what you want to do
22
+ kspec triage record @inbox-ref --action promote --reasoning "Clear feature request"
23
+
24
+ # Step 2: Execute the decision
25
+ kspec triage act @triage-ref
26
+ ```
27
+
28
+ ### Actions
29
+
30
+ | Action | What `act` does |
31
+ |--------|-----------------|
32
+ | `promote` | Creates task from inbox item snapshot |
33
+ | `delete` | Deletes the inbox item |
34
+ | `defer` | Records deferral, no side effect |
35
+ | `spec-gap` | Creates observation tagged spec-gap |
36
+ | `duplicate` | Deletes the inbox item |
37
+
38
+ ### Lifecycle
39
+
40
+ ```
41
+ record (with action) override (optional) act
42
+ → triaged → triaged → acted_on
43
+ ```
44
+
45
+ ## Workflow
46
+
47
+ ### 1. Gather Context
48
+
49
+ ```bash
50
+ kspec session start --full
51
+ kspec inbox list
52
+ ```
53
+
54
+ ### 2. Categorize Items
55
+
56
+ Group inbox items by type:
57
+ - **Bugs** — implementation issues, errors
58
+ - **Spec gaps** — missing or incomplete specs
59
+ - **Quick wins** — small, well-defined improvements
60
+ - **Larger features** — need plan mode to design
61
+ - **Process/workflow** — meta improvements
62
+ - **Delete candidates** — outdated, duplicates, already done
63
+
64
+ Present categories to user for alignment.
65
+
66
+ ### 3. Triage Each Item
67
+
68
+ **Interactive mode** (recommended for multiple items):
69
+
70
+ ```bash
71
+ kspec triage start
72
+ # Presents untriaged items one by one
73
+ # Prompts for action + reasoning
74
+ # Ctrl+C preserves all previously committed records
75
+ ```
76
+
77
+ **Individual recording** (for targeted decisions):
78
+
79
+ ```bash
80
+ kspec triage record @ref --action promote --reasoning "Clear feature request with spec coverage"
81
+ kspec triage record @ref --action delete --reasoning "Already implemented in PR #123"
82
+ kspec triage record @ref --action defer --reasoning "Depends on auth system redesign"
83
+ kspec triage record @ref --action spec-gap --reasoning "No spec covers error handling for this flow"
84
+ kspec triage record @ref --action duplicate --reasoning "Covered by @existing-spec"
85
+ ```
86
+
87
+ ### 4. Review and Execute Decisions
88
+
89
+ ```bash
90
+ # Review what was recorded
91
+ kspec triage list --status triaged
92
+
93
+ # Preview before executing
94
+ kspec triage act @triage-ref --dry-run
95
+
96
+ # Execute decisions
97
+ kspec triage act @triage-ref
98
+ ```
99
+
100
+ ### 5. Override If Needed
101
+
102
+ ```bash
103
+ # Override changes the action while preserving the audit trail
104
+ kspec triage override @triage-ref --action defer --reasoning "Reconsidered - not ready"
105
+
106
+ # Then act on the updated decision
107
+ kspec triage act @triage-ref
108
+ ```
109
+
110
+ ## Spec-First Processing
111
+
112
+ For behavior changes, check spec coverage before promoting:
113
+
114
+ 1. **Check coverage**: `kspec search "<relevant keyword>"` or `kspec item get @ref`
115
+ 2. **Identify gaps**: Does spec have description AND acceptance criteria?
116
+ 3. **Update spec**:
117
+ ```bash
118
+ kspec item set @ref --description "..."
119
+ kspec item ac add @ref --given "..." --when "..." --then "..."
120
+ ```
121
+ 4. **Record and act**:
122
+ ```bash
123
+ kspec triage record @inbox-ref --action promote --reasoning "Spec updated" --evidence @spec-ref
124
+ kspec triage act @triage-ref
125
+ ```
126
+
127
+ ## Plan Mode for Larger Items
128
+
129
+ When an item needs design work:
130
+
131
+ 1. Enter plan mode
132
+ 2. Explore codebase for patterns/context
133
+ 3. Design spec structure and implementation approach
134
+ 4. Write plan, exit for approval
135
+ 5. Execute: create spec, add AC, derive task
136
+
137
+ ## Observation Processing
138
+
139
+ During triage sessions, you may also process pending observations:
140
+
141
+ ```bash
142
+ kspec meta observations --pending-resolution
143
+ ```
144
+
145
+ For each observation:
146
+
147
+ | Type | How to Process |
148
+ |------|----------------|
149
+ | **friction** | Reveals spec gap? → Create spec or inbox item. Already addressed? → Resolve |
150
+ | **success** | Document in relevant spec or AGENTS.md if broadly useful → Resolve |
151
+ | **question** | Answer if you can. Needs investigation? → Promote to task |
152
+ | **idea** | Clear scope? → Inbox or task. Unclear? → Leave or delete if stale |
153
+
154
+ ```bash
155
+ # Promote observation to task
156
+ kspec meta promote @ref --title "Add bulk AC command" --priority 2
157
+
158
+ # Resolve observation
159
+ kspec meta resolve @ref "Resolution notes"
160
+ kspec meta resolve --refs @ref1 @ref2 --resolution "Batch resolution"
161
+
162
+ # Convert inbox item to observation (if it's a pattern, not a task)
163
+ kspec meta observe --from-inbox @ref
164
+ ```
165
+
166
+ ## Export for Context
167
+
168
+ Share triage decisions with other agents or sessions:
169
+
170
+ ```bash
171
+ # Markdown context blocks (for agent handoff)
172
+ kspec triage export --format context
173
+
174
+ # Full structured data
175
+ kspec triage export --format json
176
+ ```
177
+
178
+ ## Bulk Operations with Batch
179
+
180
+ When triaging many items, use `kspec batch` for atomic operations:
181
+
182
+ ```bash
183
+ kspec batch --commands '[
184
+ {"command":"triage record","args":{"ref":"@ref1","action":"delete","reasoning":"Stale"}},
185
+ {"command":"triage record","args":{"ref":"@ref2","action":"promote","reasoning":"Clear scope"}}
186
+ ]'
187
+ ```
188
+
189
+ Use `--dry-run` to preview. See `/kspec:help` for full batch documentation.
190
+
191
+ ## Common Patterns
192
+
193
+ | Pattern | Action |
194
+ |---------|--------|
195
+ | Already implemented | Verify impl exists → check spec gaps → record delete |
196
+ | Duplicate of existing | Verify original covers scope → record duplicate |
197
+ | Small flag/option | Update spec + AC → record promote |
198
+ | New command | Plan mode → design spec → record promote with evidence |
199
+ | Bug report | Check spec coverage → update spec → record promote |
200
+ | Vague idea | Record defer, or leave untriaged for later |
201
+ | Missing spec | Record spec-gap → creates observation for follow-up |
202
+
203
+ ## Key Principles
204
+
205
+ - **Record before act** — Separate decisions from execution for audit trail
206
+ - **Ask one question at a time** — Don't batch decisions in interactive mode
207
+ - **Spec before task** — Fill spec gaps before promoting to tasks
208
+ - **AC is required** — Specs without acceptance criteria are incomplete
209
+ - **Use CLI, not YAML** — All changes through kspec commands
210
+ - **Delete freely** — Outdated or duplicate items should go
211
+
212
+ ## Progress Tracking
213
+
214
+ At session end, provide summary:
215
+ - Items triaged (recorded decisions)
216
+ - Actions executed (promoted, deleted, deferred, spec-gap, duplicate)
217
+ - Tasks created/updated
218
+ - Observations resolved
219
+ - Remaining items
220
+
221
+ ## Integration
222
+
223
+ - **`/kspec:reflect`** — Session reflection may generate inbox items for triage
224
+ - **`/kspec:observations`** — Captures systemic patterns found during triage
225
+ - **`kspec session start`** — Shows inbox count for triage awareness