trekoon 0.4.2 → 0.4.4

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 (40) hide show
  1. package/.agents/skills/trekoon/SKILL.md +97 -208
  2. package/.agents/skills/trekoon/reference/execution-with-team.md +87 -149
  3. package/.agents/skills/trekoon/reference/execution.md +170 -380
  4. package/.agents/skills/trekoon/reference/harness-primitives.md +77 -0
  5. package/.agents/skills/trekoon/reference/planning.md +193 -330
  6. package/.agents/skills/trekoon/reference/sync.md +56 -103
  7. package/README.md +29 -10
  8. package/docs/ai-agents.md +48 -4
  9. package/docs/commands.md +34 -25
  10. package/docs/machine-contracts.md +1 -1
  11. package/docs/quickstart.md +9 -9
  12. package/package.json +2 -2
  13. package/src/board/asset-root.ts +73 -0
  14. package/src/board/assets/app.js +5 -3
  15. package/src/board/assets/components/Component.js +6 -8
  16. package/src/board/assets/state/actions.js +3 -0
  17. package/src/board/assets/state/api.js +48 -34
  18. package/src/board/assets/state/store.js +3 -0
  19. package/src/board/event-bus.ts +15 -0
  20. package/src/board/routes.ts +94 -83
  21. package/src/board/server.ts +35 -8
  22. package/src/board/snapshot.ts +6 -0
  23. package/src/board/types.ts +2 -34
  24. package/src/board/wal-watcher.ts +170 -28
  25. package/src/commands/board.ts +20 -42
  26. package/src/commands/help.ts +11 -12
  27. package/src/commands/init.ts +0 -29
  28. package/src/commands/quickstart.ts +1 -1
  29. package/src/commands/skills.ts +17 -5
  30. package/src/domain/mutation-service.ts +61 -42
  31. package/src/domain/tracker-domain.ts +20 -16
  32. package/src/domain/types.ts +3 -0
  33. package/src/export/render-markdown.ts +1 -2
  34. package/src/runtime/daemon.ts +110 -49
  35. package/src/runtime/version.ts +10 -2
  36. package/src/storage/database.ts +9 -2
  37. package/src/storage/migrations.ts +19 -2
  38. package/src/storage/path.ts +0 -36
  39. package/src/sync/service.ts +47 -27
  40. package/src/board/install.ts +0 -196
@@ -1,417 +1,281 @@
1
1
  # Planning Reference
2
2
 
3
- Write implementation plans directly into Trekoon as epics with task/subtask
4
- DAGs. Plans must be directly executable without re-interpretation.
3
+ Write plans directly into Trekoon as epics with task/subtask DAGs. A plan is
4
+ done only when the epic exists, the graph is validated, and the user can run
5
+ `trekoon <epic-id> execute` without reinterpretation.
5
6
 
6
- **Plan mode contract:** planning is complete only when the epic exists in
7
- Trekoon, the dependency graph is validated, and the user can immediately run
8
- `trekoon <epic-id> execute`.
7
+ Ask planning-critical questions before writing. Use the harness question tool
8
+ when available (`question`, `AskUserQuestion`, or native equivalent); otherwise
9
+ ask one concise plain-text question. Use multi-select only for independent
10
+ features that can combine. Use single-select for mutually exclusive choices.
9
11
 
10
- **Clarify ambiguity upfront.** If the plan has unclear requirements or meaningful
11
- tradeoffs, ask the user before writing. Present options with clear tradeoffs.
12
- Use multi-select for independent features that can be combined; use single-select
13
- for mutually exclusive choices.
12
+ ## Before You Create Records
14
13
 
15
- Use the harness's interactive user-question tool when you need clarification:
14
+ Synthesize existing context instead of rediscovering it:
16
15
 
