HC

haustorium12/continuity-v2

Database management

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

36 stars 8 forks Качество 68 Тренд 16MIT

Long-term memory for Claude Code. Indexes every session as SQLite+FTS5, exposes recall via MCP, and ships PreCompact/PostCompact hooks so nothing is ever lost.

Обзор

Long-term memory layer for Claude Code, built on the JSONL session record. continuity (v1) protected against compaction within a single session — PreCompact hook saves a checkpoint, SessionStart hook injects it back, SSE proxy rings bells at 70/85/95% token pressure. Every Claude Code session is already written to disk as a JSONL — every turn, every tool call, every response. Plain text. Append-only. Free. That file is an episodic memory store hiding in plain sight. v2 is the index, search, and retrieval layer on top of it. Walk ~/.claude/projects/, extract every turn into SQLite with FTS5: Literal full-text search across every conversation ever had with Claude Code. Filterable by project, reverse-chronological. Wire it into the existing claude-memory MCP (port 8200) or stand alone.

README

Показан фрагмент оригинального README. Открыть оригинал.

continuity v2

Long-term memory layer for Claude Code, built on the JSONL session record.

What this is

continuity (v1) protected against compaction within a single session — PreCompact hook saves a checkpoint, SessionStart hook injects it back, SSE proxy rings bells at 70/85/95% token pressure.

continuity v2 solves the other half: across-session recall.

Every Claude Code session is already written to disk as a JSONL — every turn, every tool call, every response. Plain text. Append-only. Free.

That file is an episodic memory store hiding in plain sight. v2 is the index, search, and retrieval layer on top of it.

Architecture

~/.claude/projects//.jsonl   (raw episodic record, already there)
                       ↓
                   v2 indexer
                       ↓
              SQLite + FTS5 + (later) embeddings
                       ↓
                  MCP tool surface
                       ↓
        Claude calls search_sessions(query) mid-conversation

Build stages

Stage 1 — Index (MVP)

Walk ~/.claude/projects/, extract every turn into SQLite with FTS5:

sessions(id, project, started_at, ended_at, turn_count)
turns(session_id, turn_idx, ts, role, text)
turns_fts (FTS5 mirror of turns.text)

Literal full-text search across every conversation ever had with Claude Code. Filterable by project, reverse-chronological.

Stage 2 — MCP tool

Wire it into the existing claude-memory MCP (port 8200) or stand alone.

  • search_sessions(query, limit=10) — FTS5 search, returns matching turns + session ID + surrounding context
  • recall_session(session_id, range="full") — return full or sliced session
  • recent_sessions(n=10) — list recent sessions with first/last user message

Stage 3 — Semantic recall

Sentence embeddings + SIMILAR_TO edges. Hybrid search: literal + semantic.

For when the words don’t match but the concept does (“when did we talk about the thread-home problem” should match conversations about “Hal”, “50 First Dates”, “Alice in Wonderland”).

find_similar(query, limit=10) — find semantically similar turns via ANN search over all-MiniLM-L6-v2 embeddings, re-ranked by a hybrid score:

score = 0.7 * semantic_similarity
      + 0.2 * recency_decay       # linear, full decay at 365 days
      + 0.1 * complexity_bonus    # session turn count, normalized to 50 turns

Build: python embed.py (idempotent — skips turns already embedded), then python wire_similar.py to wire SIMILAR_TO edges between turn pairs with cosine ≥ 0.85.

Stage 4 — Auto-tagging (later)

  • Project mentions (saranna, dream-module, gold-402, etc.)
  • Decision markers (DECIDED, SAVE, session-close triggers)
  • File paths touched

Why this matters

Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

"mcpServers": { "continuity-v2": { "type": "stdio", "command": "python", "args": ["/path/to/continuity-v2/mcp_server.py"], "env": { "PYTHONIOENCODING": "utf-8" } } }