cofluxd 0.15.0 → 1.1.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: coflux
3
- description: When you run inside a coflux terminal, this skill documents the local cofluxd commands that open terminals the user can watch and take over from the coflux web/mobile app, report progress, call the user and hand out preview URLs, plus the center MCP for reaching other workspaces and devices. Your coordinates (device / project / workspace / terminal) arrive in a <coflux-session> block at session start, or via the COFLUX_* environment variables. For the workspace your cwd is in always use the zero-credential local cofluxd commands (open, read, wait, send, report progress, call the user, get preview URLs); use the center's coflux MCP only to reach beyond it (child workspaces, other workspaces or devices). Use when the user should be able to watch, step into or stop a command (interactive steps, dev servers, a job they are waiting on), when the user has to decide something, when you want to hand the user a clickable preview URL, or when you need an isolated child workspace for parallel work.
3
+ description: Use coflux to open visible terminals, read, wait, type, report progress, notify the user and obtain preview URLs. Prefer zero-credential local commands in the current workspace; use the account CLI across workspaces and devices. Coordinates arrive through coflux-session or COFLUX_* variables.
4
4
  ---
5
5
 
6
6
  # Working inside coflux
@@ -10,19 +10,32 @@ machines from a browser or a phone and take over at any time. This skill gives y
10
10
  user can see and take over, a progress line and a call button on the workspace card, preview URLs,
11
11
  and a way to operate the other workspaces and devices under the account when you need to.
12
12
 
13
- Two tracks, one rule: **whatever closes locally uses local commands; only reaching beyond the
14
- workspace you are in goes through MCP.**
13
+ **Use local commands in this workspace and account CLI commands across workspaces and devices.**
15
14
 
16
15
  | Track | Credentials | Reach | Use for |
17
16
  |---|---|---|---|
18
- | Local commands `cofluxd terminal/progress/notify/ports` | none (the daemon identifies you by process tree) | **the workspace your cwd is in** | open, read, wait, send, report progress, call the user, preview URLs: the default, fastest, no network dependency |
19
- | Center MCP `coflux` | one OAuth authorization by the user in the host | **the whole account**: every device, project, workspace and terminal | child workspaces (git worktrees), cross-workspace / cross-device access, joining from outside coflux |
17
+ | Local commands `coflux terminal/progress/notify/ports` | none (the daemon identifies you by process tree) | **the workspace your cwd is in** | open, read, wait, send, report progress, call the user, preview URLs: the default, fastest, no network dependency |
18
+ | Account CLI | app login or `coflux login` | all devices and workspaces in the account | child workspaces and remote terminals; JSON output |
20
19
 
21
20
  Of the local commands, `send`/`read`/`wait`/`notify`/`progress` complete entirely inside the
22
21
  local daemon and never touch the center; `new`/`list`/`ports` are relayed to the center by the
23
22
  daemon on your behalf (terminals must appear in the user's sidebar, preview URLs are minted by
24
23
  the center). You only ever talk to the local daemon.
25
24
 
25
+ ## Managed terminal integration
26
+
27
+ Coflux terminals automatically load this capability for Claude Code and Codex. Use
28
+ `coflux agent status` to inspect this terminal's integration acknowledgements; an
29
+ unconfirmed run has not successfully executed its context hook. It does not prove
30
+ that approval is pending. Codex asks for native hook review when needed; use `/hooks`
31
+ to review it. Do not edit trust hashes or the user's global configuration.
32
+
33
+ Each agent keeps its own immutable CLI and skill files. Relaunching the agent selects
34
+ the installed device version, including from an already-open supported shell. Use
35
+ `COFLUX_AGENT_INTEGRATION=off claude` or `COFLUX_AGENT_INTEGRATION=off codex` to bypass
36
+ managed integration for one invocation. Use `coflux agent run <claude|codex> -- ...`
37
+ when a custom shell alias takes precedence over automatic integration.
38
+
26
39
  ## Figure out where you are first
