Lossless Claude
БесплатноНе проверенCross-runtime memory bridge between Claude Code and OpenClaw via the lossless-claw LCM SQLite database. MCP recall tools, PreCompact capture hook, SessionStart
Описание
Cross-runtime memory bridge between Claude Code and OpenClaw via the lossless-claw LCM SQLite database. MCP recall tools, PreCompact capture hook, SessionStart bootstrap, lcm-recall skill.
README
License: Apache 2.0 Version Node TypeScript MCP Status: alpha
Bridges lossless-claw (LCM) into Claude Code as a cross-runtime memory layer. Sits beside Claude Code's harness and shares the OpenClaw lossless-claw SQLite database, so Claude Code sessions can read from and contribute to the same hierarchical memory store that Daphne and other OpenClaw agents use.
What this is and is not
This is: a read-mostly memory bridge that exposes LCM recall tools to Claude Code via MCP, captures Claude Code sessions on PreCompact, and bootstraps relevant context on SessionStart.
This is not: a replacement for Claude Code's built-in context management. Claude Code's harness still owns the active context window and decides when to compact. lossless-claude lives outside that loop, providing recall and persistence around it.
Architecture
┌─────────────────────────────────────────────────────────┐
│ Claude Code Session │
│ │
│ [SessionStart hook] ──── reads ──→ ┌────────────┐ │
│ │ │ │
│ [Active context] │ LCM │ │
│ (managed by harness — opaque) │ SQLite │ │
│ │ │ │
│ [PreCompact hook] ──── writes ──→ │ ~/.opencl │ │
│ │ aw/lcm.db │ │
│ [MCP tools] ───── queries ─────→ │ │ │
│ lcm_grep, lcm_describe, lcm_stats └────────────┘ │
└─────────────────────────────────────────────────────────┘
↑ ↑
│ │
shared with the OpenClaw runtime (Daphne, JelleeBean, etc.)
Components
| Component | Type | Purpose |
|---|---|---|
lcm_grep |
MCP tool | FTS5/LIKE search across messages and summaries |
lcm_describe |
MCP tool | Look up message or summary by ID with DAG lineage |
lcm_stats |
MCP tool | Database health snapshot, prefix breakdown |
lcm_expand_query |
MCP tool (stub) | v2 — full LLM-driven recursive expansion |
pre-compact.sh |
Hook (PreCompact) | Captures session messages into LCM before compaction |
session-start.sh |
Hook (SessionStart) | Injects recent CC + Daphne activity as bootstrap context |
lcm-recall |
Skill | Teaches Claude when and how to use the recall tools |
Prerequisites
- Node 22+ — required for the MCP server (uses
better-sqlite3) - Python 3 — required for the hook scripts (uses
sqlite3from stdlib) ~/.openclaw/lcm.db— must exist. Run lossless-claw at least once via OpenClaw to create it. Override withLCM_DB_PATHenv var if you want a separate database for Claude Code.
Install
# 1. Clone
git clone https://github.com/offendingcommit/lossless-claude ~/lossless-claude
cd ~/lossless-claude
# 2. Build the MCP server
cd mcp-server
pnpm install # or npm install
pnpm build # or npm run build
cd ..
# 3. Add to Claude Code as a plugin
# (User-level — applies to all Claude Code sessions)
mkdir -p ~/.claude/plugins
ln -s ~/lossless-claude ~/.claude/plugins/lossless-claude
After symlinking, restart Claude Code. The MCP server, hooks, and skill load automatically.
Verify the install
In Claude Code:
/mcp # should list "lossless-claude" as connected
Then test the tools:
Use lcm_stats to show me the database snapshot.
Configuration
| Env var | Default | Purpose |
|---|---|---|
LCM_DB_PATH |
~/.openclaw/lcm.db |
Path to the lossless-claw SQLite database |
LOSSLESS_CLAUDE_LOG |
~/.openclaw/logs/lossless-claude.log |
PreCompact hook log file |
LOSSLESS_CLAUDE_WATERMARK_FILE |
~/.openclaw/lossless-claude-watermarks.json |
PreCompact hook watermark store. Tracks per-session-key insert counts so overlapping PreCompact firings never insert the same message twice. |
LOSSLESS_CLAUDE_BOOTSTRAP_TURNS |
12 |
Max turns to inject in SessionStart bootstrap |
LOSSLESS_CLAUDE_BOOTSTRAP_INCLUDE_AGENTS |
0 |
When set to 1, include cross-runtime activity from OpenClaw agents (agent:main:* session keys) in the SessionStart bootstrap. OFF by default because that data can include Discord DMs and other sensitive material that should not silently leak into a new session's system prompt. |
Session keying
Claude Code sessions are written to LCM with session_key = cc:<basename(cwd)>:<git-branch>. This namespaces them under cc: so they're easy to filter via lcm_grep(session_key_prefix: "cc:") and they don't collide with the agent:* keys that OpenClaw uses.
Example session keys you'll see in the database:
| Session key | Source |
|---|---|
cc:lossless-claude:main |
This repo, working on the main branch in Claude Code |
cc:offendingcommit-site:feature/auth |
Some other repo on a feature branch |
agent:main:discord:dm:123 |
Daphne in OpenClaw, in a Discord DM |
agent:jellybean:discord:dm:456 |
JelleeBean in OpenClaw |
Why this design
- Claude Code's harness owns the context window. Replacing its compaction is not a supported extension point. lossless-claude works beside the harness, not inside it.
- Direct SQL instead of importing lossless-claw internals. The lossless-claw schema is migration-versioned and stable. Importing
LcmContextEnginewould couple us to OpenClaw runtime symbols. Talking to SQLite directly viabetter-sqlite3keeps the bridge thin and decouples upgrade cycles. - Read-mostly. The MCP server is strictly read-only (
PRAGMA query_only = ON). Only the PreCompact hook writes, and only to its owncc:namespace, so we never trample OpenClaw's data. - Cross-runtime recall is the killer feature. Daphne writes to LCM via OpenClaw at 7 AM; you open Claude Code at 2 PM and it can recall what was discussed — no copy/paste, no manual export.
Roadmap
- v0.1 (current) —
lcm_grep,lcm_describe,lcm_stats, PreCompact + SessionStart hooks,lcm-recallskill - v0.2 —
lcm_expand_querywith LLM-driven recursive DAG walk - v0.3 — periodic compaction job that runs lossless-claw's summarizer over
cc:*conversations - v0.4 —
/lossless-claudeslash command for ad-hoc DB inspection from inside Claude Code
License
Apache-2.0
Установка Lossless Claude
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/offendingcommit/lossless-claudeFAQ
Lossless Claude MCP бесплатный?
Да, Lossless Claude MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Lossless Claude?
Нет, Lossless Claude работает без API-ключей и переменных окружения.
Lossless Claude — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Lossless Claude в Claude Desktop, Claude Code или Cursor?
Открой Lossless Claude на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
автор: wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
автор: madhurprashPostgres
Query your database in natural language
автор: AnthropicPostgreSQL
Read-only database access with schema inspection.
автор: modelcontextprotocolCompare Lossless Claude with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории data
