@dibssoftware/dibs 0.0.0-stage → 0.0.179

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 (75) hide show
  1. package/CHANGELOG.md +594 -0
  2. package/LICENSE +670 -0
  3. package/README.md +85 -2
  4. package/bin/dibs-guard.mjs +7 -0
  5. package/bin/dibs.mjs +548 -0
  6. package/docs/benchmarks.md +193 -0
  7. package/docs/files.md +30 -0
  8. package/docs/guard.md +91 -0
  9. package/docs/later.md +43 -0
  10. package/docs/machines.md +147 -0
  11. package/docs/questions.md +78 -0
  12. package/docs/reference.md +157 -0
  13. package/docs/relay.md +196 -0
  14. package/docs/releasing.md +27 -0
  15. package/docs/scheduling.md +163 -0
  16. package/docs/simulators.md +17 -0
  17. package/package.json +45 -4
  18. package/skills/dibs/SKILL.md +183 -0
  19. package/src/acquire.mjs +700 -0
  20. package/src/admin.mjs +145 -0
  21. package/src/agents.mjs +145 -0
  22. package/src/alerts.mjs +499 -0
  23. package/src/answers.mjs +65 -0
  24. package/src/board.mjs +202 -0
  25. package/src/broker.mjs +369 -0
  26. package/src/commands.mjs +810 -0
  27. package/src/config.mjs +324 -0
  28. package/src/connect.mjs +106 -0
  29. package/src/cool.mjs +160 -0
  30. package/src/diskwarn.mjs +154 -0
  31. package/src/events.mjs +96 -0
  32. package/src/files.mjs +1123 -0
  33. package/src/guard.mjs +613 -0
  34. package/src/history.mjs +247 -0
  35. package/src/hogs.mjs +227 -0
  36. package/src/later.mjs +487 -0
  37. package/src/measure.mjs +262 -0
  38. package/src/news.mjs +101 -0
  39. package/src/nodecheck.mjs +17 -0
  40. package/src/notes.mjs +171 -0
  41. package/src/notices.mjs +160 -0
  42. package/src/ondemand.mjs +572 -0
  43. package/src/overlap.mjs +151 -0
  44. package/src/override.mjs +360 -0
  45. package/src/owner.mjs +30 -0
  46. package/src/plain.mjs +470 -0
  47. package/src/platform.mjs +357 -0
  48. package/src/preempt.mjs +438 -0
  49. package/src/primer.mjs +89 -0
  50. package/src/proc.mjs +99 -0
  51. package/src/progress.mjs +187 -0
  52. package/src/qr.mjs +204 -0
  53. package/src/questions.mjs +389 -0
  54. package/src/quota.mjs +81 -0
  55. package/src/reads.mjs +54 -0
  56. package/src/relay.mjs +779 -0
  57. package/src/remote.mjs +584 -0
  58. package/src/reset.mjs +127 -0
  59. package/src/schedule.mjs +1020 -0
  60. package/src/scratch.mjs +61 -0
  61. package/src/serve.mjs +742 -0
  62. package/src/service.mjs +221 -0
  63. package/src/shard.mjs +59 -0
  64. package/src/simctl.mjs +42 -0
  65. package/src/simpool.mjs +258 -0
  66. package/src/state.mjs +201 -0
  67. package/src/stats.mjs +328 -0
  68. package/src/style.mjs +44 -0
  69. package/src/talk.mjs +702 -0
  70. package/src/thin.sh +130 -0
  71. package/src/trust.mjs +152 -0
  72. package/src/util.mjs +184 -0
  73. package/src/version.mjs +2 -0
  74. package/src/web.mjs +1119 -0
  75. package/src/worker.mjs +318 -0
