Graph-Backed Recall with Audit Sync
Parent: #101 (Hippocampus v2)
Depends on: #102 (SQLite audit trail)
Priority: 3
What
`recall` is powered by the graph engine (CozoDB HNSW + Datalog), not SQLite scans. memories.db is write-only for normal operations. This issue ensures the two stay in sync and that the graph's full power is behind the simple `recall` verb.
How Recall Works Internally
When an agent calls `recall "authentication issues"`:
- Vector search: Embed query -> HNSW nearest neighbors on concepts (existing `/mind/search`)
- Graph traversal: For top results, walk 1-hop edges to find connected concepts (existing `/graph/neighbors`)
- Connection typing: Edges with CONFLICTS_WITH relation -> `conflict: true` flag on result
- Trust inference: Look up memory's `from_source` in memories.db -> assign trust tier
- Strength scoring: Combine vector similarity + recency + access count (existing decay scoring)
- Format: Return memories as `{id, what, from, tags, trust, strength, connections, conflict}`
This is what the graph buys us — a single `recall` call does semantic search, graph traversal, contradiction detection, and relevance scoring in one pass.
Auto-Connection on Remember
When a new memory is written:
- Embed the `what` field (existing behavior)
- Query HNSW for top-3 similar existing concepts (score > 0.7)
- Create `RELATES_TO` edges between the new concept and matches
- Return connections in the `remember` response
CozoDB handles this natively — edge create after vector search.
Audit Sync Guarantee
The dual-write from #102 ensures every graph write has a corresponding memories.db row. For sync validation:
- Each memories.db row has `graph_id` pointing to the concept in mind.db
- `brane admin verify` can cross-check: every memories.db row has a live concept, every concept has a memories.db row
- Drift detected -> `brane admin rebuild` reconciles from memories.db
Acceptance Criteria
Graph-Backed Recall with Audit Sync
Parent: #101 (Hippocampus v2)
Depends on: #102 (SQLite audit trail)
Priority: 3
What
`recall` is powered by the graph engine (CozoDB HNSW + Datalog), not SQLite scans. memories.db is write-only for normal operations. This issue ensures the two stay in sync and that the graph's full power is behind the simple `recall` verb.
How Recall Works Internally
When an agent calls `recall "authentication issues"`:
This is what the graph buys us — a single `recall` call does semantic search, graph traversal, contradiction detection, and relevance scoring in one pass.
Auto-Connection on Remember
When a new memory is written:
CozoDB handles this natively — edge create after vector search.
Audit Sync Guarantee
The dual-write from #102 ensures every graph write has a corresponding memories.db row. For sync validation:
Acceptance Criteria