@dibssoftware/dibs 0.0.181 → 0.0.195

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 (105) hide show
  1. package/CHANGELOG.md +103 -1
  2. package/README.md +10 -8
  3. package/bin/dibs.mjs +370 -73
  4. package/docs/agents.md +303 -0
  5. package/docs/council.md +88 -0
  6. package/docs/files.md +3 -3
  7. package/docs/guard.md +86 -11
  8. package/docs/json.md +211 -0
  9. package/docs/later.md +5 -5
  10. package/docs/machines.md +6 -6
  11. package/docs/questions.md +104 -3
  12. package/docs/reference.md +124 -30
  13. package/docs/relay.md +120 -9
  14. package/docs/releasing.md +7 -1
  15. package/docs/scheduling.md +28 -6
  16. package/docs/secrets.md +53 -0
  17. package/docs/simulators.md +3 -3
  18. package/package.json +1 -1
  19. package/skills/dibs/SKILL.md +79 -149
  20. package/src/about.mjs +341 -0
  21. package/src/acquire.mjs +111 -27
  22. package/src/after.mjs +127 -0
  23. package/src/agents.mjs +2 -1
  24. package/src/alerts.mjs +95 -42
  25. package/src/answers.mjs +2 -2
  26. package/src/board.mjs +21 -16
  27. package/src/broker.mjs +23 -7
  28. package/src/carry.mjs +287 -0
  29. package/src/codex.mjs +132 -0
  30. package/src/commands.mjs +243 -82
  31. package/src/config.mjs +85 -14
  32. package/src/connect.mjs +4 -2
  33. package/src/cool.mjs +27 -11
  34. package/src/council.mjs +482 -0
  35. package/src/cwd.mjs +9 -0
  36. package/src/decisions.mjs +250 -0
  37. package/src/declare.mjs +96 -0
  38. package/src/diskreport.mjs +306 -0
  39. package/src/diskuse.mjs +420 -0
  40. package/src/diskwarn.mjs +68 -13
  41. package/src/doctor.mjs +149 -0
  42. package/src/doors.mjs +547 -0
  43. package/src/durable.mjs +143 -0
  44. package/src/envs.mjs +372 -0
  45. package/src/events.mjs +7 -2
  46. package/src/files.mjs +118 -6
  47. package/src/guard.mjs +239 -86
  48. package/src/guardd.mjs +8 -1
  49. package/src/halt.mjs +63 -0
  50. package/src/handoffs.mjs +362 -0
  51. package/src/history.mjs +34 -4
  52. package/src/hogs.mjs +36 -8
  53. package/src/jobprogress.mjs +283 -0
  54. package/src/later.mjs +21 -10
  55. package/src/lock.mjs +33 -9
  56. package/src/measure.mjs +42 -11
  57. package/src/media.mjs +240 -0
  58. package/src/news.mjs +31 -0
  59. package/src/notes.mjs +49 -8
  60. package/src/notices.mjs +126 -43
  61. package/src/ondemand.mjs +25 -2
  62. package/src/outcome.mjs +163 -0
  63. package/src/overlap.mjs +2 -2
  64. package/src/override.mjs +149 -79
  65. package/src/owner.mjs +15 -2
  66. package/src/people.mjs +236 -0
  67. package/src/pickup.mjs +72 -0
  68. package/src/picture.mjs +321 -0
  69. package/src/plain.mjs +84 -18
  70. package/src/platform.mjs +19 -0
  71. package/src/preempt.mjs +123 -15
  72. package/src/primer.mjs +91 -20
  73. package/src/prints.mjs +99 -0
  74. package/src/proc.mjs +1 -1
  75. package/src/progress.mjs +49 -3
  76. package/src/proof.mjs +102 -0
  77. package/src/push.mjs +271 -0
  78. package/src/questions.mjs +328 -57
  79. package/src/quota.mjs +1 -1
  80. package/src/recap.mjs +205 -0
  81. package/src/relay.mjs +139 -20
  82. package/src/remote.mjs +23 -10
  83. package/src/reviewgate.mjs +268 -0
  84. package/src/reviews.mjs +377 -0
  85. package/src/route.mjs +263 -0
  86. package/src/rules.mjs +216 -0
  87. package/src/schedule.mjs +238 -44
  88. package/src/schema.mjs +62 -0
  89. package/src/scratch.mjs +2 -2
  90. package/src/serve.mjs +3 -2
  91. package/src/signed.mjs +97 -0
  92. package/src/simpool.mjs +46 -1
  93. package/src/spend.mjs +375 -0
  94. package/src/state.mjs +43 -17
  95. package/src/talk.mjs +1078 -133
  96. package/src/thin.sh +2 -0
  97. package/src/trail.mjs +290 -0
  98. package/src/trailnote.mjs +209 -0
  99. package/src/util.mjs +7 -0
  100. package/src/vault.mjs +435 -0
  101. package/src/vendors.mjs +327 -0
  102. package/src/version.mjs +1 -1
  103. package/src/web.mjs +353 -60
  104. package/src/work.mjs +487 -0
  105. package/src/worker.mjs +7 -1
package/bin/dibs.mjs CHANGED
@@ -7,25 +7,29 @@
7
7
  // wait starts Node twice (to get in line, then to run), 75 ms more, for a wait
8
8
  // that won't happen.
9
9
  // dibs: take turns on shared machine resources so parallel agents stop colliding.
10
+ // First: every later import may ask where it is.
11
+ import '../src/cwd.mjs';
10
12
  import fs from 'node:fs';
11
13
  import path from 'node:path';
12
14
  import { fileURLToPath } from 'node:url';
13
- import { loadConfig, paths, profiled } from '../src/config.mjs';
15
+ import { loadConfig, paths, profiled, isEnv } from '../src/config.mjs';
14
16
  import { identity } from '../src/proc.mjs';
15
- import { changelog, seenBy, markSeen, newer } from '../src/news.mjs';
17
+ import { changelog, seenBy, markSeen, newer, whatsNew } from '../src/news.mjs';
16
18
  import { PRIORITY_SHIFT, PRIORITIES, priority } from '../src/schedule.mjs';
17
19
  import { VERSION } from '../src/version.mjs';
18
- import { run, notifyOnExit, hold, release, when, why, mine, who, yieldTo, ask, requests, status, freePort, pace, checkNames, nearest } from '../src/commands.mjs';
20
+ import { run, notifyOnExit, hold, release, when, why, mine, jobs, who, yieldTo, ask, requests, status, freePort, pace, checkNames, nearest } from '../src/commands.mjs';
19
21
  import { remoteRun, join, machines } from '../src/remote.mjs';
20
22
  import { sims } from '../src/simpool.mjs';
21
- import { question, questions, answer, hoursCmd } from '../src/questions.mjs';
22
- import { say, tell, threads, noticesFor, listen } from '../src/talk.mjs';
23
+ import { question, questions, answer, hoursCmd, attentionCmd } from '../src/questions.mjs';
24
+ import { say, tell, threads, noticesFor, listen, project, poll, pending } from '../src/talk.mjs';
23
25
  import { bytes, ms, deadline, die, noSpace, fullDisk, setCaller, lastDie, lastDieCode, lastDieAt } from '../src/util.mjs';
24
26
  import { event } from '../src/events.mjs';
25
27
  import { fileRes, isFiles, resList } from '../src/files.mjs';
26
28
  import { boost, pause, resume, stop, cap } from '../src/override.mjs';
27
29
  import { later } from '../src/later.mjs';
28
30
  import { isQuota } from '../src/quota.mjs';
31
+ import { requireDeclaration } from '../src/declare.mjs';
32
+ import { outerLease } from '../src/acquire.mjs';
29
33
 
30
34
  // Commands no waiting or running dibs needs load when called: a waiter is a
31
35
  // long-lived process, and each module it never uses costs it memory.
@@ -33,48 +37,82 @@ const lazy = name => import(`../src/${name}.mjs`);
33
37
 
34
38
  const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
35
39
 
