@excitedjs/dreamux 0.13.0 → 0.14.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.
Files changed (88) hide show
  1. package/CHANGELOG.json +41 -0
  2. package/CHANGELOG.md +16 -1
  3. package/README.md +7 -4
  4. package/dist/admin/methods.js +86 -61
  5. package/dist/admin/methods.js.map +1 -1
  6. package/dist/admin/socket.js +31 -0
  7. package/dist/admin/socket.js.map +1 -1
  8. package/dist/agent-runtime/builtin/claude-code/runtime.js +8 -3
  9. package/dist/agent-runtime/builtin/claude-code/runtime.js.map +1 -1
  10. package/dist/agent-runtime/builtin/claude-code/supervisor.js +5 -0
  11. package/dist/agent-runtime/builtin/claude-code/supervisor.js.map +1 -1
  12. package/dist/agent-runtime/builtin/codex/codex-home.js +2 -3
  13. package/dist/agent-runtime/builtin/codex/codex-home.js.map +1 -1
  14. package/dist/agent-runtime/builtin/codex/paths.js +16 -62
  15. package/dist/agent-runtime/builtin/codex/paths.js.map +1 -1
  16. package/dist/agent-runtime/builtin/codex/runtime-support.js +4 -3
  17. package/dist/agent-runtime/builtin/codex/runtime-support.js.map +1 -1
  18. package/dist/agent-runtime/builtin/codex/runtime.js +5 -6
  19. package/dist/agent-runtime/builtin/codex/runtime.js.map +1 -1
  20. package/dist/agent-runtime/builtin/codex/supervisor.js +11 -1
  21. package/dist/agent-runtime/builtin/codex/supervisor.js.map +1 -1
  22. package/dist/agent-runtime/completion-body.js +14 -9
  23. package/dist/agent-runtime/completion-body.js.map +1 -1
  24. package/dist/channel/feishu/bot.js +0 -18
  25. package/dist/channel/feishu/bot.js.map +1 -1
  26. package/dist/channel/feishu/feishu-message.js +9 -2
  27. package/dist/channel/feishu/feishu-message.js.map +1 -1
  28. package/dist/cli/doctor.js +23 -0
  29. package/dist/cli/doctor.js.map +1 -1
  30. package/dist/cli/dreamux.js +1 -1
  31. package/dist/cli/dreamux.js.map +1 -1
  32. package/dist/cli/server-ctl.js +2 -2
  33. package/dist/cli/server.js +9 -4
  34. package/dist/cli/server.js.map +1 -1
  35. package/dist/daemon/restart-intent.js +7 -2
  36. package/dist/daemon/restart-intent.js.map +1 -1
  37. package/dist/dispatcher-service/dispatcher/base-prompt.js +4 -4
  38. package/dist/dispatcher-service/dispatcher/base-prompt.js.map +1 -1
  39. package/dist/dispatcher-service/dispatcher/service.js +7 -10
  40. package/dist/dispatcher-service/dispatcher/service.js.map +1 -1
  41. package/dist/dispatcher-service/dispatcher-workspace.js +108 -0
  42. package/dist/dispatcher-service/dispatcher-workspace.js.map +1 -0
  43. package/dist/dispatcher-service/service.js +5 -12
  44. package/dist/dispatcher-service/service.js.map +1 -1
  45. package/dist/dispatcher-service/team/service.js +214 -65
  46. package/dist/dispatcher-service/team/service.js.map +1 -1
  47. package/dist/dispatcher-service/team/store.js +6 -0
  48. package/dist/dispatcher-service/team/store.js.map +1 -1
  49. package/dist/dispatcher-service/team/types.js.map +1 -1
  50. package/dist/dispatcher-service/teammate/identity-store.js +11 -77
  51. package/dist/dispatcher-service/teammate/identity-store.js.map +1 -1
  52. package/dist/dispatcher-service/teammate/name-allocator.js +86 -0
  53. package/dist/dispatcher-service/teammate/name-allocator.js.map +1 -0
  54. package/dist/dispatcher-service/teammate/runtime-state.js +26 -8
  55. package/dist/dispatcher-service/teammate/runtime-state.js.map +1 -1
  56. package/dist/dispatcher-service/teammate/service.js +365 -113
  57. package/dist/dispatcher-service/teammate/service.js.map +1 -1
  58. package/dist/dispatcher-service/teammate/session-ledger.js +306 -0
  59. package/dist/dispatcher-service/teammate/session-ledger.js.map +1 -0
  60. package/dist/dispatcher-service/teammate/types.js +14 -0
  61. package/dist/dispatcher-service/teammate/types.js.map +1 -1
  62. package/dist/dispatcher-service/teammate/worktree-manager.js +74 -4
  63. package/dist/dispatcher-service/teammate/worktree-manager.js.map +1 -1
  64. package/dist/dispatcher-service/teammate/worktree-paths.js +53 -0
  65. package/dist/dispatcher-service/teammate/worktree-paths.js.map +1 -0
  66. package/dist/mcp/team-mcp.js +86 -75
  67. package/dist/mcp/team-mcp.js.map +1 -1
  68. package/dist/mcp/teammate-mcp.js +32 -25
  69. package/dist/mcp/teammate-mcp.js.map +1 -1
  70. package/dist/onboard/run.js +3 -3
  71. package/dist/onboard/run.js.map +1 -1
  72. package/dist/onboard/uninstall.js +7 -1
  73. package/dist/onboard/uninstall.js.map +1 -1
  74. package/dist/platform/logs.js +32 -0
  75. package/dist/platform/logs.js.map +1 -0
  76. package/dist/platform/owner-only-dir.js +37 -0
  77. package/dist/platform/owner-only-dir.js.map +1 -0
  78. package/dist/platform/paths.js +130 -33
  79. package/dist/platform/paths.js.map +1 -1
  80. package/dist/platform/runtime-sockets.js +127 -0
  81. package/dist/platform/runtime-sockets.js.map +1 -0
  82. package/dist/server.js +47 -1
  83. package/dist/server.js.map +1 -1
  84. package/package.json +1 -1
  85. package/skills/dispatcher/SKILL.md +62 -38
  86. package/skills/dispatcher/references/dispatch-task.md +3 -3
  87. package/skills/dispatcher/references/inspect-and-resume.md +5 -3
  88. package/skills/dreamux-maintenance/SKILL.md +21 -0
