Learning Pipeline Architecture
The learning process is decoupled from the main message loop to minimize latency. It follows a “Phase 6” lifecycle where successful runs trigger background reflection tasks.Data Flow & Component Interaction
The following diagram illustrates how a completed run is transformed into learned entities. Learning Lifecycle: From Transcript to Fact Sources: crates/palyra-daemon/src/application/learning.rs#41-123, crates/palyra-daemon/src/application/learning.rs#125-185, crates/palyra-daemon/src/background_queue.rs#11-26Learning Candidates & Confidence Thresholds
Palyra classifies learned information into three primary candidate types. Each type has configurable confidence thresholds measured in Basis Points (BPS), where 10,000 BPS equals 100% confidence.| Candidate Type | Description | Key Logic |
|---|---|---|
| DurableFact | Long-term factual information intended for Workspace Documents. | build_compaction_learning_candidates |
| Preference | User-specific stylistic or operational constraints. | build_preference_candidates |
| Procedure | Sequences of tool calls or steps that recur across sessions. | build_procedure_candidates |
Threshold Configuration
TheLearningRuntimeConfig struct defines the behavior of the autonomous agent:
durable_fact_review_min_confidence_bps: Minimum confidence required to even show a candidate to a human (Default: 7,500). crates/palyra-daemon/src/gateway/runtime.rs#159-159durable_fact_auto_write_threshold_bps: Threshold for bypassing human review and writing directly to the workspace (Default: 9,000). crates/palyra-daemon/src/gateway/runtime.rs#160-160procedure_min_occurrences: Procedures must be observed this many times before becoming candidates (Default: 2). crates/palyra-daemon/src/gateway/runtime.rs#162-162
Reflection Background Workload
Reflection is managed by thebackground_queue.rs subsystem. When an orchestrator run completes, schedule_post_run_reflection is called.
- Sampling: To manage costs, the system uses
sampling_percentto decide if a run should be reflected upon. crates/palyra-daemon/src/application/learning.rs#48-64 - Cooldown: A
cooldown_msprevents excessive background tasks for the same session. crates/palyra-daemon/src/application/learning.rs#82-88 - Task Creation: A task of kind
post_run_reflectionis inserted into theorchestrator_background_taskstable. crates/palyra-daemon/src/application/learning.rs#90-120 - Execution: The
poll_background_queueloop picks up the task and executesprocess_post_run_reflection_task, which uses the LLM to analyze the transcript and session compaction plan. crates/palyra-daemon/src/background_queue.rs#51-93
MemorySection UI Workflow
The Web Console provides a dedicated interface for managing the output of the learning pipeline. Memory UI to Daemon RPC MappingUI Features
- Learning Queue: Displays
LearningCandidateRecorditems filtered by status (queued, approved, rejected) and risk level. apps/web/src/console/sections/MemorySection.tsx#58-73 - Auto-Apply Stats: Visualizes
reflections_scheduledvscandidates_auto_appliedusing metrics cards. apps/web/src/console/sections/MemorySection.tsx#167-172 - Recall Preview: Allows operators to simulate how learned facts will be injected into future prompts via
previewMemoryRecall. apps/web/src/console/sections/MemorySection.tsx#89-89
Implementation Detail: Auto-Apply vs Manual Review
When a candidate is created, the daemon evaluates its confidence against the runtime configuration.min_confidence and auto_write thresholds, the record remains in a queued state, appearing in the MemorySection for human intervention.
Sources: crates/palyra-daemon/src/application/learning.rs#189-205, crates/palyra-daemon/src/gateway/runtime.rs#151-166