flockwork 0.1.0__tar.gz

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.
@@ -0,0 +1,162 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the
14
+ copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the legal entity that controls or is
17
+ controlled by such Legal Entity and any entities that control or are
18
+ controlled by such Legal Entity, or are under common control with such Legal
19
+ Entity. For the purposes of this definition, "control" means (i) the power,
20
+ direct or indirect, to cause the direction or management of such Legal
21
+ Entity, whether by contract or otherwise, or (ii) ownership of fifty percent
22
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, whether in Source or
50
+ Object form, made available under the License, as indicated by a
51
+ copyright notice that is included in or attached to the work
52
+ (an example is provided in the Appendix below).
53
+
54
+ "Contributor" shall mean Licensor and any individual or Legal Entity
55
+ on behalf of whom a Contribution has been received for inclusion in
56
+ the Work by the copyright owner or other entity authorized to grant
57
+ such rights on behalf of the copyright owner.
58
+
59
+ 2. Grant of Copyright License. Subject to the terms and conditions of
60
+ this License, each Contributor hereby grants to You a perpetual,
61
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
62
+ copyright license to reproduce, prepare Derivative Works of,
63
+ publicly display, publicly perform, sublicense, and distribute the
64
+ Work and such Derivative Works in Source or Object form.
65
+
66
+ 3. Grant of Patent License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ (except as stated in this section) patent license to make, have made,
70
+ use, offer to sell, sell, import, and otherwise transfer the
71
+ Work, where such license applies to patent claims infringed by
72
+ the Work or any Contribution incorporated in the Work.
73
+
74
+ 4. Redistribution. You may reproduce and distribute copies of the
75
+ Work or Derivative Works thereof in any medium, with or without
76
+ modifications, and in Source or Object form, provided that You
77
+ meet the following conditions:
78
+
79
+ (a) You must give any other recipients of the Work or
80
+ Derivative Works a copy of this License; and
81
+
82
+ (b) You must cause any modified files to carry prominent notices
83
+ stating that You changed the files; and
84
+
85
+ (c) You must retain, in the Source form of any Derivative Works
86
+ that You distribute, all copyright, patent, trademark, and
87
+ attribution notices from the Source form of the Work,
88
+ excluding those notices that do not pertain to any part of
89
+ the Derivative Works; and
90
+
91
+ (d) If the Work includes a "NOTICE" text file as part of its
92
+ distribution, then any Derivative Works that You distribute must
93
+ include a readable copy of the attribution notices contained
94
+ within such NOTICE file, excluding those notices that do not
95
+ pertain to any part of the Derivative Works.
96
+
97
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
98
+ any Contribution intentionally submitted for inclusion in the Work
99
+ by You to the Licensor shall be under the terms and conditions of
100
+ this License, without any additional terms or conditions.
101
+ Notwithstanding the above, nothing herein shall supersede or modify
102
+ the terms of any separate license agreement you may have executed
103
+ with Licensor regarding such Contributions.
104
+
105
+ 6. Trademarks. This License does not grant permission to use the trade
106
+ names, trademarks, service marks, or product names of the
107
+ Licensor, except as required for reasonable and customary use in
108
+ describing the origin of the Work and reproducing the
109
+ inclusion of the Work in derivative works.
110
+
111
+ 7. Disclaimer of Warranty. Unless required by applicable law or
112
+ agreed to in writing, Licensor provides the Work (and each
113
+ Contributor provides its Contributions) on an "AS IS" BASIS,
114
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
115
+ implied, including, without limitation, any warranties or conditions
116
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
117
+ PARTICULAR PURPOSE. You are solely responsible for determining the
118
+ appropriateness of using or redistributing the Work and assume any
119
+ risks associated with your exercise of permissions under this License.
120
+
121
+ 8. Limitation of Liability. In no event and under no legal theory,
122
+ whether in tort (including negligence), contract, or otherwise, unless
123
+ required by applicable law (such as deliberate and gross
124
+ negligence) or agreed to in writing, shall any Contributor be liable
125
+ to You for damages, including any direct, indirect, special, incidental,
126
+ or consequential damages of any character arising from the use of or
127
+ inability to use the Work (or any other breach of this License), even
128
+ if advised of the possibility of such damages.
129
+
130
+ 9. Accepting Warranty or Additional Liability. While redistributing the
131
+ Work or Derivative Works thereof, You may choose to offer, and charge a
132
+ fee for, acceptance of support, warranty, indemnity, or other liability
133
+ obligations and/or rights consistent with this License. However, in
134
+ accepting such obligations, You act on Your own behalf, on Your sole
135
+ responsibility, not on behalf of any Contributor.
136
+
137
+ END OF TERMS AND CONDITIONS
138
+
139
+ APPENDIX: How to apply the Apache License to your work.
140
+
141
+ To apply the Apache License to your work, attach the following
142
+ boilerplate notice, with the fields enclosed by brackets "[]"
143
+ replaced with your own identifying information. Don't include
144
+ the brackets! The text should be enclosed in the appropriate
145
+ comment syntax for the file format. We also recommend that a
146
+ file or class name and description of purpose be included in the
147
+ same "printed page" as the copyright notice for easier
148
+ identification within third-party archives.
149
+
150
+ Copyright 2026 jlam
151
+
152
+ Licensed under the Apache License, Version 2.0 (the "License");
153
+ you may not use this file except in compliance with the License.
154
+ You may obtain a copy of the License at
155
+
156
+ http://www.apache.org/licenses/LICENSE-2.0
157
+
158
+ Unless required by applicable law or agreed to in writing, software
159
+ distributed under the License is distributed on an "AS IS" BASIS,
160
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
161
+ See the License for the specific language governing permissions and
162
+ limitations under the License.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: flockwork
3
+ Version: 0.1.0
4
+ Summary: A worker swarm whose entire coordination substrate is git itself.
5
+ Author: jlam
6
+ License: Apache-2.0
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Topic :: Software Development :: Version Control :: Git
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # flockwork — the swarm that runs like clockwork
17
+
18
+ **flockwork** is a worker swarm whose **entire coordination substrate is
19
+ git itself**: no server, no database, no queue daemon — a shared origin's
20
+ refs under `refs/swarm/` carry task briefs, claims, returns, and
21
+ verdicts, and every guarantee (exactly-once work, honest outcomes,
22
+ bounded retries) reduces to a git property you can verify with
23
+ `ls-remote` and `cat-file`. This repo doubles as its own substrate
24
+ (**D-INREPO**): the machinery lives in `l2/inrepo.py`, and workers
25
+ coordinate through refs on the project's own origin. (The code, CLI, and
26
+ repo internals keep the working name `swarmo` — same product.)
27
+
28
+ > **New to swarms, git refs, or both?** `docs/00-ORIENTATION.md` is the
29
+ > zero-context orientation: the project in 15 sentences, how the pieces
30
+ > relate, which doc to open for which job, what a verdict means, and a
31
+ > full glossary.
32
+
33
+ Run it yourself in five minutes: `QUICKSTART.md` (scratch board, zero
34
+ model spend).
35
+
36
+ ## The refs model (one diagram)
37
+
38
+ ```
39
+ origin (any git remote — a bare repo; e.g. a local bare repo under /tmp)
40
+ ├── refs/heads/main the product: landed fixes
41
+ └── refs/swarm/* the coordination lane
42
+ ├── specs/<task> the brief operator seeds it (root commit,
43
+ │ body carries the task + `verify:` line)
44
+ ├── claims/<task> the lease create-once CAS push — exactly one
45
+ │ worker wins; duplicates are rejected
46
+ ├── tasks/<task> the return points at the fix, on main's lineage
47
+ ├── verdicts/<task> the outcome root commit: task/attempt/fixed/host/rc
48
+ └── archive/<kind>/<task>@<att> dead attempts, preserved (never deleted)
49
+ ```
50
+
51
+ Claim and verdict commits are ROOT commits, so their objects never
52
+ leak into consumer clones or fetches; the whole lane is evictable with
53
+ a one-transaction namespace delete.
54
+
55
+ ## The five verbs
56
+
57
+ 1. **seed** — the operator declares a task: `python3 l2/inrepo.py seed
58
+ spec.json` pushes `refs/swarm/specs/<task>` carrying the brief; a
59
+ `verify:` line in the brief is the task's oracle.
60
+ 2. **claim** — a worker leases a task: a create-once CAS push
61
+ (`push --force-with-lease=<ref>:`) to `refs/swarm/claims/<task>`.
62
+ Git itself rejects the second claim — exactly-once is not a lock
63
+ file, it is the ref database.
64
+ 3. **work** — the claim winner clones the origin, dispatches the brief
65
+ to the model, and the `verify:` line (or host pytest) judges the
66
+ tree. A pass lands the fix on main and points the return ref at it;
67
+ a fail touches nothing but the verdict.
68
+ 4. **verdict** — the attempt closes as a root commit at
69
+ `refs/swarm/verdicts/<task>`: `fixed: true|false`, host, dispatch
70
+ and oracle exit codes. The refs alone must separate environmental
71
+ deaths from honest merit failures.
72
+ 5. **evict** — `sweep`/`reconcile` archive dead attempts to
73
+ `refs/swarm/archive/<kind>/<task>@<att>` and free the live refs in
74
+ one atomic transaction, so the task re-enters the queue; eviction
75
+ is bounded (one heir per death, then a final honest `fixed:false`).
76
+
77
+ ## The honesty laws (what keeps the lane truthful)
78
+
79
+ Claim and verdict commits are ROOT commits so their objects never leak
80
+ into consumer fetches, and eviction is a one-transaction namespace
81
+ delete. Four honesty laws keep the lane truthful. **Claim-loss
82
+ honesty:** a failed claim is classified — a lost race (`! [rejected]
83
+ (stale info)`) is healthy contention to re-scan, a structurally broken
84
+ origin is reported — and bounded by `SWARM_WORKER_MAX_FAILS` so a sick
85
+ host exits instead of spinning. **Law-freshness gate:** each worker
86
+ refuses to claim when its running `l2/inrepo.py` blob differs from
87
+ origin main's published copy, so stale code never writes to the
88
+ substrate. **Environmental honesty:** a dispatch death (timeout, or
89
+ failure with an empty tree) is never recorded as a fix — the attempt is
90
+ archived and requeued to one heir, then closed with a final honest
91
+ `fixed:false`. **Main-push honesty:** a fix is a fix only if its commit
92
+ actually lands on main, else the task requeues under the same bounded
93
+ machinery — and a change that fails its oracle never lands at all: a
94
+ merit failure publishes only its final honest verdict, never to main.
95
+
96
+ **No-default-origin law:** there is **no** default `SWARM_ORIGIN`. Every
97
+ origin resolution is explicit-arg > `SWARM_ORIGIN` at call time > the
98
+ import-time `ORIGIN` > a typed `OriginUnsetError` naming the fix. A
99
+ write or read leg with no origin anywhere refuses *before* any git/ssh
100
+ contact, so a forgotten config can never push into a production board.
101
+
102
+ `python3 l2/inrepo.py audit` is the board's health instrument
103
+ (`h1_pass`: every live claim has a matching return + verdict);
104
+ `reconcile` is the TTL backstop for stale claims; `correction-graph`
105
+ reconstructs the multi-model attempt graph from refs alone.
106
+
107
+ ## Observability (opt-in, zero wire change)
108
+
109
+ - `FLOCKWORK_METRICS=1` turns on a JSONL observer over the lane's own
110
+ results; `python3 -m l2.metrics [files]` summarizes counts,
111
+ reject-rate, and claim→verdict latency. `--dora` adds the DORA five
112
+ over the same stream.
113
+ - `FLOCKWORK_KEEP_TREE=1` preserves a merit-failed attempt's tree so a
114
+ failure is auditable.
115
+
116
+ ## Layout
117
+
118
+ ```
119
+ l2/inrepo.py the lane law: seed/claim/work/verdict/evict + review/gate + audit
120
+ l2/metrics.py the opt-in JSONL observer + DORA judge
121
+ l2/gates.py the verdict-count gate (n-of-m reviewer agreement)
122
+ l2/refschema.py minimal required-field schemas; loud typed refusals
123
+ tests/ the suite (hermetic: scratch boards, no network, no default origin)
124
+ demo/ the scripted end-to-end (owner_test.sh) + the raw CAS demo
125
+ docs/ 00-ORIENTATION (start here), GATES, SCRATCH-BOARDS
126
+ ```
127
+
128
+ ## License
129
+
130
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,115 @@
1
+ # flockwork — the swarm that runs like clockwork
2
+
3
+ **flockwork** is a worker swarm whose **entire coordination substrate is
4
+ git itself**: no server, no database, no queue daemon — a shared origin's
5
+ refs under `refs/swarm/` carry task briefs, claims, returns, and
6
+ verdicts, and every guarantee (exactly-once work, honest outcomes,
7
+ bounded retries) reduces to a git property you can verify with
8
+ `ls-remote` and `cat-file`. This repo doubles as its own substrate
9
+ (**D-INREPO**): the machinery lives in `l2/inrepo.py`, and workers
10
+ coordinate through refs on the project's own origin. (The code, CLI, and
11
+ repo internals keep the working name `swarmo` — same product.)
12
+
13
+ > **New to swarms, git refs, or both?** `docs/00-ORIENTATION.md` is the
14
+ > zero-context orientation: the project in 15 sentences, how the pieces
15
+ > relate, which doc to open for which job, what a verdict means, and a
16
+ > full glossary.
17
+
18
+ Run it yourself in five minutes: `QUICKSTART.md` (scratch board, zero
19
+ model spend).
20
+
21
+ ## The refs model (one diagram)
22
+
23
+ ```
24
+ origin (any git remote — a bare repo; e.g. a local bare repo under /tmp)
25
+ ├── refs/heads/main the product: landed fixes
26
+ └── refs/swarm/* the coordination lane
27
+ ├── specs/<task> the brief operator seeds it (root commit,
28
+ │ body carries the task + `verify:` line)
29
+ ├── claims/<task> the lease create-once CAS push — exactly one
30
+ │ worker wins; duplicates are rejected
31
+ ├── tasks/<task> the return points at the fix, on main's lineage
32
+ ├── verdicts/<task> the outcome root commit: task/attempt/fixed/host/rc
33
+ └── archive/<kind>/<task>@<att> dead attempts, preserved (never deleted)
34
+ ```
35
+
36
+ Claim and verdict commits are ROOT commits, so their objects never
37
+ leak into consumer clones or fetches; the whole lane is evictable with
38
+ a one-transaction namespace delete.
39
+
40
+ ## The five verbs
41
+
42
+ 1. **seed** — the operator declares a task: `python3 l2/inrepo.py seed
43
+ spec.json` pushes `refs/swarm/specs/<task>` carrying the brief; a
44
+ `verify:` line in the brief is the task's oracle.
45
+ 2. **claim** — a worker leases a task: a create-once CAS push
46
+ (`push --force-with-lease=<ref>:`) to `refs/swarm/claims/<task>`.
47
+ Git itself rejects the second claim — exactly-once is not a lock
48
+ file, it is the ref database.
49
+ 3. **work** — the claim winner clones the origin, dispatches the brief
50
+ to the model, and the `verify:` line (or host pytest) judges the
51
+ tree. A pass lands the fix on main and points the return ref at it;
52
+ a fail touches nothing but the verdict.
53
+ 4. **verdict** — the attempt closes as a root commit at
54
+ `refs/swarm/verdicts/<task>`: `fixed: true|false`, host, dispatch
55
+ and oracle exit codes. The refs alone must separate environmental
56
+ deaths from honest merit failures.
57
+ 5. **evict** — `sweep`/`reconcile` archive dead attempts to
58
+ `refs/swarm/archive/<kind>/<task>@<att>` and free the live refs in
59
+ one atomic transaction, so the task re-enters the queue; eviction
60
+ is bounded (one heir per death, then a final honest `fixed:false`).
61
+
62
+ ## The honesty laws (what keeps the lane truthful)
63
+
64
+ Claim and verdict commits are ROOT commits so their objects never leak
65
+ into consumer fetches, and eviction is a one-transaction namespace
66
+ delete. Four honesty laws keep the lane truthful. **Claim-loss
67
+ honesty:** a failed claim is classified — a lost race (`! [rejected]
68
+ (stale info)`) is healthy contention to re-scan, a structurally broken
69
+ origin is reported — and bounded by `SWARM_WORKER_MAX_FAILS` so a sick
70
+ host exits instead of spinning. **Law-freshness gate:** each worker
71
+ refuses to claim when its running `l2/inrepo.py` blob differs from
72
+ origin main's published copy, so stale code never writes to the
73
+ substrate. **Environmental honesty:** a dispatch death (timeout, or
74
+ failure with an empty tree) is never recorded as a fix — the attempt is
75
+ archived and requeued to one heir, then closed with a final honest
76
+ `fixed:false`. **Main-push honesty:** a fix is a fix only if its commit
77
+ actually lands on main, else the task requeues under the same bounded
78
+ machinery — and a change that fails its oracle never lands at all: a
79
+ merit failure publishes only its final honest verdict, never to main.
80
+
81
+ **No-default-origin law:** there is **no** default `SWARM_ORIGIN`. Every
82
+ origin resolution is explicit-arg > `SWARM_ORIGIN` at call time > the
83
+ import-time `ORIGIN` > a typed `OriginUnsetError` naming the fix. A
84
+ write or read leg with no origin anywhere refuses *before* any git/ssh
85
+ contact, so a forgotten config can never push into a production board.
86
+
87
+ `python3 l2/inrepo.py audit` is the board's health instrument
88
+ (`h1_pass`: every live claim has a matching return + verdict);
89
+ `reconcile` is the TTL backstop for stale claims; `correction-graph`
90
+ reconstructs the multi-model attempt graph from refs alone.
91
+
92
+ ## Observability (opt-in, zero wire change)
93
+
94
+ - `FLOCKWORK_METRICS=1` turns on a JSONL observer over the lane's own
95
+ results; `python3 -m l2.metrics [files]` summarizes counts,
96
+ reject-rate, and claim→verdict latency. `--dora` adds the DORA five
97
+ over the same stream.
98
+ - `FLOCKWORK_KEEP_TREE=1` preserves a merit-failed attempt's tree so a
99
+ failure is auditable.
100
+
101
+ ## Layout
102
+
103
+ ```
104
+ l2/inrepo.py the lane law: seed/claim/work/verdict/evict + review/gate + audit
105
+ l2/metrics.py the opt-in JSONL observer + DORA judge
106
+ l2/gates.py the verdict-count gate (n-of-m reviewer agreement)
107
+ l2/refschema.py minimal required-field schemas; loud typed refusals
108
+ tests/ the suite (hermetic: scratch boards, no network, no default origin)
109
+ demo/ the scripted end-to-end (owner_test.sh) + the raw CAS demo
110
+ docs/ 00-ORIENTATION (start here), GATES, SCRATCH-BOARDS
111
+ ```
112
+
113
+ ## License
114
+
115
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: flockwork
3
+ Version: 0.1.0
4
+ Summary: A worker swarm whose entire coordination substrate is git itself.
5
+ Author: jlam
6
+ License: Apache-2.0
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Topic :: Software Development :: Version Control :: Git
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # flockwork — the swarm that runs like clockwork
17
+
18
+ **flockwork** is a worker swarm whose **entire coordination substrate is
19
+ git itself**: no server, no database, no queue daemon — a shared origin's
20
+ refs under `refs/swarm/` carry task briefs, claims, returns, and
21
+ verdicts, and every guarantee (exactly-once work, honest outcomes,
22
+ bounded retries) reduces to a git property you can verify with
23
+ `ls-remote` and `cat-file`. This repo doubles as its own substrate
24
+ (**D-INREPO**): the machinery lives in `l2/inrepo.py`, and workers
25
+ coordinate through refs on the project's own origin. (The code, CLI, and
26
+ repo internals keep the working name `swarmo` — same product.)
27
+
28
+ > **New to swarms, git refs, or both?** `docs/00-ORIENTATION.md` is the
29
+ > zero-context orientation: the project in 15 sentences, how the pieces
30
+ > relate, which doc to open for which job, what a verdict means, and a
31
+ > full glossary.
32
+
33
+ Run it yourself in five minutes: `QUICKSTART.md` (scratch board, zero
34
+ model spend).
35
+
36
+ ## The refs model (one diagram)
37
+
38
+ ```
39
+ origin (any git remote — a bare repo; e.g. a local bare repo under /tmp)
40
+ ├── refs/heads/main the product: landed fixes
41
+ └── refs/swarm/* the coordination lane
42
+ ├── specs/<task> the brief operator seeds it (root commit,
43
+ │ body carries the task + `verify:` line)
44
+ ├── claims/<task> the lease create-once CAS push — exactly one
45
+ │ worker wins; duplicates are rejected
46
+ ├── tasks/<task> the return points at the fix, on main's lineage
47
+ ├── verdicts/<task> the outcome root commit: task/attempt/fixed/host/rc
48
+ └── archive/<kind>/<task>@<att> dead attempts, preserved (never deleted)
49
+ ```
50
+
51
+ Claim and verdict commits are ROOT commits, so their objects never
52
+ leak into consumer clones or fetches; the whole lane is evictable with
53
+ a one-transaction namespace delete.
54
+
55
+ ## The five verbs
56
+
57
+ 1. **seed** — the operator declares a task: `python3 l2/inrepo.py seed
58
+ spec.json` pushes `refs/swarm/specs/<task>` carrying the brief; a
59
+ `verify:` line in the brief is the task's oracle.
60
+ 2. **claim** — a worker leases a task: a create-once CAS push
61
+ (`push --force-with-lease=<ref>:`) to `refs/swarm/claims/<task>`.
62
+ Git itself rejects the second claim — exactly-once is not a lock
63
+ file, it is the ref database.
64
+ 3. **work** — the claim winner clones the origin, dispatches the brief
65
+ to the model, and the `verify:` line (or host pytest) judges the
66
+ tree. A pass lands the fix on main and points the return ref at it;
67
+ a fail touches nothing but the verdict.
68
+ 4. **verdict** — the attempt closes as a root commit at
69
+ `refs/swarm/verdicts/<task>`: `fixed: true|false`, host, dispatch
70
+ and oracle exit codes. The refs alone must separate environmental
71
+ deaths from honest merit failures.
72
+ 5. **evict** — `sweep`/`reconcile` archive dead attempts to
73
+ `refs/swarm/archive/<kind>/<task>@<att>` and free the live refs in
74
+ one atomic transaction, so the task re-enters the queue; eviction
75
+ is bounded (one heir per death, then a final honest `fixed:false`).
76
+
77
+ ## The honesty laws (what keeps the lane truthful)
78
+
79
+ Claim and verdict commits are ROOT commits so their objects never leak
80
+ into consumer fetches, and eviction is a one-transaction namespace
81
+ delete. Four honesty laws keep the lane truthful. **Claim-loss
82
+ honesty:** a failed claim is classified — a lost race (`! [rejected]
83
+ (stale info)`) is healthy contention to re-scan, a structurally broken
84
+ origin is reported — and bounded by `SWARM_WORKER_MAX_FAILS` so a sick
85
+ host exits instead of spinning. **Law-freshness gate:** each worker
86
+ refuses to claim when its running `l2/inrepo.py` blob differs from
87
+ origin main's published copy, so stale code never writes to the
88
+ substrate. **Environmental honesty:** a dispatch death (timeout, or
89
+ failure with an empty tree) is never recorded as a fix — the attempt is
90
+ archived and requeued to one heir, then closed with a final honest
91
+ `fixed:false`. **Main-push honesty:** a fix is a fix only if its commit
92
+ actually lands on main, else the task requeues under the same bounded
93
+ machinery — and a change that fails its oracle never lands at all: a
94
+ merit failure publishes only its final honest verdict, never to main.
95
+
96
+ **No-default-origin law:** there is **no** default `SWARM_ORIGIN`. Every
97
+ origin resolution is explicit-arg > `SWARM_ORIGIN` at call time > the
98
+ import-time `ORIGIN` > a typed `OriginUnsetError` naming the fix. A
99
+ write or read leg with no origin anywhere refuses *before* any git/ssh
100
+ contact, so a forgotten config can never push into a production board.
101
+
102
+ `python3 l2/inrepo.py audit` is the board's health instrument
103
+ (`h1_pass`: every live claim has a matching return + verdict);
104
+ `reconcile` is the TTL backstop for stale claims; `correction-graph`
105
+ reconstructs the multi-model attempt graph from refs alone.
106
+
107
+ ## Observability (opt-in, zero wire change)
108
+
109
+ - `FLOCKWORK_METRICS=1` turns on a JSONL observer over the lane's own
110
+ results; `python3 -m l2.metrics [files]` summarizes counts,
111
+ reject-rate, and claim→verdict latency. `--dora` adds the DORA five
112
+ over the same stream.
113
+ - `FLOCKWORK_KEEP_TREE=1` preserves a merit-failed attempt's tree so a
114
+ failure is auditable.
115
+
116
+ ## Layout
117
+
118
+ ```
119
+ l2/inrepo.py the lane law: seed/claim/work/verdict/evict + review/gate + audit
120
+ l2/metrics.py the opt-in JSONL observer + DORA judge
121
+ l2/gates.py the verdict-count gate (n-of-m reviewer agreement)
122
+ l2/refschema.py minimal required-field schemas; loud typed refusals
123
+ tests/ the suite (hermetic: scratch boards, no network, no default origin)
124
+ demo/ the scripted end-to-end (owner_test.sh) + the raw CAS demo
125
+ docs/ 00-ORIENTATION (start here), GATES, SCRATCH-BOARDS
126
+ ```
127
+
128
+ ## License
129
+
130
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,20 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ flockwork.egg-info/PKG-INFO
5
+ flockwork.egg-info/SOURCES.txt
6
+ flockwork.egg-info/dependency_links.txt
7
+ flockwork.egg-info/entry_points.txt
8
+ flockwork.egg-info/top_level.txt
9
+ l2/__init__.py
10
+ l2/gates.py
11
+ l2/inrepo.py
12
+ l2/metrics.py
13
+ l2/refschema.py
14
+ tests/test_gates.py
15
+ tests/test_inrepo_gate.py
16
+ tests/test_keep_tree.py
17
+ tests/test_metrics.py
18
+ tests/test_origin_refusal.py
19
+ tests/test_packaging.py
20
+ tests/test_refschema.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ flockwork = l2.inrepo:main
@@ -0,0 +1,5 @@
1
+ """flockwork lane — the git-refs coordination substrate.
2
+
3
+ The CLI lives in l2/inrepo.py; the opt-in observer in l2/metrics.py;
4
+ the verdict-count gate in l2/gates.py; the ref schemas in l2/refschema.py.
5
+ """