17
- - OpenCode: `question`
18
- - Claude Code: `AskUserQuestion`
16
+ 1. Goal and user outcome.
17
+ 2. Decisions already made and rejected options.
18
+ 3. Constraints: architecture, compatibility, safety, timelines, libraries.
19
+ 4. Affected areas: subsystems, paths, interfaces, workflows.
20
+ 5. Verification evidence needed for completion.
21
+ 6. Unknowns that block graph creation.
19
22
 
20
- Do not hide planning-critical questions inside a long narrative response.
23
+ If the brief is sufficient, plan. If not, do targeted research or ask one narrow
24
+ question. Preserve prior user decisions unless they explicitly reopen them.
25
+ Expand existing Trekoon items when they already represent the work.
21
26
 
22
- ## Pre-plan synthesis
27
+ ## Data Model
23
28
 
24
- Before creating or expanding an epic, synthesize the context you already have.
25
- Planning should consume previous brainstorming, research, and codebase discovery
26
- rather than redoing it from scratch.
29
+ - Epic: full outcome, scope, constraints, and verification gates.
30
+ - Task: one complete subsystem/domain work unit that one agent can own.
31
+ - Subtask: concrete implementation/test/verification step under a task.
32
+ - Dependency: hard prerequisite only, not "nice to have" ordering.
27
33
 
28
- Build a short internal planning brief with:
34
+ All new entities start as `todo`. Do not create records as `in_progress`,
35
+ `blocked`, or `done`.
29
36
 
30
- 1. **Goal** what outcome the user wants
31
- 2. **Decisions already made** — chosen direction, rejected options, known tradeoffs
32
- 3. **Known constraints** — architecture, library constraints, timelines, safety, compatibility
33
- 4. **Affected areas** — subsystems, files, interfaces, or workflows likely involved
34
- 5. **Verification expectations** — what evidence will prove the work is complete
35
- 6. **Remaining unknowns** — only the ones that actually block graph creation
37
+ ## Write Detailed, Executable Records
36
38
 
37
- If the brief is already sufficient, go straight into planning. If important
38
- unknowns remain, do targeted research or ask a narrow user question before
39
- creating the graph.
39
+ ### Epic
40
40
 
41
- ## Research-aware planning rules
42
-
43
- - Reuse research conclusions in the epic and task descriptions.
44
- - Carry forward concrete patterns, file paths, APIs, and constraints that were
45
- discovered earlier.
46
- - Do not replace prior decisions with generic planning boilerplate.
47
- - If the user already chose an approach during brainstorming, plan that approach
48
- unless they explicitly reopen the decision.
49
- - If existing Trekoon items already represent part of the work, expand or refine
50
- them instead of recreating parallel tracking state.
51
-
52
- ## Planning data model
53
-
54
- - **Epic** = full feature outcome and constraints.
55
- - **Task** = one complete subsystem/domain work unit that can be owned by one
56
- agent.
57
- - **Subtask** = concrete implementation/test/verification step under a task.
58
- - **Dependency edge** = strict prerequisite only (do not add "nice to have"
59
- dependencies).
60
-
61
- All entities start in `todo`. See `reference/status-machine.md` for the
62
- canonical transition table.
63
-
64
- Plan implications:
65
- - Never set initial status to anything other than `todo` in create commands.
66
- - Task descriptions should reference valid transitions when documenting
67
- completion flow (e.g., "todo -> in_progress -> done", not "todo -> done").
68
- - `task done` auto-transitions through `in_progress`, but `task update` does
69
- not — plan descriptions should note this for agents.
70
-
71
- ## Information-dense writing standard
72
-
73
- ### Epic title
74
-
75
- Use a functional, outcome-oriented format:
41
+ Title format:
76
42
 
77
43
  `<Product/Area>: <deliverable> to <user/system outcome> (<key constraint>)`
78
44
 
79
- Example: `Checkout: add idempotent payment capture to prevent duplicate charges
80
- (Stripe + retries)`
81
-
82
- ### Epic description
45
+ Description must include:
83
46
 
84
- Include:
47
+ - Goal and why now.
48
+ - In scope and out of scope.
49
+ - Success criteria.
50
+ - Risks and constraints.
51
+ - Verification gates.
52
+ - Key prior decisions or research findings that affect implementation.
85
53
 