27
40
 
28
41
  With the coflux plugin installed, Claude Code and Codex receive a `<coflux-session>` block at
@@ -36,22 +49,19 @@ env | grep '^COFLUX_'
36
49
 
37
50
  - **`COFLUX_WORKSPACE_ID` is non-empty** (or the `<coflux-session>` block is present) → you are in
38
51
  a coflux terminal with an up-to-date daemon. The variables below are your coordinates; pass
39
- these ids to MCP tools directly instead of guessing from `list_*`:
52
+ these ids to account CLI commands directly instead of guessing from `list_*`:
40
53
 
41
54
  | Variable | Meaning |
42
55
  |---|---|
43
56
  | `COFLUX_DEVICE_ID` | id of the device you run on (the id in `list_devices`) |
44
57
  | `COFLUX_PROJECT_ID` | owning project id; empty string for a directory workspace without a repository |
45
- | `COFLUX_WORKSPACE_ID` | the workspace this terminal was **opened** in (the id in `list_workspaces`). The variable is frozen when the terminal starts; the workspace the terminal *belongs to* can still change — see below. `cofluxd workspace` is the authority |
58
+ | `COFLUX_WORKSPACE_ID` | the workspace this terminal was **opened** in (the id in `list_workspaces`). The variable is frozen when the terminal starts; the workspace the terminal *belongs to* can still change — see below. `coflux workspace` is the authority |
46
59
  | `COFLUX_TASK_ID` | id of this terminal (the taskId / terminalId used by local commands and `read_terminal`) |
47
60
  | `COFLUX_SESSION_ID` | id of this PTY session |
48
- | `COFLUX_MCP_URL` | the center's MCP URL; the user configures MCP with it |
49
61
 
50
- - **Variables empty or absent** → treat yourself as outside coflux: forget this skill and use your
51
- own tools as usual (if the user configured the coflux MCP in the host, the MCP tools still work;
52
- you just have no "where am I" coordinates). If the user insists you are inside a coflux terminal,
53
- this machine's daemon has not been upgraded: tell the user to run `cofluxd update && cofluxd restart`;
54
- after reopening the terminal the variables and the local commands are there.
62
+ - **Variables empty or absent**: there is no local terminal context. Use `coflux whoami` to check
63
+ account access and the account CLI to discover workspaces. Ask the user to log in when needed;
64
+ never fabricate COFLUX_* coordinates.
55
65
 
56
66
  ### Two workspaces to keep apart: owning and effective
57
67
 
@@ -66,11 +76,11 @@ conversation, no restart — and a coflux child workspace is a normal registered
66
76
  session whose terminal belongs to workspace A can end up working inside workspace B. From that
67
77
  moment, in B:
68
78
 
69
- - `cofluxd terminal new` opens the terminal **in B**, under B in the user's sidebar, running in B's
79
+ - `coflux terminal new` opens the terminal **in B**, under B in the user's sidebar, running in B's
70
80
  directory, counting against B's terminal cap;
71
- - `cofluxd terminal list` lists B's terminals, and A's terminals answer `read` / `wait` / `send`
81
+ - `coflux terminal list` lists B's terminals, and A's terminals answer `read` / `wait` / `send`
72
82
  with "not in this workspace or does not exist" (`cd` back to A to reach them again);
73
- - MCP calls need **B's** id as `workspaceId`;
83
+ - Account CLI calls need **B's** id as `workspaceId`;
74
84
  - the terminal itself stays under A, and `progress`, `notify` and `ports` still belong to it,
75
85
  whatever your cwd is; `COFLUX_TASK_ID` and `COFLUX_SESSION_ID` never change.
76
86
 
@@ -93,8 +103,8 @@ lives. When Claude Code cleans up its own worktree on exit, that workspace's ter
93
103
  the project's main workspace and the record disappears by itself.
94
104
 
95
105
  So, after entering or leaving a worktree, owning **and** effective are both the new workspace: pass