40
+ // dibs help <topic>: the section of dibs help all whose heading starts with this. exit is the
41
+ // exit codes' paragraph, which has no heading of its own.
42
+ const TOPICS = { run: 'get a turn', env: 'environments and accounts', look: 'ask without joining', later: 'run it later',
43
+ agents: 'work with other agents', work: 'shared work', question: 'ask the person', money: 'money', progress: 'progress',
44
+ page: "the person's page", talk: 'talk with your agents', machines: 'several machines', stop: 'priorities and pauses',
45
+ other: 'other', flags: 'flags', exit: 'Exit codes:' };
46
+ const TOPIC_ALIASES = { spend: 'money', questions: 'question', person: 'question', priority: 'stop', pause: 'stop', boost: 'stop',
47
+ tell: 'agents', handoff: 'agents', review: 'agents', disk: 'look', env: 'env', envs: 'env', exits: 'exit', codes: 'exit', files: 'run', hold: 'run' };
48
+
36
49
  const HELP = `dibs ${VERSION}: agents take turns on this machine's simulator, builds, test runs and deploys.
37
50
 
38
- Wait your turn
39
- dibs run test -m "why" -- npm test wait for a turn, run, give it back when it exits
40
- dibs run sim,xcode-build -- <command> need two things? ask for both at once
41
- dibs hold sim --for 20m -m "why" keep it across several commands, each still in dibs run sim -- <cmd>
42
- (no wait under your hold); give it back: dibs release sim
43
- dibs hold 'files:src/auth/**' -m "why" keep other agents' edits off these files
44
- dibs run test --anywhere -- <command> on whichever machine in the group starts it soonest (--on <machine>: that one)
45
- dibs run deploy --quick -- ./ship.sh a command over in under 15 s starts at once (or --est 10s; dibs learns it after)
46
-
47
- Tell the person
48
- dibs progress "what you did or found" --task <name> --eta 30m as often as you commit; then --blocked or --done
49
- dibs question "Ship 123 now?" --options yes,no --recommend yes -m why --one-way "testers get it at once"
50
- only one-way doors reach the person; the same command plus --wait reads the answer
51
- dibs say "done: tests pass" an FYI in your thread, no question
51
+ What agents use (-m on run and hold is required: what it does and why, in plain words the person reads)
52
+ dibs run test -m "login tests after the redirect fix" -- npm test wait for a turn, run, give it back when it exits
53
+ dibs hold sim --for 20m -m "check the onboarding screens by hand" keep it across commands (dibs release sim gives it back)
54
+ dibs listen start it with run_in_background: it wakes you when something is for you
55
+ dibs say "done: tests pass" a note to the person; dibs tell <agent> "..." messages another agent
56
+ dibs question "Ship 123?" --recommend yes -m why --one-way "testers get it" only for what can't be undone
57
+ dibs progress "what you did" --task <name> --eta 30m as often as you commit; then --blocked or --done
58
+ dibs why why you're waiting, in sentences
59
+ dibs mine | dibs stop <id> your jobs with their #ids | end one and kill its processes
60
+ dibs disk who fills the disk; dibs disk add <dir> marks a folder you made
61
+ dibs help <topic> | dibs help all one topic, below | every command and flag
62
+
63
+ Exit 75: your command never ran (you gave up waiting) and didn't fail: run it again within 2 minutes.
64
+ Exit 74: it can't fit on this disk. Exit 78: refused, nothing ran: don't retry it.
65
+ Priority: -p urgent|high|normal|low|idle (urgent and high need -m "why"). low and idle run at background priority, which on macOS also slows disk and network: uploads and deploys at -p normal.
66
+ Topics: ${Object.keys(TOPICS).join(', ')}
67
+
68
+ More ways to wait your turn
69
+ dibs run sim,xcode-build -m "..." -- <command> need two things? ask for both at once
70
+ dibs hold 'files:src/auth/**' -m "rework the session refresh" keep other agents' edits off these files
71
+ dibs run test --anywhere -m "..." -- <command> on whichever machine in the group starts it soonest (--on <machine>: that one)
72
+ dibs run deploy --quick -m "ship the docs fix" -- ./ship.sh a command over in under 15 s starts at once (or --est 10s)
73
+ Priority: -p urgent|high|normal|low|idle (urgent and high need -m "why"). Due by a time: --by 23:30.
74
+
75
+ More for the person
76
+ dibs decisions --project --about "words" what's already decided for this project; dibs question answers from it first
77
+ dibs spend check 50 --on apple-ads -m why before committing money: exit 0 within the caps, else the person decides
78
+ dibs say "the chart" --file chart.png with files (--file, --report r.md) or a live file or folder (--link <path>)
79
+ dibs poll "which one?" --option A --option B choices the person taps; each vote reaches you as a message
52
80
 
53
81
  Other agents and their jobs
54
- dibs tell <agent> "..." a message that reaches it with its next tool call (or dibs say --to <agent>)
55
- dibs boost <id> high -m "why" move a job up (urgent|high|normal|low|idle); --owner <its session> if not yours
82
+ dibs tell <agent> "..." --wait 5m ...and wait for its answer, which it prints (exit 75: none in time)
83
+ dibs who knows src/payments which agents edited, held, ran or posted about it lately, best first
84
+ dibs tell --who-knows src/payments "..." ask the best of them that's running, in place of a name (exit 1: nobody)
85
+ dibs tell --all "..." every agent running here
86
+ dibs handoff "title" --to <agent> -m "context" hand a task over (no --to: whichever agent on your project takes it first)
87
+ dibs review request <branch> -m "what to look at" another agent reviews it; you hear approve or changes
88
+ dibs project <name> say which product you work on: work for it can be offered to you when idle
89
+ dibs work next claim the next piece of shared work; dibs work done <id> closes it with proof
90
+ dibs halt --for 7m -m "why" no new dibs job starts until then; running ones go on (dibs halt off lifts it)
91
+ dibs boost <id> high -m "why" move a job up (urgent|high|normal|low|idle), anyone's
56
92
 
57
93
  Look around
58
94
  dibs what each resource is doing and who's next
59
- dibs why where you are in the queue and what you're waiting for
60
95
  dibs when sim when you'd get it, without joining the queue
61
- dibs who sim | dibs mine | dibs history who has it, what you have (exit 1: nothing), what happened this week
96
+ dibs who sim | dibs history who has it | what happened this week
97
+ dibs recap --since 2h what the other agents finished, got stuck on and decided lately
98
+ dibs trail --since 2h what agents committed, merged, shipped and tested, as dibs saw it
99
+ dibs disk what fills the disk: the biggest folders (simulators, worktrees, swap, caches), who made
100
+ each, whether it can go and the command; and each session's share
101
+ dibs disk add <dir> a folder you made that dibs may delete 30 minutes after your session ends
62
102
  dibs yield web-app let another agent go first
103
+ dibs news what changed in dibs lately
63
104
 
64
105
  Set up
65
106
  dibs pace quiet|normal|max how hard dibs drives this machine
66
- dibs guard install make Claude Code agents use dibs when they forget
67
- dibs init point your agents' CLAUDE.md and AGENTS.md at dibs.md (install does it)
68
- dibs machines other machines in the group
69
-
70
- Priority: -p urgent|high|normal|low|idle (urgent and high need -m "why"). Due by a time: --by 23:30.
71
- Exit 75: your command never ran (you gave up waiting) and didn't fail. Run the same command again within 2 minutes.
72
- Everything else: dibs help all`;
107
+ dibs guard install [--for tool] make agents use dibs when they forget: Claude Code, or codex, gemini, cursor, opencode
108
+ dibs init point your agents' instruction files at dibs.md (install does it)
109
+ dibs machines other machines in the group`;
73
110
 
74
111
  const LATER_HELP = `run it later
75
- dibs later <res> --at 02:00 -- <cmd> schedule a run for a time (at most 7 days out); returns at once with its id
76
- dibs later <res> --in 3h -- <cmd> ...or a while from now
77
- dibs later <res> --after <what> -- <cmd> ...or when something ends: #42 on the board, an agent (web-app, or web-app:deploy
112
+ dibs later <res> --at 02:00 -m "..." -- <cmd> schedule a run for a time (at most 7 days out); returns at once with its id
113
+ dibs later <res> --in 3h -m "..." -- <cmd> ...or a while from now (-m is required, as for dibs run)
114
+ dibs later <res> --after <what> -m "..." -- <cmd>
115
+ ...or when something ends: #42 on the board, an agent (web-app, or web-app:deploy
78
116
  for its deploy), or an earlier later job (l3). --after-ok: only if it succeeded