@@ -0,0 +1,78 @@
1
+ # Questions for the person
2
+
3
+ With five or ten agents running, the person who runs them is the scarcest thing on the machine. Each agent that stops to ask "ship it?" or "which name?" interrupts them, and an agent that stops dead waits until they notice. dibs queues those questions like any other resource: the agent asks, keeps working on whatever doesn't depend on the answer, and the person answers when they get to it, in order.
4
+
5
+ ```bash
6
+ dibs question "Ship build 123 to TestFlight now?" --options yes,no --recommend yes -m "tests pass, notes written" \
7
+ --one-way "testers get it at once; it can't be pulled back" --wait # blocks; prints only the answer
8
+ dibs question "Use port 5173 for the dev server?" --options yes,no --recommend yes -m "nothing else listens there"
9
+ # a two-way door: prints "yes" at once, logged, shown to the person as done
10
+ dibs questions # open first, by priority then age (--json for scripts and the Mac app)
11
+ dibs answer 4 yes # the person answers with an option...
12
+ dibs answer 4 "wait until Monday" # ...or in their own words
13
+ dibs questions dismiss 5 # or waves it off
14
+ ```
15
+
16
+ The board's first line says `3 questions for you: dibs questions` while any are open, and `dibs --json` has a `questions` count. `dibs questions --json` has an `open` count for a badge.
17
+
18
+ ## For agents: one-way doors only
19
+
20
+ The person's standing rule: walk through two-way doors (anything you can undo) and show them after. Bring them one-way doors (anything that can't be undone) and taste calls only, one at a time, with your recommendation. dibs holds you to it:
21
+
22
+ - Every question needs `--recommend <option>` and `-m "why"`. With `--options`, the recommendation must be one of them.
23
+ - **Without `--one-way`**, nobody is asked. dibs prints your recommendation on stdout at once (exit 0, `--wait` or not), logs `decided by <you>: two-way door` in `dibs history`, and shows it in the person's threads as done. They message you if they want it otherwise.
24
+ - **With `--one-way "what can't be undone"`**, it's queued for the person, who sees the question, your recommendation and why, and what can't be undone.
25
+ - dibs refuses (exit 2, nothing recorded) a question that isn't a short sentence of at least three words (a bare "2"), one without a recommendation or a reason, and options that repeat.
26
+
27
+ 1. Ask without `--wait`. It prints the id and returns. Carry on with the work that doesn't need the answer.
28
+ 2. When you reach the step that does, run the same command again with `--wait`. It prints the answer on stdout, and only the answer, so `answer=$(dibs question ... --wait)` works.
29
+ 3. Exit 75 means no answer: the person dismissed it, or your wait's `--timeout` (a duration: `30s`, `1m`, `2h`) passed. Nothing was decided. Don't take silence as a yes; carry on without that step and say so in your report. A question you asked in step 1 stays open for the person after a wait gives up: run the same command with `--wait` again later to collect it. One asked only with `--wait` stays open 2 minutes after its wait gives up, so the same command picks it back up.
30
+
31
+ - The person may answer in their own words instead of an option. Those words are the answer (on stdout with `--wait`), and they also reach you through the hook as `Message from the person: (answering your question #N) ...`.
32
+ - `-p urgent|high|normal|low|idle` places it like a job in line: urgent goes 2 hours ahead, high 1 hour, low 10 minutes back. Use urgent only when something is broken or the person is waiting on you right now.
33
+ - Asking the same text again from the same session is the same question, not a new one (a two-way one gives the same decision), until it's answered and read, dismissed or expired. After that the same text is a new question with a new id.
34
+ - Inside a Claude Code tool call, `--wait` has no time limit, as with `dibs run`: if the call reaches its timeout, Claude Code moves it to the background and tells you when the answer comes.
35
+ - A question belongs to whoever asked. Asked with `--wait` only, that's the waiting dibs: if it's killed, the question expires. Asked without it, it's your agent session: its questions expire when the session ends, or at the `--timeout` you gave when you asked, never at a later wait's.
36
+
37
+ An agent may answer another agent's question with `dibs answer <id> <text>` when it knows the answer: the asker sees `answered by <agent>, an agent, not the person` on stderr, beside the bare answer on stdout, and the history names who answered.
38
+
39
+ ## The person's threads, and the desk
40
+
41
+ `dibs threads` holds what's for the person: one-way questions, and agents' `dibs say` notes, marked FYI. dibs's own notices to an agent about its jobs (bookings, stuck-job advice, "pass --mem 7G") go only to that agent through the hook, never into the person's threads.
42
+
43
+ Set `"desk": "<agent name>"` in `~/.dibs/config.json` to give the person one agent to talk to. `dibs tell desk "..."` (and the Mac app's chat) reaches that agent through the hook, and it answers with `dibs say --to person "..."`. `dibs threads --json` names it (`desk`), marks its thread `desk: true`, and its answers `reply: true`.
44
+
45
+ ## For the person: hours
46
+
47
+ ```bash
48
+ dibs hours 09:00-23:00 # dibs hours off clears them; dibs hours [--json] shows them
49
+ ```
50
+
51
+ (or `"hours": { "start": "09:00", "end": "23:00" }` in `~/.dibs/config.json`) keeps questions below urgent out of your way at night. They stay in the list, marked "for tomorrow", and the board doesn't count them until `start`. An end before the start runs past midnight. Agents asking off hours are told their question waits for the morning unless it's urgent.
52
+
53
+ `dibs answer`, `dibs questions dismiss` and `dibs hours` work for the person and for agents alike; `dibs history` names who did each.
54
+
55
+ Closed questions stay in `dibs questions --json` for 7 days (at most 200), in `~/.dibs/questions.json`.
56
+
57
+ ## Threads: notes and messages both ways
58
+
59
+ Questions are one half of a conversation. Each agent also has a thread, keyed by its session (and, for a subagent, its agent id), that holds its questions and your answers, the notes it leaves you, and the messages you send it.
60
+
61
+ ```bash
62
+ dibs say "migration done, tests pass" # an agent: a note to the person, no answer expected (--as <label> for a subagent)
63
+ dibs threads # the person: every thread, newest first, with unread counts
64
+ dibs threads read web-app # the conversation; marks its notes and questions read
65
+ dibs tell web-app "use the staging database" # the person: a message for that agent
66
+ dibs tell web-app/Explore "check the tests" # a subagent's thread is <session name>/<label>
67
+ ```
68
+
69
+ How a message reaches the agent, with `dibs guard install` (or the plugin):
70
+
71
+ - On the agent's next Bash, edit or Agent tool call, the hook adds it next to the call as `additionalContext` ("Message from the person: ..."). The call itself goes through unchanged, through the normal permission checks. If the guard turns that call away (a heavy command outside dibs, a file another agent leased), the message waits for the next one.
72
+ - If the agent is ending its turn instead, the Stop hook (SubagentStop for a subagent) answers with the message as `additionalContext`, so it keeps going and reads it as hook feedback (a `decision: "block"` would read as a hook error). Each message is handed over once, and a stop that's already a stop hook's continuation (`stop_hook_active`) never gets another, so this can't loop.
73
+ - An agent that's idle, waiting for its person to type, gets it on its next tool call. A session that has ended keeps the message queued, shown as not delivered, in case it's resumed.
74
+ - Without the guard, the agent gets queued messages the next time it runs `dibs say`.
75
+
76
+ dibs leaves notices of its own in an agent's thread, as lines from dibs: a job of the agent's that has used no CPU for 20 minutes while others wait for it, one that used far more memory than it asked for (with the `--mem` to pass next time), and one paused for low disk or memory (it resumes by itself). Each is said once and handed over the same way as your messages, beside the next tool call, with "dibs has a notice about your jobs". A notice never keeps an agent from stopping, and one nobody picked up expires after an hour. Outside Claude Code, notices arrive on stderr with the agent's next dibs command.
77
+
78
+ Plain `dibs` counts unread notes with the questions: `2 questions and 1 note are waiting for you: dibs threads` (`dibs --detail`: `2 questions and 1 note for you: dibs threads`), and `dibs --json` has a `notes` count. Agents may run `dibs tell` and `dibs threads read` too, as they may `dibs answer`: a message from an agent reaches its reader marked as another agent's, never the person's. Threads keep 7 days and at most 200 lines each, in `~/.dibs/messages.json`.
@@ -0,0 +1,157 @@
1
+ # dibs reference
2
+
3
+ Everything the [README](../README.md) leaves out: the rules to paste into your agents' instructions, every command, who may change what, the page and MCP in full, exit codes and settings. `dibs help all` prints the commands too, and `dibs ask "..."` answers from this file and the rest of docs/.
4
+
5
+ ## Tell your agents
6
+
7
+ The install does this for you: it writes `dibs.md` beside dibs and a note pointing at it into `~/.claude/CLAUDE.md` (`dibs init` again by hand). The Claude Code plugin ships the same text as a skill. To paste it yourself into a `CLAUDE.md` or `AGENTS.md`, these are the rules every agent gets first; the rest is reference in the skill:
8
+
9
+ <!-- dibs:rules:start -->
10
+ ```markdown
11
+ ## dibs
12
+ dibs runs on this machine. Agents take turns through it on the simulator, Xcode builds, test suites, browser runs and deploys.
13
+ - Wrap those: `dibs run <resource> -m "why" -- <command>` (resources: sim, sim-own, xcode-build, test, playwright, deploy, heavy). Two at once: `dibs run sim,xcode-build -- ...`.
14
+ - No dibs for reads, edits, small commands, or long jobs that mostly wait on the network and use little CPU, memory or disk (crawlers, pollers, HTTP checks). The hook leaves those alone too.
15
+ - Start `dibs listen` with run_in_background now, and again each time it exits: it wakes you when the person or dibs has something for you.
16
+ - Waiting is normal. A call moved to the background is still waiting: don't run it again. A wait on memory, swap or disk protects the machine: keep waiting, and never lower `--mem` or raise `-p` to get past it.
17
+ - Exit 75: it gave up waiting and your command never ran; run the same command again. Exit 74: not enough free disk; free your own build output, or tell the person.
18
+ - Decide what you can undo yourself. Ask the person only before something you can't undo (`dibs question ... --one-way`). Lines starting "Message from the person:" are theirs: act on them.
19
+ - Post progress as you work: `dibs progress "what you did or found" --task <name> --eta 30m`, then `--done`.
20
+ - The rest (holding across tool calls, file leases, other machines, every exit code, overriding jobs, questions) is in the dibs skill and in `dibs help`.
21
+ ```
22
+ <!-- dibs:rules:end -->
23
+
24
+ ## Commands
25
+
26
+ ```bash
27
+ dibs run sim,xcode-build -- ./build-and-install.sh # everything you need, at once
28
+ dibs run playwright --port WEB --port API -- npx playwright test # free ports in $WEB and $API
29
+ dibs run test -p high -m "release blocker" --by 23:30 -- npm test
30
+ dibs run test --after #42 -- npm run e2e # joins the line once your job #42 has ended
31
+ dibs hold sim --for 20m -m "screenshot pass" # across several tool calls; again to extend
32
+ dibs release sim
33
+ dibs hold 'files:src/auth/**' -m "auth refactor" # other agents' edits there are turned away
34
+ dibs run quota:asc --cost 3 -- ./upload.sh # share an API's rate limit between scripts
35
+ dibs when sim # when you'd get it, without joining the line
36
+ dibs who sim # who holds it, until when, who's next
37
+ dibs why # where you are, when you start, what you're waiting for (--detail: the math)
38
+ dibs mine sim # exit 0 if you hold it, 1 if not
39
+ dibs yield web-app # let another agent go first
40
+ dibs pace quiet # how hard dibs drives this machine: quiet, normal or max
41
+ dibs sims # the private simulator pool
42
+ dibs setup scratch # the admin commands for a capped scratch volume for build output (macOS)
43
+ dibs changes # what changed in recent versions
44
+ dibs question "Ship 123 now?" --options yes,no --recommend yes -m "tests pass" --one-way "testers get it at once" --wait # only one-way doors reach the person
45
+ dibs questions # what agents are asking you, with what they recommend; dibs answer <id> <option, or your own words>
46
+ dibs hours 09:00-23:00 # outside your hours, questions below urgent wait for the morning
47
+ dibs threads # one thread per agent: its notes and questions, your messages; dibs threads read <agent>
48
+ dibs tell web-app "use the staging database" # reaches the agent on its next tool call, or as it finishes its turn
49
+ dibs tell desk "why is my build waiting?" # the agent config.json names as "desk" answers you with dibs say --to person
50
+ dibs alerts # what's wrong and the one fix for each: long waits, memory holding work back (and what to close), stuck jobs, failed or lost jobs, dibs itself, a full disk
51
+ dibs alerts dismiss <id> # close one for a day; it comes back if its cause is still there
52
+ dibs listen # an agent waits for a message (run_in_background); exit 3 after 60m with none
53
+ dibs history # the last 7 days: busy time, waits and who waited, by resource, agent and hour
54
+ dibs stats # waits against run times, today and the last 7 days: the share of jobs that waited longer than they ran
55
+ dibs stats --me # your own: jobs, run and wait time, failures by exit code, what held you back, top commands, ETAs met (--agent <name>, --since 30d, --json)
56
+ dibs later sim --at 02:00 -m "snapshot suite" -- ./snapshots.sh # run it tonight; returns at once with its id
57
+ dibs later test --after web-app:deploy -- npm run smoke # when that agent's deploy ends (--after-ok: only if it passed)
58
+ dibs later list # scheduled, waiting, running, and how the finished ones ended; dibs later cancel <id>
59
+ ```
60
+
61
+ `dibs listen` also wakes an agent when dibs on this machine is updated (with what changed) or when a newer release is out, which it learns by asking dibs.cc at most every 6 hours per machine (never from a git checkout). `"updateCheck": false` in `~/.dibs/config.json` turns that ask off.
62
+
63
+ Anyone can override any job, the person or an agent. An agent acting on a job that isn't its own names the owner with `--owner <session>` (or `session/agent`), as the board shows it, or nothing changes (exit 2, with the owner, its `-m` and the command to rerun); the person never needs it. Every answer starts with whose job it was: `boosting #10167: alex-c8 deploy 'shop-api first deploy'`. `dibs boost <id> high -m "why"` (the `#` on `dibs --detail`), `dibs pause <id>` and `dibs resume <id>`, `dibs stop <id>` (kills the job; its agent is told who stopped it), and `dibs cap <agent> low` (that agent never waits or runs above low until `dibs cap <agent> off`). The same goes for `answer`, `questions dismiss`, `hours`, `pace <word>`, `tell`, `threads read`, `join`, `invite`, `pair --machine`, `kick`, `limit`, `service install`/`remove`, `guard install`/`remove` and `serve --force`: nothing is the person's alone.
64
+
65
+ Every one of them is logged with who ran it: `dibs history --json` has an `override` event with `by` (the agent's session name, or `the person`). The board says it too: `[boosted by web-app: release blocked]`, `[paused by web-app]`, `capped: pushy at low (by web-app)`. A message an agent sends with `dibs tell` arrives as `Message from web-app (another agent, not the person)`, and an agent that answers a question is named to the one that asked. An agent raising a job to high or urgent passes `-m`, so everyone sees why. The machine's own limits (memory, swap, disk, and never pausing every job) hold for everyone.
66
+
67
+ A waiting `dibs run` or `dibs hold` is a shell blocked on a FIFO (about 1.5 MB, no CPU), and one broker process decides for every waiter on the machine: it starts when someone waits and exits after a quiet minute. Before 0.0.102 each waiter was a Node process of its own, 35 to 65 MB polling the state every 1.5 seconds, which with dozens waiting came to gigabytes and kept the state lock busy most of the time. To go back to that, in `~/.dibs/config.json` (or `DIBS_THIN=0` for one caller):
68
+
69
+ ```json
70
+ { "waits": "fat" }
71
+ ```
72
+
73
+ Nothing changes in how agents call dibs, what it prints, or its exit codes. Jobs other machines send here and `dibs later` jobs wait thin too. `--after` still waits in Node (it waits outside the line until the other job ends), as does a run sent with `--anywhere` or `--on`, whose sender follows it over the network while it waits on the other machine. Anything that goes wrong with a thin wait (a broker that died, got stuck or couldn't start, a wait that fell back to Node, a crash) leaves an event of kind `thin` in `~/.dibs/events.jsonl`: `grep '"kind":"thin"' ~/.dibs/events.jsonl`.
74
+
75
+ ## Watching your agents: the page and MCP
76
+
77
+ ```bash
78
+ dibs service install web # or: dibs web (http://127.0.0.1:7421)
79
+ dibs pair # a one-time code, e.g. K7QM-4XNA: one use, 10 minutes
80
+ ```
81
+
82
+ Open http://127.0.0.1:7421 and type the code. The rail on the left switches between views:
83
+
84
+ - **Now**: alerts first: anything wrong, why, and the one fix, until it resolves (then when it did). Then every agent's running and waiting jobs on a timeline that spans only the time something is in, file locks, tasks with their ETAs, and every `dibs progress` post, live. Click a job to make it go first, give it back its normal place, let others go first, pause, resume or stop it (stop asks twice). Pick an agent to hold all its jobs back (`dibs cap`).
85
+ - **Questions**: what agents asked you at one-way doors. Answer with an option or your own words, or say not now.
86
+ - **Messages**: one thread per agent. What you send reaches the agent with its next tool call.
87
+ - **Stats**: run and wait time by agent and by resource, how often jobs waited longer than they ran, failures by exit code, what held jobs back, top commands, ETAs met, a daily trend, a day-by-hour heatmap, and the machine's load, memory and disk over time. Agents get the same numbers from `dibs stats --me`.
88
+ - **Scheduled**: `dibs later` runs coming up and ended this week; cancel one.
89
+ - **History**: `dibs history` for the past day, week or 30 days, and every override with who made it.
90
+ - **Settings**: the speed (`dibs pace`), your hours, and the Claude Code hook.
91
+
92
+ Every change on the page runs the same CLI command you would, as you, so `dibs history` and the board name you, and the CLI's own rules apply. Changes need the page's sign-in; nothing else can make them.
93
+
94
+ The same server is an MCP server at `http://127.0.0.1:7421/mcp`, so your own Claude can answer "what are my agents doing?". Add it to Claude Code with `claude mcp add --transport http dibs http://127.0.0.1:7421/mcp`; the client opens a sign-in page in your browser, and you type a code from `dibs pair`. With a plain `dibs pair` code it gets read-only tools: `board`, `agents`, `agent`, `progress`, `stats`, `questions`, `history`, `resource`, `machines` and `messages`. A code from `dibs pair --allow-actions` adds tools that act: post progress, answer questions, message agents and you, hold and release, and boost, pause, resume and stop jobs. It acts as an agent named after the client (`mcp-<name>`), never as you, so agents treat its messages as a peer's. A model reads text agents wrote, and text can steer a model, so give actions only to a client you'd trust with them. A code from `dibs pair --allow-commands` also lets a client signed in here (never through mcp.dibs.cc) queue commands to run on this Mac with `queue_run`, the way `dibs later` does. `dibs pair --list` shows what's signed in and `dibs pair --revoke <id|all>` signs it out.
95
+
96
+ It answers only on 127.0.0.1 unless you pass `--bind <address>` (your Tailscale address, say), and only to requests that name that address, so a web page can't reach it by DNS rebinding. Codes and tokens are stored hashed in `~/.dibs/web.json`. After 10 wrong codes in 10 minutes every try is refused until the window passes; open codes stay good. To let claude.ai or another Claude account read your board, `dibs relay mcp on` serves it at `https://mcp.dibs.cc/mcp` through the relay (docs/relay.md).
97
+
98
+ ## Mac app
99
+
100
+ `app/` builds a Mac app (macOS 26) over the same commands: the live board with boost, pause, stop and cap buttons, agents' questions to answer, the week's history, and the pace, in a window and the menu bar. It runs the `dibs` on your PATH and reads nothing else. A signed, notarized download is at https://dibs.cc/mac. To build it yourself you need Xcode 26 and xcodegen (`brew install xcodegen`): [app/README.md](../app/README.md) has the steps.
101
+
102
+ Priority is `-p urgent|high|normal|low|idle`. `urgent` and `high` need `-m` and everyone sees them. `low` and `idle` run at background priority, and may be paused while urgent work borrows their slot. `--est 5m` tells dibs how long a new job takes, so short jobs can move up. A command that runs in under 15 seconds goes in the quick lane: wrap it with `--quick` (or `--est 10s`) and it starts at once, past the line and full slots, at most 2 at a time (on the simulator, or a deploy of the same repo, at the front of the line instead); dibs learns it after that, and takes the pass away from a run that goes over. `--by 23:30` moves you up as a deadline gets close.
103
+
104
+ Agents show up by their Claude Code session name. Anywhere else, dibs names them after the folder they run in; set `DIBS_AGENT=name` to pick your own.
105
+
106
+ ## Exit codes
107
+
108
+ Agents branch on these, so they don't change.
109
+
110
+ | code | meaning |
111
+ |---|---|
112
+ | the command's own | it ran |
113
+ | 75 | dibs stopped waiting in line. The command never started and did not fail. Run the same command again within 2 minutes to keep your place. For `dibs question --wait`: no answer (timed out or dismissed), nothing was decided |
114
+ | 74 | not enough free disk, and nothing running would free it. Other sessions' `/private/tmp/claude-*` folders are off limits for making room |
115
+ | 76 | lost the coordinator or the other machine before a remote job started. Nothing ran there: sending it again is safe |
116
+ | 77 | lost the other machine after a remote job started. It may have run, or may still be running: check before running it again |
117
+ | 127 | the command didn't start |
118
+ | 2 | bad usage, a job asking more memory or cores than the machine ever hands out (it says the most it can ask), a resource name close to a real one (`simulator` for `sim`), an agent's high or urgent boost without `-m`, `--on` on a machine that isn't in a group, or a `dibs run` you already have waiting or running (wait for that one) |
119
+ | 3 | `dibs listen` heard nothing in its time (`--for`, 60m by default). Run it again to keep listening |
120
+ | 1 | nothing matched: `mine` with nothing held (the clean result after a release), `release` with nothing to give back |
121
+ | 70 | dibs itself crashed: a bug in dibs, not your command. Report it with `dibs ask "..."`. If your command already ran, you get its code instead |
122
+
123
+ Inside Claude Code, `dibs run` waits as long as it takes: when the tool call hits its timeout, Claude Code moves it to the background and tells the agent when it ends. Everywhere else (Codex, scripts, a terminal) dibs gives up after 8 minutes with exit 75, which fits a 10-minute tool call. `--wait` lifts the limit, `--max-wait 20m` sets your own.
124
+
125
+ ## Resources
126
+
127
+ | name | slots | memory | cores | free disk | pausable |
128
+ |---|---|---|---|---|---|
129
+ | sim | 1 | 3G | 1 | 8G | no |
130
+ | sim-own | 4 on 16 GB (RAM / 4G, at most 4), and only as many as free memory fits | 3G | 2 | 6G | no |
131
+ | xcode-build | 2 | 4G | 4 | 4G | no |
132
+ | playwright | 2 | 3G | 2 | 3G | yes |
133
+ | test | 3 | 2G | 3 | | yes |
134
+ | deploy | 1 per project (its repo's origin, or the folder outside git), up to 3 projects at once (`exclusiveBy: "repo"`, `across: 3`) | 0.5G | 1 | | no |
135
+ | heavy | 1 | 4G | 4 | 10G | yes |
136
+ | any other name | 1 | 1G | 1 | | no |
137
+ | `files:<path or glob>` | one holder per path | 0 | 0 | | no |
138
+ | `quota:<name>` | a token bucket from config | 0 | 0 | | no |
139
+
140
+ A name close to a real one (`simulator`, `tests`, `xcode`) is refused with exit 2 and the right name, since two agents slipping differently would both get the real thing at once. A name of your own that looks like none of them starts a queue of its own.
141
+
142
+ Running jobs share a budget of 8 GB and 6 cores while the machine is busy, so light jobs run side by side and heavy ones take turns. The cores count what running jobs are measured using, not what they asked for. dibs measures what each job really uses, failed and killed runs included, and plans the next run of the same command at that, when it's more than asked (a command it hasn't measured yet goes by the same program on the same resource, so a new Playwright spec starts at what the others used); `--mem` and `--cpu` say what you need up front. Override any of it in `~/.dibs/config.json`; you only need the keys you change. State lives in `~/.dibs`. A resource you make up can have a name people read on the board: `"resources": { "gpu": { "slots": 1, "label": "The GPU" } }` (a quota takes `"label"` too).
143
+
144
+ ## The rest of docs/
145
+
146
+ - [docs/scheduling.md](scheduling.md): how a turn is decided, what a lease guarantees, nested runs, measuring what jobs use, rate-limit quotas, pausing low-priority work, `dibs pace`, running jobs side by side, resetting a resource after each use, throttling
147
+ - [docs/files.md](files.md): file leases, and which edits the guard turns away
148
+ - [docs/questions.md](questions.md): agents queuing questions for the person, `--wait`, working hours
149
+ - [app/README.md](../app/README.md): the Mac app
150
+ - [docs/later.md](later.md): runs scheduled for a time or after something else ends
151
+ - [docs/relay.md](relay.md): the page from a phone or any browser, end to end encrypted, and dibs accounts
152
+ - [docs/simulators.md](simulators.md): `sim-own`, the pool of private simulators
153
+ - [docs/guard.md](guard.md): the hook, what it matches, the subagent limit, installing it for Claude Code and Codex, your own rules
154
+ - [docs/machines.md](machines.md): sending jobs to other machines, adding one (`dibs pair --machine` on the coordinator, `dibs join <code>` on the new machine), tokens, and keeping a project's code on the machines you name
155
+ - [AGENTS.md](../AGENTS.md): working on dibs itself
156
+
157
+ Platforms: macOS is what dibs is tested on. Linux uses the same code paths (`ps`, process groups, `/proc/pressure/memory`) but hasn't had a full test run yet. Windows support exists and is untested.
package/docs/relay.md ADDED
@@ -0,0 +1,196 @@
1
+ # dibs from anywhere: the encrypted relay
2
+
3
+ `dibs pair --remote` pairs a phone or any browser with this Mac. The browser then opens https://app.dibs.cc and sees the same page `dibs web` serves at 127.0.0.1:7421, carried end to end encrypted through a relay that only forwards opaque frames. The relay (a Cloudflare Worker, `relay/` in this repo) never holds a key, a pairing secret or a byte of the board.
4
+
5
+ Turn it on:
6
+
7
+ ```bash
8
+ dibs service install relay # keeps the outbound connection up, with backoff; off until you do this
9
+ dibs pair --remote # prints a one-time link and a QR code; open it on the phone. That browser can only look
10
+ dibs pair --remote --allow-actions # the same, and that browser may also boost, pause, resume and stop jobs, cap an agent, set the pace and cancel scheduled runs
11
+ dibs pair --list # local sign-ins and remote devices
12
+ dibs pair --revoke <id|all> # a revoked device's open session ends within 25 seconds
13
+ dibs service status relay # connected or not, since when, how many devices
14
+ ```
15
+
16
+ ## Keys
17
+
18
+ | key | where | what it does |
19
+ |---|---|---|
20
+ | Mac identity, Ed25519 | `~/.dibs/relay-keys.json` (0600), never sent | signs every pairing answer and session handshake; browsers pin its fingerprint |
21
+ | Mac relay key, Ed25519 | same file | proves to the relay that this Mac owns its machine id; opens no session, decrypts nothing |
22
+ | device key, Ed25519 | the browser's IndexedDB, made with `extractable: false` | signs the device's half of each handshake; page script can use it but never read it |
23
+ | session keys, AES-256-GCM | memory only, per connection | one per direction, from a fresh X25519 exchange |
24
+
25
+ Machine id `mid` = first 16 bytes of SHA-256("dibs-mid-v1\0" ‖ relay public key), base64url (22 characters). Fingerprint `fp` = SHA-256("dibs-fp-v1\0" ‖ identity public key), base64url (43 characters).
26
+
27
+ ## Encoding
28
+
29
+ `tx(label, f1, f2, ...)` is every item as a 4-byte big-endian length followed by its bytes, so two different transcripts never encode the same. All binary fields travel as base64url and are checked for exact length. Messages between the page and the Mac are binary WebSocket messages: `0x01` followed by UTF-8 JSON for handshake messages, `0x02` followed by an encrypted frame.
30
+
31
+ ## Pairing
32
+
33
+ `dibs pair --remote` makes a 32-byte random `secret` and prints
34
+
35
+ ```
36
+ https://app.dibs.cc/#p=<mid>.<secret>.<fp>
37
+ ```
38
+
39
+ The fragment never goes in a request, and the page removes it from the address bar (`history.replaceState`) before any other code runs. The Mac keeps only what's derived from the secret, for ten minutes: `pid` = HKDF(secret, info "dibs-relay-v1 pair id", 16 bytes), the HMAC key `kp` (info "... pair key"), the name key `kn` (info "... pair name"), and the hash of the pairing ticket `pt` (info "... pair ticket", 32 bytes), which it registers with the relay. The page sends `pt` to the relay to get into the pairing pool; the relay can't derive anything else from it.
40
+
41
+ 1. **pair1**, browser to Mac: `{t, pid, d, nb, name, sig, mac}`. `d` is the new device public key, `nb` 32 random bytes, `name` is the device's name ("Safari on iPhone") padded to 64 bytes, followed by the device's 32-byte random relay token `rt`, sealed together with AES-GCM under `kn` (random nonce), so the relay learns neither the name, its length, nor the token. `T1 = tx("dibs-pair1-v1", mid, pid, d, nb, name)`, `sig = Sign_d(T1)`, `mac = HMAC(kp, T1 ‖ sig)`.
42
+ The Mac finds the pending link by `pid` (gone or expired: `pair-expired`), checks `mac` in constant time (three failures burn the link), checks `sig`, decrypts the name, and only then, under one lock, deletes the link and stores the device `{pub: d, name, rth, created}` under a random 16-byte id `did`, where `rth` is the first 16 bytes of SHA-256("dibs-relay-token-v1\0" ‖ rt). It sends the relay the new list of token hashes, then `{t: "admit", ch, h: rth}` for the pairing tab.
43
+ 2. **pair2**, Mac to browser: `{t, m, nm, did, sig, mac}`. `m` is the Mac's identity key, `nm` 32 random bytes. `T2 = tx("dibs-pair2-v1", mid, pid, d, nb, name, m, nm, did)`, `sig = Sign_M(T2)`, `mac = HMAC(kp, T2 ‖ sig)`.
44
+ The browser requires `fingerprint(m) == fp` from the link, then the HMAC, then the signature, and only then stores `{mid, m, fp, did, device key pair}`.
45
+
46
+ So pairing needs the secret (256 bits, one use, ten minutes; there's nothing to brute force), and a relay that swaps either key is caught: the device key by the HMAC and the device's own signature, the Mac's key by the fingerprint and the HMAC.
47
+
48
+ ## A session
49
+
50
+ Every connection, including the first right after pairing:
51
+
52
+ 1. **hello1**, browser: `{t, did, eb, nb}`: a fresh X25519 public key `eb` and 32 random bytes.
53
+ The Mac refuses an unknown `did` (`unpaired`). Otherwise it makes its own X25519 pair `em`, 32 random bytes `nm`, and `TH = tx("dibs-hs-v1", mid, did, D, eb, nb, M, em, nm)` where `D` is the stored device key and `M` its identity key. It rejects an all-zero shared secret.
54
+ 2. **hello2**, Mac: `{t, em, nm, sig}`, `sig = Sign_M(tx("dibs-hs2-v1", TH))`. The browser builds `TH` from its own view (the `M` it pinned at pairing) and verifies, so a relay answering with its own keys is caught here, before the browser has sent anything but a public key.
55
+ 3. **hello3**, browser: `{t, sig}`, `sig = Sign_D(tx("dibs-hs3-v1", TH, sigM))`. The Mac verifies it against `D` and checks the device is still paired.
56
+
57
+ Keys: `salt = SHA-256(tx("dibs-hs-keys-v1", TH, sigM, sigD))`; from the X25519 shared secret, HKDF-SHA-256 with that salt gives `k_b2m` (info "dibs-relay-v1 key b2m"), `k_m2b` ("... key m2b") and the session id `sid` ("... sid"). Both ephemeral private keys are dropped after the exchange, so a later theft of the long-term keys reveals no recorded session (forward secrecy). Both sides signed the same transcript (mutual authentication); a replayed hello3 fails because the Mac's `em` and `nm` are new every time.
58
+
59
+ 4. **ready**: the Mac's first encrypted frame. The page sends no call before it decrypts this (key confirmation).
60
+
61
+ ## Frames
62
+
63
+ ```
64
+ 0x02 | seq (8 bytes, big-endian) | AES-256-GCM ciphertext | tag (16)
65
+ nonce = 4 zero bytes | seq
66
+ AAD = "dibs-frame-v1" | sid | direction (1 = browser to Mac, 2 = Mac to browser) | the 9 header bytes
67
+ ```
68
+
69
+ Each side's `seq` starts at 0, and the receiver accepts only exactly the next one. A replayed, dropped, reordered, altered or cross-session frame fails, and any failure closes the session (the page reconnects with new keys). Plaintext is a 4-byte length, the JSON, and zeros up to the next bucket of 1, 4, 16, 64, 256 KiB, 1 or 4 MiB; requests are capped at 64 KiB. Messages: `{t: "req", id, method, path, body}` from the page, `{t: "res", id, status, json}` from the Mac. The Mac runs a request only after it decrypts, only for `/api/...` paths, only if the device is still in `relay.json` at that moment, and only if the device may. Remote calls go through an allow-list, checked in the relay connector and again in `api()`, on the path as `api()` parses it (so `/api/x/../hook` is `/api/hook`):
70
+
71
+ - any paired device: GET `/api/board`, `/api/questions`, `/api/threads`, `/api/later`, `/api/history`, `/api/stats`, `/api/settings`;
72
+ - a device paired with `--allow-actions`, also: POST `/api/jobs/<id>/boost|pause|resume|stop`, `/api/cap`, `/api/pace`, `/api/later/<id>/cancel`;
73
+ - everything else is 403, a route added later included, so new routes are local-only until someone decides otherwise. That covers messaging an agent, marking a thread read, answering or dismissing an agent's question (all of which reach agents as "Message from the person", which agents act on, shell commands included), installing the hook (it edits `~/.claude/settings.json`) and setting the hours (they decide when the person gets asked).
74
+
75
+ A reason sent with a remote action is dropped: the action runs, but no words from a paired browser reach an agent as the person's. A remote action runs the CLI with `DIBS_VIA`, so the record names the device: the job's `by` (a stop's `stopBy`, a pause's `by`, which the job's agent is told), the override event and `logChange` all read "the person via Safari on iPhone (remote 1a2b3c4d)": a label from the page's fixed vocabulary (browser and system, or "a browser" for any name the page wouldn't have made, since the device chooses its own name and this text reaches agents), and the start of its id, the one `dibs pair --revoke` takes. The device's own name appears only in `dibs pair --list`. `dibs pair --list` shows each device as "can act" or "look only", and every `dibs pair --remote` is logged with whether it allowed actions. Sessions end after 12 hours; the page reconnects.
76
+
77
+ Errors before a session exists (`{t: "err", code}`) are unauthenticated, so the relay could write them. The page believes only four codes (`unpaired`, `pair-expired`, `bad-pair`, `bad-hello`), shows only its own fixed sentence for each, and never deletes keys because of one. Nothing else the relay sends reaches the page as words either: WebSocket close reasons are ignored, and every message the page shows about the connection is one of its own.
78
+
79
+ ## The relay
80
+
81
+ | path | who | what the relay does |
82
+ |---|---|---|
83
+ | `wss://app.dibs.cc/ws/m/<mid>` | the Mac (also sends `{t: "tokens", h, p}`: the hashes of its paired browsers' relay tokens and of its open links' pairing tickets, within a second of any change in `relay.json`) | sends a 32-byte challenge; the Mac answers with its relay public key and `Sign_R(tx("dibs-relay-auth-v1", mid, challenge, host))`. The relay checks that the key hashes to `<mid>` and the signature; then routes. The newest authenticated connection replaces the old one |
84
+ | `wss://app.dibs.cc/ws/b/<mid>` | a browser tab | only from the page's own Origin. A tab gets a slot only by proving it's paired: its first message is `{t: "hello", rt}`, and the relay admits it if the hash of `rt` is one the Mac registered (compared in constant time), or `{t: "pair", ticket}` with a ticket whose hash the Mac registered for an open link, into a pool of 2 with a 30 s deadline that ends when the Mac admits it. A wrong ticket and no open link get the same answer, so the relay's answers say nothing about whether a link is open, and nobody without the link can take the pairing pool. Anything else (a byte, a made-up token, silence for 5 s) closes it. An admitted tab gets a random channel id; its binary messages go to the Mac prefixed with the id, and the Mac's go back by id. Text from the relay: `{t: "mac", up}`, and `{t: "refused", why: "unpaired" or "no-pairing"}`, which the page turns into its own words |
85
+ | `https://app.dibs.cc/` | anyone | the page, with the headers below |
86
+ | `https://dibs.cc/app`, `https://dibs.cc/app/*` | anyone | a 301 to `https://app.dibs.cc/`, which keeps the fragment. Exactly these two route patterns, so `/apple-touch-icon.png` and the like stay the waitlist's |
87
+
88
+ Limits: 20 connections a minute per address and role (Workers rate limiting), and 30 new tabs a minute per address in the machine's Durable Object. At most 8 paired tabs per machine and 4 per address; at most 6 tabs waiting to prove themselves, 3 per address, and past 6 the oldest waiting goes, never the newcomer. A Mac socket has 10 seconds to authenticate, on its own timer; at most 8 wait at once, and past that the oldest waiting one is closed rather than the newcomer refused, so silent sockets can't lock the real Mac out. When the Mac goes offline every tab hears so and is closed 5 seconds later, whatever it sends meanwhile; a tab that arrives while it's offline is turned away at once. When the Mac reconnects, every admitted tab is closed so it proves itself to the new connection. A revoke reaches the relay within a second, and that device's open tabs are closed. Also 64 KiB per browser frame and 4 MiB per Mac frame, token buckets of 20 frames a second (burst 60) per tab and 200 (burst 400) for the Mac, tabs closed after 10 idle minutes, a Mac closed after 90 seconds without a ping. One Durable Object per machine id, nothing in its storage, observability and logpush off, and nothing about a frame is logged.
89
+
90
+ ## The page
91
+
92
+ - Its own origin, `app.dibs.cc`, not `dibs.cc/app`: the device key lives in that origin's IndexedDB, and anything else on the same origin (the waitlist page, a future blog) could use it. Keeping the origin to this one page keeps that surface to this one page.
93
+ - `Content-Security-Policy: default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src wss://app.dibs.cc; ... base-uri 'none'; form-action 'none'; frame-ancestors 'none'; require-trusted-types-for 'script'; trusted-types 'none'`. No inline script, no third-party anything, no DOM HTML sinks.
94
+ - `Strict-Transport-Security: max-age=63072000; includeSubDomains`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, `X-Content-Type-Options: nosniff`, COOP/COEP/CORP same-origin, a Permissions-Policy denying every device API.
95
+ - Subresource Integrity (SHA-384) on every script and stylesheet, and `hashes.txt` listing the hash of every file, the page itself included, so anyone can check what app.dibs.cc serves:
96
+
97
+ ```bash
98
+ curl -s https://app.dibs.cc/ | openssl dgst -sha384 -binary | base64 # compare with relay/public/hashes.txt for /
99
+ ```
100
+
101
+ ## Remote MCP (mcp.dibs.cc)
102
+
103
+ `dibs relay mcp on` lets an MCP client somewhere else, such as a claude.ai connector on another Claude account, reach this Mac's MCP. The URL to give it is `https://mcp.dibs.cc/mcp`; `https://mcp.dibs.cc/<machine id>/mcp` works too. It's off until the person turns it on (`dibs relay mcp off` turns it off at once; `dibs service status relay` and `dibs pair --list` show which).
104
+
105
+ This part is **not end-to-end encrypted**. MCP clients speak HTTPS, and TLS ends at Cloudflare, so the relay carries these requests and answers in the clear on their way through. It stores none of it and logs no bodies.
106
+
107
+ ### Sign-in codes
108
+
109
+ While remote MCP is on, `dibs pair` prints 12-character codes (60 bits, `XXXX-XXXX-XXXX`), good for sign-in here and through the relay; with it off they're 8 characters and local only. A code through the relay must be a long one. One use, ten minutes, as always.
110
+
111
+ ### The bare host, https://mcp.dibs.cc/mcp
112
+
113
+ With no machine id in the URL, the relay finds the Mac three ways, and none of them lets it pretend to be one:
114
+
115
+ - **Discovery and registration** are answered by the relay itself, storing nothing. The issuer and resource are `https://mcp.dibs.cc`. A client id is `b.<payload>.<mac>`: the payload is the client's name and redirect URIs, and the mac is an HMAC under `REG_SECRET`, the one secret the relay holds. It signs registrations and nothing else; no Mac knows it, and it opens nothing on any Mac. The relay refuses an edited or unsigned client id at `/oauth/client`, `/oauth/authorize` and `/oauth/token`, and the Mac still checks the redirect exactly against the payload at sign-in and at token exchange.
116
+ - **Sign-in is routed by the code.** While remote MCP is on, the Mac lists the index hash of each live long code, SHA-256("dibs-mcp-code-v1\0" ‖ normalized code), with the relay over its authenticated socket. The relay keeps them in one code index (a Durable Object): hash to machine id, for the code's ten minutes at most, replaced whenever the Mac's list changes (a spent or revoked code drops out within a second; an accepted one is dropped at once), at most 10 per machine, and a machine can only replace its own entries. The sign-in page at `https://mcp.dibs.cc/authorize` sends the code; the relay hashes it, finds the machine, and forwards the request to that Mac, which checks the code itself. A malformed, unknown, expired or spent code gets exactly the answer a Mac gives a wrong code: the same 401, the same words, the same 800 ms.
117
+ - **Everything after is routed by tag.** The authorization code, access token and refresh token a Mac issues through the bare host start with `<machine id>.`; the relay routes `/oauth/token` and `/mcp` by it. The Mac checks the whole string by hash, so a token re-tagged for another machine, with a made-up tag, or made up whole is 401 (with `resource_metadata` for the bare host). The tag is a machine id, which isn't a secret: it's in every grant and token, so it reaches the MCP client and may end up in its logs or a browser's history. On its own it opens nothing. It doesn't sign anyone in (that takes the person's code), doesn't make a token (each is 32 random bytes the Mac checks by hash), and can't spend the signed-in client's budget (only tokens the Mac accepts count against that). The most it does is aim unauthenticated requests at one machine, which the per-machine and per-address limits below already cap.
118
+
119
+ Lookups at the index are limited: 10 a minute per address, and 300 a minute in total for an address's second and later tries. An address's first try in a minute always gets an answer, so a flood from many addresses can't lock out a person typing their code once.
120
+
121
+ ### What's forwarded
122
+
123
+ Only `GET|POST /mcp`, `POST /oauth/register`, `GET /oauth/client`, `POST /oauth/authorize`, `POST /oauth/token` and the three `/.well-known` metadata documents, at the bare host or under `/<machine id>/` (metadata also at `/.well-known/<kind>/<machine id>`, the RFC 8414 form). Everything else on mcp.dibs.cc is 404 at the relay, and the Mac refuses anything else again: never the page, never `/api/*`, never the relay's own messages. Requests carry only `Content-Type`, `Authorization`, `Origin`, `Accept` and `Mcp-Protocol-Version` (at most 64 KiB of body) and the connecting address; answers carry only `Content-Type`, `WWW-Authenticate` and `Allow`. The relay sends each as a `{t: "http", id, ...}` message over the Mac's authenticated WebSocket and waits up to 25 s for `{t: "http-res", id, ...}`. The Mac answers 502 instead of any `http-res` over 3.5 MiB once serialized, so a big answer fails one request and never closes the connection.
124
+
125
+ ### The sign-in page
126
+
127
+ The relay's own copy of `web/authorize.html`, with SRI and the same strict CSP as the page. It shows first, and largest, the address that will receive the token (the redirect's host, then the full address); the client's name comes after, marked as its own description, since anyone can register any name.
128
+
129
+ ### Limits and separation
130
+
131
+ - **Wrong codes** through the relay are counted apart from local ones, per address and per client: 10 wrong in 10 minutes from one address, or for one client, and that address or client waits the window out, right code or not. Past 100 wrong from all addresses together in 10 minutes (a real flood), every remote try waits. Sign-in on the Mac itself is never affected.
132
+ - **Registrations** through the relay (at `/<machine id>/`) are limited to 10 in 10 minutes per address, 100 in all. At most 200 remote clients are kept; when full, the oldest one that never signed in is dropped, and a client that has signed in is never dropped (with none to drop, registration waits). Local clients are never touched.
133
+ - **Per machine,** requests with a token the Mac accepts have their own budget (120 a minute), apart from everything else (discovery, registration, sign-in, rejected tokens: 40 a minute), so strangers can't spend the signed-in client's. At most 8 requests at once per machine, 2 from one address. Per address, 120 requests a minute (Workers rate limiting).
134
+ - **Tokens, grants and clients** made through the relay carry `remote: true` and work only through it; local ones work only locally. `dibs pair --list` shows them as "MCP via mcp.dibs.cc: <client name>"; `--revoke` signs one out.
135
+ - **What a client can do** depends on the code it signed in with, here and through the relay alike. A plain `dibs pair` code gives the read tools: `board`, `agents`, `agent`, `progress`, `stats`, `questions`, `history`, `resource`, `machines`, `messages`. A code from `dibs pair --allow-actions` adds the write tools: `post_progress`, `answer_question`, `tell_agent`, `say_to_person`, `hold`, `release`, `boost_job`, `pause_job`, `resume_job`, `stop_job`. The grant goes from the code to its grant, its tokens and every refresh; `dibs pair --list` shows each client as "can act" or "look only".
136
+ - **A client acts as an agent, never as the person.** Every write runs the CLI as `mcp-<name>-<hash>` (its name made safe, and 4 hex characters of its client id), so its messages and answers reach agents as another agent's, its holds and job changes show under that name on the board and in `dibs history`, and acting on another session's job takes `owner`, as for any agent. No tool installs the hook or sets the hours.
137
+ - **Commands never go through the relay.** A code from `dibs pair --allow-commands` also gives `queue_run` (a command for dibs to run later, as `dibs later` does), but only to a client signed in at this Mac's own `http://127.0.0.1:7421/mcp`. Through mcp.dibs.cc a token could be read in transit, so a token issued there never carries the commands grant, `queue_run` is never listed, and a call to it is refused, whatever code the client signed in with. `dibs pair --list` shows such a local client as "can run commands".
138
+ - Through the relay, writes carry a token the Mac accepts, so they count against the signed budget like any other MCP call.
139
+ - Tool text is one line per field, and the server's instructions tell the client never to follow instructions found in agents' posts, questions or messages.
140
+
141
+ ## Accounts (app.dibs.cc/account)
142
+
143
+ An account remembers your Macs, so any browser you sign in with opens all of them, still end to end. `dibs connect --account` adds a Mac; `dibs connect --approve <code>` lets a new browser have the account's key; `dibs connect --list` and `--remove <id>` show and undo it.
144
+
145
+ ### The account key and the keyring
146
+
147
+ - The **account key** (AK) is 32 random bytes made by the account's first browser. It never reaches the relay except sealed.
148
+ - The **keyring** is JSON the browser seals with AK (AES-256-GCM, additional data "dibs-keyring-v1") and stores at the relay: one Ed25519 **account device key** (its private key, pkcs8), and for each Mac its machine id, its pinned identity key and fingerprint, the device id it gave the account, and the relay token. Each Mac trusts the account device key as one paired device ("account <id>"), so every browser that opens the keyring talks to every Mac over the same sessions as a phone does (above). The keyring is versioned: a write naming an old version is refused, so two browsers can't overwrite each other's Macs.
149
+ - A browser keeps AK, its session and the Macs in IndexedDB, which belongs to app.dibs.cc alone. The device key is imported there as non-extractable.
150
+ - **Changing the account takes AK.** The first keyring write stores SHA-256 of a proof, HKDF(AK, "dibs-account-auth"); every later write (the keyring, wrapped AKs, adding a Mac, adding or removing a passkey, ending sessions) must carry that proof. A session alone, say from a stolen inbox, can read the sealed keyring and ask a Mac for AK, and nothing else. The relay keeps only the proof's hash, so a copy of its storage can't write either.
151
+ - A sign-in in a browser that already holds an account keeps AK when it's the same account, and asks before switching to another one.
152
+
153
+ ### Signing in
154
+
155
+ - **Email link.** The address is typed on a page at `https://mcp.dibs.cc/email`, not on app.dibs.cc: it runs Cloudflare Turnstile, whose script changes without notice and so can't be pinned, and app.dibs.cc runs no script it didn't ship, since AK is in its storage. The relay checks the Turnstile token with Cloudflare (for that host and action, once) before it sends anything. It keeps HMAC-SHA-256 under `ACCOUNT_SECRET` of the trimmed, lowercased address (so it can find the account an address signs in to, and can't list addresses), and sends `https://app.dibs.cc/account#signin=<token>` through Cloudflare Email Sending from no-reply@mail.dibs.cc. The token is 32 random bytes, works once, for 15 minutes, and is in the fragment, so it never lands in a server log or a referrer. The relay stores only its SHA-256. The answer is the same whether or not the address has an account. A first sign-in makes the account.
156
+ - **Passkey.** WebAuthn, checked by hand in the Worker (relay/src/webauthn.js): CBOR, COSE ES256 and EdDSA, attestation "none", the challenge, origin, relying party (app.dibs.cc), user presence, and a sign count that must go up (a copy of a passkey with an older count is refused as a possible clone). User verification (a PIN or biometrics) is required to add one, and a sign-in without it gets a session but not the wrapped AK. Challenges are stateless: the time, 16 random bytes and an HMAC under `ACCOUNT_SECRET` over them, the kind and the account, good for 5 minutes; the relay stores one only once it's been used, so asking for challenges costs it nothing. It stores each passkey's id and public key. The account page lists them and removes one.
157
+ - **PRF.** When the browser supports the WebAuthn PRF extension, adding a passkey wraps AK under HKDF of its PRF output (AES-256-GCM, "dibs-ak-v1"), and the relay stores the wrapped AK. Signing in with that passkey anywhere it's synced opens AK there and then. The relay never sees the PRF output.
158
+ - **A session** is 32 random bytes the browser sends as a bearer header (never a cookie, so a WebSocket upgrade doesn't carry it and the relay can't tie a session to the Macs it opens), good for 30 days; the relay stores its SHA-256, and drops it the first time it's shown for an account that's gone. "Sign out everywhere else" ends every session made before it (the relay stores the time) and gives the asking browser a new one.
159
+ - **Limits:** sign-in links 3 an hour per address from one IP, 20 an hour per address from anywhere (so strangers can't lock a person out), 10 an hour per IP and 300 an hour in all, every request counting toward all four, behind Turnstile, and counted in the object's storage by the clock hour (keyed by the address's and IP's keyed hashes), so an eviction doesn't reset them; sign-in attempts 10 in 10 minutes per IP; 30 account requests a minute per IP (Workers rate limiting); 10 passkeys and 50 Macs per account (a 51st is refused; a Mac joining again replaces its own entry). Expired entries are swept by the object's alarm, 128 keys per kind at a time, never during a request.
160
+
161
+ ### A new browser without the key
162
+
163
+ A browser signed in by email (or with a passkey without PRF) has a session but not AK. It asks a Mac of the account, which holds AK (given when it joined, sealed in the pairing's own session, kept in `~/.dibs/relay.json` at 0600). The relay is only a mailbox, and the four steps make it unable to slip in a key of its own:
164
+
165
+ 1. The browser posts a commitment: SHA-256("dibs-approve-commit-v1\0" || its ephemeral X25519 key || 32 random bytes).
166
+ 2. A member Mac (one that shows the relay the account secret it was given when it joined; the relay keeps the secret's hash) posts its own ephemeral X25519 key.
167
+ 3. The browser reveals its key and the random bytes; the Mac checks them against the commitment.
168
+ 4. Both derive the same keys: HKDF of the shared secret, salted with the account, the request and both keys, gives an AES key and two 6-digit codes. The browser shows the first; the person types it on the Mac (`dibs connect --approve <code>`); only then does the Mac post AK sealed with that AES key, and print the second code.
169
+ 5. The person types the second code into the browser, which opens the sealed AK only if it matches its own. A relay that answers the browser itself, posing as a Mac, knows the browser's codes, but the person has no code from a Mac to type, so its key is never used. Three wrong tries and the browser drops it.
170
+
171
+ Everything the relay lists is its word, so the Mac pins what it saw in step 2: the commitment, the label, and its own 10-minute deadline (it ignores the relay's). A list that later changes the commitment is refused, and a request never gets a second key from the Mac, even after the relay drops the Mac's socket: the ids it has answered stay in `relay.json` until their deadline, and an approval records the keys its codes came from, so the account key is sealed only to those (a relay that reconnected the Mac and replayed an approved id with keys of its own would otherwise be sealed to). A request caught by a reconnect can't be sealed any more: `dibs connect --approve` says so, refuses it so the browser hears no, and the person asks again. A browser reloaded mid-request carries on with the same one (its ephemeral key is kept in IndexedDB as a CryptoKey, which can't be read out); otherwise a relay could see the Mac's key, then grind keys of its own (1.65 million tries, about a minute on one core) until the Mac's code matched the one the person was about to type. With the commitment fixed before the Mac's key is out, a go-between has to choose blind, and its codes match one time in a million. A Mac answers at most 5 waiting browsers per account at once, and the relay keeps at most 5 open requests per account and 2 per session, so one stolen session can't crowd out the person's browsers. A wrong code approves nothing; a code that two waiting browsers show approves neither (both are refused).
172
+
173
+ ### What the relay sees and keeps, for accounts
174
+
175
+ - **Keeps:** the email hash, the account id, the hash of AK's proof, passkey ids and public keys and sign counts, AK wrapped under each PRF passkey, the sealed keyring and its version, the hashes of member Macs' account secrets and their machine ids, when sessions were last ended, and for 15 minutes, 30 days, 5 minutes and 10 minutes the hashes of link tokens, sessions, used challenges and approval requests.
176
+ - **Sees in transit:** the email address while it sends the link (TLS ends at Cloudflare), the link and session tokens, the public keys and commitments of approvals, IPs and times, and the size of the keyring.
177
+ - **Never sees:** AK, a PRF output, the keyring's contents (which Macs, their keys, the device key), or any frame between a browser and a Mac.
178
+ - **Can infer:** which Macs a signed-in browser then opens, from timing and IP, since those WebSockets carry no session.
179
+
180
+ ## What this doesn't protect against
181
+
182
+ - **Whoever controls app.dibs.cc can serve different JavaScript.** That's the Cloudflare account, anyone holding a deploy token, or Cloudflare itself. A changed page could use the device key (it can't export it) and read the board while the tab is open. SRI doesn't help here: the same party serves the HTML that carries the hashes. Mitigations: the local page at http://127.0.0.1:7421 (`dibs web`) never touches the network; `hashes.txt` and this repo let anyone compare what's served against the source; `dibs pair --list` shows when each device last connected, and `--revoke` cuts one off. A stronger fix would be a page installed on the device (a signed app or extension) instead of one loaded from a server.
183
+ - **The code index is one place every bare-host sign-in goes through.** It holds only code hashes and machine ids, and only for ten minutes, but it's a single object: a big enough flood can slow it, and while the global budget is spent, a person who mistypes their code has to wait a minute to try again (their first try always gets through). The per-machine URL, `https://mcp.dibs.cc/<machine id>/mcp`, doesn't use the index at all.
184
+ - **The relay holds one secret, `REG_SECRET`.** It signs bare-host client ids and nothing else. Whoever has it can mint a client id with any redirect, which is no more than anyone can do by registering; it can't sign anyone in, since that still takes the person's code.
185
+ - **An account is as safe as its key.** Whoever holds AK opens every Mac of the account (as the account device). It's in each signed-in browser's IndexedDB, on each member Mac, and wrapped under each PRF passkey. A stolen synced passkey with PRF, or a browser profile, gives it; so does a person approving the wrong browser at a Mac (the code is there to stop that). `dibs connect --remove <id>` takes a Mac off the account (its account device and key go); signing out clears a browser. There is no way yet to change AK without starting a new account.
186
+ - **Email is only as safe as the inbox.** A sign-in link gives a session, not AK, so a stolen inbox alone opens no Mac and changes nothing on the account; it can still ask a Mac for approval, which is why both codes must match.
187
+ - **Turnstile runs Cloudflare's script on mcp.dibs.cc/email.** It sees the address typed there and could, if changed, send it elsewhere or ask for links; it can't reach app.dibs.cc's storage or AK, and mcp.dibs.cc keeps nothing in the browser.
188
+ - **The account's first write sets its proof.** Whoever writes the keyring first sets it. That's the browser that made the account, at once; an attacker would need the account's first sign-in link before the person used it. An account that got a keyring before proofs existed (2026-11-02, before the accounts CLI shipped, so with no Mac on it) takes no first proof from anyone and can't be changed.
189
+ - **The relay sees remote MCP traffic in transit.** With `dibs relay mcp on`, whatever an MCP client reads (the board, agents' posts and tasks, stats) passes through Cloudflare decrypted, as do the sign-in codes and OAuth tokens on their way. It's never stored, but whoever controls the relay could read or change it, or keep a token and use it until it expires (access tokens last a day) or is revoked. Changing it can't do more than that client's code allowed: read, or with `dibs pair --allow-actions`, act as its `mcp-` agent. `queue_run` never goes through the relay. The page's own channel isn't affected. Leave remote MCP off unless a client elsewhere needs it.
190
+ - **The relay sees each tab's relay token.** A tab presents it so the relay can admit it; the relay keeps only hashes (in the Mac socket's state, gone when it disconnects). The token grants a tab slot and nothing else: it opens no session and decrypts nothing. Someone who steals it from the browser can occupy one of that device's slots until it's revoked.
191
+ - **The relay sees metadata**: which machine id is online and when, how many tabs, the time and padded size of each frame, IP addresses, and the public keys exchanged in pairing and handshakes. It can drop or delay anything (denial of service), but can't read, forge, replay or reorder a frame without the session closing.
192
+ - **The link is the key to pairing.** Anyone who sees it within ten minutes and opens it first pairs instead of the person (the person's own browser then gets "already used", and `dibs pair --list` shows the extra device to revoke). Don't paste it into a chat; scan the QR code with the phone's camera.
193
+ - **The link can reach synced browser history.** The page removes the fragment from the address bar as soon as its script runs, but a browser may record the full URL in its history first, and history syncs (iCloud, a Google or Firefox account). The link is dead after one use and after ten minutes either way, so a synced copy is only a risk in that window, and only before the person's own browser uses it. Scanning the QR code on the phone that will use it keeps it off the Mac's browser history altogether.
194
+ - **A compromised Mac or browser** is out of scope: malware in the person's account can read `~/.dibs`, and a browser extension with access to app.dibs.cc can drive the page.
195
+ - **A device paired with `--allow-actions`** can boost, pause, resume and stop any job, cap an agent, set the pace and cancel scheduled runs, as the person (the record names the device, and no reason text goes with it). It can't message agents, answer their questions, or change the hook or the hours. A lost phone that isn't revoked, or a changed page at app.dibs.cc while that device has it open, can do the same: stopping every job is the worst of it. Pair with actions only the devices that need them, and revoke a lost one at once. Look-only devices, the default, can read the board and nothing else.
196
+ - A pairing whose answer never reaches the browser (the connection dropped between pair1 and pair2) leaves a device on the Mac that no browser holds the key for. It can't be used; `dibs pair --list` shows it and `--revoke` removes it.
@@ -0,0 +1,27 @@
1
+ # Releasing
2
+
3
+ How a version reaches people: dibs.cc, npm, GitHub and the plugin marketplaces. The steps in AGENTS.md (suite twice, version bumps, CHANGELOG) come first; this is what happens after.
4
+
5
+ ## Where a release goes
6
+
7
+ | where | what | how people get it |
8
+ |---|---|---|
9
+ | `https://dibs.cc/install.sh` | install.sh with the release's sha256 written in | `curl -fsSL https://dibs.cc/install.sh \| sh` |
10
+ | `https://dibs.cc/releases/` | `dibs-vX.tar.gz`, `dibs-vX.tar.gz.sha256`, `install-vX.sh` | install.sh downloads the tarball and always checks its sum |
11
+ | `https://dibs.cc/mac/` | the signed, notarized `dibs-X.dmg` and `latest.json` | `/mac/` redirects to the newest DMG; the app checks `latest.json` daily |
12
+ | npm | `@dibssoftware/dibs` | `npm i -g @dibssoftware/dibs` |
13
+ | GitHub | the tag, and a release with GitHub's own tarball (`.github/workflows/release.yml`) | the repo, and the Claude Code and Codex plugin marketplaces |
14
+
15
+ The dibs.cc files live in the R2 bucket `dibs-releases`; the `dibs-waitlist` Worker serves `/install.sh`, `/releases/*` and `/mac/*` from it.
16
+
17
+ ## Steps
18
+
19
+ From the public repo, after the AGENTS.md steps and with the version bumped everywhere (test/version.test.mjs checks):
20
+
21
+ 1. Each change in the release lands in the public repo as a commit of its own, with its own message, authored and committed by `dibs maintainers <licensing@dibs.cc>`. Never one squashed commit per release, and never a rewrite of what's already public. `release.sh` refuses a tag with any other author since the last tag.
22
+ 2. `git tag vX && git push origin main vX`. The release workflow runs the suite on macOS and Linux, makes the GitHub release, and publishes `@dibssoftware/dibs` to npm through trusted publishing: no npm token anywhere, and npm shows the package's provenance as that workflow run. package.json has no dependencies and no scripts, so nothing runs on anyone's machine at install.
23
+ 3. `sh release.sh` uploads the tarball, its sum and install.sh to dibs.cc, then downloads each back and compares bytes. `DIBS_DRY_RUN=1` builds and checks without uploading.
24
+ 4. The Mac app: `dibs run xcode-build -m "mac release" -- app/release.sh`, then `sh release.sh --mac` to upload the DMG and, last, `latest.json`.
25
+ 5. Plugin users get the new version once the `version` in `.claude-plugin/plugin.json` changes and their marketplace refreshes (`claude plugin marketplace update dibs`).
26
+
27
+ The tarball is `git archive` of the tag through `gzip -n`, so the same tag always gives the same bytes and the same sum.