INSTALL.md
Language Markdown3.7 KB79 lines
# Installing better-memoryOne script (plus an optional second one) and one launchd job on a Mac, then ascheduled Cowork task for the distiller. Replace `CHANGEME` with the macOS username.## The shapevaults -> gate.py (20:00, launchd) -> ~/cowork-staging/staging -> distiller (20:30, Cowork) -> Notion better-memory## 1. Decide the walls firstOpen `gate.py` and read `_BASE_DENY_PREFIXES` and `DENY_COMPONENTS`. Every folder thatmust stay out of a database your phone reads has to be named there (prefixes arerelative to a vault root and match case-insensitively; components match a folder nameat any depth). Add any that are missing, and add a matching probe to the startupself-check in `main()` so the gate refuses to run if that wall ever stops blocking.This is the one review that matters. `EXTRA_DENY` (comma-separated prefixes) addswalls without editing the file.## 2. Install the scriptsmkdir -p ~/.local/bin/better-memory ~/cowork-stagingcp gate.py content_gate.py scheduling/run-nightly.sh ~/.local/bin/better-memory/chmod +x ~/.local/bin/better-memory/*## 3. Run it by hand against the live vaultsVAULT_ROOTS="$HOME/Documents/vaults/workbench:$HOME/Documents/vaults/identity" \STAGING_DIR="$HOME/cowork-staging" \python3 ~/.local/bin/better-memory/gate.pyYou want one line: `gate: staged=N skipped=N framing-only=N scaffold-skipped=N total-staged=N -> <staging dir>`.Then check the walls held, naming your own walled folders:ls ~/cowork-staging/staging | grep -iE '_private|finance|journal' \&& echo "WALL LEAK, STOP" || echo "walls holding"If the gate prints `DENYLIST FAILED to block ...`, that is it refusing to run because awall is not blocking. Fix the denylist; do not force it. Run it a second time: it shouldstage 0.Point `VAULT_ROOTS` at the live vaults, never at a copy or a mirror that may be missingthe very folders the walls exist for.## 4. Schedule itEdit `scheduling/com.example.better-memory.plist` (replace every `CHANGEME`; confirm the`python3` path in `run-nightly.sh` matches `which python3`), and set `VAULT_ROOTS` in`run-nightly.sh`. Then:cp scheduling/com.example.better-memory.plist ~/Library/LaunchAgents/launchctl load ~/Library/LaunchAgents/com.example.better-memory.plistlaunchctl start com.example.better-memorycat ~/cowork-staging/better-memory.logIt now runs nightly at 20:00. To stop it: `launchctl unload` the same plist.## 5. The distiller1. In Notion, create a database named `better-memory` with the properties in[`distiller/notion-schema.md`](../distiller/notion-schema.md), and seed the Tagsvocabulary.2. Authorize the Notion connector in Claude against that workspace. Click-throughauthorization; no token touches a vault or a script.3. Install [`distiller/better-memory-nightly-distill`](../distiller/better-memory-nightly-distill/SKILL.md)as a skill, with the database's URL and data source ID filled in.4. Create a Cowork scheduled task for 20:30 that runs the skill, bound to`~/cowork-staging/staging` only.5. Keep the database read-only from every interactive session.## The optional content gate`run-nightly.sh` runs `content_gate.py` after the path gate. It removes (or, with`BM_GATE_MODE=redact`, redacts) any staged file with `private: true`, `gate: block` or`visibility: private` in its frontmatter, and any line carrying `%% bm:private %%` ormatching its patterns. It writes `gate-report.json` into staging listing every decision.It is a backstop for filing mistakes, not semantic privacy: a private thought inordinary words, with no flag and no pattern, passes. Delete its lines from the wrapperto run the path gate alone.