86
- 1. **Goal & why now**
87
- 2. **In scope** (specific capabilities)
88
- 3. **Out of scope** (explicit exclusions)
89
- 4. **Success criteria** (testable outcomes)
90
- 5. **Risks/constraints** (data migration, latency budgets, auth boundaries)
91
- 6. **Verification gates** (tests, manual checks, perf/security checks)
92
- 7. **Key prior decisions or research findings** when they materially affect the
93
- implementation path
54
+ ### Task
94
55
 
95
- ### Task title
96
-
97
- Use a structure that encodes subsystem + action + outcome:
56
+ Title format:
98
57
 
99
58
  `[<Subsystem>] <verb> <artifact/interface> to <observable outcome>`
100
59
 
101
- Example: `[API/Auth] issue refresh-token rotation endpoint to invalidate
102
- replayed sessions`
103
-
104
- ### Task description
105
-
106
- Must include:
60
+ Description must include:
107
61
 
108
- - concrete scope and affected paths/symbols
109
- - acceptance criteria (observable behavior)
110
- - required tests/verification commands
111
- - integration constraints (contracts, backward compatibility)
112
- - explicit "can run in parallel with ..." or "blocked by ..." note
113
- - relevant findings from prior research or brainstorming that execution agents
114
- should not have to rediscover
62
+ - Target files: files to create or modify.
63
+ - Read first: files, functions, or patterns to inspect before editing.
64
+ - Do not touch: paths owned by other lanes.
65
+ - Acceptance criteria with observable behavior.
66
+ - Required tests or manual verification commands.
67
+ - Integration constraints and compatibility requirements.
68
+ - Owner/lane when clear.
69
+ - Parallelism note: "can run in parallel with ..." or "blocked by ...".
70
+ - Relevant prior findings so execution agents do not rediscover context.
115
71
 
116
- **File scope** — declare explicitly so the agent doesn't waste tokens exploring:
72
+ Example:
117
73
 
118
- - **Target files**: files to create or modify
119
- - **Read-first files**: files the agent should read for context
120
- - **Do-not-touch**: paths that parallel agents own — prevents merge conflicts
121
-
122
- **Context loading hints** — point the agent to existing patterns:
123
-
124
- - Reference a concrete file as the pattern to mirror
125
- - Name the specific function/class/export to extend or integrate with
126
- - State project conventions rather than assuming the agent will discover them
127
-
128
- **Owner assignment** — when the plan has clear subsystem lanes, assign owners in
129
- task descriptions so the executor knows which agent/person owns each task:
130
-
131
- ```
132
- Owner: auth-lane
133
- Can run in parallel with: billing-lane tasks
134
- ```
135
-
136
- Example task description:
137
-
138
- ```
74
+ ```text
139
75
  Implement refresh-token rotation endpoint.
140
76
 
141
77
  Target files: src/auth/refresh.ts (new), src/auth/refresh.test.ts (new)
