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
@@ -5,60 +5,43 @@ description: "Use for Trekoon-based planning and execution: creating epics, task
5
5
 
6
6
  # Trekoon Skill
7
7
 
8
- Trekoon is a local-first execution harness for tracked implementation work.
9
- Treat Trekoon as the source of truth for plans, progress, blockers, readiness,
10
- and orchestration state.
8
+ Trekoon is the source of truth for tracked implementation work: plans,
9
+ readiness, owners, blockers, progress, verification evidence, and completion.
10
+ Use this file as the router. Load references only when the current mode needs
11
+ them.
11
12
 
12
- This skill is the operating guide, not the full CLI reference. Use it to route
13
- into the right mode quickly, keep momentum, and finish work rather than
14
- stalling in analysis.
13
+ ## Mode Contracts
15
14
 
16
- ## Operating contract
15
+ - `trekoon plan <goal>`: create an execution-ready epic in Trekoon.
16
+ - `trekoon <id>`: orient on the epic/task/subtask and report current state,
17
+ blockers, and next action.
18
+ - `trekoon <id> execute`: own the epic until it is done, hard-blocked, or needs
19
+ user input. Use subagents by default for meaningful work that can run
20
+ independently when the harness exposes them.
21
+ - `trekoon <id> team execute`: same completion contract, using Claude Agent
22
+ Teams only when the user explicitly asks and the environment supports it.
17
23
 
18
- Treat these entrypoints as hard mode contracts:
24
+ Do not stop at analysis when Trekoon shows ready work. Do not invent a parallel
25
+ plan outside Trekoon.
19
26
 
20
- - `trekoon plan <goal>` → create an **execution-ready epic** in Trekoon.
21
- - `trekoon <epic-id>` → **orient** on the current state and report the next
22
- concrete action.
23
- - `trekoon <epic-id> execute` → **own the epic until it is done, hard-blocked,
24
- or requires user input**.
25
- - `trekoon <epic-id> team execute` → same execution contract, but use Agent
26
- Teams only when the environment supports it and the user explicitly wants it.
27
+ ## Load Rules
27
28
 
28
- Reading `reference/planning.md` or `reference/execution.md` is a required setup
29
- step for those modes, not the end of the workflow.
30
-
31
- ## Trigger guidance
32
-
33
- Use this skill whenever the user wants tracked planning or tracked execution in
34
- Trekoon, for example:
35
-
36
- - break a feature into epics, tasks, subtasks, or dependencies
37
- - create backlog or sprint-ready work items
38
- - check epic/task status, progress, readiness, or blockers
39
- - execute a Trekoon epic end to end with sub-agents
40
- - coordinate parallel implementation lanes from tracked work
41
-
42
- Do **not** use this skill for generic coding work that is not meant to be
43
- tracked in Trekoon.
44
-
45
- ## Command router
46
-
47
- When invoked with arguments, determine the mode first, then load only the
48
- reference needed for that mode.
49
-
50
- ### 1. Route by first argument
29
+ | Situation | Load |
30
+ |---|---|
31
+ | Any Trekoon request | This file |
32
+ | Plan, break down, design tracked work | `reference/harness-primitives.md`, then `reference/planning.md` |
33
+ | Execute, implement, complete tracked work | `reference/harness-primitives.md`, then `reference/execution.md` |
34
+ | User explicitly asks for Claude team execution | `reference/harness-primitives.md`, then `reference/execution-with-team.md` |
35
+ | Sync gaps, conflicts, shared-storage questions | `reference/sync.md` |
36
+ | Status transition error or status uncertainty | `reference/status-machine.md` |
51
37
 
52
- | Command shape | Mode | Required read | Completion target |
53
- |---|---|---|---|
54
- | `trekoon plan <goal>` | Plan | `reference/planning.md` | Epic exists, graph is validated, next-wave summary is returned |
55
- | `trekoon <epic-id>` | Orient | None beyond this file unless needed | User knows current state, next ready action, and blockers |
56
- | `trekoon <epic-id> execute` | Execute | `reference/execution.md` | Epic is done, all remaining work is blocked, or user input is required |
57
- | `trekoon <epic-id> team execute` | Team execute | `reference/execution-with-team.md` | Same as execute, using Agent Teams |
38
+ `reference/harness-primitives.md` is required before planning or execution
39
+ because those modes may need local task displays, user questions, subagents,
40
+ review agents, testing tools, and Trekoon evidence recording.
58
41
 
