trekoon 0.2.6 → 0.2.7
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/README.md +57 -723
- package/docs/ai-agents.md +198 -0
- package/docs/commands.md +126 -0
- package/docs/machine-contracts.md +253 -0
- package/docs/plans/2026-03-15-trekoon-board-design.md +13 -0
- package/docs/quickstart.md +134 -0
- package/package.json +2 -1
- package/src/commands/epic.ts +104 -3
- package/src/commands/help.ts +31 -13
- package/src/commands/subtask.ts +78 -1
- package/src/commands/task.ts +113 -7
- package/src/domain/mutation-service.ts +76 -0
- package/src/domain/tracker-domain.ts +250 -2
- package/src/domain/types.ts +51 -0
package/README.md
CHANGED
|
@@ -2,761 +2,95 @@
|
|
|
2
2
|
|
|
3
3
|
AI-first issue tracking for humans and agents.
|
|
4
4
|
|
|
5
|
-
Trekoon is a
|
|
5
|
+
Trekoon is a local-first CLI for planning and execution inside a repository. It
|
|
6
|
+
keeps work in a shared **epic → task → subtask** graph so humans and agents can
|
|
7
|
+
work against the same state, from the terminal, with deterministic machine
|
|
8
|
+
output when automation needs it.
|
|
6
9
|
|
|
7
|
-
##
|
|
10
|
+
## What it is for
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Then verify:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
trekoon --help
|
|
19
|
-
trekoon quickstart
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Alternative (npm global install):
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm i -g trekoon
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## What Trekoon is
|
|
29
|
-
|
|
30
|
-
- Local-first CLI issue tracker
|
|
31
|
-
- Structured hierarchy: **epic → task → subtask**
|
|
32
|
-
- UUID-based references for durable linking across branches/worktrees
|
|
33
|
-
- Dependency-aware planning and execution
|
|
34
|
-
- Output modes:
|
|
35
|
-
- **Human mode** for terminal users
|
|
36
|
-
- **JSON mode** for stable machine parsing
|
|
37
|
-
- **TOON mode** for true TOON-encoded payloads
|
|
38
|
-
|
|
39
|
-
## What Trekoon aims to accomplish
|
|
40
|
-
|
|
41
|
-
1. Make issue tracking fast enough for daily terminal use.
|
|
42
|
-
2. Make issue data deterministic and machine-readable for AI automation.
|
|
43
|
-
3. Keep one repo-scoped state store that every worktree can coordinate through safely.
|
|
44
|
-
4. Stay minimal in code size while preserving robustness and clear boundaries.
|
|
45
|
-
|
|
46
|
-
## Command surface
|
|
47
|
-
|
|
48
|
-
- `trekoon init`
|
|
49
|
-
- `trekoon help [command]`
|
|
50
|
-
- `trekoon quickstart`
|
|
51
|
-
- `trekoon epic <create|expand|list|show|search|replace|update|delete>`
|
|
52
|
-
- `trekoon session`
|
|
53
|
-
- `trekoon task <create|create-many|list|show|ready|next|done|search|replace|update|delete>`
|
|
54
|
-
- `trekoon subtask <create|create-many|list|search|replace|update|delete>`
|
|
55
|
-
- `trekoon dep <add|add-many|remove|list|reverse>`
|
|
56
|
-
- `trekoon events prune [--dry-run] [--archive] [--retention-days <n>]`
|
|
57
|
-
- `trekoon migrate <status|rollback> [--to-version <n>]`
|
|
58
|
-
- `trekoon sync <status|pull|resolve|conflicts>`
|
|
59
|
-
- `trekoon skills install [--link --editor opencode|claude|pi] [--to <path>] [--allow-outside-repo]`
|
|
60
|
-
- `trekoon skills update`
|
|
61
|
-
- `trekoon wipe --yes`
|
|
62
|
-
|
|
63
|
-
Global output modes:
|
|
64
|
-
|
|
65
|
-
- `--json` for structured JSON output
|
|
66
|
-
- `--toon` for true TOON-encoded output (not JSON text)
|
|
67
|
-
- `--compat <mode>` for explicit machine compatibility behavior
|
|
68
|
-
- `--help` for root and command help
|
|
69
|
-
- `--version` for CLI version
|
|
70
|
-
|
|
71
|
-
Global options can be used before or after the command:
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
trekoon --toon quickstart
|
|
75
|
-
trekoon quickstart --toon
|
|
76
|
-
trekoon --json quickstart
|
|
77
|
-
trekoon quickstart --json
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Trekoon options use long form (`--option`) for command/subcommand flags.
|
|
81
|
-
Root help/version aliases `-h` and `-v` are also supported.
|
|
82
|
-
|
|
83
|
-
Human view options:
|
|
84
|
-
|
|
85
|
-
- List and show commands default to table output in human mode.
|
|
86
|
-
- Use `--view compact` to restore compact pipe output.
|
|
87
|
-
- `epic list`, `task list`, and `subtask list` support `--view table|compact`.
|
|
88
|
-
- `epic show` and `task show` support `--view table|compact|tree|detail`.
|
|
89
|
-
|
|
90
|
-
List defaults and filters (`epic list`, `task list`, `subtask list`):
|
|
91
|
-
|
|
92
|
-
- Default scope: open work only (`in_progress`, `in-progress`, `todo`)
|
|
93
|
-
- Default limit: `10`
|
|
94
|
-
- Status filter: `--status in_progress,todo` (CSV)
|
|
95
|
-
- Custom limit: `--limit <n>`
|
|
96
|
-
- Cursor pagination: `--cursor <n>` (offset-like start index for next page)
|
|
97
|
-
- All rows and statuses: `--all`
|
|
98
|
-
- `--all` is mutually exclusive with `--status`, `--limit`, and `--cursor`
|
|
99
|
-
|
|
100
|
-
Bulk updates (`epic update`, `task update`, `subtask update`):
|
|
101
|
-
|
|
102
|
-
- Target all rows: `--all`
|
|
103
|
-
- Target specific rows: `--ids <id1,id2,...>`
|
|
104
|
-
- Bulk updates support only `--append <text>` and/or `--status <status>`
|
|
105
|
-
- In bulk mode, do not pass a positional id
|
|
106
|
-
- `--all` and `--ids` are mutually exclusive
|
|
107
|
-
- `--append` and `--description` are mutually exclusive
|
|
108
|
-
|
|
109
|
-
Examples:
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
trekoon task update --all --status in_progress
|
|
113
|
-
trekoon task update --ids <task-1>,<task-2> --append "\nFollow-up note"
|
|
114
|
-
trekoon subtask update --all --status done
|
|
115
|
-
trekoon subtask update --ids <subtask-1>,<subtask-2> --append "\nFollow-up note"
|
|
116
|
-
trekoon epic update --ids <epic-1>,<epic-2> --status done
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Quickstart
|
|
120
|
-
|
|
121
|
-
Trekoon is local-first, but in git repos and worktrees it is **repo-shared**:
|
|
122
|
-
every worktree for the same repository resolves to one shared `.trekoon`
|
|
123
|
-
directory and one shared `.trekoon/trekoon.db`.
|
|
124
|
-
|
|
125
|
-
- `worktreeRoot` identifies the current checkout.
|
|
126
|
-
- `sharedStorageRoot` identifies the repository root that owns `.trekoon`.
|
|
127
|
-
- `databaseFile` points at the shared SQLite database.
|
|
128
|
-
- `.trekoon` stays gitignored on purpose because the DB is operational state,
|
|
129
|
-
not source code.
|
|
130
|
-
- Committing `.trekoon/trekoon.db` is the wrong fix for drift because it bakes
|
|
131
|
-
machine-local state and stale snapshots into Git.
|
|
132
|
-
|
|
133
|
-
Outside git repos, Trekoon falls back to the invocation cwd.
|
|
134
|
-
|
|
135
|
-
When machine output is enabled (`--json`/`--toon`) and a command resolves
|
|
136
|
-
storage from a non-canonical cwd, Trekoon emits
|
|
137
|
-
`meta.storageRootDiagnostics` so automation can verify the storage contract.
|
|
138
|
-
|
|
139
|
-
### 1) Initialize
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
trekoon init
|
|
143
|
-
trekoon --version
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Bootstrap expectations:
|
|
147
|
-
|
|
148
|
-
- Run `trekoon --toon init` once per repository to create or re-bootstrap the
|
|
149
|
-
shared storage root.
|
|
150
|
-
- Run `trekoon --toon sync status` before agent work to inspect diagnostics.
|
|
151
|
-
- If diagnostics report `recoveryRequired`, a tracked/ignored mismatch, or an
|
|
152
|
-
ambiguous recovery path, stop and repair setup before continuing.
|
|
153
|
-
- Do **not** continue with task selection after broken bootstrap warnings.
|
|
154
|
-
|
|
155
|
-
### 2) Create epic → task → subtask
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
trekoon epic create --title "Agent backlog stabilization" --description "Track stabilization work" --status todo
|
|
159
|
-
trekoon task create --title "Implement sync status" --description "Add status reporting" --epic <epic-id> --status todo
|
|
160
|
-
trekoon subtask create --task <task-id> --title "Add cursor model" --status todo
|
|
161
|
-
trekoon task list
|
|
162
|
-
trekoon task list --status done
|
|
163
|
-
trekoon task list --limit 25
|
|
164
|
-
trekoon task list --all --view compact
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### 2a) Preferred one-shot epic creation
|
|
168
|
-
|
|
169
|
-
When you already know the epic tree, create the epic, tasks, subtasks, and
|
|
170
|
-
dependencies in one invocation.
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
trekoon epic create \
|
|
174
|
-
--title "Batch command rollout" \
|
|
175
|
-
--description "Ship one-shot planning workflows" \
|
|
176
|
-
--task "task-a|First task|First description|todo" \
|
|
177
|
-
--task "task-b|Second task|Second description|todo" \
|
|
178
|
-
--subtask "@task-a|sub-a|First subtask|Subtask description|todo" \
|
|
179
|
-
--dep "@task-b|@task-a" \
|
|
180
|
-
--dep "@sub-a|@task-a"
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Use this when:
|
|
184
|
-
|
|
185
|
-
- the epic does not exist yet
|
|
186
|
-
- later records need to reference earlier created records via `@temp-key`
|
|
187
|
-
- you want one atomic create step and one machine response with mappings/counts
|
|
188
|
-
|
|
189
|
-
Compact machine output adds:
|
|
190
|
-
|
|
191
|
-
```text
|
|
192
|
-
command: epic.create
|
|
193
|
-
data:
|
|
194
|
-
epic: created epic row
|
|
195
|
-
tasks[]: created tasks in input order
|
|
196
|
-
subtasks[]: created subtasks in input order
|
|
197
|
-
dependencies[]: created dependencies in input order
|
|
198
|
-
result:
|
|
199
|
-
mappings[]: { kind: task|subtask, tempKey, id }
|
|
200
|
-
counts: { tasks, subtasks, dependencies }
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### 3) Add dependencies
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
trekoon dep add <task-id> <depends-on-id>
|
|
207
|
-
trekoon dep list <task-id>
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### 3a) Batch planning commands
|
|
211
|
-
|
|
212
|
-
Use compact batch commands when one invocation needs to create or link multiple
|
|
213
|
-
items atomically. Use the single-item commands when you already have persisted
|
|
214
|
-
UUIDs and only need one mutation.
|
|
215
|
-
|
|
216
|
-
#### `task create-many`
|
|
217
|
-
|
|
218
|
-
Create multiple tasks under one epic in declared order.
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
trekoon task create-many \
|
|
222
|
-
--epic <epic-id> \
|
|
223
|
-
--task "seed-api|Design API|Define batch grammar|todo" \
|
|
224
|
-
--task "seed-cli|Wire CLI|Hook parser and output|in_progress"
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Compact spec:
|
|
228
|
-
|
|
229
|
-
- `--task <temp-key>|<title>|<description>|<status>`
|
|
230
|
-
- escape `\|`, `\\`, `\n`, `\r`, `\t`
|
|
231
|
-
- repeated `--task` flags are preserved in the exact order provided
|
|
232
|
-
- temp keys are local mapping labels, not persisted IDs
|
|
233
|
-
|
|
234
|
-
Rollback semantics:
|
|
235
|
-
|
|
236
|
-
- Trekoon validates the full batch before inserts
|
|
237
|
-
- duplicate temp keys, empty required fields, or invalid input fail the whole
|
|
238
|
-
command
|
|
239
|
-
- no partial task rows are kept on failure
|
|
240
|
-
|
|
241
|
-
Compact machine output:
|
|
242
|
-
|
|
243
|
-
```text
|
|
244
|
-
command: task.create-many
|
|
245
|
-
data:
|
|
246
|
-
epicId: <epic-id>
|
|
247
|
-
tasks[]: created task rows in input order
|
|
248
|
-
result:
|
|
249
|
-
mappings[]: { kind: task, tempKey, id }
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
#### `subtask create-many`
|
|
253
|
-
|
|
254
|
-
Create multiple subtasks under one existing task.
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
trekoon subtask create-many <task-id> \
|
|
258
|
-
--subtask "seed-tests|Write tests|Cover happy path|todo" \
|
|
259
|
-
--subtask "seed-docs|Document flow|Add operator notes|todo"
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Equivalent explicit parent form:
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
trekoon subtask create-many \
|
|
266
|
-
--task <task-id> \
|
|
267
|
-
--subtask "seed-tests|Write tests|Cover happy path|todo"
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Rules:
|
|
271
|
-
|
|
272
|
-
- positional `<task-id>` or `--task <task-id>` may be used
|
|
273
|
-
- if both are provided, they must be identical or the command fails
|
|
274
|
-
- repeated `--subtask` flags are applied in declared order
|
|
275
|
-
|
|
276
|
-
Rollback semantics:
|
|
277
|
-
|
|
278
|
-
- full batch prevalidation happens before inserts
|
|
279
|
-
- duplicate temp keys, conflicting task ids, or invalid specs abort the whole
|
|
280
|
-
command
|
|
281
|
-
- no partial subtasks are kept on failure
|
|
282
|
-
|
|
283
|
-
Compact machine output:
|
|
284
|
-
|
|
285
|
-
```text
|
|
286
|
-
command: subtask.create-many
|
|
287
|
-
data:
|
|
288
|
-
taskId: <task-id>
|
|
289
|
-
subtasks[]: created subtask rows in input order
|
|
290
|
-
result:
|
|
291
|
-
mappings[]: { kind: subtask, tempKey, id }
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
#### `dep add-many`
|
|
295
|
-
|
|
296
|
-
Create multiple dependency edges in one ordered, transactional operation.
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
trekoon dep add-many \
|
|
300
|
-
--dep "<task-b>|<task-a>" \
|
|
301
|
-
--dep "<subtask-c>|<task-b>"
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
Compact spec:
|
|
305
|
-
|
|
306
|
-
- `--dep <source-ref>|<depends-on-ref>`
|
|
307
|
-
- repeated `--dep` flags are applied in declared order
|
|
308
|
-
- standalone `dep add-many` resolves persisted IDs only
|
|
309
|
-
- `@temp-key` refs are **not** resolved from earlier commands; they are reserved
|
|
310
|
-
for same-invocation workflows such as `epic expand`
|
|
311
|
-
|
|
312
|
-
Rollback semantics:
|
|
313
|
-
|
|
314
|
-
- validation covers the full dependency set before insert
|
|
315
|
-
- missing ids, unresolved `@temp-key` refs, duplicates, or cycles fail the whole
|
|
316
|
-
batch
|
|
317
|
-
- no partial dependency edges are inserted on failure
|
|
318
|
-
|
|
319
|
-
Compact machine output:
|
|
12
|
+
- Fast issue tracking for day-to-day terminal use
|
|
13
|
+
- One repo-scoped task graph that works across branches and worktrees
|
|
14
|
+
- Stable machine-readable output for AI workflows (`--toon`, `--json`)
|
|
15
|
+
- Minimal command surface with strong planning and execution primitives
|
|
320
16
|
|
|
321
|
-
|
|
322
|
-
command: dep.add-many
|
|
323
|
-
data:
|
|
324
|
-
dependencies[]: created dependency rows in input order
|
|
325
|
-
result:
|
|
326
|
-
mappings[]: []
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
#### `epic expand`
|
|
330
|
-
|
|
331
|
-
Expand one existing epic by creating tasks, subtasks, and dependencies in one
|
|
332
|
-
transaction. Use this when the epic already exists and you want to add a linked
|
|
333
|
-
batch later.
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
trekoon epic expand <epic-id> \
|
|
337
|
-
--task "task-api|Design API|Define compact grammar|todo" \
|
|
338
|
-
--task "task-cli|Wire CLI|Hook parser and output|todo" \
|
|
339
|
-
--subtask "@task-api|sub-tests|Write tests|Cover parser cases|todo" \
|
|
340
|
-
--dep "@task-cli|@task-api" \
|
|
341
|
-
--dep "@sub-tests|@task-api"
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
Compact specs:
|
|
345
|
-
|
|
346
|
-
- `--task <temp-key>|<title>|<description>|<status>`
|
|
347
|
-
- `--subtask <parent-ref>|<temp-key>|<title>|<description>|<status>`
|
|
348
|
-
- `--dep <source-ref>|<depends-on-ref>`
|
|
349
|
-
- `@temp-key` refs may target tasks/subtasks declared earlier in the same
|
|
350
|
-
`epic expand` invocation
|
|
351
|
-
|
|
352
|
-
Background phases:
|
|
353
|
-
|
|
354
|
-
1. validate all compact specs and duplicate temp keys
|
|
355
|
-
2. create tasks transactionally
|
|
356
|
-
3. resolve subtask parent temp keys and create subtasks
|
|
357
|
-
4. resolve dependency refs and link dependencies
|
|
358
|
-
5. append task, subtask, then dependency events
|
|
359
|
-
6. roll back the full expansion if any phase fails
|
|
360
|
-
|
|
361
|
-
Compact machine output:
|
|
362
|
-
|
|
363
|
-
```text
|
|
364
|
-
command: epic.expand
|
|
365
|
-
data:
|
|
366
|
-
epicId: <epic-id>
|
|
367
|
-
tasks[]: created tasks in input order
|
|
368
|
-
subtasks[]: created subtasks in input order
|
|
369
|
-
dependencies[]: created dependencies in input order
|
|
370
|
-
result:
|
|
371
|
-
mappings[]: { kind: task|subtask, tempKey, id }
|
|
372
|
-
counts: { tasks, subtasks, dependencies }
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
When to choose which command:
|
|
376
|
-
|
|
377
|
-
- use `task create-many` for sibling tasks under one known epic
|
|
378
|
-
- use `subtask create-many` for sibling subtasks under one known task
|
|
379
|
-
- use `dep add-many` only when every endpoint already has a persisted ID
|
|
380
|
-
- use `epic create` with batch specs when the epic does not exist yet and the
|
|
381
|
-
whole graph is known up front
|
|
382
|
-
- use `epic expand` when the epic already exists and one batch must add linked
|
|
383
|
-
tasks/subtasks/dependencies with `@temp-key` references
|
|
384
|
-
|
|
385
|
-
### 4) AI execution loop for agents
|
|
386
|
-
|
|
387
|
-
The primary loop is: **session → work → task done → repeat**.
|
|
388
|
-
|
|
389
|
-
Orient with a single call that returns diagnostics, sync status, next ready
|
|
390
|
-
task with subtasks, blocker list, and readiness counts:
|
|
391
|
-
|
|
392
|
-
```bash
|
|
393
|
-
trekoon --toon session
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
Claim work, then finish or report a block:
|
|
397
|
-
|
|
398
|
-
```bash
|
|
399
|
-
trekoon --toon task update <task-id> --status in_progress
|
|
400
|
-
trekoon --toon task done <task-id>
|
|
401
|
-
trekoon --toon task update <task-id> --append "Blocked by <reason>" --status blocked
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
`task done` marks the task done and returns the next ready task with
|
|
405
|
-
dependencies inline, replacing the old multi-step transition.
|
|
406
|
-
|
|
407
|
-
Fail-fast rules:
|
|
408
|
-
|
|
409
|
-
- Treat `meta.storageRootDiagnostics` as the source of truth for worktree
|
|
410
|
-
storage.
|
|
411
|
-
- In linked worktrees, `sharedStorageRoot` may differ from `worktreeRoot`; that
|
|
412
|
-
is expected.
|
|
413
|
-
- If `recoveryRequired` is `true`, stop and follow the reported bootstrap or
|
|
414
|
-
recovery action.
|
|
415
|
-
- Do not fall back to a separate per-worktree DB or continue after missing
|
|
416
|
-
shared storage.
|
|
417
|
-
|
|
418
|
-
<details>
|
|
419
|
-
<summary>Legacy manual bootstrap (use <code>session</code> instead)</summary>
|
|
420
|
-
|
|
421
|
-
```bash
|
|
422
|
-
trekoon --toon init
|
|
423
|
-
trekoon --toon sync status
|
|
424
|
-
trekoon --toon task ready --limit 5
|
|
425
|
-
trekoon --toon task next
|
|
426
|
-
trekoon --toon dep reverse <task-or-subtask-id>
|
|
427
|
-
trekoon --toon task update <task-id> --status in_progress
|
|
428
|
-
trekoon --toon task update <task-id> --append "Completed implementation and checks" --status done
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
</details>
|
|
432
|
-
|
|
433
|
-
### 5) Use TOON output for agent workflows
|
|
434
|
-
|
|
435
|
-
```bash
|
|
436
|
-
trekoon --toon epic show <epic-id>
|
|
437
|
-
trekoon --toon task show <task-id>
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
Optional alternative for integrations that explicitly require JSON:
|
|
441
|
-
|
|
442
|
-
```bash
|
|
443
|
-
trekoon --json epic show <epic-id>
|
|
444
|
-
trekoon --json task show <task-id>
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### 6) Scoped search for repeated text
|
|
448
|
-
|
|
449
|
-
Use scoped search before manual tree reads when you need to locate repeated
|
|
450
|
-
paths, labels, or migration targets.
|
|
451
|
-
|
|
452
|
-
```bash
|
|
453
|
-
trekoon --toon epic search <epic-id> "path/to/somewhere"
|
|
454
|
-
trekoon --toon task search <task-id> "path/to/somewhere"
|
|
455
|
-
trekoon --toon subtask search <subtask-id> "path/to/somewhere"
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
Scope rules:
|
|
459
|
-
|
|
460
|
-
- `epic search` scans the epic title/description plus every task and subtask
|
|
461
|
-
title/description in that epic tree.
|
|
462
|
-
- `task search` scans the task title/description plus descendant subtask
|
|
463
|
-
title/description.
|
|
464
|
-
- `subtask search` scans only that subtask's title/description.
|
|
465
|
-
- Add `--fields title`, `--fields description`, or
|
|
466
|
-
`--fields title,description` when you need a narrower scan.
|
|
467
|
-
|
|
468
|
-
### 7) Preview first, then apply scoped replace
|
|
469
|
-
|
|
470
|
-
Use search first to confirm the scope, then run replace in preview mode, and
|
|
471
|
-
only use `--apply` after the preview matches the intended migration.
|
|
472
|
-
|
|
473
|
-
```bash
|
|
474
|
-
trekoon --toon epic search <epic-id> "path/to/somewhere"
|
|
475
|
-
trekoon --toon epic replace <epic-id> --search "path/to/somewhere" --replace "path/to/new-path"
|
|
476
|
-
trekoon --toon epic replace <epic-id> --search "path/to/somewhere" --replace "path/to/new-path" --apply
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
Use this loop for low-risk agent workflows:
|
|
480
|
-
|
|
481
|
-
1. `search` when you need the smallest possible read before deciding whether a
|
|
482
|
-
migration is needed.
|
|
483
|
-
2. preview `replace` to verify the exact candidate set and changed fields.
|
|
484
|
-
3. `replace --apply` only after the preview output matches the intended scope.
|
|
17
|
+
## Why it exists
|
|
485
18
|
|
|
486
|
-
|
|
487
|
-
|
|
19
|
+
Trekoon exists to make task tracking cheap enough to use while coding, and
|
|
20
|
+
structured enough that agents can read, update, and complete work without
|
|
21
|
+
guessing.
|
|
488
22
|
|
|
489
|
-
|
|
23
|
+
## Install
|
|
490
24
|
|
|
491
|
-
|
|
492
|
-
ok: true
|
|
493
|
-
command: epic.search
|
|
494
|
-
data:
|
|
495
|
-
scope: epic
|
|
496
|
-
query: { search, fields[], mode: preview }
|
|
497
|
-
matches[]: { kind, id, fields[]: { field, count, snippet } }
|
|
498
|
-
summary: { matchedEntities, matchedFields, totalMatches }
|
|
499
|
-
metadata:
|
|
500
|
-
contractVersion: 1.0.0
|
|
501
|
-
requestId: req-<id>
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
```text
|
|
505
|
-
ok: true
|
|
506
|
-
command: epic.replace
|
|
507
|
-
data:
|
|
508
|
-
scope: epic
|
|
509
|
-
query: { search, replace, fields[], mode: preview|apply }
|
|
510
|
-
matches[]: { kind, id, fields[]: { field, count, snippet } }
|
|
511
|
-
summary: { matchedEntities, matchedFields, totalMatches, mode }
|
|
512
|
-
metadata:
|
|
513
|
-
contractVersion: 1.0.0
|
|
514
|
-
requestId: req-<id>
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
Background behavior:
|
|
518
|
-
|
|
519
|
-
- `epic search` and preview `epic replace` traverse the epic first, then
|
|
520
|
-
descendant tasks, then descendant subtasks.
|
|
521
|
-
- Within each record, Trekoon checks `title` before `description` so output stays
|
|
522
|
-
deterministic and low-token.
|
|
523
|
-
- Preview reports the candidate set without mutating records.
|
|
524
|
-
- `--apply` reuses the same scoped traversal, updates only rows with real text
|
|
525
|
-
changes, and returns the matched rows with `query.mode` and `summary.mode`
|
|
526
|
-
set to `"apply"`.
|
|
527
|
-
|
|
528
|
-
### 8) Sync workflow for worktrees
|
|
529
|
-
|
|
530
|
-
- Run `trekoon sync status` at session start and before PR/merge.
|
|
531
|
-
- Run `trekoon sync pull --from main` before merge to align tracker state.
|
|
532
|
-
- If conflicts exist, resolve explicitly:
|
|
533
|
-
|
|
534
|
-
```bash
|
|
535
|
-
trekoon sync status
|
|
536
|
-
trekoon sync pull --from main
|
|
537
|
-
trekoon sync conflicts list
|
|
538
|
-
trekoon sync conflicts show <conflict-id>
|
|
539
|
-
trekoon sync resolve <conflict-id> --use ours
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
`sync pull` machine output includes diagnostics counters and hints so agents can
|
|
543
|
-
react deterministically:
|
|
544
|
-
|
|
545
|
-
- `diagnostics.malformedPayloadEvents`
|
|
546
|
-
- `diagnostics.applyRejectedEvents`
|
|
547
|
-
- `diagnostics.quarantinedEvents`
|
|
548
|
-
- `diagnostics.conflictEvents`
|
|
549
|
-
- `diagnostics.errorHints`
|
|
550
|
-
|
|
551
|
-
Worktree diagnostics and recovery:
|
|
552
|
-
|
|
553
|
-
- Inspect `storageMode`, `repoCommonDir`, `worktreeRoot`, `sharedStorageRoot`,
|
|
554
|
-
and `databaseFile` in machine output when debugging worktree behavior.
|
|
555
|
-
- If a worktree resolves shared storage outside its checkout, that is expected
|
|
556
|
-
for linked worktrees and should not be “fixed” by committing `.trekoon`.
|
|
557
|
-
- If Git contains a tracked `.trekoon/trekoon.db`, remove it from Git history or
|
|
558
|
-
the index as appropriate, keep `.trekoon` ignored, and re-run
|
|
559
|
-
`trekoon --toon init`.
|
|
560
|
-
- Use `trekoon wipe --yes` only for explicit destructive recovery; it deletes
|
|
561
|
-
the shared storage root for the entire repository, not just the current
|
|
562
|
-
worktree.
|
|
563
|
-
|
|
564
|
-
Compatibility mode for legacy sync command IDs:
|
|
565
|
-
|
|
566
|
-
```bash
|
|
567
|
-
trekoon --json --compat legacy-sync-command-ids sync status
|
|
568
|
-
trekoon --toon --compat legacy-sync-command-ids sync pull --from main
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
Behavior:
|
|
572
|
-
|
|
573
|
-
- Default remains strict canonical IDs (`sync.status`, `sync.pull`, ...).
|
|
574
|
-
- Compatibility mode rewrites sync command IDs to legacy forms
|
|
575
|
-
(`sync_status`, `sync_pull`, ...).
|
|
576
|
-
- Compatibility mode is machine-only and valid only for `sync` commands.
|
|
577
|
-
- Machine output includes `metadata.compatibility` with:
|
|
578
|
-
- deprecation warning code
|
|
579
|
-
- migration guidance
|
|
580
|
-
- canonical + compatibility command IDs
|
|
581
|
-
- removal window (`removalAfter: 2026-09-30`)
|
|
582
|
-
- Migration path: remove `--compat legacy-sync-command-ids` and consume dotted
|
|
583
|
-
command IDs directly.
|
|
584
|
-
|
|
585
|
-
### 9) Install project-local Trekoon skill for agents
|
|
586
|
-
|
|
587
|
-
`trekoon skills install` always writes the bundled skill file under the current
|
|
588
|
-
working directory at:
|
|
589
|
-
|
|
590
|
-
- `.agents/skills/trekoon/SKILL.md`
|
|
591
|
-
|
|
592
|
-
You can also create a project-local editor link:
|
|
25
|
+
Recommended (global install with Bun):
|
|
593
26
|
|
|
594
27
|
```bash
|
|
595
|
-
|
|
596
|
-
trekoon skills install --link --editor opencode
|
|
597
|
-
trekoon skills install --link --editor claude
|
|
598
|
-
trekoon skills install --link --editor pi
|
|
599
|
-
trekoon skills install --link --editor opencode --to ./.custom-editor/skills
|
|
600
|
-
trekoon skills update
|
|
28
|
+
bun add -g trekoon
|
|
601
29
|
```
|
|
602
30
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
- Default opencode link path: `.opencode/skills/trekoon`
|
|
606
|
-
- Default claude link path: `.claude/skills/trekoon`
|
|
607
|
-
- Default pi link path: `.pi/skills/trekoon`
|
|
608
|
-
- `--to <path>` overrides the editor root for link creation only.
|
|
609
|
-
- `--to` does **not** move or copy `SKILL.md` to that path.
|
|
610
|
-
- By default, link targets must resolve inside the current working directory root.
|
|
611
|
-
- Editor symlinks are written with relative targets so repo-local links survive
|
|
612
|
-
moving the repository.
|
|
613
|
-
- Use `--allow-outside-repo` only for intentional external links.
|
|
614
|
-
- When override is used, install prints a warning and includes confirmation
|
|
615
|
-
fields in machine output.
|
|
616
|
-
- Re-running install is idempotent: it refreshes `SKILL.md` and reuses/replaces
|
|
617
|
-
the same symlink target.
|
|
618
|
-
- `trekoon skills update` is idempotent: it refreshes canonical
|
|
619
|
-
`.agents/skills/trekoon/SKILL.md` and creates or refreshes default editor
|
|
620
|
-
links when their config directories exist.
|
|
621
|
-
- Update skips editors with no config dir and leaves conflicts untouched while
|
|
622
|
-
reporting actionable path context.
|
|
623
|
-
- If the link destination exists as a non-link path, install fails with an
|
|
624
|
-
actionable conflict error.
|
|
625
|
-
|
|
626
|
-
How `--to` works (step-by-step):
|
|
627
|
-
|
|
628
|
-
1. Trekoon always installs/copies to:
|
|
629
|
-
- `<cwd>/.agents/skills/trekoon/SKILL.md`
|
|
630
|
-
2. If `--link` is present, Trekoon creates a `trekoon` symlink directory entry.
|
|
631
|
-
3. `--to <path>` sets the symlink root directory.
|
|
632
|
-
4. Final link path is:
|
|
633
|
-
- `<resolved-to-path>/trekoon -> <relative path to <cwd>/.agents/skills/trekoon>`
|
|
634
|
-
|
|
635
|
-
Example:
|
|
31
|
+
Alternative (npm global install):
|
|
636
32
|
|
|
637
33
|
```bash
|
|
638
|
-
|
|
639
|
-
```
|
|
640
|
-
|
|
641
|
-
This produces:
|
|
642
|
-
|
|
643
|
-
- `<cwd>/.agents/skills/trekoon/SKILL.md` (copied file)
|
|
644
|
-
- `<cwd>/.custom-editor/skills/trekoon` (symlink)
|
|
645
|
-
- symlink target: relative path to `<cwd>/.agents/skills/trekoon`
|
|
646
|
-
|
|
647
|
-
Trekoon does not mutate global editor config directories.
|
|
648
|
-
|
|
649
|
-
### 10) Pre-merge checklist
|
|
650
|
-
|
|
651
|
-
- [ ] `trekoon sync status` shows no unresolved conflicts
|
|
652
|
-
- [ ] done tasks/subtasks are marked completed
|
|
653
|
-
- [ ] dependency graph has no stale blockers
|
|
654
|
-
- [ ] final AI check: `trekoon --toon epic show <epic-id>`
|
|
655
|
-
- [ ] no one tried to commit `.trekoon/trekoon.db` as a worktree fix
|
|
656
|
-
|
|
657
|
-
## Machine-contract recipes (--toon)
|
|
658
|
-
|
|
659
|
-
Use `--toon` for production agent loops. The examples below show command +
|
|
660
|
-
expected envelope fields.
|
|
661
|
-
|
|
662
|
-
Base envelope fields (all machine responses):
|
|
663
|
-
|
|
664
|
-
```text
|
|
665
|
-
ok: true|false
|
|
666
|
-
command: <stable command id>
|
|
667
|
-
data: <payload>
|
|
668
|
-
metadata:
|
|
669
|
-
contractVersion: "1.0.0"
|
|
670
|
-
requestId: req-<stable-id>
|
|
34
|
+
npm i -g trekoon
|
|
671
35
|
```
|
|
672
36
|
|
|
673
|
-
|
|
674
|
-
`epic.show`). Root-level commands may use single-token IDs (`help`, `init`,
|
|
675
|
-
`quickstart`, `wipe`, `version`).
|
|
676
|
-
|
|
677
|
-
Additional metadata can appear when relevant:
|
|
678
|
-
|
|
679
|
-
- `metadata.compatibility` when `--compat` mode is active
|
|
680
|
-
- `meta.storageRootDiagnostics` when a machine-readable command resolves
|
|
681
|
-
storage from a non-canonical cwd
|
|
682
|
-
|
|
683
|
-
### Ready queue (deterministic candidates)
|
|
37
|
+
Verify the install:
|
|
684
38
|
|
|
685
39
|
```bash
|
|
686
|
-
trekoon --
|
|
40
|
+
trekoon --help
|
|
41
|
+
trekoon quickstart
|
|
687
42
|
```
|
|
688
43
|
|
|
689
|
-
|
|
44
|
+
## Commands
|
|
690
45
|
|
|
691
|
-
|
|
692
|
-
ok: true
|
|
693
|
-
command: task.ready
|
|
694
|
-
data:
|
|
695
|
-
candidates[]:
|
|
696
|
-
task: { id, epicId, title, status, ... }
|
|
697
|
-
readiness: { isReady, reason }
|
|
698
|
-
blockerSummary: { blockedByCount, totalDependencies, blockedBy[] }
|
|
699
|
-
ranking: { rank, blockerCount, statusPriority }
|
|
700
|
-
blocked[]: (same shape, non-ready items)
|
|
701
|
-
summary: {
|
|
702
|
-
totalOpenTasks,
|
|
703
|
-
readyCount,
|
|
704
|
-
returnedCount,
|
|
705
|
-
appliedLimit,
|
|
706
|
-
blockedCount,
|
|
707
|
-
unresolvedDependencyCount,
|
|
708
|
-
}
|
|
709
|
-
```
|
|
46
|
+
These are the commands most people need to recognize quickly:
|
|
710
47
|
|
|
711
|
-
|
|
48
|
+
| Goal | Commands |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| Initialize a repo | `trekoon init` |
|
|
51
|
+
| Learn the CLI | `trekoon help [command]`, `trekoon quickstart` |
|
|
52
|
+
| Plan work | `trekoon epic ...`, `trekoon task ...`, `trekoon subtask ...`, `trekoon dep ...` |
|
|
53
|
+
| Start an execution session | `trekoon session` |
|
|
54
|
+
| Keep worktrees in sync | `trekoon sync ...` |
|
|
55
|
+
| Install or refresh the AI skill | `trekoon skills install`, `trekoon skills update` |
|
|
56
|
+
| Maintenance | `trekoon events prune ...`, `trekoon migrate ...`, `trekoon wipe --yes` |
|
|
712
57
|
|
|
713
|
-
|
|
714
|
-
trekoon --toon dep reverse <task-or-subtask-id>
|
|
715
|
-
```
|
|
58
|
+
Machine output modes:
|
|
716
59
|
|
|
717
|
-
|
|
60
|
+
- `--toon` for true TOON-encoded payloads
|
|
61
|
+
- `--json` for JSON output
|
|
62
|
+
- `--compat <mode>` for explicit compatibility behavior
|
|
63
|
+
- `--help` and `--version` at the root or command level
|
|
718
64
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
command: dep.reverse
|
|
722
|
-
data:
|
|
723
|
-
targetId: <id>
|
|
724
|
-
targetKind: task|subtask
|
|
725
|
-
blockedNodes[]: { id, kind, distance, isDirect }
|
|
726
|
-
```
|
|
65
|
+
For the full command surface, flags, filters, and bulk update rules, read the
|
|
66
|
+
[command reference](docs/commands.md).
|
|
727
67
|
|
|
728
|
-
|
|
68
|
+
## AI skill
|
|
729
69
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
trekoon --toon task list --status todo --limit 2 --cursor 2
|
|
733
|
-
```
|
|
70
|
+
Trekoon ships with a bundled `trekoon` skill for AI agents. It teaches the
|
|
71
|
+
agent to:
|
|
734
72
|
|
|
735
|
-
|
|
73
|
+
- use `--toon` by default
|
|
74
|
+
- prefer the smallest sufficient read
|
|
75
|
+
- use bulk planning commands when possible
|
|
76
|
+
- keep progress in Trekoon with append-based updates
|
|
77
|
+
- treat `.trekoon` as shared repo-scoped operational state
|
|
736
78
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
- Do not combine `--all` with `--cursor`.
|
|
740
|
-
- Machine consumers should page using `meta.pagination.hasMore` and
|
|
741
|
-
`meta.pagination.nextCursor`.
|
|
79
|
+
Read [AI agents and the Trekoon skill](docs/ai-agents.md) for installation,
|
|
80
|
+
editor linking, recommended skill combinations, and example prompts.
|
|
742
81
|
|
|
743
|
-
|
|
82
|
+
## Read next
|
|
744
83
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
contractVersion: "1.0.0"
|
|
752
|
-
requestId: req-<stable-id>
|
|
753
|
-
meta:
|
|
754
|
-
pagination: { hasMore, nextCursor }
|
|
755
|
-
```
|
|
84
|
+
- [Quickstart](docs/quickstart.md)
|
|
85
|
+
- [Command reference](docs/commands.md)
|
|
86
|
+
- [AI agents and the Trekoon skill](docs/ai-agents.md)
|
|
87
|
+
- [Machine contracts](docs/machine-contracts.md)
|
|
88
|
+
- [Contributing](CONTRIBUTING.md)
|
|
89
|
+
- [Changelog](CHANGELOG.md)
|
|
756
90
|
|
|
757
91
|
## Implementation principles
|
|
758
92
|
|
|
759
93
|
- Minimal, composable modules
|
|
760
94
|
- Strict validation at command boundaries
|
|
761
|
-
- Stable automation
|
|
95
|
+
- Stable automation envelopes for JSON and TOON modes
|
|
762
96
|
- No unnecessary feature sprawl
|