4.1. Memory Lifecycle and Storage
The memory system operates on a tiered scope model: Principal (user-wide), Channel (platform-specific), and Session (current conversation) crates/palyra-daemon/src/application/memory.rs#11-16. All memory operations are mediated by theMemoryLifecycleProvider, which handles ingestion through a pipeline of classification, deduplication, and redaction crates/palyra-daemon/src/application/memory.rs#4-9.
Durable memory items are stored in the journal and exposed via the gRPC MemoryService crates/palyra-daemon/src/transport/grpc/services/memory/service.rs. The system enforces strict visibility: channel-scoped items are invisible without matching channel context, and all text is redacted before being returned to models to prevent credential leakage crates/palyra-daemon/src/application/memory.rs#107-138.
Key Components:
- MemoryLifecycleProvider: Manages the
retain/delete/replacelogic crates/palyra-daemon/src/application/memory.rs#41. - Write Classification: Categorizes incoming memories (e.g.,
manual,summary,import) and assigns sensitivity levels crates/palyra-daemon/src/application/memory.rs#72-91. - Redaction Pipeline: Uses
redact_memory_text_for_outputto sanitize content before model consumption crates/palyra-daemon/src/application/memory.rs#161-170.
4.2. Retrieval-Augmented Generation (RAG) and Recall
Retrieval is governed by theRecallPlan, which coordinates hybrid search across multiple indices. The InstructionCompiler integrates retrieved context into the model’s system prompt, ensuring the agent is aware of the trust posture of the provided data crates/palyra-daemon/src/application/instruction_compiler.rs#28-38.
Hybrid Search Architecture
Palyra combines lexical search (FTS5), vector embeddings, and recency scoring to rank results. Thepalyra.memory.search tool allows agents to query their own memory or indexed workspace documents crates/palyra-daemon/src/application/tool_registry/builtin.rs#105-139.
Memory Retrieval Mapping
Sources: crates/palyra-daemon/src/application/recall.rs, crates/palyra-daemon/src/application/instruction_compiler.rs#1-87, crates/palyra-daemon/src/application/tool_registry/builtin.rs#105-140
For details, see Retrieval-Augmented Generation (RAG) and Recall.
4.3. Post-Run Learning and Reflection Pipeline
The learning subsystem performs asynchronous reflection on completed runs to extract reusable knowledge. It generatesLearningCandidate objects, which can be durable facts, user preferences, or “patch skills” (suggested improvements to existing tools) crates/palyra-daemon/src/application/learning.rs.
Learning Ingestion Flow
TheLearning Curator audits these candidates, applying sampling heuristics to prioritize high-value insights. Candidates remain in a pending state until an operator approves them via the Web Console apps/web/src/console/sections/MemorySection.tsx#71-112.
Memory Learning Pipeline
Sources: crates/palyra-daemon/src/application/learning.rs, apps/web/src/console/sections/MemorySection.tsx#131-190, crates/palyra-daemon/src/application/memory.rs#1-9
For details, see Post-Run Learning and Reflection Pipeline.