@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,230 @@
1
+ ---
2
+ name: review
3
+ description: Kspec-specific review gates — spec alignment, own AC coverage,
4
+ trait AC coverage, and validation integration. Building block for
5
+ project-specific review workflows.
6
+ ---
7
+ <!-- kspec-managed -->
8
+ # Review
9
+
10
+ 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.
11
+
12
+ ## When to Use
13
+
14
+ - Before creating a PR — verify implementation meets spec
15
+ - As part of a project-specific local review workflow
16
+ - When reviewing code changes against acceptance criteria
17
+
18
+ **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).
19
+
20
+ ## Spec Context Discovery
21
+
22
+ If a spec ref is not explicitly provided, discover it before proceeding with AC checks:
23
+
24
+ ```bash
25
+ # 1. Check commit messages for Task: or Spec: trailers
26
+ git log --format='%B' main..HEAD | grep -E '^(Task|Spec):'
27
+
28
+ # 2. Check changed files for // AC: annotations pointing to specs
29
+ git diff main..HEAD | grep '// AC: @'
30
+
31
+ # 3. If a task ref is found, get its spec_ref
32
+ kspec task get @task-ref --json | jq '.spec_ref'
33
+
34
+ # 4. Search recent tasks matching the scope of changes
35
+ kspec tasks list | grep -i "<keywords from changed files>"
36
+ ```
37
+
38
+ If a spec is found through any method, proceed with full AC validation below.
39
+ If no spec context is found after all discovery steps, skip AC coverage checks and focus on code quality and regression checks.
40
+
41
+ **Principle:** The absence of a trailer is a signal to look harder, not permission to skip validation.
42
+
43
+ ## CLI Lookups
44
+
45
+ Use CLI commands to resolve specs and traits. **Do NOT search `.kspec/` YAML files manually.**
46
+
47
+ | Need | Command |
48
+ |------|---------|
49
+ | Spec + all ACs (own + inherited) | `kspec item get @spec-ref` |
50
+ | Trait definition + ACs | `kspec item get @trait-slug` |
51
+ | All traits on a spec | shown in `kspec item get @spec-ref` output |
52
+ | Search by keyword | `kspec search "keyword"` |
53
+ | All traits | `kspec trait list` |
54
+
55
+ **Resolving inherited traits:** When `kspec item get` shows "Inherited from @trait-slug", run `kspec item get @trait-slug` to see the full trait ACs. This is one command — never grep through `.kspec/modules/*.yaml` files.
56
+
57
+ ## Spec Alignment
58
+
59
+ Implementation must match spec intent, not just pass tests.
60
+
61
+ ### How to Verify
62
+
63
+ ```bash
64
+ # Read the spec — all ACs (own + inherited)
65
+ kspec item get @spec-ref
66
+ ```
67
+
68
+ For each AC, verify:
69
+ 1. **Implementation exists** — Code handles the described behavior
70
+ 2. **Test exists** — A test validates the behavior
71
+ 3. **Behavior matches** — The test actually proves the AC, not just syntactically passes
72
+
73
+ ### What to Flag
74
+
75
+ | Issue | Severity |
76
+ |-------|----------|
77
+ | AC has no implementation | MUST-FIX |
78
+ | AC has no test | MUST-FIX |
79
+ | Implementation deviates from spec | MUST-FIX |
80
+ | Undocumented behavior (not in any AC) | SHOULD-FIX |
81
+ | Spec is vague, implementation chose reasonable interpretation | Note it |
82
+
83
+ ## Own AC Coverage
84
+
85
+ Every acceptance criterion on the spec MUST have at least one annotated test.
86
+
87
+ ### Annotation Format
88
+
89
+ ```javascript
90
+ // AC: @spec-ref ac-N
91
+ it('should validate input when given invalid data', () => { ... });
92
+ ```
93
+
94
+ ```python
95
+ # AC: @spec-ref ac-N
96
+ def test_validates_input():
97
+ ...
98
+ ```
99
+
100
+ ### Checking Coverage
101
+
102
+ ```bash
103
+ # Get all ACs for the spec
104
+ kspec item get @spec-ref
105
+
106
+ # Search for annotations in test files
107
+ # (adapt grep path to your project's test directories)
108
+ grep -rn "// AC: @spec-ref" tests/
109
+ ```
110
+
111
+ Each AC listed in the spec output must have a corresponding annotation. Missing annotations are MUST-FIX.
112
+
113
+ ## Trait AC Coverage
114
+
115
+ When a spec implements traits, it inherits their ACs. Every inherited trait AC must also have test coverage.
116
+
117
+ ### How It Works
118
+
119
+ ```bash
120
+ # kspec item get shows inherited ACs under "Inherited from @trait-slug" sections
121
+ kspec item get @spec-ref
122
+ ```
123
+
124
+ Each inherited AC needs a test annotated with the **trait's** ref, not the spec's ref:
125
+
126
+ ```javascript
127
+ // AC: @trait-json-output ac-1
128
+ it('should output valid JSON with --json flag', () => { ... });
129
+ ```
130
+
131
+ ### Checking Coverage
132
+
133
+ ```bash
134
+ # kspec validate reports uncovered trait ACs
135
+ kspec validate
136
+
137
+ # Search for specific trait annotations
138
+ grep -rn "// AC: @trait-json-output" tests/
139
+ ```
140
+
141
+ Any "inherited trait AC(s) without test coverage" warning from `kspec validate` is a MUST-FIX blocker.
142
+
143
+ ### When a Trait AC Doesn't Apply
144
+
145
+ If a trait AC genuinely doesn't apply to this spec, annotate it with a reason:
146
+
147
+ ```javascript
148
+ // AC: @trait-json-output ac-3 — N/A: this command has no tabular output to format
149
+ ```
150
+
151
+ The annotation must exist so coverage tooling can track it.
152
+
153
+ ### No Traits?
154
+
155
+ If the spec has no traits (`kspec item get` shows no "Inherited from" sections), skip this step entirely.
156
+
157
+ ## Validation Integration
158
+
159
+ ```bash
160
+ kspec validate
161
+ ```
162
+
163
+ Validation catches spec-level issues:
164
+ - Missing acceptance criteria on specs
165
+ - Broken references (dangling `@slug`)
166
+ - Missing descriptions
167
+ - Uncovered trait ACs (the most common review finding)
168
+ - Orphaned specs (no linked tasks)
169
+
170
+ **Exit codes:** `0` = clean, `4` = errors, `6` = warnings only.
171
+
172
+ Treat errors as MUST-FIX. Treat warnings as SHOULD-FIX (especially trait AC warnings).
173
+
174
+ ## Review Checklist
175
+
176
+ Use this checklist when reviewing implementation against a spec:
177
+
178
+ ### MUST-FIX (Blocks PR)
179
+
180
+ - [ ] Every own AC has at least one annotated test
181
+ - [ ] Every inherited trait AC has at least one annotated test (or N/A annotation)
182
+ - [ ] `kspec validate` reports no errors for this spec
183
+ - [ ] Implementation matches spec behavior (not just syntactically correct tests)
184
+ - [ ] No regressions — existing tests still pass
185
+
186
+ ### SHOULD-FIX
187
+
188
+ - [ ] `kspec validate` warnings addressed (especially trait AC coverage)
189
+ - [ ] Undocumented behavior has spec coverage or is flagged
190
+ - [ ] Test annotations reference correct spec/trait refs
191
+
192
+ ### SUGGESTION
193
+
194
+ - [ ] Tests are meaningful (would fail if feature breaks)
195
+ - [ ] Prefer E2E over unit where practical
196
+ - [ ] Tests run in isolation (temp dirs, not project repo)
197
+
198
+ ## Severity Guide
199
+
200
+ | Finding | Severity | Action |
201
+ |---------|----------|--------|
202
+ | Missing own AC test annotation | MUST-FIX | Add test with `// AC: @spec-ref ac-N` |
203
+ | Missing trait AC test annotation | MUST-FIX | Add test with `// AC: @trait-slug ac-N` |
204
+ | `kspec validate` error | MUST-FIX | Fix the validation error |
205
+ | Implementation doesn't match spec | MUST-FIX | Fix implementation or update spec |
206
+ | `kspec validate` warning | SHOULD-FIX | Address warning |
207
+ | Undocumented behavior | SHOULD-FIX | Add AC or note deviation |
208
+ | Test doesn't prove its AC | SHOULD-FIX | Rewrite test |
209
+ | No E2E tests | SUGGESTION | Consider adding |
210
+
211
+ ## Using in Project Reviews
212
+
213
+ This skill provides the kspec-specific gates. Wrap it in your project's review:
214
+
215
+ ```
216
+ Project Review = kspec:review gates + project-specific gates
217
+ ```
218
+
219
+ Project-specific gates to add in your own review skill:
220
+ - **Test commands** — How to run your test suite
221
+ - **Test patterns** — Project-specific test helpers and isolation patterns
222
+ - **Code style** — Naming, error handling, import conventions
223
+ - **E2E specifics** — How E2E tests work in your project
224
+ - **Regression check** — Full suite command and expectations
225
+
226
+ ## Integration
227
+
228
+ - **`/kspec:task-work`** — Run review before submitting tasks
229
+ - **`/kspec:writing-specs`** — If review reveals spec gaps, update specs first
230
+ - **`kspec validate`** — Automated validation complements manual review
@@ -0,0 +1,319 @@
1
+ ---
2
+ name: task-work
3
+ description: Structured task lifecycle — start, work, note, submit, complete.
4
+ Fix cycle handling, scope management, loop mode for automation, and quality
5
+ gates.
6
+ ---
7
+ <!-- kspec-managed -->
8
+ # Task Work
9
+
10
+ Structured workflow for working on tasks. Full lifecycle from start through PR merge.
11
+
12
+ ## When to Use
13
+
14
+ - Starting work on a ready task
15
+ - Continuing in-progress or needs_work tasks
16
+ - Ensuring consistent task lifecycle with notes and audit trail
17
+
18
+ **Not for:** Spec creation (use `/kspec:writing-specs`), plan translation (use `/kspec:plan`), or triage (use `/kspec:triage`).
19
+
20
+ ## Inherit Existing Work First
21
+
22
+ Before starting new work, check for existing work:
23
+
24
+ ```bash
25
+ kspec session start # Shows active work at the top
26
+ ```
27
+
28
+ Priority order:
29
+ 1. **needs_work** — Fix cycle: address review feedback (highest priority)
30
+ 2. **in_progress** — Continue work already started
31
+ 3. **ready (pending)** — New work to start
32
+
33
+ Always inherit existing work unless explicitly told otherwise. This prevents orphaned tasks.
34
+
35
+ ## Task Lifecycle
36
+
37
+ ```
38
+ pending → in_progress → pending_review → completed
39
+ ↓ ↓
40
+ blocked needs_work
41
+ (→ in_progress → pending_review)
42
+ ```
43
+
44
+ | Command | Transition | When |
45
+ |---------|-----------|------|
46
+ | `kspec task start @ref` | → in_progress | Beginning work |
47
+ | `kspec task submit @ref` | → pending_review | Code done, PR created |
48
+ | `kspec task complete @ref --reason "..."` | → completed | PR merged |
49
+ | `kspec task block @ref --reason "..."` | → blocked | External blocker |
50
+
51
+ ## CLI Lookups
52
+
53
+ 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).
54
+
55
+ | Need | Command |
56
+ |------|---------|
57
+ | Task details | `kspec task get @ref` |
58
+ | Spec + all ACs (own + inherited) | `kspec item get @ref` |
59
+ | Trait definition + ACs | `kspec item get @trait-slug` |
60
+ | Search by keyword | `kspec search "keyword"` |
61
+ | List by type | `kspec item list --type feature` |
62
+ | All traits | `kspec trait list` |
63
+ | Task's linked spec | `kspec task get @ref` → read `spec_ref` field |
64
+
65
+ **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.
66
+
67
+ ## Workflow Steps
68
+
69
+ ### 1. Choose Task
70
+
71
+ ```bash
72
+ kspec tasks ready # All ready tasks
73
+ kspec tasks ready --eligible # Automation-eligible only (loop mode)
74
+ ```
75
+
76
+ ### 2. Verify Work Is Needed
77
+
78
+ Before starting, check if work is already done:
79
+
80
+ ```bash
81
+ # Check git history
82
+ git log --oneline --grep="feature-name"
83
+ git log --oneline -- path/to/relevant/files
84
+
85
+ # Check existing implementation
86
+ kspec item get @spec-ref # View spec and ACs
87
+ ```
88
+
89
+ If already implemented: verify tests pass, AC coverage exists, then `kspec task complete @ref --reason "Already implemented"`.
90
+
91
+ **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.
92
+
93
+ ### 3. Start Task
94
+
95
+ ```bash
96
+ kspec task start @ref
97
+ ```
98
+
99
+ ### 4. Work and Note
100
+
101
+ Read all ACs (own + trait) before implementing:
102
+
103
+ ```bash
104
+ kspec item get @spec-ref # Shows own ACs AND inherited trait ACs
105
+ ```
106
+
107
+ Add notes during work, not just at the end:
108
+
109
+ ```bash
110
+ # Good: explains decisions and context
111
+ kspec task note @ref "Using retry with exponential backoff. Chose 3 max retries based on API rate limits."
112
+
113
+ # Bad: no context
114
+ kspec task note @ref "Done"
115
+ ```
116
+
117
+ Note when you:
118
+ - Discover something unexpected
119
+ - Make a design decision
120
+ - Encounter a blocker
121
+ - Complete a significant piece
122
+
123
+ ### 5. Commit
124
+
125
+ Include task and spec trailers:
126
+
127
+ ```
128
+ feat: add user authentication
129
+
130
+ Implemented JWT-based auth with refresh tokens.
131
+
132
+ Task: @task-add-auth
133
+ Spec: @auth-feature
134
+ ```
135
+
136
+ Trailers enable `kspec log @ref` to find related commits.
137
+
138
+ ### 6. Local Review
139
+
140
+ Run quality checks before submitting. Verify:
141
+
142
+ - **Own AC coverage** — Each spec AC has a test annotated `// AC: @spec-ref ac-N`
143
+ - **Trait AC coverage** — Each inherited trait AC has a test annotated `// AC: @trait-slug ac-N`
144
+ - **Tests pass** — Full test suite, not just new tests
145
+ - **Code quality** — Matches existing patterns, no duplicated utilities
146
+ - **No regressions** — Existing tests still pass
147
+
148
+ ```bash
149
+ kspec validate # Reports uncovered trait ACs as warnings
150
+ ```
151
+
152
+ ### 7. Submit Task
153
+
154
+ ```bash
155
+ kspec task submit @ref
156
+ ```
157
+
158
+ Moves task to `pending_review`. Create PR after submitting.
159
+
160
+ ### 8. Complete Task
161
+
162
+ After PR is merged:
163
+
164
+ ```bash
165
+ kspec task complete @ref --reason "Merged in PR #N. Summary of what was done."
166
+ ```
167
+
168
+ ## Fix Cycle
169
+
170
+ When inheriting a `needs_work` task:
171
+
172
+ 1. **Find the PR** — Check for review comments
173
+ ```bash
174
+ gh pr list --search "Task: @task-ref" --json number,url
175
+ gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '.[] | {path, line, body}'
176
+ ```
177
+
178
+ 2. **Fix findings** — Address MUST-FIX and SHOULD-FIX items
179
+
180
+ 3. **Push fixes** — Commit with descriptive message
181
+ ```bash
182
+ git add <files> && git commit -m "fix: address review feedback
183
+
184
+ Task: @task-slug"
185
+ git push
186
+ ```
187
+
188
+ 4. **Re-submit** — `kspec task submit @ref` (back to pending_review)
189
+
190
+ You do NOT merge in a fix cycle. The reviewer handles merge decisions.
191
+
192
+ ## Scope Management
193
+
194
+ ### What's In Scope
195
+
196
+ Tasks describe expected outcomes, not rigid boundaries:
197
+
198
+ - **Tests need implementation?** Implementing missing functionality is in scope — the goal is verified behavior
199
+ - **Implementation needs tests?** Proving it works is always in scope
200
+
201
+ ### When to Expand vs Escalate
202
+
203
+ **Expand** (do it yourself):
204
+ - Additional work is clearly implied by the goal
205
+ - Proportional to the original task
206
+ - You have the context
207
+
208
+ **Escalate** (capture separately):
209
+ - Scope expansion is major
210
+ - Uncertain about the right approach
211
+ - Outside your task's domain
212
+
213
+ **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.
214
+
215
+ ## AC Test Annotations
216
+
217
+ Link tests to acceptance criteria:
218
+
219
+ ```javascript
220
+ // AC: @spec-item ac-N
221
+ it('should validate input', () => { ... });
222
+ ```
223
+
224
+ ```python
225
+ # AC: @spec-item ac-N
226
+ def test_validates_input():
227
+ ...
228
+ ```
229
+
230
+ Every AC should have at least one test with this annotation.
231
+
232
+ ## Implementation Quality
233
+
234
+ Before submitting:
235
+
236
+ - **Search for existing utilities** — Don't duplicate helpers that already exist
237
+ - **Match neighboring file style** — Naming conventions, error handling, imports
238
+ - **Run full test suite** — Not just your new tests
239
+ - **Validate** — `kspec validate` for spec alignment
240
+
241
+ ## Loop Mode
242
+
243
+ Autonomous task execution without human confirmation.
244
+
245
+ ```bash
246
+ kspec tasks ready --eligible # Only automation-eligible tasks
247
+ ```
248
+
249
+ ### Task Selection Priority
250
+
251
+ 1. `needs_work` — Fix review feedback
252
+ 2. `in_progress` — Continue existing work
253
+ 3. Tasks that unblock others
254
+ 4. Highest priority ready task
255
+
256
+ ### Key Behaviors
257
+
258
+ - Verify work is needed before starting (prevent duplicates)
259
+ - Decisions auto-resolve without prompts
260
+ - PR review handled externally (not this workflow)
261
+ - All actions are logged and auditable
262
+
263
+ ### Blocking Rules
264
+
265
+ **Block only for genuine external blockers:**
266
+ - Human architectural decision needed
267
+ - Spec clarification required
268
+ - External dependency unavailable
269
+ - Formal `depends_on` blocker
270
+
271
+ **Do NOT block for:**
272
+ - Task seems complex (do the work)
273
+ - Tests are failing (fix them)
274
+ - Service needs running (start it)
275
+
276
+ After blocking:
277
+ ```bash
278
+ kspec task block @ref --reason "Reason..."
279
+ kspec tasks ready --eligible # Check for other work
280
+ # If tasks exist: work on the next one
281
+ # If empty: stop responding (ralph auto-exits)
282
+ ```
283
+
284
+ ### Turn Completion
285
+
286
+ After creating a PR, **stop responding**. Ralph continues automatically — it checks for remaining eligible tasks and exits the loop when none remain.
287
+
288
+ **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.
289
+
290
+ ## Command Reference
291
+
292
+ ```bash
293
+ # Task lifecycle
294
+ kspec task start @ref
295
+ kspec task note @ref "..."
296
+ kspec task submit @ref
297
+ kspec task complete @ref --reason "..."
298
+ kspec task block @ref --reason "..."
299
+
300
+ # Task discovery
301
+ kspec tasks ready
302
+ kspec tasks ready --eligible
303
+ kspec task get @ref
304
+
305
+ # Validation
306
+ kspec validate
307
+ kspec validate --alignment
308
+
309
+ # Session context
310
+ kspec session start
311
+ ```
312
+
313
+ ## Integration
314
+
315
+ - **`/kspec:writing-specs`** — Create specs before deriving tasks
316
+ - **`/kspec:plan`** — Plans create specs that become tasks
317
+ - **`/kspec:review`** — Review checks AC coverage and code quality
318
+ - **`/kspec:observations`** — Capture friction found during task work
319
+ - **`/kspec:reflect`** — Session reflection after completing tasks
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: triage-automation
3
+ description: Assess and prepare tasks for automation eligibility. Verify spec
4
+ coverage, acceptance criteria, and task readiness for automated agents.
5
+ ---
6
+ <!-- kspec-managed -->
7
+ # Automation Triage
8
+
9
+ Assess and prepare tasks for automation eligibility. Goal: make tasks self-contained so they can be worked on by automated agents.
10
+
11
+ ## When to Use
12
+
13
+ - During a triage session focused on automation readiness
14
+ - When new tasks need eligibility assessment
15
+ - Before starting an automated work loop (to ensure eligible tasks exist)
16
+
17
+ ## Philosophy
18
+
19
+ - **Eligible is the goal** — Manual-only should be the exception
20
+ - **Criteria are for visibility** — Help identify what's missing, not auto-approve
21
+ - **Fix issues, don't just assess** — Guide toward making tasks automatable
22
+
23
+ ## Eligibility Criteria
24
+
25
+ A task is ready for automation when:
26
+
27
+ 1. Has `spec_ref` pointing to a resolvable spec
28
+ 2. Spec has acceptance criteria (testable outcomes)
29
+ 3. Task type is not `spike` (spikes output knowledge, not code)
30
+
31
+ **Having spec + ACs is necessary but not sufficient** — you must also verify the spec is appropriate and ACs are adequate for the task.
32
+
33
+ **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.
34
+
35
+ ## Workflow
36
+
37
+ ### 1. Get Assessment Overview
38
+
39
+ ```bash
40
+ # Show unassessed pending tasks with criteria status
41
+ kspec tasks assess automation
42
+
43
+ # See what auto mode would change
44
+ kspec tasks assess automation --auto --dry-run
45
+ ```
46
+
47
+ ### 2. Process Each Task
48
+
49
+ For each task shown:
50
+
51
+ **If spike:**
52
+ - Mark `manual_only` — spikes are inherently human work
53
+ - `kspec task set @ref --automation manual_only --reason "Spike - output is knowledge"`
54
+
55
+ **If missing spec_ref or no ACs:**
56
+ - Ask: "Fix now or mark for later?"
57
+ - **Fix now:**
58
+ 1. Create or find appropriate spec: `kspec item add --under @parent --title "..."`
59
+ 2. Add acceptance criteria: `kspec item ac add @spec --given "..." --when "..." --then "..."`
60
+ 3. Link task to spec: `kspec task set @ref --spec-ref @spec`
61
+ 4. Re-assess and mark eligible if appropriate
62
+ - **Mark for later:**
63
+ - `kspec task set @ref --automation needs_review --reason "Missing spec - needs spec creation"`
64
+
65
+ **If has spec + ACs:**
66
+ - Review for eligibility:
67
+ - Is the spec appropriate for this task?
68
+ - Are the ACs adequate and testable?
69
+ - Does the task have sufficient context?
70
+ - If yes: `kspec task set @ref --automation eligible`
71
+ - If no: Fix issues or mark `needs_review` with specific reason
72
+
73
+ ### 3. Batch Processing with Auto Mode
74
+
75
+ For fast triage of obvious cases:
76
+
77
+ ```bash
78
+ # Apply auto mode (spikes → manual_only, missing → needs_review)
79
+ kspec tasks assess automation --auto
80
+
81
+ # Then manually review the "review_for_eligible" tasks
82
+ kspec tasks ready --unassessed
83
+ ```
84
+
85
+ Auto mode is conservative:
86
+ - Spikes → `manual_only`
87
+ - Missing spec/ACs → `needs_review`
88
+ - Has spec + ACs → **NOT auto-marked** (requires review)
89
+
90
+ ## Commands Reference
91
+
92
+ ```bash
93
+ # Assessment
94
+ kspec tasks assess automation # Show unassessed with criteria
95
+ kspec tasks assess automation @ref # Single task
96
+ kspec tasks assess automation --all # Include already-assessed
97
+ kspec tasks assess automation --auto # Apply obvious cases
98
+ kspec tasks assess automation --dry-run # Preview changes
99
+
100
+ # Setting automation status
101
+ kspec task set @ref --automation eligible
102
+ kspec task set @ref --automation needs_review --reason "Why"
103
+ kspec task set @ref --automation manual_only --reason "Why"
104
+ kspec task set @ref --no-automation # Clear to unassessed
105
+
106
+ # Filtering tasks
107
+ kspec tasks ready --unassessed # Tasks needing assessment
108
+ kspec tasks ready --eligible # Automation-ready tasks
109
+ kspec tasks ready --needs-review # Tasks needing human triage
110
+ ```
111
+
112
+ ## Assessment Output
113
+
114
+ ```
115
+ @task-slug "Task title"
116
+ spec_ref: ✓ @feature-slug
117
+ has_acs: ✓ 3 acceptance criteria
118
+ not_spike: ✓ type: task
119
+ → review_for_eligible (verify spec/AC adequacy)
120
+ ```
121
+
122
+ | Recommendation | Meaning | Auto Mode Action |
123
+ |----------------|---------|------------------|
124
+ | `review_for_eligible` | Passes criteria, needs review | No change (manual review) |
125
+ | `needs_review` | Missing spec or ACs | Sets `needs_review` with reason |
126
+ | `manual_only` | Spike task | Sets `manual_only` |
127
+
128
+ ## Key Principles
129
+
130
+ - **CLI doesn't auto-mark eligible** — Requires agent/human review
131
+ - **Agents CAN mark eligible** — When reviewing based on user instruction
132
+ - **Add notes when setting status** — Document the "why"
133
+ - **Re-assess after fixes** — After adding spec/ACs, check again
134
+ - **Task type is not destiny** — Any non-spike task can be eligible
135
+
136
+ ## Integration
137
+
138
+ - **`/kspec:triage-inbox`** — Inbox triage may promote items to tasks needing assessment
139
+ - **`kspec tasks ready --eligible`** — Used by task-work loop to find automatable work
140
+ - **Ralph loop** — Consumes eligible tasks; automation assessment feeds the pipeline