Skip to content

API Reference parrot.memory.unified.models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.memory.unified.models

View source

Unified Memory data models for the long-term memory layer.

Provides:

  • MemoryContext: assembled context from all memory subsystems
  • MemoryConfig: configuration for UnifiedMemoryManager

Class MemoryCandidate

Scoped supplementary content with relevance separate from ranking.

A candidate is a retrieval result, not an outcome or review record. In particular, user knowledge is intentionally represented without a dynamics grade so experiential forgetting cannot be applied to facts.

Fields:

Field Type Default Description
scope MemoryRequestScope
memory_id str
content_version str
source str
text str
relevance float 0.0
similarity float | None None
ranking_score float | None None
provenance str 'retrieved'
candidate_type Literal['episodic', 'user', 'brain', 'skill'] 'episodic'
dynamics_state_ref str | None None
importance int | None None
memory_ref MemoryRef | None None
lane Literal['warning', 'recall'] 'warning'

Class MemoryConfig

Configuration for UnifiedMemoryManager.

Controls which subsystems are enabled, token budget allocation, and per-subsystem limits.

Fields:

Field Type Default Description
enable_episodic bool True Enable episodic memory retrieval and recording
enable_skills bool True Enable skill registry retrieval
enable_conversation bool True Enable conversation history retrieval
enable_user_memory bool False Enable independent scoped user-knowledge retrieval
enable_brain bool False Enable brain-wiki (dream cycle) retrieval — FEAT-390
max_context_tokens int 2000 Maximum total tokens for assembled context
episodic_max_warnings int 3 Maximum number of episodic warnings to retrieve
episodic_max_recall int 3
user_max_records int 20
user_context_tokens int | None None
user_priority Literal['high', 'normal'] 'normal'
skill_max_context int 3 Maximum number of skills to include in context
episodic_weight float 0.3 Fraction of token budget for episodic warnings
skill_weight float 0.3 Fraction of token budget for relevant skills
conversation_weight float 0.4 Fraction of token budget for conversation history
brain_weight float 0.2 Fraction of token budget for brain-wiki knowledge (FEAT-390)
user_weight float 0.2 Relative token weight for scoped user knowledge
skill_auto_extract bool False Automatically extract skills from successful interactions (expensive)

Attributes:

Attribute Type Description
normalized_section_weights dict[str, float] Return weights normalized across enabled context capabilities only. Legacy callers continue to validate and use the original three weights. The structured agent path can enable user knowledge (or brain) without allocating budget to disabled sections or injecting conversation a second time.

Class MemoryContext

Assembled context from all memory subsystems.

Holds the text sections retrieved from episodic memory, skill registry, and conversation history, along with token accounting for budget enforcement.

Fields:

Field Type Default Description
episodic_warnings str '' Past failure lessons from episodic memory
relevant_skills str '' Applicable skills from the skill registry
conversation_summary str '' Recent conversation turns
semantic_knowledge str '' Distilled long-term knowledge from the agent's brain wiki (FEAT-390)
episodic_recall str '' Relevant non-failure episodes from earlier sessions
user_knowledge str '' Scoped user knowledge supplied as contextual data, never instructions
tokens_used int 0 Total tokens consumed by assembled context
tokens_budget int 2000 Maximum token budget for context
delivered_refs tuple[str, ...] ( Ordered memory references whose content was actually delivered
memory_refs tuple[MemoryRef, ...] ( Original episode identities carried with fully packed candidate content
packed_digest str | None None Digest of the packed supplementary memory block
exposure_id str | None None Runtime exposure identity for the delivered memory block
exposure_metadata dict[str, str] Bounded metadata associated with the delivered exposure

Method MemoryContext.to_prompt_string

Format as injectable system prompt sections.

Only non-empty sections are included. Each section is wrapped in descriptive XML tags so the LLM can distinguish memory types.

to_prompt_string() -> str

Returns: str — Formatted string ready for injection into a system prompt.

Alias MemoryRef

Re-exported from parrot.memory.dynamics.models.MemoryRef.

Alias MemoryRequestScope

Re-exported from parrot.memory.agent_memory.models.MemoryRequestScope.

Alias visible_to_scope

Re-exported from parrot.memory.episodic.visibility.visible_to_scope.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally