from
e59e46b30befcfc0d31c7b41f8d5fd226e2ec0df888e32b6dd74bb7dbed0fc68 → e59e46b3to
cc1384f94702067ee43700c6750be1ac0c22cf3adc095a5e858af85cc43253bd → cc1384f9+2 −2
| 1 | 1 | # loot | |
| 2 | 2 | ||
| 3 | 3 | A from-scratch source-control system. | |
| 4 | 4 | ||
| 5 | 5 | **Thesis:** visibility and permissions belong to *content and changes*, not to | |
| 6 | 6 | the *repository*. Commit your `.env`. Keep files private inside a shared repo. | |
| 7 | 7 | Embargo a security fix: merge it, cut the release, reveal the source later. | |
| 8 | 8 | ||
| 9 | 9 | This is the unsolved problem in modern version control. Ergonomics (jj already | |
| 10 | 10 | nails them) are a layer for later. | |
| 11 | 11 | ||
| 12 | 12 | ## Security | |
| 13 | 13 | ||
| 14 | 14 | loot's cryptography is written from scratch and has never been independently | |
| 15 | 15 | reviewed. What each reader — a relay, a forge, a collaborator, the anonymous | |
| 16 | 16 | internet, the git mirror, and anyone holding your `.loot/` directory — can | |
| 17 | 17 | actually read is stated tier by tier at | |
| 18 | 18 | **<https://loot.millerbyte.com/trust>**. Read it before you put anything in a | |
| 19 | 19 | loot repo whose disclosure would hurt you. Two things it says that the pitch | |
| 20 | 20 | does not: the default tier is one a relay reads by design, and path names are | |
| 21 | 21 | never encrypted at any tier. | |
| 22 | 22 | ||
| 23 | 23 | **Report a vulnerability to <security@millerbyte.com>** — not to the public | |
| 24 | 24 | Discord. One maintainer, best effort, expect days rather than hours. ⚠ This | |
| 25 | 25 | file is not the published route: the GitHub repo is permanently private | |
| 26 | 26 | (ADR 0045/0064), so a `SECURITY.md` here and GitHub's private-advisory button | |
| 27 | 27 | both reach nobody. `/trust` is the route; this section exists for whoever | |
| 28 | 28 | already has repo access. | |
| 29 | 29 | ||
| 30 | 30 | ## What works today | |
| 31 | 31 | ||
| 32 | 32 | The full loop from first init to relay-based collaboration is functional. This | |
| 33 | − | block is the CLI's **full verb list** — all 64 verbs, regenerated from | |
| 33 | + | block is the CLI's **full verb list** — all 65 verbs, regenerated from | |
| 34 | 34 | `loot --help` rather than curated (a guard test pins it to the dispatch table, | |
| 35 | 35 | so it cannot drift again; #1107): | |
| 36 | 36 | ||
| 37 | 37 | ```text | |
| 38 | − | abandon absorb adopt apply archive attest bisect blame bundle buoy burn | |
| 38 | + | abandon absorb adopt apply archive attest bisect blame bundle buoy burn cat | |
| 39 | 39 | cherry-pick clone completions config conflicts converge describe diff doctor | |
| 40 | 40 | duplicate edit embargo-status evolog ferry gc grant grant-status grants grep id | |
| 41 | 41 | init keygen lane lanes lock log manifest maroon migrate new op peer pull | |
| 42 | 42 | pull-grants purges push rehome relay remote resolve revert serve shortlog split | |
| 43 | 43 | squash status surface tutorial undo unlock verify view whoami | |
| 44 | 44 | ``` | |
| 45 | 45 | ||
| 46 | 46 | `loot <verb> --help` prints any verb's own usage block without running it. | |
| 47 | 47 | ||
| 48 | 48 | ### Try it: private `.env` in a shared repo | |
| 49 | 49 | ||
| 50 | 50 | ```bash | |
| 51 | 51 | cargo build --release | |
| 52 | 52 | export PATH="$PWD/target/release:$PATH" | |
| 53 | 53 | ||
| 54 | 54 | cd $(mktemp -d) | |
| 55 | 55 | printf 'TOKEN=supersecret\n' > .env | |
| 56 | 56 | printf '# My Project\n' > README.md | |
| 57 | 57 | printf '.env restricted=alice\n*.md public\n' > .lootattributes | |
| 58 | 58 | ||
| 59 | 59 | loot init --identity alice | |
| 60 | 60 | loot status -m "initial work" | |
| 61 | 61 | loot surface # alice: restores both README.md and .env | |
| 62 | 62 | ||
| 63 | 63 | # switch to a non-keyholder to prove it | |
| 64 | 64 | printf mallory > .loot/identity | |
| 65 | 65 | rm -f .env README.md | |
| 66 | 66 | loot surface # mallory: README.md appears; .env stays sealed | |
| 67 | 67 | ``` | |
| 68 | 68 | ||
| 69 | 69 | The `.env` ciphertext lives in `.loot/` the whole time. Mallory cannot decrypt | |
| 70 | 70 | it, and if she snapshots and re-syncs, the sealed file is carried forward | |
| 71 | 71 | untouched — snapshot is visibility-aware. | |
| 72 | 72 | ||
| 73 | 73 | ### Sync over a relay | |
| 74 | 74 | ||
| 75 | 75 | A relay stores and forwards ciphertext it cannot read. Restricted keys never | |
| 76 | 76 | travel in a sync bundle (ADR 0003), so the relay's zero-knowledge property is | |
| 77 | 77 | enforced at the wire level, not by policy. | |
| 78 | 78 | ||
| 79 | 79 | ```bash | |
| 80 | 80 | # Terminal 1: run a relay | |
| 81 | 81 | loot serve --dir /tmp/relay --addr 127.0.0.1:4000 | |
| 82 | 82 | ||
| 83 | 83 | # Terminal 2: alice pushes | |
| 84 | 84 | loot remote add origin http://127.0.0.1:4000 | |
| 85 | 85 | loot push | |
| 86 | 86 | ||
| 87 | 87 | # Terminal 3: bob pulls (bob only sees public content) | |
| 88 | 88 | loot clone http://127.0.0.1:4000 ./bob-repo --identity bob | |
| 89 | 89 | ``` | |
| 90 | 90 | ||
| 91 | 91 | ### Grants: sharing a content key | |
| 92 | 92 | ||
| 93 | 93 | ```bash | |
| 94 | 94 | # alice knows bob's public key (from `loot whoami` on bob's machine) | |
| 95 | 95 | loot peer add bob "ssh-ed25519 AAAA..." | |
| 96 | 96 | ||
| 97 | 97 | # deliver a sealed grant via the relay | |
| 98 | 98 | loot grant --relay origin .env bob | |
| 99 | 99 | ||
| 100 | 100 | # bob fetches and applies it | |
| 101 | 101 | loot pull-grants # verifies alice's signature, checks peer registry | |
| 102 | 102 | loot surface # now bob can read .env | |
| 103 | 103 | ``` | |
| 104 | 104 | ||
| 105 | 105 | ### Embargo: timed reveals | |
| 106 | 106 | ||
| 107 | 107 | ```bash | |
| 108 | 108 | # mark a file as embargoed until unix timestamp 1800000000 | |
| 109 | 109 | echo "VULN_DETAILS=CVE-2025-XXXX" > security-fix.txt | |
| 110 | 110 | printf 'security-fix.txt embargoed=1800000000\n' >> .lootattributes | |
| 111 | 111 | ||
| 112 | 112 | loot status -m "patch for CVE-2025-XXXX" | |
| 113 | 113 | loot push # relay holds the ciphertext; key withheld until reveal_at | |
| 114 | 114 | ``` | |
| 115 | 115 | ||
| 116 | 116 | At `reveal_at`, the next read promotes the key out of escrow, so anyone who | |
| 117 | 117 | pulls can read it. | |
| 118 | 118 | The seam for a third-party key custodian (network escrow) is designed and ready. | |
| 119 | 119 | ||
| 120 | 120 | ## Architecture | |
| 121 | 121 | ||
| 122 | 122 | ```text | |
| 123 | 123 | crates/ | |
| 124 | 124 | loot-core canonical engine: encrypted DAG, per-content visibility, convergence | |
| 125 | 125 | loot-identity ed25519 keypairs, x25519 ECIES, signed push envelopes, peer registry | |
| 126 | 126 | loot-net relay HTTP server + sync client (stow/negotiate/grant mailbox) | |
| 127 | 127 | loot-cli the `loot` binary — commands are thin verbs over Workspace | |
| 128 | 128 | loot-bench shared 50k-file benchmark workload | |
| 129 | 129 | spike-dag thin shim re-exporting loot-core (bake-off compat) | |
| 130 | 130 | spike-crdt non-canonical CRDT model (retained so the bake-off is reproducible) | |
| 131 | 131 | ``` | |
| 132 | 132 | ||
| 133 | 133 | ### Key modules | |
| 134 | 134 | ||
| 135 | 135 | | Module | What it owns | | |
| 136 | 136 | | --- | --- | | |
| 137 | 137 | | `loot-core::sealed` | Per-content encryption, key custody, embargo, public-content compression (ADR 0003, 0007, 0020) | | |
| 138 | 138 | | `loot-core::converge` | Merger/relay convergence rule — decrypt-then-merge (ADR 0001) | | |
| 139 | 139 | | `loot-core::engine` | Encrypted content-addressed DAG: put/get/record/surface/bundle/apply | | |
| 140 | 140 | | `loot-core::manifest` | Grant audit trail: grantee, grantor pubkeys, timestamps | | |
| 141 | 141 | | `loot-identity` | ed25519 sign/verify, x25519 derive, ECIES seal/unseal, push envelope | | |
| 142 | 142 | | `loot-net::mailbox` | Relay grant mailbox: pubkey-addressed, content-addressed loose blobs | | |
| 143 | 143 | | `loot-cli::workspace` | Ambient repo: identity, clock, persistence, idempotent snapshot | | |
| 144 | 144 | ||
| 145 | 145 | ### ADRs (docs/adr/) | |
| 146 | 146 | ||
| 147 | 147 | | # | Decision | | |
| 148 | 148 | | --- | --- | | |
| 149 | 149 | | 0001 | Per-content decrypt-then-merge convergence | | |
| 150 | 150 | | 0002 | Encrypted DAG as the canonical foundation (bake-off winner) | | |
| 151 | 151 | | 0003 | Sealed content module + keyring custody (restricted keys never travel) | | |
| 152 | 152 | | 0004 | Drop plaintext dedup equality oracle | | |
| 153 | 153 | | 0005 | CLI slice, persistence, .lootattributes | | |
| 154 | 154 | | 0006 | JJ-style workspace auto-snapshot | | |
| 155 | 155 | | 0007 | Embargo escrow module | | |
| 156 | 156 | | 0008 | Grant log and targeted key bundles | | |
| 157 | 157 | | 0009 | Two-level revocation | | |
| 158 | 158 | | 0010 | Forward-maroon implementation | | |
| 159 | 159 | | 0011 | Relay stow append-only | | |
| 160 | 160 | | 0012 | Per-object loose storage | | |
| 161 | 161 | | 0013 | Named remotes and grant bundle delivery | | |
| 162 | 162 | | 0014 | Identity keypairs: ed25519 OpenSSH, signed push envelopes | | |
| 163 | 163 | | 0015 | Grant authentication and trust (grantor signs, peer-registry gate) | | |
| 164 | 164 | | 0016 | Identity portability: export/import with passphrase wrapping | | |
| 165 | 165 | | 0017 | RepoStore: one home for the `.loot/` layout | | |
| 166 | 166 | | 0018 | Signed changes: author in id + validity enforcement | | |
| 167 | 167 | | 0019 | Format versioning + compatibility gate (newer reads older) | | |
| 168 | 168 | | 0020 | Compress public content (Zstd); format major → 2 | | |
| 169 | 169 | | 0021 | Object-level "wants" negotiation on push/pull | | |
| 170 | 170 | | 0022 | Concurrent-agent model: docks, harbor, optimistic convergence | | |
| 171 | 171 | | 0023 | Agent-facing machine output: porcelain-first, reconciliation verbs | | |
| 172 | 172 | | 0024 | Resumable transfer via batched, negotiated sync | | |
| 173 | 173 | ||
| 174 | 174 | See [CONTEXT.md](CONTEXT.md) for the full domain glossary. | |
| 175 | 175 | ||
| 176 | 176 | ## Build & test | |
| 177 | 177 | ||
| 178 | 178 | ```bash | |
| 179 | 179 | cargo build | |
| 180 | 180 | cargo test # ~25s — includes HTTP relay integration tests | |
| 181 | 181 | cargo test -p loot-core # fast, no I/O, 67 tests | |
| 182 | 182 | ``` | |
| 183 | 183 | ||
| 184 | 184 | ## Command reference | |
| 185 | 185 | ||
| 186 | 186 | ```text | |
| 187 | 187 | loot init [--identity <name>] initialize a repo (identity from global config if omitted) | |
| 188 | 188 | loot clone <url> <dir> clone a relay or forge repo into <dir>; ends with a materialized working tree | |
| 189 | 189 | loot config set <key> <val> set a global config value (~/.config/loot/config) | |
| 190 | 190 | loot status [-m <message>] snapshot the working tree into the working change (idempotent) | |
| 191 | 191 | loot describe -m <message> name the working change | |
| 192 | 192 | loot new finalize the working change; start a fresh one | |
| 193 | 193 | loot surface materialize what the current identity may see | |
| 194 | 194 | loot lane new [--name <n>] spawn a sealed lane (isolated tree + tip) over the shared store | |
| 195 | 195 | loot lanes list lanes with their tip, in-flight PR, and status | |
| 196 | 196 | loot log show change history with visibility hints | |
| 197 | 197 | loot gc [--dry-run] prune loose objects no change references | |
| 198 | 198 | loot verify [--accept-loss] integrity-check the object store (exits 1 on corrupt/missing; --accept-loss records unrecoverable losses) | |
| 199 | 199 | loot bundle <file> write a sync bundle (ciphertext, no keys) | |
| 200 | 200 | loot apply <file> merge a peer's bundle (idempotent) | |
| 201 | 201 | loot grant <path> <identity> <file> write a targeted grant bundle (file delivery) | |
| 202 | 202 | loot grant --relay <remote> <path> <id> seal and deliver a grant via relay mailbox | |
| 203 | 203 | loot grants [<url>] peek pending grant count (no download) | |
| 204 | 204 | loot pull-grants [<url>] fetch, verify, and apply sealed grants from relay | |
| 205 | 205 | loot maroon [--hard] <path> <identity> cut off <identity> from future access | |
| 206 | 206 | loot migrate <path> <vis-spec> change a path's visibility | |
| 207 | 207 | loot manifest show the grant audit trail | |
| 208 | 208 | loot conflicts list paths needing resolution | |
| 209 | 209 | loot resolve <path> <file> resolve a conflict | |
| 210 | 210 | loot remote add <name> <url> register a relay URL | |
| 211 | 211 | loot push [<url>] publish changes to a relay | |
| 212 | 212 | loot pull [<url>] fetch and merge changes from a relay | |
| 213 | 213 | loot serve [--addr <host:port>] run a relay | |
| 214 | 214 | loot keygen generate an identity keypair | |
| 215 | 215 | loot whoami show identity and public key | |
| 216 | 216 | loot id export <file> export keypair, passphrase-encrypted | |
| 217 | 217 | loot id import <file> import keypair from passphrase-encrypted file | |
| 218 | 218 | loot peer add <name> <pubkey> register a peer's public key | |
| 219 | 219 | loot peer list list known peers | |
| 220 | 220 | ``` | |
| 221 | 221 |