96
- its id to MCP tools and everything local already acts on it. The plugin drops the new id next to the
97
- tool result, and `cofluxd workspace` always tells you. Two things stay behind on purpose:
106
+ its id to account CLI commands and everything local already acts on it. The plugin drops the new id next to the
107
+ tool result, and `coflux workspace` always tells you. Two things stay behind on purpose:
98
108
 
99
109
  - `COFLUX_WORKSPACE_ID` (and the id in the `<coflux-session>` block from earlier in this session)
100
110
  still names where the terminal was *opened*; it is frozen when the PTY starts and cannot be
@@ -109,15 +119,15 @@ a daemon that is down or too old — the session just carries on with the owners
109
119
  ### Ask where you are
110
120
 
111
121
  ```sh
112
- cofluxd workspace
122
+ coflux workspace
113
123
  {"workspaceId":"ws-b","path":"/Users/me/.coflux/worktrees/ws-b","owningWorkspaceId":"ws-a","moved":true}
114
124
  ```
115
125
 
116
126
  One line of JSON: `workspaceId` (+ `path`) is the **effective** workspace, `owningWorkspaceId` is the
117
127
  workspace this terminal belongs to right now, and `moved` says whether they differ. With the plugin
118
128
  installed you also get a `<coflux-session-moved>` block at the start of every prompt while the two
119
- differ — but that block only arrives with the **next** user prompt. **About to call an MCP tool right
120
- after a `cd`? Run `cofluxd workspace` first** and use the `workspaceId` it prints; do not reuse
129
+ differ — but that block only arrives with the **next** user prompt. **About to call an account command right
130
+ after a `cd`? Run `coflux workspace` first** and use the `workspaceId` it prints; do not reuse
121
131
  `COFLUX_WORKSPACE_ID`.
122
132
 
123
133
  ## When to open a terminal
@@ -143,8 +153,8 @@ own tools are faster, and a pile of one-second terminals is just noise to the us
143
153
  There are two kinds, told apart by one single thing: **whether you pass a command**.
144
154
 
145
155
  ```sh
146
- cofluxd terminal new --title="Run unit tests" --cmd="pnpm -C tests test" # job terminal
147
- cofluxd terminal new --title="Debug shell" # session terminal
156
+ coflux terminal new --title="Run unit tests" --cmd="pnpm -C tests test" # job terminal
157
+ coflux terminal new --title="Debug shell" # session terminal
148
158
  ```
149
159
 
150
160
  `--title` is the name the user sees in the sidebar; **name it properly**: "Run unit tests",
@@ -173,14 +183,14 @@ from what is on screen, and `wait` is only meaningful after you have sent `exit`
173
183
 
174
184
  Driving a session terminal:
175
185
 
176
- 1. `cofluxd terminal new --title="Debug shell"` → prints a taskId.
177
- 2. `cofluxd terminal read <taskId>` until you see the shell prompt. The shell needs a moment to
186
+ 1. `coflux terminal new --title="Debug shell"` → prints a taskId.
187
+ 2. `coflux terminal read <taskId>` until you see the shell prompt. The shell needs a moment to
178
188
  start and the first read can come back empty — **never `send` before you have seen a prompt**.
179
- 3. `cofluxd terminal send <taskId> --text="pnpm build" --enter`, then `read` again to see what
189
+ 3. `coflux terminal send <taskId> --text="pnpm build" --enter`, then `read` again to see what
180
190
  happened. One send per command; nothing signals you when a command finished, so read until the
181
191
  prompt is back. To make that unambiguous, end the command with a marker of your own
182
192
  (`pnpm build; echo DONE-$?`) and read until the marker shows up.
183
- 4. `cofluxd terminal send <taskId> --text="exit" --enter` when you are done; the terminal then
193
+ 4. `coflux terminal send <taskId> --text="exit" --enter` when you are done; the terminal then
184
194
  becomes `exited` with the shell's exit code.
185
195
 
