
Lethe
io.github.JesusGarcia9009由 GitHub 账号 JesusGarcia9009 发布v0.6.2更新于 Oct 24, 2026
Context GC for LLM agents: offload large tool outputs and recall them to save tokens.
概览
Lethe 是一个本地 MCP 服务器,让助手把大型工具输出归档到 SQLite 存储并按需召回,从而降低长任务中的 token 消耗。
- 可以做什么
- 归档大型工具输出和文件,上下文中只保留简短句柄而非全文(lethe_archive)。按句柄或关键词无损召回已归档内容(lethe_recall)。查看已归档块数量以及移出上下文的 token 数(lethe_status)。
- 适用场景
- 适合长时间运行的智能体会话:过期的工具输出、庞大的 JSON 转储或许多步之前读取的文件会占满上下文窗口并推高成本。也适合希望保持工作上下文精简、同时仍能按需取回被埋没细节的用户。
- 运行要求
- 作为本地 Python 进程运行,从 lethe-llm-context 包(含 mcp 附加项)安装,以 lethe-mcp 通过 stdio 启动。环境变量 LETHE_DB 指定 SQLite 归档路径(默认 ./lethe.db)。未声明身份验证;可选的 Claude 演示需要 ANTHROPIC_API_KEY。
安装
在 SourceWeft 中
- 打开 控制台中的 Lethe,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
LETHE
Live Ephemeral Token & History Engine — offload big tool outputs out of your LLM agent's context and recall them on demand, so long tasks cost fewer tokens.
[PyPI] [Python] [MCP Registry] [License: Unlicense]
[LETHE archives big tool outputs and recalls them on demand to save tokens]
🔌 Use it in Claude Code or Codex (save tokens now)
LETHE ships as an MCP server. Two lines and your agent can move big outputs out of its context and recall them on demand — fewer tokens on every long task. / LETHE viene como servidor MCP. Dos líneas y tu agente saca outputs grandes del contexto y los recupera cuando los necesita — menos tokens en cada tarea larga.
Claude Code:
Codex: add an MCP block to ~/.codex/config.toml — see
integrations/codex/mcp-config.md.
Then drop in the guiding skill so the agent archives on its own:
integrations/claude-code/SKILL.md.
Tools exposed: lethe_archive · lethe_recall · lethe_status.
Full guide: integrations/claude-code/mcp-config.md.
▶️ See it work (no API key) / Míralo funcionar (sin API key)
This runs the same logic the MCP tools use — lethe_archive / lethe_recall / lethe_status.
English
What LETHE is (today, honestly)
When an LLM agent runs a long task (tens to hundreds of steps), its context window fills with material that was useful but no longer is: stale tool outputs, files read 30 steps ago, big JSON dumps. That means more tokens per turn, higher cost, and eventually the context ceiling.
LETHE gives the agent an external, lossless scratch store so that heavy content lives outside the context window and only a tiny handle stays inside. Two ways to use it:
1. As an MCP server (the install path above). The agent calls lethe_archive(content) on a
big output and keeps only the returned 4–8-char handle; later it calls lethe_recall(handle) or
lethe_recall("keywords") to bring the full text back. Nothing is ever deleted — recall is
lossless. The guiding skill tells the agent when to do
this, so it happens near-automatically. This is provider-agnostic: it works in any MCP host
(Claude Code, Codex).
2. As a Python library (in-loop context GC). ContextManager runs an automatic pass inside
your agent loop: a heuristic Curator scores each block (recency, whether later blocks cite
it, block kind, plus an optional cheap-model relevance call) and an Archivist pages the
coldest blocks out to a store — losslessly, leaving stubs — to hold the working set under a token
budget. Referenced handles are paged back in on demand.
Be clear about the mechanism. An MCP server cannot silently rewrite the host's context window. LETHE works by giving the agent explicit offload/recall tools plus a skill that makes using them near-automatic — not by magic. That honesty is the point.
✅ What works today vs. 🗺️ what's on the roadmap
The multi-provider, ensemble, and semantic-retrieval design below is the long-term vision, not what's implemented. Here is the honest split:
Each milestone ships as a tagged release — full notes in CHANGELOG.md.
The mental model (OS analogy)
LETHE is designed like an operating system managing virtual memory. This analogy guides the architecture; the ✅/🟡 above says how much of it runs automatically today.
How LETHE differs from agent-memory libraries
Mem0, Zep, Letta and friends persist facts across sessions. LETHE targets the opposite: managing the live, in-session working context of a running loop — deciding what to keep in the window right now. It's complementary to a long-term memory product, not a competitor. Whether that difference is decisive is something the roadmap above still has to prove.
Quickstart (no API key needed)
Real Claude demo
Design docs
docs/specs/2026-06-12-lethe-vertical-slice-design.md— approved design of the built slicedocs/LETHE_engineering_design.md— the full long-term engineering vision (multi-provider, ensemble, embeddings). Read it as the roadmap, not the current state.
License
Released into the public domain under the Unlicense. Free for everyone, anywhere.
Español
Qué es LETHE (hoy, con honestidad)
Cuando un agente LLM ejecuta una tarea larga (decenas o cientos de pasos), su ventana de contexto se llena de material que fue útil pero ya no lo es: resultados de herramientas obsoletos, archivos leídos hace 30 pasos, dumps de JSON enormes. Eso significa más tokens por turno, más costo y, al final, el techo de contexto.
LETHE le da al agente un almacén externo y sin pérdida para que el contenido pesado viva fuera de la ventana de contexto y dentro solo quede un handle diminuto. Dos formas de usarlo:
1. Como servidor MCP (la instalación de arriba). El agente llama lethe_archive(content)
sobre un output grande y conserva solo el handle de 4–8 caracteres; después llama
lethe_recall(handle) o lethe_recall("palabras") para traer el texto completo. Nada se borra
nunca — el recall es sin pérdida. El skill guía le dice al
agente cuándo hacerlo, así que ocurre casi-automáticamente. Es agnóstico al proveedor: funciona
en cualquier host MCP (Claude Code, Codex).
2. Como librería Python (GC de contexto dentro del loop). ContextManager corre una pasada
automática dentro de tu loop: un Curator heurístico puntúa cada bloque (recencia, si bloques
posteriores lo citan, tipo de bloque, más una llamada opcional a un modelo barato) y un
Archivist pagina los bloques más fríos a un almacén — sin pérdida, dejando stubs — para
mantener el working set bajo un presupuesto de tokens. Los handles referenciados se repaginan
bajo demanda.
Seamos claros con el mecanismo. Un servidor MCP no puede reescribir en silencio la ventana de contexto del host. LETHE funciona dándole al agente tools explícitas de offload/recall más un skill que hace que usarlas sea casi automático — no por magia. Esa honestidad es el punto.
✅ Qué funciona hoy vs. 🗺️ qué está en el roadmap
El diseño multi-proveedor, ensamble y retrieval semántico de abajo es la visión a largo plazo, no lo implementado. La división honesta:
Cada milestone se publica como release etiquetada — notas completas en CHANGELOG.md.
El modelo mental (analogía con el SO)
LETHE se diseña como un sistema operativo que gestiona memoria virtual. La analogía guía la arquitectura; el ✅/🟡 de arriba dice cuánto de eso corre automáticamente hoy.
En qué se diferencia de las librerías de memoria de agentes
Mem0, Zep, Letta y compañía persisten hechos entre sesiones. LETHE apunta a lo contrario: gestionar el contexto vivo de la sesión de un loop en marcha — decidir qué mantener en la ventana ahora mismo. Es complementario a un producto de memoria a largo plazo, no un competidor. Si esa diferencia es decisiva es algo que el roadmap de arriba todavía debe demostrar.
Inicio rápido (sin API key)
Demo con Claude real
Documentos de diseño
docs/specs/2026-06-12-lethe-vertical-slice-design.md— diseño aprobado del corte construidodocs/LETHE_engineering_design.md— la visión de ingeniería completa a largo plazo (multi-proveedor, ensamble, embeddings). Léelo como el roadmap, no como el estado actual.
Licencia
Liberado al dominio público bajo la Unlicense. Libre para todos, en cualquier lugar.
来源:README.md,提交 4f10077
工具
0版本历史
1- v0.6.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分