Summary
Comprehensive test suite for the memory system — unit tests for MemoryStore, integration tests for MemoryMixin lifecycle.
Spec: docs/spec/agent-memory-architecture.md → Implementation Order steps 4-5
Depends on: #542 (MemoryStore), #543 (MemoryMixin)
Unit Tests (tests/unit/test_memory_store.py)
MemoryStore Core
- Store and recall knowledge entries
- FTS5 search with AND/OR fallback
- Dedup: >80% word overlap in same category+context → updates
- Dedup: different contexts don't collide
- Confidence: +0.02 on recall, decay after 30 days
- Timestamps: ISO 8601 with timezone
Conversations
- Store and retrieve turns
- FTS5 search across conversations
- Time-based retrieval (get_recent_conversations)
- Context filtering
Tool History
- Log tool calls with timing
- Error filtering
- Per-tool stats (success rate, avg duration)
Temporal
- Store with due_at, retrieve via get_upcoming
- Overdue detection
- reminded_at lifecycle (remind → won't show → overdue resurfaces)
- Invalid date validation
Context / Sensitivity / Entity
- Context scoping filters correctly
- Sensitive items excluded from search by default
- Entity linking and get_by_entity
Dashboard Queries
- get_stats aggregation
- get_all_knowledge pagination and filtering
- get_tool_summary
- get_activity_timeline
Schema
- schema_version table created
- Migration path (future-proofing test)
- rebuild_fts recovery
Integration Tests (tests/integration/test_memory_mixin.py)
Lifecycle
- System prompt includes memory section
- System prompt cache invalidated per query
- Tool calls auto-logged to tool_history
- Memory tools excluded from tool_history
- Tool errors auto-stored as knowledge
- Conversation turns stored after process_query
- Heuristic extraction (preferences, facts)
Cross-Session
- Knowledge persists across agent restarts
- Conversation history persists
- Tool history persists
- Confidence decay on session start
Context
- System prompt filters by active context + global
- set_memory_context switches correctly
- Conversations tagged with active context
Acceptance Criteria
Summary
Comprehensive test suite for the memory system — unit tests for MemoryStore, integration tests for MemoryMixin lifecycle.
Spec:
docs/spec/agent-memory-architecture.md→ Implementation Order steps 4-5Depends on: #542 (MemoryStore), #543 (MemoryMixin)
Unit Tests (
tests/unit/test_memory_store.py)MemoryStore Core
Conversations
Tool History
Temporal
Context / Sensitivity / Entity
Dashboard Queries
Schema
Integration Tests (
tests/integration/test_memory_mixin.py)Lifecycle
Cross-Session
Context
Acceptance Criteria