trekoon 0.4.1 → 0.4.2
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.
- package/.agents/skills/trekoon/SKILL.md +20 -577
- package/.agents/skills/trekoon/reference/execution-with-team.md +21 -9
- package/.agents/skills/trekoon/reference/execution.md +246 -7
- package/.agents/skills/trekoon/reference/planning.md +138 -1
- package/.agents/skills/trekoon/reference/status-machine.md +21 -0
- package/.agents/skills/trekoon/reference/sync.md +129 -0
- package/README.md +8 -1
- package/docs/ai-agents.md +17 -2
- package/docs/commands.md +147 -3
- package/docs/machine-contracts.md +123 -0
- package/docs/quickstart.md +52 -0
- package/package.json +1 -1
- package/src/board/assets/app.js +45 -13
- package/src/board/assets/components/Component.js +22 -8
- package/src/board/assets/components/Workspace.js +9 -3
- package/src/board/assets/components/helpers.js +4 -0
- package/src/board/assets/runtime/delegation.js +8 -0
- package/src/board/assets/runtime/focus-trap.js +48 -0
- package/src/board/assets/state/actions.js +42 -4
- package/src/board/assets/state/api.js +284 -11
- package/src/board/assets/state/store.js +79 -11
- package/src/board/assets/state/url.js +10 -0
- package/src/board/assets/state/utils.js +2 -1
- package/src/board/event-bus.ts +72 -0
- package/src/board/routes.ts +412 -33
- package/src/board/server.ts +77 -8
- package/src/board/wal-watcher.ts +302 -0
- package/src/commands/board.ts +52 -17
- package/src/commands/epic.ts +7 -9
- package/src/commands/error-utils.ts +54 -1
- package/src/commands/help.ts +69 -4
- package/src/commands/migrate.ts +153 -24
- package/src/commands/quickstart.ts +7 -0
- package/src/commands/subtask.ts +71 -10
- package/src/commands/suggest.ts +6 -13
- package/src/commands/task.ts +137 -88
- package/src/domain/batch-validation.ts +329 -0
- package/src/domain/cascade-planner.ts +412 -0
- package/src/domain/dependency-rules.ts +15 -0
- package/src/domain/mutation-service.ts +828 -192
- package/src/domain/search.ts +113 -0
- package/src/domain/tracker-domain.ts +150 -680
- package/src/domain/types.ts +53 -2
- package/src/index.ts +37 -0
- package/src/runtime/cli-shell.ts +44 -0
- package/src/runtime/daemon.ts +639 -0
- package/src/storage/backup.ts +166 -0
- package/src/storage/database.ts +261 -4
- package/src/storage/migrations.ts +422 -20
- package/src/storage/path.ts +8 -0
- package/src/storage/schema.ts +5 -1
- package/src/sync/event-writes.ts +38 -11
- package/src/sync/git-context.ts +226 -8
- package/src/sync/service.ts +650 -147
|
@@ -47,35 +47,6 @@ tracked in Trekoon.
|
|
|
47
47
|
When invoked with arguments, determine the mode first, then load only the
|
|
48
48
|
reference needed for that mode.
|
|
49
49
|
|
|
50
|
-
## Planning preflight
|
|
51
|
-
|
|
52
|
-
Before entering plan mode, harvest the context already available in the current
|
|
53
|
-
conversation and workspace. Planning should build on prior thinking, not restart
|
|
54
|
-
discovery from zero.
|
|
55
|
-
|
|
56
|
-
Treat these as primary inputs when they exist:
|
|
57
|
-
|
|
58
|
-
- brainstorm output
|
|
59
|
-
- research notes or library findings
|
|
60
|
-
- codebase exploration results
|
|
61
|
-
- prior user decisions and constraints
|
|
62
|
-
- existing Trekoon entities that should be expanded rather than replaced
|
|
63
|
-
|
|
64
|
-
Compress that context into a short internal planning brief before creating the
|
|
65
|
-
epic graph:
|
|
66
|
-
|
|
67
|
-
- goal and why now
|
|
68
|
-
- decisions already made
|
|
69
|
-
- constraints and risks already known
|
|
70
|
-
- affected systems/files/interfaces
|
|
71
|
-
- verification expectations
|
|
72
|
-
- unresolved questions that actually block planning
|
|
73
|
-
|
|
74
|
-
If the remaining unknowns are real blockers, do targeted follow-up research or
|
|
75
|
-
ask the user a narrow clarification question. Use the harness's interactive user
|
|
76
|
-
question tool for this — `question` in OpenCode or `AskUserQuestion` in Claude
|
|
77
|
-
Code — instead of guessing.
|
|
78
|
-
|
|
79
50
|
### 1. Route by first argument
|
|
80
51
|
|
|
81
52
|
| Command shape | Mode | Required read | Completion target |
|
|
@@ -137,9 +108,11 @@ Read references lazily based on mode.
|
|
|
137
108
|
|
|
138
109
|
| Mode | Read | Use it for |
|
|
139
110
|
|---|---|---|
|
|
140
|
-
| Plan | `reference/planning.md` | Converting a goal into a real epic/task/subtask dependency graph with validation and handoff |
|
|
141
|
-
| Execute | `reference/execution.md` | Running an epic end to end, choosing lanes, dispatching sub-agents, recording evidence,
|
|
111
|
+
| Plan | `reference/planning.md` | Converting a goal into a real epic/task/subtask dependency graph with validation and handoff. Includes creation policy, search/replace policy. |
|
|
112
|
+
| Execute | `reference/execution.md` | Running an epic end to end, choosing lanes, dispatching sub-agents, recording evidence, closing the epic. Includes single-agent loop, update policy, read policy. |
|
|
142
113
|
| Team execute | `reference/execution-with-team.md` | Agent Teams coordination via TeamCreate/TaskCreate/SendMessage when the environment supports it |
|
|
114
|
+
| Status machine | `reference/status-machine.md` | Canonical status transition table |
|
|
115
|
+
| Sync | `reference/sync.md` | Cross-branch sync, conflict resolution, shared-database model, worktree diagnostics |
|
|
143
116
|
|
|
144
117
|
## Mode completion rules
|
|
145
118
|
|
|
@@ -197,55 +170,22 @@ options over a broad list of speculative unknowns.
|
|
|
197
170
|
|
|
198
171
|
## Status machine
|
|
199
172
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
| From | Allowed targets |
|
|
203
|
-
|---|---|
|
|
204
|
-
| `todo` | `in_progress`, `blocked` |
|
|
205
|
-
| `in_progress` | `done`, `blocked` |
|
|
206
|
-
| `blocked` | `in_progress`, `todo` |
|
|
207
|
-
| `done` | `in_progress` |
|
|
208
|
-
|
|
209
|
-
Invalid transitions (e.g. `todo → done`) return error code
|
|
210
|
-
`status_transition_invalid`. Always transition through `in_progress` to reach
|
|
211
|
-
`done`.
|
|
212
|
-
|
|
213
|
-
**Exception:** `task done` auto-transitions through `in_progress` when the task
|
|
214
|
-
is in `todo` or `blocked` status, so you can call `task done` from any
|
|
215
|
-
non-done status.
|
|
216
|
-
|
|
217
|
-
Recommended statuses for consistent workflows: `todo`, `in_progress`, `done`.
|
|
218
|
-
Use `blocked` with an appended reason when work is stuck.
|
|
173
|
+
See `reference/status-machine.md` for the canonical transition table and
|
|
174
|
+
`task done` auto-transition exception.
|
|
219
175
|
|
|
220
176
|
## Epic lifecycle
|
|
221
177
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
through `in_progress` to reach `done`.
|
|
225
|
-
|
|
226
|
-
### Start: mark epic `in_progress`
|
|
227
|
-
|
|
228
|
-
Immediately after session bootstrap and before dispatching any work, transition
|
|
229
|
-
the epic:
|
|
178
|
+
Epics follow the same status machine as tasks — they must transition through
|
|
179
|
+
`in_progress` to reach `done`.
|
|
230
180
|
|
|
231
181
|
```bash
|
|
182
|
+
# Start: mark epic in_progress before dispatching any work
|
|
232
183
|
trekoon --toon epic update <epic-id> --status in_progress
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
This ensures the epic reflects actual state even if execution is interrupted.
|
|
236
|
-
|
|
237
|
-
### Finish: mark epic `done`
|
|
238
|
-
|
|
239
|
-
After all tasks are verified done (see cleanup in execution references), mark
|
|
240
|
-
the epic complete:
|
|
241
184
|
|
|
242
|
-
|
|
185
|
+
# Finish: mark epic done after all tasks are verified done
|
|
243
186
|
trekoon --toon epic update <epic-id> --status done
|
|
244
187
|
```
|
|
245
188
|
|
|
246
|
-
Since the epic is already `in_progress` from the start step, this is a single
|
|
247
|
-
valid transition.
|
|
248
|
-
|
|
249
189
|
## Execution mode selection
|
|
250
190
|
|
|
251
191
|
Choose the lightest mode that will still move the work forward.
|
|
@@ -256,6 +196,10 @@ Choose the lightest mode that will still move the work forward.
|
|
|
256
196
|
| Multiple ready tasks across separable subsystems or owners | Orchestrated execution | Read `reference/execution.md`, then `task ready --epic <epic-id> --limit 50` |
|
|
257
197
|
| User explicitly asked for team execution and Agent Teams are available | Team execution | Read `reference/execution-with-team.md` |
|
|
258
198
|
|
|
199
|
+
Single-agent loop shape: **session → claim → work → task done → repeat**.
|
|
200
|
+
Read `reference/execution.md` for the full loop, including subtask discipline,
|
|
201
|
+
update/recovery policy, and the canonical command sequences.
|
|
202
|
+
|
|
259
203
|
## Delegation policy
|
|
260
204
|
|
|
261
205
|
Prefer one sub-agent per execution lane, not one sub-agent per tiny task.
|
|
@@ -268,368 +212,6 @@ Prefer one sub-agent per execution lane, not one sub-agent per tiny task.
|
|
|
268
212
|
- When tasks share the same directory roots, owners, or subsystem context, group
|
|
269
213
|
them into one lane.
|
|
270
214
|
|
|
271
|
-
## Single-agent execution loop
|
|
272
|
-
|
|
273
|
-
Use this loop when one agent should continue the work directly. The primary loop
|
|
274
|
-
is: **session → claim → work → task done → repeat**.
|
|
275
|
-
|
|
276
|
-
### 1. Orient with a single call
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
trekoon --toon session
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
If you already know which epic you are working on, scope the session:
|
|
283
|
-
|
|
284
|
-
```bash
|
|
285
|
-
trekoon --toon session --epic <epic-id>
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
`session` returns diagnostics, sync status, the next ready task with subtrees,
|
|
289
|
-
blocker list, and readiness counts in one envelope. Use `--compact` to reduce
|
|
290
|
-
output size when you do not need contract metadata:
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
trekoon --toon --compact session
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
**After session returns, follow this decision tree in order:**
|
|
297
|
-
|
|
298
|
-
1. **`recoveryRequired` is true?** → Stop. Run `trekoon --toon init` and
|
|
299
|
-
re-check.
|
|
300
|
-
2. **`behind > 0`?** → Sync first: `trekoon --toon sync pull --from main`.
|
|
301
|
-
This pulls tracker events (not git commits) so task states are current.
|
|
302
|
-
3. **`pendingConflicts > 0`?** → Resolve before claiming work:
|
|
303
|
-
`trekoon --toon sync conflicts list`. For uniform conflicts, batch resolve:
|
|
304
|
-
`trekoon --toon sync resolve --all --use ours` (or `--use theirs`). For
|
|
305
|
-
mixed conflicts, inspect individually with `sync conflicts show <id>` and
|
|
306
|
-
resolve per-conflict.
|
|
307
|
-
4. **Session returned a next task?** → Proceed to step 2 (claim work).
|
|
308
|
-
5. **No next task and unsure what to do?** → Run `trekoon --toon suggest` for
|
|
309
|
-
priority-ranked recommendations (see step 1b below).
|
|
310
|
-
|
|
311
|
-
### 1b. Get suggestions when stuck
|
|
312
|
-
|
|
313
|
-
When the session has no clear next task, or you are unsure what action to take:
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
trekoon --toon suggest
|
|
317
|
-
trekoon --toon suggest --epic <epic-id>
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
`suggest` inspects recovery state, sync status, readiness, and epic progress,
|
|
321
|
-
then returns up to 3 suggestions ranked by priority. Each suggestion includes a
|
|
322
|
-
category (`recovery`, `sync`, `execution`, `planning`), a reason, and a
|
|
323
|
-
ready-to-run command you can execute directly.
|
|
324
|
-
|
|
325
|
-
Suggest respects the status machine — it will never recommend an invalid
|
|
326
|
-
transition. Use it:
|
|
327
|
-
- At session start when `readyCount` is 0 and you need guidance.
|
|
328
|
-
- Mid-loop when all tasks are blocked and you need to decide what to unblock.
|
|
329
|
-
- Before closing an epic to confirm the right next step.
|
|
330
|
-
|
|
331
|
-
### 1c. Check epic progress
|
|
332
|
-
|
|
333
|
-
When you need a quick dashboard before or during work on an epic:
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
trekoon --toon epic progress <epic-id>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
Returns done/in_progress/blocked/todo counts, ready task count, and the next
|
|
340
|
-
candidate. Use this:
|
|
341
|
-
- Before starting a work session to gauge how much remains.
|
|
342
|
-
- After completing several tasks to report progress to the user.
|
|
343
|
-
- To decide whether an epic is ready to be marked done.
|
|
344
|
-
|
|
345
|
-
### 2. Claim work explicitly
|
|
346
|
-
|
|
347
|
-
Once you know which task to work on, claim it:
|
|
348
|
-
|
|
349
|
-
```bash
|
|
350
|
-
trekoon --toon task update <task-id> --status in_progress
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
Optionally assign ownership when multiple agents or people are working:
|
|
354
|
-
|
|
355
|
-
```bash
|
|
356
|
-
trekoon --toon task update <task-id> --status in_progress --owner <name>
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
Owner is for tracking who is responsible. Set it on tasks or subtasks:
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
trekoon --toon task update <task-id> --owner alice
|
|
363
|
-
trekoon --toon subtask update <subtask-id> --owner bob
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
### 3. Work on the task
|
|
367
|
-
|
|
368
|
-
While working, append progress notes:
|
|
369
|
-
|
|
370
|
-
```bash
|
|
371
|
-
trekoon --toon task update <task-id> --append "Started implementation"
|
|
372
|
-
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
### 3b. Work on subtasks explicitly when they matter
|
|
376
|
-
|
|
377
|
-
Use the same status discipline for subtasks when a task depends on concrete
|
|
378
|
-
subtask progress:
|
|
379
|
-
|
|
380
|
-
```bash
|
|
381
|
-
trekoon --toon subtask update <subtask-id> --status in_progress
|
|
382
|
-
trekoon --toon subtask update <subtask-id> --append "Implemented parser branch"
|
|
383
|
-
trekoon --toon subtask update <subtask-id> --append "Verified with fixture set" --status done
|
|
384
|
-
trekoon --toon subtask update <subtask-id> --append "Blocked by <reason>" --status blocked
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
Use subtasks for real execution units, not filler. If a task has open subtasks
|
|
388
|
-
when `task done` is called, treat the warning as a prompt to consciously decide
|
|
389
|
-
whether the task is genuinely complete.
|
|
390
|
-
|
|
391
|
-
### 4. Finish or report a block
|
|
392
|
-
|
|
393
|
-
When done, append a completion note then mark done:
|
|
394
|
-
|
|
395
|
-
```bash
|
|
396
|
-
trekoon --toon task update <task-id> --append "Completed implementation and checks"
|
|
397
|
-
trekoon --toon task done <task-id>
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
`task done` works from any non-done status (`todo`, `in_progress`, `blocked`).
|
|
401
|
-
It auto-transitions through `in_progress` when needed. The response includes:
|
|
402
|
-
|
|
403
|
-
- **Next candidate**: the next ready task with its full tree and blockers.
|
|
404
|
-
- **Unblocked tasks**: downstream tasks that became ready after this completion.
|
|
405
|
-
Use this to decide what to claim next or to launch parallel work.
|
|
406
|
-
- **Open subtask warning**: if subtasks remain incomplete (completion still
|
|
407
|
-
proceeds, but the warning is surfaced so you can decide whether to go back).
|
|
408
|
-
|
|
409
|
-
If blocked instead of done:
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### 5. Repeat
|
|
416
|
-
|
|
417
|
-
After `task done`, the returned next-task envelope is sufficient to continue
|
|
418
|
-
the loop from step 2. A fresh `session` call is not required mid-loop unless
|
|
419
|
-
you need updated diagnostics, sync status, or want to switch epics.
|
|
420
|
-
|
|
421
|
-
Run `session` again at the start of each new conversation session.
|
|
422
|
-
|
|
423
|
-
**When to use each command during the loop:**
|
|
424
|
-
|
|
425
|
-
| Situation | Command |
|
|
426
|
-
|---|---|
|
|
427
|
-
| Start of session | `session` or `session --epic <id>` |
|
|
428
|
-
| Unsure what to do next | `suggest` or `suggest --epic <id>` |
|
|
429
|
-
| Quick progress check | `epic progress <epic-id>` |
|
|
430
|
-
| Claim a task | `task update <id> --status in_progress` |
|
|
431
|
-
| Assign ownership | `task update <id> --owner <name>` |
|
|
432
|
-
| Log progress | `task update <id> --append "..."` |
|
|
433
|
-
| Mark done | `task done <id>` |
|
|
434
|
-
| Report blocker | `task update <id> --append "..." --status blocked` |
|
|
435
|
-
| Reduce output noise | Add `--compact` to any command |
|
|
436
|
-
|
|
437
|
-
## Read policy: use the smallest sufficient read
|
|
438
|
-
|
|
439
|
-
Use the narrowest command that answers the question.
|
|
440
|
-
|
|
441
|
-
| Need | Preferred command |
|
|
442
|
-
|---|---|
|
|
443
|
-
| Session startup (diagnostics + sync + next task) | `trekoon --toon session` |
|
|
444
|
-
| Session scoped to one epic | `trekoon --toon session --epic <epic-id>` |
|
|
445
|
-
| Next-action suggestions | `trekoon --toon suggest` |
|
|
446
|
-
| Epic progress dashboard | `trekoon --toon epic progress <epic-id>` |
|
|
447
|
-
| Next task only | `trekoon --toon task next` |
|
|
448
|
-
| A few ready options | `trekoon --toon task ready --limit 5` |
|
|
449
|
-
| Direct blockers for one task | `trekoon --toon dep list <task-id>` |
|
|
450
|
-
| What this item unblocks | `trekoon --toon dep reverse <task-or-subtask-id>` |
|
|
451
|
-
| One full task payload | `trekoon --toon task show <task-id> --all` |
|
|
452
|
-
| One full epic tree | `trekoon --toon epic show <epic-id> --all` |
|
|
453
|
-
| Repeated text in one scope | `trekoon --toon epic|task|subtask search ...` |
|
|
454
|
-
|
|
455
|
-
Avoid broad scans such as `task list --all` or `epic show --all` when
|
|
456
|
-
`task next`, `task ready`, `dep list`, `dep reverse`, `suggest`, or `search`
|
|
457
|
-
can answer the question more cheaply.
|
|
458
|
-
|
|
459
|
-
## Creation policy: prefer bulk planning workflows
|
|
460
|
-
|
|
461
|
-
When creating multiple related records, do not loop through repeated single-item
|
|
462
|
-
creates unless only one record is needed.
|
|
463
|
-
|
|
464
|
-
### Which command to use
|
|
465
|
-
|
|
466
|
-
| Situation | Preferred command |
|
|
467
|
-
|---|---|
|
|
468
|
-
| New epic and full graph already known | `trekoon --toon epic create ... --task ... --subtask ... --dep ...` |
|
|
469
|
-
| Existing epic needs linked additions | `trekoon --toon epic expand <epic-id> ...` |
|
|
470
|
-
| Multiple sibling tasks under one epic | `trekoon --toon task create-many --epic <epic-id> --task ...` |
|
|
471
|
-
| Multiple sibling subtasks under one task | `trekoon --toon subtask create-many <task-id> --subtask ...` |
|
|
472
|
-
| Multiple dependency edges across existing IDs | `trekoon --toon dep add-many --dep ...` |
|
|
473
|
-
| One record only | `epic create`, `task create`, or `subtask create` |
|
|
474
|
-
|
|
475
|
-
### Compact spec escaping rules
|
|
476
|
-
|
|
477
|
-
Compact specs (pipe-delimited `--task`, `--subtask`, `--dep` values) use `\` as
|
|
478
|
-
the escape character. Only these sequences are valid:
|
|
479
|
-
|
|
480
|
-
| Sequence | Produces |
|
|
481
|
-
|---|---|
|
|
482
|
-
| `\|` | literal `|` (not a field separator) |
|
|
483
|
-
| `\\` | literal `\` |
|
|
484
|
-
| `\n` | newline |
|
|
485
|
-
| `\r` | carriage return |
|
|
486
|
-
| `\t` | tab |
|
|
487
|
-
|
|
488
|
-
Any other `\X` combination (e.g., `\!`, `\=`, `\$`) is rejected with
|
|
489
|
-
`Invalid escape sequence`. To avoid accidental escapes:
|
|
490
|
-
|
|
491
|
-
- Do not use `!=` or similar operators in description text; rephrase instead
|
|
492
|
-
(e.g., "null does not equal sourceBranch" instead of "null !== sourceBranch").
|
|
493
|
-
- If a literal backslash is needed, double it: `\\`.
|
|
494
|
-
- When using shell line continuations (`\` at end of line), ensure the next
|
|
495
|
-
line's first character is not one that forms an invalid escape with `\`.
|
|
496
|
-
|
|
497
|
-
### Critical temp-key rule
|
|
498
|
-
|
|
499
|
-
- Use plain temp keys when declaring records in compact specs, for example
|
|
500
|
-
`task-api` or `sub-tests`.
|
|
501
|
-
- Refer to those records later in the same invocation as `@task-api` or
|
|
502
|
-
`@sub-tests`.
|
|
503
|
-
- `@temp-key` references work in same-invocation graph workflows such as
|
|
504
|
-
one-shot `epic create` and `epic expand`.
|
|
505
|
-
- `dep add-many` does **not** resolve temp keys from earlier commands. Use real
|
|
506
|
-
persisted IDs there.
|
|
507
|
-
|
|
508
|
-
### Compact examples
|
|
509
|
-
|
|
510
|
-
#### One-shot epic creation
|
|
511
|
-
|
|
512
|
-
Use this when the epic does not exist yet and you already know the tree.
|
|
513
|
-
|
|
514
|
-
```bash
|
|
515
|
-
trekoon --toon epic create \
|
|
516
|
-
--title "Batch command rollout" \
|
|
517
|
-
--description "Ship linked planning in one transaction" \
|
|
518
|
-
--task "task-api|Design API|Define compact grammar|todo" \
|
|
519
|
-
--task "task-cli|Wire CLI|Hook parser and output|todo" \
|
|
520
|
-
--subtask "@task-api|sub-tests|Write tests|Cover parser cases|todo" \
|
|
521
|
-
--dep "@task-cli|@task-api"
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
#### Expand an existing epic
|
|
525
|
-
|
|
526
|
-
Use this when the epic already exists and the new batch needs internal links.
|
|
527
|
-
|
|
528
|
-
```bash
|
|
529
|
-
trekoon --toon epic expand <epic-id> \
|
|
530
|
-
--task "task-docs|Document workflow|Write operator guide|todo" \
|
|
531
|
-
--subtask "@task-docs|sub-examples|Add examples|Show canonical flows|todo" \
|
|
532
|
-
--dep "@sub-examples|@task-docs"
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
#### Create sibling tasks or subtasks
|
|
536
|
-
|
|
537
|
-
```bash
|
|
538
|
-
trekoon --toon task create-many --epic <epic-id> \
|
|
539
|
-
--task "seed-api|Design API|Define grammar|todo" \
|
|
540
|
-
--task "seed-cli|Wire CLI|Hook output|todo"
|
|
541
|
-
|
|
542
|
-
trekoon --toon subtask create-many <task-id> \
|
|
543
|
-
--subtask "seed-tests|Write tests|Cover happy path|todo" \
|
|
544
|
-
--subtask "seed-docs|Document flow|Add notes|todo"
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
#### Add dependencies after records already exist
|
|
548
|
-
|
|
549
|
-
```bash
|
|
550
|
-
trekoon --toon dep add-many \
|
|
551
|
-
--dep "<task-b>|<task-a>" \
|
|
552
|
-
--dep "<subtask-c>|<task-b>"
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
## Update policy: prefer append-based progress logging
|
|
556
|
-
|
|
557
|
-
Use descriptions as the durable work log. For progress updates, append instead
|
|
558
|
-
of rewriting full descriptions.
|
|
559
|
-
|
|
560
|
-
Status transitions must follow the status machine (see above). Use `in_progress`
|
|
561
|
-
as the intermediate step to reach `done`. Direct `todo → done` is invalid via
|
|
562
|
-
`task update`; use `task done` instead, which auto-transitions.
|
|
563
|
-
|
|
564
|
-
### Preferred patterns
|
|
565
|
-
|
|
566
|
-
```bash
|
|
567
|
-
trekoon --toon task update <task-id> --append "Started implementation" --status in_progress
|
|
568
|
-
trekoon --toon task update <task-id> --append "Completed implementation and checks"
|
|
569
|
-
trekoon --toon task done <task-id>
|
|
570
|
-
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
571
|
-
trekoon --toon task update <task-id> --owner alice
|
|
572
|
-
```
|
|
573
|
-
|
|
574
|
-
### Bulk update rules
|
|
575
|
-
|
|
576
|
-
- Bulk update is available for `epic update`, `task update`, and
|
|
577
|
-
`subtask update`.
|
|
578
|
-
- Bulk mode uses `--ids <csv>` or `--all`.
|
|
579
|
-
- Bulk mode supports only `--append` and/or `--status`.
|
|
580
|
-
- Do not pass a positional ID in bulk mode.
|
|
581
|
-
- `--append` and `--description` are mutually exclusive.
|
|
582
|
-
- Prefer `--ids` for narrow, explicit updates.
|
|
583
|
-
- Use `--all` only for clear maintenance sweeps or when the user explicitly wants
|
|
584
|
-
a broad update.
|
|
585
|
-
|
|
586
|
-
Examples:
|
|
587
|
-
|
|
588
|
-
```bash
|
|
589
|
-
trekoon --toon task update --ids id1,id2 --append "Waiting on release" --status blocked
|
|
590
|
-
trekoon --toon epic update --ids epic1,epic2 --append "Sprint planning refreshed" --status in_progress
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
## Search and replace policy
|
|
594
|
-
|
|
595
|
-
Use scoped search before manual tree reads when you need to locate repeated
|
|
596
|
-
paths, labels, owners, or migration targets.
|
|
597
|
-
|
|
598
|
-
### Scope choice
|
|
599
|
-
|
|
600
|
-
Prefer the narrowest valid root:
|
|
601
|
-
|
|
602
|
-
1. `subtask search` or `subtask replace`
|
|
603
|
-
2. `task search` or `task replace`
|
|
604
|
-
3. `epic search` or `epic replace`
|
|
605
|
-
|
|
606
|
-
Scope behavior:
|
|
607
|
-
|
|
608
|
-
- `subtask` scope scans only that subtask.
|
|
609
|
-
- `task` scope scans the task plus descendant subtasks.
|
|
610
|
-
- `epic` scope scans the epic plus descendant tasks and subtasks.
|
|
611
|
-
|
|
612
|
-
### Safe replace workflow
|
|
613
|
-
|
|
614
|
-
1. Search first.
|
|
615
|
-
2. Preview replace.
|
|
616
|
-
3. Apply only after preview matches the intended scope.
|
|
617
|
-
|
|
618
|
-
```bash
|
|
619
|
-
trekoon --toon epic search <epic-id> "path/to/somewhere"
|
|
620
|
-
trekoon --toon epic replace <epic-id> --search "path/to/somewhere" --replace "path/to/new-path"
|
|
621
|
-
trekoon --toon epic replace <epic-id> --search "path/to/somewhere" --replace "path/to/new-path" --apply
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
Guardrails:
|
|
625
|
-
|
|
626
|
-
- Use literal, explicit search text.
|
|
627
|
-
- Narrow fields when useful: `--fields title`, `--fields description`, or
|
|
628
|
-
`--fields title,description`.
|
|
629
|
-
- Do not jump straight to `--apply`.
|
|
630
|
-
- Prefer scoped search/replace over manually reading a whole tree and editing
|
|
631
|
-
many records one by one.
|
|
632
|
-
|
|
633
215
|
## Setup and fallback
|
|
634
216
|
|
|
635
217
|
If Trekoon is unavailable or storage diagnostics require repair:
|
|
@@ -641,155 +223,16 @@ trekoon --toon quickstart
|
|
|
641
223
|
trekoon --toon help sync
|
|
642
224
|
```
|
|
643
225
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
- Re-bootstrap first, then re-read diagnostics.
|
|
647
|
-
- Stop if `recoveryRequired` stays true or diagnostics report storage mismatch.
|
|
648
|
-
- Do not continue with task selection after missing shared storage or broken
|
|
649
|
-
bootstrap.
|
|
650
|
-
- Do not commit `.trekoon/trekoon.db`; remove the tracked DB and keep
|
|
651
|
-
`.trekoon` ignored instead.
|
|
652
|
-
|
|
653
|
-
Use `session` as the primary entry point — it returns diagnostics, sync status,
|
|
654
|
-
and the next ready task in one call. Use `suggest` for priority-ranked
|
|
655
|
-
recommendations. Use `quickstart` for the canonical bootstrapping walkthrough
|
|
656
|
-
and execution loop reference. Use `help` when you need exact flag syntax for a
|
|
657
|
-
specific command.
|
|
658
|
-
|
|
659
|
-
## Sync reminders
|
|
660
|
-
|
|
661
|
-
Same-branch sync is a no-op: `sync pull --from main` while on `main` produces
|
|
662
|
-
zero conflicts and simply advances the cursor. `sync status` returns `behind=0`
|
|
663
|
-
on the source branch. No action is needed.
|
|
664
|
-
|
|
665
|
-
Cross-branch sync matters before merging a feature branch back:
|
|
666
|
-
|
|
667
|
-
- Before merge, pull tracker events from the base branch:
|
|
668
|
-
|
|
669
|
-
```bash
|
|
670
|
-
trekoon --toon sync pull --from main
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
- If conflicts exist, inspect and resolve them explicitly:
|
|
674
|
-
|
|
675
|
-
```bash
|
|
676
|
-
trekoon --toon sync conflicts list
|
|
677
|
-
trekoon --toon sync conflicts show <conflict-id>
|
|
678
|
-
trekoon --toon sync resolve <conflict-id> --use theirs --dry-run
|
|
679
|
-
trekoon --toon sync resolve <conflict-id> --use ours
|
|
680
|
-
```
|
|
681
|
-
|
|
682
|
-
### Conflict resolution: ours vs theirs
|
|
683
|
-
|
|
684
|
-
Conflicts are **field-level**, not whole-record. Each conflict targets one field
|
|
685
|
-
(e.g., `status`, `title`, `description`) on one entity.
|
|
686
|
-
|
|
687
|
-
- `--use ours` — keep the current entity field value in the shared DB. The
|
|
688
|
-
entity is not written, but the conflict record is marked resolved and a
|
|
689
|
-
resolution event is appended.
|
|
690
|
-
- `--use theirs` — overwrite the shared DB entity field with the source-branch
|
|
691
|
-
value. The conflict record is marked resolved and a resolution event is
|
|
692
|
-
appended.
|
|
693
|
-
- `--dry-run` — preview the resolution without mutating the database. Returns
|
|
694
|
-
`oursValue`, `theirsValue`, `wouldWrite`, and `dryRun: true`. Use this before
|
|
695
|
-
committing to a resolution.
|
|
696
|
-
|
|
697
|
-
**Example:** after `sync pull --from main`, a conflict appears on epic `abc123`,
|
|
698
|
-
field `status`:
|
|
699
|
-
- ours (current DB): `in_progress`
|
|
700
|
-
- theirs (source branch): `done`
|
|
701
|
-
- `--use ours` keeps status as `in_progress`
|
|
702
|
-
- `--use theirs` changes status to `done` in the live shared DB
|
|
703
|
-
|
|
704
|
-
Always inspect conflicts with `sync conflicts show` before resolving. Choosing
|
|
705
|
-
`theirs` without inspection can overwrite in-progress work in the shared DB.
|
|
706
|
-
|
|
707
|
-
### Understanding why conflicts happen
|
|
708
|
-
|
|
709
|
-
| Scenario | Typical resolution | Why |
|
|
710
|
-
|---|---|---|
|
|
711
|
-
| Completed work vs stale main state | ours | Your branch has the latest progress |
|
|
712
|
-
| Enriched descriptions vs original | ours | Your descriptions are more detailed |
|
|
713
|
-
| Upstream updates from another agent | theirs | Accept the newer upstream state |
|
|
714
|
-
| User-intentional reset | theirs | Respect the user's explicit action |
|
|
715
|
-
|
|
716
|
-
### Agent decision framework
|
|
717
|
-
|
|
718
|
-
1. List conflicts: `trekoon --toon sync conflicts list`
|
|
719
|
-
2. Group by pattern — are conflicts on the same field or direction?
|
|
720
|
-
3. If uniform pattern, batch resolve: `trekoon --toon sync resolve --all --use ours`
|
|
721
|
-
4. If mixed, narrow by entity or field, or inspect individually
|
|
722
|
-
5. When unsure, ask the user
|
|
723
|
-
|
|
724
|
-
### Batch resolve patterns
|
|
725
|
-
|
|
726
|
-
Common scenarios:
|
|
727
|
-
|
|
728
|
-
```bash
|
|
729
|
-
# Resolve all conflicts at once (most common after completing work)
|
|
730
|
-
trekoon --toon sync resolve --all --use ours
|
|
731
|
-
|
|
732
|
-
# Preview before resolving
|
|
733
|
-
trekoon --toon sync resolve --all --use ours --dry-run
|
|
734
|
-
|
|
735
|
-
# Narrow to status field conflicts only
|
|
736
|
-
trekoon --toon sync resolve --all --use ours --field status
|
|
737
|
-
|
|
738
|
-
# Narrow to a specific entity
|
|
739
|
-
trekoon --toon sync resolve --all --use theirs --entity <id>
|
|
740
|
-
|
|
741
|
-
# Combine filters
|
|
742
|
-
trekoon --toon sync resolve --all --use ours --entity <id> --field description
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
## Shared-database model
|
|
746
|
-
|
|
747
|
-
Trekoon uses **one live SQLite database per repository**. The file lives at
|
|
748
|
-
`<sharedStorageRoot>/.trekoon/trekoon.db`, where `sharedStorageRoot` is the
|
|
749
|
-
parent of `git rev-parse --git-common-dir` (i.e., the main worktree root).
|
|
750
|
-
|
|
751
|
-
Key consequences:
|
|
752
|
-
|
|
753
|
-
- **All linked worktrees share the same database.** A status change in one
|
|
754
|
-
worktree is immediately visible in every other worktree.
|
|
755
|
-
- **`git checkout` / `git switch` does not change tracker state.** The database
|
|
756
|
-
is outside the git object store, so switching branches does not roll back or
|
|
757
|
-
swap task data.
|
|
758
|
-
- **Sync operates on tracker events, not on the database file itself.** Use
|
|
759
|
-
`sync pull` to import events between branches — never copy or commit the
|
|
760
|
-
`.db` file.
|
|
761
|
-
|
|
762
|
-
Treat every write as a mutation of shared repo-wide state, not branch-scoped
|
|
763
|
-
state.
|
|
764
|
-
|
|
765
|
-
## Worktree diagnostics and destructive scope
|
|
766
|
-
|
|
767
|
-
- Inspect machine-readable storage fields when debugging worktrees:
|
|
768
|
-
`storageMode`, `repoCommonDir`, `worktreeRoot`, `sharedStorageRoot`, and
|
|
769
|
-
`databaseFile`.
|
|
770
|
-
- `sharedStorageRoot` is the repo-scoped source of truth for `.trekoon` in git
|
|
771
|
-
worktrees.
|
|
772
|
-
- If `trekoon wipe --yes --toon` is explicitly requested, warn that it deletes
|
|
773
|
-
shared storage for the entire repository and every linked worktree.
|
|
774
|
-
- Wipe is destructive recovery only; it is never the right fix for a tracked DB
|
|
775
|
-
or gitignore mistake.
|
|
776
|
-
|
|
777
|
-
Trekoon stores local state in `.trekoon/trekoon.db`. In git repos and
|
|
778
|
-
worktrees, storage resolves from the shared repository root rather than each
|
|
779
|
-
worktree independently.
|
|
226
|
+
Re-bootstrap first, then re-read diagnostics. Do not continue with task
|
|
227
|
+
selection after missing shared storage or broken bootstrap.
|
|
780
228
|
|
|
781
229
|
## Tool capability guidance
|
|
782
230
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
- Use your harness's structured file search and file read tools instead of shell
|
|
787
|
-
commands for code inspection whenever possible.
|
|
788
|
-
- Use symbol-aware tools when available; fall back to content search when they
|
|
789
|
-
are not.
|
|
231
|
+
- Use your harness's structured file search and file read tools for code
|
|
232
|
+
inspection whenever possible.
|
|
233
|
+
- Use symbol-aware tools when available; fall back to content search otherwise.
|
|
790
234
|
- Run Trekoon commands, build/lint/test flows, and explicit git operations via
|
|
791
235
|
your shell tool.
|
|
792
|
-
- Use `--compact` on Trekoon commands in sub-agent prompts to reduce token
|
|
793
|
-
usage.
|
|
236
|
+
- Use `--compact` on Trekoon commands in sub-agent prompts to reduce token usage.
|
|
794
237
|
|
|
795
238
|
## User manual input:
|