interplane.Get Omega
Read in your language

interplane-mv

INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.

Brought by drakestapleton

branch main Branches Tags History

interplane-mv / docs / FORGE.md

152 lines · 10375 bytes Raw Blame History Rendered
1# INTERPLANE Forge: the authority boundary for code
2
3> Agents express intent. The forge retains authority.
4
5INTERPLANE Forge is a module of INTERPLANE. It applies the protocol's own rule (Crossveil:
6"Nothing crosses the veil as authority merely because a model requested it") to code hosting.
7It is a GitHub replacement I am building on Radicle (radicle.xyz; the Heartwood protocol and
8its `rad` CLI). Radicle stores and replicates repositories and patches peer to peer; that part
9is Radicle's work, not mine. The forge adds the merge decision on top: agents open patches,
10and only gates, exact-head review verdicts and people decide what merges.
11
12The forge is one program, `forge` (seeded Omega, `forge/forge.om`), with three commands:
13`forge decide` makes the merge decision from three intent objects, `forge gate` runs a
14repository's gate and its negative control in fresh clones of an exact head and writes the gate
15receipt, and `forge status` reads a repository's live Radicle patches and decides each one that has
16a verdict. Section 6 lists what runs today and what is planned; nothing in this document claims
17feature parity with GitHub.
18
19## 1. Intent objects
20
21An intent object asks for something. None of them is authority by itself.
22
23| Object | Written by | Form | Carries |
24|---|---|---|---|
25| Patch proposal | an agent (through the desk; today RadPublish opens the Radicle patch from the agent's READY file) | a Radicle patch (COB `xyz.radicle.patch`) whose current revision has one head commit | the proposed change and its exact head sha |
26| Review verdict | an independent reviewer | the desk verdict file, line 1 `VERDICT MERGE\|MERGE_AFTER_FIX\|REJECT head=<40 hex>`, one `reviewer=` line | a judgement about exactly one head |
27| Gate receipt | `forge gate`, from two fresh clones of the exact head | `forge-receipt v1` (`forge/README.md`) | the repository, clone head and tree, omc sha256, the gate and negative-control commands and exit codes, the patch author, UTC start and finish, SHA-256 of both logs |
28
29The verdict format is the desk format already in use (`~/handoffs/hive/manager/reviews/`); the
30forge reads it as is. The receipt format is defined in `forge/README.md`. `forge gate` writes
31evidence, not a decision: its exit code says whether `decide` could merge, but only `decide` decides.
32
33## 2. Authority: the merge decision
34
35`forge decide <patch-head> <verdict-file> <gate-receipt>` is the merge decision. It prints
36`MERGE OK` and exits 0 only when every invariant below holds; otherwise it prints
37`HOLD <CODE>` and exits 1, with the first invariant that failed as the code. There is no third
38outcome and no override flag. A HOLD is not an error to work around: the patch waits for a new
39verdict, a new receipt or a person.
40
41The decision is a pure function of the three inputs. `decide` reads two files and its arguments,
42writes one line, and starts no process. It does not merge: performing the merge (pushing `main`
43as the repository's delegate) stays with the delegate, today RadPublish following
44`~/handoffs/radicle/PROTOCOL.md` section 4. `forge decide` is the check that the delegate runs
45before that push.
46
47## 3. Fail-closed invariants
48
49Each is checked in this order; reason codes are in `forge/README.md`.
50
511. **Well-formed inputs.** The patch head is 40 lowercase hex. The verdict has one `VERDICT` line,
52 first, in the exact form, ended by a newline or the end of the file; a second `VERDICT` line, a
53 short or uppercase head, a trailing byte or space, a second word (`VERDICT MERGE head=<sha>
54 REJECT`) or CRLF is malformed, and so is a control byte in the `reviewer=` value. The receipt
55 has the exact header, known keys only, each at most once. Missing, empty or oversized files are
56 unreadable. Malformed and unreadable both HOLD.
572. **MERGE only.** `MERGE_AFTER_FIX` and `REJECT` HOLD. A verdict asking for fixes is not a merge,
58 however small the fixes.
593. **Exact head.** The verdict's head equals the patch head on all 40 hex digits. A prefix match is
60 not a match. A new revision of the patch has a new head, so it voids the verdict (as the desk
61 protocol says).
624. **A named reviewer.** The verdict has exactly one `reviewer=` line, and its value holds at least
63 one printable ASCII byte (33..126).
645. **The gate ran on that head.** The receipt's `clone` equals the patch head.
656. **The runs finished.** Neither `gate_rc` nor `negctl_rc` is 124, the code `forge gate` records
66 when it killed a run at its timeout (`HOLD GATE_TIMEOUT`). This comes before the results
67 (items 7 and 8) because a killed run's exit code says nothing about the patch: the evidence is
68 incomplete before it is a failure, and a timed-out negative control must not count as a control
69 that failed. A command that exits 124 by itself is read the same way (fail closed).
707. **The gate passed.** `gate_rc` is 0.
718. **The negative control failed.** The receipt has `negctl_rc`, and it is not 0. A gate whose
72 negative control passes cannot tell a broken patch from a good one, so its PASS proves nothing.
739. **No self-review.** The normalized reviewer text does not contain the normalized author: both
74 are folded to ASCII lower case, with runs of spaces, tabs, `_` and `-` collapsed to one space,
75 and ASCII punctuation and spaces stripped at both ends. Identities are unsigned text until
76 signed receipts land. Nobody merges their own work.
77
78Anything the forge cannot prove is a HOLD. Every invariant has a test case that breaks only it
79and a mutant of `forge.om` that removes or weakens it; `forge/tests/run.sh` requires every case to
80give its expected line and exit code and every mutant to be caught.
81
82Limits, stated plainly:
83
84- Identities are asserted text. The verdict's `reviewer=` and the receipt's `author=` are not
85 signed, so the self-review check compares normalized text (item 9: also `_` and `-` as spaces,
86 ASCII punctuation stripped at both ends), not identities; it does not fold Unicode case or
87 punctuation, or catch an alias. Signed verdicts (the desk's `rad patch review` or sigcheck route)
88 and signed receipts are planned.
89- `forge status` decides at most 512 patches of a repository; when rad lists more it prints
90 `TRUNCATED patches=N examined=512` and exits 2.
91- `forge gate` runs the gate and the negative control each in its own process group with a timeout
92 (`--timeout S`, 1 to 86400, default 1800 s): at the timeout the whole
93 group and the direct child by its pid get `SIGKILL`, the rc is recorded as 124 and a timeout line
94 is appended to the hashed log; forge waits at most 10 s more for the reap. A grandchild that
95 leaves the group (`setsid`, `setpgid`) escapes the kill, a direct child in uninterruptible sleep
96 is left unreaped to init, background processes left after a
97 command exits are not killed, and the gate command runs with the rights of the user who runs it.
98 The receipt records `gate_cmd` joined with spaces, not shell-quoted. `decide` checks the form of
99 `rid`, `tree`, `omc`, times and log hashes but compares none of them with anything.
100- `decide` trusts the paths it is given; `status` finds files by name (section 5).
101
102## 4. Mapping onto Crossveil
103
104Crossveil (`spec/CROSSVEIL.md`) splits an effect into `decide` and `execute` and keeps authority on
105the runtime side. The forge uses the same split for a merge.
106
107| Crossveil | Forge |
108|---|---|
109| `capability_request` from the model | the patch proposal (and its exact head) from an agent |
110| runtime adapter `decide(request, context) -> decision` | `forge decide head verdict receipt -> MERGE \| HOLD` |
111| `authorized` | `MERGE OK` |
112| `denied` | `HOLD` with a reason (`VERDICT_REJECT`, `GATE_FAIL`, `SELF_REVIEW`, …) |
113| `requires_approval`, continued only by the host with the minted `approval_id` | `HOLD VERDICT_MERGE_AFTER_FIX` or a missing verdict: only a new reviewer verdict for the exact head continues it; nothing in the patch is read as approval |
114| approval correlated to the digest of the exact `capability_request` | verdict and receipt bound to the exact 40-hex head |
115| unknown decision value is `denied` | unknown verdict kind, malformed or unreadable files are `HOLD` |
116| adapter fault in `decide` becomes `denied` | the forge failing to read or parse anything is `HOLD` |
117| `execute` runs only after `authorized` | the delegate pushes `main` only after `MERGE OK` |
118| a stale catalog is `stale_capability` | a new patch revision changes the head, so the old verdict gives `HEAD_MISMATCH` |
119
120## 5. `forge status`
121
122`forge status <RID> [reviews-dir [receipts-dir]]` asks the local Radicle node's storage, through
123`rad patch list --all` and `rad patch show`, for every patch of the repository, its status and its
124current head. For a head H it looks for exactly one verdict named `*-<H[0..8]>.verdict.txt` in the
125reviews directory and exactly one receipt named `*-<H[0..8]>.receipt.txt` (the name `forge gate`
126writes) in the receipts directory (names are followed through symlinks; two or more are
127`VERDICT_AMBIGUOUS` / `RECEIPT_AMBIGUOUS`), and prints the decision or `NOT_RUN no verdict file`.
128It is read-only: it never merges, comments or pushes.
129
130## 6. Today and planned
131
132Runs today (HOST_TESTED on spark, aarch64; evidence in the forge READY files):
133
134- Radicle hosting and replication of the AIEN repositories (Radicle's software; my node and seeds),
135 with the desk protocol: READY file, independent exact-head verdict, delegate merge.
136- `forge decide` (text and `--json`), replaying real desk decisions: omega-mv 215ea39a and CUDApp
137 9714eba8 give MERGE, aien-architecture-mv 6daec174 gives HOLD (MERGE_AFTER_FIX), plus head
138 mismatch, missing negative control and the other invariants; all mutants caught.
139- `forge gate` writing receipts from fresh clones out of Radicle storage, checked against `git`,
140 `sha256sum` and `date -u` in the test suite, with a per-run timeout that kills the run's process
141 group and holds as `GATE_TIMEOUT`.
142- `forge status` against live Radicle storage.
143
144Planned (not built):
145
146- Signed verdicts and receipts, checked by the forge.
147- A native Omega reader of Radicle patch COBs and git objects, replacing the `rad` and `git` CLI
148 calls; an HTTP read path through radicle-httpd.
149- A web UI for patches, verdicts and decisions.
150- Issues.
151- CI runners on more than one host.
152- Federation of reviews: verdicts from reviewers on other Radicle nodes.