59
- ### 2. Resolve entity IDs when present
42
+ ## Route Input
60
43
 
61
- If the first argument is not `plan`, resolve it as a Trekoon entity:
44
+ Resolve the first non-mode argument as an epic, task, or subtask:
62
45
 
63
46
  ```bash
64
47
  trekoon --toon epic show <id> 2>/dev/null || \
@@ -66,173 +49,79 @@ trekoon --toon task show <id> 2>/dev/null || \
66
49
  trekoon --toon subtask show <id> 2>/dev/null
67
50
  ```
68
51
 
69
- If none match, tell the user the ID was not found.
70
-
71
- When the entity is a **task or subtask**, resolve its parent epic ID from the
72
- entity record and scope `session`, `suggest`, and `epic progress` to that epic.
73
- If the user asked to execute a task or subtask, make forward progress on that
74
- requested entity first; continue broader epic execution only if that matches the
75
- user's intent.
76
-
77
- ### 3. Interpret missing or extra text
52
+ If the ID is a task or subtask, resolve its parent epic and scope `session`,
53
+ `suggest`, and `epic progress` to that epic. If the user asked to execute a task
54
+ or subtask, start with that item; continue broader epic execution only when it
55
+ matches the user intent.
78
56
 
79
- | User intent signal | Action |
57
+ | User signal | Mode |
80
58
  |---|---|
