trekoon 0.3.3 → 0.3.5

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.
@@ -171,7 +171,10 @@ trekoon --toon --compact session
171
171
  2. **`behind > 0`?** → Sync first: `trekoon --toon sync pull --from main`.
172
172
  This pulls tracker events (not git commits) so task states are current.
173
173
  3. **`pendingConflicts > 0`?** → Resolve before claiming work:
174
- `trekoon --toon sync conflicts list`.
174
+ `trekoon --toon sync conflicts list`. For uniform conflicts, batch resolve:
175
+ `trekoon --toon sync resolve --all --use ours` (or `--use theirs`). For
176
+ mixed conflicts, inspect individually with `sync conflicts show <id>` and
177
+ resolve per-conflict.
175
178
  4. **Session returned a next task?** → Proceed to step 2 (claim work).
176
179
  5. **No next task and unsure what to do?** → Run `trekoon --toon suggest` for
177
180
  priority-ranked recommendations (see step 1b below).
@@ -502,8 +505,11 @@ Rules:
502
505
  - Do not commit `.trekoon/trekoon.db`; remove the tracked DB and keep
503
506
  `.trekoon` ignored instead.
504
507
 
505
- Use `quickstart` for the canonical execution loop. Use help when you need exact
506
- syntax.
508
+ Use `session` as the primary entry point it returns diagnostics, sync status,
509
+ and the next ready task in one call. Use `suggest` for priority-ranked
510
+ recommendations. Use `quickstart` for the canonical bootstrapping walkthrough
511
+ and execution loop reference. Use `help` when you need exact flag syntax for a
512
+ specific command.
507
513
 
508
514
  ## Sync reminders
509
515
 
@@ -524,9 +530,93 @@ Cross-branch sync matters before merging a feature branch back:
524
530
  ```bash
525
531
  trekoon --toon sync conflicts list
526
532
  trekoon --toon sync conflicts show <conflict-id>
533
+ trekoon --toon sync resolve <conflict-id> --use theirs --dry-run
527
534
  trekoon --toon sync resolve <conflict-id> --use ours
528
535
  ```
529
536
 
537
+ ### Conflict resolution: ours vs theirs
538
+
539
+ Conflicts are **field-level**, not whole-record. Each conflict targets one field
540
+ (e.g., `status`, `title`, `description`) on one entity.
541
+
542
+ - `--use ours` — keep the current entity field value in the shared DB. The
543
+ entity is not written, but the conflict record is marked resolved and a
544
+ resolution event is appended.
545
+ - `--use theirs` — overwrite the shared DB entity field with the source-branch
546
+ value. The conflict record is marked resolved and a resolution event is
547
+ appended.
548
+ - `--dry-run` — preview the resolution without mutating the database. Returns
549
+ `oursValue`, `theirsValue`, `wouldWrite`, and `dryRun: true`. Use this before
550
+ committing to a resolution.
551
+
552
+ **Example:** after `sync pull --from main`, a conflict appears on epic `abc123`,
553
+ field `status`:
554
+ - ours (current DB): `in_progress`
555
+ - theirs (source branch): `done`
556
+ - `--use ours` keeps status as `in_progress`
557
+ - `--use theirs` changes status to `done` in the live shared DB
558
+
559
+ Always inspect conflicts with `sync conflicts show` before resolving. Choosing
560
+ `theirs` without inspection can overwrite in-progress work in the shared DB.
561
+
562
+ ### Understanding why conflicts happen
563
+
564
+ | Scenario | Typical resolution | Why |
565
+ |---|---|---|
566
+ | Completed work vs stale main state | ours | Your branch has the latest progress |
567
+ | Enriched descriptions vs original | ours | Your descriptions are more detailed |
568
+ | Upstream updates from another agent | theirs | Accept the newer upstream state |
569
+ | User-intentional reset | theirs | Respect the user's explicit action |
570
+
571
+ ### Agent decision framework
572
+
573
+ 1. List conflicts: `trekoon --toon sync conflicts list`
574
+ 2. Group by pattern — are conflicts on the same field or direction?
575
+ 3. If uniform pattern, batch resolve: `trekoon --toon sync resolve --all --use ours`
576
+ 4. If mixed, narrow by entity or field, or inspect individually
577
+ 5. When unsure, ask the user
578
+
579
+ ### Batch resolve patterns
580
+
581
+ Common scenarios:
582
+
583
+ ```bash
584
+ # Resolve all conflicts at once (most common after completing work)
585
+ trekoon --toon sync resolve --all --use ours
586
+
587
+ # Preview before resolving
588
+ trekoon --toon sync resolve --all --use ours --dry-run
589
+
590
+ # Narrow to status field conflicts only
591
+ trekoon --toon sync resolve --all --use ours --field status
592
+
593
+ # Narrow to a specific entity
594
+ trekoon --toon sync resolve --all --use theirs --entity <id>
595
+
596
+ # Combine filters
597
+ trekoon --toon sync resolve --all --use ours --entity <id> --field description
598
+ ```
599
+
600
+ ## Shared-database model
601
+
602
+ Trekoon uses **one live SQLite database per repository**. The file lives at
603
+ `<sharedStorageRoot>/.trekoon/trekoon.db`, where `sharedStorageRoot` is the
604
+ parent of `git rev-parse --git-common-dir` (i.e., the main worktree root).
605
+
606
+ Key consequences:
607
+
608
+ - **All linked worktrees share the same database.** A status change in one
609
+ worktree is immediately visible in every other worktree.
610
+ - **`git checkout` / `git switch` does not change tracker state.** The database
611
+ is outside the git object store, so switching branches does not roll back or
612
+ swap task data.
613
+ - **Sync operates on tracker events, not on the database file itself.** Use
614
+ `sync pull` to import events between branches — never copy or commit the
615
+ `.db` file.
616
+
617
+ Treat every write as a mutation of shared repo-wide state, not branch-scoped
618
+ state.
619
+
530
620
  ## Worktree diagnostics and destructive scope
