trekoon 0.4.1 → 0.4.3

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 (58) hide show
  1. package/.agents/skills/trekoon/SKILL.md +97 -765
  2. package/.agents/skills/trekoon/reference/execution-with-team.md +91 -141
  3. package/.agents/skills/trekoon/reference/execution.md +188 -159
  4. package/.agents/skills/trekoon/reference/harness-primitives.md +77 -0
  5. package/.agents/skills/trekoon/reference/planning.md +213 -213
  6. package/.agents/skills/trekoon/reference/status-machine.md +21 -0
  7. package/.agents/skills/trekoon/reference/sync.md +82 -0
  8. package/README.md +29 -8
  9. package/docs/ai-agents.md +65 -6
  10. package/docs/commands.md +149 -5
  11. package/docs/machine-contracts.md +123 -0
  12. package/docs/quickstart.md +55 -3
  13. package/package.json +1 -1
  14. package/src/board/assets/app.js +47 -13
  15. package/src/board/assets/components/Component.js +20 -8
  16. package/src/board/assets/components/Workspace.js +9 -3
  17. package/src/board/assets/components/helpers.js +4 -0
  18. package/src/board/assets/runtime/delegation.js +8 -0
  19. package/src/board/assets/runtime/focus-trap.js +48 -0
  20. package/src/board/assets/state/actions.js +45 -4
  21. package/src/board/assets/state/api.js +304 -17
  22. package/src/board/assets/state/store.js +82 -11
  23. package/src/board/assets/state/url.js +10 -0
  24. package/src/board/assets/state/utils.js +2 -1
  25. package/src/board/event-bus.ts +81 -0
  26. package/src/board/routes.ts +430 -40
  27. package/src/board/server.ts +86 -10
  28. package/src/board/snapshot.ts +6 -0
  29. package/src/board/wal-watcher.ts +313 -0
  30. package/src/commands/board.ts +52 -17
  31. package/src/commands/epic.ts +7 -9
  32. package/src/commands/error-utils.ts +54 -1
  33. package/src/commands/help.ts +75 -10
  34. package/src/commands/migrate.ts +153 -24
  35. package/src/commands/quickstart.ts +7 -0
  36. package/src/commands/skills.ts +17 -5
  37. package/src/commands/subtask.ts +71 -10
  38. package/src/commands/suggest.ts +6 -13
  39. package/src/commands/task.ts +137 -88
  40. package/src/domain/batch-validation.ts +329 -0
  41. package/src/domain/cascade-planner.ts +412 -0
  42. package/src/domain/dependency-rules.ts +15 -0
  43. package/src/domain/mutation-service.ts +842 -187
  44. package/src/domain/search.ts +113 -0
  45. package/src/domain/tracker-domain.ts +167 -693
  46. package/src/domain/types.ts +56 -2
  47. package/src/export/render-markdown.ts +1 -2
  48. package/src/index.ts +37 -0
  49. package/src/runtime/cli-shell.ts +44 -0
  50. package/src/runtime/daemon.ts +700 -0
  51. package/src/storage/backup.ts +166 -0
  52. package/src/storage/database.ts +268 -4
  53. package/src/storage/migrations.ts +441 -22
  54. package/src/storage/path.ts +8 -0
  55. package/src/storage/schema.ts +5 -1
  56. package/src/sync/event-writes.ts +38 -11
  57. package/src/sync/git-context.ts +226 -8
  58. package/src/sync/service.ts +679 -156
@@ -1,104 +1,76 @@
1
- # Execution with Agent Teams Reference
1
+ # Execution With Agent Teams Reference
2
2
 
3
- **You are a team lead orchestrator.** Execute work from Trekoon using Agent
4
- Teams real parallel Claude Code instances coordinated via TeamCreate,
5
- TaskCreate, SendMessage, and shared task lists. Each teammate runs in its own
6
- tmux pane.
3
+ You are a team lead orchestrator. Use this file only for Claude Code Agent
4
+ Teams when the user explicitly asks for team execution and
5
+ `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=true`. This is a runtime-specific path,
6
+ not the default subagent path for Codex, OpenCode, Pi, or other harnesses.
7
7
 
