Summary
Integrate MemPalace (8.2k stars, MIT) as an optional persistent memory layer for Trinity agents. MemPalace is an MCP-compatible memory server that gives agents structured long-term recall across chat sessions using local SQLite + ChromaDB — no cloud services or API keys required.
Problem
Trinity agents have persistent chat history (stored in the platform DB), but the agents themselves have no cross-session memory. When a new chat session starts, the agent loses all working context about prior conversations, decisions, and accumulated knowledge. This limits the effectiveness of long-running autonomous agents.
Solution
Add MemPalace as a per-agent opt-in capability via a simple toggle, similar to the existing read-only mode or autonomy toggle.
Architecture
- Transport: stdio MCP server (
python -m mempalace.mcp_server) — no ports, no sidecar containers
- Storage:
/home/developer/.mempalace/ — already on the persistent workspace volume, survives restarts
- Tools: 19 MCP tools for memory filing, semantic search, knowledge graph, and agent diary
- Dependencies: Python package with ChromaDB (adds ~50MB to base image)
- Init: None required — palace structure created lazily on first tool use
Runtime flow
User enables memory toggle → backend injects mempalace into .mcp.json
→ Claude Code picks up MCP server → 19 memory tools available
→ Agent stores/retrieves memories automatically
→ Data persists across container restarts via workspace volume
Implementation
Changes required
| Change |
File |
Notes |
Add pip install mempalace |
docker/base-image/Dockerfile |
1 line, requires base image rebuild |
| Add memory toggle DB mixin |
src/backend/db/agent_settings/memory.py |
New mixin, ~40 lines |
| Add memory toggle endpoints |
src/backend/routers/agent_config.py |
GET/PUT /api/agents/{name}/memory |
| Inject MCP config on toggle |
src/backend/routers/agent_config.py |
Add/remove mempalace entry in .mcp.json |
| Frontend toggle UI |
src/frontend/src/views/AgentDetail.vue |
Toggle in agent settings panel |
| MCP tool (optional) |
src/mcp-server/src/tools/agents.ts |
Enable/disable via MCP |
MCP config injected when enabled
{
"mcpServers": {
"mempalace": {
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
Design decisions
- Platform capability, not template-specific — any agent can enable it regardless of template
- Off by default — adds 19 tools to the agent's context; should be opt-in
- No initialization step — skip
mempalace init (interactive, human-oriented); MCP tools create structure on first use
- Leverage existing injection flow — use
POST /api/agents/{name}/credentials/inject for .mcp.json updates
Acceptance Criteria
References
- MemPalace repo: https://github.com/milla-jovovich/mempalace
- 19 MCP tools: palace navigation, data modification, knowledge graph, graph navigation, agent diary
- AAAK compression: 30x compression dialect for efficient memory storage
Summary
Integrate MemPalace (8.2k stars, MIT) as an optional persistent memory layer for Trinity agents. MemPalace is an MCP-compatible memory server that gives agents structured long-term recall across chat sessions using local SQLite + ChromaDB — no cloud services or API keys required.
Problem
Trinity agents have persistent chat history (stored in the platform DB), but the agents themselves have no cross-session memory. When a new chat session starts, the agent loses all working context about prior conversations, decisions, and accumulated knowledge. This limits the effectiveness of long-running autonomous agents.
Solution
Add MemPalace as a per-agent opt-in capability via a simple toggle, similar to the existing read-only mode or autonomy toggle.
Architecture
python -m mempalace.mcp_server) — no ports, no sidecar containers/home/developer/.mempalace/— already on the persistent workspace volume, survives restartsRuntime flow
Implementation
Changes required
pip install mempalacedocker/base-image/Dockerfilesrc/backend/db/agent_settings/memory.pysrc/backend/routers/agent_config.pyGET/PUT /api/agents/{name}/memorysrc/backend/routers/agent_config.py.mcp.jsonsrc/frontend/src/views/AgentDetail.vuesrc/mcp-server/src/tools/agents.tsMCP config injected when enabled
{ "mcpServers": { "mempalace": { "command": "python", "args": ["-m", "mempalace.mcp_server"] } } }Design decisions
mempalace init(interactive, human-oriented); MCP tools create structure on first usePOST /api/agents/{name}/credentials/injectfor.mcp.jsonupdatesAcceptance Criteria
mempalacePython package pre-installed in base agent image.mcp.jsonReferences