79
117
  When due, it runs as dibs run --wait with your flags, in this folder, with PATH,
80
118
  HOME and LANG (more with --env NAME). Output: ~/.dibs/later/<id>.log
@@ -84,21 +122,65 @@ const LATER_HELP = `run it later
84
122
  const HELP_ALL = `dibs ${VERSION}: take turns on shared machine resources.
85
123
 
86
124
  get a turn
87
- dibs run <res>[,<res>] [flags] -- <cmd> wait for the resources, run cmd, release when it exits
88
- dibs run <res> --after #42 -- <cmd> ...but join the line only once job #42 has ended
89
- dibs hold <res> [--for 20m] keep a resource across several tool calls (max 1h); again to extend
125
+ dibs run <res>[,<res>] -m "<what and why>" [flags] -- <cmd>
126
+ wait for the resources, run cmd, release when it exits. -m is required: plain
127
+ words the person reads on the board and their phone, at least 3, not the command
128
+ ("run the login tests after fixing the redirect", not "npm test"); exit 2 without
129
+ dibs run <res> --after #42 -m "..." -- <cmd> ...but join the line only once job #42 has ended (also on hold). By number,
130
+ agent name, or the words a job was run with (--after "drift test"). The wait
131
+ counts against no time limit; the board shows it as "after #42". --after-ok:
132
+ only if it succeeded; if it failed or never ran, exit 75 and nothing runs
133
+ dibs hold <res> [--for 20m] -m "..." keep a resource across several tool calls (max 1h); again to extend (no -m needed)
90
134
  dibs release [<res>] give back your holds
91
- dibs hold 'files:src/auth/**' -m "why" keep other agents' edits off these paths (from the git root; * ** ?; quote it)
135
+ dibs hold 'files:src/auth/**' -m "..." keep other agents' edits off these paths (from the git root; * ** ?; quote it)
136
+
137
+ environments and accounts (env:staging, env:prod, account:asc: one holder per project, and each remembers what's on it)
138
+ dibs run env:staging -m "why" -- ./deploy.sh lease it like any resource; first you hear what the last holder left there
139
+ dibs env <name> left "deployed web@1a2b3c" say what you left there: during your turn, or just after it
140
+ dibs env [<name>] [--all] [--json] this project's environments (--all: every project's): who has each now, what's
141
+ on it, and its last turns. Without a note, a turn reads as its command and exit code
142
+ .dibs.json {"envs": {"staging": {"about": "https://staging.example.com"}, "prod": {"oneWay": "deploys reach users"}}}
143
+ names a project's environments (config.json "envs": every project's); once named, other
144
+ names are refused (exit 2, with the closest). oneWay: each
145
+ lease first asks the person (needs -m "why"); their no exits 78, and nothing ran
92
146
 
93
147
  ask without joining the queue
94
148
  dibs [--detail] the board: what each resource is doing and who's next (--detail: ids and numbers)
95
149
  dibs who <res> who holds it, until when, who's next
96
150
  dibs when <res>[,<res>] when you'd get it if you asked now
97
- dibs why [--detail] why you're waiting, in sentences (--detail: how your place was worked out)
98
- dibs mine [<res>] what you hold and wait for (exit 1 if nothing: "do I hold sim?")
151
+ dibs why [--detail] [--json] why you're waiting, in sentences (--detail: how your place was worked out)
152
+ dibs mine [<res>] [--json] what you hold and wait for (exit 1 if nothing: "do I hold sim?")
153
+ dibs jobs [--since 1h] [--json] every job here: running, paused, waiting, and those that ended lately with
154
+ their exit codes. The ids are what dibs stop, boost and pause take
155
+ dibs help json data instead of sentences: --json on dibs, why, mine, jobs, questions, threads,
156
+ disk and history, in one documented layout (schema 1). dibs run --json (or
157
+ DIBS_JSON=1): its end as one JSON line on stderr, after the end line
99
158
  dibs alerts [--json] [--all] what's wrong, each with its fix: long waits, memory holding work back, stuck or failed
100
159
  jobs, dibs's services and hook, a full disk. dibs alerts dismiss <id|all> closes one for a day
160
+ dibs doctor [--check] checks every state file parses and no lease or waiter is left from a process that
161
+ ended, and puts right what it can (a broken file from its last good copy); --check only looks
101
162
  dibs history [--since 7d] [--json] what happened: busy time, waits and who waited, by resource, agent and hour
163
+ dibs disk [--json] [--fresh] what fills the disk. First the biggest folders on the machine, dibs's or not (simulators,
164
+ agents' worktrees, swap, DerivedData, caches, Claude Code's temp folder): what each is, who
165
+ made it, when it was last used, whether it's safe to delete and the command. Merged worktrees
166
+ untouched for days are listed as likely removable. dibs deletes none of it. Measured at most
167
+ every 10 minutes (--fresh: now), a minute at most. Then each session's scratch folder and the
168
+ folders it marked, what grew lately, and each running session's share (an even split of
169
+ what's free above minDisk, or diskShare in config.json). Over it, or growing 1 GB between readings, its agent is told
170
+ dibs disk add <dir> [<dir>...] a folder your session made (a worktree, build output) that dibs deletes 30 minutes
171
+ after your session ends. Never in Claude Code's temp folder, ~/Library (but a
172
+ DerivedData folder), your home folder's own, or a repository's checkout (worktrees are fine)
173
+ dibs disk keep <dir> | dibs disk list don't delete it after all | what's marked, and what dibs deleted
174
+ dibs secret set|run|rules|list|log|revoke credentials agents use without seeing them: dibs secret run NAME -- <cmd> sets $NAME
175
+ for that command alone (dibs secret help)
176
+ dibs recap [--since 2h|09:00] [--json] what happened since your last look: tasks done and stuck, agents that stopped
177
+ mid-task, failed runs, decisions made without you, notes (an agent's look starts
178
+ 12h back and moves nothing)
179
+ dibs trail [--since 2h|09:00] [--agent <name>] [--json]
180
+ what agents did, as dibs saw it (not their words): commits, pushes, merges,
181
+ tags, releases, pull requests, App Store Connect uploads, test suites, deploys
182
+ dibs agents [--json] each agent in plain words: what it's for, what it needs from you, what blocks it,
183
+ what it's doing, its plan and what its runs meant ("Tests pass, 212 of 212")
102
184
  dibs stats [--json] waits against run times, today and the last 7 days: median and 90% by resource
103
185
  dibs stats --me | --agent <name> [--since 30d] [--json]
104
186
  per agent and resource: run and wait time, failures by exit code, what held
@@ -108,10 +190,66 @@ ${LATER_HELP}
108
190
 
109
191
  work with other agents
110
192
  dibs yield <agent> [<res>] let another agent go first (and release your hold on what they need)