142
- Read first: src/auth/login.ts (follow same handler pattern)
78
+ Read first: src/auth/login.ts (follow handler pattern)
143
79
  Do not touch: src/billing/* (owned by billing-lane)
144
80
 
145
- Follow the handler pattern in login.ts: schema validation -> service call ->
146
- response mapping.
147
-
148
- Acceptance: POST /auth/refresh returns new token pair, invalidates old token.
81
+ Follow login.ts: schema validation -> service call -> response mapping.
82
+ Acceptance: POST /auth/refresh returns a new token pair and invalidates old token.
149
83
  Verify: bun test src/auth/refresh.test.ts
150
84
  Owner: auth-lane
151
- Can run in parallel with: billing-lane. Blocked by: task-types (needs AuthToken).
152
- ```
153
-
154
- ### Subtask title/description
155
-
156
- - Titles are imperative and specific, not generic.
157
- - Description states exact artifact and completion signal.
158
- - Use subtasks for real units, not filler checklist noise.
159
- - Inherit file scope from parent task — only override if different files.
160
-
161
- ## Parallelism & dependencies
162
-
163
- Model execution lanes intentionally:
164
-
165
- - Tasks with no dependency edge between them are parallel candidates.
166
- - Tasks in different subsystems should usually run in parallel.
167
- - Tasks in the same subsystem should be combined or sequenced.
168
- - Keep task groups to ~3-4 tasks per active subsystem lane.
169
-
170
- Dependency policy:
171
-
172
- 1. Add an edge only for hard prerequisites.
173
- 2. Prefer task-to-task dependencies; use subtask dependencies only when required.
174
- 3. Validate acyclic graph assumptions before finalizing.
175
-
176
- ## Assign owners after creation
177
-
178
- After creating tasks, assign ownership for multi-agent execution:
179
-
180
- ```bash
181
- trekoon --toon task update <task-id> --owner auth-lane
182
- trekoon --toon task update <task-id> --owner billing-lane
183
- ```
184
-
185
- ## Validate the plan
186
-
187
- After creating the epic, validate before handing off to execution.
188
-
189
- ### Check progress structure
190
-
191
- ```bash
192
- trekoon --toon epic progress <epic-id>
193
- ```
194
-
195
- Verify: total count matches expectations, all tasks are in `todo`, ready count
196
- equals the number of tasks with no dependencies.
197
-
198
- ### Run suggest to confirm sanity
199
-
200
- ```bash
201
- trekoon --toon suggest --epic <epic-id>
202
- ```
203
-
204
- `suggest` will surface issues: sync gaps, recovery needs, or unexpected blocker
205
- states. If it suggests claiming a task, the plan's dependency graph is valid and
206
- execution-ready.
207
-
208
- ### Verify dependency graph
209
-
210
- ```bash
211
- trekoon --toon task ready --epic <epic-id> --limit 50
212
- ```
213
-
214
- Confirm that the expected first-wave tasks appear as ready candidates and
215
- second-wave tasks appear as blocked with the right dependencies.
216
-
217
- ## Plan output and handoff
218
-
219
- After creating the epic and validating, present a summary to the user. This
220
- summary is the primary handoff artifact — it must be self-contained and
221
- actionable.
222
-
223
- Do not stop at a prose-only design. The final handoff must reference the actual
224
- Trekoon epic and the first execution wave.
225
-
226
- ### ID rules
227
-
228
- - **Always use full UUIDs** for epic and task IDs. Never use temp-keys
229
- (`task-truthy`, `@task-api`, etc.) in the summary — those are ephemeral
230
- creation-time references that do not exist in the database.
231
- - IDs must be copy-friendly: render them in monospace/code formatting so the
232
- user can select and copy a UUID directly.
233
-
234
- ### Summary structure
235
-
236
- 1. **Epic ID + title** — displayed prominently at the top, e.g.:
237
- ```
238
- Epic: <full-uuid>
239
- Title: <epic title>
240
- ```
241
- 2. Tasks grouped by wave/batch with columns: full UUID, title, owner/lane
242
- 3. Dependencies shown per task (using full UUIDs or task titles, not temp-keys)
243
- 4. Verification gate (commands to run after all tasks complete)
244
-
245
- ### Example format
246
-
247
- ```
248
- Epic: 904b3129-be2d-4b20-8030-537dc327491a
249
- Title: Checkout: add idempotent payment capture
250
-
251
- Wave 1 (parallel)
252
- | ID | Task | Owner |
253
- |--------------------------------------|-------------------------------|--------------|
254
- | c12c9746-dbae-4660-bcbb-ebe660cb7054 | [API] Payment capture endpoint| api-lane |
255
- | 4f0848f3-538a-44d3-8415-5bb16cf3f39e | [UI] Checkout button states | ui-lane |
256
-
257
- Wave 2 (depends on wave 1)
258
- | ID | Task | Depends on |
259
- |--------------------------------------|-------------------------------|--------------------------------------|
260
- | 8a76afac-155d-45b3-b205-df2e4ef8988b | [API] Retry logic | c12c9746-dbae-4660-bcbb-ebe660cb7054 |
261
-
262
- Verification: bun run build && bun run test
85
+ Can run in parallel with: billing-lane. Blocked by: task-types.
263
86
  ```
264
87
 
265
- ### Execution handoff contract
88
+ ### Subtask
266
89
 
267
- Every plan must be directly executable without re-interpretation. Include these
268
- in task descriptions:
90
+ - Use imperative, specific titles.
91
+ - State exact artifact and completion signal.
92
+ - Use subtasks for real execution units, not filler checklist noise.
93
+ - Inherit parent task file scope unless a subtask differs.
269
94
 
270
- 1. **Lane/subsystem ownership** (`[Subsystem] ...` in title, `--owner` set).
271
- 2. **Dependency intent** (explicit `blocked by ...` / `can run in parallel
272
- with ...`).
273
- 3. **Verification evidence** (exact commands and expected outcome).
274
- 4. **Completion semantics** (`done` means verified and handoff-ready; use
275
- `blocked` with reason when not).
276
- 5. **Stable contract** (execution appends progress notes rather than rewriting
277
- original plan text unless the plan itself is wrong).
95
+ ## Design For Delegated Execution
278
96
 
279
- ## Quality rules
97
+ Plan so meaningful independent work can run in subagents:
280
98
 
281
- 1. **No markdown plan files** as source of truth.
282
- 2. **No vague titles** ("Refactor stuff", "Fix bugs").
283
- 3. **Descriptions must be implementation-usable** by another agent without
284
- guessing.
285
- 4. **Every task must define completion evidence** (tests/manual checks).
286
- 5. **Parallelism must be explicit** (not implied).
287
- 6. **Status transitions must be valid** — never describe a `todo -> done` flow.
288
- 7. **Owners should be assigned** when multiple execution lanes exist.
99
+ - Tasks with no dependency edge are parallel candidates.
100
+ - Different subsystems usually become different lanes.
101
+ - Same subsystem work should usually be grouped or sequenced.
102
+ - Keep each active subsystem lane to about 3-4 tasks.
103
+ - Add owners after creation when lanes are clear:
104
+ ```bash
105
+ trekoon --toon task update <task-id> --owner auth-lane
106
+ trekoon --toon task update <task-id> --owner billing-lane
107
+ ```
289
108
 
290
- ## Large initiatives
109
+ Use dependencies only for hard prerequisites. Prefer task-to-task dependencies.
110
+ Use subtask dependencies only when task-level ordering is too coarse.
291
111
 
292
- For large scope, create multiple epics with explicit cross-epic boundaries. Use
293
- dependencies within each epic DAG and keep each epic executable in bounded time.
112
+ ## Create Records Efficiently
294
113
 
295
- ## Creation policy: prefer bulk planning workflows
114
+ Use `--toon` on every planning command. It saves tokens and gives agents a
115
+ stable structured response.
296
116
 
297
- When creating multiple related records, do not loop through repeated single-item
298
- creates unless only one record is needed.
117
+ Prefer one transactional planning command over repeated single-item creates. If
118
+ you know the epic, tasks, subtasks, and dependencies, one-shot the whole epic
119
+ with `epic create --task ... --subtask ... --dep ...`. This saves tool calls and
120
+ keeps the graph internally consistent.
299
121
 
300
- ### Which command to use
301
-
302
- | Situation | Preferred command |
122
+ | Situation | Command |
303
123
  |---|---|
304
- | New epic and full graph already known | `trekoon --toon epic create ... --task ... --subtask ... --dep ...` |
124
+ | New epic with known graph | Prefer `trekoon --toon epic create ... --task ... --subtask ... --dep ...` |
305
125
  | Existing epic needs linked additions | `trekoon --toon epic expand <epic-id> ...` |
306
- | Multiple sibling tasks under one epic | `trekoon --toon task create-many --epic <epic-id> --task ...` |
307
- | Multiple sibling subtasks under one task | `trekoon --toon subtask create-many <task-id> --subtask ...` |
308
- | Multiple dependency edges across existing IDs | `trekoon --toon dep add-many --dep ...` |
126
+ | Many sibling tasks | `trekoon --toon task create-many --epic <epic-id> --task ...` |
127
+ | Many sibling subtasks | `trekoon --toon subtask create-many <task-id> --subtask ...` |
128
+ | Many dependency edges across existing IDs | `trekoon --toon dep add-many --dep ...` |
309
129
  | One record only | `epic create`, `task create`, or `subtask create` |
310
130
 
311
- ### Compact spec escaping rules
312
-
313
- Compact specs (pipe-delimited `--task`, `--subtask`, `--dep` values) use `\` as
314
- the escape character. Only these sequences are valid:
131
+ Compact specs use pipe-delimited values. `\` is the escape character:
315
132
 
316
133
  | Sequence | Produces |
317
134
  |---|---|
318
- | `\|` | literal `\|` (not a field separator) |
135
+ | `\|` | literal `|` |
319
136
  | `\\` | literal `\` |
320
137
  | `\n` | newline |
321
138
  | `\r` | carriage return |
322
139
  | `\t` | tab |
323
140
 
324
- Any other `\X` combination (e.g., `\!`, `\=`, `\$`) is rejected with
325
- `Invalid escape sequence`. To avoid accidental escapes:
141
+ Any other `\X` is invalid. Do not paste regex-escaped or shell-escaped
142
+ patterns directly into compact specs: sequences like `\?`, `\.`, `\{`, `\}`,
143
+ `\(`, `\)`, `\[`, and `\]` will fail before records are created. When a task
144
+ description needs a search pattern, prefer prose over exact regex syntax. Avoid
145
+ operators like `!=` in descriptions because shell or compact-spec escaping can
146
+ be confusing; rephrase as words.
147
+
148
+ Good:
326
149
 
327
- - Do not use `!=` or similar operators in description text; rephrase instead
328
- (e.g., "null does not equal sourceBranch" instead of "null !== sourceBranch").
329
- - If a literal backslash is needed, double it: `\\`.
330
- - When using shell line continuations (`\` at end of line), ensure the next
331
- line's first character is not one that forms an invalid escape with `\`.
150
+ ```text
151
+ Verify: search docs for currentUpdatedAt, updatedAt-ms, SSE auth token rides, and token query contract text.
152
+ ```
332
153
 
333
- ### Critical temp-key rule
154
+ Bad:
334
155
 
335
- - Use plain temp keys when declaring records in compact specs, for example
336
- `task-api` or `sub-tests`.
337
- - Refer to those records later in the same invocation as `@task-api` or
338
- `@sub-tests`.
339
- - `@temp-key` references work in same-invocation graph workflows such as
340
- one-shot `epic create` and `epic expand`.
341
- - `dep add-many` does **not** resolve temp keys from earlier commands. Use real
342
- persisted IDs there.
156
+ ```text
157
+ Verify: search with regex "currentUpdatedAt|<updatedAt-ms>|/api/snapshot/stream\?token|\?token=\{token\}" in docs and README.md
158
+ ```
343
159
 
344
- ### Compact examples
160
+ One-shot rules:
345
161
 
346
- #### One-shot epic creation
162
+ - Declare tasks/subtasks with plain temp keys, e.g. `task-api`, `sub-tests`.
163
+ - Refer to records created in the same command as `@task-api` or `@sub-tests`.
164
+ - Use `@task-key` as the subtask parent ref and in `--dep` specs.
165
+ - `--dep <source>|<depends-on>` points from blocked item to prerequisite.
166
+ - `epic create` returns `result.mappings` and counts. Use those real UUIDs in
167
+ handoff summaries and follow-up updates. Never show temp keys as real IDs.
168
+ - `dep add-many` does not resolve temp keys from earlier commands. Use real IDs.
347
169
 
348
- Use this when the epic does not exist yet and you already know the tree.
170
+ One-shot example:
349
171
 
350
172
  ```bash
351
173
  trekoon --toon epic create \
352
- --title "Batch command rollout" \
353
- --description "Ship linked planning in one transaction" \
354
- --task "task-api|Design API|Define compact grammar|todo" \
355
- --task "task-cli|Wire CLI|Hook parser and output|todo" \
356
- --subtask "@task-api|sub-tests|Write tests|Cover parser cases|todo" \
357
- --dep "@task-cli|@task-api"
174
+ --title "Checkout: add idempotent payment capture" \
175
+ --description "Goal: prevent duplicate charges.\nVerification: bun test tests/payments" \
176
+ --task "task-api|[API] add capture endpoint|Target files: src/payments/capture.ts\nRead first: src/payments/service.ts\nDo not touch: src/ui/*\nAcceptance: duplicate request returns prior result.\nVerify: bun test tests/payments/capture.test.ts\nOwner: api-lane\nCan run in parallel with: task-ui.|todo" \
177
+ --task "task-ui|[UI] show capture states|Target files: src/ui/checkout.tsx\nRead first: src/ui/form.tsx\nDo not touch: src/payments/*\nAcceptance: loading and retry states render.\nVerify: bun test tests/ui/checkout.test.ts\nOwner: ui-lane\nBlocked by: task-api.|todo" \
178
+ --subtask "@task-api|sub-api-tests|Write capture tests|Cover idempotent retry and conflict responses.|todo" \
179
+ --subtask "@task-ui|sub-ui-states|Write UI state tests|Cover loading, success, retry, and error states.|todo" \
180
+ --dep "@task-ui|@task-api"
358
181
  ```
359
182
 
360
- #### Expand an existing epic
183
+ ## Append Efficiently
184
+
185
+ Use `--append` for progress notes, shared findings, verification requirements,
186
+ or planning refinements. Appending is cheaper and safer than rewriting full
187
+ descriptions.
361
188
 
362
- Use this when the epic already exists and the new batch needs internal links.
189
+ Entity-specific append:
363
190
 
364
191
  ```bash
365
- trekoon --toon epic expand <epic-id> \
366
- --task "task-docs|Document workflow|Write operator guide|todo" \
367
- --subtask "@task-docs|sub-examples|Add examples|Show canonical flows|todo" \
368
- --dep "@sub-examples|@task-docs"
192
+ trekoon --toon epic update <epic-id> --append "Planning note: <text>"
193
+ trekoon --toon task update <task-id> --append "Planning note: <text>"
194
+ trekoon --toon subtask update <subtask-id> --append "Planning note: <text>"
369
195
  ```
370
196
 
371
- #### Create sibling tasks or subtasks
197
+ Append to selected tasks or subtasks with IDs from `result.mappings`:
372
198
 
373
199
  ```bash
374
- trekoon --toon task create-many --epic <epic-id> \
375
- --task "seed-api|Design API|Define grammar|todo" \
376
- --task "seed-cli|Wire CLI|Hook output|todo"
377
-
378
- trekoon --toon subtask create-many <task-id> \
379
- --subtask "seed-tests|Write tests|Cover happy path|todo" \
380
- --subtask "seed-docs|Document flow|Add notes|todo"
200
+ trekoon --toon task update --ids id1,id2,id3 --append "Shared verification: bun test tests/payments"
201
+ trekoon --toon subtask update --ids id1,id2 --append "Shared note: follow capture endpoint contract"
381
202
  ```
382
203
 
383
- #### Add dependencies after records already exist
204
+ Important:
205
+
206
+ - `epic update <epic-id> --append ...` appends only to the epic description.
207
+ - There is no scoped "append to all tasks in this epic" command. Use task IDs
208
+ from one-shot mappings, `epic show --all`, or `task ready`, then
209
+ `task update --ids ... --append ...`.
210
+ - Do not use `task update --all --append ...` unless you truly mean every task
211
+ in the database.
212
+ - `epic update <epic-id> --all` is cascade status mode only and rejects
213
+ `--append`.
214
+ - Bulk append is per-row, not one atomic transaction.
215
+
216
+ ## Validate Before Handoff
217
+
218
+ After creating or expanding the epic:
384
219
 
385
220
  ```bash
386
- trekoon --toon dep add-many \
387
- --dep "<task-b>|<task-a>" \
388
- --dep "<subtask-c>|<task-b>"
221
+ trekoon --toon epic progress <epic-id>
222
+ trekoon --toon suggest --epic <epic-id>
223
+ trekoon --toon task ready --epic <epic-id> --limit 50
389
224
  ```
390
225
 
391
- ## Search and replace policy
226
+ Verify:
227
+
228
+ - Counts match expectations.
229
+ - All new tasks are `todo`.
230
+ - Ready count equals first-wave tasks with no dependencies.
231
+ - Blocked tasks show the expected dependencies.
232
+ - `suggest` returns a sensible first execution candidate and no recovery/sync
233
+ issue that blocks execution.
234
+
235
+ ## Handoff Summary
236
+
237
+ Do not stop at a prose-only design. Return the actual Trekoon epic and first
238
+ execution wave.
239
+
240
+ Rules:
241
+
242
+ - Always use full UUIDs for epic/task IDs in summaries.
243
+ - Never use temp keys (`task-api`, `@sub-tests`) outside create commands.
244
+ - Render IDs in code formatting.
245
+ - Group tasks by wave with title, owner/lane, and dependencies.
246
+ - Include final verification gate.
392
247
 
393
- Use scoped search before manual tree reads when you need to locate repeated
394
- paths, labels, owners, or migration targets.
248
+ Format:
395
249
 
396
- ### Scope choice
250
+ ```text
251
+ Epic: <full-uuid>
252
+ Title: <epic title>
397
253
 
398
- Prefer the narrowest valid root:
254
+ Wave 1 (parallel)
255
+ | ID | Task | Owner |
256
+ |---|---|---|
257
+ | <uuid> | [API] Payment capture endpoint | api-lane |
258
+
259
+ Wave 2
260
+ | ID | Task | Depends on |
261
+ |---|---|---|
262
+ | <uuid> | [API] Retry logic | <wave-1-uuid> |
263
+
264
+ Verification: bun run build && bun run test
265
+ ```
399
266
 
400
- 1. `subtask search` or `subtask replace`
401
- 2. `task search` or `task replace`
402
- 3. `epic search` or `epic replace`
267
+ ## Search And Replace
403
268
 
404
- Scope behavior:
269
+ Use scoped search before manual tree reads when locating repeated paths, labels,
270
+ owners, or migration targets.
405
271
 
406
- - `subtask` scope scans only that subtask.
407
- - `task` scope scans the task plus descendant subtasks.
408
- - `epic` scope scans the epic plus descendant tasks and subtasks.
272
+ Narrowest valid scope first:
409
273
 
410
- ### Safe replace workflow
274
+ 1. `subtask search` / `subtask replace`
275
+ 2. `task search` / `task replace`
276
+ 3. `epic search` / `epic replace`
411
277
 
412
- 1. Search first.
413
- 2. Preview replace.
414
- 3. Apply only after preview matches the intended scope.
278
+ Workflow:
415
279
 
416
280
  ```bash
417
281
  trekoon --toon epic search <epic-id> "path/to/somewhere"
@@ -424,6 +288,5 @@ Guardrails:
424
288
  - Use literal, explicit search text.
425
289
  - Narrow fields when useful: `--fields title`, `--fields description`, or
426
290
  `--fields title,description`.
427
- - Do not jump straight to `--apply`.
428
- - Prefer scoped search/replace over manually reading a whole tree and editing
429
- many records one by one.
291
+ - Preview before `--apply`.
292
+ - Prefer scoped replace over manually editing many records one by one.