8
- **Execute mode contract:** team execution is complete only when the epic is
9
- marked `done`, all remaining work is blocked with recorded reasons, or user
10
- input is required to continue.
8
+ Team execution is complete only when the epic is marked `done`, all remaining
9
+ work is blocked with recorded reasons, or real user input is required.
11
10
 
12
- **Prerequisite:** Agent Teams requires the Claude Code environment variable
13
- `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set to `"true"`. This feature is Claude
14
- Code only — it is not available in OpenCode or other harnesses.
11
+ Clarify meaningful ambiguity before starting.
15
12
 
16
- - [Claude Agent Teams documentation](https://code.claude.com/docs/en/agent-teams.md)
13
+ ## Start
17
14
 
18
- **Clarify ambiguity upfront.** If the plan has unclear requirements or meaningful
19
- tradeoffs, ask the user before starting.
20
-
21
- ## Build the execution graph
22
-
23
- Same as the standard execution reference — use `task ready`, `dep reverse`, and
24
- lane grouping to construct a runnable graph. See `reference/execution.md` for
25
- the full scheduler loop and lane grouping rules.
26
-
27
- ## Mark epic in-progress
28
-
29
- Before dispatching any work, transition the epic so it reflects actual state:
15
+ Build the graph with the standard execution reference: `task ready`,
16
+ `dep reverse`, lane grouping, and first-wave validation. Then mark the epic in
17
+ progress:
30
18
 
31
19
  ```bash
32
20
  trekoon --toon epic update <epic-id> --status in_progress
33
21
  ```
34
22
 
35
- This must happen once, immediately after building the execution graph. If
36
- execution is interrupted, the epic is at least `in_progress` rather than `todo`.
23
+ ## Create Team And Tasks
37
24
 
38
- ## Create the team
25
+ 1. Create the team:
39
26
 
40
- Use **TeamCreate** to set up the team, then **TaskCreate** to populate the
41
- shared task list, then **Agent** with `team_name` to spawn teammates.
42
-
43
- ### Step 1: Create the team
44
-
45
- ```
27
+ ```text
46
28
  TeamCreate:
47
29
  team_name: "<epic-slug>"
48
30
  description: "Executing epic <epic-id>: <title>"
49
31
  ```
50
32
 
51
- ### Step 2: Create tasks in the shared task list
52
-
53
- For each task group from the execution graph, create a task:
33
+ 2. Create one shared team task per lane:
54
34
 
55
- ```
35
+ ```text
56
36
  TaskCreate:
57
- subject: "<lane description>: <task-ids/titles>"
37
+ subject: "<lane>: <task-ids/titles>"
58
38
  description: |
59
- Execute these Trekoon tasks IN ORDER unless task description says
39
+ Execute these Trekoon tasks IN ORDER unless task descriptions allow
60
40
  parallel subtasks:
61
41
  - Task <id>: <title>
62
- - Task <id>: <title>
63
42
 
64
- Before starting each task:
65
- - claim and assign owner:
66
- trekoon --toon task update <id> --status in_progress --owner <lane-name>
67
- - append a short start note:
68
- trekoon --toon task update <id> --append "Starting implementation"
43
+ Before each task:
44
+ - trekoon --toon task claim <id> --owner <lane-name>
45
+ - trekoon --toon task update <id> --append "Starting implementation"
69
46
 
70
- While executing:
71
- - complete required subtasks, update subtask statuses
72
- - append meaningful progress notes (do not rewrite task description)
73
- - respect the status machine: todo -> in_progress -> done (never skip)
74
- - use --compact to reduce output noise:
75
- trekoon --toon --compact task show <id>
47
+ While working:
48
+ - Complete required subtasks.
49
+ - Append progress notes; do not rewrite task descriptions.
50
+ - Use task done for completion.
51
+ - Use --compact for noisy Trekoon reads.
76
52
 
77
53
  On completion:
78
- - append final verification evidence
79
- - mark done: trekoon --toon task done <id>
80
- (task done auto-transitions from todo/blocked through in_progress)
81
- - read the response: it includes unblocked downstream tasks and open
82
- subtask warnings report these back via SendMessage
54
+ - Append verification evidence.
55
+ - trekoon --toon task done <id>
56
+ - Report unblocked tasks, open subtask warnings, and next candidate via
57
+ SendMessage.
58
+ - Report review result or review gap for non-trivial code changes.
83
59
 
