From 938f3a6551594bb1d06f0f9d68805c185beb0f17 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 20 Feb 2026 23:24:17 -0600 Subject: [PATCH] store: Fix: Use client.py reindex (not stats) to build _index.json from scratch on new deployments --- ...-stats-to-build-indexjson-from-s-8244e7.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 graph/fixes/fix-use-clientpy-reindex-not-stats-to-build-indexjson-from-s-8244e7.md diff --git a/graph/fixes/fix-use-clientpy-reindex-not-stats-to-build-indexjson-from-s-8244e7.md b/graph/fixes/fix-use-clientpy-reindex-not-stats-to-build-indexjson-from-s-8244e7.md new file mode 100644 index 00000000000..d29853c91ee --- /dev/null +++ b/graph/fixes/fix-use-clientpy-reindex-not-stats-to-build-indexjson-from-s-8244e7.md @@ -0,0 +1,42 @@ +--- +id: 8244e75b-f077-4f92-9ed1-904af7b9ba63 +type: fix +title: "Fix: Use client.py reindex (not stats) to build _index.json from scratch on new deployments" +tags: [cognitive-memory, deployment, fix, homelab, reindex, index] +importance: 0.6 +confidence: 0.8 +created: "2026-02-21T05:24:17.159355+00:00" +updated: "2026-02-21T05:24:17.159355+00:00" +--- + +# Fix: client.py reindex Required for Fresh Memory Deployments + +## Problem + +When deploying cognitive memory to a new server, running `client.py stats` does NOT build an `_index.json`. It only reads an existing one. On a fresh deployment the index file does not exist, so stats returns nothing useful and memory search/recall will fail. + +## Solution + +Run `client.py reindex` after deploying files to a new server. This command: +1. Walks `graph/` and `vault/` directories +2. Parses YAML frontmatter from each `.md` file +3. Extracts 200-char content previews +4. Scans `graph/edges/` separately +5. Writes a single `_index.json` (approx 450KB for 538 memories, takes ~1 second) + +## Integration with sync-memory.sh + +On LXC 301, the `reindex` call is placed **inside the conditional block** that checks whether `git pull` brought in new commits (BEFORE/AFTER rev comparison). This prevents unnecessary reindex runs on no-op syncs. + +```bash +BEFORE=$(git rev-parse HEAD) +git pull +AFTER=$(git rev-parse HEAD) +if [ "$BEFORE" != "$AFTER" ]; then + python3 client.py reindex +fi +``` + +## Tags + +Applies to any new cognitive-memory deployment. Always reindex after first sync.