flockwork — the swarm that runs like clockwork
flockwork is a worker swarm whose entire coordination substrate is
git itself: no server, no database, no queue daemon — a shared origin's
refs under refs/swarm/ carry task briefs, claims, returns, and
verdicts, and every guarantee (exactly-once work, honest outcomes,
bounded retries) reduces to a git property you can verify with
ls-remote and cat-file. This repo doubles as its own substrate
(D-INREPO): the machinery lives in l2/inrepo.py, and workers
coordinate through refs on the project's own origin. (The code, CLI, and
repo internals keep the working name swarmo — same product.)
New to swarms, git refs, or both?
docs/00-ORIENTATION.mdis the zero-context orientation: the project in 15 sentences, how the pieces relate, which doc to open for which job, what a verdict means, and a full glossary.
Run it yourself in five minutes: QUICKSTART.md (scratch board, zero
model spend).
The refs model (one diagram)
origin (any git remote — a bare repo; e.g. a local bare repo under /tmp)
├── refs/heads/main the product: landed fixes
└── refs/swarm/* the coordination lane
├── specs/<task> the brief operator seeds it (root commit,
│ body carries the task + `verify:` line)
├── claims/<task> the lease create-once CAS push — exactly one
│ worker wins; duplicates are rejected
├── tasks/<task> the return points at the fix, on main's lineage
├── verdicts/<task> the outcome root commit: task/attempt/fixed/host/rc
└── archive/<kind>/<task>@<att> dead attempts, preserved (never deleted)
Claim and verdict commits are ROOT commits, so their objects never leak into consumer clones or fetches; the whole lane is evictable with a one-transaction namespace delete.
The five verbs
- seed — the operator declares a task:
python3 l2/inrepo.py seed spec.jsonpushesrefs/swarm/specs/<task>carrying the brief; averify:line in the brief is the task's oracle. - claim — a worker leases a task: a create-once CAS push
(
push --force-with-lease=<ref>:) torefs/swarm/claims/<task>. Git itself rejects the second claim — exactly-once is not a lock file, it is the ref database. - work — the claim winner clones the origin, dispatches the brief
to the model, and the
verify:line (or host pytest) judges the tree. A pass lands the fix on main and points the return ref at it; a fail touches nothing but the verdict. - verdict — the attempt closes as a root commit at
refs/swarm/verdicts/<task>:fixed: true|false, host, dispatch and oracle exit codes. The refs alone must separate environmental deaths from honest merit failures. - evict —
sweep/reconcilearchive dead attempts torefs/swarm/archive/<kind>/<task>@<att>and free the live refs in one atomic transaction, so the task re-enters the queue; eviction is bounded (one heir per death, then a final honestfixed:false).
The honesty laws (what keeps the lane truthful)
Claim and verdict commits are ROOT commits so their objects never leak
into consumer fetches, and eviction is a one-transaction namespace
delete. Four honesty laws keep the lane truthful. Claim-loss
honesty: a failed claim is classified — a lost race (! [rejected] (stale info)) is healthy contention to re-scan, a structurally broken
origin is reported — and bounded by SWARM_WORKER_MAX_FAILS so a sick
host exits instead of spinning. Law-freshness gate: each worker
refuses to claim when its running l2/inrepo.py blob differs from
origin main's published copy, so stale code never writes to the
substrate. Environmental honesty: a dispatch death (timeout, or
failure with an empty tree) is never recorded as a fix — the attempt is
archived and requeued to one heir, then closed with a final honest
fixed:false. Main-push honesty: a fix is a fix only if its commit
actually lands on main, else the task requeues under the same bounded
machinery — and a change that fails its oracle never lands at all: a
merit failure publishes only its final honest verdict, never to main.
No-default-origin law: there is no default SWARM_ORIGIN. Every
origin resolution is explicit-arg > SWARM_ORIGIN at call time > the
import-time ORIGIN > a typed OriginUnsetError naming the fix. A
write or read leg with no origin anywhere refuses before any git/ssh
contact, so a forgotten config can never push into a production board.
python3 l2/inrepo.py audit is the board's health instrument
(h1_pass: every live claim has a matching return + verdict);
reconcile is the TTL backstop for stale claims; correction-graph
reconstructs the multi-model attempt graph from refs alone.
Observability (opt-in, zero wire change)
FLOCKWORK_METRICS=1turns on a JSONL observer over the lane's own results;python3 -m l2.metrics [files]summarizes counts, reject-rate, and claim→verdict latency.--doraadds the DORA five over the same stream.FLOCKWORK_KEEP_TREE=1preserves a merit-failed attempt's tree so a failure is auditable.
Layout
l2/inrepo.py the lane law: seed/claim/work/verdict/evict + review/gate + audit
l2/metrics.py the opt-in JSONL observer + DORA judge
l2/gates.py the verdict-count gate (n-of-m reviewer agreement)
l2/refschema.py minimal required-field schemas; loud typed refusals
tests/ the suite (hermetic: scratch boards, no network, no default origin)
demo/ the scripted end-to-end (owner_test.sh) + the raw CAS demo
docs/ 00-ORIENTATION (start here), GATES, SCRATCH-BOARDS
License
Apache-2.0. See LICENSE.
Metadata
Release files for flockwork 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flockwork-0.2.0.tar.gz | 65.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flockwork-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 111.8 kB
Release files / flockwork-0.2.0.tar.gz
| Download URL | flockwork-0.2.0.tar.gz |
|---|---|
| Size | 65.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
130a709427ad2c8a526b21e13b92a0f466599766af8995c55d65844ee4b72931
|
|
BLAKE2b-256 checksum How to use checksums |
46b47d0f9f833fdac178d952803e265b0c487555793692239efe3c974ca0d03e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / flockwork-0.2.0-py3-none-any.whl
| Download URL | flockwork-0.2.0-py3-none-any.whl |
|---|---|
| Size | 45.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c69894cb706d94f6e9879090ba7be53e673095bcd09f168172a7dc092fde4cd5
|
|
BLAKE2b-256 checksum How to use checksums |
c65e2b1a3b54b3a8d024c478c1a1caf9d6cdda5af2ac7f5bfb6e95b3b72384d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for flockwork 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.