package/dist/server.js CHANGED
@@ -12,9 +12,10 @@ import { BUILT_IN_DEFAULTS, } from './config/config.js';
12
12
  import { DispatcherStore, } from './state/dispatcher-store.js';
13
13
  import { adminSocketPath, setRuntimeConfig, } from './platform/paths.js';
14
14
  import { createLogger, } from './platform/logger.js';
15
- import { createAdminSocketServer } from './admin/socket.js';
15
+ import { assertNoLegacyAdminServer, createAdminSocketServer, } from './admin/socket.js';
16
16
  import { RestartIntentConsumer } from './daemon/restart-intent.js';
17
17
  import { DispatcherService } from './dispatcher-service/service.js';
18
+ import { ensureDispatcherWorkspace } from './dispatcher-service/dispatcher-workspace.js';
18
19
  export { IN_PROGRESS_REACTION_EMOJI, RECEIVED_REACTION_EMOJI, } from './channel/feishu/feishu-channel.js';
19
20
  export class Server {
20
21
  repos;
@@ -85,9 +86,32 @@ export class Server {
85
86
  now: Date.now(),
86
87
  warn: (message) => this.log.warn(message),
87
88
  }));
89
+ // Dispatcher workspace cwd contract (issue #182 PR-4): every enabled
90
+ // dispatcher must declare an explicit, usable `cwd` — there is no fallback
91
+ // to a Dreamux state dir. Pre-flight all of them before taking the admin
92
+ // lock or launching anything, and fail the whole start loud (aggregated) so
93
+ // a misconfigured deployment never comes up half-broken.
94
+ await this.assertDispatcherWorkspaces();
95
+ // Before taking the new run/ admin lock, fail loud if an OLD-version
96
+ // server still holds the pre-#182 state/ admin lock — the two locks are at
97
+ // different paths and would not otherwise see each other (issue #182 P1).
98
+ if (this.opts.legacyAdminLockPath != null) {
99
+ await assertNoLegacyAdminServer({
100
+ legacyLockPath: this.opts.legacyAdminLockPath,
101
+ });
102
+ }
88
103
  this.admin = createAdminSocketServer(this, this.opts.adminSocketPath ?? adminSocketPath());
