Apply P14: the brief's State list names brokerd's session state

broker/sessions/<id>.json holds each session's taint and untrusted
flag. It is written only by brokerd and can be rebuilt from the audit
log's result records.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-18 22:22:18 -07:00
co-authored by Claude Fable 5.1
parent 477e28a759
commit 9dcb16ff30
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -72,10 +72,10 @@ Later changes to the brief:
| Date | Change | Reason | | Date | Change | Reason |
|---|---|---| |---|---|---|
| 2026-09-17 | The roles table gained a one-sentence Purpose column, and the crates that are not roles got a purpose table under Code constraints. No behaviour changed. | Owner's request: a reader, human or agent, should learn what each piece is for before what it holds. | | 2026-09-17 | The roles table gained a one-sentence Purpose column, and the crates that are not roles got a purpose table under Code constraints. No behaviour changed. | Owner's request: a reader, human or agent, should learn what each piece is for before what it holds. |
| 2026-09-18 | P14, State: the list gained `broker/sessions/<id>.json`, each session's taint and untrusted flag, written only by `brokerd`. | The M3a spec keeps this state in files the list did not name. It can be rebuilt from the audit log's `result` records, so the audit log stays the record of truth. Owner: a plain file also makes debugging easier. |
## Proposed changes to the design brief ## Proposed changes to the design brief
| # | Change | Reason | | # | Change | Reason |
|---|---|---| |---|---|---|
| P13 | Authority contract 4: add "Tool containers run from one image built from source by Nix and named by digest; nothing is pulled at call time." | The brief does not say where tool images come from; a pull at call time would be unlisted egress. Decided 2026-09-18 above. | | P13 | Authority contract 4: add "Tool containers run from one image built from source by Nix and named by digest; nothing is pulled at call time." | The brief does not say where tool images come from; a pull at call time would be unlisted egress. Decided 2026-09-18 above. |
| P14 | State: add "`broker/sessions/<id>.json` — each session's taint and untrusted flag, written only by `brokerd`". | The M3a spec keeps this state in files the brief's list does not name. It can be rebuilt from the audit log's `result` records, so the audit log stays the record of truth. |
+2
View File
@@ -206,6 +206,8 @@ Files are the source of truth. SQLite is allowed only for rebuildable indexes an
- `index/` — FTS5 and, later, vectors; disposable and rebuildable from `memory/` - `index/` — FTS5 and, later, vectors; disposable and rebuildable from `memory/`
- `grants/*.toml` — owner-written - `grants/*.toml` — owner-written
- `audit/*.jsonl` — hash-chained - `audit/*.jsonl` — hash-chained
- `broker/sessions/<id>.json` — each session's taint and untrusted flag, written only by
`brokerd`; it can be rebuilt from the audit log's `result` records
- Secrets: behind a `SecretStore` trait. v0 backend is an encrypted file whose key is not stored - Secrets: behind a `SecretStore` trait. v0 backend is an encrypted file whose key is not stored
beside it. No plaintext secrets on disk, none in config, none in the repo. beside it. No plaintext secrets on disk, none in config, none in the repo.
+1 -1
View File
@@ -296,7 +296,7 @@ pub fn redecide(ask: Ask, grants: &GrantSet, state: SessionState, now: Timestamp
- Writes are atomic: write `<id>.json.tmp`, `fsync`, rename over `<id>.json`, `fsync` the directory. - Writes are atomic: write `<id>.json.tmp`, `fsync`, rename over `<id>.json`, `fsync` the directory.
- A file that exists but cannot be read or parsed is an error: every call for that session is - A file that exists but cannot be read or parsed is an error: every call for that session is
denied with `state_unreadable` and `brokerd` prints `see docs/runbook.md#broker-state-damaged`. denied with `state_unreadable` and `brokerd` prints `see docs/runbook.md#broker-state-damaged`.
- The brief's State list does not name this directory yet; P14 in `docs/decisions.md` proposes it. - The brief's State list names this file (P14, applied 2026-09-18).
- `loopd` has no access to `<home>/broker/`. The `class` and `untrusted` values it logs are a copy - `loopd` has no access to `<home>/broker/`. The `class` and `untrusted` values it logs are a copy
for its own use and never an input to policy. for its own use and never an input to policy.