You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add memory and context persistence so agents can retain information across conversations.
Motivation
Stateless agents lose all context between requests. For business use cases (ongoing document review, multi-session projects), agents need persistent memory.
Evaluation targets
Letta — open source, agent memory management framework
Mem0 — open source, structured memory layer for LLM apps
Graphiti — open source, temporal knowledge graph for agent memory
All candidates should be evaluated for OpenShift compatibility, resource requirements, and integration complexity.
Acceptance criteria
Evaluate candidates against OpenShift deployment constraints
Prototype integration with at least one memory backend
Memory accessible via tool interface in the agentic loop
Configuration via agent-config.yaml
From roadmap: docs/slides/docsclaw-intro.html, slide 6
ran into this exact problem running agents for recurring business workflows (weekly client reports, follow-up sequences, invoice reconciliation). tested all three of your candidates over about two months.
the thing nobody warns you about: structured memory (Mem0) works great for factual recall but falls apart for procedural memory. your agent remembers that Client X prefers PDF invoices but forgets the 6-step sequence it learned for generating them. Graphiti handles temporal relationships better but the resource footprint on constrained environments is rough, we saw 2-3GB baseline just for the graph store.
what actually worked for us was a dead simple file-based approach: markdown files with YAML frontmatter, organized by type (user preferences, workflow feedback, project state). agent reads an index file at conversation start, pulls in relevant memory files as needed. total overhead is basically zero, deploys anywhere, and the memory is human-readable so you can debug it by just opening a file.
for your OpenShift constraints i'd honestly prototype the flat-file approach first before committing to infrastructure. curious what kind of agent workflows you're targeting, because that changes the memory architecture significantly. document review with stable context is very different from multi-session projects where the state graph keeps growing.
Before adding persistent memory, we need basic multi-turn session state on the server side. Currently the server is stateless — the chat TUI works around this by prepending full conversation history as text into each request.
Once sessions persist message history (Phase 1), long conversations will hit context window limits. We need automatic compaction — summarizing older messages while preserving recent context.
Approach (modeled on pi-mono's implementation)
Token estimation: len(chars) / 4 heuristic for quick estimates; use actual usage.totalTokens from provider responses when available
Trigger: compact when estimatedTokens > (contextWindow - reserveTokens), with configurable reserveTokens (default 16384) and keepRecentTokens (default 20000)
Cut point selection: walk backwards from newest message, accumulate token sizes, stop at keepRecentTokens; never cut mid-turn (keep tool results with their tool calls)
Summarization: send discarded messages to the LLM with a structured summarization prompt producing: Goal, Constraints, Progress, Decisions, Next Steps, Critical Context
Iterative updates: on subsequent compactions, merge new messages into the previous summary rather than re-summarizing everything
Key design decisions
Compaction runs automatically but can also be triggered manually (e.g., /compact command in chat TUI)
File operations (reads/writes) should be tracked across compaction boundaries so the agent knows what files it has touched
The summary replaces old messages in the session — original history stays in the persisted session file for audit
Depends on
Phase 1 (session management) — need Messages []llm.Message in the session model
Activity
m13v commentedon Apr 14, 2026
ran into this exact problem running agents for recurring business workflows (weekly client reports, follow-up sequences, invoice reconciliation). tested all three of your candidates over about two months.
the thing nobody warns you about: structured memory (Mem0) works great for factual recall but falls apart for procedural memory. your agent remembers that Client X prefers PDF invoices but forgets the 6-step sequence it learned for generating them. Graphiti handles temporal relationships better but the resource footprint on constrained environments is rough, we saw 2-3GB baseline just for the graph store.
what actually worked for us was a dead simple file-based approach: markdown files with YAML frontmatter, organized by type (user preferences, workflow feedback, project state). agent reads an index file at conversation start, pulls in relevant memory files as needed. total overhead is basically zero, deploys anywhere, and the memory is human-readable so you can debug it by just opening a file.
for your OpenShift constraints i'd honestly prototype the flat-file approach first before committing to infrastructure. curious what kind of agent workflows you're targeting, because that changes the memory architecture significantly. document review with stable context is very different from multi-session projects where the state graph keeps growing.
pavelanni commentedon Apr 24, 2026
Phase 1: Server-side session management (from #37)
Before adding persistent memory, we need basic multi-turn session state on the server side. Currently the server is stateless — the chat TUI works around this by prepending full conversation history as text into each request.
Session model
Storage backends (in order of implementation)
Integration points
taskIdfrom the protocol to look up or create sessionsprocessMessageinserve.goretrieves session history and appends new messagesDesign constraints
agent-config.yamlThis is a prerequisite for Phase 2 (persistent memory via Letta/Mem0/Graphiti).
pavelanni commentedon May 4, 2026
Phase 3: Context compaction (from pi-mono analysis)
Once sessions persist message history (Phase 1), long conversations will hit context window limits. We need automatic compaction — summarizing older messages while preserving recent context.
Approach (modeled on pi-mono's implementation)
len(chars) / 4heuristic for quick estimates; use actualusage.totalTokensfrom provider responses when availableestimatedTokens > (contextWindow - reserveTokens), with configurablereserveTokens(default 16384) andkeepRecentTokens(default 20000)keepRecentTokens; never cut mid-turn (keep tool results with their tool calls)Key design decisions
/compactcommand in chat TUI)Depends on
Messages []llm.Messagein the session modelllm.Response(see feat: add OpenTelemetry tracing for agent execution #34)Identified from analysis of pi-mono's compaction system in
packages/coding-agent/src/core/compaction/.feat: add server-side session management for multi-turn conversations (…
fix: address code review findings from PR #74
feat: agent manifest with declarative tooling and build pipeline (#74)