fromf10ba1d90df3fd1016685f5a0c4d1b6ec28d7aca8d9b9b3c9aaf304bfc6790f0 → f10ba1d9
to2c12d0f2a3246d10ab33f9ded3d4d530f7db0f2fd84d0dcf50ac2aba554f8178 → 2c12d0f2

+2 −1

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