Skip to content

Memory unit and integration tests #579

@kovtcharov

Description

@kovtcharov

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

  • All unit tests pass
  • All integration tests pass
  • No external dependencies (sqlite3 in-memory for tests)
  • Tests run in CI (no hardware requirements)

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:agent-coreFramework, tools, registry, memory, skills, orchestrationtrack:consumer-appHermes-competitor consumer product — mobile-first, voice + messaging + memory + skills

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions