Skip to main content
neutral

Phase 4: Memory Architecture

Status: Completed (2026-02-09)

Goal: Structured memory that survives workflow boundaries and scales.

Scope:

  • Memory taxonomy (working, episodic, semantic, procedural)
  • Memory store interface and implementations
  • Automatic memory management policies
  • Cross-run persistence

Tasks and subtasks:

  1. Memory interfaces
    • Define memory types and access patterns
    • Implement MemoryStore interfaces
  2. Implementations
    • Postgres store
    • Redis store (episodic)
    • Vector store option (pgvector, Pinecone, etc.)
    • In-memory store for tests
    • Memory read/write tools
  3. Policies
    • Working memory limits
    • Episodic summarization
    • Fact extraction and semantic persistence
    • Conversation window management
  4. Cross-run persistence
    • Memory references in AgentRunInput
    • Load/merge logic across runs
  5. Tests
    • Memory store integration tests
    • Policy enforcement tests
    • Memory read/write tooling validation

Deliverables:

  • Memory interfaces and implementations
  • Policy engine
  • Cross-run persistence
  • Tests

Dev environment checks:

  • Create and query episodic memory across continue-as-new
  • Validate semantic search returns relevant facts

Dependencies:

  • Phase 2 completion

Files to add/change:

  • internal/memory/types.go
  • internal/memory/store.go
  • internal/memory/policy.go
  • internal/memory/embedding.go
  • internal/memory/postgres_store.go
  • internal/memory/redis_store.go
  • internal/memory/inmemory_store.go
  • internal/memory/memory_test.go
  • internal/agent/activities.go
  • internal/agent/workflow.go
  • internal/agent/state.go
  • internal/agent/types.go
  • cmd/worker/main.go
  • cmd/run/main.go
  • cmd/replay/main.go
  • cmd/memory-query/main.go
  • internal/tools/memory_read.go
  • internal/tools/memory_write.go
  • migrations/0002_memory.up.sql
  • migrations/0002_memory.down.sql
  • migrations/0003_memory_metadata.up.sql
  • migrations/0003_memory_metadata.down.sql
  • .env.example