193
+ dibs tell <agent> "..." --wait 5m a message, then wait for that agent's answer (dibs say --to you) and print only it;
194
+ exit 75: no answer in time (the message stays with them)
195
+ dibs who knows <path|words> [--all] [--json]
196
+ which agents know it, best first, and why: files they edited or read, file
197
+ leases, runs (dibs who knows "iOS build"), progress tasks, session titles and
198
+ branches. No model reads anything. Exit 1: nobody matched
199
+ dibs tell --who-knows <path|words> "..." [--wait 5m]
200
+ the same message dibs tell sends, to the best match that's still running
201
+ (listening first); it hears why it was picked. Exit 1: nobody fits, nothing sent
202
+ dibs tell --all "..." the same message to every agent running here (Claude Code sessions, their recent
203
+ subagents, and listeners outside Claude Code)
204
+ dibs handoff "title" [--to <agent>] [-m "context"]
205
+ hand a task to that agent, or to whichever agent on your project (dibs project) takes
206
+ it first. It hears it as a message; you hear when it's taken and when it's done
207
+ dibs handoff take|done|back|cancel <id> take one (w3); finish it (done w3 "what you did"); give it back ("why"): open to
208
+ any agent again; drop it. A taker whose session ends gives it back on its own
209
+ dibs handoff give <id> <agent> an open one is that agent's to take, and it hears it now
210
+ dibs handoff list [--all] [--json] open and taken handoffs (--all: closed ones too). A session that ends with work
211
+ open (its last post not --done, or a handoff it had taken) leaves a handoff
212
+ of it: what dibs knows (git state, its task and posts, questions, file leases),
213
+ offered to an agent listening in the same project, else shown to the person
214
+ dibs review request [<branch>|<from>..<to>] [-m "what to look at"] [--to <agent>] [--repo <dir>] [--pr <n>]
215
+ another agent reviews the change (no branch: the one checked out, against main).
216
+ dibs picks one running here that knows the area, never your own session; it hears
217
+ the request as a message from you, and you hear its answer the same way
218
+ dibs review approve|changes <id> "notes" answer a review you were asked for (r3); changes needs notes. Its author is told
219
+ dibs review list [--all] [--json] | dibs review cancel <id> | dibs review check [<branch>] (exit 0: approved, 1: not)
220
+ A repo whose .dibs.json says "reviewBeforeMerge": true gets its merges and pushes
221
+ into main turned away by the hook until that commit has an approving review
222
+
223
+ shared work (one item per job, claimed by one agent at a time; handoffs are items too, and h3 still means w3)
224
+ dibs work [list] [--takeable] [--all] [--json]
225
+ what's in flight: who has what, what's blocked and why, what's done and
226
+ its proof. Progress tasks show here too
227
+ dibs work add "title" [--goal "done when..."] [-m "context"] [--after w2,w5] [--files 'src/auth/**'] [--to <agent>]
228
+ work any agent can claim (--to: that one). --after: it can't be claimed until
229
+ those are done. --files: dibs work next skips it while another agent edits them.
230
+ It's for your project (--project <name> for another); --no-pickup: never offered
231
+ dibs project [<name>|off] [--json] which product you work on. Items and handoffs for anyone go only to agents on
232
+ the project of whoever made them; an agent on none is offered nothing
233
+ dibs work pickup [on|off] offer open items to agents listening with nothing on, on the item's project.
234
+ Unclaimed in 10 minutes, it goes to the next. Off unless turned on
235
+ dibs work next | claim <id> claim the oldest item you can take, or that one (exit 1: none, or taken)
236
+ dibs work done <id> ["what you did"] [--commit <sha>] [--url <url>] [--build <n>]
237
+ close it. dibs attaches proof it checked: your last dibs run that passed since
238
+ you claimed it, and your commit (HEAD if made since, or --commit, which must
239
+ exist). --url and --build are kept as your word. Shown as "done, proved by: ..."
240
+ or "done, no proof"
241
+ dibs work block <id> "why" [--after w7] | unblock <id> | back <id> ["why"] | drop <id> ["why"] | show <id> [--json]
242
+ dibs progress "..." --task w3 [--done|--blocked]
243
+ posts under an item's id are its log; --done closes it, --blocked blocks it
244
+ dibs halt [--for 7m|--until 14:30] -m "why" no new dibs job starts on this machine until then (no time: until lifted);
245
+ running ones go on. Every agent running here is told. dibs halt off lifts it;
246
+ dibs halt says whether one is on
111
247
  dibs ask "..." send a request or bug report to whoever maintains dibs
112
248
 
113
249
  ask the person (one-way doors only)
114
- dibs question "..." --recommend <option> -m why [--options a,b] [--one-way "what can't be undone"] [--wait]
250
+ dibs question "..." --recommend <option> -m why [--options a,b] [--one-way "what can't be undone"] [--for <person>] [--wait]
251
+ dibs question "..." --needs-you "sign in to GitHub in the bison tab" --options done,cant --recommend done -m why --wait
252
+ what only the person can do (a login, a captcha, a code on their phone) reaches them too
115
253
  without --one-way: decided at once with your recommendation (printed on
116
254
  stdout, logged, shown to the person as done). With it: queued for the person;