84
60
  If blocked:
85
- - append blocker reason, dependency id, and exact failing command/output
86
- - set status: trekoon --toon task update <id> --status blocked
87
- - notify team lead via SendMessage with blocker details
61
+ - Append blocker reason, dependency id, and exact failing command/output.
62
+ - trekoon --toon task update <id> --append "Blocked by <reason>" --status blocked
63
+ - Notify team lead via SendMessage.
88
64
 
89
- Only create branches, commits, or PRs if the user explicitly requested
90
- them and the current harness policy allows it.
91
- Report: files changed, verification results, blockers
65
+ Do not create branches, commits, pushes, or PRs unless the user explicitly
66
+ asked and harness policy allows it.
92
67
  ```
93
68
 
94
- Use `blockedBy` via TaskUpdate to set dependencies between tasks that require
95
- sequential execution.
69
+ Use `blockedBy` via TaskUpdate for team tasks that must run sequentially.
96
70
 
97
- ### Step 3: Spawn teammates
71
+ 3. Spawn one teammate per parallel lane:
98
72
 
99
- For each parallel lane, spawn a teammate using the Agent tool:
100
-
101
- ```
73
+ ```text
102
74
  Agent:
103
75
  name: "developer-1"
104
76
  team_name: "<epic-slug>"
@@ -106,106 +78,84 @@ Agent:
106
78
  description: "<lane>: <task titles>"
107
79
  prompt: |
108
80
  You are a developer on team "<epic-slug>".
109
- Check TaskList for your assigned tasks and work through them.
110
- Use TaskUpdate to claim tasks (set owner to your name) and mark
111
- them completed.
112
-
113
- Status machine rules:
114
- - todo -> in_progress -> done (valid)
115
- - todo -> done (INVALID — use task done which auto-transitions)
116
- - in_progress -> blocked (valid, with reason)
117
- - blocked -> in_progress (valid, to resume)
118
-
119
- When you complete a Trekoon task with `task done`, read the response:
120
- - unblocked: tasks that became ready — report via SendMessage
121
- - warning: open subtasks — report via SendMessage
122
- - next: next ready candidate
123
-
124
- Communicate with teammates via SendMessage if you need coordination.
125
- After completing a task, check TaskList for the next available task.
126
- ```
81
+ Work through your TaskList assignment.
82
+ Claim each Trekoon task before editing:
83
+ trekoon --toon task claim <trekoon-task-id> --owner <your-name>
84
+
85
+ Use task done for completion. Read and report unblocked tasks, warnings,
86
+ and next candidate via SendMessage.
127
87
 
128
- **Teammate count:** 3-5 teammates for most epics. Don't over-parallelize.
88
+ Communicate blockers and coordination needs via SendMessage.
89
+ ```
129
90
 
130
- **Agent types:**
131
- - Use `general-purpose` for implementation work (has edit/write/bash access)
132
- - Use `Explore` or `Plan` only for read-only research or planning tasks
91
+ Use 3-5 teammates for most epics. Do not over-parallelize. Use
92
+ `general-purpose` for implementation and `Explore`/`Plan` only for read-only
93
+ research or planning.
133
94
 
134
- ## Coordinate as team lead
95
+ ## Coordinate
135
96
 
136
97
  Your job as team lead:
137
98
 
138
- 1. **Monitor progress** — teammates send messages when they complete tasks or
139
- hit blockers.
140
- 2. **Use task done responses** — when a teammate reports `unblocked` tasks from
141
- a `task done` response, create new team tasks via TaskCreate for the
142
- unblocked work and assign to idle teammates.
143
- 3. **Unblock work** — when a teammate reports a blocker, help resolve it or
144
- reassign.
145
- 4. **Assign ownership** — use TaskUpdate with `owner` to assign tasks to idle
146
- teammates. Also set Trekoon owner:
99
+ 1. Monitor SendMessage updates.
100
+ 2. When a teammate reports `unblocked` tasks from `task done`, create new team
101
+ tasks and assign idle teammates.
102
+ 3. Help resolve or reassign blockers.
103
+ 4. Keep Trekoon owners current:
147
104
  ```bash
148
105
  trekoon --toon task update <task-id> --owner <teammate-name>
