from061af7f3554d4bfc663b3241cce07503681abb82b855c9f1c14a1e2e1c2a31f6 → 061af7f3
to7ff4ef4d5263ee3613c5cc3bfc7e44f4ae0b490afd5c0553c6992b693da08b03 → 7ff4ef4d

+2 −2

11 # loot
22
33 A from-scratch source-control system.
44
55 **Thesis:** visibility and permissions belong to *content and changes*, not to
66 the *repository*. Commit your `.env`. Keep files private inside a shared repo.
77 Embargo a security fix: merge it, cut the release, reveal the source later.
88
99 This is the unsolved problem in modern version control. Ergonomics (jj already
1010 nails them) are a layer for later.
1111
1212 ## Security
1313
1414 loot's cryptography is written from scratch and has never been independently
1515 reviewed. What each reader — a relay, a forge, a collaborator, the anonymous
1616 internet, the git mirror, and anyone holding your `.loot/` directory — can
1717 actually read is stated tier by tier at
1818 **<https://loot.millerbyte.com/trust>**. Read it before you put anything in a
1919 loot repo whose disclosure would hurt you. Two things it says that the pitch
2020 does not: the default tier is one a relay reads by design, and path names are
2121 never encrypted at any tier.
2222
2323 **Report a vulnerability to <security@millerbyte.com>** — not to the public
2424 Discord. One maintainer, best effort, expect days rather than hours. ⚠ This
2525 file is not the published route: the GitHub repo is permanently private
2626 (ADR 0045/0064), so a `SECURITY.md` here and GitHub's private-advisory button
2727 both reach nobody. `/trust` is the route; this section exists for whoever
2828 already has repo access.
2929
3030 ## What works today
3131
3232 The full loop from first init to relay-based collaboration is functional. This
33−block is the CLI's **full verb list** — all 78 verbs, regenerated from
33+block is the CLI's **full verb list** — all 79 verbs, regenerated from
3434 `loot --help` rather than curated (a guard test pins it to the dispatch table,
3535 so it cannot drift again; #1107):
3636
3737 ```text
3838 abandon absorb adopt apply apply-patch archive attest bisect blame bundle buoy
3939 burn cat
4040 cherry-pick clean clone completions config conflicts converge count-objects
4141 describe diff doctor duplicate edit embargo-status evolog explain ferry
4242 fetch format-patch gates gc grant grant-status grants grep heads id init keygen
43−lane lanes lock log manifest maroon merge migrate new op peer propose pull
43+lane lanes lock log manifest maroon merge migrate move new op peer propose pull
4444 pull-grants purges push rehome relay remote resolve restore revert serve
4545 shortlog show split squash status surface tag tutorial undo unlock verify
4646 view whoami
4747 ```
4848
4949 `loot <verb> --help` prints any verb's own usage block without running it.
5050
5151 ### Try it: private `.env` in a shared repo
5252
5353 ```bash
5454 cargo build --release
5555 export PATH="$PWD/target/release:$PATH"
5656
5757 cd $(mktemp -d)
5858 printf 'TOKEN=supersecret\n' > .env
5959 printf '# My Project\n' > README.md
6060 printf '.env restricted=alice\n*.md public\n' > .lootattributes
6161
6262 loot init --identity alice
6363 loot status -m "initial work"
6464 loot surface # alice: restores both README.md and .env
6565
6666 # switch to a non-keyholder to prove it
6767 printf mallory > .loot/identity
6868 rm -f .env README.md
6969 loot surface # mallory: README.md appears; .env stays sealed
7070 ```
7171
7272 The `.env` ciphertext lives in `.loot/` the whole time. Mallory cannot decrypt
7373 it, and if she snapshots and re-syncs, the sealed file is carried forward
7474 untouched — snapshot is visibility-aware.
7575
7676 ### Sync over a relay
7777
7878 A relay stores and forwards ciphertext it cannot read. Restricted keys never
7979 travel in a sync bundle (ADR 0003), so the relay's zero-knowledge property is
8080 enforced at the wire level, not by policy.
8181
8282 ```bash
8383 # Terminal 1: run a relay
8484 loot serve --dir /tmp/relay --addr 127.0.0.1:4000
8585
8686 # Terminal 2: alice pushes
8787 loot remote add origin http://127.0.0.1:4000
8888 loot push
8989
9090 # Terminal 3: bob pulls (bob only sees public content)
9191 loot clone http://127.0.0.1:4000 ./bob-repo --identity bob
9292 ```
9393
9494 ### Grants: sharing a content key
9595
9696 ```bash
9797 # alice knows bob's public key (from `loot whoami` on bob's machine)
9898 loot peer add bob "ssh-ed25519 AAAA..."
9999
100100 # deliver a sealed grant via the relay
101101 loot grant --relay origin .env bob
102102
103103 # bob fetches and applies it
104104 loot pull-grants # verifies alice's signature, checks peer registry
105105 loot surface # now bob can read .env
106106 ```
107107
108108 ### Embargo: timed reveals
109109
110110 ```bash
111111 # mark a file as embargoed until unix timestamp 1800000000
112112 echo "VULN_DETAILS=CVE-2025-XXXX" > security-fix.txt
113113 printf 'security-fix.txt embargoed=1800000000\n' >> .lootattributes
114114
115115 loot status -m "patch for CVE-2025-XXXX"
116116 loot push # relay holds the ciphertext; key withheld until reveal_at
117117 ```
118118
119119 At `reveal_at`, the next read promotes the key out of escrow, so anyone who
120120 pulls can read it.
121121 The seam for a third-party key custodian (network escrow) is designed and ready.
122122
123123 ## Architecture
124124
125125 ```text
126126 crates/
127127 loot-core canonical engine: encrypted DAG, per-content visibility, convergence
128128 loot-identity ed25519 keypairs, x25519 ECIES, signed push envelopes, peer registry
129129 loot-net relay HTTP server + sync client (stow/negotiate/grant mailbox)
130130 loot-cli the `loot` binary — commands are thin verbs over Workspace
131131 loot-bench shared 50k-file benchmark workload
132132 spike-dag thin shim re-exporting loot-core (bake-off compat)
133133 spike-crdt non-canonical CRDT model (retained so the bake-off is reproducible)
134134 ```
135135
136136 ### Key modules
137137
138138 | Module | What it owns |
139139 | --- | --- |
140140 | `loot-core::sealed` | Per-content encryption, key custody, embargo, public-content compression (ADR 0003, 0007, 0020) |
141141 | `loot-core::converge` | Merger/relay convergence rule — decrypt-then-merge (ADR 0001) |
142142 | `loot-core::engine` | Encrypted content-addressed DAG: put/get/record/surface/bundle/apply |
143143 | `loot-core::manifest` | Grant audit trail: grantee, grantor pubkeys, timestamps |
144144 | `loot-identity` | ed25519 sign/verify, x25519 derive, ECIES seal/unseal, push envelope |
145145 | `loot-net::mailbox` | Relay grant mailbox: pubkey-addressed, content-addressed loose blobs |
146146 | `loot-cli::workspace` | Ambient repo: identity, clock, persistence, idempotent snapshot |
147147
148148 ### ADRs (docs/adr/)
149149
150150 | # | Decision |
151151 | --- | --- |
152152 | 0001 | Per-content decrypt-then-merge convergence |
153153 | 0002 | Encrypted DAG as the canonical foundation (bake-off winner) |
154154 | 0003 | Sealed content module + keyring custody (restricted keys never travel) |
155155 | 0004 | Drop plaintext dedup equality oracle |
156156 | 0005 | CLI slice, persistence, .lootattributes |
157157 | 0006 | JJ-style workspace auto-snapshot |
158158 | 0007 | Embargo escrow module |
159159 | 0008 | Grant log and targeted key bundles |
160160 | 0009 | Two-level revocation |
161161 | 0010 | Forward-maroon implementation |
162162 | 0011 | Relay stow append-only |
163163 | 0012 | Per-object loose storage |
164164 | 0013 | Named remotes and grant bundle delivery |
165165 | 0014 | Identity keypairs: ed25519 OpenSSH, signed push envelopes |
166166 | 0015 | Grant authentication and trust (grantor signs, peer-registry gate) |
167167 | 0016 | Identity portability: export/import with passphrase wrapping |
168168 | 0017 | RepoStore: one home for the `.loot/` layout |
169169 | 0018 | Signed changes: author in id + validity enforcement |
170170 | 0019 | Format versioning + compatibility gate (newer reads older) |
171171 | 0020 | Compress public content (Zstd); format major → 2 |
172172 | 0021 | Object-level "wants" negotiation on push/pull |
173173 | 0022 | Concurrent-agent model: docks, harbor, optimistic convergence |
174174 | 0023 | Agent-facing machine output: porcelain-first, reconciliation verbs |
175175 | 0024 | Resumable transfer via batched, negotiated sync |
176176
177177 See [CONTEXT.md](CONTEXT.md) for the full domain glossary.
178178
179179 ## Build & test
180180
181181 ```bash
182182 cargo build
183183 cargo test # ~25s — includes HTTP relay integration tests
184184 cargo test -p loot-core # fast, no I/O, 67 tests
185185 ```
186186
187187 ## Command reference
188188
189189 ```text
190190 loot init [--identity <name>] initialize a repo (identity from global config if omitted)
191191 loot clone <url> <dir> clone a relay or forge repo into <dir>; ends with a materialized working tree
192192 loot config [--local] set <key> <val> set a config value; bare writes the global file (~/.config/loot/config), --local writes this repo's (.loot/config.local, never tracked)
193193 loot config --get <key> print one effective value (local over global); exits non-zero when unset
194194 loot status [-m <message>] snapshot the working tree into the working change (idempotent)
195195 loot describe -m <message> name the working change
196196 loot new finalize the working change; start a fresh one
197197 loot surface materialize what the current identity may see
198198 loot lane new [--name <n>] spawn a sealed lane (isolated tree + tip) over the shared store
199199 loot lanes list lanes with their tip, in-flight PR, and status
200200 loot log show change history with visibility hints
201201 loot gc [--dry-run] prune loose objects no change references
202202 loot verify [--accept-loss] [--unreachable] integrity-check the object store (exits 1 on corrupt/missing; --accept-loss records unrecoverable losses; --unreachable also lists objects that are PRESENT and referenced by nothing — deletes nothing, names `loot gc` as the remedy, and never changes the exit status)
203203 loot bundle <file> write a sync bundle (ciphertext, no keys)
204204 loot apply <file> merge a peer's bundle (idempotent)
205205 loot apply-patch <file> [--check] apply a TEXT patch `loot format-patch` wrote — strict, with an ADR 0044 three-way fallback that stops on conflict like `loot apply` does; a path this identity cannot open refuses the whole run, and CRLF on either side is refused (ADR 0082). --check reports applicability and writes nothing
206206 loot grant <path> <identity> <file> write a targeted grant bundle (file delivery)
207207 loot grant --relay <remote> <path> <id> seal and deliver a grant via relay mailbox
208208 loot grants [<url>] peek pending grant count (no download)
209209 loot pull-grants [<url>] fetch, verify, and apply sealed grants from relay
210210 loot maroon [--hard] <path> <identity> cut off <identity> from future access
211211 loot migrate <path> <vis-spec> change a path's visibility
212212 loot manifest show the grant audit trail
213213 loot conflicts list paths needing resolution
214214 loot resolve <path> <file> resolve a conflict
215215 loot remote add <name> <url> register a relay URL
216216 loot push [<url>] publish changes to a relay
217217 loot pull [<url>] fetch and merge changes from a relay
218218 loot fetch [<url>] ingest from a relay and stop — no merge, no converge, no tree write
219219 loot serve [--addr <host:port>] run a relay
220220 loot keygen generate an identity keypair
221221 loot whoami show identity and public key
222222 loot id export <file> export keypair, passphrase-encrypted
223223 loot id import <file> import keypair from passphrase-encrypted file
224224 loot peer add <name> <pubkey> register a peer's public key
225225 loot peer list list known peers
226226 ```
227227