186
196
  The new terminal has the same `COFLUX_*` variables (pointing at its own task/session ids, same
@@ -189,9 +199,9 @@ workspace as you).
189
199
  ### See how far it got
190
200
 
191
201
  ```sh
192
- cofluxd terminal list # every terminal in the workspace your cwd is in: id, state, exit code, title
193
- cofluxd terminal read <taskId> # a terminal's content (plain text, last 200 lines by default)
194
- cofluxd terminal read <taskId> --lines 50
202
+ coflux terminal list # every terminal in the workspace your cwd is in: id, state, exit code, title
203
+ coflux terminal read <taskId> # a terminal's content (plain text, last 200 lines by default)
204
+ coflux terminal read <taskId> --lines 50
195
205
  ```
196
206
 
197
207
  `list` states are `running` / `exited` / `idle`; `exited` carries `exit=<code>`.
@@ -203,8 +213,8 @@ history, and empty for the first moments after opening. Both are immediate.
203
213
  ### Wait for a command to finish
204
214
 
205
215
  ```sh
206
- cofluxd terminal wait <taskId> # block until that terminal exits and print the exit code (default cap 30 minutes)
207
- cofluxd terminal wait <taskId> --timeout 300 # custom timeout in seconds; a timeout fails loudly with a non-zero exit
216
+ coflux terminal wait <taskId> # block until that terminal exits and print the exit code (default cap 30 minutes)
217
+ coflux terminal wait <taskId> --timeout 300 # custom timeout in seconds; a timeout fails loudly with a non-zero exit
208
218
  ```
209
219
 
210
220
  To wait for a command use `wait`; **do not write your own polling loop**. One command blocks
@@ -223,10 +233,10 @@ not any command's: check what a command did by reading the screen.
223
233
  **Keep working, and be woken up when it finishes.** `wait` blocks, so run it as a backgrounded Bash
224
234
  call of your own:
225
235
 
226
- 1. `cofluxd terminal new --title="Run the test suite" --cmd="pnpm -C tests test"` → prints a taskId.
227
- 2. Run `cofluxd terminal wait <taskId>` as a backgrounded Bash call, then go do something else.
236
+ 1. `coflux terminal new --title="Run the test suite" --cmd="pnpm -C tests test"` → prints a taskId.
237
+ 2. Run `coflux terminal wait <taskId>` as a backgrounded Bash call, then go do something else.
228
238
  3. The host wakes you when that call exits. Check its output for `# exited exit=<code>`, then
229
- `cofluxd terminal read <taskId>` to see what actually happened.
239
+ `coflux terminal read <taskId>` to see what actually happened.
230
240
 
231
241
  That gets you both halves at once: the user watches (and can take over) a real terminal, and you are
232
242
  still told the moment it is over, instead of blocking or polling for it.
@@ -234,8 +244,8 @@ still told the moment it is over, instead of blocking or polling for it.
234
244
  ### Type into a terminal
235
245
 
236
246
  ```sh
237
- cofluxd terminal send <taskId> --text "y" --enter # type a line and press Enter
238
- cofluxd terminal send <taskId> --enter # just press Enter
247
+ coflux terminal send <taskId> --text "y" --enter # type a line and press Enter
248
+ coflux terminal send <taskId> --enter # just press Enter
239
249
  ```
240
250
 
241
251
  For interactive confirmations (y/N, menus), or to add a command in the same shell after the
@@ -252,7 +262,7 @@ previous one finished. Discipline:
252
262
  ### Report progress
253
263
 
254
264
  ```sh
255
- cofluxd progress "Reproduced; narrowing down the relay reconnect timing"
265
+ coflux progress "Reproduced; narrowing down the relay reconnect timing"
256
266
  ```
257
267
 
258
268
  One sentence telling the user how far you are, shown on the workspace card and replaced by the
@@ -267,7 +277,7 @@ If unsure: when the user does not have to do anything, use `progress`.
267
277
  ### Call the user
268
278
 