531
621
 
532
622
  - Inspect machine-readable storage fields when debugging worktrees:
package/README.md CHANGED
@@ -1,167 +1,200 @@
1
1
  # Trekoon
2
2
 
3
- AI-first issue tracking for humans and agents.
3
+ AI-first task tracking that lives in your repo. You describe what to build, your
4
+ agent plans it as a dependency graph, then executes it task by task.
4
5
 
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.
9
-
10
- ## What it is for
11
-
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
16
-
17
- ## Why it exists
18
-
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.
6
+ Trekoon stores work as **epics > tasks > subtasks** with dependency edges in a
7
+ local SQLite database. Every command has structured output (`--toon`, `--json`)
8
+ so agents can read and update state without parsing human text. No server, no
9
+ accounts. The database lives in `.trekoon/` inside your repo.
22
10
 
23
11
  ## Install
24
12
 
25
- Recommended (global install with Bun):
26
-
27
13
  ```bash
28
14
  bun add -g trekoon
29
15
  ```
30
16
 
31
- Alternative (npm global install Bun must still be installed as the runtime):
17
+ Or via npm (Bun still needs to be installed as the runtime):
32
18
 
33
19
  ```bash
34
20
  npm i -g trekoon
35
21
  ```
36
22
 
37
- Verify the install:
38
-
39
23
  ```bash
40
- trekoon --help
41
- trekoon quickstart
24
+ trekoon init # set up .trekoon/ in your repo
25
+ trekoon quickstart # walkthrough of the basics
42
26
  ```
43
27
 
44
- ## Commands
28
+ ## The two workflows
45
29
 
46
- These are the commands most people need to recognize quickly:
30
+ Trekoon gives agents two modes: **plan** and **execute**. You can run them
31
+ separately or back to back.
47
32
 
