Run 2026-08-27, after the correction established that new pollution had already stopped on its own and the whole problem was a historical residue being over-retrieved.
Result: the command-log share of what recall injects fell from 22% to 0.9%.
| candidates matched by the classifier | 178 |
| kept after reading all 178 | 20 |
| deleted | 158 |
| nodes before → after | 7,330 → 7,172 |
The keep/delete decision for every id is committed beside this file as
command-log-cleanup-plan.json, so the call
is auditable rather than described.
Its precision was estimated at ~92% from a 12-item sample. Reading all 178 put the real figure at 11.2% — 20 false positives, nearly double the estimate, and the misses were exactly the expensive kind:
curl used to measure it.claude mcp add -s local, the Discord parser’s ! prefix, the
setfacl ACL repair and its gotcha, the vec0 test-ordering defect, and the
exit=101 → retain_jobs lock finding.A 12-item sample said 92% and the population said 89%. The difference between those two numbers is six irreplaceable memories. The sample was not wrong; it was too small to see what it was about to cost, and that is the argument for reading all of them rather than trusting a rate.
Borderline calls went to keep, because deletion is the irreversible
direction: a stale test tally (2126), a thin latency note duplicating 777
(6632 / 7264), and an operational note about hermes-qwen3 (5201).
8171 and 8221 are not command logs. Their text is “the
include_tool_calls switch … is set to true by default for the coding
profile” — this investigation’s own wrong claim, faithfully retained by
MemGarden hours before it was disproved. They were removed because they are
false, not because they are noise, and that is recorded here rather than
folded into the 158.
Raw SQL cannot do this. The memory_nodes_vec_ad trigger deletes from
vec_nodes, a vec0 virtual table that only a connection with the sqlite-vec
extension can touch; a python3 -c attempt failed with no such module: vec0
before writing anything. So deletion went through the store’s own
nodes::delete, via crates/memgardend/examples/delete_nodes.rs — dry-run by
default, --apply to commit — with the daemon stopped for the duration.
A full backup was taken first:
~/.local/share/memgarden/backup-before-cmdlog-cleanup-20260827-023937.db,
87 MB, integrity_check ok, 7,330 nodes.
| check | result |
|---|---|
nodes::delete calls |
158 ok, 0 errors |
PRAGMA integrity_check |
ok |
PRAGMA foreign_key_check |
clean |
orphans across links, node_entities, node_tags, node_sources |
0 on all six columns |
memory_nodes vs memory_nodes_fts |
7,172 = 7,172 |
| daemon after restart | HEALTHY, 7,172 nodes, 9 banks, schema v9, unembedded 0 |
| links | 245,532 → 237,449 (cascade) |
The four cascade tables are declared ON DELETE CASCADE and the app’s
init_pragmas sets foreign_keys=ON (conn.rs:48) — which matters, because
SQLite’s default for that pragma is off, and deleting with it off would
have left every one of those orphan counts non-zero.
Six prompts from the session that found the problem, replayed against the live recall endpoint:
| injected | command-log | share | |
|---|---|---|---|
| before | 106 | 23 | 22% |
| after | 109 | 1 | 0.9% |
The one survivor is a hit on the question “can command logs be stopped from being stored at all?” — a query for which a command log is the correct answer.