@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,303 @@
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
+ ## Workflow Steps
52
+
53
+ ### 1. Choose Task
54
+
55
+ ```bash
56
+ kspec tasks ready # All ready tasks
57
+ kspec tasks ready --eligible # Automation-eligible only (loop mode)
58
+ ```
59
+
60
+ ### 2. Verify Work Is Needed
61
+
62
+ Before starting, check if work is already done:
63
+
64
+ ```bash
65
+ # Check git history
66
+ git log --oneline --grep="feature-name"
67
+ git log --oneline -- path/to/relevant/files
68
+
69
+ # Check existing implementation
70
+ kspec item get @spec-ref # View spec and ACs
71
+ ```
72
+
73
+ If already implemented: verify tests pass, AC coverage exists, then `kspec task complete @ref --reason "Already implemented"`.
74
+
75
+ **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.
76
+
77
+ ### 3. Start Task
78
+
79
+ ```bash
80
+ kspec task start @ref
81
+ ```
82
+
83
+ ### 4. Work and Note
84
+
85
+ Read all ACs (own + trait) before implementing:
86
+
87
+ ```bash
88
+ kspec item get @spec-ref # Shows own ACs AND inherited trait ACs
89
+ ```
90
+
91
+ Add notes during work, not just at the end:
92
+
93
+ ```bash
94
+ # Good: explains decisions and context
95
+ kspec task note @ref "Using retry with exponential backoff. Chose 3 max retries based on API rate limits."
96
+
97
+ # Bad: no context
98
+ kspec task note @ref "Done"
99
+ ```
100
+
101
+ Note when you:
102
+ - Discover something unexpected
103
+ - Make a design decision
104
+ - Encounter a blocker
105
+ - Complete a significant piece
106
+
107
+ ### 5. Commit
108
+
109
+ Include task and spec trailers:
110
+
111
+ ```
112
+ feat: add user authentication
113
+
114
+ Implemented JWT-based auth with refresh tokens.
115
+
116
+ Task: @task-add-auth
117
+ Spec: @auth-feature
118
+ ```
119
+
120
+ Trailers enable `kspec log @ref` to find related commits.
121
+
122
+ ### 6. Local Review
123
+
124
+ Run quality checks before submitting. Verify:
125
+
126
+ - **Own AC coverage** — Each spec AC has a test annotated `// AC: @spec-ref ac-N`
127
+ - **Trait AC coverage** — Each inherited trait AC has a test annotated `// AC: @trait-slug ac-N`
128
+ - **Tests pass** — Full test suite, not just new tests
129
+ - **Code quality** — Matches existing patterns, no duplicated utilities
130
+ - **No regressions** — Existing tests still pass
131
+
132
+ ```bash
133
+ kspec validate # Reports uncovered trait ACs as warnings
134
+ ```
135
+
136
+ ### 7. Submit Task
137
+
138
+ ```bash
139
+ kspec task submit @ref
140
+ ```
141
+
142
+ Moves task to `pending_review`. Create PR after submitting.
143
+
144
+ ### 8. Complete Task
145
+
146
+ After PR is merged:
147
+
148
+ ```bash
149
+ kspec task complete @ref --reason "Merged in PR #N. Summary of what was done."
150
+ ```
151
+
152
+ ## Fix Cycle
153
+
154
+ When inheriting a `needs_work` task:
155
+
156
+ 1. **Find the PR** — Check for review comments
157
+ ```bash
158
+ gh pr list --search "Task: @task-ref" --json number,url
159
+ gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '.[] | {path, line, body}'
160
+ ```
161
+
162
+ 2. **Fix findings** — Address MUST-FIX and SHOULD-FIX items
163
+
164
+ 3. **Push fixes** — Commit with descriptive message
165
+ ```bash
166
+ git add <files> && git commit -m "fix: address review feedback
167
+
168
+ Task: @task-slug"
169
+ git push
170
+ ```
171
+
172
+ 4. **Re-submit** — `kspec task submit @ref` (back to pending_review)
173
+
174
+ You do NOT merge in a fix cycle. The reviewer handles merge decisions.
175
+
176
+ ## Scope Management
177
+
178
+ ### What's In Scope
179
+
180
+ Tasks describe expected outcomes, not rigid boundaries:
181
+
182
+ - **Tests need implementation?** Implementing missing functionality is in scope — the goal is verified behavior
183
+ - **Implementation needs tests?** Proving it works is always in scope
184
+
185
+ ### When to Expand vs Escalate
186
+
187
+ **Expand** (do it yourself):
188
+ - Additional work is clearly implied by the goal
189
+ - Proportional to the original task
190
+ - You have the context
191
+
192
+ **Escalate** (capture separately):
193
+ - Scope expansion is major
194
+ - Uncertain about the right approach
195
+ - Outside your task's domain
196
+
197
+ **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.
198
+
199
+ ## AC Test Annotations
200
+
201
+ Link tests to acceptance criteria:
202
+
203
+ ```javascript
204
+ // AC: @spec-item ac-N
205
+ it('should validate input', () => { ... });
206
+ ```
207
+
208
+ ```python
209
+ # AC: @spec-item ac-N
210
+ def test_validates_input():
211
+ ...
212
+ ```
213
+
214
+ Every AC should have at least one test with this annotation.
215
+
216
+ ## Implementation Quality
217
+
218
+ Before submitting:
219
+
220
+ - **Search for existing utilities** — Don't duplicate helpers that already exist
221
+ - **Match neighboring file style** — Naming conventions, error handling, imports
222
+ - **Run full test suite** — Not just your new tests
223
+ - **Validate** — `kspec validate` for spec alignment
224
+
225
+ ## Loop Mode
226
+
227
+ Autonomous task execution without human confirmation.
228
+
229
+ ```bash
230
+ kspec tasks ready --eligible # Only automation-eligible tasks
231
+ ```
232
+
233
+ ### Task Selection Priority
234
+
235
+ 1. `needs_work` — Fix review feedback
236
+ 2. `in_progress` — Continue existing work
237
+ 3. Tasks that unblock others
238
+ 4. Highest priority ready task
239
+
240
+ ### Key Behaviors
241
+
242
+ - Verify work is needed before starting (prevent duplicates)
243
+ - Decisions auto-resolve without prompts
244
+ - PR review handled externally (not this workflow)
245
+ - All actions are logged and auditable
246
+
247
+ ### Blocking Rules
248
+
249
+ **Block only for genuine external blockers:**
250
+ - Human architectural decision needed
251
+ - Spec clarification required
252
+ - External dependency unavailable
253
+ - Formal `depends_on` blocker
254
+
255
+ **Do NOT block for:**
256
+ - Task seems complex (do the work)
257
+ - Tests are failing (fix them)
258
+ - Service needs running (start it)
259
+
260
+ After blocking:
261
+ ```bash
262
+ kspec task block @ref --reason "Reason..."
263
+ kspec tasks ready --eligible # Check for other work
264
+ # If tasks exist: work on the next one
265
+ # If empty: stop responding (ralph auto-exits)
266
+ ```
267
+
268
+ ### Turn Completion
269
+
270
+ After creating a PR, **stop responding**. Ralph continues automatically — it checks for remaining eligible tasks and exits the loop when none remain.
271
+
272
+ **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.
273
+
274
+ ## Command Reference
275
+
276
+ ```bash
277
+ # Task lifecycle
278
+ kspec task start @ref
279
+ kspec task note @ref "..."
280
+ kspec task submit @ref
281
+ kspec task complete @ref --reason "..."
282
+ kspec task block @ref --reason "..."
283
+
284
+ # Task discovery
285
+ kspec tasks ready
286
+ kspec tasks ready --eligible
287
+ kspec task get @ref
288
+
289
+ # Validation
290
+ kspec validate
291
+ kspec validate --alignment
292
+
293
+ # Session context
294
+ kspec session start
295
+ ```
296
+
297
+ ## Integration
298
+
299
+ - **`/kspec:writing-specs`** — Create specs before deriving tasks
300
+ - **`/kspec:plan`** — Plans create specs that become tasks
301
+ - **`/kspec:review`** — Review checks AC coverage and code quality
302
+ - **`/kspec:observations`** — Capture friction found during task work
303
+ - **`/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
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: triage-inbox
3
+ description: Process inbox items using the record-act pattern. Categorize,
4
+ promote to spec/task, merge duplicates, defer, or delete stale items with full
5
+ audit trail.
6
+ ---
7
+ <!-- kspec-managed -->
8
+ # Inbox Triage
9
+
10
+ Systematically process inbox items using the **record → act** pattern. Records decisions with audit trail, then executes actions.
11
+
12
+ ## When to Use
13
+
14
+ - Processing accumulated inbox items
15
+ - During a triage session (`kspec workflow start @inbox-triage`)
16
+ - When inbox count is growing and needs attention
17
+
18
+ ## Core Concept: Record → Act
19
+
20
+ Triage separates **decision-making** from **execution**:
21
+
22
+ 1. **Record** the decision (what to do + why)
23
+ 2. **Act** on the decision (execute it)
24
+
25
+ This enables review, override, and audit trails.
26
+
27
+ ```bash
28
+ # Step 1: Record what you want to do
29
+ kspec triage record @inbox-ref --action promote --reasoning "Clear feature request"
30
+
31
+ # Step 2: Execute the decision
32
+ kspec triage act @triage-ref
33
+ ```
34
+
35
+ ### Actions
36
+
37
+ | Action | What `act` does |
38
+ |--------|-----------------|
39
+ | `promote` | Creates task from inbox item snapshot |
40
+ | `delete` | Deletes the inbox item |
41
+ | `defer` | Records deferral, no side effect |
42
+ | `spec-gap` | Creates observation tagged spec-gap |
43
+ | `duplicate` | Deletes the inbox item |
44
+
45
+ ### Lifecycle
46
+
47
+ ```
48
+ record (with action) override (optional) act
49
+ → triaged → triaged → acted_on
50
+ ```
51
+
52
+ ## Workflow
53
+
54
+ ### 1. Gather Context
55
+
56
+ ```bash
57
+ kspec session start --full
58
+ kspec inbox list
59
+ ```
60
+
61
+ ### 2. Categorize Items
62
+
63
+ Group inbox items by type:
64
+ - **Bugs** — implementation issues, errors
65
+ - **Spec gaps** — missing or incomplete specs
66
+ - **Quick wins** — small, well-defined improvements
67
+ - **Larger features** — need plan mode to design
68
+ - **Process/workflow** — meta improvements
69
+ - **Delete candidates** — outdated, duplicates, already done
70
+
71
+ Present categories to user for alignment.
72
+
73
+ ### 3. Triage Each Item
74
+
75
+ **Interactive mode** (recommended for multiple items):
76
+
77
+ ```bash
78
+ kspec triage start
79
+ # Presents untriaged items one by one
80
+ # Prompts for action + reasoning
81
+ # Ctrl+C preserves all previously committed records
82
+ ```
83
+
84
+ **Individual recording** (for targeted decisions):
85
+
86
+ ```bash
87
+ kspec triage record @ref --action promote --reasoning "Clear feature request with spec coverage"
88
+ kspec triage record @ref --action delete --reasoning "Already implemented in PR #123"
89
+ kspec triage record @ref --action defer --reasoning "Depends on auth system redesign"
90
+ kspec triage record @ref --action spec-gap --reasoning "No spec covers error handling for this flow"
91
+ kspec triage record @ref --action duplicate --reasoning "Covered by @existing-spec"
92
+ ```
93
+
94
+ ### 4. Review and Execute Decisions
95
+
96
+ ```bash
97
+ # Review what was recorded
98
+ kspec triage list --status triaged
99
+
100
+ # Preview before executing
101
+ kspec triage act @triage-ref --dry-run
102
+
103
+ # Execute decisions
104
+ kspec triage act @triage-ref
105
+ ```
106
+
107
+ ### 5. Override If Needed
108
+
109
+ ```bash
110
+ # Override changes the action while preserving the audit trail
111
+ kspec triage override @triage-ref --action defer --reasoning "Reconsidered - not ready"
112
+
113
+ # Then act on the updated decision
114
+ kspec triage act @triage-ref
115
+ ```
116
+
117
+ ## Spec-First Processing
118
+
119
+ For behavior changes, check spec coverage before promoting:
120
+
121
+ 1. **Check coverage**: `kspec item list | grep <relevant>`
122
+ 2. **Identify gaps**: Does spec have description AND acceptance criteria?
123
+ 3. **Update spec**:
124
+ ```bash
125
+ kspec item set @ref --description "..."
126
+ kspec item ac add @ref --given "..." --when "..." --then "..."
127
+ ```
128
+ 4. **Record and act**:
129
+ ```bash
130
+ kspec triage record @inbox-ref --action promote --reasoning "Spec updated" --evidence @spec-ref
131
+ kspec triage act @triage-ref
132
+ ```
133
+
134
+ ## Plan Mode for Larger Items
135
+
136
+ When an item needs design work:
137
+
138
+ 1. Enter plan mode
139
+ 2. Explore codebase for patterns/context
140
+ 3. Design spec structure and implementation approach
141
+ 4. Write plan, exit for approval
142
+ 5. Execute: create spec, add AC, derive task
143
+
144
+ ## Observation Processing
145
+
146
+ During triage sessions, you may also process pending observations:
147
+
148
+ ```bash
149
+ kspec meta observations --pending-resolution
150
+ ```
151
+
152
+ For each observation:
153
+
154
+ | Type | How to Process |
155
+ |------|----------------|
156
+ | **friction** | Reveals spec gap? → Create spec or inbox item. Already addressed? → Resolve |
157
+ | **success** | Document in relevant spec or AGENTS.md if broadly useful → Resolve |
158
+ | **question** | Answer if you can. Needs investigation? → Promote to task |
159
+ | **idea** | Clear scope? → Inbox or task. Unclear? → Leave or delete if stale |
160
+
161
+ ```bash
162
+ # Promote observation to task
163
+ kspec meta promote @ref --title "Add bulk AC command" --priority 2
164
+
165
+ # Resolve observation
166
+ kspec meta resolve @ref "Resolution notes"
167
+ kspec meta resolve --refs @ref1 @ref2 --resolution "Batch resolution"
168
+
169
+ # Convert inbox item to observation (if it's a pattern, not a task)
170
+ kspec meta observe --from-inbox @ref
171
+ ```
172
+
173
+ ## Export for Context
174
+
175
+ Share triage decisions with other agents or sessions:
176
+
177
+ ```bash
178
+ # Markdown context blocks (for agent handoff)
179
+ kspec triage export --format context
180
+
181
+ # Full structured data
182
+ kspec triage export --format json
183
+ ```
184
+
185
+ ## Bulk Operations with Batch
186
+
187
+ When triaging many items, use `kspec batch` for atomic operations:
188
+
189
+ ```bash
190
+ kspec batch --commands '[
191
+ {"command":"triage record","args":{"ref":"@ref1","action":"delete","reasoning":"Stale"}},
192
+ {"command":"triage record","args":{"ref":"@ref2","action":"promote","reasoning":"Clear scope"}}
193
+ ]'
194
+ ```
195
+
196
+ Use `--dry-run` to preview. See `/kspec:help` for full batch documentation.
197
+
198
+ ## Common Patterns
199
+
200
+ | Pattern | Action |
201
+ |---------|--------|
202
+ | Already implemented | Verify impl exists → check spec gaps → record delete |
203
+ | Duplicate of existing | Verify original covers scope → record duplicate |
204
+ | Small flag/option | Update spec + AC → record promote |
205
+ | New command | Plan mode → design spec → record promote with evidence |
206
+ | Bug report | Check spec coverage → update spec → record promote |
207
+ | Vague idea | Record defer, or leave untriaged for later |
208
+ | Missing spec | Record spec-gap → creates observation for follow-up |
209
+
210
+ ## Key Principles
211
+
212
+ - **Record before act** — Separate decisions from execution for audit trail
213
+ - **Ask one question at a time** — Don't batch decisions in interactive mode
214
+ - **Spec before task** — Fill spec gaps before promoting to tasks
215
+ - **AC is required** — Specs without acceptance criteria are incomplete
216
+ - **Use CLI, not YAML** — All changes through kspec commands
217
+ - **Delete freely** — Outdated or duplicate items should go
218
+
219
+ ## Progress Tracking
220
+
221
+ At session end, provide summary:
222
+ - Items triaged (recorded decisions)
223
+ - Actions executed (promoted, deleted, deferred, spec-gap, duplicate)
224
+ - Tasks created/updated
225
+ - Observations resolved
226
+ - Remaining items
227
+
228
+ ## Integration
229
+
230
+ - **`/kspec:reflect`** — Session reflection may generate inbox items for triage
231
+ - **`/kspec:observations`** — Captures systemic patterns found during triage
232
+ - **`kspec session start`** — Shows inbox count for triage awareness