48
- | Goal | Commands |
49
- | --- | --- |
50
- | Initialize a repo | `trekoon init` |
51
- | Install/open/update the local board | `trekoon board open`, `trekoon board update` |
52
- | Learn the CLI | `trekoon [command] -h`, `trekoon [command] [subcommand] -h`, `trekoon quickstart` |
53
- | Plan work | `trekoon epic ...`, `trekoon task ...`, `trekoon subtask ...`, `trekoon dep ...` |
54
- | Track epic progress | `trekoon epic progress <id>` |
55
- | Start an execution session | `trekoon session`, `trekoon session --epic <id>` |
56
- | Get next-action suggestions | `trekoon suggest`, `trekoon suggest --epic <id>` |
57
- | Keep worktrees in sync | `trekoon sync ...` |
58
- | Install or refresh the AI skill | `trekoon skills install`, `trekoon skills install -g`, `trekoon skills update` |
59
- | Maintenance | `trekoon events prune ...`, `trekoon migrate ...`, `trekoon wipe --yes` |
60
-
61
- Machine output modes:
62
-
63
- - `--toon` for true TOON-encoded payloads
64
- - `--json` for JSON output
65
- - `--compact` to strip metadata from TOON envelopes
66
- - `--compat <mode>` for explicit compatibility behavior
67
- - `--help` and `--version` at the root or command level
68
-
69
- For the full command surface, flags, filters, and bulk update rules, read the
70
- [command reference](docs/commands.md).
71
-
72
- ## Local board workflow
73
-
74
- Trekoon ships a no-extra-install local board for browsing and updating work in a
75
- browser.
76
-
77
- - `trekoon init` creates the shared `.trekoon` storage, database, and board
78
- runtime under `.trekoon/board`
79
- - `trekoon board open` ensures those bundled board assets are installed, starts a
80
- token-gated loopback server on `127.0.0.1`, and launches the browser
81
- - `trekoon board update` refreshes the board runtime assets only; it does not
82
- start the server or open a browser
83
-
84
- Keep the operator path simple:
33
+ ### Plan
85
34
 
86
- ```bash
87
- trekoon board open
88
- ```
35
+ Tell the agent what you want to build or find and fix bugs in your code. Then ask Trekoon to
36
+ create plan and decomposes the plan into an epic with tasks, subtasks, and dependency edges,
37
+ then writes the whole graph into Trekoon in a single transaction.
89
38
 
90
- Use `trekoon board update` only when you want to refresh the copied runtime
91
- assets without opening a session.
39
+ ```
40
+ /trekoon plan <description>
41
+ ```
92
42
 
93
- The browser flow is local-only by design:
43
+ What the agent does during planning:
94
44
 
95
- - Trekoon copies the board shell and app files into repo-shared storage, so the
96
- board still starts with one CLI command and no separate frontend build step
97
- - the board server binds only to `127.0.0.1`
98
- - every `board open` session uses a per-session token in the URL/API requests
99
- - command output always includes a manual fallback URL if the browser launch
100
- fails
45
+ 1. Asks clarifying questions if requirements are ambiguous
46
+ 2. Creates an epic with outcome-oriented title and scoped description
47
+ 3. Breaks it into tasks grouped by subsystem (auth, billing, UI, etc.)
48
+ 4. Adds subtasks with concrete file paths, acceptance criteria, and test commands
49
+ 5. Wires dependency edges so the execution order is explicit
50
+ 6. Assigns lane owners when multiple agents will work in parallel
51
+ 7. Validates the graph with `epic progress` and `suggest` before handing off
101
52
 
102
- Current runtime expectations:
53
+ Each task description includes target files, read-first files, do-not-touch
54
+ paths, and verification commands. Another agent (or a human) can pick up any
55
+ task and execute it without re-reading the codebase to figure out what to do.
103
56
 
104
- - the local runtime is served from `.trekoon/board`
105
- - all assets are self-hosted: the board ships its own CSS, fonts (Inter,
106
- Material Symbols), and vanilla JS with no framework or CDN dependencies
107
- - the board works fully offline once `trekoon board open` copies the runtime
108
- assets into `.trekoon/board`
57
+ ### Execute
109
58
 
110
- Current board behavior to expect:
59
+ Point the agent at an epic and it works through the dependency graph
60
+ automatically. It is recommended to do it with clean context window.
111
61
 
