Repository navigation
Closed
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttheme-devexTheme: DevExtype-featureNew functionality
Description
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/injectfor.mcp.jsonupdates
Acceptance Criteria
-
mempalacePython package pre-installed in base agent image - Per-agent memory toggle (GET/PUT endpoints)
- Enabling toggle injects mempalace MCP server into agent's
.mcp.json - Disabling toggle removes mempalace entry (preserves other MCP servers)
- Memory data persists across container restarts
- Frontend toggle in agent settings panel
- No initialization required — works on first enable
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
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttheme-devexTheme: DevExtype-featureNew functionality
Activity
ferhimedamine commentedon Jun 17, 2026
Persistent memory for agents needs more than key-value storage — you need semantic recall, temporal awareness, importance weighting, and multi-agent isolation. We built a memory server that handles all of this: vector-indexed memories with BM25 hybrid search, knowledge graph for entity relationships, and configurable importance decay. The built-in embeddings mean no external model server dependency. If you're evaluating memory backends for Trinity: https://github.com/Dakera-AI/dakera-deploy/blob/main/docker/docker-compose.local.yml — single Docker command gets you a full memory API.
vybe commentedon Oct 30, 2026
Verdict (2026-10-29): no-go — superseded by the platform-side retrieval memory in #4102 (trinity-enterprise#1022).
Why not MemPalace specifically: it runs inside the agent container on ChromaDB, which the Dec-2025 base-image decision removed (+800 MB) and which carries the CVE-2026-45829 class; it is per-agent with no per-user isolation, so a multi-user agent would mix people's facts (the MEM-001 PII class); and it is Claude-Code-only via
.mcp.json, while Trinity is model-agnostic.What ships instead: facts captured at the backend's terminal seam for every runtime, scoped per person (the owner shares the agent's scope), stored in the platform DB, recalled by relevance inside the ent#419 envelope. Default off. The reusable gate for third-party memory stores — where the corpus rests, who holds the keys, what the index leaks, what happens if the vendor disappears — is answered by keeping the corpus in the instance's own database.