Problem
The MCP server loads the graph once at startup. Conversations added via add_conversation are saved to disk but NOT reflected in the in-memory Graph. New memories are invisible within the same session.
Solution
Replace the immutable Graph value with a MemoryAgentState containing TVar fields:
data MemoryAgentState = MemoryAgentState
{ masGraph :: TVar Graph
, masIndex :: TVar GraphIndex
, masCommMap :: TVar CommunityMap
, masAnalysis :: TVar Analysis
, masConvs :: TVar [ConversationNode]
, masDirty :: TVar Bool
, masMutationCount :: TVar Int
}
All MCP handlers read from TVars. add_conversation updates TVars atomically via STM.
Acceptance Criteria
Files to Modify
- src/Graphos/Infrastructure/Server/MCP.hs
- src/Graphos/Domain/Context.hs (no changes needed, types already complete)
Effort: 2-3 days
Priority: Critical (blocks all other memory agent work)
See: docs/proposals/memory-agent/03-architecture.md (Spec 1)
Problem
The MCP server loads the graph once at startup. Conversations added via add_conversation are saved to disk but NOT reflected in the in-memory Graph. New memories are invisible within the same session.
Solution
Replace the immutable Graph value with a MemoryAgentState containing TVar fields:
All MCP handlers read from TVars. add_conversation updates TVars atomically via STM.
Acceptance Criteria
Files to Modify
Effort: 2-3 days
Priority: Critical (blocks all other memory agent work)
See: docs/proposals/memory-agent/03-architecture.md (Spec 1)