112
- - the topbar is a compact single-row navbar showing the Trekoon brand, Epics
113
- and Board navigation, search, theme toggle, and a workspace info popover;
114
- selecting an epic adds the active epic context to the topbar
115
- - the board toggles between an epics overview and a task workspace view; task
116
- detail opens as a modal overlay; responsive breakpoints adjust kanban column
117
- counts and component spacing
118
- - the page scrolls naturally as a single SPA surface; modal overlays (task
119
- detail, subtask editor) lock body scroll while open
120
- - overview cards are the primary entry point into an epic; clicking a card opens
121
- that epic's board workspace
122
- - task cards show truncated descriptions; clicking anywhere on a card opens the
123
- task detail modal with the full description
124
- - search is debounced and filters client-side across titles, descriptions,
125
- statuses, and subtask content
62
+ ```
63
+ /trekoon <id> execute
64
+ ```
126
65
 
127
- For the full lifecycle and examples, read [Quickstart](docs/quickstart.md) and
128
- [Command reference](docs/commands.md).
66
+ What the agent does during execution:
129
67
 
130
- ## AI skill
68
+ 1. Runs `session --epic <id>` to get diagnostics, sync status, and the first
69
+ ready task
70
+ 2. Marks the epic `in_progress`
71
+ 3. Groups ready tasks into lanes by subsystem to minimize redundant codebase
72
+ exploration
73
+ 4. Spawns sub-agents for parallel lanes (auth tasks go to one agent, billing
74
+ tasks to another)
75
+ 5. Each sub-agent claims a task, does the work, appends progress notes, and
76
+ calls `task done`
77
+ 6. `task done` returns which downstream tasks just became unblocked, so the
78
+ orchestrator knows what to dispatch next
79
+ 7. After all tasks complete: code review, tests, manual verification, then marks
80
+ the epic `done`
131
81
 
132
- Trekoon ships with a self-contained `trekoon` skill for AI agents. One skill
133
- covers the full plan-to-completion workflow:
82
+ The orchestrator uses `task done` responses to drive the whole loop. No polling,
83
+ no guessing. When a task finishes, Trekoon tells you exactly what's ready next.
134
84
 
