[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80938":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":20,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":15,"starSnapshotCount":15,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},80938,"continuity-v2","Haustorium12\u002Fcontinuity-v2","Haustorium12","Long-term memory for Claude Code. Indexes every session as SQLite+FTS5, exposes recall via MCP, and ships PreCompact\u002FPostCompact hooks so nothing is ever lost.","",null,"Python",32,7,1,0,2.71,"MIT License",false,"main",[21,22,23,24,25,26,27,28],"claude","claude-code","compaction","developer-tools","hooks","mcp","memory","sqlite","2026-06-12 02:04:08","\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fbanner.png\" alt=\"continuity v2\" width=\"100%\">\n\u003C\u002Fp>\n\n# continuity v2\n\nLong-term memory layer for Claude Code, built on the JSONL session record.\n\n## What this is\n\n`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\u002F85\u002F95% token pressure.\n\n`continuity v2` solves the other half: **across-session recall.**\n\nEvery Claude Code session is already written to disk as a JSONL — every turn, every tool call, every response. Plain text. Append-only. Free.\n\nThat file is an episodic memory store hiding in plain sight. v2 is the index, search, and retrieval layer on top of it.\n\n## Architecture\n\n```\n~\u002F.claude\u002Fprojects\u002F\u003Cproject-id>\u002F\u003Csession-id>.jsonl   (raw episodic record, already there)\n                       ↓\n                   v2 indexer\n                       ↓\n              SQLite + FTS5 + (later) embeddings\n                       ↓\n                  MCP tool surface\n                       ↓\n        Claude calls search_sessions(query) mid-conversation\n```\n\n## Build stages\n\n### Stage 1 — Index (MVP)\n\nWalk `~\u002F.claude\u002Fprojects\u002F`, extract every turn into SQLite with FTS5:\n\n```\nsessions(id, project, started_at, ended_at, turn_count)\nturns(session_id, turn_idx, ts, role, text)\nturns_fts (FTS5 mirror of turns.text)\n```\n\nLiteral full-text search across every conversation ever had with Claude Code. Filterable by project, reverse-chronological.\n\n### Stage 2 — MCP tool\n\nWire it into the existing `claude-memory` MCP (port 8200) or stand alone.\n\n- `search_sessions(query, limit=10)` — FTS5 search, returns matching turns + session ID + surrounding context\n- `recall_session(session_id, range=\"full\")` — return full or sliced session\n- `recent_sessions(n=10)` — list recent sessions with first\u002Flast user message\n\n### Stage 3 — Semantic recall\n\nSentence embeddings + SIMILAR_TO edges. Hybrid search: literal + semantic.\n\nFor 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\").\n\n`find_similar(query, limit=10)` — find semantically similar turns via ANN search over\n`all-MiniLM-L6-v2` embeddings, re-ranked by a hybrid score:\n\n```\nscore = 0.7 * semantic_similarity\n      + 0.2 * recency_decay       # linear, full decay at 365 days\n      + 0.1 * complexity_bonus    # session turn count, normalized to 50 turns\n```\n\nBuild: `python embed.py` (idempotent — skips turns already embedded), then\n`python wire_similar.py` to wire `SIMILAR_TO` edges between turn pairs with cosine ≥ 0.85.\n\n### Stage 4 — Auto-tagging (later)\n\n- Project mentions (saranna, dream-module, gold-402, etc.)\n- Decision markers (`DECIDED`, `SAVE`, session-close triggers)\n- File paths touched\n\n## Why this matters\n\nCompaction stops being context loss and becomes a cache miss. The 3-hour conversation isn't gone — it's a `search_sessions()` call away.\n\nThe \"I told you this two weeks ago\" problem disappears. The episodic record was always there. Nothing was ever lost. Nobody had wired it into recall yet.\n\n## Status\n\n**Stages 1, 2, 3, and 3A complete.** Sessions grow with every conversation; DB starts around 50 MB.\n\nTwo sources in one DB:\n- **Claude Code sessions** -- JSONL files under `~\u002F.claude\u002Fprojects\u002F`\n- **claude.ai chat conversations** -- Anthropic data export (`conversations.json`)\n\n```\npython index.py                              # index Claude Code sessions (incremental)\npython chat_index.py \u003Cpath\u002Fconversations.json>  # index claude.ai chat export (incremental)\npython embed.py                              # build\u002Fupdate sentence embeddings (idempotent)\npython wire_edges.py                         # wire TEMPORAL edges between turns\npython wire_similar.py                       # wire SIMILAR_TO edges from embeddings (run after embed.py)\npython stats.py                              # health + recent sessions\npython search.py \"\u003Cquery>\"                   # FTS5 search across all sessions\npython recall.py \u003Cid>                        # full or sliced session by id\n\n# FTS5 quoting note: hyphenated\u002Fnumeric tokens MUST be double-quoted\n#   python search.py '\"memory-v4\" wave propagation' --project C--dev\n#   python search.py '\"gold-402\" distribution'\n```\n\nDB lives at `data\u002Fcontinuity.db` (gitignored).\n\nTo get your claude.ai chat export: claude.ai -> Settings -> Export data.\n\n### Stage 2 -- MCP server\n\n`mcp_server.py` exposes the index as a stdio MCP server. Add to `~\u002F.claude.json`\n(the primary MCP config for Claude Code — **not** `~\u002F.claude\u002Fsettings.json`):\n\n```json\n\"mcpServers\": {\n  \"continuity-v2\": {\n    \"type\": \"stdio\",\n    \"command\": \"python\",\n    \"args\": [\"\u002Fpath\u002Fto\u002Fcontinuity-v2\u002Fmcp_server.py\"],\n    \"env\": { \"PYTHONIOENCODING\": \"utf-8\" }\n  }\n}\n```\n\nTools exposed:\n\n- `search_sessions(query, limit=10, project=None, source=None)` -- FTS5 search with snippets\n- `find_similar(query, limit=10)` -- semantic search, hybrid-scored (0.7 sem + 0.2 recency + 0.1 complexity)\n- `thread_recall(query, ...)` -- BFS over TEMPORAL edges; returns narrative thread not just rows\n- `recall_session(session_id, idx_from=None, idx_to=None)` -- full or sliced replay\n- `recent_sessions(n=10, project=None, source=None)` -- list recent sessions\n- `index_stats()` -- DB health, session\u002Fturn counts, embedding coverage, edge counts\n- `reindex()` -- re-index new sessions without restarting the server\n\nThe `source` param accepts `\"code\"` (Claude Code only) or `\"chat\"` (claude.ai only). Omit for both.\n\nRestart Claude Code to load the server.\n\n\n## Hooks: installation\n\nCopy the four scripts from `hooks\u002F` to `~\u002F.claude\u002Fhooks\u002F`:\n\n```\ncp hooks\u002Fprecompact_save.py        ~\u002F.claude\u002Fhooks\u002F\ncp hooks\u002Fsession_start_inject.py   ~\u002F.claude\u002Fhooks\u002F\ncp hooks\u002Fstop_hook_checkpoint.py   ~\u002F.claude\u002Fhooks\u002F\ncp hooks\u002Fsse_proxy.py              ~\u002F.claude\u002Fhooks\u002F\n```\n\nAll paths use `Path.home()` and resolve correctly on any platform. The one\nconstant you may want to change is `PROJECT_STATE` in `session_start_inject.py`\n— set it to your project's sticky-note file if it lives somewhere other than\n`~\u002F.claude\u002Fmemory\u002Fproject_current_state.md`, or `None` to disable resume injection.\n\n\n## License\n\nMIT — same as continuity v1.\n","continuity v2 是一个为 Claude Code 设计的长期记忆层，通过将每次会话记录为 JSONL 文件，并基于 SQLite+FTS5 构建索引，实现了跨会话的信息检索。项目使用 Python 编写，其核心功能包括对所有对话进行全文索引和搜索、支持通过 MCP 接口调用搜索功能，以及提供了预压缩和后压缩钩子确保数据不会丢失。此外，未来版本还将引入语义相似度搜索，以提高信息召回的准确性。此工具非常适合需要持久化保存和高效检索大量对话记录的开发场景，例如在持续性技术支持或复杂问题解决过程中提供历史上下文辅助。",2,"2026-06-11 04:02:55","CREATED_QUERY"]