Queue → gate → PR → review / fix
GitHub issues are the queue. Labels are the state machine. The hourly dispatcher has no model of its own: it picks work, runs the kit, and writes the ledger.
One warlock per machine, many imps per machine, many machines. The warlock is the single
dispatch.mjs cycle; the imp-runner is the detached checkout it executes; imps are the workers.
More throughput means more imps (--concurrency), never a second warlock — two would see the same
imp:ready labels, pick the same briefs, and race on one imp-nm- volume.
Machines coordinate only through labels. Contract:
WARLOCK.md, checked by
node .
imp:ready + an comment with front matter (repo, issue, test, maxLines, allow).9router imp. Push URL is no_push.maxLines, paths under allow, deny list clean, every imp commit carries the trailer.imp, read-only review, up to two fix rounds on feedback / red CI, then imp:needs-human. wins. Front matter is taken verbatim. The runner substitutes {wt} and runs test: itself — the model's "tests pass" claim is never trusted.dispatch.mjs hourly at :07 plus a 5-minute label watch: lock file, 9router MAX health probe, reclaim stranded claims, fix-sweep open imp PRs first, then pick quiet repos (prefer bot:review), respect WIP / per-repo / daily caps, pause a repo 24 h after two straight gate failures.imp.mjs run through 9router with PATH + router URL/key only. Tools: Read, Edit, Write, Glob, Grep, a short git allowlist, docker run. No gh, no host npm.lint: in Docker, at least one commit, Co-Authored-By: …imp on every imp-authored commit, no leftovers, size and scope checks, hard deny of .github/, .env*, secrets/, lockfiles.imp.mjs pr pushes and opens the PR. review.mjs posts a read-only COMMENT review (verdict recomputed from findings). fix.mjs answers threads and red CI for at most two rounds.imp:ready → imp:working → imp:pr or imp:failed. Exhausted fix rounds or a conflict get imp:needs-human.
The kit can arm squash auto-merge when the reviewer verdict is approve and every check on the head commit is green — and it re-checks before merging, because
gh pr merge --auto only waits for required checks.
The queue is the lock. Nothing else is shared.
There is no shared database, no shared volume and no leader election. Each machine has its own warlock, its own
runner checkout and its own ~/.imps state, and the only thing they read and write in common is GitHub.
That keeps a machine's death local — and it is also where the interesting failure modes live, so each one has a
mechanism rather than a hope.
imp:ready → imp:working before spawning. Another machine sees the label and skips it. The window between reading the search result and flipping it is real and accepted: a duplicate imp produces a duplicate PR, which a human closes — not a corrupted repo. comment naming the machine and the time. The dispatcher reclaims claims older than 3 h made by another machine with no live run in this machine's ledger, comment , and put the issue back on imp:ready. A crashed machine therefore strands an issue for up to three hours, not forever.~/.imps/runs.jsonl never leaves the machine. A warlock cannot fix-sweep a PR opened from another machine's ledger — it logs the PR as unknown and skips. Fix rounds happen on the machine that opened the PR, which is the machine holding its worktree and its test context.kitSha or machine. A future kit change will add these fields so a behaviour change after a kit fix is attributable — you can tell a bad brief from a machine that is forty commits behind instead of guessing."heartbeat": true in config.json or IMPS_HEARTBEAT=1 will update one issue, imps heartbeat: , with its kit sha, last cycle and runs today. A row that has stopped moving is a machine that is not running. It will never fail a cycle — a heartbeat that can break the loop would be worse than no heartbeat.IMPS_HOME. The ledger is the warlock's memory, not a cache, and two
writers make every fix-sweep decision a coin flip.
The model is nondeterministic. The rails are not.
Everything that can be a script is a script. Caps live in code defaults (see
defaults.mjs /
lib.mjs), not in wishful docs, and
check-defaults.mjs reads STANDARD.md and dispatch.mjs header and fails the build when they disagree with the code; it does not read pages/imps.html.
| Rail | What the code does |
|---|---|
| Clean env | Worker gets PATH and the 9router URL/key. No Claude session tokens, no GitHub token. |
| No push from the worker | Worktree push URL is no_push. Only imp.mjs pr pushes, and only after the gate passes. |
| Diff budget | Gate default maxLines is 15 (brief can raise it). Fix rounds get --slack 30 extra lines. |
| Scope | Every changed path must start with a brief allow: prefix when allow is set. |
| Deny list | .github/, .env anywhere, secrets/, package / yarn / pnpm / bun lockfiles. |
| Trailer | Every commit authored as the imp must match /Co-Authored-By: .*imp/i. |
| Throughput caps | Defaults today: --max 5, --wip 8, --per-repo 4, --concurrency 4, --daily-cap 15, quiet repos only for quietHours 6. |
| Quota | Per-model run counter lives in ~/.imps, not the checkout, and refills on a rolling window. A counter in a directory that is reset every cycle could neither persist nor limit anything. |
| Cooldown | 24 h repo pause after two consecutive gate failures (loopBudget). |
| Fix budget | Two rounds, then imp:needs-human. Conflicts escalate the same way. |
| Earned trust | Auto-merge requires autoMergeTrust (3) previously merged imp PRs with all checks green for that repo, seeded from GitHub history. A seed query error fails closed. |
A detached runner that keeps itself current
The kit lives in the public nitsuah/.github imps/
tree (same pattern as journeys). Each machine keeps a detached checkout outside
any project tree, so the hourly wrapper can reset it to origin/main before every run and only merged kit
code runs unattended.
setup.ps1 / setup.sh
Checks node, git, gh auth, Docker and 9router. Installs the detached runner, clones IMPS_CODE/.github for kit self-work, creates ~/.imps, and registers the schedule.
hourly :07 + label watch
Windows: two Scheduled Tasks. macOS/Linux: crontab when it exists; otherwise setup prints a hint to configure your own scheduler (it does not install systemd timers automatically and does not fail).
fetch + reset every cycle (exit-code checked)
The Unix wrappers (hourly.sh, label-watch.sh) abort on failed fetch or reset. The Windows wrappers (hourly.cmd, label-watch.cmd) check exit codes after git fetch and git reset — a failed fetch or reset aborts the cycle so a merged kit change always reaches the machine.
| Path | What | Reset by updates? |
|---|---|---|
| runner checkout | the kit — code only | yes, reset --hard origin/main every cycle |
IMPS_CODE clone | base for kit self-work worktrees | no — fetched only |
~/.imps | ledger, logs, locks, config.json, quota | never — machine state |
imps/preflight.mjs refuses a checkout where a required kit file is missing or any .mjs is under 200 bytes. A hand-copied stub once satisfied a "does the file exist" check and no-op'd on schedule for days while every dashboard looked healthy — an existence check is not a health check.warlock.mjs checks: runner path known, runner is a real git checkout, has imps/dispatch.mjs, no tracked edits, current with origin/main, hourly.cmd (Windows) or hourly.sh (Unix) points at it and was generated from its sha, exactly one dispatch task (on Windows; Unix users must verify manually), lock not stale, ledger parseable, and one HTTP MAX probe to 9router. preflight.mjs and doctor.ps1 do not run warlock.mjs; they only verify the kit files exist and pass size checks.warlock.mjs checks: runner path known, runner is a real git checkout, has imps/dispatch.mjs, no tracked edits, current with origin/main, hourly.cmd (Windows) or hourly.sh (Unix) points at it and was generated from its sha, exactly one dispatch task (on Windows; Unix users must verify manually), lock not stale, ledger parseable — and one HTTP MAX probe to 9router.
Deploying a second machine is therefore: clone, run setup, done. It pulls its own updates from then on. When a machine genuinely stalls, operators must monitor stalled machines independently. The kit's RSI loop (rsi.mjs) files imp:ready issues against the kit for recurring gate failures, fix-loop needs-human spikes, and open journey issues observed during running cycles — so the fleet repairs its own tooling instead of waiting for a person to notice.
Measure the runs. Teach the preamble.
Every run writes a ledger row (model served, turns, tool errors, gate reasons, tokens, kit sha). That is the training data for the next prompt change — not vibes.
node imps/imp.mjs report (and stats.mjs) surfaces recurring tool-error kinds and gate failures; dispatch.jsonl carries the same provenance for queue decisions.PREAMBLE.md, or one gate rule in lib.mjs, citing the run ids. Same loop for REVIEW.md and FIX.md.rsi.mjs turns recurring gate failures, fix-loop needs-human spikes and open journey issues into capped imp:ready issues — including kit briefs against .github, so a machine that stalls leaves a written reason behind.Journeys find. Imps fix. Journeys verify.
Nightly journeys cost zero tokens and file bot:journey issues with screenshots and a Docker repro.
Imps are for the small, already-diagnosed fixes (often bot:review first). Green nights after the merge
are the verification — the bot closes the issue, not the author.
Journeys
AI once at setup. Playwright every night. Dedup, reopen, auto-close after three green nights.
fixImps
One briefed issue, one gated PR, bounded fix rounds. Public kit shared across repos and machines.
nextmotor-pool plan
Long-term: durable queue, imp-runner container, GitHub App identity, imps never merge without a human ruleset.