117
255
  --wait prints only the answer; --timeout 1m caps the wait (exit 75: no answer
@@ -119,10 +257,63 @@ ask the person (one-way doors only)
119
257
  dibs questions [--json] open questions first, by priority then age
120
258
  dibs answer <id> <text> answer one with an option or any words (words reach the asker as a message too)
121
259
  dibs questions dismiss <id> dismiss one; its waiting agent gets exit 75
260
+ A past decision that clearly matches, in this project, answers instead of the person
261
+ (stdout as an answer; one-way doors only from the person's own): --again asks anyway
262
+ dibs decide "use Postgres 16 for staging" -m why [--tags a,b] [--everywhere]
263
+ keep a decision for this project (or every project) for agents to look up
264
+ dibs decisions [--about words] [--project] [--all] [--json]
265
+ every answered question, two-way door and kept decision, closest first with --about;
266
+ --project: this folder's project only; --all: revoked ones too
267
+ dibs decisions revoke <id> [-m why] take one back: it's never cited again
122
268
  dibs hours [09:00-23:00|off] [--json] the person's hours: outside them, questions below urgent wait for morning
269
+ dibs question "..." --about testflight ... names the kind of question, so a standing rule about that kind can answer it
270
+ dibs rules [--json] the standing rules: each answers every question asked with its --about at once,
271
+ one-way doors too (never --needs-you; an agent's rule: two-way doors only), and says so to the asker and the person
272
+ dibs rules add --about <kind> --answer <a> [--if word,word] [--unless word] [--between 18:00-08:00|--after 18:00|--before 09:00] [-m why]
273
+ --if: every word in the question itself; --unless: none anywhere in it. Rules
274
+ that cover a question and disagree answer neither
275
+ dibs rules test "..." --about <kind> [--options a,b] [--one-way "..."] [--at 19:00]
276
+ would a rule answer it, and why each rule of that kind steps aside (exit 1: none would)
277
+ dibs rules remove <id> that kind of question goes the usual way again
278
+ dibs doors on|off [--json] opt-in, off by default: the guard turns away an agent's commands that can't be undone
279
+ (force pushes over main, production deploys, TestFlight and App Store uploads,
280
+ publishes, rm -r of home-level folders, DROP TABLE, purchases) until the person
281
+ answers yes to dibs question --about <kind>. dibs doors allow|block <kind>: standing
282
+ yeses (the person only); dibs doors check "<command>"; dibs doors help
283
+ dibs attention [<n>|off] [--json] phone notifications an hour at most (default 6). Past it, only urgent questions
284
+ buzz; the rest wait for the next batch, or the recap
285
+ dibs people [--json] who's here. With two or more, dibs says who asked, answered and sent each message
286
+ dibs people add|set <name> [--user <macOS user>] [--device <id>] [--hours 09:00-18:00|off] [--notify all|asks|off]
287
+ an agent's owner: DIBS_PERSON, else its project's .dibs.json ("owner": "sam"),
288
+ else the macOS user running it. dibs people remove <name>; dibs people me: whose you are
123
289
  dibs say "..." [--as label] [--to person] an FYI to the person in your thread: progress, done, blocked on X.
124
290
  --to person: a reply to what they said (the desk's answers); --to <agent>: a message to that agent,
125
291
  the same as dibs tell
292
+ dibs say|tell ... --file <f> --report <r.md> --link <path>
293
+ attach files (copied when sent, up to 25 MB each, 10 a message), a markdown
294
+ report, or a live file or folder on this Mac. The person opens them on the
295
+ page and the phone; an agent gets each one's path here. Key and password files are refused
296
+ dibs poll "question" --option A --option B [--multi] [--to <agent>]
297
+ a poll for the person (or that agent); every vote reaches you as a message
298
+ dibs poll vote <id> <option>... vote (again to change it); dibs poll results <id> [--json]; dibs poll close <id>
299
+ dibs pending [--mine] [--json] everything waiting on the person: open questions, polls, needs-you notes
300
+ (--mine: what you asked); dibs pending clear <id> dismisses one
301
+
302
+ money (the ledger is what agents and dibs record; dibs reads no bills)
303
+ dibs spend check <amount> --on <category> -m "why" [--project p] [--recommend yes|no] [--timeout 10m] [--no-wait]
304
+ before committing money: exit 0 within every cap that covers it. Over one, the
305
+ person decides (a one-way door only they can answer, waited for like question --wait): yes is exit 0,
306
+ anything else is printed and exits 78; no answer in time is 75
307
+ dibs spend <amount> --on <category> -m "what" [--project p] [--against s3]
308
+ record money as you commit it (the project is the repo's unless --project).
309
+ --against draws a payment from a hold. Prints its id (s4)
310
+ dibs spend hold <amount> --on <category> -m "what" [--for 30d]
311
+ a budget you're about to set: counts against caps until closed or --for runs out
312
+ dibs spend close <id> end a hold; what's left of it stops counting
313
+ dibs spend cap <amount|off> --per day|month [--on <category>] [--project p]
314
+ a cap on all spend, a category, a project or both; past 80% the person's phone hears
315
+ dibs spend [--since 30d] [--json] this month: caps, spend by project, agent and category, open holds, the latest
316
+ On-demand VMs record their own time (machines.ondemand "perHour" in config.json)
126
317
 
127
318
  progress (post as often as you commit)
128
319
  dibs progress "..." [--task <name>] [--eta 30m|17:30] [--done|--blocked]
@@ -130,6 +321,9 @@ progress (post as often as you commit)
130
321
  reads every post live; other agents read them too. Post at each step, not at the end
131
322
  dibs progress [--agent <name>] [-n 50] [--json] recent posts
132
323
  dibs progress list [--all] [--json] your session's open tasks (--all: every session's), owner, state, ETA, last post
324
+ dibs progress 40% | 1200/9000 ["what's counted"] [--job <id>]
325
+ from inside a long dibs run job (it sets DIBS_LEASE): how far along it is, so
326
+ the board and waiters see a time left. --job names the job from outside it
133
327
 
134
328
  the person's page and MCP server
135
329
  dibs web [--port 7421] [--bind <address>] every agent's jobs, tasks and posts at http://127.0.0.1:7421, and the same as
@@ -151,6 +345,9 @@ the person's page and MCP server
151
345
  dibs pair --remote [--allow-actions] a one-time QR code, and a code to type, to pair a phone or any browser with https://app.dibs.cc,
152
346
  end-to-end encrypted through the relay (dibs service install relay keeps it connected).
153
347
  It can only look unless --allow-actions; the hook and hours never change remotely
348
+ dibs pair --remote --allow-talk the same, and that phone may also message agents and answer their questions,
349
+ asking for Face ID every time; agents read it as the person via that phone
350
+ dibs pair --remote --for <person> (or dibs connect --phone --for <person>) the phone is that person's once it pairs (dibs people)
154
351
  dibs relay [--url wss://app.dibs.cc] the relay connection itself, in the foreground
155
352
  dibs relay mcp on|off let MCP clients (another Claude account's connectors) reach this Mac's read-only MCP at
156
353
  https://mcp.dibs.cc/mcp through the relay, signing in with a dibs pair code. Off by default
@@ -161,14 +358,20 @@ talk with your agents
161
358
  dibs tell <agent> "..." a message for that agent: it gets it with its next tool call, or as it
162
359
  finishes its turn (needs dibs guard install). From an agent, it says which agent sent it
163
360
  dibs tell desk "..." to the agent config.json names as "desk": it answers with dibs say --to person
164
- dibs listen [--for 30m] [--json] waits until a message, an answer or a notice is queued for you, prints all of it
165
- and exits 0; no time limit unless --for (exit 3: none in time), and it ends quietly
166
- with your session. Start it with run_in_background at the start of
361
+ dibs listen [--for 30m] [--json] waits until a message, an answer, a vote, work handed to you or a notice you should
362
+ act on is queued, gathers for a moment, prints all of it and exits 0; no time limit unless --for (exit 3:
363
+ none in time), and it ends quietly with your session. A dibs update doesn't end it,
364
+ and a second one waits behind the first instead of ending it. Start it with run_in_background at the start of
167
365
  a session and again each time it exits: its exit wakes you even while idle
366
+ dibs listen --stream the same, but it never exits for a message: one line per message, and it keeps
367
+ listening. For Claude Code's Monitor tool, where each line is a notification
368
+ dibs council "question" [--voices a,b] [--via claude,codex] [--mode merge|critique|debate]
369
+ ask several headless agents at once, each with its own system prompt and model,
370
+ and combine their answers with the disagreements kept (dibs council help)
168
371
 
169
372
  several machines
170
- dibs run <res> --anywhere -- <cmd> run it on whichever machine would start it soonest (maybe this one)
171
- dibs run <res> --on <machine> -- <cmd> run it on that machine
373
+ dibs run <res> --anywhere -m "..." -- <cmd> run it on whichever machine would start it soonest (maybe this one)
374
+ dibs run <res> --on <machine> -m "..." -- <cmd> run it on that machine
172
375
  dibs machines every machine, its load and line, and the jobs moving between them
173
376
  dibs serve be the coordinator (one machine does this); then dibs pair --machine or dibs invite <machine>
174
377
  dibs join <code> [--at <address>] join with a code from dibs pair --machine: finds the coordinator on this network
@@ -183,17 +386,19 @@ several machines
183
386
  dibs limit <machine> --sends test|none on the coordinator: the only jobs it may send to other machines
184
387
  .dibs.json {"stayOn": ["mini"]} at a project's root: the machines its code may go to (besides its own)
185
388
  dibs service install|remove|status [serve] [worker] [throttle] [web] [relay] start them at login and keep them up
186
- join, leave, invite, kick, limit, service, guard install/remove, pace, hours and cap go in the history with who ran them
389
+ join, leave, invite, kick, limit, service, guard install/remove, pace, hours, rules, attention and cap go in the history with who ran them
187
390
 
188
- priorities and pauses (ids are the #numbers on dibs --detail; anyone, person or agent, on any job; the board names who.
189
- An agent acting on a job that isn't its own adds --owner <session>, or session/agent, as the board names it)
391
+ priorities and pauses (ids are the #numbers beside each job on the board; anyone, person or agent, on any job, no --owner needed;
392
+ every answer names whose job it was, the history keeps who did it, and a stopped job's agent is told)
190
393
  dibs boost <id|agent> <prio> [-m why] change a waiter's or running job's priority: re-ranks it, and moves a run
191
394
  onto or off the efficiency cores (an agent name changes all its work).
192
395
  An agent raising a job to high or urgent passes -m, which everyone sees
193
396
  dibs pause <id> [--force] [-m why] freeze a running job where it stands; it keeps its lease (sim, xcode-build
194
397
  and deploy need --force: frozen midway they can fail)
195
398
  dibs resume <id> [-m why] continue a paused job
196
- dibs stop <id> [-m why] end a job and kill its processes, as a crash would; its agent is told
399
+ dibs stop your running and waiting jobs, with their numbers
400
+ dibs stop <id> [<id>...] [-m why] end a job, anyone's, and kill its processes, as a crash would; its agent is told
401
+ dibs stop <words> | mine your one job whose -m or command has those words; every job of yours
197
402
  dibs cap <agent> <prio|off> that agent's work never waits or runs above prio until off
198
403
 
199
404
  other
@@ -203,9 +408,11 @@ other
203
408
  dibs throttle [--watch] move CPU hogs running outside dibs to background priority when the machine is hot
204
409
  dibs setup scratch [--size 40G] print the one-time commands for a capped volume for build output (--check: how full)
205
410
  dibs changes what changed in recent versions
206
- dibs guard install|remove|status|check|serve a Claude Code hook that runs heavy commands through dibs when an agent forgets
411
+ dibs guard install|remove|status|check|serve a hook that runs heavy commands through dibs when an agent forgets,
412
+ in Claude Code, or --for codex, gemini, cursor or opencode (a plugin there)
207
413
  dibs init [--repo] [--remove] write dibs.md (the agent instructions) and a note pointing at it in ~/.claude/CLAUDE.md,
208
- ~/.codex/AGENTS.md and this repo's CLAUDE.md and AGENTS.md (install does it; --repo makes
414
+ ~/.codex/AGENTS.md, ~/.gemini/GEMINI.md, OpenCode's AGENTS.md and this repo's CLAUDE.md
415
+ and AGENTS.md, each tool's only where it's set up (install does it; --repo makes
209
416
  this repo's CLAUDE.md; --remove takes it all out; DIBS_NO_AGENT_NOTES=1 skips it)
210
417
 
211
418
  flags
@@ -216,7 +423,10 @@ flags
216
423
  normal (3) arrival order
217
424
  low (4) 10 min back nobody is waiting on it; runs at background priority
218
425
  idle (5) 60 min back only when nobody else waits; runs at background priority
219
- low and idle runs may be paused (not killed) for urgent or high work, or under memory pressure
426
+ low and idle runs may be paused (not killed) for urgent or high work, or under memory pressure;
427
+ any other job only with --pausable.
428
+ On macOS background priority slows a job's disk and its new network connections too, not just CPU:
429
+ an upload, download or deploy runs at -p normal
220
430
  --by 23:30|20m deadline: as it nears you move up the queue (up to an hour), and you're warned if it's at risk
221
431
  --est 5m how long the job takes, when dibs has no history for it. Short jobs move up a little
222
432
  --quick it takes under 15 s (quickUnder): it starts at once, past the line and full slots, at most 2 at a time.
@@ -224,8 +434,13 @@ flags
224
434
  first time; a run that goes over loses the pass until it runs under again. A command dibs has seen run
225
435
  under 15 s gets it without the flag
226
436
  --cost 3 tokens a quota:<name> job takes from its bucket (default 1)
227
- --mem 4G memory the job needs (default from the resource). dibs measures what it really uses
228
- and plans the next run at that when it's more
437
+ --mem 4G memory the job needs (default from the resource): a first guess. dibs measures what it
438
+ really uses, and once this command has run in this repo it plans at that peak plus a margin,
439
+ more or less than --mem
440
+ --pausable dibs run: this job is safe to pause, or to stop at its next checkpoint. Urgent or high work,
441
+ or work that has waited 20 min, may pause it for a slot (it resumes after), or for memory send
442
+ it SIGUSR1 ($DIBS_CHECKPOINT_SIGNAL): save your progress and exit 0, and dibs runs the same
443
+ command again behind that job. Not out in 2 min, it's ended. Never done to a job without it
229
444
  --cpu 2 cores the job keeps busy (default from the resource)
230
445
  --disk 10G free disk the job needs
231
446
  --port NAME put a free port in env NAME for the command (repeatable)
@@ -233,9 +448,11 @@ flags
233
448
  tool call that reaches its timeout to the background instead of killing it
234
449
  --max-wait 8m stop waiting after this with exit 75. The default (8m) everywhere else
235
450
  --no-wait don't wait at all
451
+ --time-limit 1h end the command if it runs longer than this, counted from when it starts, never the wait
452
+ in line (exit 124). Use this, not timeout(1) around dibs: that clock counts the wait too
236
453
  --notify <file> when dibs exits, append one JSON line to file: {"code", "started", "res", "cmd", ...}
237
454
  --as label a label shown next to your agent name (for subagents)
238
- --json machine-readable output (board, when, mine, requests, machines, history, questions, threads, hours, pace, guard status)
455
+ --json machine-readable output (board, when, mine, requests, machines, history, questions, threads, hours, rules, attention, pace, guard status)
239
456
  --anywhere send it to the least busy machine (see "several machines")
240
457
  --shards N split a playwright test, vitest or node --test run into N pieces across machines, output and exit codes merged.
241
458
  vitest and node --test suites that usually take over 5 minutes split in two on their own; --no-shard keeps one
@@ -247,26 +464,40 @@ Your place in the queue is your arrival time, moved by priority, a near deadline
247
464
  lease (like high). dibs why says which moved you; dibs why --detail shows the math.
248
465
 
249
466
  Agents are listed by session name, the same name SendMessage uses.
250
- Resources: sim, sim-own, xcode-build, playwright, test, deploy, heavy, or any name you make up (use the same one as others).
467
+ Resources: sim, sim-own, xcode-build, playwright, test, deploy, heavy, env:<name> and account:<name> (one per project),
468
+ or any name you make up (use the same one as others).
251
469
  quota:<name> is a rate limit shared by every script here (config.json "quotas": {"asc": {"per": "1h", "limit": 300}}):
252
470
  a job waits until its bucket has --cost tokens, so scripts calling one API wait instead of getting 429s.
253
471
  Subagents: with dibs guard installed, at most agents.slots (default 8) run at once across every Claude Code
254
472
  session here. A spawn past that is denied, unless the session has none running; wait for one of yours to finish.
255
473
  A profile is a name for a resource with its ports and sizes, set once in config.json "profiles":
256
- {"playwright:web": {"res": "playwright", "ports": ["WEB", "API"], "mem": "3G", "cpu": 2}}, then dibs run playwright:web -- <command>.
474
+ {"playwright:web": {"res": "playwright", "ports": ["WEB", "API"], "mem": "3G", "cpu": 2}}, then dibs run playwright:web -m "..." -- <command>.
257
475
  files:<path or glob> is a file lease: while you hold it, dibs guard turns away other sessions' edits and writes there.
258
476
  sim is the one shared booted simulator. sim-own boots a private one for your command: its udid is in $SIM, its name in $SIM_NAME.
259
477
  Exit codes: the command's own, or 75 gave up waiting (NOT a failure: your command never started; run the
260
- same command again within 2 minutes to keep your place), 74 this run can't fit on this disk even empty of
478
+ same command again within 2 minutes to keep your place; for dibs tell --wait and dibs question --wait: no answer in time;
479
+ for --after and --after-ok: the job it waited on never ran, or with --after-ok failed, so nothing ran: see to that job first), 74 this run can't fit on this disk even empty of
261
480
  other jobs, or its wait limit ran out on disk (low disk otherwise just means you wait),
262
481
  76 lost the coordinator or the other machine before the job started (safe to send again),
263
482
  77 lost it after the job started on another machine (it may have run: check before running it again),
264
- 127 command didn't start, 2 bad usage (also: you already have this exact command waiting or running),
265
- 1 nothing matched (mine, release), 3 dibs listen heard nothing in time, 70 dibs itself crashed (a bug in dibs; report it: dibs ask "...").
483
+ 78 refused, nothing ran: dibs secret run (a rule, or the person said no or an agent answered for them), dibs spend check
484
+ (over a cap and the person didn't say yes: don't spend it), a one-way environment such as env:prod the person said no to (don't retry), or dibs answer on a question only a person may answer,
485
+ 124 ran past its --time-limit and was stopped, 127 command didn't start, 2 bad usage (also: you already have this exact command waiting or running),
486
+ 1 nothing matched (mine, release, a handoff or work item already taken, dibs work next with nothing free, who knows, dibs review check with no approval), 3 dibs listen heard nothing in time, 70 dibs itself crashed (a bug in dibs; report it: dibs ask "...").
266
487
  A job sent to another machine takes the git working copy (tracked files plus new ones git doesn't ignore;
267
488
  outside git, the folder minus build output). .env files, keys and certificates never leave this machine.
268
489
  Config: ${paths.config}`;
269
490
 
491
+ // One topic of dibs help all, or null. A section runs to the next blank line; exit codes
492
+ // run from their own line to the paragraph after them.
493
+ function helpTopic(name) {
494
+ const head = TOPICS[TOPIC_ALIASES[name] || name];
495
+ if (!head) return null;
496
+ if (head === 'Exit codes:') return HELP_ALL.slice(HELP_ALL.indexOf(head), HELP_ALL.indexOf('\nA job sent to another machine'));
497
+ if (head === 'run it later') return LATER_HELP;
498
+ return HELP_ALL.split('\n\n').find(b => b.startsWith(head)) || null;
499
+ }
500
+
270
501
  function parse(argv) {
271
502
  const o = { res: [], cmd: null, ports: [], bring: [] };
272
503
  const dd = argv.indexOf('--');
@@ -278,6 +509,7 @@ function parse(argv) {
278
509
  else if (a === '--by') o.by = deadline(next());
279
510
  else if (a === '--est') o.est = ms(next());
280
511
  else if (a === '--quick') o.quick = true;
512
+ else if (a === '--pausable') o.pausable = true;
281
513
  else if (a === '--cost') { o.cost = Number(next()); if (!(o.cost > 0)) die('--cost takes a number of tokens above 0'); }
282
514
  else if (a === '--mem') o.mem = bytes(next());
283
515
  else if (a === '--cpu') { o.cpu = Number(next()); if (!(o.cpu >= 0)) die('--cpu takes a number of cores'); }
@@ -285,10 +517,14 @@ function parse(argv) {
285
517
  else if (a === '--max-wait') o.maxWait = ms(next());
286
518
  else if (a === '--no-wait') o.maxWait = 0;
287
519
  else if (a === '--wait') o.maxWait = Infinity;
520
+ else if (a === '--time-limit') { o.timeLimit = ms(next()); if (!(o.timeLimit > 0)) die('--time-limit takes how long the command may run once it starts, like --time-limit 1h'); }
521
+ // timeout(1)'s word, which agents reach for: its clock would count the wait in line too.
522
+ else if (a === '--timeout') die('dibs run has no --timeout. --time-limit 1h ends the command an hour after it starts (the wait in line never counts); --max-wait 10m limits the wait.');
288
523
  else if (a === '--notify') o.notify = next();
289
524
  else if (a === '--for') o.for = ms(next());
290
525
  else if (a === '--lease') o.lease = Number(next()); // src/thin.sh's, on its turn
291
526
  else if (a === '--after') o.after = next();
527
+ else if (a === '--after-ok') { o.after = next(); o.afterOk = true; }
292
528
  else if (a === '--since') o.since = next();
293
529
  else if (a === '--as') o.as = next();
294
530
  else if (a === '--port') o.ports.push(next());
@@ -317,8 +553,8 @@ function parse(argv) {
317
553
  return o;
318
554
  }
319
555
 
320
- // The first time each agent session runs a new version, one line pointing at
321
- // what changed. Only for an agent that ran an older one here: a brand-new
556
+ // The first time each agent session runs a new version, a few lines on what to do
557
+ // differently (src/news.mjs whatsNew), and dibs news for the rest. Only for an agent that ran an older one here: a brand-new
322
558
  // install, or a session that never ran dibs before, has nothing to compare.
323
559
  // Written to stderr, so it never lands in output a script reads.
324
560
  function announce() {
@@ -329,7 +565,7 @@ function announce() {
329
565
  // process hasn't been replaced by yet): nothing to say, and never move it back.
330
566
  if (before === VERSION || (before && newer(before, VERSION))) return;
331
567
  markSeen(key, VERSION);
332
- if (before) process.stderr.write(`dibs was updated to ${VERSION}: see \`dibs changes\`\n`);
568
+ if (before) process.stderr.write(`${whatsNew(before, VERSION).join('\n')}\n`);
333
569
  }
334
570
 
335
571
  // An npm install has no install script (the package runs none, by design), so the first
@@ -355,8 +591,8 @@ function notices() {
355
591
  const ALIASES = { done: 'release', renew: 'hold', news: 'changes', cool: 'throttle', ls: 'status', board: 'status' };
356
592
  const VERBS = new Set(['run', 'hold', 'release', 'when', 'why', 'mine', 'who', 'yield', 'ask', 'requests', 'port', 'throttle', 'changes', 'status', 'help',
357
593
  'machines', 'serve', 'join', 'leave', 'worker', 'service', 'invite', 'kick', 'limit', 'guard', 'sims', 'pace', 'setup', 'history', 'stats',
358
- 'question', 'questions', 'answer', 'hours', 'say', 'tell', 'threads', 'listen', 'boost', 'pause', 'resume', 'stop', 'cap', 'later',
359
- 'progress', 'web', 'pair', 'relay', 'connect', 'alerts', 'init']);
594
+ 'jobs', 'question', 'questions', 'answer', 'hours', 'say', 'tell', 'threads', 'listen', 'boost', 'pause', 'resume', 'stop', 'cap', 'later',
595
+ 'progress', 'web', 'pair', 'relay', 'connect', 'alerts', 'init', 'halt', 'handoff', 'council', 'recap', 'decide', 'decisions', 'trail', 'rules', 'attention', 'work', 'secret', 'people', 'project', 'spend', 'review', 'disk', 'env', 'agents', 'poll', 'pending', 'doctor', 'doors']);
360
596
 
361
597
  // A job sent from another machine ends when the worker that started it does,
362
598
  // even if the worker was killed outright and couldn't say so.
@@ -395,11 +631,20 @@ async function main() {
395
631
  if (verb === '--version' || verb === '-v' || verb === 'version') return console.log(VERSION);
396
632
  if (verb === '-h' || verb === '--help') verb = 'help';
397
633
  verb = ALIASES[verb] || verb;
398
- if (verb === 'help') return console.log(argv[1] === 'all' ? HELP_ALL : HELP);
634
+ // dibs help json: the documented --json layout, as docs/json.md has it.
635
+ if (verb === 'help' && argv[1] === 'json') return console.log(fs.readFileSync(path.join(ROOT, 'docs', 'json.md'), 'utf8').trimEnd());
636
+ if (verb === 'help') {
637
+ if (!argv[1]) return console.log(HELP);
638
+ if (argv[1] === 'all') return console.log(HELP_ALL);
639
+ const text = helpTopic(argv[1]);
640
+ if (!text) die(`no help topic ${argv[1]}. Topics: ${Object.keys(TOPICS).join(', ')}. Everything: dibs help all`);
641
+ return console.log(text);
642
+ }
399
643
  if (verb === 'changes') return console.log(changelog().slice(0, 3).map(c => `${c.version}\n${c.body}`).join('\n\n'));
400
644
  // The hook runs on every Bash call: no config file writes, no what's-new notice.
401
645
  if (verb === 'guard') {
402
- if (argv[1] === 'install' || argv[1] === 'remove') (await import('../src/owner.mjs')).logChange(`guard ${argv[1]}`);
646
+ const tools = argv.includes('--for') ? ` --for ${argv[argv.indexOf('--for') + 1]}` : '';
647
+ if (argv[1] === 'install' || argv[1] === 'remove') (await import('../src/owner.mjs')).logChange(`guard ${argv[1]}${tools}`);
403
648
  return (await lazy('guard')).guard(argv.slice(1));
404
649
  }
405
650
  // src/thin.sh's own calls, not commands anyone types (src/broker.mjs).
@@ -422,23 +667,36 @@ async function main() {
422
667
  // Services, jobs sent from another machine and scheduled ones have nobody to read the notes.
423
668
  // A thin waiter's turn has had them already, when it got in line.
424
669
  const lease = argv.slice(0, argv.indexOf('--') >>> 0).includes('--lease');
425
- if (!process.env.DIBS_REMOTE_JOB && !process.env.DIBS_LATER_JOB && !lease && !['serve', 'worker', 'service', 'relay', 'init'].includes(verb)) { announce(); notices(); }
426
- if (verb !== 'init') await npmNotes();
670
+ // dibs listen starts with every session, used or not: what's new waits for a call that uses dibs.
671
+ if (!process.env.DIBS_REMOTE_JOB && !process.env.DIBS_LATER_JOB && !lease && !['serve', 'worker', 'service', 'relay', 'init'].includes(verb)) {
672
+ if (verb !== 'listen') announce();
673
+ notices();
674
+ }
675
+ if (verb !== 'init') {
676
+ await npmNotes();
677
+ // Not a thin waiter getting in line: that start is kept lean, and the agent's other calls keep dibs.md.
678
+ if (!thin) (await lazy('notes')).keep();
679
+ }
427
680
  // `dibs sim -- cmd` (no verb) means run; a bare `dibs` or `dibs --json` is the board.
428
681
  // `dibs -m why sim -- cmd` is a run too: anything with a command after -- is.
429
682
  if (!verb || (verb.startsWith('-') && verb !== '--' && !argv.includes('--'))) return status(parse(argv), cfg);
430
- if (!VERBS.has(verb) && !argv.includes('--') && !cfg.resources[verb] && !isFiles(verb) && !isQuota(verb)) {
683
+ if (!VERBS.has(verb) && !argv.includes('--') && !cfg.resources[verb] && !isFiles(verb) && !isQuota(verb) && !isEnv(verb)) {
431
684
  // `dibs list`, `dibs stauts`: a command that doesn't exist, not a run missing its --.
432
685
  const near = nearest(verb, [...VERBS, ...Object.keys(ALIASES)]);
433
- die(`unknown command ${verb}.${near ? ` Did you mean dibs ${near}?` : ''} Commands: dibs help. To run something: dibs run <resource> -- <command>`);
686
+ die(`unknown command ${verb}.${near ? ` Did you mean dibs ${near}?` : ''} Commands: dibs help. To run something: dibs run <resource> -m "..." -- <command>`);
434
687
  }
435
688
  const rest = VERBS.has(verb) ? argv.slice(1) : argv;
436
689
  if (!VERBS.has(verb)) verb = 'run';
437
690
  switch (verb) {
438
691
  case 'run': {
439
692
  const o = profiled(parse(rest), cfg);
693
+ // Plain words for the person, before anything gets in line, here or on another machine.
694
+ // A script's dibs run inside a run of its own (DIBS_LEASE) goes under that run's words.
695
+ // Without a resource or a command, the usage error that says so comes first.
696
+ if (o.res.length && o.cmd?.length && !(process.env.DIBS_LEASE && outerLease())) requireDeclaration(o, 'run', ['run', ...rest]);
440
697
  if (o.bring.length && !o.anywhere && !o.on) die('--bring only means something with --anywhere or --on');
441
698
  if ((o.anywhere || o.on) && o.res.some(isFiles)) die("file leases cover this machine's files. Take them here (dibs hold files:...), then send the job without them");
699
+ if ((o.anywhere || o.on) && o.res.some(isEnv)) die(`${o.res.filter(isEnv).join(', ')} is leased on this machine, where its history is, so it can't go with a job to another. Run it here: dibs run ${o.res.join(',')} -- <command>`);
442
700
  if (o.after && (o.anywhere || o.on)) die('--after works for a run on this machine; for another, use dibs later --after');
443
701
  checkNames(o.res, cfg);
444
702
  const shards = await shardsFor(o, cfg);
@@ -462,12 +720,21 @@ async function main() {
462
720
  case 'leave': return (await lazy('admin')).leave();
463
721
  case 'limit': return (await lazy('admin')).limit(parse(rest));
464
722
  case 'service': return (await lazy('service')).service(rest);
465
- case 'hold': { const o = profiled(parse(rest), cfg); if (o.notify || o.after) die(`${o.notify ? '--notify' : '--after'} works with dibs run`); checkNames(o.res, cfg); o.thin = thin; return hold(o, cfg); }
723
+ case 'hold': {
724
+ const o = profiled(parse(rest), cfg); o.typed = ['hold', ...rest];
725
+ if (o.notify) die('--notify works with dibs run');
726
+ checkNames(o.res, cfg);
727
+ // --after waits outside the line, in Node.
728
+ if (o.after && thin) { if (thin.inline) thin = null; else return thin.fat(); }
729
+ o.thin = thin;
730
+ return hold(o, cfg);
731
+ }
466
732
  case 'release': return release(parse(rest));
467
733
  case 'when': { const o = profiled(parse(rest), cfg); checkNames(o.res, cfg); return when(o, cfg); }
468
734
  case 'why': return why(parse(rest), cfg);
469
735
  case 'mine': return mine(parse(rest), cfg);
470
- case 'who': return who(parse(rest), cfg);
736
+ case 'jobs': return jobs(parse(rest), cfg);
737
+ case 'who': return rest[0] === 'knows' ? (await lazy('route')).whoKnows(rest.slice(1)) : who(parse(rest), cfg);
471
738
  case 'yield': return yieldTo(parse(rest));
472
739
  case 'ask': return ask(rest, cfg);
473
740
  case 'requests': return requests(parse(rest));
@@ -480,10 +747,17 @@ async function main() {
480
747
  case 'history': return (await lazy('history')).history(parse(rest), cfg);
481
748
  case 'stats': return (await lazy('stats')).stats(rest, cfg);
482
749
  case 'alerts': return (await lazy('alerts')).alerts(rest, cfg);
750
+ case 'doctor': return (await lazy('doctor')).doctor(rest);
483
751
  case 'question': return question(rest, cfg);
484
752
  case 'questions': return questions(rest, cfg);
485
753
  case 'answer': return answer(rest);
486
754
  case 'hours': return hoursCmd(rest, cfg);
755
+ case 'decide': return (await lazy('decisions')).decide(rest);
756
+ case 'decisions': return (await lazy('decisions')).decisions(rest);
757
+ case 'attention': return attentionCmd(rest, cfg);
758
+ case 'rules': return (await lazy('rules')).rulesCmd(rest);
759
+ case 'doors': return (await lazy('doors')).doors(rest);
760
+ case 'people': return (await lazy('people')).peopleCmd(rest);
487
761
  case 'say': return say(rest);
488
762
  case 'progress': return (await lazy('progress')).post(rest);
489
763
  case 'web': return (await lazy('web')).web(rest);
@@ -492,8 +766,23 @@ async function main() {
492
766
  case 'init': return (await lazy('notes')).init(rest);
493
767
  case 'relay': return (await lazy('relay')).relay(rest);
494
768
  case 'tell': return tell(rest);
769
+ case 'poll': return poll(rest);
770
+ case 'pending': return pending(rest);
771
+ case 'halt': return (await lazy('halt')).halt(rest);
772
+ case 'handoff': return (await lazy('handoffs')).handoff(rest);
773
+ case 'work': return (await lazy('work')).work(rest);
774
+ case 'council': return (await lazy('council')).council(rest);
775
+ case 'recap': return (await lazy('recap')).recap(rest);
776
+ case 'trail': return (await lazy('trail')).trail(rest);
777
+ case 'secret': return (await lazy('vault')).secret(rest);
778
+ case 'spend': return (await lazy('spend')).spend(rest);
779
+ case 'review': return (await lazy('reviews')).review(rest);
780
+ case 'disk': return (await lazy('diskuse')).disk(rest);
781
+ case 'env': return (await lazy('envs')).env(rest);
782
+ case 'agents': return (await lazy('picture')).agents(rest);
495
783
  case 'threads': return threads(rest);
496
784
  case 'listen': return listen(rest);
785
+ case 'project': return project(rest);
497
786
  case 'boost': return boost(rest, cfg);
498
787
  case 'pause': return pause(rest, cfg);
499
788
  case 'resume': return resume(rest);
@@ -512,15 +801,23 @@ async function readOne(argv) {
512
801
  const only = (...want) => rest.length === want.length && want.every((w, i) => (w instanceof RegExp ? w.test(rest[i]) : w === rest[i]));
513
802
  if (verb === '--version' && !rest.length) return console.log(VERSION);
514
803
  if (verb === '--json' && !rest.length) return status(parse(argv), cfg);
804
+ if (verb === 'jobs' && only('--json')) return jobs(parse(rest), cfg);
515
805
  if (verb === 'questions' && only('--json')) return questions(rest, cfg);
516
806
  if (verb === 'threads' && only('--json')) return threads(rest);
517
807
  if (verb === 'progress' && (only('--json') || only('--json', '-n', COUNT))) return (await lazy('progress')).post(rest);
518
808
  if (verb === 'later' && only('list', '--json')) return later(rest, cfg, parse);
809
+ if (verb === 'work' && (only('list', '--json') || only('list', '--all', '--json'))) return (await lazy('work')).work(rest);
810
+ if (verb === 'spend' && only('--json')) return (await lazy('spend')).spend(rest);
811
+ if (verb === 'recap' && (only('--json') || only('--json', '--since', /^\d+[mhd]$/))) return (await lazy('recap')).recap(rest);
812
+ if (verb === 'trail' && (only('--json') || only('--json', '--since', /^\d+[mhd]$/))) return (await lazy('trail')).trail(rest);
519
813
  if (verb === 'history' && only('--json', '--since', /^\d+[mhd]$/)) return (await lazy('history')).history(parse(rest), cfg);
520
814
  if (verb === 'stats' && rest[0] === '--json' && (only('--json', '--since', /^\d+[mhd]$/) || only('--json', '--since', /^\d+[mhd]$/, '--agent', /^[^-]/)))
521
815
  return (await lazy('stats')).stats(rest, cfg);
522
816
  if (verb === 'guard' && only('status', '--json')) return (await lazy('guard')).guard(rest);
523
817
  if (verb === 'pace' && only('--json')) return pace(rest);
818
+ if (verb === 'rules' && only('--json')) return (await lazy('rules')).rulesCmd(rest);
819
+ if (verb === 'attention' && only('--json')) return attentionCmd(rest, cfg);
820
+ if (verb === 'env' && only('--all', '--json')) return (await lazy('envs')).env(rest);
524
821
  if (verb === 'pair' && only('--list')) return (await lazy('web')).pair(rest);
525
822
  if (verb === 'connect' && only('--accounts', '--json')) return (await lazy('connect')).connect(rest);
526
823
  if (verb === 'service' && rest[0] === 'status' && rest.slice(1).every(k => /^[a-z]+$/.test(k))) return (await lazy('service')).service(rest);