149
106
  ```
150
- 5. **Send messages** — use SendMessage to direct teammates, never plain text
151
- output.
152
- 6. **Check progress** — periodically run `epic progress` to gauge completion:
107
+ 5. Use SendMessage to direct teammates.
108
+ 6. Check progress:
153
109
  ```bash
154
110
  trekoon --toon epic progress <epic-id>
155
111
  ```
156
- 7. **Get suggestions when stuck** — when all teammates are blocked:
112
+ 7. When all teammates are blocked, run:
157
113
  ```bash
158
114
  trekoon --toon suggest --epic <epic-id>
159
115
  ```
160
116
 
161
- ## Auto-recovery
117
+ ## Recovery
118
+
119
+ Use the standard execution recovery rules. Teammates should try to fix failures
120
+ with their local context. If they cannot, they must report exact command/output
121
+ via SendMessage so you can give fix instructions or reassign.
162
122
 
163
- 1. If status update fails with `status_transition_invalid`, check current status
164
- and use the valid intermediate transition.
165
- 2. If status update fails with `dependency_blocked`, refresh with
166
- `task ready`/`task next` and continue with a ready candidate.
167
- 3. Teammate attempts to fix failures (has context).
168
- 4. If can't fix, teammate reports failure with error output via SendMessage.
169
- 5. Dispatch fix instructions via SendMessage to the teammate.
170
- 6. Same error twice -> stop and ask user.
123
+ For `status_transition_invalid`, inspect current status with:
171
124
 
172
- ## Verify and close
125
+ ```bash
126
+ trekoon --toon --compact task show <id>
127
+ ```
173
128
 
174
- Same verification steps as the standard execution reference: code review,
175
- automated tests, manual verification, DX quality, record evidence, final
176
- progress check. See `reference/execution.md` for details.
129
+ For `dependency_blocked`, inspect the dependency, append a blocker note, then
130
+ continue with a ready candidate from:
177
131
 
178
- ## Shutdown and cleanup
132
+ ```bash
133
+ trekoon --toon task ready --epic <epic-id>
134
+ ```
179
135
 
180
- After all work is verified:
136
+ ## Verify And Close
181
137
 
182
- 1. **Check everything is done:**
183
- ```bash
184
- trekoon --toon epic progress <epic-id>
185
- ```
138
+ Use the standard execution verification rules: review, automated tests, manual
139
+ checks, DX quality, and Trekoon evidence notes.
186
140
 
187
- 2. **Confirm nothing remains:**
188
- ```bash
189
- trekoon --toon suggest --epic <epic-id>
190
- ```
191
- Should return no actionable suggestions.
141
+ After all work is verified:
192
142
 
193
- 3. **Mark epic done** (already `in_progress` from the start step):
194
- ```bash
195
- trekoon --toon epic update <epic-id> --status done
196
- ```
143
+ ```bash
144
+ trekoon --toon epic progress <epic-id>
145
+ trekoon --toon suggest --epic <epic-id>
146
+ trekoon --toon epic update <epic-id> --status done
147
+ ```
197
148
 
198
- 4. **Shutdown teammates** — send `shutdown_request` via SendMessage to each.
199
- 5. **Delete the team** use TeamDelete to clean up team and task directories.
200
- 6. Return final execution summary: completed tasks, remaining blockers,
201
- dependency state.
149
+ Then send `shutdown_request` to each teammate, delete the team with TeamDelete,
150
+ and return completed tasks, files changed, verification, review, remaining
151
+ blockers, and dependency state.
202
152
 
203
- ## Team orchestration tools
153
+ ## Team Tools
204
154
 
205
155
  | Purpose | Tool |
206
- |---------|------|
207
- | Create the team | `TeamCreate` |
208
- | Manage shared task list | `TaskCreate` / `TaskList` / `TaskUpdate` / `TaskGet` |
209
- | Spawn teammates | `Agent` (with `team_name`) |
156
+ |---|---|
157
+ | Create team | `TeamCreate` |
158
+ | Manage shared tasks | `TaskCreate` / `TaskList` / `TaskUpdate` / `TaskGet` |
159
+ | Spawn teammates | `Agent` with `team_name` |
210
160
  | Communicate | `SendMessage` |
211
161
  | Clean up | `TeamDelete` |