Goal: get a high-level picture of what’s in the store.
sudo -u ownsona psql -d ownsona <<'EOF' SELECT unnest(tags) AS tag, count(*) AS n FROM memories WHERE deleted_at IS NULL GROUP BY 1 ORDER BY n DESC; EOF
How many memories were explicitly requested vs. inferred by the LLM:
SELECT metadata->>'capture_mode' AS mode, count(*) FROM memories WHERE deleted_at IS NULL GROUP BY 1;
(SELECT id, text, created_at FROM memories WHERE deleted_at IS NULL ORDER BY created_at LIMIT 3) UNION ALL (SELECT id, text, created_at FROM memories WHERE deleted_at IS NULL ORDER BY created_at DESC LIMIT 3);
SELECT id, text, deleted_at, forget_reason, replaced_by_id FROM memories WHERE deleted_at IS NOT NULL ORDER BY deleted_at DESC;
These are operator queries — they bypass the MCP layer entirely, which is exactly the point: they’re for you, not for the LLM.