@kynetic-ai/spec 0.3.0 → 0.4.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 (111) 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/log.d.ts.map +1 -1
  9. package/dist/cli/commands/log.js +5 -4
  10. package/dist/cli/commands/log.js.map +1 -1
  11. package/dist/cli/commands/meta.d.ts.map +1 -1
  12. package/dist/cli/commands/meta.js +2 -1
  13. package/dist/cli/commands/meta.js.map +1 -1
  14. package/dist/cli/commands/plan-import.d.ts.map +1 -1
  15. package/dist/cli/commands/plan-import.js +50 -19
  16. package/dist/cli/commands/plan-import.js.map +1 -1
  17. package/dist/cli/commands/ralph.d.ts.map +1 -1
  18. package/dist/cli/commands/ralph.js +18 -7
  19. package/dist/cli/commands/ralph.js.map +1 -1
  20. package/dist/cli/commands/session.d.ts.map +1 -1
  21. package/dist/cli/commands/session.js +6 -7
  22. package/dist/cli/commands/session.js.map +1 -1
  23. package/dist/cli/commands/setup.d.ts.map +1 -1
  24. package/dist/cli/commands/setup.js +41 -7
  25. package/dist/cli/commands/setup.js.map +1 -1
  26. package/dist/cli/commands/skill-install.d.ts +4 -1
  27. package/dist/cli/commands/skill-install.d.ts.map +1 -1
  28. package/dist/cli/commands/skill-install.js +62 -5
  29. package/dist/cli/commands/skill-install.js.map +1 -1
  30. package/dist/cli/commands/task.d.ts.map +1 -1
  31. package/dist/cli/commands/task.js +35 -24
  32. package/dist/cli/commands/task.js.map +1 -1
  33. package/dist/cli/commands/tasks.d.ts.map +1 -1
  34. package/dist/cli/commands/tasks.js +2 -4
  35. package/dist/cli/commands/tasks.js.map +1 -1
  36. package/dist/cli/commands/triage.d.ts.map +1 -1
  37. package/dist/cli/commands/triage.js +12 -98
  38. package/dist/cli/commands/triage.js.map +1 -1
  39. package/dist/cli/output.d.ts.map +1 -1
  40. package/dist/cli/output.js +4 -2
  41. package/dist/cli/output.js.map +1 -1
  42. package/dist/daemon/routes/triage.ts +4 -70
  43. package/dist/parser/config.d.ts +106 -0
  44. package/dist/parser/config.d.ts.map +1 -1
  45. package/dist/parser/config.js +47 -0
  46. package/dist/parser/config.js.map +1 -1
  47. package/dist/parser/plan-document.d.ts +8 -0
  48. package/dist/parser/plan-document.d.ts.map +1 -1
  49. package/dist/parser/plan-document.js +1 -0
  50. package/dist/parser/plan-document.js.map +1 -1
  51. package/dist/ralph/events.d.ts.map +1 -1
  52. package/dist/ralph/events.js +24 -0
  53. package/dist/ralph/events.js.map +1 -1
  54. package/dist/ralph/index.d.ts +1 -1
  55. package/dist/ralph/index.d.ts.map +1 -1
  56. package/dist/ralph/index.js +1 -1
  57. package/dist/ralph/index.js.map +1 -1
  58. package/dist/ralph/subagent.d.ts +12 -1
  59. package/dist/ralph/subagent.d.ts.map +1 -1
  60. package/dist/ralph/subagent.js +22 -3
  61. package/dist/ralph/subagent.js.map +1 -1
  62. package/dist/schema/batch.d.ts +2 -0
  63. package/dist/schema/batch.d.ts.map +1 -1
  64. package/dist/schema/common.d.ts +6 -0
  65. package/dist/schema/common.d.ts.map +1 -1
  66. package/dist/schema/common.js +8 -0
  67. package/dist/schema/common.js.map +1 -1
  68. package/dist/sessions/store.d.ts +8 -0
  69. package/dist/sessions/store.d.ts.map +1 -1
  70. package/dist/sessions/store.js +219 -37
  71. package/dist/sessions/store.js.map +1 -1
  72. package/dist/strings/errors.d.ts +4 -0
  73. package/dist/strings/errors.d.ts.map +1 -1
  74. package/dist/strings/errors.js +2 -0
  75. package/dist/strings/errors.js.map +1 -1
  76. package/dist/triage/actions.d.ts +27 -0
  77. package/dist/triage/actions.d.ts.map +1 -0
  78. package/dist/triage/actions.js +95 -0
  79. package/dist/triage/actions.js.map +1 -0
  80. package/dist/triage/constants.d.ts +6 -0
  81. package/dist/triage/constants.d.ts.map +1 -0
  82. package/dist/triage/constants.js +7 -0
  83. package/dist/triage/constants.js.map +1 -0
  84. package/dist/triage/index.d.ts +3 -0
  85. package/dist/triage/index.d.ts.map +1 -0
  86. package/dist/triage/index.js +3 -0
  87. package/dist/triage/index.js.map +1 -0
  88. package/package.json +1 -1
  89. package/plugin/.claude-plugin/marketplace.json +1 -1
  90. package/plugin/.claude-plugin/plugin.json +1 -1
  91. package/plugin/plugins/kspec/skills/create-workflow/SKILL.md +235 -0
  92. package/plugin/plugins/kspec/skills/observations/SKILL.md +143 -0
  93. package/plugin/plugins/kspec/skills/plan/SKILL.md +343 -0
  94. package/plugin/plugins/kspec/skills/reflect/SKILL.md +161 -0
  95. package/plugin/plugins/kspec/skills/review/SKILL.md +193 -0
  96. package/plugin/plugins/kspec/skills/task-work/SKILL.md +303 -0
  97. package/plugin/plugins/kspec/skills/triage-automation/SKILL.md +140 -0
  98. package/plugin/plugins/kspec/skills/triage-inbox/SKILL.md +232 -0
  99. package/plugin/plugins/kspec/skills/writing-specs/SKILL.md +340 -0
  100. package/templates/agents-sections/03-task-lifecycle.md +2 -2
  101. package/templates/agents-sections/04-pr-workflow.md +3 -3
  102. package/templates/skills/create-workflow/SKILL.md +228 -0
  103. package/templates/skills/manifest.yaml +45 -0
  104. package/templates/skills/observations/SKILL.md +137 -0
  105. package/templates/skills/plan/SKILL.md +336 -0
  106. package/templates/skills/reflect/SKILL.md +155 -0
  107. package/templates/skills/review/SKILL.md +186 -0
  108. package/templates/skills/task-work/SKILL.md +296 -0
  109. package/templates/skills/triage-automation/SKILL.md +134 -0
  110. package/templates/skills/triage-inbox/SKILL.md +225 -0
  111. package/templates/skills/writing-specs/SKILL.md +333 -0
