Files
DeepTutor/deeptutor/services/memory/__init__.py
Bingxi Zhao (Frank) 2b7242081f feat(memory): three-layer memory subsystem (L1/L2/L3) with workbench
Replaces the flat single-blob memory page with a structured store:
- L1 captures raw run traces; L2 holds normalized document records;
  L3 holds curated slots per surface (chat, notebook, book, TutorBot).
- New consolidator pipeline (chunker, guards, parse, references, runs,
  modes, line-doc, meta) turns traces into versioned line-oriented
  documents with stable ids and snapshot history.
- Per-user isolation flows through PathService; the store API is
  stateless.

UI ships a dedicated /memory workbench with graph / L1 / L2 / L3 /
resolve subpages, plus a reusable MemorySection embedded where the
legacy panel lived.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:02:32 +08:00

35 lines
1.1 KiB
Python

"""Three-layer memory subsystem.
- ``trace`` : L1 raw event capture (append-only JSONL per surface per day)
- ``document``: L2/L3 markdown + footnote-citation parser/serializer (pure)
- ``ops`` : add/edit/delete batch applier (pure)
- ``paths`` : per-user path resolution
- ``ids`` : ULID-style trace and entry id generators
- ``store`` : public facade — :class:`MemoryStore`
- ``consolidator``: LLM-driven L1→L2 and L2→L3 ops
The v1 two-file `MemoryService` is gone. All callers go through
:func:`get_memory_store` and the :class:`MemoryStore` facade.
"""
from .ids import is_entry_id, is_trace_id, new_entry_id, new_trace_id
from .paths import L3_SLOTS, SURFACES, L3Slot, Surface
from .store import DocOverview, MemoryStore, get_memory_store, migrate_v1_if_needed
from .trace import TraceEvent
__all__ = [
"DocOverview",
"L3_SLOTS",
"L3Slot",
"MemoryStore",
"SURFACES",
"Surface",
"TraceEvent",
"get_memory_store",
"is_entry_id",
"is_trace_id",
"migrate_v1_if_needed",
"new_entry_id",
"new_trace_id",
]