interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / ipl / CONTRACT.md

227 lines · 16669 bytes Raw Blame History Rendered
1# Interplane native store: the contract for consumers (version 0, trial)
2
3Status: IMPLEMENTED and EXERCISED on the Spark host (the gate in `tests/run.sh`, and a trial import).
4Not installed, not serving anything, not the publishing route. Under the standing rule the route
5"exists" only after its gates on a fresh clone, an other-provider MERGE and a receipt. Consumers may
6build against this contract; they may not publish through it yet.
7
8Operator intent (Drake, 2026-11-13): "take everything radicle did and replicate it into interplane
9and leave out all the bullshit ... designed around agent workflows and agent coding", and to the
10HardenOS lane: "take radicle out and build this directly on to of git".
11
12## Where things are
13
14One store root. Where a trial store stands, and with which trial key, is named in the receipt of the head that made it.
15
16```
17ROOT/catalog.tsv generated, never typed
18ROOT/projects/NAME/repo.git ordinary bare Git repository
19ROOT/projects/NAME/chain.tsv the record chain
20ROOT/projects/NAME/records/N the exact payload bytes record N commits to
21ROOT/projects/NAME/owner.pub the owner's public key
22ROOT/projects/NAME/staging/ landings in progress. A finished request removes its own files; an abandoned one leaves its files here until that same request is finished
23```
24
25`catalog.tsv` has one line per project, five tab-separated fields:
26`name id default-branch head visibility` (`head` is `none` before the first recorded head).
27It is rewritten on every change the store commits (init, import, land), from each project's own
28line, so it follows a landing without anyone running anything. `ipl catalog` re-derives every line
29from full verification, drops a project that does not verify, and then exits 3. Readers take the
30catalog as the list of projects; they do not scan the folder. A project folder or `repo.git` that is
31a link is not a project.
32
33## Identity
34
35- A project's **id** is the SHA-256 of record 1's payload (`records/1`): 64 lowercase hex digits. That
36 payload is signed and holds a random 128-bit `nonce` made at creation, so the id cannot be changed
37 without the owner's key, and projects created separately get different ids (by chance, not by a
38 registry). A copy of a project keeps its id.
39- A project's **name** is its folder name and is written in record 1: letters, digits,
40 `.`, `_`, `-`, starting with a letter or digit, not ending in a dot. Two names that differ only in
41 case cannot both exist. A project folder copied under another name does not verify.
42- The **owner** starts as one Ed25519 SSH key, named in record 1 by its fingerprint (`SHA256:` and
43 43 characters). Other key types are refused. A later `SUCCESSOR` record, signed by the then-current
44 key, names a new owner key (its public key blob and fingerprint). The current owner is the last
45 such successor, or the key in record 1 if there has been none. `owner.pub` stays the key record 1
46 names; swapping it for the successor is not how a handover is recorded, and a project whose
47 `owner.pub` is not the key record 1 names does not verify.
48- The old Radicle id is kept in record 1 as `alias` (`rad:z...` or `-`), for looking up history only.
49- Receipt identity for gate tools: `git:` followed by the project id.
50
51## Records
52
53The chain is the forge's `chain/chain.om` format: one line per record, seven tab-separated fields
54`seq utc kind actor subject payload prev`; `payload` is the SHA-256 of the bytes in `records/SEQ`;
55`prev` commits to the line before. `actor` is the fingerprint of the owner key that was current
56when the record was written (the key in record 1, until a `SUCCESSOR` is signed, and the successor
57key after that).
58
59| Kind | Subject | Payload (`records/N`) |
60|---|---|---|
61| `PROJECT` | the name | `interplane-project 1`, then `project`, `branch`, `visibility`, `owner`, `alias`, `nonce` lines. Always record 1. |
62| `IMPORT` | the branch | a land payload whose `old` is 40 zeros: a head taken over from the old store, not gated or reviewed here. Once per branch, before any landing on it. |
63| `LAND` | the branch | `interplane-land 1`, then `project`, `branch`, `old`, `new`, `receipt`, `verdict`, `request` lines. `old` is the head the chain recorded for that branch before (40 zeros for a new branch). |
64| `SUCCESSOR` | the new key's fingerprint | `interplane-successor 1`, then `project`, `old`, `new`, `pub`, `reason` lines. `old` is the then-current owner's fingerprint, `new` is the successor's, `pub` is the 68-character `ssh-ed25519` blob of that successor (no comment), and `reason` is `-` or the same bytes a request id may use. The successor must differ from every key that has already been an owner of the project (the key in record 1, and every earlier `SUCCESSOR` `new`). |
65| `SIG` | the seq it signs | an SSH signature, namespace `interplane`, by the owner key that was current when the signed record was written |
66
67A name or branch longer than 128 bytes is written in the subject field as `sha256:` and the digest of
68its bytes; the payload always holds it in full.
69
70Every `PROJECT`, `IMPORT`, `LAND` and `SUCCESSOR` record is immediately followed by its `SIG` record. The signed
71message is six lines: `interplane-sig 1`, then `kind`, `actor`, `subject`, `payload`, `prev`, each
72followed by that field of the record it signs. So a signature fixes what the record says, who wrote
73it, and, through `prev`, every record before it. It does not cover the record's `seq` and `utc`
74fields or the SIG line itself; those are fixed by the next signed record's `prev`, and for the last
75record of a chain by nothing. So the times in a chain are not signed facts: do not rely on the time of
76the last record, and treat the others as fixed only by what was signed after them.
77
78`receipt` and `verdict` are the SHA-256 of the receipt file and of the review verdict file. Version 0
79commits to those files; it does not read them. Checking that the verdict comes from a different key
80and provider than the author is step 3.
81
82Field rules and the canonical bytes are decided in one place, `om/landrec.om` (seeded Omega). No
83field can hold a space, a tab or a line feed. No field has a length chosen by this store. The chain
84format's subject field holds 128 bytes, which is why longer names and branches go there as a digest.
85What is refused for length is only what the machine cannot hold: a name longer than a file name on
86the store's file system, a branch part longer than that less the five bytes of git's `.lock`, a
87branch path past the file system's path limit, and an argument longer than Linux passes to a
88program (131071 bytes). The numbers are read from the file system when the call is made.
89
90## Actions
91
92```
93ipl init ROOT NAME BRANCH VISIBILITY ALIAS KEY record 1 for an existing repo.git
94ipl import ROOT NAME BRANCH EVIDENCE_FILE NOTE_FILE REQUEST KEY
95ipl land ROOT NAME BRANCH NEW SOURCE RECEIPT_FILE VERDICT_FILE REQUEST KEY [--expect-owner FP]
96ipl handover ROOT NAME|--all OLD_KEY NEW_PUBKEY [REASON] signed succession to a new owner key
97ipl verify ROOT NAME [--expect-owner FP] prints: OK NAME ID BRANCH HEAD VISIBILITY CURRENT SEQ CHAINHEAD
98ipl catalog ROOT [--expect-owner FP]
99```
100
101SOURCE is the absolute path of a local repository that holds NEW, or `-` when the store already has
102it. Nothing else is accepted there.
103
104The `OK` line from `verify`, `land`, `import`, `init` and `handover` is
105`OK NAME ID BRANCH HEAD VISIBILITY CURRENT SEQ CHAINHEAD`. `CURRENT` is the current owner
106fingerprint, `SEQ` is the last record number, and `CHAINHEAD` is the SHA-256 of the last chain line
107with no line feed (the `prev` a next record would commit to). `catalog.tsv` stays five fields
108(`name`, `id`, `default-branch`, `head`, `visibility`) and does not include these extra columns.
109
110The current owner is pinned outside the store, in
111`${IPL_OWNER_PINS:-$HOME/.config/interplane/owner-pins}`. Each line is `NAME SHA256:<43>` or
112`* SHA256:<43>` (every project). Blank lines and `#` comments are allowed. The file must exist, be
113mode 0600 (no group or world bits), and resolve outside ROOT. `verify`, `land`, `import`,
114`handover` and `catalog` load it automatically and fail closed, exit 3, if it is missing, has bad
115permissions, is inside ROOT, or names a different key than the walk ends on. `catalog` leaves a
116mismatching project out and exits 3. `--expect-owner FP` may also be passed to those commands; if
117it disagrees with the file, that is exit 3.
118
119The pin is the out-of-band channel the leaked key cannot sign for. Its value is written by hand,
120from the current owner key's `.pub` on the machine that holds that key — never copied from a store.
121After `ipl handover` appends a signed `SUCCESSOR`, it updates the local pin file (only then, never
122on a no-op). A single-project handover rewrites or appends that project's `NAME` line and prints
123`ipl: pin: NAME SHA256:...`. `handover --all` rewrites the `NAME` line of every project rotated in
124that run, rewrites `*` only if it named the old key (and appends `* NEW` if there was no `*` line),
125and prints `ipl: pin: * SHA256:...`. Install a `* SHA256:...` line by hand on the forge serving
126host, on the machine that runs `tools/receipt.sh`, and on each mirror. `receipt.sh` points
127`IPL_OWNER_PINS` at a pin file outside the trial ROOT. If handover records the SUCCESSOR but then
128exits 5 because the pin file could not be updated, write the printed line into the pin file by
129hand; a rerun will not repair a stale pin, because the current key has already switched.
130
131Do not install the pin on the live forge host from this change alone. When it is time, on the
132machine that holds the current owner key:
133
134```
135install -d -m 0700 ~/.config/interplane
136printf '* %s\n' "$(ssh-keygen -lf /path/to/current-owner.pub | awk '{print $2}')" > ~/.config/interplane/owner-pins
137chmod 600 ~/.config/interplane/owner-pins
138```
139
140Use the same path (or set `IPL_OWNER_PINS`) on the forge, receipt, and mirror hosts, with the
141fingerprint taken from that key's `.pub`, not from any store. After a rotation, replace the file
142with the `ipl: pin: * SHA256:...` line the handover printed.
143
144`ipl handover --all` prechecks every project before writing any record. If any project cannot be
145handed over (including one whose current owner is not the given old key, or whose successor was
146already an owner), nothing is recorded and the run exits 2, naming every project that failed.
147
148| Exit | Meaning | State afterwards |
149|---|---|---|
150| 0 | done | recorded, signed, branch in place |
151| 1 | usage | unchanged |
152| 2 | an argument, file or key was refused (stderr says which) | unchanged |
153| 3 | the project does not verify, or has an unfinished request that is not this one | unchanged |
154| 4 | not a fast-forward, the head is already there, not a commit the store can find, the branch name collides with an existing one, or the request id was already used for something else | unchanged |
155| 5 | a tool failed part-way | possibly unfinished: run the same request again; it finishes or refuses |
156
157"Unchanged" means the chain, the records and the branches, with two exceptions that are said here
158rather than hidden. A refused landing may already have copied Git objects from SOURCE into
159`repo.git`; no branch points at them. And on a call by the owner, leftovers of an interruption are
160put right before the request is looked at, and that repair stays even if the request is then
161refused; `ipl` says so on stderr (`ipl: repaired: ...`).
162
163- A landing checks every argument, then that the key signs as the project's owner, then puts right
164 what an interruption left, then that the project verifies. Only after that is anything appended.
165 The branch moves last, and only forward.
166- `init` with the same terms by the owner is safe to repeat: it finishes an init that was
167 interrupted, and on a complete project it publishes the catalog line again and answers. With
168 other terms or another key it is exit 2.
169- The same REQUEST never lands twice. A request is the same only if kind, branch, head, receipt and
170 verdict are all the same; then it is answered with the project's present state (the same `OK` line
171 `ipl verify` prints now, not a copy of the first answer) and nothing moves. Used again for
172 anything else it is exit 4.
173- An interruption can leave: a torn last line in the chain (never a record), an empty chain file, a
174 record whose payload is still in staging, `PENDING_SIG` (recorded, not signed yet) or `PENDING_REF`
175 (signed, branch not moved yet). `ipl verify` exits 3 and names the state. The first three are put
176 right, and the two pending states finished, only on a call by the owner's key, and a pending
177 request only by that same request. Until then nothing else can be recorded on the project.
178 Anything else that does not verify is refused whole; this tool does not repair it.
179- What the gate has exercised of this, said exactly. A real landing is stopped at five points: after
180 staging (nothing is recorded yet: the project verifies and the request id is still free), between
181 the chain line and its payload file, after the record, after the signature (these three do not
182 verify, are closed to other requests and to other keys, and are finished by the same request), and
183 after the branch moved (the project verifies; the same request publishes the catalog line that
184 was missing). A real init is stopped at the first four of those points, since an init moves no
185 branch; each is refused to another key and to other terms and finished by the same init. Not
186 exercised: a write the kernel never completed, and loss of power.
187- Before anything is changed for a caller, including finishing or repairing, the caller's key must
188 sign a fresh message that verifies against the current owner key (`owner.pub` until a `SUCCESSOR`
189 is signed, and the successor key after that). Having a public key file is not enough.
190- Only the current owner key can record in version 0. `ipl land` signs with that key and refuses any
191 other, including a retired owner key. `ipl handover` appends a `SUCCESSOR` record signed by the
192 current key and is a no-op if that successor is already current. It refuses a successor that has
193 already been an owner of the project; `ipl verify` also refuses a chain that hands a retired key
194 back. Agent keys with a scope and an end date are step 3.
195
196## What verify proves, and what it does not
197
198It proves: the chain is intact from record 1; every payload file is the one its record commits to
199and is in canonical form; record 1 is this project's `PROJECT` record under this folder's name;
200`owner.pub` is the Ed25519 key record 1 names; every record was written by the owner key that was
201current at that point in the chain, and every `PROJECT`, `IMPORT`, `LAND` and `SUCCESSOR` record
202carries a valid signature by that same key; a `SUCCESSOR` names a new Ed25519 key, different from every key that has already been an owner,
203whose fingerprint matches the `pub` blob, and after that record's signature the current key is only
204the successor (a later record signed by a retired key does not verify, and a successor that returns
205to a prior owner does not verify);
206every landing starts from the head the chain recorded before it and is a fast-forward of it, and its
207head is a commit the store holds; no request id appears twice; and every branch the chain has a head
208for is, in `repo.git`, exactly at that head. Sequential handovers are followed in order. A store
209with no `SUCCESSOR` records verifies as it did before this rule existed. Anything ambiguous about
210which key is current, or a handover not signed by the then-current key, fails closed.
211
212It does not prove: that a receipt or verdict is any good; anything about branches and tags the chain
213has no record of; that a copy of the store is the newest one (an older or forked pre-handover copy
214also verifies if the operator pin still names that copy's current key; with the pin file, or
215`--expect-owner`, naming the successor, it does not); or that Git objects are intact beyond what Git
216itself checks on use.
217
218Outside this version's trust boundary: anyone who can write files in the store directly, and the
219`git` and `ssh-keygen` programs on the host. `ipl` runs git with no user or system configuration, no
220hooks, no replace objects and only the local file transport.
221
222## Not in version 0
223
224Agent grants and their withdrawal, the HTTP form of these actions, proposals and issues, mirrors and
225freshness, serving, private-project access rules beyond "not served", events. `ipl` itself is shell
226around the Omega record rules, the Omega chain, git and ssh-keygen; its decisions move into Omega
227before the route is offered for publishing.