fromc8ffee3b9745d26979fbd58b939250f06027b42a800fb3bc11ff2f4294c23f96 → c8ffee3b
to2d9a2d316666fde436ee34e48fd3836c088ea7a56fb812c6f11a72e2eba65dfa → 2d9a2d31

+6 −6

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 63 verbs, regenerated from
33+block is the CLI's **full verb list** — all 64 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
39−cherry-pick clone completions config conflicts describe diff doctor duplicate
40−edit embargo-status evolog ferry gc grant grant-status grants grep id init
41−keygen lane lanes lock log manifest maroon migrate new op peer pull pull-grants
42−purges push rehome relay remote resolve revert serve shortlog split squash
43−status surface tutorial undo unlock verify view whoami
39+cherry-pick clone completions config conflicts converge describe diff doctor
40+duplicate edit embargo-status evolog ferry gc grant grant-status grants grep id
41+init keygen lane lanes lock log manifest maroon migrate new op peer pull
42+pull-grants purges push rehome relay remote resolve revert serve shortlog split
43+squash status surface tutorial undo unlock verify view whoami
4444 ```
4545
4646 `loot <verb> --help` prints any verb's own usage block without running it.
4747
4848 ### Try it: private `.env` in a shared repo
4949
5050 ```bash
5151 cargo build --release
5252 export PATH="$PWD/target/release:$PATH"
5353
5454 cd $(mktemp -d)
5555 printf 'TOKEN=supersecret\n' > .env
5656 printf '# My Project\n' > README.md
5757 printf '.env restricted=alice\n*.md public\n' > .lootattributes
5858
5959 loot init --identity alice
6060 loot status -m "initial work"
6161 loot surface # alice: restores both README.md and .env
6262
6363 # switch to a non-keyholder to prove it
6464 printf mallory > .loot/identity
6565 rm -f .env README.md
6666 loot surface # mallory: README.md appears; .env stays sealed
6767 ```
6868
6969 The `.env` ciphertext lives in `.loot/` the whole time. Mallory cannot decrypt
7070 it, and if she snapshots and re-syncs, the sealed file is carried forward
7171 untouched — snapshot is visibility-aware.
7272
7373 ### Sync over a relay
7474
7575 A relay stores and forwards ciphertext it cannot read. Restricted keys never
7676 travel in a sync bundle (ADR 0003), so the relay's zero-knowledge property is
7777 enforced at the wire level, not by policy.
7878
7979 ```bash
8080 # Terminal 1: run a relay
8181 loot serve --dir /tmp/relay --addr 127.0.0.1:4000
8282
8383 # Terminal 2: alice pushes
8484 loot remote add origin http://127.0.0.1:4000
8585 loot push
8686
8787 # Terminal 3: bob pulls (bob only sees public content)
8888 loot clone http://127.0.0.1:4000 ./bob-repo --identity bob
8989 ```
9090
9191 ### Grants: sharing a content key
9292
9393 ```bash
9494 # alice knows bob's public key (from `loot whoami` on bob's machine)
9595 loot peer add bob "ssh-ed25519 AAAA..."
9696
9797 # deliver a sealed grant via the relay
9898 loot grant --relay origin .env bob
9999
100100 # bob fetches and applies it
101101 loot pull-grants # verifies alice's signature, checks peer registry
102102 loot surface # now bob can read .env
103103 ```
104104
105105 ### Embargo: timed reveals
106106
107107 ```bash
108108 # mark a file as embargoed until unix timestamp 1800000000
109109 echo "VULN_DETAILS=CVE-2025-XXXX" > security-fix.txt
110110 printf 'security-fix.txt embargoed=1800000000\n' >> .lootattributes
111111
112112 loot status -m "patch for CVE-2025-XXXX"
113113 loot push # relay holds the ciphertext; key withheld until reveal_at
114114 ```
115115
116116 At `reveal_at`, `flush_escrow` promotes the key so anyone who pulls can read it.
117117 The seam for a third-party key custodian (network escrow) is designed and ready.
118118
119119 ## Architecture
120120
121121 ```text
122122 crates/
123123 loot-core canonical engine: encrypted DAG, per-content visibility, convergence
124124 loot-identity ed25519 keypairs, x25519 ECIES, signed push envelopes, peer registry
125125 loot-net relay HTTP server + sync client (stow/negotiate/grant mailbox)
126126 loot-cli the `loot` binary — commands are thin verbs over Workspace
127127 loot-bench shared 50k-file benchmark workload
128128 spike-dag thin shim re-exporting loot-core (bake-off compat)
129129 spike-crdt non-canonical CRDT model (retained so the bake-off is reproducible)
130130 ```
131131
132132 ### Key modules
133133
134134 | Module | What it owns |
135135 | --- | --- |
136136 | `loot-core::sealed` | Per-content encryption, key custody, embargo, public-content compression (ADR 0003, 0007, 0020) |
137137 | `loot-core::converge` | Merger/relay convergence rule — decrypt-then-merge (ADR 0001) |
138138 | `loot-core::engine` | Encrypted content-addressed DAG: put/get/record/surface/bundle/apply |
139139 | `loot-core::manifest` | Grant audit trail: grantee, grantor pubkeys, timestamps |
140140 | `loot-identity` | ed25519 sign/verify, x25519 derive, ECIES seal/unseal, push envelope |
141141 | `loot-net::mailbox` | Relay grant mailbox: pubkey-addressed, content-addressed loose blobs |
142142 | `loot-cli::workspace` | Ambient repo: identity, clock, persistence, idempotent snapshot |
143143
144144 ### ADRs (docs/adr/)
145145
146146 | # | Decision |
147147 | --- | --- |
148148 | 0001 | Per-content decrypt-then-merge convergence |
149149 | 0002 | Encrypted DAG as the canonical foundation (bake-off winner) |
150150 | 0003 | Sealed content module + keyring custody (restricted keys never travel) |
151151 | 0004 | Drop plaintext dedup equality oracle |
152152 | 0005 | CLI slice, persistence, .lootattributes |
153153 | 0006 | JJ-style workspace auto-snapshot |
154154 | 0007 | Embargo escrow module |
155155 | 0008 | Grant log and targeted key bundles |
156156 | 0009 | Two-level revocation |
157157 | 0010 | Forward-maroon implementation |
158158 | 0011 | Relay stow append-only |
159159 | 0012 | Per-object loose storage |
160160 | 0013 | Named remotes and grant bundle delivery |
161161 | 0014 | Identity keypairs: ed25519 OpenSSH, signed push envelopes |
162162 | 0015 | Grant authentication and trust (grantor signs, peer-registry gate) |
163163 | 0016 | Identity portability: export/import with passphrase wrapping |
164164 | 0017 | RepoStore: one home for the `.loot/` layout |
165165 | 0018 | Signed changes: author in id + validity enforcement |
166166 | 0019 | Format versioning + compatibility gate (newer reads older) |
167167 | 0020 | Compress public content (Zstd); format major → 2 |
168168 | 0021 | Object-level "wants" negotiation on push/pull |
169169 | 0022 | Concurrent-agent model: docks, harbor, optimistic convergence |
170170 | 0023 | Agent-facing machine output: porcelain-first, reconciliation verbs |
171171 | 0024 | Resumable transfer via batched, negotiated sync |
172172
173173 See [CONTEXT.md](CONTEXT.md) for the full domain glossary.
174174
175175 ## Build & test
176176
177177 ```bash
178178 cargo build
179179 cargo test # ~25s — includes HTTP relay integration tests
180180 cargo test -p loot-core # fast, no I/O, 67 tests
181181 ```
182182
183183 ## Command reference
184184
185185 ```text
186186 loot init [--identity <name>] initialize a repo (identity from global config if omitted)
187187 loot clone <url> <dir> clone a relay into <dir>; ends with a materialized working tree
188188 loot config set <key> <val> set a global config value (~/.config/loot/config)
189189 loot status [-m <message>] snapshot the working tree into the working change (idempotent)
190190 loot describe -m <message> name the working change
191191 loot new finalize the working change; start a fresh one
192192 loot surface materialize what the current identity may see
193193 loot lane new [--name <n>] spawn a sealed lane (isolated tree + tip) over the shared store
194194 loot lanes list lanes with their tip, in-flight PR, and status
195195 loot log show change history with visibility hints
196196 loot gc [--dry-run] prune loose objects no change references
197197 loot verify [--accept-loss] integrity-check the object store (exits 1 on corrupt/missing; --accept-loss records unrecoverable losses)
198198 loot bundle <file> write a sync bundle (ciphertext, no keys)
199199 loot apply <file> merge a peer's bundle (idempotent)
200200 loot grant <path> <identity> <file> write a targeted grant bundle (file delivery)
201201 loot grant --relay <remote> <path> <id> seal and deliver a grant via relay mailbox
202202 loot grants [<url>] peek pending grant count (no download)
203203 loot pull-grants [<url>] fetch, verify, and apply sealed grants from relay
204204 loot maroon [--hard] <path> <identity> cut off <identity> from future access
205205 loot migrate <path> <vis-spec> change a path's visibility
206206 loot manifest show the grant audit trail
207207 loot conflicts list paths needing resolution
208208 loot resolve <path> <file> resolve a conflict
209209 loot remote add <name> <url> register a relay URL
210210 loot push [<url>] publish changes to a relay
211211 loot pull [<url>] fetch and merge changes from a relay
212212 loot serve [--addr <host:port>] run a relay
213213 loot keygen generate an identity keypair
214214 loot whoami show identity and public key
215215 loot id export <file> export keypair, passphrase-encrypted
216216 loot id import <file> import keypair from passphrase-encrypted file
217217 loot peer add <name> <pubkey> register a peer's public key
218218 loot peer list list known peers
219219 ```
220220