>cogtrix v0.3.0

Memory

Public surface for Cogtrix’s hybrid memory subsystem — rolling summary, semantic recall, and three working modes.

src.memory.base

Abstract base classes that define the memory contract. Extend these to plug in a custom memory backend (e.g. a Redis-backed store).

Key types:

  • MemoryStore — abstract interface for read/write/clear of session history.
  • MemoryEntry — the canonical message record (role, content, timestamp, tool calls).

Source ↗

src.memory.manager

Coordinates the three memory layers — working window, rolling summary, semantic recall — and exposes a single API to the agent.

Key callables:

  • MemoryManager.add(message) — append a turn.
  • MemoryManager.recall(query, k=...) — semantic recall.
  • MemoryManager.compact() — summarise old turns in place.
  • MemoryManager.snapshot() — serialise to disk.

Source ↗

src.memory.factory

Constructs the right MemoryManager for a given mode. The factory inspects the config’s memory.mode field and assembles the matching pipeline.

Source ↗

src.memory.facts

Mode-specific fact tracking — files touched (code mode), goals (reasoning mode), entities (conversation mode). Stored alongside the message log but queryable separately.

Source ↗

src.memory.recall

The semantic-recall layer. Embeds turn content into the vector DB at write time, queries by similarity at recall time. Embedding provider is configurable.

Source ↗