81
- | No text, just an ID | **Orient:** run `session --epic <epic-id>` (or show the task/subtask), summarize status, readiness, and next action |
82
- | `analyze`, `review`, `check`, `status`, `progress` | **Analyze:** run `epic progress <id>` or `task show <id> --all`, then `suggest --epic <id>`, and report findings |
83
- | `execute`, `implement`, `do`, `complete`, `start`, `run` | **Execute:** read `reference/execution.md`, choose single-agent vs orchestrated execution, and keep going until the mode contract is satisfied |
84
- | `team execute`, `execute with team` | **Team execute:** read `reference/execution-with-team.md` only when Agent Teams are available |
85
- | `plan`, `break down`, `design`, `architect` | **Plan:** read `reference/planning.md` and create or expand the epic graph |
86
-
87
- ### Examples
88
-
89
- ```text
90
- trekoon plan build a dependency-aware release workflow
91
- reads planning reference, creates a validated epic, returns epic ID + wave summary
92
-
93
- trekoon abc-123
94
- orients on epic/task/subtask abc-123, summarizes state and next action
95
-
96
- trekoon abc-123 execute
97
- reads execution reference, starts the execution loop, keeps going until done or blocked
98
-
99
- trekoon abc-123 team execute
100
- reads team execution reference, starts Agent Teams orchestration if supported
101
- ```
102
-
103
- ## Reference guides
104
-
105
- Read references lazily based on mode.
106
-
107
- > **Path note:** Script paths below are relative to this skill's folder (where this SKILL.md lives), not the current project root. Resolve them from this skill folder when invoking Bash.
108
-
109
- | Mode | Read | Use it for |
110
- |---|---|---|
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. |
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 |
116
-
117
- ## Mode completion rules
118
-
119
- These stop conditions are the core contract for the skill.
120
-
121
- - **Plan mode** is complete only when the epic has been created in Trekoon,
122
- tasks/subtasks/dependencies exist, validation passes, and the user receives
123
- the epic ID plus an execution-ready summary.
124
- - **Orient mode** is complete when the user has the current state, ready work,
125
- blockers, and the most likely next command.
126
- - **Execute mode** is complete only when one of these is true:
127
- 1. the epic is fully completed and marked `done`
128
- 2. all remaining work is blocked and blockers are recorded in Trekoon
129
- 3. a real ambiguity, approval, or external dependency requires user input
130
-
131
- ## Anti-stall rules
132
-
133
- - Do not stop after `session`, `suggest`, or `epic progress` if a clear next
134
- action exists.
135
- - Do not stop after completing one task if more ready work exists.
136
- - After each `task done`, inspect `unblocked` and `next` to decide the next
137
- move immediately.
138
- - If multiple independent tasks are ready and isolation is safe, group them by
139
- lane and delegate.
140
- - Ask the user only when the work is genuinely blocked by ambiguity, approval,
141
- or missing external access.
142
-
143
- ## Clarification tool rule
144
-
145
- When planning or execution needs user input, use the harness's user-question
146
- tool rather than burying the question inside narration:
147
-
148
- - OpenCode: `question`
149
- - Claude Code: `AskUserQuestion`
150
-
151
- Ask narrow, decision-shaping questions. Prefer one clear question with concrete
152
- options over a broad list of speculative unknowns.
153
-
154
- ## Non-negotiable defaults
155
-
156
- - Always include `--toon` on every Trekoon command.
157
- - Prefer the smallest sufficient scope.
158
- - Prefer transactional bulk commands over many single-item commands.
159
- - Prefer `--append` for progress notes, completion notes, and blocker notes.
160
- - Preview replace before `--apply`.
161
- - Prefer `--ids` over `--all` for bulk updates.
162
- - Treat Trekoon state updates as part of the workflow, not as after-the-fact
163
- bookkeeping.
164
- - Never edit `.trekoon/trekoon.db` directly.
165
- - Treat `.trekoon` as shared repo-scoped operational state in git worktrees.
166
- - Keep `.trekoon` gitignored; do not commit the SQLite DB as a recovery fix.
167
- - Never run `trekoon wipe --yes --toon` unless the user explicitly asks for it.
168
- - Create branches, commits, merges, or PRs only when the user explicitly asks
169
- and the current harness policy allows it.
170
-
171
- ## Status machine
172
-
173
- See `reference/status-machine.md` for the canonical transition table and
174
- `task done` auto-transition exception.
175
-
176
- ## Epic lifecycle
177
-
178
- Epics follow the same status machine as tasks — they must transition through
179
- `in_progress` to reach `done`.
180
-
181
- ```bash
182
- # Start: mark epic in_progress before dispatching any work
183
- trekoon --toon epic update <epic-id> --status in_progress
184
-
185
- # Finish: mark epic done after all tasks are verified done
186
- trekoon --toon epic update <epic-id> --status done
187
- ```
188
-
189
- ## Execution mode selection
190
-
191
- Choose the lightest mode that will still move the work forward.
192
-
193
- | Situation | Mode | First move |
194
- |---|---|---|
195
- | One ready task, narrow scope, or user asked to continue personally | Single-agent execution | `session --epic <epic-id>` |
196
- | Multiple ready tasks across separable subsystems or owners | Orchestrated execution | Read `reference/execution.md`, then `task ready --epic <epic-id> --limit 50` |
197
- | User explicitly asked for team execution and Agent Teams are available | Team execution | Read `reference/execution-with-team.md` |
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
-
203
- ## Delegation policy
204
-
205
- Prefer one sub-agent per execution lane, not one sub-agent per tiny task.
206
-
207
- - Spawn sub-agents when 2+ ready tasks are independent, touch different
208
- subsystems, or can be grouped into bounded lanes.
209
- - Keep each lane small enough to verify and report clearly.
210
- - Avoid delegation when the scope is tiny, the tasks are tightly coupled, or the
211
- overhead exceeds the gain.
212
- - When tasks share the same directory roots, owners, or subsystem context, group
213
- them into one lane.
214
-
215
- ## Setup and fallback
216
-
217
- If Trekoon is unavailable or storage diagnostics require repair:
59
+ | ID only | Orient: `session --epic <epic-id>` or show the item |
60
+ | `status`, `progress`, `analyze`, `review`, `check` | Analyze: `epic progress`, targeted show, then `suggest --epic` |
61
+ | `plan`, `break down`, `design`, `architect` | Plan |
62
+ | `execute`, `implement`, `do`, `complete`, `start`, `run` | Execute |
63
+ | `team execute`, `execute with team` | Team execute |
64
+
65
+ ## Completion Rules
66
+
67
+ - Plan mode is complete only when the epic exists, tasks/subtasks/dependencies
68
+ exist in Trekoon, the graph is validated, and the user gets the epic ID plus
69
+ first execution wave.
70
+ - Orient mode is complete when the user knows current state, blockers, ready
71
+ work, and the likely next command.
72
+ - Execute mode is complete only when the epic is marked `done`, all remaining
73
+ work is blocked with recorded reasons, or real user input is required.
74
+
75
+ ## Execution Defaults
76
+
77
+ - Start with `trekoon --toon session`; scope with `--epic <id>` when known.
78
+ - If ready work exists, keep moving. After each `task done`, inspect
79
+ `unblocked`, `warning`/`openSubtaskIds`, and `next`.
80
+ - When executing an epic, use subagents by default for any meaningful work that
81
+ can run independently. Keep small or tightly coupled tasks in the parent
82
+ agent.
83
+ - Use your context for orchestration, dependency decisions, user communication,
84
+ and final synthesis. Your job is to finish the epic, not personally perform
85
+ every implementation step.
86
+ - If a higher-priority harness rule blocks subagents without explicit user
87
+ wording, ask immediately and explain that Trekoon execution preserves the
88
+ parent context for orchestration.
89
+ - For non-trivial implementation, run relevant tests and a separate review pass
90
+ when a review agent/skill is available. Record checks and review results in
91
+ Trekoon before closing work.
92
+
93
+ ## Non-Negotiables
94
+
95
+ - Use `--toon` on every Trekoon command.
96
+ - Treat Trekoon updates as workflow state, not after-the-fact bookkeeping.
97
+ - Prefer smallest sufficient reads: `session`, `suggest`, `task ready`,
98
+ `task next`, `dep list`, `dep reverse`, targeted `show`.
99
+ - Prefer transactional/bulk commands for planning and narrow `--ids` for bulk
100
+ updates.
101
+ - Append progress, verification, and blocker notes with `--append`; do not
102
+ rewrite descriptions unless fixing the plan itself.
103
+ - Preview search/replace before `--apply`.
104
+ - Never edit `.trekoon/trekoon.db` directly. Keep `.trekoon` gitignored.
105
+ - Never run `trekoon wipe --yes --toon` unless the user explicitly asks.
106
+ - Create branches, commits, merges, pushes, or PRs only when the user explicitly
107
+ asks and the harness policy allows it.
108
+ - Use `--compact` in subagent prompts and noisy reads.
109
+
110
+ ## Status Reminder
111
+
112
+ Normal status flow is `todo -> in_progress -> done`; `blocked` requires an
113
+ appended reason. Use `task done` for task completion because it auto-transitions
114
+ from `todo` or `blocked` through `in_progress`. Load
115
+ `reference/status-machine.md` for transition errors or uncertainty.
116
+
117
+ ## Recovery
118
+
119
+ If Trekoon diagnostics show `recoveryRequired`, stop task selection and run:
218
120
 
219
121
  ```bash
220
122
  trekoon --toon init
221
123
  trekoon --toon sync status
222
- trekoon --toon quickstart
223
- trekoon --toon help sync
224
124
  ```
225
125
 
226
- Re-bootstrap first, then re-read diagnostics. Do not continue with task
227
- selection after missing shared storage or broken bootstrap.
228
-
229
- ## Tool capability guidance
230
-
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.
234
- - Run Trekoon commands, build/lint/test flows, and explicit git operations via
235
- your shell tool.
236
- - Use `--compact` on Trekoon commands in sub-agent prompts to reduce token usage.
237
-
238
- ## User manual input:
126
+ If sync is behind or conflicts exist, resolve that before claiming work. Load
127
+ `reference/sync.md` for conflict handling.