Files
syndarix/backend/app/services/memory/integration/__init__.py
Felipe Cardoso 30e5c68304 feat(memory): integrate memory system with context engine (#97)
## Changes

### New Context Type
- Add MEMORY to ContextType enum for agent memory context
- Create MemoryContext class with subtypes (working, episodic, semantic, procedural)
- Factory methods: from_working_memory, from_episodic_memory, from_semantic_memory, from_procedural_memory

### Memory Context Source
- MemoryContextSource service fetches relevant memories for context assembly
- Configurable fetch limits per memory type
- Parallel fetching from all memory types

### Agent Lifecycle Hooks
- AgentLifecycleManager handles spawn, pause, resume, terminate events
- spawn: Initialize working memory with optional initial state
- pause: Create checkpoint of working memory
- resume: Restore from checkpoint
- terminate: Consolidate working memory to episodic memory
- LifecycleHooks for custom extension points

### Context Engine Integration
- Add memory_query parameter to assemble_context()
- Add session_id and agent_type_id for memory scoping
- Memory budget allocation (15% by default)
- set_memory_source() for runtime configuration

### Tests
- 48 new tests for MemoryContext, MemoryContextSource, and lifecycle hooks
- All 108 memory-related tests passing
- mypy and ruff checks passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 03:49:22 +01:00

20 lines
581 B
Python

# app/services/memory/integration/__init__.py
"""
Memory Integration Module.
Provides integration between the agent memory system and other Syndarix components:
- Context Engine: Memory as context source
- Agent Lifecycle: Spawn, pause, resume, terminate hooks
"""
from .context_source import MemoryContextSource, get_memory_context_source
from .lifecycle import AgentLifecycleManager, LifecycleHooks, get_lifecycle_manager
__all__ = [
"AgentLifecycleManager",
"LifecycleHooks",
"MemoryContextSource",
"get_lifecycle_manager",
"get_memory_context_source",
]