269
279
  ```sh
270
- cofluxd notify "Both approaches work; I need you to pick one"
280
+ coflux notify "Both approaches work; I need you to pick one"
271
281
  ```
272
282
 
273
283
  The user's sidebar switches this workspace to "waiting for interaction" and shows this sentence;
@@ -281,7 +291,7 @@ extra notify. This is for "what you have to say cannot be guessed from the statu
281
291
  ### Hand the user a clickable preview
282
292
 
283
293
  ```sh
284
- cofluxd ports
294
+ coflux ports
285
295
  ```
286
296
 
287
297
  Lists every listening port in this workspace with its public preview URL. After starting a dev
@@ -292,79 +302,55 @@ server, use it to get the URL and tell the user directly; they click it and nobo
292
302
  Errors are one readable sentence; do what they say: "not inside a coflux terminal" = you are not
293
303
  in a coflux session; "terminal is not in this workspace or does not exist" = check the id with
294
304
  `list`, and if you moved into another workspace that is exactly what a terminal of the other one
295
- looks like (`cofluxd workspace` to confirm, `cd` back to reach it); "predates the daemon upgrade" =
305
+ looks like (`coflux workspace` to confirm, `cd` back to reach it); "predates the daemon upgrade" =
296
306
  that terminal was opened before the daemon upgrade, open a new one; a `new` without `--cmd` refused for a missing command = this machine's daemon is older
297
307
  than session terminals, tell the user to run `cofluxd update && cofluxd restart` (or pass a command
298
308
  and use a job terminal); "daemon is not connected to the center" only appears on
299
309
  `new`/`list`/`ports`, retry once it reconnects.
300
310
 
301
- ## Center MCP: leaving this workspace
302
-
303
- Local commands only see the workspace your cwd is in. Use the MCP server named `coflux` in the
304
- host **only** for these:
305
-
306
- - **Open an isolated child workspace to work in parallel**: `create_workspace` (project id from
307
- `$COFLUX_PROJECT_ID`) really runs `git worktree add` on the device; then `create_terminal` runs
308
- commands there. The same two kinds apply: `create_terminal` with a `command` opens a
309
- job terminal, without one it opens a session terminal.
310
- - **Look at or operate terminals in other workspaces or on other devices**: `list_*` →
311
- `read_terminal` / `send_terminal_input`.
312
- - **Join everything under the account when you are not inside a coflux terminal** (for example
313
- Claude Code the user started on their own machine).
314
- - **Deleting a workspace**: `remove_workspace` (it closes that workspace's terminals first, then
315
- removes the worktree and the record). Inside a coflux project the plugin blocks
316
- `git worktree remove|move` run by hand, because that leaves an orphan workspace record in the user's
317
- sidebar. Creating a worktree is *not* blocked — coflux follows you into it (see above) — and Claude
318
- Code's own worktrees need no cleanup from you at all.
311
+ ## Account CLI: across workspaces and devices
319
312
 
320
- Do not detour through MCP for work inside the workspace you are in — including one you moved into
321
- with `cd` or EnterWorktree, where the local commands follow you: that is an extra round trip to the
322
- center, while a local command does it in one step.
323
-
324
- ### When MCP is not configured
325
-
326
- Run `claude mcp list` (Codex: `codex mcp list`) to see whether `coflux` is there. If not, give
327
- the user the one-line setup, with the URL from `$COFLUX_MCP_URL` (it is the center's public URL
328
- + `/mcp`):
313
+ The bundled CLI can use the desktop app's login without receiving its token. For a standalone CLI,
314
+ use `coflux login --username <account> --password-stdin`; the user supplies the password safely,
315
+ never as a command argument. Account commands return JSON. A workspace ID identifies its device.
329
316
 
330
317
  ```sh
331
- claude mcp add --transport http coflux "$COFLUX_MCP_URL" # Claude Code
332
- codex mcp add coflux --url "$COFLUX_MCP_URL" # Codex
318
+ coflux device list
319
+ coflux project list --device <deviceId>
320
+ coflux workspace list --device <deviceId>
321
+ coflux workspace new --project <projectId> --branch <branch>
322
+ coflux terminal new --workspace <workspaceId> --title <title> [--cmd <command>]
323
+ coflux terminal list --workspace <workspaceId>
324
+ coflux terminal read <terminalId> --remote
325
+ coflux terminal send <terminalId> --remote --text <text> [--enter]
326
+ coflux terminal wait <terminalId> --remote --timeout 30
327
+ coflux terminal stop <terminalId> --remote
328
+ coflux terminal remove <terminalId> --remote
329
+ coflux workspace rename <workspaceId> --name <name>
330
+ coflux workspace remove <workspaceId>
331
+ coflux ports --remote --device <deviceId>
333
332
  ```
334
333
 
335
- The host then guides the user through a one-time OAuth authorization in the browser (`/mcp` in
336
- Claude Code). Authorization is the user's job; you only hand over the URL and the command. Until
337
- it is set up, keep doing the work inside this workspace with local commands.
338
-
339
- ### Using the tools
340
-
341
- The tool list and each tool's contract (parameters, limits, what an error means) come from the
342
- MCP server itself: read the tool descriptions in the host, they are the source of truth and this
343
- file does not repeat them. Take ids from the `COFLUX_*` variables first — except the workspace id
344
- after you moved, which comes from `cofluxd workspace` (or the `<coflux-session-moved>` block); for
345
- anything outside the workspace you are in, find ids with the `list_*` tools.
346
-
347
- The local-command disciplines apply to MCP just the same: `read_terminal` before
348
- `send_terminal_input`, stop when refused because the user is taking over (communicate with
349
- `cofluxd notify` instead of retrying), `wait_terminal` instead of a polling loop around
350
- `read_terminal`, and stop on "needs upgrade" (tell the user to run
351
- `cofluxd update && cofluxd restart` on that device; do not retry or work around it).
334
+ `--remote` selects account access, including other workspaces on this machine. Read before sending;
335
+ stop immediately when the user takes over. If a write times out, inspect the result before retrying.
336
+ Exiting the CLI does not stop its terminals. Delete workspaces through `coflux workspace remove`
337
+ so the filesystem and workspace records stay consistent.
352
338
 
353
339
  ## Boundaries
354
340
 
355
341
  - You can open, read, wait and type, but **typing is a restricted write with humans first**: you
356
342
  cannot write into a terminal the user is taking over (you are refused explicitly), and the user
357
343
  taking over at any time displaces you. Do not fight a human for a terminal.
358
- - Local commands only see **the workspace your cwd is in** (`cofluxd workspace` says which one);
359
- other workspaces and other machines go through MCP and are limited to the same account.
344
+ - Local commands only see **the workspace your cwd is in** (`coflux workspace` says which one);
345
+ use the account CLI for other workspaces and machines in the same account.
360
346
  - A workspace has a cap on concurrently live terminals (default 8, including the user's own).
361
347
  On hitting the cap, `list` first: usually some finished terminals were never collected. If the
362
348
  user really filled it up, `notify` them instead of forcing it.
363
- - `new`/`list`/`ports` and every MCP tool need the daemon connected to the center; "letting the
349
+ - `new`/`list`/`ports` and account commands need the daemon connected to the center; "letting the
364
350
  user see" is their whole point. `send`/`read`/`wait`/`notify`/`progress` do not depend on the
365
351
  center. When disconnected they fail loudly rather than degrade silently.
366
352
  - `COFLUX_*` variables exist only in PTYs opened by coflux; exporting or changing them yourself
367
353
  has no effect, the center only trusts the ids it issued. `COFLUX_WORKSPACE_ID` always means the
368
354
  workspace this terminal was **opened** in and goes stale the moment coflux follows you into a
369
355
  worktree; both "where does this terminal belong now" and "where am I acting" come from
370
- `cofluxd workspace`.
356
+ `coflux workspace`.