@@ -0,0 +1,186 @@
1
+ # Review
2
+
3
+ Kspec-specific review concerns for verifying spec alignment, AC coverage, and trait coverage. A building block that projects reference in their own review skills and workflows.
4
+
5
+ ## When to Use
6
+
7
+ - Before creating a PR — verify implementation meets spec
8
+ - As part of a project-specific local review workflow
9
+ - When reviewing code changes against acceptance criteria
10
+
11
+ **This is NOT a complete review workflow.** It covers kspec-specific quality gates (spec alignment, AC coverage, trait coverage, validation). Projects should wrap this in their own review skill that adds project-specific concerns (test commands, E2E patterns, coding standards).
12
+
13
+ ## Spec Alignment
14
+
15
+ Implementation must match spec intent, not just pass tests.
16
+
17
+ ### How to Verify
18
+
19
+ ```bash
20
+ # Read the spec — all ACs (own + inherited)
21
+ kspec item get @spec-ref
22
+ ```
23
+
24
+ For each AC, verify:
25
+ 1. **Implementation exists** — Code handles the described behavior
26
+ 2. **Test exists** — A test validates the behavior
27
+ 3. **Behavior matches** — The test actually proves the AC, not just syntactically passes
28
+
29
+ ### What to Flag
30
+
31
+ | Issue | Severity |
32
+ |-------|----------|
33
+ | AC has no implementation | MUST-FIX |
34
+ | AC has no test | MUST-FIX |
35
+ | Implementation deviates from spec | MUST-FIX |
36
+ | Undocumented behavior (not in any AC) | SHOULD-FIX |
37
+ | Spec is vague, implementation chose reasonable interpretation | Note it |
38
+
39
+ ## Own AC Coverage
40
+
41
+ Every acceptance criterion on the spec MUST have at least one annotated test.
42
+
43
+ ### Annotation Format
44
+
45
+ ```javascript
46
+ // AC: @spec-ref ac-N
47
+ it('should validate input when given invalid data', () => { ... });
48
+ ```
49
+
50
+ ```python
51
+ # AC: @spec-ref ac-N
52
+ def test_validates_input():
53
+ ...
54
+ ```
55
+
56
+ ### Checking Coverage
57
+
58
+ ```bash
59
+ # Get all ACs for the spec
60
+ kspec item get @spec-ref
61
+
62
+ # Search for annotations in test files
63
+ # (adapt grep path to your project's test directories)
64
+ grep -rn "// AC: @spec-ref" tests/
65
+ ```
66
+
67
+ Each AC listed in the spec output must have a corresponding annotation. Missing annotations are MUST-FIX.
68
+
69
+ ## Trait AC Coverage
70
+
71
+ When a spec implements traits, it inherits their ACs. Every inherited trait AC must also have test coverage.
72
+
73
+ ### How It Works
74
+
75
+ ```bash
76
+ # kspec item get shows inherited ACs under "Inherited from @trait-slug" sections
77
+ kspec item get @spec-ref
78
+ ```
79
+
80
+ Each inherited AC needs a test annotated with the **trait's** ref, not the spec's ref:
81
+
82
+ ```javascript
83
+ // AC: @trait-json-output ac-1
84
+ it('should output valid JSON with --json flag', () => { ... });
85
+ ```
86
+
87
+ ### Checking Coverage
88
+
89
+ ```bash
90
+ # kspec validate reports uncovered trait ACs
91
+ kspec validate
92
+
93
+ # Search for specific trait annotations
94
+ grep -rn "// AC: @trait-json-output" tests/
95
+ ```
96
+
97
+ Any "inherited trait AC(s) without test coverage" warning from `kspec validate` is a MUST-FIX blocker.
98
+
99
+ ### When a Trait AC Doesn't Apply
100
+
101
+ If a trait AC genuinely doesn't apply to this spec, annotate it with a reason:
102
+
103
+ ```javascript
104
+ // AC: @trait-json-output ac-3 — N/A: this command has no tabular output to format
105
+ ```
106
+
107
+ The annotation must exist so coverage tooling can track it.
108
+
109
+ ### No Traits?
110
+
111
+ If the spec has no traits (`kspec item get` shows no "Inherited from" sections), skip this step entirely.
112
+
113
+ ## Validation Integration
114
+
115
+ ```bash
116
+ kspec validate
117
+ ```
118
+
119
+ Validation catches spec-level issues:
120
+ - Missing acceptance criteria on specs
121
+ - Broken references (dangling `@slug`)
122
+ - Missing descriptions
123
+ - Uncovered trait ACs (the most common review finding)
124
+ - Orphaned specs (no linked tasks)
125
+
126
+ **Exit codes:** `0` = clean, `4` = errors, `6` = warnings only.
127
+
128
+ Treat errors as MUST-FIX. Treat warnings as SHOULD-FIX (especially trait AC warnings).
129
+
130
+ ## Review Checklist
131
+
132
+ Use this checklist when reviewing implementation against a spec:
133
+
134
+ ### MUST-FIX (Blocks PR)
135
+
136
+ - [ ] Every own AC has at least one annotated test
137
+ - [ ] Every inherited trait AC has at least one annotated test (or N/A annotation)
138
+ - [ ] `kspec validate` reports no errors for this spec
139
+ - [ ] Implementation matches spec behavior (not just syntactically correct tests)
140
+ - [ ] No regressions — existing tests still pass
141
+
142
+ ### SHOULD-FIX
143
+
144
+ - [ ] `kspec validate` warnings addressed (especially trait AC coverage)
145
+ - [ ] Undocumented behavior has spec coverage or is flagged
146
+ - [ ] Test annotations reference correct spec/trait refs
147
+
148
+ ### SUGGESTION
149
+
150
+ - [ ] Tests are meaningful (would fail if feature breaks)
151
+ - [ ] Prefer E2E over unit where practical
152
+ - [ ] Tests run in isolation (temp dirs, not project repo)
153
+
154
+ ## Severity Guide
155
+
156
+ | Finding | Severity | Action |
157
+ |---------|----------|--------|
158
+ | Missing own AC test annotation | MUST-FIX | Add test with `// AC: @spec-ref ac-N` |
159
+ | Missing trait AC test annotation | MUST-FIX | Add test with `// AC: @trait-slug ac-N` |
160
+ | `kspec validate` error | MUST-FIX | Fix the validation error |
161
+ | Implementation doesn't match spec | MUST-FIX | Fix implementation or update spec |
162
+ | `kspec validate` warning | SHOULD-FIX | Address warning |
163
+ | Undocumented behavior | SHOULD-FIX | Add AC or note deviation |
164
+ | Test doesn't prove its AC | SHOULD-FIX | Rewrite test |
165
+ | No E2E tests | SUGGESTION | Consider adding |
166
+
167
+ ## Using in Project Reviews
168
+
169
+ This skill provides the kspec-specific gates. Wrap it in your project's review:
170
+
171
+ ```
172
+ Project Review = kspec:review gates + project-specific gates
173
+ ```
174
+
175
+ Project-specific gates to add in your own review skill:
176
+ - **Test commands** — How to run your test suite
177
+ - **Test patterns** — Project-specific test helpers and isolation patterns
178
+ - **Code style** — Naming, error handling, import conventions
179
+ - **E2E specifics** — How E2E tests work in your project
180
+ - **Regression check** — Full suite command and expectations
181
+
182
+ ## Integration
183
+
184
+ - **`/kspec:task-work`** — Run review before submitting tasks
185
+ - **`/kspec:writing-specs`** — If review reveals spec gaps, update specs first
186
+ - **`kspec validate`** — Automated validation complements manual review
@@ -0,0 +1,296 @@
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
+ ## Workflow Steps
45
+
46
+ ### 1. Choose Task
47
+
48
+ ```bash
49
+ kspec tasks ready # All ready tasks
50
+ kspec tasks ready --eligible # Automation-eligible only (loop mode)
51
+ ```
52
+
53
+ ### 2. Verify Work Is Needed
54
+
55
+ Before starting, check if work is already done:
56
+
57
+ ```bash
58
+ # Check git history
59
+ git log --oneline --grep="feature-name"
60
+ git log --oneline -- path/to/relevant/files
61
+
62
+ # Check existing implementation
63
+ kspec item get @spec-ref # View spec and ACs
64
+ ```
65
+
66
+ If already implemented: verify tests pass, AC coverage exists, then `kspec task complete @ref --reason "Already implemented"`.
67
+
68
+ **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.
69
+
70
+ ### 3. Start Task
71
+
72
+ ```bash
73
+ kspec task start @ref
74
+ ```
75
+
76
+ ### 4. Work and Note
77
+
78
+ Read all ACs (own + trait) before implementing:
79
+
80
+ ```bash
81
+ kspec item get @spec-ref # Shows own ACs AND inherited trait ACs
82
+ ```
83
+
84
+ Add notes during work, not just at the end:
85
+
86
+ ```bash
87
+ # Good: explains decisions and context
88
+ kspec task note @ref "Using retry with exponential backoff. Chose 3 max retries based on API rate limits."
89
+
90
+ # Bad: no context
91
+ kspec task note @ref "Done"
92
+ ```
93
+
94
+ Note when you:
95
+ - Discover something unexpected
96
+ - Make a design decision
97
+ - Encounter a blocker
98
+ - Complete a significant piece
99
+
100
+ ### 5. Commit
101
+
102
+ Include task and spec trailers:
103
+
104
+ ```
105
+ feat: add user authentication
106
+
107
+ Implemented JWT-based auth with refresh tokens.
108
+
109
+ Task: @task-add-auth
110
+ Spec: @auth-feature
111
+ ```
112
+
113
+ Trailers enable `kspec log @ref` to find related commits.
114
+
115
+ ### 6. Local Review
116
+
117
+ Run quality checks before submitting. Verify:
118
+
119
+ - **Own AC coverage** — Each spec AC has a test annotated `// AC: @spec-ref ac-N`
120
+ - **Trait AC coverage** — Each inherited trait AC has a test annotated `// AC: @trait-slug ac-N`
121
+ - **Tests pass** — Full test suite, not just new tests
122
+ - **Code quality** — Matches existing patterns, no duplicated utilities
123
+ - **No regressions** — Existing tests still pass
124
+
125
+ ```bash
126
+ kspec validate # Reports uncovered trait ACs as warnings
127
+ ```
128
+
129
+ ### 7. Submit Task
130
+
131
+ ```bash
132
+ kspec task submit @ref
133
+ ```
134
+
135
+ Moves task to `pending_review`. Create PR after submitting.
136
+
137
+ ### 8. Complete Task
138
+
139
+ After PR is merged:
140
+
141
+ ```bash
142
+ kspec task complete @ref --reason "Merged in PR #N. Summary of what was done."
143
+ ```
144
+
145
+ ## Fix Cycle
146
+
147
+ When inheriting a `needs_work` task:
148
+
149
+ 1. **Find the PR** — Check for review comments
150
+ ```bash
151
+ gh pr list --search "Task: @task-ref" --json number,url
152
+ gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '.[] | {path, line, body}'
153
+ ```
154
+
155
+ 2. **Fix findings** — Address MUST-FIX and SHOULD-FIX items
156
+
157
+ 3. **Push fixes** — Commit with descriptive message
158
+ ```bash
159
+ git add <files> && git commit -m "fix: address review feedback
160
+
161
+ Task: @task-slug"
162
+ git push
163
+ ```
164
+
165
+ 4. **Re-submit** — `kspec task submit @ref` (back to pending_review)
166
+
167
+ You do NOT merge in a fix cycle. The reviewer handles merge decisions.
168
+
169
+ ## Scope Management
170
+
171
+ ### What's In Scope
172
+
173
+ Tasks describe expected outcomes, not rigid boundaries:
174
+
175
+ - **Tests need implementation?** Implementing missing functionality is in scope — the goal is verified behavior
176
+ - **Implementation needs tests?** Proving it works is always in scope
177
+
178
+ ### When to Expand vs Escalate
179
+
180
+ **Expand** (do it yourself):
181
+ - Additional work is clearly implied by the goal
182
+ - Proportional to the original task
183
+ - You have the context
184
+
185
+ **Escalate** (capture separately):
186
+ - Scope expansion is major
187
+ - Uncertain about the right approach
188
+ - Outside your task's domain
189
+
190
+ **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.
191
+
192
+ ## AC Test Annotations
193
+
194
+ Link tests to acceptance criteria:
195
+
196
+ ```javascript
197
+ // AC: @spec-item ac-N
198
+ it('should validate input', () => { ... });
199
+ ```
200
+
201
+ ```python
202
+ # AC: @spec-item ac-N
203
+ def test_validates_input():
204
+ ...
205
+ ```
206
+
207
+ Every AC should have at least one test with this annotation.
208
+
209
+ ## Implementation Quality
210
+
211
+ Before submitting:
212
+
213
+ - **Search for existing utilities** — Don't duplicate helpers that already exist
214
+ - **Match neighboring file style** — Naming conventions, error handling, imports
215
+ - **Run full test suite** — Not just your new tests
216
+ - **Validate** — `kspec validate` for spec alignment
217
+
218
+ ## Loop Mode
219
+
220
+ Autonomous task execution without human confirmation.
221
+
222
+ ```bash
223
+ kspec tasks ready --eligible # Only automation-eligible tasks
224
+ ```
225
+
226
+ ### Task Selection Priority
227
+
228
+ 1. `needs_work` — Fix review feedback
229
+ 2. `in_progress` — Continue existing work
230
+ 3. Tasks that unblock others
231
+ 4. Highest priority ready task
232
+
233
+ ### Key Behaviors
234
+
235
+ - Verify work is needed before starting (prevent duplicates)
236
+ - Decisions auto-resolve without prompts
237
+ - PR review handled externally (not this workflow)
238
+ - All actions are logged and auditable
239
+
240
+ ### Blocking Rules
241
+
242
+ **Block only for genuine external blockers:**
243
+ - Human architectural decision needed
244
+ - Spec clarification required
245
+ - External dependency unavailable
246
+ - Formal `depends_on` blocker
247
+
248
+ **Do NOT block for:**
249
+ - Task seems complex (do the work)
250
+ - Tests are failing (fix them)
251
+ - Service needs running (start it)
252
+
253
+ After blocking:
254
+ ```bash
255
+ kspec task block @ref --reason "Reason..."
256
+ kspec tasks ready --eligible # Check for other work
257
+ # If tasks exist: work on the next one
258
+ # If empty: stop responding (ralph auto-exits)
259
+ ```
260
+
261
+ ### Turn Completion
262
+
263
+ After creating a PR, **stop responding**. Ralph continues automatically — it checks for remaining eligible tasks and exits the loop when none remain.
264
+
265
+ **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.
266
+
267
+ ## Command Reference
268
+
269
+ ```bash
270
+ # Task lifecycle
271
+ kspec task start @ref
272
+ kspec task note @ref "..."
273
+ kspec task submit @ref
274
+ kspec task complete @ref --reason "..."
275
+ kspec task block @ref --reason "..."
276
+
277
+ # Task discovery
278
+ kspec tasks ready
279
+ kspec tasks ready --eligible
280
+ kspec task get @ref
281
+
282
+ # Validation
283
+ kspec validate
284
+ kspec validate --alignment
285
+
286
+ # Session context
287
+ kspec session start
288
+ ```
289
+
290
+ ## Integration
291
+
292
+ - **`/kspec:writing-specs`** — Create specs before deriving tasks
293
+ - **`/kspec:plan`** — Plans create specs that become tasks
294
+ - **`/kspec:review`** — Review checks AC coverage and code quality
295
+ - **`/kspec:observations`** — Capture friction found during task work
296
+ - **`/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