SleepSweet

SleepSweet

Enables AI agents to audit and clean their memory files by scanning for duplicates, broken links, stale facts, and conflicts, with non-destructive, reversible fixes and a full audit trail. It also lets the calling agent serve as the conflict judge through MCP tools.

Category
访问服务器

README

SleepSweet — memory hygiene and audit for AI agents

Agents have a brain — we give it sleep.

SleepSweet is an open-source memory hygiene and audit layer for AI agents: an offline engine plus local CLI and MCP server that deduplicates, resolves conflicts, flags stale facts, finds broken links and dead paths, and quarantines suspicious entries in the memory your agent already keeps — CLAUDE.md, AGENTS.md, ~/.claude auto-memory, Cursor rules, and GitHub Copilot instructions. It is not a memory store and it does not do retrieval.

Cleanup is non-destructive: history is marked, never deleted. Every decision is journaled and versioned, which yields a complete audit trail of your agent's knowledge over time — what the agent knew at date X, and who changed it, when, and why.

Quick start

pip install sleepsweet     # or zero-install: uvx sleepsweet run
sleepsweet run

No configuration. run scans (read-only), prints the summary below, then asks once — Apply them? [y/N] — and on y applies the fixes with a live log of every change. Nothing changes without your y:

SleepSweet — memory audit — 89 files, 206 records
Scope: all agent memory on this machine (scanned from ~/projects/myapp)
Read-only scan: nothing was changed.

  20 findings: 16 warnings, 4 notices

     10  broken links     [[links]] pointing at memories that do not exist
      6  dead file paths  memory refers to files that no longer exist
      3  unclear entries  too short or context-dependent to stand on their own
      1  duplicates       the same rule or fact written more than once
      0  conflicts        needs a judge — run via MCP, or set SLEEPSWEET_LLM

The whole CLI:

sleepsweet run             # scan + report + one confirmation + fixes
sleepsweet report          # the latest report (--details for every finding)
sleepsweet diff            # what changed in memory since the previous run
sleepsweet undo            # revert applied fixes (--to DATE rolls back to a date)
sleepsweet asof 2026-08-01 # what the agent knew at that date

Why

Agent memory degrades measurably, and the research is unambiguous:

  • Memory systems fail at conflict resolution. On the MAB FactConsolidation benchmark, popular memory stores resolve conflicting facts 7–28% of the time (best system: 54%). The recipe that reaches 78–94.8% is the one SleepSweet implements: an LLM extracts candidates verbatim, deterministic code makes the decision (arXiv 2606.01435).
  • 97.7% of memory errors are born at write time — confident fabrications stored as fact (MemGuard, arXiv 2605.28009). Auditing what was written is the highest-leverage intervention.
  • Bad context files actively hurt: degraded CLAUDE.md-style files reduce agent task success (arXiv 2602.11988). That is why every SleepSweet fix is a diff you approve, never an automatic rewrite.

What it checks

Analyzer Finds LLM needed
exact_dedup byte-identical records, within and across files no
semantic_dedup near-duplicates via static embeddings — the model ships inside the package, works offline out of the box no
reality_check paths that no longer exist — and where they moved, with filesystem-level proof (inode + birth time) when available no
lineage broken [[wiki-links]] between memories no
staleness records far past the freshness half-life of their type no
trust weak provenance: inferred origins, anchors that no longer resolve no
quality entries that cannot stand on their own: dangling pronouns, fragments, relative dates with no anchor no
conflicts records that disagree about the same fact, resolved by newest-wins judge*

* The judge is either the calling agent itself (via MCP — no setup at all) or any LLM you already have via one string: SLEEPSWEET_LLM=claude (or claude:<model>), ollama:qwen3:8b, command:llm -m gpt-4o-mini, or https://host/v1#model (+ SLEEPSWEET_API_KEY if the endpoint needs one).

Run it from your agent (MCP)

claude mcp add sleepsweet -- sleepsweet mcp

The agent gets tools to scan, read the structured report, dismiss false positives, and — through get_judge_batches / submit_judged_facts — act as the conflict judge itself. No API key, no model configuration: the model that calls the tool is the model that judges. The JSON report schema is stable and documented in docs/report-schema.md.

Audit superpowers

  • sleepsweet diff — what changed in your memory since the previous run? Byte-level diffs of every change, with the ones SleepSweet did not make labeled as such.
  • sleepsweet asof 2026-08-01 — what did the agent know on that date? The event-sourced journal replays to any moment, and every verdict records which analyzer, ruleset, judge, and prompt produced it.

Safety

  • Local-first: no telemetry, no network calls; your memory never leaves the machine (the only exception is an LLM judge you explicitly configure).
  • Nothing changes without your y: scanning is read-only, fixes wait for one explicit confirmation — or an explicit --yes for hooks and automation — and are logged as they are applied (agents triage the same way through MCP).
  • Secrets are redacted before anything is stored or sent anywhere — API keys, tokens, and private keys never reach the journal or a judge.
  • Everything is reversible: append-only journal, sleepsweet undo (down to a date with --to), and history is marked, never deleted.

Details: docs/safety.md · docs/how-it-works.md · docs/cli.md · docs/mcp.md · docs/faq.md

Verified against a stratified golden set

Beyond unit tests, evals/ holds a hand-labelled, stratified golden set: 18 kinds of memory defect (duplicates, conflicts, moved paths, stale facts, broken links, retracted parents, trust lows, external edits, …) covering every analyzer stage A1–A14, each with several planted corpora and negative controls. python evals/run.py executes real scans over them and reports objective precision/coverage per stratum and per stage; gated strata must score clean or the run fails, while the hard strata (vector-close lookalikes, hidden paraphrases, indirect conflicts) honestly map the current frontier. Judge-only defects count as misses in a judgeless run, so the tier-0 and --llm numbers are directly comparable.

Project family

License

Apache-2.0

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选