forked from cardosofelipe/fast-next-template
Add reflection layer for memory system with pattern detection, success/failure factor analysis, anomaly detection, and insights generation. Enables agents to learn from past experiences and identify optimization opportunities. Key components: - Pattern detection: recurring success/failure, action sequences, temporal, efficiency - Factor analysis: action, context, timing, resource, preceding state factors - Anomaly detection: unusual duration, token usage, failure rates, action patterns - Insight generation: optimization, warning, learning, recommendation, trend insights Also fixes pre-existing timezone issues in test_types.py (datetime.now() -> datetime.now(UTC)). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
39 lines
647 B
Python
39 lines
647 B
Python
# app/services/memory/reflection/__init__.py
|
|
"""
|
|
Memory Reflection Layer.
|
|
|
|
Analyzes patterns in agent experiences to generate actionable insights.
|
|
"""
|
|
|
|
from .service import (
|
|
MemoryReflection,
|
|
ReflectionConfig,
|
|
get_memory_reflection,
|
|
)
|
|
from .types import (
|
|
Anomaly,
|
|
AnomalyType,
|
|
Factor,
|
|
FactorType,
|
|
Insight,
|
|
InsightType,
|
|
Pattern,
|
|
PatternType,
|
|
TimeRange,
|
|
)
|
|
|
|
__all__ = [
|
|
"Anomaly",
|
|
"AnomalyType",
|
|
"Factor",
|
|
"FactorType",
|
|
"Insight",
|
|
"InsightType",
|
|
"MemoryReflection",
|
|
"Pattern",
|
|
"PatternType",
|
|
"ReflectionConfig",
|
|
"TimeRange",
|
|
"get_memory_reflection",
|
|
]
|