@mentholmike

Lethe

Lethe — Persistent Memory for AI Agents

当前版本
v0.1.0
bundle-plugin社区source-linked

Lethe — Persistent Memory for AI Agents

"AI that remembers what you decided."

Every AI agent starts from scratch. Same question, same reasoning, same dead ends — every single session. Lethe breaks that loop.

Lethe is a persistent memory layer for AI agents. It records reasoning chains, decisions, observations, flagged uncertainty, and task history across sessions — so your agent carries context forward instead of rebuilding it from nothing.


What It Records

TypeUse Case
recordA decision made, a direction chosen, a conclusion reached
logAn observation, a discovery, something worth noting
flagUncertainty that needs human review before proceeding
taskA work unit with a status chain: todo → in_progress → done

Records carry confidence scores (0.0–1.0). Flags persist across sessions until explicitly reviewed. Task events chain together so you can trace the history of any piece of work.


How It Works

┌─────────────────────────────────────────────────────────────┐
│  Your AI Agent                                              │
│                                                             │
│  ┌─────────────┐    context assembly      ┌──────────────┐  │
│  │  Lethe      │◄────────────────────────   LLM prompt │ │
│  │  Plugin     │                          │   (prepend)  │  │
│  └──────┬──────┘                          └──────────────┘  │
│         │                                                   │
│         │ HTTP                                              │
│         ▼                                                   │
│  ┌──────────────┐   ┌─────────────────────────────────────┐ │
│  │  Lethe       │   │  Lethe Server (Go + SQLite)         │ │
│  │  Plugin      │   │                                     │ │
│  │  (Node.js)   │   │  Sessions · Events · Checkpoints    │ │
│  └──────────────┘   │  Flags · Threads · Task chains      │ │
│                     └────────────────────────────────────┘
└─────────────────────────────────────────────────────────────┘
  1. Sessions — Each agent session gets a stable key. State: active, interrupted, or completed.
  2. Events — Every meaningful agent action is logged: decisions, observations, flags, tasks.
  3. Checkpoints — Periodic snapshots so the agent can resume exactly where it left off.
  4. Compaction — When a session grows long, events are synthesized into a narrative summary, preserving the full history in compressed form.
  5. Threads — Flags and uncertainty can be grouped into named threads for tracking open questions across sessions.

On session resume, the plugin assembles context: session summary + recent events, prepended to the LLM prompt. The agent picks up exactly where it left off.


What Makes It Different

Most agent memory is just conversation storage. Lethe is different:

  • Structured, not soup — Records, logs, flags, and tasks have meaning. It's a memory schema, not a chatlog.
  • Confidence scoring — Every record carries a confidence score so the agent can calibrate how much to trust prior conclusions.
  • Flag system — Uncertainty gets surfaced and tracked, not buried in context.
  • Crash recovery — Interrupted sessions resume from the last checkpoint, not from zero.
  • No external dependencies — SQLite only. No API keys, no embedding models, no vector search to tune.
  • Lightweight — A single Docker container. Drop it into any agent stack.

Quick Start

Docker

docker run -d \
  --name lethe \
  -v lethe-data:/data \
  -p 18483:18483 \
  ghcr.io/openlethe/lethe:latest

From Source

go build ./cmd/lethe
./lethe --db ./lethe.db --http :18483

The server starts on port 18483 with a built-in UI at http://localhost:18483/ui/.


API Overview

MethodPathPurpose
POST/api/sessionsCreate a session
GET/api/sessions/{key}Get session
GET/api/sessions/{key}/summarySession summary + recent events
POST/api/sessions/{key}/heartbeatHeartbeat ping
POST/api/sessions/{key}/interruptInterrupt session
POST/api/sessions/{key}/completeComplete session
POST/api/sessions/{key}/compactTrigger compaction
GET/api/sessions/{key}/eventsList events
POST/api/sessions/{key}/eventsCreate event
GET/api/sessions/{key}/checkpointsList checkpoints
POST/api/sessions/{key}/checkpointsCreate checkpoint
GET/api/flagsList unreviewed flags
PUT/api/flags/{id}/reviewReview a flag
GET/api/statsDashboard stats

Full API reference at docs.openlethe.ai.


Integrations

OpenClaw Plugin

The Lethe plugin for OpenClaw handles bootstrap and context assembly automatically. Install the plugin and configure your endpoint:

{
  "id": "lethe",
  "endpoint": "http://localhost:18483",
  "agentId": "archimedes",
  "projectId": "default"
}

Roll Your Own

Any agent that can make HTTP calls can use Lethe. The plugin protocol is just a session lifecycle + context assembly API. See the API reference for details.


Architecture

cmd/lethe/main.go        — entry point, wires server + store + session manager
internal/api/            — HTTP handlers, Chi router, request/response types
internal/db/             — SQLite store, embedded migrations, all CRUD
internal/models/         — domain types (Session, Event, Checkpoint, Flag, Thread)
internal/session/        — session lifecycle state machine and manager
internal/ui/             — embedded UI (Go templates, HTMX)

源码与版本

源码仓库

openlethe/lethe

打开仓库

源码提交

2411d03

查看提交

安装命令

openclaw plugins install clawhub:lethe

元数据

  • 包名: lethe
  • 创建时间: 2026/03/28
  • 更新时间: 2026/03/28
  • 执行代码:
  • 源码标签: v0.1.0

兼容性

  • 构建于 OpenClaw: -
  • 插件 API 范围: -
  • 标签: latest
  • 文件数: 72