from9b32538e2d6daeb1cc396a7e112b18b84d15096f97d4f3ece46344229ea50185 → 9b32538e
tof10ba1d90df3fd1016685f5a0c4d1b6ec28d7aca8d9b9b3c9aaf304bfc6790f0 → f10ba1d9

+8 −7

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 74 verbs, regenerated from
33+block is the CLI's **full verb list** — all 75 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 archive attest bisect blame bundle buoy burn cat
39−cherry-pick clone completions config conflicts converge describe diff doctor
40−duplicate edit embargo-status evolog explain ferry format-patch gates gc
41−grant grant-status grants grep heads id init keygen lane lanes lock log
42−manifest maroon merge migrate new op peer propose pull pull-grants purges
43−push rehome relay remote resolve restore revert serve shortlog show split
44−squash status surface tag tutorial undo unlock verify view whoami
39+cherry-pick clone completions config conflicts converge count-objects
40+describe diff doctor duplicate edit embargo-status evolog explain ferry
41+format-patch gates gc grant grant-status grants grep heads id init keygen
42+lane lanes lock log manifest maroon merge migrate new op peer propose pull
43+pull-grants purges push rehome relay remote resolve restore revert serve
44+shortlog show split squash status surface tag tutorial undo unlock verify
45+view whoami
4546 ```
4647
4748 `loot <verb> --help` prints any verb's own usage block without running it.
4849
4950 ### Try it: private `.env` in a shared repo
5051
5152 ```bash
5253 cargo build --release
5354 export PATH="$PWD/target/release:$PATH"
5455
5556 cd $(mktemp -d)
5657 printf 'TOKEN=supersecret\n' > .env
5758 printf '# My Project\n' > README.md
5859 printf '.env restricted=alice\n*.md public\n' > .lootattributes
5960
6061 loot init --identity alice
6162 loot status -m "initial work"
6263 loot surface # alice: restores both README.md and .env
6364
6465 # switch to a non-keyholder to prove it
6566 printf mallory > .loot/identity
6667 rm -f .env README.md
6768 loot surface # mallory: README.md appears; .env stays sealed
6869 ```
6970
7071 The `.env` ciphertext lives in `.loot/` the whole time. Mallory cannot decrypt
7172 it, and if she snapshots and re-syncs, the sealed file is carried forward
7273 untouched — snapshot is visibility-aware.
7374
7475 ### Sync over a relay
7576
7677 A relay stores and forwards ciphertext it cannot read. Restricted keys never
7778 travel in a sync bundle (ADR 0003), so the relay's zero-knowledge property is
7879 enforced at the wire level, not by policy.
7980
8081 ```bash
8182 # Terminal 1: run a relay
8283 loot serve --dir /tmp/relay --addr 127.0.0.1:4000
8384
8485 # Terminal 2: alice pushes
8586 loot remote add origin http://127.0.0.1:4000
8687 loot push
8788
8889 # Terminal 3: bob pulls (bob only sees public content)
8990 loot clone http://127.0.0.1:4000 ./bob-repo --identity bob
9091 ```
9192
9293 ### Grants: sharing a content key
9394
9495 ```bash
9596 # alice knows bob's public key (from `loot whoami` on bob's machine)
9697 loot peer add bob "ssh-ed25519 AAAA..."
9798
9899 # deliver a sealed grant via the relay
99100 loot grant --relay origin .env bob
100101
101102 # bob fetches and applies it
102103 loot pull-grants # verifies alice's signature, checks peer registry
103104 loot surface # now bob can read .env
104105 ```
105106
106107 ### Embargo: timed reveals
107108
108109 ```bash
109110 # mark a file as embargoed until unix timestamp 1800000000
110111 echo "VULN_DETAILS=CVE-2025-XXXX" > security-fix.txt
111112 printf 'security-fix.txt embargoed=1800000000\n' >> .lootattributes
112113
113114 loot status -m "patch for CVE-2025-XXXX"
114115 loot push # relay holds the ciphertext; key withheld until reveal_at
115116 ```
116117
117118 At `reveal_at`, the next read promotes the key out of escrow, so anyone who
118119 pulls can read it.
119120 The seam for a third-party key custodian (network escrow) is designed and ready.
120121
121122 ## Architecture
122123
123124 ```text
124125 crates/
125126 loot-core canonical engine: encrypted DAG, per-content visibility, convergence
126127 loot-identity ed25519 keypairs, x25519 ECIES, signed push envelopes, peer registry
127128 loot-net relay HTTP server + sync client (stow/negotiate/grant mailbox)
128129 loot-cli the `loot` binary — commands are thin verbs over Workspace
129130 loot-bench shared 50k-file benchmark workload
130131 spike-dag thin shim re-exporting loot-core (bake-off compat)
131132 spike-crdt non-canonical CRDT model (retained so the bake-off is reproducible)
132133 ```
133134
134135 ### Key modules
135136
136137 | Module | What it owns |
137138 | --- | --- |
138139 | `loot-core::sealed` | Per-content encryption, key custody, embargo, public-content compression (ADR 0003, 0007, 0020) |
139140 | `loot-core::converge` | Merger/relay convergence rule — decrypt-then-merge (ADR 0001) |
140141 | `loot-core::engine` | Encrypted content-addressed DAG: put/get/record/surface/bundle/apply |
141142 | `loot-core::manifest` | Grant audit trail: grantee, grantor pubkeys, timestamps |
142143 | `loot-identity` | ed25519 sign/verify, x25519 derive, ECIES seal/unseal, push envelope |
143144 | `loot-net::mailbox` | Relay grant mailbox: pubkey-addressed, content-addressed loose blobs |
144145 | `loot-cli::workspace` | Ambient repo: identity, clock, persistence, idempotent snapshot |
145146
146147 ### ADRs (docs/adr/)
147148
148149 | # | Decision |
149150 | --- | --- |
150151 | 0001 | Per-content decrypt-then-merge convergence |
151152 | 0002 | Encrypted DAG as the canonical foundation (bake-off winner) |
152153 | 0003 | Sealed content module + keyring custody (restricted keys never travel) |
153154 | 0004 | Drop plaintext dedup equality oracle |
154155 | 0005 | CLI slice, persistence, .lootattributes |
155156 | 0006 | JJ-style workspace auto-snapshot |
156157 | 0007 | Embargo escrow module |
157158 | 0008 | Grant log and targeted key bundles |
158159 | 0009 | Two-level revocation |
159160 | 0010 | Forward-maroon implementation |
160161 | 0011 | Relay stow append-only |
161162 | 0012 | Per-object loose storage |
162163 | 0013 | Named remotes and grant bundle delivery |
163164 | 0014 | Identity keypairs: ed25519 OpenSSH, signed push envelopes |
164165 | 0015 | Grant authentication and trust (grantor signs, peer-registry gate) |
165166 | 0016 | Identity portability: export/import with passphrase wrapping |
166167 | 0017 | RepoStore: one home for the `.loot/` layout |
167168 | 0018 | Signed changes: author in id + validity enforcement |
168169 | 0019 | Format versioning + compatibility gate (newer reads older) |
169170 | 0020 | Compress public content (Zstd); format major → 2 |
170171 | 0021 | Object-level "wants" negotiation on push/pull |
171172 | 0022 | Concurrent-agent model: docks, harbor, optimistic convergence |
172173 | 0023 | Agent-facing machine output: porcelain-first, reconciliation verbs |
173174 | 0024 | Resumable transfer via batched, negotiated sync |
174175
175176 See [CONTEXT.md](CONTEXT.md) for the full domain glossary.
176177
177178 ## Build & test
178179
179180 ```bash
180181 cargo build
181182 cargo test # ~25s — includes HTTP relay integration tests
182183 cargo test -p loot-core # fast, no I/O, 67 tests
183184 ```
184185
185186 ## Command reference
186187
187188 ```text
188189 loot init [--identity <name>] initialize a repo (identity from global config if omitted)
189190 loot clone <url> <dir> clone a relay or forge repo into <dir>; ends with a materialized working tree
190191 loot config set <key> <val> set a global config value (~/.config/loot/config)
191192 loot status [-m <message>] snapshot the working tree into the working change (idempotent)
192193 loot describe -m <message> name the working change
193194 loot new finalize the working change; start a fresh one
194195 loot surface materialize what the current identity may see
195196 loot lane new [--name <n>] spawn a sealed lane (isolated tree + tip) over the shared store
196197 loot lanes list lanes with their tip, in-flight PR, and status
197198 loot log show change history with visibility hints
198199 loot gc [--dry-run] prune loose objects no change references
199200 loot verify [--accept-loss] integrity-check the object store (exits 1 on corrupt/missing; --accept-loss records unrecoverable losses)
200201 loot bundle <file> write a sync bundle (ciphertext, no keys)
201202 loot apply <file> merge a peer's bundle (idempotent)
202203 loot grant <path> <identity> <file> write a targeted grant bundle (file delivery)
203204 loot grant --relay <remote> <path> <id> seal and deliver a grant via relay mailbox
204205 loot grants [<url>] peek pending grant count (no download)
205206 loot pull-grants [<url>] fetch, verify, and apply sealed grants from relay
206207 loot maroon [--hard] <path> <identity> cut off <identity> from future access
207208 loot migrate <path> <vis-spec> change a path's visibility
208209 loot manifest show the grant audit trail
209210 loot conflicts list paths needing resolution
210211 loot resolve <path> <file> resolve a conflict
211212 loot remote add <name> <url> register a relay URL
212213 loot push [<url>] publish changes to a relay
213214 loot pull [<url>] fetch and merge changes from a relay
214215 loot serve [--addr <host:port>] run a relay
215216 loot keygen generate an identity keypair
216217 loot whoami show identity and public key
217218 loot id export <file> export keypair, passphrase-encrypted
218219 loot id import <file> import keypair from passphrase-encrypted file
219220 loot peer add <name> <pubkey> register a peer's public key
220221 loot peer list list known peers
221222 ```
222223