@mindfoldhq/trellis 0.6.0-rc.0 → 0.6.0

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.
@@ -0,0 +1 @@
1
+ {"version": "0.6.0", "description": "v0.6.0 stable — multi-agent channel runtime, `trellis mem`, `@mindfoldhq/trellis-core` SDK extraction, 15-platform coverage (incl. Reasonix + Pi). Stable promotion of rc.0 with no new src/ changes.", "breaking": false, "recommendMigrate": true, "changelog": "**v0.6.0 stable.** Stable promotion of rc.0 — no new src/ changes since rc.0.\n\n**Heads-up:** Trellis now ships a multi-agent channel runtime (`trellis channel`) and a memory subsystem (`trellis mem`). Both are auto-discovered via bundled skills; the single-agent workflow from 0.5 still works unchanged.\n\nCycle headlines since 0.5.0:\n\n**Channel runtime**\n- `trellis channel`: durable thread / forum channels, project/global scope, linked context, idempotent writes (`idempotencyKey`).\n- Worker lifecycle: `spawn` / `kill` / `prune` / `wait` / `run` with turn-event recording.\n- OOM guard ON by default: `idle_timeout 5m`, `max_live_workers 6` per scope; tunable via `.trellis/config.yaml` or `--idle-timeout` / `--max-live-workers`.\n- Bundled `.trellis/agents/{check,implement}.md` ship at `init` / `update` so `channel spawn --agent` works out of the box (#323).\n\n**Memory**\n- `trellis mem` reads local Claude Code / Codex sessions. Five subcommands: `projects` / `list` / `search` / `context` / `extract`.\n- `--phase brainstorm|implement|all` slices at `task.py create` / `task.py start` boundaries.\n- Library API: `@mindfoldhq/trellis-core/mem`. OpenCode 1.2+ reader degraded (see notes).\n\n**SDK extraction**\n- `@mindfoldhq/trellis-core` is now its own npm package, published in lockstep with the CLI. Subpath exports: `/channel`, `/task`, `/testing`, `/mem`.\n- v0.6.0 is the first GA shipping both packages simultaneously; `bump-versions.js` rewrites `workspace:*` → exact version at release.\n\n**Platform coverage**\n- 15 platforms total. **New: Reasonix** (DeepSeek-Reasonix) and **matured Pi Agent** native extension with `trellis_subagent` tool + project-level override.\n- Codex dispatch defaults to `inline` (was `sub-agent`); no longer writes `[features.multi_agent_v2]` to `.codex/config.toml` (fixes config-load abort on Codex CLI ≤ 0.130).\n- OpenCode `TRELLIS_CONTEXT_ID` picks shell dialect (PowerShell / Git Bash / POSIX).\n- Cursor `sessionStart` emits `additional_context` per Cursor schema; GitHub Copilot SessionStart uses `hookSpecificOutput.additionalContext`.\n\n**Workflow + planning**\n- Task triage consent: no-task turns classify the request and ask before creating a task.\n- Three planning artifacts: `prd.md` / `design.md` / `implement.md`. Parent / child task trees supported.\n- Workflow templates via `trellis init --workflow` and `trellis workflow`. Built-ins: `native`, `tdd`, `channel-driven-subagent-dispatch`.\n\n**Updater**\n- `trellis upgrade` first-class command: channel-aware defaults, `--tag`, `--dry-run`; hardened for Windows.\n- `trellis update` refreshes registry-backed `.trellis/spec` (supports direct + marketplace registries, SSH, self-hosted Git; #324).\n- Configurable hooks via `.trellis/config.yaml`: session commit / journal limits, `hooks.after_*`, `channel.worker_guard.*`, `codex.dispatch_mode`.\n\n**Bundled skills**\n- `trellis-spec-bootstrap` (renamed from typoed `trellis-spec-bootstarp`, #296): bootstraps `.trellis/spec/` from the real codebase.\n- `trellis-session-insight` (new): when to reach for `trellis mem` for cross-session recall.\n- `trellis-channel` (new in GA cycle): when to reach for `trellis channel` for multi-agent collaboration, forum/thread boards, dispatcher-wait patterns.\n- `trellis-meta` (refreshed for v0.6): SKILL.md preamble + new references (`multi-agent-channel.md`, `bundled-skills.md`) cover channel runtime, mem, dual-package SDK, parent/child tasks, workflow templates, registry-backed spec, configurable hooks, Reasonix + Pi platforms, bundled-skill auto-dispatch flow.\n\n**Migration & update flow**\n- `0.6.0-beta.0` is the load-bearing breaking manifest for 0.5.x → 0.6.0 (rename / delete chain documented in its own `migrationGuide`).\n- `0.6.0-beta.23` ships a `rename-dir` migration: `trellis-spec-bootstarp/` → `trellis-spec-bootstrap/` across 13 platform skill roots. Missing roots silently skip.\n- This `0.6.0.json` carries `migrations: []` (GA = rc.0). `recommendMigrate: true` still fires the `--migrate` guidance for users coming directly from 0.5.x.\n\n**Bug fixes (cut window)**\n- fix(agents): drop explicit `mcp__exa__*` tools from bundled `trellis-implement` / `trellis-check` defs. Claude Code silently skipped agent registration when an explicit MCP tool failed to resolve; users without Exa MCP installed lost every Trellis sub-agent. `trellis-research` keeps external search via `mcp__*` wildcard. OpenCode files unchanged (different permission syntax). (#302, rc.0)\n- Earlier 0.6 beta-line bug fixes are documented in their per-beta changelogs.\n\n**Out of scope at GA**\n- OpenCode 1.2+ `trellis mem` reader remains degraded; permanent rework deferred past 0.6.0.\n- Open feature requests (#193, #318, #320, #325, #326) deferred to 0.7+.", "migrations": [], "notes": "**Stable release.** Promoted from 0.6.0-rc.0 with no new src/ changes since.\n\n**Users on 0.5.x** (e.g. `0.5.19`, the last 0.5 stable): run `trellis update --migrate`. The `--migrate` flag is REQUIRED — the breaking-change gate from `0.6.0-beta.0` fires when traversing the migration chain, and a separate `rename-dir` migration from `0.6.0-beta.23` renames the bundled `trellis-spec-bootstarp/` skill directory to `trellis-spec-bootstrap/` across every configured platform skill root (missing roots silently skip).\n\n**Users on any 0.6.0 prerelease** (`beta.X` / `rc.0`): plain `trellis update` is a clean version bump — no `--migrate` needed because you already absorbed the breaking manifest when you adopted the beta line.\n\n**Codex users**: the v0.6 cycle flipped `codex.dispatch_mode` default from `sub-agent` to `inline`. If you previously uncommented `dispatch_mode: sub-agent` in `.trellis/config.yaml`, that opt-in still routes to the legacy sub-agent dispatch flow; if you left the line commented (the default), behavior is now inline. `trellis init` / `update` no longer write a `[features.multi_agent_v2]` block to `.codex/config.toml`, so Codex CLI ≤ 0.130 (including the desktop app's bundled CLI) no longer aborts on config load.\n\n**Channel runtime is opt-in.** The single-agent workflow you know from 0.5 still works unchanged. `trellis channel` and the bundled `trellis-session-insight` skill are auto-discovered but only fire when the AI decides the task calls for them.\n\n**OpenCode users**: `trellis mem` returns empty on OpenCode 1.2+ in this build — the SQLite reader was reverted at `0.6.0-beta.4` due to native-dependency install failures on Windows. A re-enable is planned post-0.6.0.\n\nInstall: `npm install -g @mindfoldhq/trellis`"}
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: trellis-channel
3
+ description: Use Trellis channel for live multi-agent collaboration, spawned workers, cross-agent review, progress inspection, forum channels, and channel log debugging.
4
+ ---
5
+
6
+ # trellis-channel
7
+
8
+ `trellis channel` is the local multi-agent collaboration runtime. Reach for it when agents need to talk through a durable event log, when a worker should be spawned as a peer process, when an in-flight worker needs interrupt / debugging, or when feedback should be recorded on a durable `--type forum` channel.
9
+
10
+ Typical user signals: "和 codex/claude 讨论", "brainstorm with another agent", "spawn an implement/check worker", "let agent review", "open an issue board / changelog forum", "look at this thread", "channel is stuck / no output", "progress was truncated", "how do I write that channel command".
11
+
12
+ This skill is an index. Load only the reference file for the current job — do not preload all of them.
13
+
14
+ ## First Commands
15
+
16
+ ```bash
17
+ trellis --version
18
+ trellis channel --help
19
+ trellis channel list --all
20
+ trellis channel list --scope global --all
21
+ ```
22
+
23
+ If the user names a channel or thread, inspect it before asking for background:
24
+
25
+ ```bash
26
+ trellis channel forum <board> --scope global
27
+ trellis channel thread <board> <thread> --scope global
28
+ trellis channel context list <board> --scope global --thread <thread>
29
+ ```
30
+
31
+ ## Route By User Intent
32
+
33
+ | User intent | Read |
34
+ |---|---|
35
+ | "和 codex/claude 讨论一下", "brainstorm with another agent" | `references/workflows.md` |
36
+ | "派一个 implement/check agent", "让 agent review", "spawn a worker" | `references/workflows.md`, then `references/workers.md` |
37
+ | "开 issue 区 / topic 群 / changelog / board", "make a forum" | `references/forum.md` |
38
+ | "看看这个 thread / linked context", "inspect a thread" | `references/forum.md` |
39
+ | "channel 卡住了 / 没输出 / progress 被截断", "worker stalled" | `references/progress-debugging.md` |
40
+ | "具体命令怎么写", "what flags does X take" | `references/command-reference.md` |
41
+
42
+ ## Core Rules
43
+
44
+ - New forum channels use `--type forum`. A `thread` is one item inside a forum channel.
45
+ - Use `--context-file` / `--context-raw` and `trellis channel context add/delete/list`. `--linked-context-*` is deprecated terminology.
46
+ - Use `--stdin` or `--text-file` for long messages. Do not put long mixed Chinese/English text in the positional shell argument.
47
+ - Pretty `messages` output is an operator dashboard and may truncate progress. Use `--raw` for audit.
48
+ - `--as` is the speaker or worker handle, depending on the command. Use explicit, stable names when multiple agents or sessions are involved.
49
+ - `--scope project` (default) operates on the current cwd's project bucket; `--scope global` operates on the shared `__global__` bucket. Pick scope deliberately — a global board is invisible from project listings unless `--scope global` is passed.
50
+ - For brainstorm, do multiple pressure-test rounds. One answer plus one confirmation is review, not brainstorm.
51
+ - **Dispatcher wait pattern**: use `--kind done` / `--kind turn_finished` (trellis-emitted system events), NOT a user `--tag` as the completion signal. CLI help lists `phase_done` / `question` as `--tag` examples but only `interrupt` is a reserved tag with hardcoded trellis behavior; the others are opaque user labels. Relying on a worker to run `send --tag <my_signal>` is unreliable — LLM workers commonly write the tag string into prose instead of running the actual CLI command. See `references/command-reference.md` "tag vs kind".
52
+ - Forum channels are event-sourced. Do not parse `events.jsonl` first; use `forum`, `thread`, `messages --thread`, and `context list`.
53
+ - `@mindfoldhq/trellis-core` owns reusable channel/thread state, event append, seq allocation, context/title projection, reducers, and task helpers. The CLI owns flags, terminal rendering, prompts, worker lifecycle, and process exits.
54
+
55
+ ## Reference Files
56
+
57
+ - `references/workflows.md` — canonical collaboration patterns A–F (peer brainstorm, spawned review, dispatch-and-wait, forum issue capture, interrupt-and-redirect, one-shot run).
58
+ - `references/forum.md` — forum channels, context, title, rename, changelog forums, thread filtering.
59
+ - `references/workers.md` — spawn, agent cards, context injection (`--file` / `--jsonl`), interrupts, kill semantics.
60
+ - `references/progress-debugging.md` — progress/raw inspection, stalled worker diagnosis, OOM guard, exit codes.
61
+ - `references/command-reference.md` — current CLI command reference (every subcommand, every flag, output conventions, scope/type model).
62
+
63
+ ## Not For
64
+
65
+ - One static review where a markdown file and prompt are enough.
66
+ - Replacing normal tool calls with self-logging.
67
+ - Long-term memory retrieval. Use durable forum channels for actionable issues, and `trellis mem` (the `trellis-session-insight` skill) for session/history search.
@@ -0,0 +1,480 @@
1
+ # Command Reference
2
+
3
+ Authoritative current command reference for `trellis channel` subcommands,
4
+ validated against the source in `packages/cli/src/commands/channel/`
5
+ (`index.ts` Commander wiring and each subcommand handler).
6
+
7
+ Every subcommand accepts `--scope <project|global>` unless noted; `project`
8
+ is the default and resolves against the current cwd's project bucket.
9
+
10
+ ## Top-level
11
+
12
+ ```
13
+ trellis channel <subcommand>
14
+ ```
15
+
16
+ > Multi-agent collaboration runtime — spawn / coordinate / interrupt worker
17
+ > agents through a shared event log.
18
+
19
+ ---
20
+
21
+ ## Create / List
22
+
23
+ ### `create <name>`
24
+
25
+ ```bash
26
+ trellis channel create <name>
27
+ [--scope project|global] # default: project
28
+ [--type chat|forum] # default: chat
29
+ [--task <path>] # associated Trellis task dir
30
+ [--project <slug>]
31
+ [--labels a,b,c]
32
+ [--description <text>] # stable channel description
33
+ [--context-file <abs-path>] ... # repeatable
34
+ [--context-raw <text>] ... # repeatable
35
+ [--linked-context-file <abs-path>] # [deprecated alias]
36
+ [--linked-context-raw <text>] # [deprecated alias]
37
+ [--cwd <path>] # recorded in create event
38
+ [--by <agent>] # default: main
39
+ [--force] # overwrite existing channel
40
+ [--ephemeral] # hide from default list, prunable
41
+ ```
42
+
43
+ Behavior:
44
+ - Appends a `create` event; immutable `type` (cannot mutate forum↔chat after).
45
+ - `--ephemeral` channels are hidden from `channel list` by default and are
46
+ the sweep target for `channel prune --ephemeral`.
47
+ - `--linked-context-*` are folded into `--context-*`; emit a deprecation
48
+ notice when used.
49
+
50
+ ### `list`
51
+
52
+ ```bash
53
+ trellis channel list
54
+ [--scope project|global]
55
+ [--json]
56
+ [--project <slug>] # substring match on task field
57
+ [--all] # include ephemeral (suffix '*')
58
+ [--all-projects] # scan every project bucket
59
+ ```
60
+
61
+ Behavior:
62
+ - Default scope: current cwd's project. `--all-projects` scans every bucket.
63
+ - Pretty mode prints `NAME WORKERS EVENTS LAST KIND TYPE TASK`, sorted by
64
+ recency, with a footer noting hidden ephemeral count.
65
+ - `--json` switches to a JSON array.
66
+
67
+ ---
68
+
69
+ ## Chat Messages
70
+
71
+ ### `send <name> [text]`
72
+
73
+ ```bash
74
+ trellis channel send <name> [text]
75
+ --as <agent> # REQUIRED — author
76
+ [--scope project|global]
77
+ [--to <agents,csv>] # default: broadcast
78
+ [--stdin | --text-file <path>] # body from stdin or file
79
+ [--delivery-mode appendOnly|requireKnownWorker|requireRunningWorker]
80
+ ```
81
+
82
+ Behavior:
83
+ - Body precedence: positional `[text]` → `--stdin` → `--text-file`.
84
+ - `--to` with one entry stores a string; multiple stores an array; omitted
85
+ means broadcast.
86
+ - `--delivery-mode` selects targeted-delivery validation:
87
+ - `appendOnly` (default-ish — just record),
88
+ - `requireKnownWorker` (the named target must have a `spawned` event),
89
+ - `requireRunningWorker` (the worker must currently be live).
90
+ - Prints the appended event as one JSON line on stdout.
91
+
92
+ > **Note:** `send` has **no** `--tag` and **no** `--kind` flag. See
93
+ > [`tag-vs-kind`](#tag-vs-kind--how-event-shape-is-actually-controlled) below.
94
+
95
+ ### `messages <name>`
96
+
97
+ ```bash
98
+ trellis channel messages <name>
99
+ [--scope project|global]
100
+ [--raw] # one JSON event per line
101
+ [--follow] # stream new events
102
+ [--last <N>] # last N matching events
103
+ [--since <seq>] # seq > N
104
+ [--kind <kind>] # one of CHANNEL_EVENT_KINDS
105
+ [--from <csv>] # author filter
106
+ [--to <target>] # routing target filter
107
+ [--thread <key>] # forum-only
108
+ [--action <thread-action>] # forum-only
109
+ [--no-progress] # hide progress events
110
+ ```
111
+
112
+ Behavior:
113
+ - Auto-detects forum channels: with no filters it renders the thread board
114
+ instead of the event stream. `--thread` / `--action` are forum-only and
115
+ error against chat channels.
116
+ - `--kind` is validated against `CHANNEL_EVENT_KINDS` (single value, not
117
+ CSV — that's the `wait` side).
118
+
119
+ ### `wait <name>`
120
+
121
+ ```bash
122
+ trellis channel wait <name>
123
+ --as <agent> # REQUIRED — self for filter ctx
124
+ [--scope project|global]
125
+ [--timeout <Ns|Nm|Nh|Nms>] # parsed by parseDuration
126
+ [--from <a,b>] # author CSV
127
+ [--kind <k1,k2>] # CSV, OR semantics
128
+ [--thread <key>] # forum filter
129
+ [--action <thread-action>] # forum filter
130
+ [--to <target>] # default: own agent (broadcast + me)
131
+ [--include-progress] # also wake on progress events
132
+ [--all] # require every --from to match
133
+ ```
134
+
135
+ Behavior:
136
+ - Streams matching events as JSON, one per line.
137
+ - Default `--to` filter is the caller's own agent (broadcast events still
138
+ match — broadcast + explicit-to-me).
139
+ - `--all` requires `--from` and blocks until every listed agent has produced
140
+ a matching event.
141
+ - **Timeout exits 124** and prints `timeout: still waiting on ...` to stderr
142
+ when `--all` was in play.
143
+
144
+ ---
145
+
146
+ ## tag-vs-kind — how event shape is actually controlled
147
+
148
+ There is **no `--tag` flag** anywhere in the v0.6.0 channel CLI; `--kind` is
149
+ not a legacy alias for any `--tag` flag.
150
+
151
+ Concrete model in the current source:
152
+
153
+ - `--kind` is the only event-type filter, and it is constrained to the
154
+ trellis-emitted whitelist (`CHANNEL_EVENT_KINDS` in
155
+ `packages/core/src/channel/internal/store/events.ts`):
156
+ - `create`, `join`, `leave`, `message`, `thread`, `context`, `channel`,
157
+ `spawned`, `killed`, `respawned`, `progress`, `done`, `error`,
158
+ `waiting`, `awake`, `undeliverable`, `interrupt_requested`,
159
+ `turn_started`, `turn_finished`, `interrupted`, `supervisor_warning`
160
+ - Passing anything else throws
161
+ `Invalid --kind '<x>'. Must be one of: …`.
162
+ - `--kind` lives on `wait` (CSV, OR semantics) and `messages` (single
163
+ value). `send` and `run` cannot emit a custom kind — every `send` writes
164
+ a `message` event.
165
+ - Mid-turn worker abort is **not** a tag. It is the dedicated
166
+ `channel interrupt` command, which appends an `interrupt_requested` /
167
+ `interrupted` pair and provider-level interrupts the worker.
168
+
169
+ Practical rule for dispatchers waiting on workers:
170
+
171
+ - Use `--kind done,turn_finished` for "worker finished a turn" — these are
172
+ system events that the supervisor fires automatically. Do not depend on
173
+ the worker LLM remembering to emit any custom signal.
174
+ - Use `trellis channel interrupt` (the command) only when you actually want
175
+ mid-turn abort behavior.
176
+ - Do **not** invent user-side tags as completion signals. There is no
177
+ `--tag` filter; a worker writing a custom string into its final message
178
+ is just text inside a `message` event and cannot be matched by `wait`.
179
+
180
+ Long bodies always go through stdin or a file:
181
+
182
+ ```bash
183
+ trellis channel send T --as A --stdin < /tmp/message.md
184
+ trellis channel send T --as A --text-file /tmp/message.md
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Interrupt
190
+
191
+ ### `interrupt <name> [text]`
192
+
193
+ ```bash
194
+ trellis channel interrupt <name> [text]
195
+ --as <agent> # REQUIRED — caller
196
+ --to <agent> # REQUIRED — target worker
197
+ [--scope project|global]
198
+ [--stdin | --text-file <path>]
199
+ ```
200
+
201
+ Behavior:
202
+ - Appends an `interrupt` event with `reason: "user"` and a replacement
203
+ instruction body; supervisor performs provider-level interrupt where
204
+ supported (Claude `/interrupt`, Codex turn cancel).
205
+ - Prints the appended event JSON on stdout.
206
+
207
+ ---
208
+
209
+ ## Workers
210
+
211
+ ### `spawn <name>`
212
+
213
+ ```bash
214
+ trellis channel spawn <name>
215
+ [--scope project|global]
216
+ [--agent <agent-name>] # loads .trellis/agents/<name>.md
217
+ [--provider claude|codex] # overrides agent file
218
+ [--as <worker-name>] # default: agent name
219
+ [--cwd <path>]
220
+ [--model <id>]
221
+ [--resume <id>] # session/thread id resume
222
+ [--timeout <Ns|Nm|Nh>] # auto-kill after duration
223
+ [--warn-before <Ns|Nm|Nh>] # supervisor_warning lead time
224
+ # default 5m, 0ms disables
225
+ [--file <path>] ... # glob, repeatable; inject content
226
+ [--jsonl <path>] ... # Trellis manifest, repeatable
227
+ [--by <agent>] # spawn-event author
228
+ # default: TRELLIS_CHANNEL_AS env or 'main'
229
+ [--inbox-policy explicitOnly|broadcastAndExplicit]
230
+ # default explicitOnly
231
+ [--idle-timeout <Ns|Nm|Nh>] # OOM-guard idle TTL
232
+ # default 5m, 0 disables
233
+ [--max-live-workers <n>] # spawn-time live-worker budget
234
+ # default 6, 0 disables
235
+ ```
236
+
237
+ Behavior:
238
+ - Provider is validated against the adapter registry
239
+ (`packages/cli/src/commands/channel/adapters/`); current: `claude`,
240
+ `codex`.
241
+ - Worker stays inbox-idle until the first `send --to <worker>`.
242
+ - Records a `spawned` event with `pid`, `provider`, `agent`, `files`,
243
+ `manifests`.
244
+ - OOM-guard precedence: CLI flag → env var
245
+ (`TRELLIS_CHANNEL_WORKER_IDLE_TIMEOUT`,
246
+ `TRELLIS_CHANNEL_MAX_LIVE_WORKERS`) →
247
+ `.trellis/config.yaml#channel.worker_guard` → built-in defaults.
248
+
249
+ ### `run [name]`
250
+
251
+ ```bash
252
+ trellis channel run [name?]
253
+ [--agent <name>]
254
+ [--provider claude|codex]
255
+ [--as <worker-name>]
256
+ [--cwd <path>]
257
+ [--model <id>]
258
+ [--file <path>] ... # repeatable, glob
259
+ [--jsonl <path>] ... # repeatable
260
+ [--message <text> | --message-file <path> | --stdin]
261
+ [--timeout <Ns|Nm|Nh>] # default 5m
262
+ ```
263
+
264
+ Behavior:
265
+ - One-shot. Auto-generates `run-<hex>` if `name` omitted.
266
+ - Creates an ephemeral channel (`createMode=run`), spawns a single worker,
267
+ sends the prompt, waits for `done`, prints the final assistant text to
268
+ stdout, then removes the channel on success. On failure the channel is
269
+ kept for inspection and exit code is 1.
270
+
271
+ > `run` has **no** `--tag` flag. Completion is detected via the `done`
272
+ > event the supervisor emits.
273
+
274
+ ### `kill <name>`
275
+
276
+ ```bash
277
+ trellis channel kill <name>
278
+ --as <agent> # REQUIRED — worker agent name
279
+ [--scope project|global]
280
+ [--force] # SIGKILL immediately
281
+ ```
282
+
283
+ Behavior:
284
+ - Default path: SIGTERM → 8 s grace → SIGKILL escalation; the CLI writes a
285
+ `killed` event when SIGKILL was needed so the log stays truthful.
286
+ - Cleans `pid`, `worker-pid`, `config`, `spawnlock` sidecar files; keeps
287
+ `log`, `session-id`, `thread-id` for forensics / resume.
288
+
289
+ ### `rm <name>`
290
+
291
+ ```bash
292
+ trellis channel rm <name>
293
+ [--scope project|global]
294
+ ```
295
+
296
+ Behavior:
297
+ - Kills any live workers, then deletes the entire channel directory.
298
+ - Prints `Removed channel '<name>'`.
299
+
300
+ ### `prune`
301
+
302
+ ```bash
303
+ trellis channel prune
304
+ [--scope project|global] # omitted: scan every project
305
+ [--all | --empty | --idle <Ns|Nm|Nh|Nd> | --ephemeral] # mutually exclusive
306
+ [--yes] # actually delete (default: dry-run)
307
+ [--dry-run] # default true; redundant with default
308
+ [--keep <names,csv>] # exclusion list
309
+ ```
310
+
311
+ Behavior:
312
+ - Filter flags are mutually exclusive — error otherwise.
313
+ - Default is dry-run; `--yes` flips to real delete.
314
+ - Without `--scope`, scans **every** project bucket (intentional, repo-wide
315
+ cleanup); with `--scope project|global`, limited to that bucket.
316
+ - Live-worker channels are always skipped regardless of filter.
317
+ - Output: per-candidate line `name last-ts (reason)` plus a final summary.
318
+
319
+ ---
320
+
321
+ ## Forum Channels
322
+
323
+ ### `post <name> <action>`
324
+
325
+ ```bash
326
+ trellis channel post <name> <action>
327
+ --as <agent> # REQUIRED
328
+ [--scope project|global]
329
+ [--thread <key>] # required except action=opened
330
+ [--title <text>]
331
+ [--text <text> | --stdin | --text-file <path>]
332
+ [--description <text>] # stable thread description
333
+ [--status <status>]
334
+ [--labels a,b] # REPLACES thread labels
335
+ [--assignees a,b] # REPLACES assignees
336
+ [--summary <text>]
337
+ [--context-file <abs-path>] ...
338
+ [--context-raw <text>] ...
339
+ [--linked-context-file <abs-path>] # [deprecated alias]
340
+ [--linked-context-raw <text>] # [deprecated alias]
341
+ ```
342
+
343
+ Behavior:
344
+ - `<action>` is free-form on the CLI surface; conventional values include
345
+ `opened`, `comment`, `status`, `labels`, `assignees`, `summary`,
346
+ `processed`.
347
+ - `action=rename` is rejected — use `thread rename` instead.
348
+ - `--labels` / `--assignees` are replace-semantics, not append.
349
+ - Output: appended event JSON on stdout.
350
+
351
+ ### `forum <name>`
352
+
353
+ ```bash
354
+ trellis channel forum <name>
355
+ [--scope project|global]
356
+ [--status <status>]
357
+ [--raw]
358
+ ```
359
+
360
+ Behavior:
361
+ - Lists threads (reduced state). `--status` filters by current thread
362
+ status. `--raw` prints one JSON per thread.
363
+
364
+ ### `thread <name> <thread>` / `thread rename`
365
+
366
+ ```bash
367
+ trellis channel thread <name> <thread-key>
368
+ [--scope project|global]
369
+ [--raw]
370
+
371
+ trellis channel thread rename <name> <old-thread> <new-thread>
372
+ --as <agent> # REQUIRED
373
+ [--scope project|global]
374
+ ```
375
+
376
+ Behavior:
377
+ - `thread <name> <key>` shows one thread's timeline:
378
+ header `<thread> [<status>] <title>`, then description / labels /
379
+ assignees / summary / timeline lines. `--raw` switches to raw events.
380
+ - `thread rename` is the only mutation; `post --action rename` is rejected.
381
+
382
+ ---
383
+
384
+ ## Context / Title
385
+
386
+ ### `context add` / `context delete` / `context list`
387
+
388
+ ```bash
389
+ trellis channel context add <name>
390
+ [--as <agent>] # default: main
391
+ [--scope project|global]
392
+ [--thread <key>] # thread-level instead of channel-level
393
+ [--file <abs-path>] ... # repeatable
394
+ [--raw <text>] ... # repeatable
395
+ # at least one of --file or --raw
396
+
397
+ trellis channel context delete <name>
398
+ [--as <agent>] # default: main
399
+ [--scope project|global]
400
+ [--thread <key>]
401
+ [--file <abs-path>] ...
402
+ [--raw <text>] ...
403
+
404
+ trellis channel context list <name>
405
+ [--scope project|global]
406
+ [--thread <key>]
407
+ [--raw] # one JSON entry per line
408
+ ```
409
+
410
+ Behavior:
411
+ - `add` / `delete` append a `context` event and print the event JSON.
412
+ - `list` projects current context entries; pretty output is
413
+ `file <path>` / `raw <truncated text>` lines, `(no context)` when empty.
414
+
415
+ ### `title set <name>` / `title clear <name>`
416
+
417
+ ```bash
418
+ trellis channel title set <name>
419
+ --title <text> # REQUIRED
420
+ [--as <agent>] # default: main
421
+ [--scope project|global]
422
+
423
+ trellis channel title clear <name>
424
+ [--as <agent>] # default: main
425
+ [--scope project|global]
426
+ ```
427
+
428
+ Behavior:
429
+ - Appends a `title` event projecting a stable display title onto the
430
+ channel. Output: event JSON.
431
+
432
+ ---
433
+
434
+ ## Hidden / Internal
435
+
436
+ | Command | Purpose |
437
+ |---|---|
438
+ | `channel __supervisor <channel> <worker> <config>` | Forked entry point invoked by `spawn`. Do not invoke directly. |
439
+ | `channel __parse-trace <adapter> <file>` | Dev helper — replays a recorded stream-json / wire trace through the matching adapter and prints the resulting channel events. Adapter is validated against the provider registry. |
440
+
441
+ ---
442
+
443
+ ## Event Model
444
+
445
+ `CHANNEL_EVENT_KINDS` (whitelist enforced by `parseChannelKind`):
446
+
447
+ `create`, `join`, `leave`, `message`, `thread`, `context`, `channel`,
448
+ `spawned`, `killed`, `respawned`, `progress`, `done`, `error`, `waiting`,
449
+ `awake`, `undeliverable`, `interrupt_requested`, `turn_started`,
450
+ `turn_finished`, `interrupted`, `supervisor_warning`.
451
+
452
+ `MEANINGFUL_EVENT_KINDS` (default-visible subset used by `wait` /
453
+ `messages` when no explicit `--kind` is given):
454
+
455
+ `create`, `join`, `leave`, `message`, `thread`, `context`, `channel`,
456
+ `spawned`, `killed`, `respawned`, `done`, `error`.
457
+
458
+ Non-meaningful kinds (e.g. `progress`, `waiting`, `awake`,
459
+ `supervisor_warning`, the `turn_*` / `interrupt*` set) still flow through
460
+ the store; opt in via `--kind` or `--include-progress`.
461
+
462
+ Forum channels are event-sourced; use the CLI reducers
463
+ (`forum`, `thread`, `context list`) for state projection.
464
+
465
+ ---
466
+
467
+ ## Output Conventions
468
+
469
+ - **Mutations** (`send`, `interrupt`, `post`, `context add/delete`,
470
+ `title set/clear`, `thread rename`) print the appended event as one JSON
471
+ line on **stdout**.
472
+ - **Streaming reads** (`wait`, `messages --follow`) print one JSON event
473
+ per line on stdout.
474
+ - **Pretty reads** (`list`, `messages`, `forum`, `thread`, `context list`)
475
+ print colored, padded tables / timelines.
476
+ - **`run`** prints only the final assistant text on stdout (so callers can
477
+ pipe); diagnostic notes go to stderr.
478
+ - **Errors** go through `chalk.red("Error:")` to stderr and `exit 1`.
479
+ - **`wait` timeout** specifically exits **124**.
480
+