Where Mātou agents work together to build software
  • Shell 78.3%
  • Python 10.3%
  • JavaScript 7.9%
  • Vue 1.1%
  • TypeScript 0.9%
  • Other 1.4%
Find a file
jamin b02d5cbf31
All checks were successful
ci / static (push) Successful in 3m11s
ci / test (push) Successful in 6m8s
sandcastle: #364 — declare LANDING_TEST_CMD in this repo's running identity layer (the root template had it, the self-copy did not)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 16:15:14 -05:00
.forgejo ci: #370 — a queued ci run that a newer push has overtaken skips its work (only the newest queued run tests) 2026-11-19 15:30:06 -05:00
.sandcastle sandcastle: #364 — declare LANDING_TEST_CMD in this repo's running identity layer (the root template had it, the self-copy did not) 2026-11-20 16:15:14 -05:00
docs sandcastle: #364 — declare LANDING_TEST_CMD in this repo's running identity layer (the root template had it, the self-copy did not) 2026-11-20 16:15:14 -05:00
fleet-tui floor: the Queue and Outbox heads each get a sort dropdown — newest filed / most recent at the top, view only 2026-11-18 01:47:36 -05:00
git-hooks sandcastle: #223 — wire the Factory-Account: <fp> commit trailer (follow-up to #200) 2026-10-15 10:03:46 +00:00
onboarding fleet: landing detection — the dispatcher detects four end-state anomalies and surfaces each at the front of the fleet queue (ADR 0009 slice 5, #358) 2026-11-18 18:13:04 -05:00
prompts session-runner: land PR-mode ready-for-session tickets through a PR instead of skipping them (#302) 2026-10-22 03:05:49 -05:00
tests sandcastle: #385 — landing detection fails safe on an unresolvable main-ref 2026-11-20 15:16:36 -05:00
tui sandcastle: #227 — un-red the 3 suites 0665d8d left red; ci/test green, all 6 pass (advances #227) 2026-10-15 11:45:59 +00:00
.env.example sandcastle: #198 — deliver the Claude OAuth token as a mounted file via a claude shim, not a docker -e value 2026-10-15 04:50:56 +00:00
.gitattributes sandcastle: #300 — the GOTCHAS index stops being the last single-anchor concurrent-write surface 2026-10-22 00:46:14 +00:00
.gitignore chore: gitignore the superpowers plan-execution scratch workspace 2026-09-28 12:24:15 +13:00
.shellcheckrc ci: #215 — a dedicated static job (broadened bash -n + a green shellcheck -S warning -x) 2026-10-15 06:15:31 +00:00
align-worktree.sh rebrand: the origin product is IDSS (was OurCloud); sandbox fence token becomes the generic FACTORY_SANDBOX 2026-08-20 11:21:36 -05:00
ask-human.sh harness: never post a channel-wide mention — @channel/@all/@here are defused before every Mattermost post 2026-09-23 22:54:43 -05:00
body-marker-lib.sh body-marker: a marker quoted in an inline code span is no marker 2026-11-03 22:08:11 -05:00
body-marker.jq body-marker: a marker quoted in an inline code span is no marker 2026-11-03 22:08:11 -05:00
branch-strategy.mts sandcastle: #329 — relocate the push-mode post-run merge out of Sandcastle's lifecycle into the land seam's rescue ladder (faults 1 & 3) 2026-11-05 04:18:28 -05:00
cancel-lib.sh rebrand: the origin product is IDSS (was OurCloud); sandbox fence token becomes the generic FACTORY_SANDBOX 2026-08-20 11:21:36 -05:00
check-harness-drift.sh sandcastle: #352 — HEAL_WORKDIR guarded as a per-host value; a literal /home/... default is hard-refused at enrol and drift time 2026-11-18 15:53:38 +00:00
claim-lib.sh claim-lib: the janitor ages a session claim instead of looking its pid up among swarm runs (#348) 2026-11-18 00:06:39 -05:00
claim-next-task.sh sandcastle: #350 — a no-pick run's in-sandbox claim reaches the Floor slot at claim time 2026-11-18 01:38:36 -05:00
claude-fence sandcastle: #200 — key Claude limit/active markers and spend by token fingerprint, not host letter A/B 2026-10-15 06:27:42 +00:00
CLAUDE.md sandcastle: #300 — the GOTCHAS index stops being the last single-anchor concurrent-write surface 2026-10-22 00:46:14 +00:00
close-report-lib.sh close-report: feed the reviewer prompt on stdin + SKIP an empty result, never fail CLOSED over MAX_ARG_STRLEN (idss #2161) 2026-11-04 13:50:42 -05:00
close-report.sh harness: #359 — close the push close-before-land strand from both ends 2026-11-19 11:56:11 -05:00
CONTEXT.md sandcastle: #351 — the fleet queue arbitrates each dispatch on the tracker, so one ticket goes to one host 2026-11-18 02:00:24 -05:00
env-allowlist-lib.sh sandcastle: #198 — deliver the Claude OAuth token as a mounted file via a claude shim, not a docker -e value 2026-10-15 04:50:56 +00:00
evidence-lib.sh triage: the harness's agent-facing docs are ruled factory-only, and the doc-path ratchet widens to all of docs/ (#47) 2026-08-24 02:26:59 +00:00
execute-lib.sh sandcastle: #329 — relocate the push-mode post-run merge out of Sandcastle's lifecycle into the land seam's rescue ladder (faults 1 & 3) 2026-11-05 04:18:28 -05:00
fence-lib.sh ci: #215 — a dedicated static job (broadened bash -n + a green shellcheck -S warning -x) 2026-10-15 06:15:31 +00:00
fleet-dispatch-lib.sh sandcastle: #384 — the dispatcher no longer offers a host a second pick of a repo it already runs 2026-11-20 15:15:56 -05:00
fleet-dispatch-receiver.py fleet: live-dispatch scoping — the dispatcher can go live on one host's slots then fleet-wide, per host (ADR 0009 slice 4, #357) 2026-11-19 09:21:56 -05:00
fleet-dispatch.sh sandcastle: #384 — the dispatcher no longer offers a host a second pick of a repo it already runs 2026-11-20 15:15:56 -05:00
fleet-landing-detect-lib.sh sandcastle: #385 — landing detection fails safe on an unresolvable main-ref 2026-11-20 15:16:36 -05:00
fleet-queue-lib.sh sandcastle: #376 — host-side runner-queue backpressure follow-ups to #373 2026-11-20 02:42:59 +00:00
fleet-queue.sh sandcastle: #376 — host-side runner-queue backpressure follow-ups to #373 2026-11-20 02:42:59 +00:00
fleet-slot-report-lib.sh fleet: acknowledgements + the host tick stand-down (ADR 0009 slice 3, #356) 2026-11-18 17:36:37 -05:00
forgejo-lib.sh forgejo-lib + heal: bounded GET retry, runner-unit detection, pool-locality honesty (idss #2048) 2026-10-28 15:52:13 -05:00
gate-lib.sh gate: #379 — add a scoped shellcheck tier to the pre-push gate (fail-open until provisioned) 2026-11-19 21:38:34 -05:00
gate.sh gate: #379 — add a scoped shellcheck tier to the pre-push gate (fail-open until provisioned) 2026-11-19 21:38:34 -05:00
git-cred-lib.sh sandcastle: #195 (foundation) — credential-free git origin + per-invocation token helper 2026-10-15 05:38:56 +00:00
git-fence factory core: extract from Matou/ourcloud (ADR 0180 / #571) 2026-08-19 21:45:06 +00:00
git-setup.sh sandcastle: #195 (foundation) — credential-free git origin + per-invocation token helper 2026-10-15 05:38:56 +00:00
heal-lib.sh sandcastle: #304 — the watchdog now fetches the failing run's job log (#188 in watchdog mode) 2026-10-24 05:28:23 +00:00
heal.sh sandcastle: #339 — resolve this host's .runner the way onboarding writes it, reviving #336's dead here state 2026-11-06 13:45:05 +00:00
host-capacity-lib.sh sandcastle: #350 — a no-pick run's in-sandbox claim reaches the Floor slot at claim time 2026-11-18 01:38:36 -05:00
identity-lib.sh sandcastle: #352 — HEAL_WORKDIR guarded as a per-host value; a literal /home/... default is hard-refused at enrol and drift time 2026-11-18 15:53:38 +00:00
land-pr.sh sandcastle: #222 — credential-free git auth across workflows/land-pr/healers/landing guidance (ROOT; re-vendor routed to human) 2026-10-15 10:17:19 +00:00
landing-lib.sh landing: #383 Part B — keep the failed-resolve resolver log for diagnosis 2026-11-20 09:41:07 -05:00
limit-lib.sh sandcastle: #200 — key Claude limit/active markers and spend by token fingerprint, not host letter A/B 2026-10-15 06:27:42 +00:00
list-ready-tasks.sh sandcastle: #378 — split decl from command-substitution to clear the four SC2155 findings reddening ci/static on main 2026-11-19 22:04:27 -05:00
main.mts sandcastle: #329 — relocate the push-mode post-run merge out of Sandcastle's lifecycle into the land seam's rescue ladder (faults 1 & 3) 2026-11-05 04:18:28 -05:00
model-lib.sh sandcastle: #197 — independent reviewer gate over the diff in close-report.sh 2026-10-15 05:26:48 +00:00
notify-mattermost.sh harness: never post a channel-wide mention — @channel/@all/@here are defused before every Mattermost post 2026-09-23 22:54:43 -05:00
package.json self-onboard: the factory is its own third consumer — .sandcastle/ self-pinned at 59c53bd, labels, workflows, identity, prompt copies 2026-08-22 06:32:42 -05:00
park-wiring-lib.sh sandcastle: park_wiring_file_violations strips YAML comments before the entry-point invocation test (#133) 2026-09-06 00:45:58 +00:00
pnpm-lock.yaml self-onboard: the factory is its own third consumer — .sandcastle/ self-pinned at 59c53bd, labels, workflows, identity, prompt copies 2026-08-22 06:32:42 -05:00
pnpm-workspace.yaml pnpm-workspace.yaml: allow esbuild build so cold-store frozen install passes 2026-08-22 12:20:01 +00:00
policy-lib.sh policy + preflight: a dead TRACKER is not an invalid POLICY (idss #2052) 2026-10-20 22:51:16 +00:00
post-issue-ask.sh harness: never post a channel-wide mention — @channel/@all/@here are defused before every Mattermost post 2026-09-23 22:54:43 -05:00
preflight-lib.sh policy + preflight: a dead TRACKER is not an invalid POLICY (idss #2052) 2026-10-20 22:51:16 +00:00
preflight-swarm.sh sandcastle: #198 — deliver the Claude OAuth token as a mounted file via a claude shim, not a docker -e value 2026-10-15 04:50:56 +00:00
preflight-triage.sh sandcastle: #341 — preflight api() bounds each attempt and propagates curl's real rc + http_code, ending the empty-verdict opaque 22 2026-11-07 05:35:31 +00:00
prices.conf sandcastle: #202 — spend telemetry: runs.host column, spend-by grouped query, price table/USD, triage+healer spend 2026-10-15 07:30:18 +00:00
prompt-render-lib.sh sandcastle: #220 — relocate push-mode landing into harness LANDING_RULES; dev-factory LANDING=pr interim rail (prereq #193) 2026-10-15 08:47:11 +00:00
protected-paths-lib.sh sandcastle: #445 boundary — attribute by origin/main, never delete main-owned machinery (idss #2104, forward-port) 2026-11-04 13:50:42 -05:00
provision-lib.sh provision: a FULL docker data root reds the swarm as an anonymous build-image exit=1 with an EMPTY error block — measure before the write (GOTCHAS #411) 2026-11-16 10:35:08 -05:00
README.md sandcastle: #209 — consumer upgrade story: tag pins, a MIGRATIONS ledger, and onboard.sh upgrade 2026-10-15 04:18:26 +00:00
record-run-result.sh #2110: the #574 swarm.db telemetry parse reads the host sink, not only the worker's stdout 2026-11-04 05:45:13 +00:00
rehearsal-heal-lib.sh heal_rails: refuse a drifted factory-vendored edit (ADR 0180) — the heal clone wires no hooksPath so ADR 0287's pre-push drift gate never runs (idss #2177) 2026-11-17 22:44:36 -05:00
rehearsal-report.sh rehearsal-report: keep #495's labels fetch single-attempt under the #2048 lib retry; idss backport debt reconciled 2026-10-28 16:13:20 -05:00
report-lib.sh sandcastle: #301 — one ticket per run; the fleet queue watcher orders dispatch across every repo (ADR 0007) 2026-10-22 23:38:34 -05:00
resume-parked-asks.sh harness: never post a channel-wide mention — @channel/@all/@here are defused before every Mattermost post 2026-09-23 22:54:43 -05:00
run-swarm.sh sandcastle: #381 — mirror the host's verified ready-set on EVERY path so the no-fleet-view claim leg no longer REDs with rc 124 2026-11-19 23:48:23 -05:00
run-triage.sh sandcastle: #218 — finish #205: move the host-capacity guards + sampler + stamps off /tmp (lockstep cutover) 2026-10-15 08:04:37 +00:00
runlog-lib.sh claim harness vs tracker latency: verdict-log sweeper, bounded retry, p95 budgets (origin idss #1279) 2026-09-07 01:16:46 +00:00
schedule-backstop.sh backstop: guard on runs?status=waiting too — a queued run has no task row, so a stalled runner made the tasks-only guard flood 4x (#289, GOTCHAS 78) 2026-10-20 02:23:17 -05:00
schedule-lib.sh sandcastle: #381 — mirror the host's verified ready-set on EVERY path so the no-fleet-view claim leg no longer REDs with rc 124 2026-11-19 23:48:23 -05:00
scheduler-canary.sh scheduler-canary: read the head's own runs (runs?head_sha=, last page first) instead of the recency-paged tasks view; notify refuses fixture forges (#109) 2026-08-28 13:33:58 -05:00
session-host-lib.sh sandcastle: #2114 — session_host_marker reads through body_marker, not its own sed (idss #2114) 2026-11-17 22:44:59 -05:00
session-runner.sh claim-lib: the janitor ages a session claim instead of looking its pid up among swarm runs (#348) 2026-11-18 00:06:39 -05:00
STATUS.md sandcastle: #364 — declare LANDING_TEST_CMD in this repo's running identity layer (the root template had it, the self-copy did not) 2026-11-20 16:15:14 -05:00
swarm-db-lib.sh sandcastle: #202 — spend telemetry: runs.host column, spend-by grouped query, price table/USD, triage+healer spend 2026-10-15 07:30:18 +00:00
swarm-db.py swarm-db: prune-fixtures sweeps leaked test-fixture rows from a live db (#117) 2026-10-21 22:30:35 +00:00
swarm-db.sh sandcastle: #202 — spend telemetry: runs.host column, spend-by grouped query, price table/USD, triage+healer spend 2026-10-15 07:30:18 +00:00
swarm-identity.sh sandcastle: #364 — the #207 rebase resolver had never run; fix its argv, defer a could-not-start resolver, declare LANDING_TEST_CMD 2026-11-19 16:20:25 +00:00
swarm-yield-lib.sh sandcastle: #218 — finish #205: move the host-capacity guards + sampler + stamps off /tmp (lockstep cutover) 2026-10-15 08:04:37 +00:00
swarm-yield-signal.sh sandcastle: #213 — swarm starvation counter, repo-wanted want-file, debounce head-SHA 2026-10-15 03:53:12 +00:00
swarm.config sandcastle: #202 — spend telemetry: runs.host column, spend-by grouped query, price table/USD, triage+healer spend 2026-10-15 07:30:18 +00:00
sweep-lib.sh sandcastle: #218 — finish #205: move the host-capacity guards + sampler + stamps off /tmp (lockstep cutover) 2026-10-15 08:04:37 +00:00
triage-yield-lib.sh sandcastle: #218 — finish #205: move the host-capacity guards + sampler + stamps off /tmp (lockstep cutover) 2026-10-15 08:04:37 +00:00
triage-yield-signal.sh triage: signal a yield loop instead of starving green — per-repo consecutive-yield counter + threshold comment/notice (#110) 2026-08-28 17:30:08 +00:00
verdict-lib.sh fix(verdict): keep the EXIT trap alive when the errlog has no regex match (#154) 2026-09-20 14:05:17 -05:00
verify-lib.sh sandcastle: #445 boundary — attribute by origin/main, never delete main-owned machinery (idss #2104, forward-port) 2026-11-04 13:50:42 -05:00
worktree-lib.sh factory core: extract from Matou/ourcloud (ADR 0180 / #571) 2026-08-19 21:45:06 +00:00

dev-factory

A multi-project software factory: sandboxed AI agents drain product repos' ticket queues into verified, landed code, and e2e drives — with screenshots as the verification currency — confirm that features actually work, end to end, on real infrastructure.

The factory is one machine serving any number of product repos. A repo plugs in by vendoring the harness at a pinned ref and declaring a thin identity layer; the factory never belongs to any one product. Founding decision: docs/adr/0001-*.md. Glossary: CONTEXT.md. Agent instructions: CLAUDE.md. Current state and the live consumer list: STATUS.md.

Linux hosts only (GNU coreutils, bash ≥ 4.3); macOS untested. The harness uses GNU-specific behaviours (stat -c %Y, date -d, flock, timeout, declare -A, sha256sum) with no portability branch; onboard-host preflight executes each one before a machine is enrolled.

Lineage

Three currents converge here:

  • IndyDevDan's software-factory thinking — the factory is a product in its own right: instrumented, observable, continuously reworked; agents are staffed stations around a queue, and the queue's health is a first-class concern. (Reviewed and imported in docs/research/2026-08-11-software-factory-learnings.md.)
  • Matt Pocock's sandcastle (@ai-hero/sandcastle) — the execution primitive: a Claude agent run inside a disposable Docker sandbox on an isolated git worktree, iterated until done, its commits proposed rather than trusted.
  • Matou's own agentic development process — where this harness was hardened in production before being promoted to its own repo: issues-as-queue with labels as the state machine, claim-by-comment multi-host arbitration, "agent proposes, code disposes" close reports, fail-closed gates and protected paths, healers on law-grade rails, and the e2e drive + gap-ticketing loop that makes screenshots the proof of work. (Surveyed in docs/research/2026-08-15-factory-reengineering-survey.md.)

Design principle: pull, not push

The factory never pushes into a product repo and holds no credential that could. Each product pulls: it vendors the harness files byte-identical at a pinned ref — a commit SHA on main, or a release tag (v2026.10.14) onboard.sh vendor resolves to its SHA and records alongside it — recorded as .sandcastle/FACTORY_REF, and upgrades by bumping the pin (onboard.sh upgrade re-renders and diffs everything a bump touches, not only the byte-comparable vendored layer; onboarding/MIGRATIONS is the per-event ledger it reads). "Drift" means a vendored file differs from its pin — structural corruption, always red. A pin that merely trails main is an advisory, never a failure. There is no canonical product repo, and adding the Nth product changes nothing about the topology.

What lives here vs. in a product repo

Here (byte-identical across every consumer): the tested libs (claim/limit/model/verdict/runlog/heal/close-report/gate/protected-paths/ sweep/swarm-db/worktree/rehearsal-heal), the orchestrators (run-swarm.sh, run-triage.sh, heal.sh, rehearsal-report.sh, session-runner.sh, …), forgejo-lib.sh (the tracker adapter), the host-crontab scheduler pair (schedule-backstop.sh, which dispatches a workflow Forgejo's dead scheduler owes a repo, and scheduler-canary.sh, its detection sibling that shouts to Mattermost when a repo's Actions queue has gone silent — saturated or ungated, #105/GOTCHAS 34), swarm.config, git-fence/git-hooks/, and this repo's own tests (tests/*.sh) and CI (.forgejo/workflows/).

In each product repo (the thin declarative identity layer):

  • swarm-identity.sh — the repo's own FORGEJO_API/HEAL_WORKDIR/ REPO_SLUG. Copy the template here and edit the three values; every vendored script sources it for its defaults and carries no repo slug of its own.
  • a Dockerfile — the product's toolchain layer (whatever the worker sandbox needs to build/test that product).
  • repo-specific gate rules, ready-task filters, and extra preflights beyond the vendored defaults.
  • prompt enrichments layered on the skeletons here (prompt.md, heal-prompt.md, rehearsal-*-prompt.md, session-runner-prompt.md) — see "Prompt skeletons" below.
  • an e2e driver conforming to the driver contract (exit non-zero on red; legs.json rewritten per leg; text logs; sortable run dirs; verdict.json), and per-repo .env secrets.
  • host state (crontab entries, the host capacity lock, swarm.db, host scheduling) is factory-owned (ADR 0001 point 4), not yet moved off its current host — tracked as #3.

Prompt skeletons — not yet templated

prompt.md, heal-prompt.md, rehearsal-heal-prompt.md, rehearsal-report-prompt.md, and session-runner-prompt.md ship as reference copies, not yet turned into a real {{REPO_SLUG}}-style skeleton + per-repo enrichment render step. A prompt is live text handed straight to a Claude session — getting a templating/render pipeline wrong risks a broken prompt reaching every future worker, so it is deliberately its own arc (#1) rather than a side effect of anything else.

Plugging in a repo

The vendoring steps (pin a ref, copy the files, write swarm-identity.sh, record the pin) are automated by onboarding/onboard.sh — see onboarding/README.md for the exact subcommands and what's still manual (Mattermost channel creation, runner registration, the live smoke-ticket acceptance gate); STATUS.md tracks the remaining work and the rulings the tool's shape rests on.

By hand, if you'd rather not use the script yet:

  1. Pick a pinned ref (a commit SHA on main).
  2. Copy the files you need into your product repo's .sandcastle/ (everything except this README, .gitignore, and the prompt skeletons until the templating pipeline lands).
  3. Write your own swarm-identity.sh from the template here (or run onboarding/onboard.sh identity).
  4. Record the pinned ref (e.g. .sandcastle/FACTORY_REF) so a drift check can compare your copies against it.
  5. Set up your e2e driver — a repo without drives can land code but cannot prove features work; onboarding treats e2e setup as a mandatory question, not an optional extra.

Tests

bash tests/<name>-test.sh per file, or run the whole suite:

for t in tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done

No network, no docker required — every test shims its own curl/claude.