Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-mv/tree/main/forge # interplane-mv INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-mv / forge` `708b4da` docs: first person, Drake's own voice (L422) Drake Stapleton committed 2026-11-09 ``` .. tests/ DEPENDENCIES.md 3891 README.md 16696 forge.om 49062 ``` README.md # INTERPLANE Forge v1: `forge` The merge decision of INTERPLANE Forge and the gate runner that feeds it, in seeded Omega (`forge.om`). Spec: `docs/FORGE.md`. Host dependencies: `DEPENDENCIES.md`. Agents express intent. The forge retains authority. An agent proposes a patch, an independent reviewer writes a verdict for one exact head, `forge gate` runs the gate and its negative control in fresh clones of that head and writes a receipt. `forge decide` is the only step that turns those three objects into MERGE, and it says HOLD for anything it cannot prove. ## Build and test ``` OMC=~/work/flux/omega-mv/seed/out/omc # omega-mv f4df8239, sha256 3ad9f10f…3194 "$OMC" < forge/forge.om > /tmp/forge && chmod +x /tmp/forge OMC="$OMC" sh forge/tests/run.sh # every check, then every mutant; exit 0 only when all pass ``` `run.sh` refuses any omc whose sha256 is not the pin (prints `NOT_RUN`, exit 3). It needs `git` for the gate fixture. ## Commands ``` forge decide [--json] forge status [reviews-dir [receipts-dir]] forge gate [--name N] [--out DIR] [--timeout S] --author A --neg ARGV.. -- ARGV.. ``` Any other subcommand prints the usage on stderr and exits 2. ### `forge decide` Prints exactly one line, `MERGE OK` (exit 0) or `HOLD ` (exit 1). With `--json` (first argument after `decide`) it prints exactly one line holding one JSON object instead, with the same exit codes: ``` {"schema":"forge-decision/1","head":"<40 lowercase hex>","decision":"MERGE","reason":"OK"} {"schema":"forge-decision/1","head":"<40 lowercase hex>","decision":"HOLD","reason":""} {"schema":"forge-decision/1","head":null,"decision":"HOLD","reason":"USAGE"} ``` The keys always appear in that order with no spaces. `head` is the patch head argument when it is 40 lowercase hex and the argument count is right, else `null` (`USAGE`, `BAD_HEAD`). `reason` is one of the codes in the table below. ### `forge status` Runs `rad patch list --all --repo ` and `rad patch show --repo ` for every patch and prints one line per patch, then a summary: ``` patch status= head=<40 hex> verdict= receipt= decision=|NOT_RUN no verdict file> forge status patches=N decided=K merge=A hold=B not_run=C ``` For each patch head H, the verdict is the one file in `reviews-dir` named `*-.verdict.txt` (two or more such files give `HOLD VERDICT_AMBIGUOUS`), and the receipt is the one file in `receipts-dir` named `*-.receipt.txt`, the name `forge gate` writes (two or more give `receipt=ambiguous` and `HOLD RECEIPT_AMBIGUOUS`; none gives `receipt=none` and `HOLD RECEIPT_UNREADABLE`). Defaults: `$HOME/handoffs/hive/manager/reviews` and `$HOME/handoffs/hive/forge/receipts`. Names are followed through symlinks. `status` is a report and exits 0 when rad ran; a rad failure prints `forge: rad failed, exit N` and exits 2. It decides at most the first 512 listed patches: when rad lists more, it prints the summary for those, then `TRUNCATED patches=N examined=512`, and exits 2. It never merges or writes anything. ### `forge gate` ``` forge gate rad:z6do9WDBhuSnvopDkgFdFr1yWA62 215ea39afdc0cf1914cfadf43bbb6d23ce68c920 \ --author "t_04379749" --out ~/handoffs/hive/forge/receipts \ --neg -- ``` - Checks the arguments: `RID` is `rad:` and 1 to 60 ASCII letters and digits; `head` is 40 lowercase hex; `--author` (required) is 1 to 256 bytes with a printable ASCII byte and no control byte; `--name` is 1 to 100 bytes of `A-Z a-z 0-9 . _ -` not starting with `.`; each option at most once; `--timeout` is 1 to 5 decimal digits giving 1 to 86400 seconds (default 1800); both commands are 1 to 40 arguments, at most 1024 bytes joined, no CR or LF, and a first argument that is not empty, does not start with `-` and holds no `=`. - Reads `HOME` (required), `PATH` (default `/usr/local/bin:/usr/bin:/bin`), `OMC` and `RAD_HOME`. The storage is `$RAD_HOME/storage/`, else `$HOME/.radicle/storage/…`. When `OMC` is set, its file's SHA-256 is recorded as `omc=` (an unreadable `OMC` is an error); unset, `omc=none`. The name is `--name`, else the `name` of `rad inspect --payload`. - Makes `/tmp/forge-gate--<16 random hex>` (mode 0700) and, twice, a fresh clone of exactly `head` from the storage (`git init`, `fetch --no-tags`, `checkout --detach`), with git's system and global config off. Each clone's `HEAD` must equal `head`. - Runs the gate command in one clone and the negative control in the other, each through `/usr/bin/env` with only `HOME`, `PATH` and (when set) `OMC` in the environment, stdin `/dev/null`, stdout and stderr to `-.gate.log` / `-.negctl.log` in the out dir. An exit code is the command's status, or 128 + the signal number when it was killed. Each command runs in its own process group (the child calls `setpgid(0, 0)` before `chdir`, and forge sets the same group from the parent, so there is no race) with its own timeout of `--timeout` seconds (default 1800), measured on the monotonic clock and polled every 100 ms. A command still running at its timeout is killed with its whole process group (`SIGKILL` to `-pid`) and by its pid (so a direct child that moved to another group is killed too), reaped (forge stops waiting for the reap 10 s after the kill, so forge itself stays bounded), its exit code recorded as 124, and the line `forge: timeout after S s, process group killed with SIGKILL, exit status recorded as 124` appended to its log, so the log hash covers it; the receipt and logs are then written as usual, and `decide` gives `HOLD GATE_TIMEOUT`. Limits: a grandchild that leaves the group (`setsid`, `setpgid`) escapes the kill; a direct child stuck in uninterruptible sleep is not reaped by forge (it is left to init after the 10 s reap deadline, and could still finish a write it was in); a command that exits 124 by itself is indistinguishable from a timeout and also holds as `GATE_TIMEOUT` (fail closed: both are HOLD); background processes a command leaves running after it exits are not killed. - Hashes both logs (SHA-256, first-party Omega) and creates the out files: the logs, then the receipt `-.receipt.txt`, then removes the temp dir. The command logs live in the 0700 temp dir (`gate.log`, `negctl.log`), created with `O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW| O_CLOEXEC` (557249) and opened a second time read-only (557056), both fds checked to be the same file. The commands write through the first fd (duplicated to stdout and stderr, never reopened by name); forge hashes and copies through the second, so a log renamed or swapped while a gate runs changes neither the out log nor `log_sha256`. Out files are created only at the end, with the same `O_EXCL|O_NOFOLLOW` flags: forge never replaces or follows an out file. A name already taken (file or symlink) is refused before the gate runs; one that appears during the run makes the run exit 2, and the out files it had created are removed, so a refused run leaves no file. The out dir must exist and be writable (checked first). The flag values are aarch64 Linux, the only target the pinned omc emits; `tests/run.sh` reports NOT_RUN (exit 3) on any other machine, and x86 is not supported. It prints `forge gate head= gate_rc=N negctl_rc=M receipt=` and exits 0 when `gate_rc` is 0 and `negctl_rc` is neither 0 nor 124, 1 when the receipt records anything else (`decide` would HOLD), 2 on an error, with a message on stderr and no receipt: bad arguments (including a bad `--timeout`), unknown head, clone failure, unreadable `OMC`, no `HOME`, or an out directory that does not exist or cannot be written. The out directory defaults to `$HOME/handoffs/hive/forge/receipts`; the forge never creates directories. `gate` decides nothing: the receipt is evidence for `forge decide`. ## Verdict file (the desk format, read as is) - Line 1 is exactly `VERDICT head=<40 lowercase hex>`, with `KIND` one of `MERGE`, `MERGE_AFTER_FIX`, `REJECT`, ended by a newline or the end of the file. Anything else (uppercase hex, a short head, CRLF, a trailing byte, a trailing space, a second word such as `VERDICT MERGE head= REJECT`, lowercase `verdict`) is `VERDICT_MALFORMED`. - No later line may start with `VERDICT` (`VERDICT_MALFORMED`): a file holds one verdict. - At most one line starting `reviewer=` (two are `VERDICT_MALFORMED`). A value with a control byte (below 32 other than tab, or 127; NUL included) is `VERDICT_MALFORMED`. No such line, or a value without a printable ASCII byte (33..126), so empty or only spaces and tabs, is `NO_REVIEWER`. - Other lines are free text. Files of 65536 bytes or more are `VERDICT_UNREADABLE`. ## Gate receipt, `forge-receipt v1` (format defined here) `forge gate` writes every key, in this order: ``` FORGE-RECEIPT v1 rid= clone=<40 lowercase hex: HEAD of the fresh clone the gate ran in> tree=<40 lowercase hex: that clone's HEAD^{tree}> omc=<64 lowercase hex: SHA-256 of $OMC, or none> gate_cmd= gate_rc=<0..255: exit status of the gate; 124 when forge killed it at the timeout> negctl_cmd= negctl_rc=<0..255: exit status of the negative control; 124 when forge killed it at the timeout> author= started= finished= log_sha256=<64 lowercase hex: SHA-256 of the gate log> negctl_log_sha256=<64 lowercase hex: SHA-256 of the negative-control log> ``` `decide` requires only `clone`, `gate_rc` and `author` (and `negctl_rc`, else `NO_NEGCTL`); the other keys are optional, so receipts written by hand in the v0 key set stay valid. Line 1 is exactly `FORGE-RECEIPT v1`. Every other line is `key=value` with a key from the list, in any order, each at most once, no empty lines (the final newline is optional); exit codes are 1 to 3 decimal digits. An unknown key, a duplicate, an empty line, a missing required key, a value that is not of its form (including uppercase hex or a hash of the wrong length) or a number above 255 is `RECEIPT_MALFORMED`. Times are checked as a digit pattern, not as a calendar date. Files of 4096 bytes or more, and missing files, are `RECEIPT_UNREADABLE`. `decide` does not compare `rid`, `tree`, `omc` or the log hashes with anything; they let a reader check a receipt against the repository, the compiler and the logs. ## Decision and reason codes Checks run in this order; the first that fails is the reason. Exit Line Meaning 0 `MERGE OK` every check below passed 1 `HOLD USAGE` `decide` without exactly three arguments (after `--json`) 1 `HOLD BAD_HEAD` the patch head is not 40 lowercase hex 1 `HOLD VERDICT_UNREADABLE` verdict file missing, empty or too large 1 `HOLD VERDICT_MALFORMED` verdict file breaks the format above 1 `HOLD VERDICT_MERGE_AFTER_FIX` the reviewer asked for fixes; only `MERGE` merges 1 `HOLD VERDICT_REJECT` the reviewer rejected the patch 1 `HOLD HEAD_MISMATCH` verdict head is not the patch head (all 40 hex compared) 1 `HOLD NO_REVIEWER` no `reviewer=` line, or one without a printable ASCII byte 1 `HOLD RECEIPT_AMBIGUOUS` `status` only: more than one receipt file for the head 1 `HOLD RECEIPT_UNREADABLE` receipt missing, empty or too large 1 `HOLD RECEIPT_MALFORMED` receipt breaks the format above 1 `HOLD NO_NEGCTL` the receipt has no negative control 1 `HOLD CLONE_MISMATCH` the gate ran on another head than the patch head 1 `HOLD GATE_TIMEOUT` `gate_rc` or `negctl_rc` is 124: a run was killed at the `forge gate` timeout, so its evidence is incomplete (checked before its result) 1 `HOLD GATE_FAIL` `gate_rc` is not 0 1 `HOLD NEGCTL_PASSED` `negctl_rc` is 0: the control did not fail, so the gate proves nothing 1 `HOLD SELF_REVIEW` the normalized reviewer text contains the normalized receipt author 1 `HOLD VERDICT_AMBIGUOUS` `status` only: more than one verdict file for the head Self-review normalization. Both the reviewer value and the author are folded to ASCII lower case; tab, `_` and `-` count as spaces and every run of them becomes one space; then ASCII punctuation (`!"#$%&'()*+,./:;<=>?@[\]^`{|}~`) and spaces are stripped from both ends. The reviewer text is then searched for the author as a substring. `Manager reviewer agent` as author matches `reviewer= MANAGER reviewer agent (relayed)`, and the authors `"Manager reviewer agent"`, `Manager_reviewer_agent`, `manager-reviewer-agent.` all match it. An author that normalizes to nothing (only punctuation) is contained in every reviewer text, so it is `SELF_REVIEW`. Punctuation inside a name is kept. Bytes of 128 and above are compared as they are: no Unicode case folding, and no folding of Unicode punctuation or look-alike letters. Identities are unsigned text until signed receipts land. ## Test fixtures (`tests/`) - `verdicts/`: copies of three real review verdicts from `~/handoffs/hive/manager/reviews/` (sha256 checked equal when copied, 2026-11-07), except one edit: in `aien-architecture-mv-6daec174` a home-directory path `/home//work/…` is replaced by `$HOME/work/…`. `omega-mv-215ea39a` (MERGE, omega-mv patch `4dd099d`), `CUDApp-9714eba8` (MERGE, CUDApp #373) and `aien-architecture-mv-6daec174` (MERGE_AFTER_FIX, arch #382, held). - `receipts/.receipt`: TRANSCRIBED. No forge receipt existed before v0; these three restate in `forge-receipt v1` the gate and negative-control exit codes that the reviewer recorded in each verdict's EXERCISED section (omega-mv: run-tape.sh rc 0, control C2 rc 1; CUDApp: `make test-om-encoder-ldg` rc 0, control NC1 rc 11; arch: doctrine gate rc 0, wrong-omc control rc 3). `author` is the lane that wrote the patch (t_`04379749`; the hive-ng gpu lane whose bundle is `~/handoffs/hive-ng/gpu/CUDApp-373/`; omp-queen-ng). - `receipts/*.receipt` with descriptive names: synthetic, one defect each. - Derived verdicts and receipts: `run.sh` makes them at test time with one `sed` edit each, from the real omega-mv verdict, from `receipts/self-review.receipt` (case, whitespace, punctuation, `_`, `-`, blank and control-byte values), or by appending the gate-written keys to the real omega-mv receipt (valid, and one defect each), and fails if an edit changes nothing. - `json-*` cases in `cases.txt` run `decide --json`. - `status` runs: `run.sh` puts a fake `rad` first on `PATH` that lists 512, then 513 patches, then one patch with zero, one and two receipts for its head. - `gate` runs: `run.sh` makes a git repository with two commits (100000 random bytes, then a second file) in a Radicle-shaped storage under a temp `RAD_HOME`, with a fake `rad inspect`, and checks every receipt key against independent tools (`git rev-parse`, `sha256sum` at 0, 55, 56, 63, 64, 65, 1000 and 100000 bytes, `date -u`), clone isolation (the gate's marker file is absent from the negative control's clone), exit codes 0/1/2, killed commands, the default out dir, and that every error writes no receipt. A receipt the gate wrote must give `MERGE OK` with a verdict. Timeout runs: a gate and a negative control that are each `sh` with a background child `sleep 20`, at `--timeout 1`: exit 1, rc 124, the receipt written, the log ending in the timeout line and hashed, `HOLD GATE_TIMEOUT` (text and JSON), done in under 10 s, and the child sleeper gone (the group kill); a direct child that joins forge's own group (`tests/joinpg.om`, then a 20 s sleep) still ends at `--timeout 1` with rc 124 in under 6 s and is gone (the kill by pid); a run that ends inside `--timeout 5` is unaffected; `--timeout 86400` is accepted and `0`, `86401`, `1x`, empty, 8 digits and a repeated `--timeout` are refused. - `mutants.txt`: one-line mutants of `forge.om`, each removing or weakening one invariant; each runs the whole suite. `run.sh` checks the original line first, so a stale list fails, and counts a mutant that does not compile as not caught.