135
- - **Command reference** — `--toon` defaults, status machine, bulk planning,
136
- append-based progress logging
137
- - **Planning** — decomposition into epic/task/subtask DAGs, writing standard,
138
- file scopes, owner assignment, dependency modeling
139
- - **Execution** — graph building, lane grouping, sub-agent dispatch, task done
140
- orchestration, verification
141
- - **Agent Teams** — TeamCreate/SendMessage pattern for parallel Claude Code
142
- instances (requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=true`)
85
+ ## Install the skill
143
86
 
144
- Install it per-repo or globally:
87
+ The `trekoon` skill is what teaches agents the planning methodology, execution
88
+ orchestration, status machine rules, and command reference. Without the skill,
89
+ agents don't know how to use Trekoon properly.
145
90
 
146
91
  ```bash
147
- trekoon skills install # repo-local (default)
92
+ trekoon skills install # repo-local (.agents/skills/trekoon/)
148
93
  trekoon skills install -g # global (~/.agents/skills/trekoon)
149
- trekoon update # refresh all installed links
94
+ trekoon update # refresh all installed skills
150
95
  ```
151
96
 
152
- The skill accepts arguments for quick entity-scoped actions:
97
+ The skill bundles three reference documents that agents load on demand:
98
+
99
+ | Agent needs to... | Skill reads | What it covers |
100
+ | --- | --- | --- |
101
+ | Plan a feature | `reference/planning.md` | Decomposition, writing standard, dependency modeling, validation |
102
+ | Execute an epic | `reference/execution.md` | Graph building, lane grouping, sub-agent dispatch, verification (universal) |
103
+ | Execute with Agent Teams | `reference/execution-with-team.md` | TeamCreate/SendMessage, parallel Claude Code instances in tmux |
104
+
105
+ ### Invoke the skill
153
106
 
154
107
  ```
155
108
  /trekoon → load the skill
109
+ /trekoon plan → decompose into tasks/subtasks/deps
156
110
  /trekoon <id> → show status and next steps for an entity
157
- /trekoon <id> execute → start executing the entity's epic
158
- /trekoon <id> plan decompose into tasks/subtasks/deps
111
+ /trekoon <id> execute → start the execution loop
112
+ /trekoon <id> analyze run progress + suggest, report findings
159
113
  ```
160
114
 
161
- Read [AI agents and the Trekoon skill](docs/ai-agents.md) for installation,
162
- editor linking, and example prompts.
115
+ ### Example prompts
116
+
117
+ Plan only:
118
+
119
+ ```
120
+ /trekoon — plan this feature as one epic with tasks, subtasks, and dependencies
121
+ ```
163
122
 
164
- ## Read next
123
+ Execute only:
124
+
125
+ ```
126
+ /trekoon <epic-id> execute
127
+ ```
128
+
129
+ Plan and execute end to end:
130
+
131
+ ```
132
+ /trekoon — plan this feature, create the backlog, then execute the tasks in
133
+ dependency order until the epic is complete
134
+ ```
135
+
136
+ ## Agent Teams
137
+
138
+ For larger epics, Trekoon supports Claude Code Agent Teams. Instead of
139
+ sequential sub-agents, you get real parallel Claude Code instances coordinated
140
+ through `TeamCreate` and `SendMessage`, each running in its own tmux pane.
141
+
142
+ Requires Claude Code env variable `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=true`.
143
+
144
+ The team lead orchestrator creates a team, populates a shared task list, spawns
145
+ 3-5 teammates per lane, and coordinates via messages. Teammates claim tasks,
146
+ report completions and blockers, and the lead dispatches new work as tasks get
147
+ unblocked.
148
+
149
+ ## Status machine
150
+
151
+ Trekoon enforces valid transitions. You can't skip straight from `todo` to
152
+ `done`.
153
+
154
+ | From | Allowed targets |
155
+ | --- | --- |
156
+ | `todo` | `in_progress`, `blocked` |
157
+ | `in_progress` | `done`, `blocked` |
158
+ | `blocked` | `in_progress`, `todo` |
159
+ | `done` | `in_progress` |
160
+
161
+ Exception: `task done` auto-transitions through `in_progress`, so agents can
162
+ call it from any non-done status.
163
+
164
+ ## Local board
165
+
166
+ Trekoon includes a browser-based board for humans who like having visual overview.
167
+ No build step, no framework dependencies, works offline.
168
+
169
+ ```bash
170
+ trekoon board open # starts a local server, opens browser
171
+ trekoon board update # refresh assets only
172
+ ```
173
+
174
+ Binds to `127.0.0.1` only with a per-session token. Gives you an epics
175
+ overview, kanban workspace per epic, task detail modals, and search.
176
+
177
+ ## Commands
178
+
179
+ | What you want to do | How |
180
+ | --- | --- |
181
+ | Set up a repo | `trekoon init` |
182
+ | Open the local board | `trekoon board open` |
183
+ | Plan work | `trekoon epic create ...`, `trekoon epic expand ...` |
184
+ | Create tasks in bulk | `trekoon task create-many ...` |
185
+ | Add dependencies | `trekoon dep add-many ...` |
186
+ | Start an agent session | `trekoon session --epic <id>` |
187
+ | Get next-action suggestions | `trekoon suggest --epic <id>` |
188
+ | Check epic progress | `trekoon epic progress <id>` |
189
+ | Mark a task done | `trekoon task done <id>` |
190
+ | Sync across worktrees | `trekoon sync pull --from main` |
191
+ | Get help | `trekoon [command] -h` |
192
+
193
+ Every command supports `--toon`, `--json`, `--compact` for structured output.
194
+
195
+ Full flag reference in [docs/commands.md](docs/commands.md).
196
+
197
+ ## Docs
165
198
 
166
199
  - [Quickstart](docs/quickstart.md)
167
200
  - [Command reference](docs/commands.md)
@@ -169,10 +202,3 @@ editor linking, and example prompts.
169
202
  - [Machine contracts](docs/machine-contracts.md)
170
203
  - [Contributing](CONTRIBUTING.md)
171
204
  - [Changelog](CHANGELOG.md)
172
-
173
- ## Implementation principles
174
-
175
- - Minimal, composable modules
176
- - Strict validation at command boundaries
177
- - Stable automation envelopes for JSON and TOON modes
178
- - No unnecessary feature sprawl