89
104
  await this.admin.start();
90
105
  this.log.info({ admin_socket: this.admin.socketPath }, 'admin socket listening');
106
+ if (this.opts.runtimeSocketSweep !== undefined) {
107
+ try {
108
+ const swept = await this.opts.runtimeSocketSweep();
109
+ this.log.info({ dirs: swept }, 'swept volatile runtime-socket dirs');
110
+ }
111
+ catch (err) {
112
+ this.log.warn({ err: errInfo(err) }, 'runtime-socket sweep failed; continuing startup');
113
+ }
114
+ }
91
115
  const rows = this.repos.dispatchers.listEnabled();
92
116
  for (const row of rows) {
93
117
  try {
@@ -98,6 +122,28 @@ export class Server {
98
122
  }
99
123
  }
100
124
  }
125
+ /**
126
+ * Validate the workspace cwd of every enabled dispatcher (issue #182 PR-4).
127
+ * Aggregates all failures into one loud error so the operator sees every
128
+ * misconfigured dispatcher at once, rather than fixing them one boot at a
129
+ * time. A throw here aborts `start()` before any socket or dispatcher.
130
+ */
131
+ async assertDispatcherWorkspaces() {
132
+ const config = this.opts.config ?? BUILT_IN_DEFAULTS;
133
+ const failures = [];
134
+ for (const row of this.repos.dispatchers.listEnabled()) {
135
+ try {
136
+ await ensureDispatcherWorkspace(config, row.dispatcher_id);
137
+ }
138
+ catch (err) {
139
+ failures.push(err instanceof Error ? err.message : String(err));
140
+ }
141
+ }
142
+ if (failures.length > 0) {
143
+ throw new Error(`dreamux serve cannot start — dispatcher workspace cwd contract failed:\n` +
144
+ failures.map((message) => ` - ${message}`).join('\n'));
145
+ }
146
+ }
101
147
  summarize() {
102
148
  return this.dispatcherService.summarize();
103
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,wCAAwC,GAEzC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,GAEhB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,GAEb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAA0B,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,oCAAoC,CAAC;AAsD5C,MAAM,OAAO,MAAM;IACR,KAAK,CAAQ;IACb,iBAAiB,CAAoB;IACtC,KAAK,GAA6B,IAAI,CAAC;IACvC,YAAY,GAAG,KAAK,CAAC;IACZ,IAAI,CAAgB;IACpB,GAAG,CAAgB;IACnB,gBAAgB,CAAmB;IACnC,qBAAqB,CAA8B;IAEpE,YAAY,OAAsB,EAAE;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,gBAAgB;YACnB,IAAI,CAAC,gBAAgB,IAAI,6BAA6B,EAAE,CAAC;QAC3D,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AC,QAAQ,CAAC,CAAC,MAAM,KAAK,KAAK,CACnE,CAAC;IACF,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO;IACrC,MAAM,IAAI,KAAK,CACb,eAAe,UAAU,CAAC,EAAE,wCAAwC;QAClE,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB;QACrE,gEAAgE,CACnE,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,GAAY;IAC3B,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,GAAG,CAAC,KAAK,KAAK,SAAS;YAC5B,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE;YAC5C,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excitedjs/dreamux",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Codex-host server — single-session MVP. One node process hosts N dispatchers, each binding 1 Feishu bot + 1 Codex thread.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dispatcher
3
- description: Use from a Dreamux dispatcher thread when bounded repository work should be delegated to a TeamMate. The server-hosted TeamMate MCP is the default interface; spawn creates a named semi-resident TeamMate, send submits follow-up turns and reopens a closed TeamMate from its checkpoint, close stops one, history lists session ledger rows, history_events reads a raw timeline, and list/status/last/ctx/get_capabilities inspect state. The tm CLI is the explicit fallback for legacy diagnostics. Applies to spawning, tracking, retrieving, sending, closing, inspecting, reopening, recovering, or summarizing teammate work.
3
+ description: Use from a Dreamux dispatcher thread when bounded repository work should be delegated to a TeamMate. The server-hosted TeamMate MCP is the default interface; spawn creates a semi-resident TeamMate and RETURNS its concrete name (use that name for every later call), send submits follow-up turns and reopens a closed TeamMate from its checkpoint, close stops one, history searches the durable session ledger, and list/status/last/get_capabilities inspect state. The tm CLI is the explicit fallback for legacy diagnostics. Applies to spawning, tracking, retrieving, sending, closing, inspecting, reopening, recovering, or summarizing teammate work.
4
4
  ---
5
5
 
6
6
  # Dispatcher
@@ -25,51 +25,74 @@ session or polling a process.
25
25
 
26
26
  **Lifecycle.**
27
27
 
28
- - `spawn` — create a named TeamMate and submit the first turn. Use a stable name
29
- for work you may resume later. When selecting a runtime, pass one of
30
- `get_capabilities.agent_runtimes[].id` as `agent_runtime`; do not pass
31
- provider refs such as `builtin:*`.
32
- - `send` submit a turn to a TeamMate. If the named TeamMate is not live —
28
+ - `spawn` — create a TeamMate and submit the first turn. The `name` you pass is
29
+ a requested label / base slug, **not** the final address: the service
30
+ allocates a concrete, never-reused name and returns it as `teammate.name`.
31
+ **Use that returned concrete name for every later `send`/`status`/`last`/
32
+ `close`.** Your requested label is preserved as `display_name` for display.
33
+ `intent` is **required**: a short recovery subject for the session ledger
34
+ (what this TeamMate is for). When selecting a runtime, pass one of
35
+ `get_capabilities.agent_runtimes[].id` as `agent_runtime`; do not pass provider
36
+ refs such as `builtin:*`.
37
+ - `send` — submit a turn to a TeamMate by its concrete name. If it is not live —
33
38
  including one previously `close`d — send first reopens it from its persisted
34
39
  checkpoint, then submits. There is no separate `resume` verb; send covers
35
- reattach.
36
- - `close` — stop the named TeamMate and mark it closed. It stays reopenable: a
37
- later `send` revives it from its checkpoint.
40
+ reattach. Pass `intent` (optional) to update the recorded recovery subject
41
+ when the work shifts.
42
+ - `close` stop the TeamMate (by concrete name) and mark it closed. `note` is
43
+ **required**: why you are stopping a recoverable session. It stays reopenable:
44
+ a later `send` revives it from its checkpoint.
38
45
 
39
46
  **Watch and collect — no polling.**
40
47
 
41
- - `list` — this dispatcher's TeamMates and their statuses.
42
- - `status` — one TeamMate status, agent runtime id, checkpoint, and close metadata.
43
- - `history` — bounded session ledger rows for this dispatcher, with filters for
44
- recovery across TeamMates.
45
- - `history_events` — raw forward-only event history for one named TeamMate.
46
- - `last` the runtime's latest assistant-visible result when supported.
47
- - `ctx` — the runtime context snapshot when supported.
48
+ - `list` — this dispatcher's TeamMates: concrete name, display name, status, and
49
+ repo/cwd/session essentials.
50
+ - `status` — one TeamMate's current state by concrete name: display name, agent
51
+ runtime id, session, cwd/repo, checkpoint, and close metadata.
52
+ - `history` — the durable session-ledger search surface for this dispatcher,
53
+ with recovery filters across TeamMates (name/state/repo/grep/cursor).
54
+ - `last` — a TeamMate's most recent settled turn(s), read from the durable
55
+ session ledger by concrete name. It accepts `turns` (1..5, default 1; newest
56
+ last) and returns the final assistant output as completely as it was durably
57
+ captured (with a truncation flag). It does **not** start or resume a runtime,
58
+ so it works for a closed or stopped TeamMate — this is your fallback when a
59
+ completion was never delivered.
48
60
 
49
61
  These serve status / history / last directly, so you do not need `tm` to check
50
62
  on a running TeamMate. Do not wait or poll for completion: submit the turn, let
51
- the dispatcher turn end, then recover through `history`, `last`, and `ctx`.
63
+ the dispatcher turn end, then recover through `history` and `last`. (The former
64
+ `ctx` and `history_events` verbs were removed; use `last` and `history`.)
52
65
 
53
66
  **Team lifecycle.**
54
67
 
55
68
  Dreamux also injects a dispatcher-scoped `team` MCP server for Team Mode
56
- lifecycle. Use it to create a TeamLeader, inspect Team status/ledger, and
57
- dissolve a Team. Team work still runs through agents; do not inspect the target
58
- repo directly from the dispatcher.
59
-
60
- - `create` — create a Team and TeamLeader. Requires `repo_cwd` and
61
- `leader_agent_runtime`; no default leader runtime is inferred.
62
- - `create_group` from a P2P control channel, create a Team, create a Feishu
63
- group, invite the requester/peers when Feishu permissions allow it, and bind
64
- the new group to the TeamLeader. The source P2P remains with the dispatcher.
65
- - `list`, `status`, `ledger` read dispatcher-owned Team records and lifecycle
66
- ledger rows.
67
- - `bind_channel` bind a Feishu group chat to a TeamLeader. P2P binding is
68
- rejected.
69
- - `transfer_channel_back` — return a bound Feishu group chat to the dispatcher.
70
- - `dissolve` close the TeamLeader and team-owned members, then conservatively
71
- clean up the shared managed worktree. Active channel bindings are transferred
72
- back first.
69
+ lifecycle. It is addressed by **Team name** (the same value you create with),
70
+ mirroring the TeamMate read-surface model. Team work still runs through agents;
71
+ do not inspect the target repo directly from the dispatcher.
72
+
73
+ - `create` — create a Team and TeamLeader. Requires `repo_cwd`,
74
+ `leader_agent_runtime`, and `intent` (the Team's recovery subject); no default
75
+ leader runtime is inferred. Optionally pass `bind_group: { chat_id }` to bind
76
+ an EXISTING Feishu group chat to the new Team at create time. (The former
77
+ `create_group` tool create a brand-new Feishu group and invite users was
78
+ retired; bind an existing group instead.)
79
+ - `list` — compact scan rows for current Teams (name, status, intent, repo
80
+ signal, leader name/state, member count, bound group marker, timestamps). Keep
81
+ it cheap and scannable; reach for `status` for detail.
82
+ - `status` — one Team's detailed current state by name: the Team record, the
83
+ TeamLeader status/session, member count, and the active bound group.
84
+ - `history` the durable Team recovery search (closed Teams included): filter by
85
+ `name`, `status`, `close_status`, `repo`, `intent` text (`grep`), and time
86
+ range (`since`/`until`), with `limit`/`cursor`. This is the recovery interface;
87
+ the raw per-Team lifecycle event timeline stays internal.
88
+ - `bind_group` — bind an existing Feishu group chat to a Team by name and
89
+ `chat_id` (group chats only; no `chat_type`).
90
+ - `transfer_channel_back` — return a bound Feishu group chat (`chat_id`) to the
91
+ dispatcher.
92
+ - `dissolve` — close the TeamLeader and team-owned members by Team name, then
93
+ conservatively clean up the shared managed worktree. `note` is **required**:
94
+ why the Team is being dissolved. Active channel bindings are transferred back
95
+ first.
73
96
 
74
97
  **Control and inspect.**
75
98
 
@@ -161,7 +184,7 @@ on a flag -- do not infer one verb's flags from another.
161
184
 
162
185
  These references cover the `tm` fallback path. For ordinary delegation —
163
186
  spawning a TeamMate, sending follow-up turns (which also reopens a closed one
164
- from its checkpoint), checking status, or reading history/last/context — use the
187
+ from its checkpoint), checking status, or reading history/last — use the
165
188
  `teammate` MCP tools above and you do not need a reference.
166
189
  Read the matching reference when you have dropped to `tm`:
167
190
 
@@ -195,9 +218,10 @@ turn's tool calls.
195
218
  Two state owners, kept distinct:
196
219
 
197
220
  - The Dreamux server owns the TeamMate **agent state** behind the `teammate`
198
- MCP — named identities, runtime checkpoints, status, history, last result,
199
- and context snapshots. Read and control it with `list`, `status`, `history`,
200
- `last`, `ctx`, `send`, and `close`.
221
+ MCP — concrete identities (with their display labels), runtime checkpoints,
222
+ status, and the durable session ledger (prompts and captured assistant
223
+ output). Read and control it with `list`, `status`, `history`, `last`,
224
+ `send`, and `close`.
201
225
  - `tm` owns live tm **session** state — teammate liveness, worktrees, and
202
226
  resumable session history (see `references/inspect-and-resume.md`).
203
227
 
@@ -1,9 +1,9 @@
1
1
  # Dispatch A Task
2
2
 
3
3
  > This is the `tm` fallback path. Default to the `teammate` MCP —
4
- > `spawn` / `send` / `close` (send also reopens a closed TeamMate), then
5
- > inspect with `history` / `last` / `ctx` (see the dispatcher skill; do not
6
- > poll). Use the
4
+ > `spawn` (which returns the concrete name to use thereafter) / `send` / `close`
5
+ > (send also reopens a closed TeamMate), then inspect with `history` / `last`
6
+ > (see the dispatcher skill; do not poll). Use the
7
7
  > `tm spawn` / `tm send` flow below only when you need an isolated managed
8
8
  > worktree or legacy tm diagnostics.
9
9
 
@@ -1,9 +1,11 @@
1
1
  # Inspect And Resume
2
2
 
3
3
  > Default to the `teammate` MCP for inspection: `list`, `status`, `history`,
4
- > `last`, and `ctx` cover server-owned TeamMate state without `tm`; do not poll.
5
- > This `tm` fallback owns what the MCP does not: legacy tm sessions, worktrees,
6
- > and tm history.
4
+ > and `last` cover server-owned TeamMate state without `tm`; do not poll. `last`
5
+ > reads the most recent settled turn(s) (turns 1..5) from the durable session
6
+ > ledger by the concrete name `spawn` returned, even for a closed TeamMate. This
7
+ > `tm` fallback owns what the MCP does not: legacy tm sessions, worktrees, and tm
8
+ > history.
7
9
 
8
10
  ## Trigger
9
11
 
@@ -71,6 +71,27 @@ dreamux config show
71
71
  | Skill path is a real file or directory | Dreamux leaves it untouched. If this is an intentional override, keep it; otherwise rename or remove it and restart the dispatcher. |
72
72
  | Skill symlink is broken after an upgrade | Restart the dispatcher or rerun `dreamux onboard`; startup recreates stale or broken bundled skill symlinks. |
73
73
 
74
+ ## Log Maintenance
75
+
76
+ Dreamux does not auto-prune logs (no automatic retention in 0.x). Pruning is a
77
+ deliberate operator action:
78
+
79
+ - A **7-day retention** is acceptable; delete logs older than that when disk
80
+ matters. Logs hold only diagnostics, never durable state.
81
+ - **Zero-byte log files are always safe to delete.** Empty runtime child
82
+ stdout/stderr logs are now removed automatically when the child shuts down
83
+ cleanly, so they no longer accumulate one-per-start; what remains under
84
+ `~/.dreamux/logs/` are files that actually captured startup/crash output.
85
+ - The whole `~/.dreamux/logs/` tree is rebuildable: it is safe to clear while no
86
+ `dreamux serve` is running; it is recreated on the next start.
87
+
88
+ Prune manually, e.g. (run only while the server is stopped):
89
+
90
+ ```bash
91
+ find ~/.dreamux/logs -type f -mtime +7 -delete # drop logs older than 7 days
92
+ find ~/.dreamux/logs -type f -empty -delete # drop any leftover empties
93
+ ```
94
+
74
95
  ## Turn Mechanics
75
96
 
76
97
  For questions about active turns, steering, background commands, and repeated