@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.
- package/CHANGELOG.md +594 -0
- package/LICENSE +670 -0
- package/README.md +85 -2
- package/bin/dibs-guard.mjs +7 -0
- package/bin/dibs.mjs +548 -0
- package/docs/benchmarks.md +193 -0
- package/docs/files.md +30 -0
- package/docs/guard.md +91 -0
- package/docs/later.md +43 -0
- package/docs/machines.md +147 -0
- package/docs/questions.md +78 -0
- package/docs/reference.md +157 -0
- package/docs/relay.md +196 -0
- package/docs/releasing.md +27 -0
- package/docs/scheduling.md +163 -0
- package/docs/simulators.md +17 -0
- package/package.json +45 -4
- package/skills/dibs/SKILL.md +183 -0
- package/src/acquire.mjs +700 -0
- package/src/admin.mjs +145 -0
- package/src/agents.mjs +145 -0
- package/src/alerts.mjs +499 -0
- package/src/answers.mjs +65 -0
- package/src/board.mjs +202 -0
- package/src/broker.mjs +369 -0
- package/src/commands.mjs +810 -0
- package/src/config.mjs +324 -0
- package/src/connect.mjs +106 -0
- package/src/cool.mjs +160 -0
- package/src/diskwarn.mjs +154 -0
- package/src/events.mjs +96 -0
- package/src/files.mjs +1123 -0
- package/src/guard.mjs +613 -0
- package/src/history.mjs +247 -0
- package/src/hogs.mjs +227 -0
- package/src/later.mjs +487 -0
- package/src/measure.mjs +262 -0
- package/src/news.mjs +101 -0
- package/src/nodecheck.mjs +17 -0
- package/src/notes.mjs +171 -0
- package/src/notices.mjs +160 -0
- package/src/ondemand.mjs +572 -0
- package/src/overlap.mjs +151 -0
- package/src/override.mjs +360 -0
- package/src/owner.mjs +30 -0
- package/src/plain.mjs +470 -0
- package/src/platform.mjs +357 -0
- package/src/preempt.mjs +438 -0
- package/src/primer.mjs +89 -0
- package/src/proc.mjs +99 -0
- package/src/progress.mjs +187 -0
- package/src/qr.mjs +204 -0
- package/src/questions.mjs +389 -0
- package/src/quota.mjs +81 -0
- package/src/reads.mjs +54 -0
- package/src/relay.mjs +779 -0
- package/src/remote.mjs +584 -0
- package/src/reset.mjs +127 -0
- package/src/schedule.mjs +1020 -0
- package/src/scratch.mjs +61 -0
- package/src/serve.mjs +742 -0
- package/src/service.mjs +221 -0
- package/src/shard.mjs +59 -0
- package/src/simctl.mjs +42 -0
- package/src/simpool.mjs +258 -0
- package/src/state.mjs +201 -0
- package/src/stats.mjs +328 -0
- package/src/style.mjs +44 -0
- package/src/talk.mjs +702 -0
- package/src/thin.sh +130 -0
- package/src/trust.mjs +152 -0
- package/src/util.mjs +184 -0
- package/src/version.mjs +2 -0
- package/src/web.mjs +1119 -0
- package/src/worker.mjs +318 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# How dibs decides, and what it promises
|
|
2
|
+
|
|
3
|
+
The README covers using dibs. This is the detail: who goes next, what a lease guarantees, and the knobs that pause, pace and reset work.
|
|
4
|
+
|
|
5
|
+
## How a turn is decided
|
|
6
|
+
|
|
7
|
+
A waiter starts when all of these hold:
|
|
8
|
+
|
|
9
|
+
1. **Each resource it names has a free slot**, or the machine has room for one more on top (see "Running side by side" below).
|
|
10
|
+
2. **Nobody ahead of it in line wants the same resource and could use it.** Your own session's hold on a resource covers your runs on it, and so does the `dibs run` you're nested in. "Ahead" means arrival time, shifted by: its run time (what its command has taken, the median of its last ten runs, or `--est` until dibs has seen it, or 2 minutes for one never seen: shorter than 2 minutes moves it up, longer moves it back by the difference, an hour at most, so a 30-second check goes ahead of a 20-minute suite that arrived up to about 19 minutes before it, and no job waits behind quicker work much longer than it runs), heavy use of the same resources by the same agent in the last hour (5 minutes of use costs a minute, up to 10 minutes back, for fair share: an hour of test runs doesn't cost you your turn on the simulator), and priority (`urgent` +2 hours, `high` +1 hour, `normal` 0, `low` -10 minutes, `idle` -60: a high job goes ahead of a normal one unless that has waited an hour longer. `low` and `idle` run at background priority, and `idle` starts only when nobody else is waiting) and by a deadline that's getting close (`--by`: once slack drops under 20 minutes, you move up, by at most an hour). Every shift is bounded, so nobody waits forever. **The quick lane:** a command that takes under `quickUnder` (15 seconds unless set; the middle of its last ten runs, or `--quick` or an `--est` that short before dibs has seen it) starts at once: past the line, the slots of shared and pool resources, warning memory pressure, swap and the load ceiling. The disk floor, critical pressure, file leases and someone else's hold still stop it, and it never pauses anyone. At most 2 run at once. On an exclusive resource it goes to the front of the line instead of alongside, unless the resource says `quickAlongside: "other-repo"` (deploys do) and every job on it is another repo's. A run that goes over `quickUnder` loses the pass for its command until a run comes in under again. The board marks these `quick`. **Pairs that slow each other:** dibs compares each command's runs that spent most of their time beside a kind of work (a resource) with its runs that didn't. If it has taken 1.8 times as long or more beside work running now (three runs of each to go on), or makes that job take that long, it waits for that job to finish, but never longer than its own usual run time since it joined (`blocked by together`). **Backfill:** you may pass someone who can't start yet anyway, if you'll be done before they could have started.
|
|
11
|
+
3. **It fits the budgets.** What jobs book never adds up past the memory budget (8 GB by default), whatever the machine looks like: nothing starts past it. Memory counts what each job was handed (asked for, or raised to what its command has used), or what its whole process tree was last measured using when that's more: a job that outgrows its number still fills the machine. **Booked at what it uses:** a run measured for 3 minutes books its peak so far plus 1 GB instead of its ask, never more than its ask. Once its memory has stopped climbing for 2 minutes, it books what it uses now plus 1 GB, or only what it uses once it has been idle 5 minutes. The gap between asks and use goes to waiters, but a waiter let into it (one that wouldn't fit if every running job used its full ask) also needs the machine to show the room: memory pressure normal, swap not growing, and the job plus 3 GB (or a fifth of the machine's memory, if that's more) free by the OS's reading (`kern.memorystatus_level` on macOS, MemAvailable on Linux). So a job that spikes later can't push the machine into swap. Past the booking too: when what running jobs measure using right now, plus the job, fits the budget and the machine shows that same room, it starts; bookings keep a job's peak for minutes after it falls. Swap that's high but holding still doesn't count against that room; only growing swap and memory pressure do. Cores count what each running job was last measured using (every 10 seconds), and what it asked for until its first measurement: suites and builds ask for their peak and spend most of a run under it, and a few too many busy cores only slows everyone a little, so on a quiet machine the CPU budget steps aside. A job as big as the whole budget runs when nothing else is; your own holds and file leases don't count as something else. A run inside your own hold (or nested in your `dibs run`) uses the memory that hold reserved, so the two count once: at the larger of what the hold reserved and what the runs inside it use. Paused jobs keep their memory but take no cores.
|
|
12
|
+
4. **The machine can take it.** Free disk covers the job's need and stays above `minDisk` (5G): below that nothing starts, `urgent` work and runs inside your own hold included. The machine isn't short on memory right now: while the OS reports memory pressure at warning or critical, or swap is over `maxSwap` (4G), grew by more than 512 MB in the last 5 minutes and is still growing over the last minute and a half, work below `urgent` waits while anything else is running. The OS's free-memory reading counts compressed and cached memory as free and can say 60% while the Mac pages gigabytes to disk, and on macOS swap grows on the startup disk. Swap alone doesn't count: macOS keeps it allocated for hours after a crunch ends. dibs keeps a swap reading every 30 seconds in `~/.dibs/swap.json` to see the growth. With nothing else running, one job starts, since waiting can't help then. `"maxSwap": null` turns the swap check off; memory pressure still counts. Swap needs free disk to grow into, so while swap is growing or memory pressure is above normal, work below `urgent` also keeps `swapRoom` (3G) free on top of what it needs (8 GB with the stock `minDisk`), and while free disk falls more than 3 GB in 5 minutes, fast enough to be under that within 10 minutes, it waits for it to hold steady (a disk with plenty free that two builds are writing to holds nobody up); in both cases one job still starts with nothing else running. If the swap, pressure and disk-for-swap waits keep every job out for 10 minutes, counting only starts that went through them (not runs inside your own hold, not urgent work), the smallest and shortest waiter they hold back starts anyway, one at a time until its memory has held steady for 2 minutes, while free disk is over `minDisk` and pressure isn't critical. `"swapRoom": null` turns the room off, and `"minDisk": null` the floor. For jobs of 2 GB or more, the OS also reports at least 15% of memory free. If free disk can't be read, the board says `disk unknown` and `dibs run` says the disk check is off.
|
|
13
|
+
5. **The load is under the ceiling**, when there is one (`maxLoad`, set by `dibs pace`). `urgent` and `high` work skips this rule, and so does work that already holds a lease (below).
|
|
14
|
+
6. **The last user's `onRelease` has finished** putting the resource back.
|
|
15
|
+
7. **A quota has the tokens**, for `quota:<name>` (below).
|
|
16
|
+
|
|
17
|
+
File leases (`files:<path>`) skip rules 3 to 5: holding a path runs nothing. See [files.md](files.md).
|
|
18
|
+
|
|
19
|
+
**Bigger than the machine.** A job that asks for more memory or cores than the budgets hand out at once (`--mem 12G` with an 8G budget, `--cpu 9` with 6 cores) could never start, so `dibs run` and `dibs hold` refuse it at once with exit 2 and the most it can ask for here. Only a number you typed does that: a size dibs chose (the resource's default, or one learned from runs on a bigger machine) is booked at the most this machine hands out, and the job runs. In a group of machines it also names the ones it would fit (`--on <machine>`, or `--anywhere`). A waiter that stops fitting while it waits (the budget was lowered) leaves the line the same way, and its agent hears why through the hook.
|
|
20
|
+
|
|
21
|
+
**Waiting long on the budget.** A waiter held back by the memory or CPU budget for more than `starveAfter` (3 minutes) goes ahead of lighter jobs that would otherwise keep passing it, but only of those that would delay it: dibs works out when enough of what's booked will really end for it to fit (a job already past its usual time counts as running as long again, not as ending in 30 seconds), and a job that will be done before then still starts. A waiter that needs three quarters of the budget or more reserves it only once it could start within 5 minutes; further off, it waits for a quiet moment and other jobs start meanwhile. High and urgent work never waits behind a lower-priority job's reservation. A job that usually uses more than the whole budget goes to an on-demand machine at once when one can take it (docs/machines.md). A job whose run time dibs knows (`--est`, or history) starts past a waiter reserving memory when that waiter's own start rests on a job of unknown length (no `--est`, no history, a hold, or one past its time), as long as it fits now: that start is only a guess.
|
|
22
|
+
|
|
23
|
+
Run times come from history (the median of the last 10 runs of the same command on the same resources), or `--est`, or a 5-minute guess. The same command means the same program and its first three words that aren't flags, each cut to its last path part (`npm run lint`, `node run.mjs` from any folder). For `xcodebuild` it's the first such word, the scheme, the configuration and the action, so a 20-second incremental build and a 7-minute archive of one project learn apart. History written by 0.0.74 and earlier kept only the first word; it counts for a command until the command has history of its own.
|
|
24
|
+
|
|
25
|
+
## What it guarantees
|
|
26
|
+
|
|
27
|
+
- **A lease belongs to a process, not a clock.** `dibs <res> -- cmd` holds until `cmd` exits, however long that takes. No keepalives, and no expiry stealing a live run.
|
|
28
|
+
- **Crashes clean up.** The command runs in its own process group, and children that split off into their own group (browsers, dev servers) are noted every 3 seconds while it runs. When it exits, or dibs is killed, all of them are killed and the slot frees. After a `kill -9`, a small watcher each run leaves behind does it within a second or two; a group that split off in the last 3 seconds before the kill is left to the next dibs call that reads the state. A group whose number was reused by another program is left alone. If the process table can't be read (spawn failures under memory pressure), nothing is reaped until it can. Pids are checked against their start time, so a recycled pid can't pose as a live holder.
|
|
29
|
+
- **Signals pass through.** Ctrl-C or SIGTERM to dibs reaches the command.
|
|
30
|
+
- **Holds end on their own.** `dibs hold` belongs to the Claude session that took it, and ends when that session dies, at `--for` (max 1 hour), or on `dibs release`.
|
|
31
|
+
- **Waiting is never blind.** The board says in a sentence what each line is doing and who's next (`Simulator: onboarding is using it, about 4 min left. Next: ios-checkout.`), and `dibs why` says where you are, when you start and what you're waiting for. A start time is "about N min" only when every job in the way has a run time from history or `--est`; otherwise it's "as soon as X finishes", or unknown when the wait is on the machine (disk, memory, load). `dibs --detail` rows say which rule stops each waiter (`[blocked by slot: xcode-build]`, `[blocked by files: src/auth/**]`, `[blocked by disk: 8.8G free, needs 10G]`, `[behind web-app]`). While you wait, dibs says once where you are, when you start, what you're waiting for, who to message to go first and when the wait gives up; after that, one line when your place or the reason changes, and otherwise every 2 minutes. When it gives up (exit 75) it prints the exact command that keeps your place.
|
|
32
|
+
- **Waiting ends when your turn comes, not at a deadline you didn't pick.** Inside Claude Code, `dibs run` and `dibs hold` wait as long as it takes: Claude Code doesn't kill a Bash command at its timeout, it moves it to the background and tells the agent when it exits, output and all. So don't run it again after the move; a second copy would run the command twice. dibs knows it's there from `CLAUDE_CODE_CHILD_SESSION=1`, which Claude Code sets only in its own tool calls, and goes back to a limit when background tasks are off (`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1`, or bare mode via `CLAUDE_CODE_SIMPLE=1`). Everywhere else (Codex, scripts, a terminal) dibs gives up at `--max-wait` (8m), which fits a 10-minute tool call. `--wait` lifts the limit anywhere; put it in a background shell if your tool call has a time limit of its own.
|
|
33
|
+
- **Exit 75 is not a failure.** It means your command never started because dibs stopped waiting in line. Your place is kept for 2 minutes: the exact same command again (same session, resources and command; flags may differ) picks it up where it was.
|
|
34
|
+
- **`--notify <file>` says when it's over.** When dibs exits, for any reason, it appends one JSON line to the file: `{"at", "code", "started", "res", "cmd", "cwd", "secs", "pid"}`. `started` is false when the command never ran (exit 75, exit 74 before launch, a bad simulator), true once dibs had recorded it and started it, and null for a job sent to another machine. Give each job its own file and wait for it to fill (`until [ -s build.done ]; do sleep 5; done`, or a Monitor tool) instead of polling the board. A `kill -9` writes nothing. Inside Claude Code you rarely need it: a background Bash call already wakes the agent when it ends.
|
|
35
|
+
- **Random ports.** `--port NAME` puts a free port in `$NAME`, so two Playwright runs never fight over 4173.
|
|
36
|
+
- **Nesting works.** A script running under `dibs run sim` that calls `dibs run sim` itself goes straight ahead instead of queueing behind its own lease. One that needs more than its lease has (`dibs run deploy -- ./ship.sh`, which runs `dibs run xcode-build`) waits only for the rest, and goes ahead of waiters that hold nothing (10 minutes, less than `high`'s hour): it passes the load ceiling, but never jumps `high` or `urgent` work or pauses anyone's job. The board shows `[holds deploy, goes first]`. A session's own `dibs hold` counts the same way for its first 10 minutes. A lease on a resource that isn't configured, a run at `low` or `idle`, or a wait asked for with `-p low` doesn't count. `DIBS_LEASE` counts only when that lease's process is really an ancestor of the caller.
|
|
37
|
+
- **Something always runs.** dibs never leaves every job paused. Each pause it makes on its own (for urgent work, memory pressure or low disk) is refused if it would leave no job running, counting a run nested in a paused one as paused too. If every running job is paused anyway, because the one still going ended, the next dibs call that changes the state (and the watcher every 10 seconds) resumes the paused job closest to done, and `~/.dibs/cool.log` says so. dibs also never pauses a job about to finish: under 2 minutes left, or in the last tenth of its usual run. With nothing running at all, a small job (2 GB or less) that's urgent or known to take under 2 minutes may start past memory the paused jobs and idle holds still book, unless memory pressure is critical. Only the person's own `dibs pause` may leave every job paused. A job dibs stops and requeues for the disk (below) isn't paused: it gives back all its memory, so stopping it may leave nothing running, and that's meant.
|
|
38
|
+
- **Agents know each other by name.** dibs reads the Claude session name from `~/.claude/sessions`, the same name `SendMessage` uses.
|
|
39
|
+
|
|
40
|
+
Exit codes: the command's own, or 75 gave up waiting in line (not a failure: the command never started), 1 nothing matched (`mine`, `release`), 74 not enough disk with nothing running that would free it, 76 lost the coordinator or the other machine before a remote job started (safe to send again), 77 lost it after the job started (it may have run: check first), 127 the command didn't start, 2 bad usage (including a resource name close to a real one, an agent's high or urgent `dibs boost` without `-m`, and a `dibs run` you already have waiting or running), 70 dibs itself crashed (a bug in dibs; report it with `dibs ask`).
|
|
41
|
+
|
|
42
|
+
## Measuring what jobs use
|
|
43
|
+
|
|
44
|
+
`--mem` and `--cpu` (or the resource's defaults) are guesses, and macOS can't cap a process tree without root. So instead of a cage, dibs keeps the numbers honest. While anything runs, one `dibs run` every 10 seconds measures every running lease: physical footprint and CPU over all its process groups, plus a pool simulator's own processes, which run outside the job. A run nested in another is counted once, as itself. The peak goes into history with the run time, and the next run of the same command is planned at the most any of its last 5 measured runs used, when that's more than it asked for. Failed and killed runs count. A command never measured goes by its family: the same resources, program and next word, so `npx playwright test b.spec.ts` learns from `a.spec.ts`, while `npm run lint` learns nothing from `npm run build`. `dibs run` and `dibs when` say so (`xcodebuild build used up to 6.1 GB of memory (it asks for 4.0 GB) in recent runs, so dibs plans for that.`). A command that has used more than the whole memory budget is planned at the budget instead, so it starts once the budget is empty rather than once the machine has no leases at all. `dibs run` says it (`usually uses up to 14 GB of memory, more than the 11 GB dibs shares out at once, so dibs plans it at all 11 GB: it starts when no other job is using that memory.`), the plain board says the waiter is waiting for `all the memory dibs shares out to be free`, and `dibs --detail` marks it `[usually uses ~14G; planned at the 11G budget]`. History is kept per command shape (the program and up to three bare words; xcodebuild by scheme, configuration and action), so a build and a test of one project learn apart.
|
|
45
|
+
|
|
46
|
+
The board flags a running job past what it was handed by more than 10%: `[over: using 6.0G of 4.0G]`. Under memory pressure, the job furthest over is paused first (see below). Ask for what you need with `--mem` and `--cpu`.
|
|
47
|
+
|
|
48
|
+
**Linux.** With `"enforce": true` in config.json, each job runs in a `systemd-run --user --scope` with `MemoryHigh` and `CPUQuota` at its numbers: it's throttled past them, never killed. Where systemd user sessions don't work (containers, WSL1), jobs run as before.
|
|
49
|
+
|
|
50
|
+
**A capped scratch volume (macOS).** `dibs setup scratch [--size 40G]` prints the admin commands that make an APFS volume with a quota for build output, so a runaway build fills its own space instead of the disk every agent shares. dibs runs none of them. `dibs setup scratch --check` says how full it is.
|
|
51
|
+
|
|
52
|
+
## Rate-limit quotas
|
|
53
|
+
|
|
54
|
+
`quota:<name>` shares an API's rate limit between scripts, so they wait their turn instead of getting 429s:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
"quotas": { "asc": { "per": "1h", "limit": 300 } }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
dibs run quota:asc --cost 3 -- ./upload-screenshots.sh # takes 3 tokens when it starts
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
A bucket holds at most `limit` tokens and refills `limit` every `per`, smoothly. A job waits until its bucket has `--cost` tokens (default 1), after anyone ahead of it for the same bucket, so a big request isn't passed forever by small ones. Tokens come back with time, not when a job ends. A quota costs no slots, memory or cores; combine it with a resource (`dibs run quota:asc,deploy -- ...`) when the work needs one. The board lists every bucket and what's left in it.
|
|
65
|
+
|
|
66
|
+
## Profiles
|
|
67
|
+
|
|
68
|
+
A project whose suite always needs the same resource, ports and sizes can name them once in `~/.dibs/config.json` instead of a wrapper script:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
"profiles": { "playwright:web": { "res": "playwright", "ports": ["WEB", "API"], "mem": "3G", "cpu": 2 } }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
dibs run playwright:web -m "e2e" -- npm run e2e # playwright, $WEB and $API set, planned at 3G and 2 cores
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
A profile sets `res` (one name, a comma list or an array), `ports`, `mem`, `cpu`, `disk` and `est`. Flags on the command line win over it. `dibs when` and `dibs hold` take profiles too. A profile's name can't be a resource's or start with `files:` or `quota:`, and a bad one fails every call with its key named.
|
|
79
|
+
|
|
80
|
+
## Overrides, by the person or any agent
|
|
81
|
+
|
|
82
|
+
Anyone may `dibs boost`, `pause`, `resume`, `stop` and `cap` any job: the person, or any agent, its own session's work or another's. Each change is kept on the job with who made it (`owner.by`, the pause's `by`, `stopBy`; none means the person), shown on the board (`[boosted by web-app: release blocked]`, `[paused by web-app]`) and logged in `dibs history` as an `override` event with `by` and `byAgent`.
|
|
83
|
+
|
|
84
|
+
- An agent raising a job to `high` or `urgent` passes `-m`, as it does on `dibs run -p`, so everyone sees why.
|
|
85
|
+
- An agent's urgent gets what the person's does: past the swap and disk-room waits (only urgent work starts during those), past paused jobs' booked memory, and pausing low runs for a slot. The hard limits hold for everyone: below `minDisk` nothing starts, the memory budget holds unless the machine really has room, critical memory pressure stops the small-job exceptions, and dibs never pauses every job on its own.
|
|
86
|
+
- A job that was stopped tells its agent who stopped it and to find out why before running it again.
|
|
87
|
+
|
|
88
|
+
## Pausing low-priority work
|
|
89
|
+
|
|
90
|
+
- **For urgent work.** When an `urgent` or `high` waiter is stuck behind a `low` or `idle` run on a full resource, dibs stops that run's whole process tree (SIGSTOP on every process group it has) and lends the waiter its slot. It pauses only as many runs as it takes, and only if that lets the waiter start right away; if something else would still block it (normal work holding another resource it wants, the memory budget, disk), nothing is paused. The paused run resumes (SIGCONT) the moment the waiter's lease ends, whether it finished, crashed, or was killed: whatever dibs call next reads the state does it.
|
|
91
|
+
- **Under memory pressure.** `dibs throttle --watch` reads the OS memory pressure every 10 seconds (`kern.memorystatus_vm_pressure_level` on macOS, `/proc/pressure/memory` on Linux). After two critical readings in a row it pauses one idle or low run (the one furthest over the memory it was handed first, then idle before low, then the most memory), and another after each further two. After a minute of normal readings it resumes one, lighter first, then waits another minute before the next. A warning reading resets both counts, so nothing flaps while the machine hovers. When the watcher stops, it resumes everything it paused; if it dies, the next dibs call does.
|
|
92
|
+
- **When swap fills the disk.** Holding new starts doesn't stop jobs already running from growing. The same watcher reads free disk every 10 seconds: while it's under `minDisk` (never under 3 GB, whatever `minDisk` says) and swap is still growing (or free disk fell more than 3 GB in 5 minutes), and still is over the last minute and a half, it pauses one more run each pass, two when free disk is falling fast enough to be down to 1 GB within two minutes: a job on top first, then `idle`, `low` and `normal` work, newest first. `urgent` and `high` work and holds are never paused, and nothing is killed. Once free disk has been back over the line it pauses at and steady for a minute, it resumes one, then another a minute later. A paused job's memory stays in swap, so the disk may never come back over the line: after 3 minutes with nothing growing or falling it resumes one anyway, since waiting frees nothing then. Free some space or end a paused job yourself if it keeps happening.
|
|
93
|
+
- **Before the disk runs out.** Under twice `minDisk`, the watcher clears caches that rebuild themselves (npm's and Homebrew's, simulators `simctl` calls unavailable, Xcode DerivedData no build has touched in a day), at most every 30 minutes and again when the disk drops under the floor, and logs what it freed in `~/.dibs/cool.log`. Then each session with something of its own to free (a scratch folder over 2 GB, or running jobs that wrote a gigabyte or more) hears through the hook how much is free, what's growing fastest, whose folder holds the most, what dibs freed, and to free its own build output and scratch. It hears once per band: once under twice the floor and once more under the floor, and again only after the disk has had room (over twice the floor) and falls again. Other sessions hear nothing; the person sees the whole machine in `dibs alerts`. If the throttle watcher isn't running, the coordinator (`dibs serve`) sends the notes and clears the caches instead. Under the floor the note says to save work now, and names each agent's running jobs (they may fail writing) and waiting ones. A job paused for the disk tells its agent through the hook right away.
|
|
94
|
+
- **Who is filling the disk.** While free disk is under `minDisk`, or a waiter is held for its own disk need, the same watcher measures the session folders in Claude Code's temp folder (`/private/tmp/claude-<uid>/<project>/<session>`) every 10 minutes and keeps the three biggest over 2 GB in `~/.dibs/hogs.json`. Each one's agent (the one that made its biggest scratchpad folder, else the session's main thread) hears once per drop, through the hook, how big it is, what fills it (git worktrees, node_modules) and how to free it. A disk wait (`dibs why`, `dibs when`, the wait message) names the biggest folder and whose session it is, so a waiting agent knows whom to ask: only that session, or the person, may delete there. It also names what grew most since the last reading, 10 minutes before (each session folder, swap, simulators, Xcode build output, caches, and dibs's copies of other machines' jobs, read from twice the floor down): `Growing fastest: swap, up 2.5 GB in 10 min`. Under half a gigabyte isn't named. Memory pressure easing doesn't resume what the disk paused. If the watcher stops while the disk is still short, its disk pauses stay for a minute so the restarted watcher takes them over, instead of every paused job resuming at once.
|
|
95
|
+
- **Never all of them.** None of these pauses the last running job, or one about to finish (see What it guarantees).
|
|
96
|
+
- **When the paused jobs themselves fill the disk.** A paused job keeps its memory, and under memory pressure that memory goes to swap, which fills the disk the job is waiting for. So while free disk is under the line and swap is still growing, the watcher stops one disk-paused job each pass, the one using the most memory, instead of pausing another. The job isn't lost: its own `dibs run` puts it back at the front of its line and runs the command again from the start once there's room, in the same call, and its agent hears why through the hook. Only on resources marked `rerun` (test, playwright, xcode-build and heavy by default; never deploy or sim), never a job a person or agent paused, and never one about to finish. The same goes for a job running far past what it booked, paused or not, even the only one running: at least 4 GB over its booking and either twice it or more than all the memory dibs shares out. That job goes back at the front booked at what it really used (up to the budget), what it used goes into the history so later runs are planned at it too, and it starts again only once that much memory is really free and swap holds still. A job stopped this way once isn't stopped for it again.
|
|
97
|
+
- **What stays the same.** A paused run keeps its lease and its place. Its clock stops, so time-left estimates and run-time history skip the pause. Its owner sees `paused your job for ...` and `resumed your job after ...` on stderr, and the board says why (`paused so web-app's urgent deploy could go first`; `dibs --detail`: `[paused for <who>]`, `[paused: memory pressure]` or `[paused: disk low]`). High and urgent work is never paused, and neither are holds; normal work only for the disk.
|
|
98
|
+
- **Memory.** A stopped process keeps its memory, so a paused run still counts against the memory budget. Only its slot and its cores are lent. Under pressure the OS can compress or swap a stopped job's pages, which is what eases it.
|
|
99
|
+
- **An urgent waiter a rate limit stops** pauses nobody: the quota is checked first.
|
|
100
|
+
- **Which resources.** `pausable` in the resource's config, and `rerun` for the ones whose jobs may be stopped and run again from the start (above). On by default for test, heavy and playwright. Off for xcode-build (`xcodebuild test` drives a simulator a pause can't stop, and pausing a real build is untested), deploy (a half-done deploy with remote timeouts running is worse than a slow one) and sim (the app runs under the simulator, outside the job's process tree, so pausing the script leaves the app and the booted device going). Off for names dibs doesn't know. A run on several resources pauses only if all of them allow it. Timers inside a paused job keep counting wall time, so a test or Playwright timeout may fire right after it resumes; the stderr notice says why.
|
|
101
|
+
- **Windows** has no SIGSTOP, so nothing is ever paused there.
|
|
102
|
+
|
|
103
|
+
## Pace and the load ceiling
|
|
104
|
+
|
|
105
|
+
The budgets above are skipped while the machine looks roomy, and nothing stops new work when the load climbs. `dibs pace` picks how hard dibs drives this machine in one word:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
dibs pace quiet # the fan stays calm and the person at the Mac never feels it
|
|
109
|
+
dibs pace normal # today's budgets, plus a load ceiling at one job per core
|
|
110
|
+
dibs pace max # finish fast: 1.5 busy jobs per core, three quarters of memory
|
|
111
|
+
dibs pace off # back to the numbers in config.json, no ceiling
|
|
112
|
+
dibs pace # what's set now, and what each pace sets on this machine
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Each pace sets six knobs from this machine's cores and memory. On a 10-core 16 GB Mac:
|
|
116
|
+
|
|
117
|
+
| | quiet | normal | max |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| `cores` in use | 4 (40%) | 6 (60%) | 15 (150%) |
|
|
120
|
+
| memory `budget` | 6.5G (40%) | 8G (50%) | 12G (75%) |
|
|
121
|
+
| `maxLoad` | 5 (half the cores) | 10 (one per core) | 15 (1.5 per core) |
|
|
122
|
+
| `coolLoad` (dibs throttle) | 5 | 8 | 12 |
|
|
123
|
+
| budgets skipped when roomy | never | load under 0.6 per core, 35% memory free, memory pressure normal, swap not growing past `maxSwap`, budget not already used up | never |
|
|
124
|
+
| `overlap` | off | fit | squeeze |
|
|
125
|
+
|
|
126
|
+
- **The ceiling.** While the 1-minute load average is above `maxLoad`, new `normal`, `low` and `idle` work waits; `dibs why` and the board say so. `urgent` and `high` work still starts, and so does work that already holds a lease (see nesting), and passes the waiters the ceiling holds back. Work already running is never stopped. Nothing waits on the ceiling forever: a job it alone has held for 20 minutes starts anyway at background priority, on the efficiency cores on Apple silicon, which barely warms the fan the ceiling protects. Jobs started that way share 40% of the cores between them, and one that asks for more still goes when it's alone. Memory, swap and disk limits still hold them. The wait says `held by load since 14:02, starts by 14:22 at the latest`, and that a job a person is waiting on now can go with `-p high -m "why"`, or to another machine with `--on <machine>`. Its agent hears once, through the hook, when it starts this way. On a coordinator with an on-demand machine (docs/machines.md), a job whose turn in line here is further off than 90 seconds (waking and sending) plus its usual run time goes there at once, and a job the machine has held for 2 minutes (the ceiling, the budgets, memory, swap, or a job ahead reserving memory) goes there instead, when it can run there: not when a resource it needs is macOS-only, its command names a macOS tool (`xcrun`, `swift`, `osascript` and the like) or a path of this machine (`/Users/...`, `~/...`), the script it runs imports Apple frameworks (Vision, Quartz, AppKit), its project's `.dibs.json` keeps it here (`stayOn`), or its folder is your home folder or outside git. Its `dibs run` says where it went, and the job runs there as if sent with `--on`.
|
|
127
|
+
- **Bursts.** The load average trails the real load by about a minute: a job started t seconds ago shows in it as only 1 - e^(-t/60s) of its cores. dibs adds the missing part of every recent start to the reading, so ten waiters can't all start under one reading taken before any of them did.
|
|
128
|
+
- **Your own numbers win.** A knob set in `~/.dibs/config.json` to anything but its stock value overrides what the pace says. A file dibs wrote holds every stock value, so those don't count as choices. `maxLoad` works on its own too, without a pace.
|
|
129
|
+
- **No pace, no change.** Without `pace` or `maxLoad` in the config, dibs behaves exactly as before. The board's first line names the pace when there is one.
|
|
130
|
+
|
|
131
|
+
## Running side by side
|
|
132
|
+
|
|
133
|
+
For most resources the slot count stands in for "the machine can take this many". When a resource is full but its jobs leave real room, `overlap` lets one more start on top:
|
|
134
|
+
|
|
135
|
+
- **`fit`.** A job starts on a full resource when its size fits what's really free right now: memory stays above `minFreeMem`, and the load stays under `maxLoad` (one per core without a ceiling). Its size is the most its command used in recent measured runs (see "Measuring what jobs use"), else the `--mem` it asked for. A command dibs has never measured, run without `--mem`, has an unknown cost and waits for a slot.
|
|
136
|
+
- **`squeeze`.** Also: a job that usually takes less than `squeezeUnder` (60s, from its run history, never `--est`) starts if its memory fits, even if its cores take the load past `maxLoad`. You accept that load hit by choosing it. Not once the load is already past it.
|
|
137
|
+
- **`off`.** One job per slot, as before.
|
|
138
|
+
- **Who decides.** `dibs pace` sets it: `quiet` off, `normal` fit, `max` squeeze, and off without a pace. `"overlap"` in `~/.dibs/config.json` wins over the pace. Switching the pace is the person's call: an agent's `dibs pace <word>` is refused.
|
|
139
|
+
- **Never on.** Resources that are one at a time: `exclusive: true` in their config (`sim` and `deploy` by default), names dibs doesn't know (often someone's lock; set `"unknown": { "exclusive": false }` to change that), the `sim-own` pool, resources with an `onRelease` reset, file leases and quotas. Nor holds: a hold keeps the resource to itself.
|
|
140
|
+
- **Bursts.** The free-memory reading lags a start by up to half a minute while a job loads, and the load average by a minute. Jobs started in the last 30 seconds count at their size, less what dibs has already measured them using, and recent starts count against the load as they do for the ceiling.
|
|
141
|
+
- **Fair.** A job on top never takes a slot. When a slot frees, the next waiter in the queue gets it as usual, so a big job waiting for a slot isn't passed for good by small ones running on top. A waiter ahead that fits on top too goes first. The budgets, disk, swap, memory and load rules still apply, and the memory budget always does: a job on top never gets the roomy exception. Nobody is paused or slowed to make room.
|
|
142
|
+
- **Under memory pressure** jobs on top pause first, newest first, and resume last (on resources that allow pausing; `xcode-build` doesn't). They're never killed.
|
|
143
|
+
- **What you see.** `dibs run` says `the test queue is full, so this runs alongside web-app: it needs about 0.5 GB of memory, and there's room.` The plain board says `api is running alongside web-app, since the machine had room` or `squeezed in next to web-app, since it usually takes under a minute`, and `dibs --detail` marks the row `[running alongside web-app]` or `[squeezed in (usually takes under a minute)]`. `dibs why` explains a refusal: `Can't run alongside: it usually needs 6.0 GB of memory and 3.0 GB is free.` A command dibs has never measured needs `--mem` the first time to run alongside.
|
|
144
|
+
|
|
145
|
+
## Putting a resource back
|
|
146
|
+
|
|
147
|
+
A resource can name a command that runs after each lease on it ends, so the next agent finds it the way you want it. For the shared simulator, a reset to the default text size, light mode and a clean status bar:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
"resources": {
|
|
151
|
+
"sim": { "onRelease": "xcrun simctl ui booted content_size large; xcrun simctl ui booted appearance light; xcrun simctl ui booted increase_contrast disabled; xcrun simctl status_bar booted clear" }
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- **When.** Once per lease end, however it ends: the command exits, crashes, dibs is killed with `-9` (the next dibs call notices), a hold is released or runs out. A run under your own session's hold isn't the end of your turn: the hold's end is.
|
|
156
|
+
- **The next user waits for it.** Until the reset finishes, the next lease on that resource waits (`Waiting for the simulator to be reset after onboarding's turn`), so it can't race them. It gets `onReleaseTimeout` (default `30s`) and is then killed with everything it started.
|
|
157
|
+
- **It never fails anyone.** It runs outside the state lock in its own process, with `$DIBS_RESOURCE` and `$DIBS_RELEASED_BY` set, from `~/.dibs`. A failure or timeout is logged to `~/.dibs/onrelease.log` with the end of its output; the job's exit code is its own.
|
|
158
|
+
- Use `;` between steps rather than `&&`, so one failing step (no simulator booted) doesn't skip the rest.
|
|
159
|
+
- `booted` means the one booted simulator. While `sim-own` devices are booted too, put the shared simulator's udid in its place (`xcrun simctl list devices booted`).
|
|
160
|
+
|
|
161
|
+
## Throttling
|
|
162
|
+
|
|
163
|
+
`dibs throttle --watch` runs a watcher. When the 1-minute load is over `coolLoad` (8, or what `dibs pace` sets), build and test processes that keep a core hot outside any lease are moved to background priority (the efficiency cores on Apple silicon, nice 10 on Linux). Nothing is killed. The same watcher pauses idle and low runs under heavy memory pressure, and runs below high when swap fills the disk (see above). Moves are logged to `~/.dibs/cool.log`. `dibs throttle` does one pass.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Simulators
|
|
2
|
+
|
|
3
|
+
`sim` is the one shared booted simulator, the one other sessions screenshot. `sim-own` gives your command a simulator nobody else touches:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
dibs run sim-own -- sh -c 'xcrun simctl install "$SIM" App.app && xcrun simctl launch "$SIM" com.example.app'
|
|
7
|
+
dibs run sim-own,xcode-build -- sh -c 'xcodebuild test -scheme App -destination "id=$SIM"' # single quotes: $SIM is set inside the run, not in your shell
|
|
8
|
+
dibs hold sim-own --for 20m # keep one booted across tool calls; it prints the udid
|
|
9
|
+
dibs sims # the pool: devices, who has them, disk they use
|
|
10
|
+
dibs sims prune # delete the idle ones
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- **What you get.** `$SIM` is the device's udid and `$SIM_NAME` its name (`dibs-pool-1`). It's booted when your command starts and shut down when it exits. A new device is an iPhone 17 on the newest installed iOS runtime; set `pool.deviceType` and `pool.runtime` on `sim-own` in the config to pick others (names like `iPhone 16` and `iOS 18.6` work).
|
|
14
|
+
- **Reuse.** Devices stay between leases, because creating one and its first boot are slow and each costs 1 to 5 GB of disk. You get the device you used last if it's free, so your installed app is still there. A device last used by another agent is erased first (`pool.erase`: `other-agent`, `always` or `never`).
|
|
15
|
+
- **How many at once.** A new one boots only if free memory covers another simulator (`pool.perSim`, 2G) and still leaves `minFreeMem` free. Devices still booting count as taken. `slots` caps it on top of that. A `sim-own` lease counts the simulator plus its job against the memory budget, and `--mem` names the job's own need, so `--mem 2G` hands out 4G.
|
|
16
|
+
- **Crashes.** If the command or dibs dies, even with `kill -9`, the next dibs call anywhere shuts the device down and puts it back in the pool.
|
|
17
|
+
- **What dibs deletes.** Only devices it named `dibs-pool-*`, and only on `dibs sims prune`. It never shuts down, erases or deletes any other simulator. It adopts or prunes only the pool devices this `DIBS_HOME` created (listed in `~/.dibs/pool-made`); another dibs's `dibs-pool-*` devices show as "not made by this dibs" and are left alone.
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dibssoftware/dibs",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.179",
|
|
4
|
+
"description": "Coding agents on one machine take turns on the simulator, Xcode builds, test suites, browser runs and deploys",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dibs": "bin/dibs.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"src/",
|
|
12
|
+
"docs/",
|
|
13
|
+
"!docs/images/",
|
|
14
|
+
"skills/",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=22.23.4"
|
|
21
|
+
},
|
|
22
|
+
"os": [
|
|
23
|
+
"darwin",
|
|
24
|
+
"linux",
|
|
25
|
+
"win32"
|
|
26
|
+
],
|
|
27
|
+
"author": "dibs maintainers <licensing@dibs.cc>",
|
|
28
|
+
"homepage": "https://dibs.cc",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/dibssoftware/dibs.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/dibssoftware/dibs/issues"
|
|
35
|
+
},
|
|
36
|
+
"license": "AGPL-3.0-only",
|
|
37
|
+
"keywords": [
|
|
38
|
+
"simulator",
|
|
39
|
+
"xcode",
|
|
40
|
+
"queue",
|
|
41
|
+
"parallel-agents",
|
|
42
|
+
"claude-code"
|
|
43
|
+
],
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dibs
|
|
3
|
+
description: How to take turns with other agents on this machine's simulators, Xcode builds, test suites, browser runs, deploys and shared files using the dibs CLI, post progress, and ask the person questions. Use before running xcodebuild, xcrun simctl, swift test, Playwright, jest, vitest, npm test, node --test or a deploy, before editing files other agents may touch, before asking the person anything, before ending a turn while waiting on another agent or the person, when a command, edit or subagent spawn was blocked or rewritten by dibs guard, or when dibs exits 1, 2, 3, 70, 74, 75, 76 or 77.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# dibs
|
|
7
|
+
|
|
8
|
+
<!-- dibs:rules:start -->
|
|
9
|
+
dibs runs on this machine. Agents take turns through it on the simulator, Xcode builds, test suites, browser runs and deploys.
|
|
10
|
+
- 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 -- ...`.
|
|
11
|
+
- 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.
|
|
12
|
+
- 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.
|
|
13
|
+
- 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.
|
|
14
|
+
- 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.
|
|
15
|
+
- 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.
|
|
16
|
+
- Post progress as you work: `dibs progress "what you did or found" --task <name> --eta 30m`, then `--done`.
|
|
17
|
+
- The rest (holding across tool calls, file leases, other machines, every exit code, overriding jobs, questions) is below, under "When you need it", and in `dibs help`.
|
|
18
|
+
<!-- dibs:rules:end -->
|
|
19
|
+
|
|
20
|
+
## When you need it
|
|
21
|
+
|
|
22
|
+
Everything below is reference. Read the part you need when it comes up.
|
|
23
|
+
|
|
24
|
+
### Running
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
dibs run xcode-build -m "why" -- xcodebuild -scheme App build
|
|
28
|
+
dibs run sim-own -- sh -c 'xcrun simctl install "$SIM" App.app' # $SIM is the private simulator's udid
|
|
29
|
+
dibs run sim-own,xcode-build -- sh -c 'xcodebuild test -scheme App -destination "id=$SIM"'
|
|
30
|
+
dibs run playwright --port WEB -- npx playwright test # a free port in $WEB
|
|
31
|
+
dibs run test --after #42 -- npm run e2e # joins the line once job #42 has ended
|
|
32
|
+
dibs run test -- sh -c 'npm run build && npm test' # a shell line goes in sh -c
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `sim` is the one shared booted simulator. `sim-own` boots a private one for your command (its udid in `$SIM`) and shuts it down after.
|
|
36
|
+
- `$SIM` and `--port` variables are set inside the run, so put them in single-quoted `sh -c '...'`. Use `$WEB` (or whatever you named the port), never a fixed port.
|
|
37
|
+
- Need two resources? Ask for both in one `dibs run a,b`. Never hold one while waiting for another.
|
|
38
|
+
- The turn lasts exactly as long as the command: when it exits or crashes, the turn is given back and its whole process tree is killed. Don't add keepalives, `timeout` wrappers or lock files of your own.
|
|
39
|
+
- Inside Claude Code, `dibs run` waits as long as it takes. Every run ends with one line on stderr, `dibs: #812 test, waited 2m10s, ran 3m04s, exit 0`; after a compaction, that line is the result.
|
|
40
|
+
- A command over in under 15 seconds (a deploy of a few seconds, a one-file test): add `--quick`, or `--est 10s`. 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, it goes to the front of the line instead. dibs learns it after that. A run that goes over loses the pass until it runs under again, and you're told.
|
|
41
|
+
- `--est 3m` (a duration like `30s`, `5m`, `1h`) on a job dibs hasn't seen lets short jobs move up. `--mem 6G --cpu 4` the first time you run something heavy dibs hasn't measured; after that it plans at the measured peak, and says so if a job used far more than it asked.
|
|
42
|
+
- Priority: `-p urgent|high|normal|low|idle` (or 1-5). `urgent` (something's broken or a person is waiting now) and `high` (critical path) need `-m`, and everyone sees them. `normal` is the default. `low` (nobody waiting) and `idle` (audits, solvers, regenerating things) run at background priority on the cool cores. Pick the true level. `--by 23:30` for a deadline.
|
|
43
|
+
- `--notify <file>` appends a JSON line to that file when dibs exits.
|
|
44
|
+
- A shared API rate budget: `dibs run quota:<name> --cost N -- <cmd>` (the budgets are set in `~/.dibs/config.json` `quotas`).
|
|
45
|
+
- Work that runs outside dibs is moved to the slow cores when the machine runs hot (`dibs throttle`). Wrapping it lets you pick its priority.
|
|
46
|
+
- A resource name close to a real one (`simulator`, `tests`) is refused with exit 2 and the right name. A new name of your own starts its own queue.
|
|
47
|
+
- A suite that takes minutes: `dibs run test --shards 2 -- npx vitest run` splits it across the group's machines and merges the output and exit codes. vitest and `node --test` suites that usually take over 5 minutes split on their own; `--no-shard` keeps one piece.
|
|
48
|
+
|
|
49
|
+
### Listening for messages
|
|
50
|
+
|
|
51
|
+
`dibs listen`, started with run_in_background, waits until something comes for you, prints all of it and exits 0, and that exit wakes you even while you sit idle. Start it at the start of your session and again each time it exits. What wakes it:
|
|
52
|
+
|
|
53
|
+
- a message for you (`dibs tell`, from the person or another agent)
|
|
54
|
+
- the person answering your question in their own words
|
|
55
|
+
- a notice from dibs about your own jobs
|
|
56
|
+
- dibs on this machine was updated: it prints what changed since your last version, once
|
|
57
|
+
- a newer dibs is out on dibs.cc ("dibs X is out (you have Y)"): the person upgrades it; don't upgrade it yourself. Asked at most every 6 hours per machine, never from a git checkout, off with `"updateCheck": false` in config.json.
|
|
58
|
+
|
|
59
|
+
Exit 0 ends with "To keep listening, start dibs listen again with run_in_background." Exit 3 means nothing came within `--for` (60m by default). Either way, start it again. `--json` gives `{ messages }`, `{ updated, changes }` or `{ release }`.
|
|
60
|
+
|
|
61
|
+
One listener per agent: the main agent of a session, and each subagent, separately. A newer one replaces the older, which exits 0 saying another took over. Messages that arrive while you work come with your next tool call instead; none is lost or handed over twice. If you end a turn after your listener exited, the hook keeps you going once with "re-arm: your dibs listen has ended". The board, `dibs threads` and `dibs tell` say who is listening.
|
|
62
|
+
|
|
63
|
+
### Holding across tool calls
|
|
64
|
+
|
|
65
|
+
`dibs hold <res> --for 20m -m "why"` waits for its turn like `dibs run`, then returns. Keep wrapping each command in `dibs run <res> -- ...`: under your hold it starts without waiting. Run the hold again to extend it; an hour is the most it gets at once. `dibs release <res>` when you're done. `dibs mine` lists what you hold and wait for, and exits 1 when that's nothing, which is the clean result after a release.
|
|
66
|
+
|
|
67
|
+
A script running under `dibs run deploy` that calls `dibs run xcode-build` waits only for xcode-build, ahead of waiters holding nothing.
|
|
68
|
+
|
|
69
|
+
### When dibs holds you back
|
|
70
|
+
|
|
71
|
+
- **Memory, swap or disk** ("waiting for memory pressure to ease", "this machine to stop swapping", "free disk to stop falling"): dibs is protecting the machine. Keep waiting. Don't pass a smaller `--mem` or a higher `-p` to get past it. A memory wait names the jobs holding the most: if one is yours and finished, end it.
|
|
72
|
+
- **Disk at your turn:** a resource that declares a disk need (the simulator asks 8 GB) is refused with exit 74 when that much isn't free and nothing running will free it. If your job needs less, pass `--disk 1G` on the hold and on each `dibs run`. A job whose own past runs ate more disk than is free waits for disk too, even alone. While you wait on something else, the wait message says early when disk will hold you next, so free your own build output then.
|
|
73
|
+
- **Paused** ("paused your job: free disk is low", or for urgent work): leave it, it resumes by itself.
|
|
74
|
+
- **Load** ("waiting for the machine to cool down"): ends within 20 minutes.
|
|
75
|
+
- **A person is waiting on the job now:** run it with `-p high -m "why"`, or send it to another machine with `--on <machine>` (`dibs machines`). That's the only reason to raise it.
|
|
76
|
+
- **Someone ahead of you:** agents appear by session name, the same name SendMessage uses. Message the agent ahead and ask; whoever is ahead runs `dibs yield <your name>`. If someone asks you and their work is more urgent, run `dibs yield <their name>`.
|
|
77
|
+
- **Lines from the dibs hook about your jobs** (stuck with no CPU for 20 minutes while others wait, over its memory, paused, a progress task overdue): they're about your own work. Act on them.
|
|
78
|
+
|
|
79
|
+
### Exit codes
|
|
80
|
+
|
|
81
|
+
| code | meaning | what to do |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| the command's own | it ran | read it as usual |
|
|
84
|
+
| 75 | gave up waiting: your command never started and didn't fail (outside Claude Code, after `--max-wait`, 8m by default), or a question got no answer | rerun the same command within 2 minutes to keep your place, or add `--wait`. On a question: nothing was decided, skip that step |
|
|
85
|
+
| 74 | not enough free disk | the message says how much it needed. Free your own build output, or tell the person; if this run needs less, pass a smaller `--disk` on that `dibs run` (a hold's `--disk` doesn't cover the runs under it). Never delete in another session's `/private/tmp/claude-*` folder |
|
|
86
|
+
| 76 | lost the coordinator or the other machine before the job started | nothing ran there: send it again |
|
|
87
|
+
| 77 | lost the other machine after the job started | it may have run, or still be running: check before running it again, above all a deploy |
|
|
88
|
+
| 70 | dibs itself crashed | a bug in dibs, not your command: `dibs ask "..."` |
|
|
89
|
+
| 127 | the command didn't start | check the command and its path |
|
|
90
|
+
| 2 | bad usage: a near-miss resource name, a high or urgent boost without `-m`, a job bigger than this machine (ask for what it names, or `--anywhere`), `--on` or `dibs machines` outside a group, or a run you already have going | read the message: it names the fix |
|
|
91
|
+
| 1 | nothing matched (`mine` with nothing held, `release` with nothing to give back) | usually the clean result |
|
|
92
|
+
| 3 | `dibs listen` heard nothing within `--for` (60m by default) | start it again with run_in_background |
|
|
93
|
+
|
|
94
|
+
### Files other agents may edit
|
|
95
|
+
|
|
96
|
+
`dibs hold 'files:src/auth/**' -m "why"` (paths from the git root; `**` crosses folders) turns away other agents' edits and writes there, with who holds it and why. Quote the glob, or zsh expands it first and fails with "no matches found". `dibs release 'files:src/auth/**'` gives it back. If your edit is refused: wait (`dibs when files:<path>`) or message the holder. Don't write the file another way. Paths nobody leased need nothing.
|
|
97
|
+
|
|
98
|
+
### Progress
|
|
99
|
+
|
|
100
|
+
Post as often as you commit. The person reads every post live on their page, the Mac app and their own Claude; other agents read them with `dibs progress`.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
dibs progress "Starting billing-migration: script written, dry run next" --task billing-migration --eta 45m
|
|
104
|
+
dibs progress "Dry run touched 4,210 rows, 0 errors. Asking before prod" --task billing-migration --eta 30m
|
|
105
|
+
dibs progress "Blocked: waiting on the person for the prod run (question #3)" --task billing-migration --blocked
|
|
106
|
+
dibs progress "Done: migrated 4,210 rows on prod, checks pass" --task billing-migration --done
|
|
107
|
+
dibs progress list # your session's open tasks, with owner, state, ETA and last post (--all: every session's)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- Post when you start (with `--eta`), when you learn something (a test fails, a cause found, a plan changed, with the numbers), when you hand off or wait (`--blocked`), and at the end (`--done`). A task of a minute or two needs just the `--done` post.
|
|
111
|
+
- Keep `--task` the same short name across posts, and move `--eta` (`30m` or `17:30`) when the estimate moves.
|
|
112
|
+
- A task still open past its `--eta` shows as overdue, and dibs tells you once: post a new `--eta`, or `--done`. You hear once too if an open task goes 45 minutes without a post. Ending a task without finishing it: `--done` with a post that says what isn't done.
|
|
113
|
+
- Posts are for the record. Questions go through `dibs question`; a note the person should see now goes through `dibs say`.
|
|
114
|
+
|
|
115
|
+
### The guard
|
|
116
|
+
|
|
117
|
+
When dibs's hook sees a heavy command outside `dibs run`, it rewrites it into the `dibs run ...` line (in bypass-permissions sessions) or blocks it and prints that line. Run the line. If the command really builds, boots, tests and deploys nothing, put `DIBS_GUARD=off` in front of it. If the person set a subagent limit (config `agents.slots`), a denied spawn started nothing and isn't a failure: wait for one of yours to report back, then spawn again.
|
|
118
|
+
|
|
119
|
+
### Looking without joining the line
|
|
120
|
+
|
|
121
|
+
`dibs` (the board, whose `Limits` line has memory, disk and swap), `dibs when sim`, `dibs who sim`, `dibs why`, `dibs mine`, `dibs history` (the last 7 days). Every command and flag: `dibs help all`. Something wrong with dibs, or a question about it: `dibs ask "..."`, or SendMessage the maintainer its answer names. When dibs says it was updated, read what changed with `dibs changes` and follow it.
|
|
122
|
+
|
|
123
|
+
### Overriding jobs and settings
|
|
124
|
+
|
|
125
|
+
You may do anything the person can, on any job: boost, lower, pause, resume, stop, cap. Use the `#` id from `dibs --detail`. On a job that isn't yours, add `--owner <its session>` as the board names it left of the `#`; without it nothing changes (exit 2) and dibs prints the command to rerun.
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
dibs boost 4221 urgent -m "person waiting on the fix" # high or urgent needs -m, which everyone sees
|
|
129
|
+
dibs pause 4219 # dibs resume 4219 continues it
|
|
130
|
+
dibs stop 4219 # end it and kill its processes
|
|
131
|
+
dibs cap pushy low # that agent's work waits and runs at low or below until dibs cap pushy off
|
|
132
|
+
dibs yield web-app # let another agent go first
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The same goes for `answer`, `cap`, `hours`, `pace`, `tell`, `join`, `invite`, `kick`, `limit`, `connect`, `service install` and `guard install`. dibs records who did each, on the board and in `dibs history`, so act the way you'd defend to the person. Raise a job to high or urgent only when a person is waiting on it now or something is broken. Prefer a message and `dibs yield` over stopping someone else's work. If your own job was **stopped by** someone, it was ended on purpose: find out why (`dibs history`, or ask them) before running it again.
|
|
136
|
+
|
|
137
|
+
### The person: questions, notes and messages
|
|
138
|
+
|
|
139
|
+
The person's rule: walk through two-way doors (anything you can undo) yourself and show them after. Bring them only one-way doors (ship, spend, delete, rename something public: things that can't be undone), one at a time, with your recommendation.
|
|
140
|
+
|
|
141
|
+
- **A two-way door:** decide. If it's worth a record, `dibs question "..." --recommend X -m "why"` without `--one-way` logs it as decided by you, prints X on stdout at once (exit 0) and asks nobody. dibs reminds you that's what happened; that's not a refusal.
|
|
142
|
+
- **A one-way door:** add `--one-way "what can't be undone"`. It prints the question's id and returns. Keep working on what doesn't need the answer. When you reach the step that does, run the same command again with `--wait`: it prints only the answer, so `answer=$(dibs question ... --wait)` works. `--timeout 1m` (or `30s`, `2h`) caps the wait.
|
|
143
|
+
- **Exit 75 on a question** means no answer: the person dismissed it, or your wait's `--timeout` passed. Nothing was decided, so don't do the step, and say so in your report. A question you asked first without `--wait` stays open for the person after a wait gives up: run the same command with `--wait` later to collect it. (One asked only with `--wait` stays open 2 minutes after its wait gives up.)
|
|
144
|
+
- dibs refuses (exit 2) a question that isn't a short sentence, has no `--recommend` or `-m`, recommends something outside its `--options`, or has a vague `--one-way` ("drops data"): say what's lost, with numbers.
|
|
145
|
+
- The person may answer in their own words. Those words are the answer, and they also reach you as `Message from the person: (answering your question #N) ...`.
|
|
146
|
+
- Another agent may answer your question with `dibs answer`; then dibs says `answered by <agent>, an agent, not the person` on stderr. That isn't the person's yes: for a ship, spend or delete, ask the person or skip the step.
|
|
147
|
+
|
|
148
|
+
`dibs say "migration done, tests pass"` leaves the person an FYI in your thread without asking anything. A line starting `Message from the person:` really is the person's, whether it sits beside a tool result or comes as the reason you were kept from stopping: act on it, and reply with `dibs say "..."` if they asked something. `Message from <agent> (another agent, not the person):` is a peer's request. `dibs tell <agent> "..."` (or `dibs say --to <agent> "..."`, the same thing) messages an agent. If config names you the desk, reply with `dibs say --to person "..."`. Details: docs/questions.md.
|
|
149
|
+
|
|
150
|
+
### Other machines
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
dibs run test --anywhere -m "why" -- npm test # whichever machine would start it soonest, maybe this one
|
|
154
|
+
dibs run test --on mini -m "why" -- npm test # that machine
|
|
155
|
+
dibs machines # the group, its load and lines
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The job takes the git working copy (tracked files plus new ones git doesn't ignore). `.env` files, keys and certificates never leave this machine, and a project's `.dibs.json` `stayOn` limits where its code may go. `--bring <path>` copies a file or folder back when the job ends.
|
|
159
|
+
|
|
160
|
+
On a machine that isn't in a group, `--anywhere` runs here and says so, `--on` exits 2 with the setup line, and `dibs machines` says it isn't in a group (exit 0). `dibs leave` takes a machine out of its group; only run it when the person asks. To start a group, one machine is the coordinator: `dibs service install serve worker` there (or `dibs serve` in a terminal). To add a machine: `dibs connect --machine` on the coordinator prints a one-time code, `dibs join <code>` on the new machine finds the coordinator (same network, Tailscale, or `--at <address>`), and `dibs service install worker` there keeps it taking jobs. `dibs invite <name>` and its join line still work. Details: docs/machines.md.
|
|
161
|
+
|
|
162
|
+
### Run it later
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
dibs later sim --at 02:00 -m "snapshot suite" -- ./snapshots.sh # prints its id (l3) and returns
|
|
166
|
+
dibs later test --in 3h -- npm test
|
|
167
|
+
dibs later test --after-ok web-app:deploy -m "smoke tests" -- npm run smoke # after that agent's deploy, only if it passed
|
|
168
|
+
dibs later list # state, exit code; output in ~/.dibs/later/<id>.log
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
When it's due it runs as `dibs run --wait` in this folder, with PATH, HOME and LANG (more with `--env NAME`). At most 7 days out. Details: docs/later.md.
|
|
172
|
+
|
|
173
|
+
### Connecting things to dibs
|
|
174
|
+
|
|
175
|
+
If the person asks you to connect something to dibs, `dibs connect` is the one way in. On its own it explains each choice and, in a terminal, asks which:
|
|
176
|
+
|
|
177
|
+
- `dibs connect --browser`: a one-time code for the page at `http://127.0.0.1:7421` (10 minutes, one use).
|
|
178
|
+
- `dibs connect --phone`: a link and QR code for a phone or any browser at https://app.dibs.cc, end-to-end encrypted through the relay.
|
|
179
|
+
- `dibs connect --account`: every browser the person signs in with at app.dibs.cc opens this Mac.
|
|
180
|
+
- `dibs connect --mcp`: another Claude account's connector reads dibs over MCP at `https://mcp.dibs.cc/mcp`.
|
|
181
|
+
- `dibs connect --machine`: another machine joins the group (above).
|
|
182
|
+
|
|
183
|
+
A browser, phone, account or MCP client can only look unless connected with `--allow-actions`. An MCP client that acts does so as an agent named `mcp-<name>`, never as the person. `dibs pair --allow-commands` also lets a client signed in at this Mac's own address queue commands; never through mcp.dibs.cc. `dibs connect --list` shows everything connected and what each may do; `dibs connect --remove <id>` disconnects one. Details: README.md and docs/relay.md.
|