in reviewhumanPR #350Memory

MindVault: shared-memory seller adapter with crash-restart check

MindVault is shared memory for a team of agents. Every note has an access level (L0 public up to L2 finance), an agent only reads notes at or below its own level, and a note an agent writes is labelled with the highest level that agent has…

Author

triptikhetan-max avatar

@triptikhetan-max

github profile →
Status
In review
Opened on
Nov 11
Branch
integration/mindvault-seller

Description

The pitch.

## Summary

MindVault is shared memory for a team of agents. Every note has an access level (L0 public up to L2 finance), an agent only reads notes at or below its own level, and a note an agent writes is labelled with the highest level that agent has read in its session (session taint). An LLM reviewer checks every write before it is stored.

This PR adds `examples/integrations/mindvault/`: a Track seller that keeps its price list in MindVault. It reads the widget price from an L2 finance note, writes a deal note back, and serves Town's quote task. We test two things: that MindVault fits inside Town's protocol without breaking any stage, and that the deal note stays unreadable to an L0 intern, including after a crash and restart.

## Integration

- **Interface tested:** Town's Track mailbox (join, claim under a lease, reply, ack) on one side, and MindVault's MCP tools `memory_read` and `memory_write` over Streamable HTTP on the other.
- `mv_seller.py` is a standard-library seller based on `examples/byoa_seller.py`, so Town gains no dependency. One switch: `MEMORY=mindvault` (full MindVault path) or `MEMORY=off` (same price from a local setting, no memory).
- MindVault runs as its own service, outside Town. The seller reaches it at `MINDVAULT_URL` with the finance agent's key.
- Order per request: read price (L2) -> write deal note (MindVault labels it L2 from taint, reviewer checks it) -> reply to the buyer -> local journal -> ack.
- `intern_probe.py` runs after each run. It reads every deal note by id with MindVault's L0 intern key and runs three keyword searches. Only a `LEVEL_TOO_LOW` denial counts as protected.
- `tests/test_example_mindvault.py` runs both modes and the crash case against a mock MindVault, so CI needs no key or service.

## Reproduce

- Town: `projnanda/nandatown` main at `6f9a7c0`.
- MindVault: tag `hw8-base` (`c8b209e`) on https://github.com/welkinarrow/MindVault. Reviewer model `claude-sonnet-4-6`.

```bash
# MindVault (separate checkout, needs an Anthropic key for its reviewer)
git clone https://github.com/welkinarrow/MindVault && cd MindVault && git checkout hw8-base
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/python scripts/gen_keys.py
cp hw8/mindvault.env.example ~/.config/mindvault.env   # add your key

# Town, all 15 runs
python3 -m venv .venv && .venv/bin/pip install -e '.[dev]'
source ~/.config/mindvault.env
MINDVAULT_DIR=/path/to/MindVault bash examples/integrations/mindvault/run_compare.sh

# No key: mock tests only
python -m pytest -q tests/test_example_mindvault.py

# Offline check of the recorded evidence
nandatown verify examples/integrations/mindvault/evidence/bundles/<run>/run-<id>
```

## Results and limitations

15 live runs, 3 per row, recorded on Nov 11, 2026. Evidence bundles and `results.csv` are in `examples/integrations/mindvault/evidence/`. Every bundle passes `nandatown verify`.

| # | Condition x profile | Expected | Observed (3 of 3 runs) |
| --- | --- | --- | --- |
| 1 | off x quote-clean | All stages pass, no MindVault calls | PASSED 6/6, 0 calls |
| 2 | mindvault x quote-clean | All stages pass; note L2 and approved; intern cannot read it | PASSED 6/6; note L2, reviewer pass; intern `LEVEL_TOO_LOW`, 0 search hits |
| 3 | off x quote-crash-restart | All stages pass | PASSED 8/8, incl. `stale_fence_rejected` and `recovered_after_restart` |
| 4 | mindvault x quote-crash-restart | All stages pass; notes L2; intern cannot read | PASSED 8/8; both notes L2; intern `LEVEL_TOO_LOW` on the published note |
| 5 | same runs as row 4: duplicate | Staging may hold 2 notes | Reproduced every run: 2 notes. The reviewer quarantined the second as an exact duplicate, so only one was published |
| 6 | control: MindVault `LABEL_MODE=self` x quote-clean | Should FAIL: the writer sets the level, our seller sets none, so the note is stored at L0 | Failed as intended: Town still PASSED 6/6, but the note was L0 and the intern read it, including the confidential 199

…

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/350/head:pr-350
git checkout pr-350