Sapience

MCP文档知识

提供方 未标注

文档知识 stdio · 本地进程 未标注 社区 / 第三方 ClaudeCursorVS CodeGemini CLI
查看接入方式

跨会话累积的持久语义记忆,以及带有真实校准(布里尔分数、偏差图)的判断账本。

一句话选型结论

按资料字段整理

Sapience 属于文档知识类 MCP 服务器,stdio · 本地进程,鉴权方式未标注,可直接接入 Claude、Cursor、VS Code 等,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类文档知识 传输方式stdio · 本地进程 鉴权未标注 部署方式本地部署
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

文档知识
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

记忆

安装与配置

stdio · 本地进程 未标注
客户端在本机拉起子进程,数据不出本机
uvx

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js 等运行时,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
文档检索问答

在你的文档库里按问题找答案。

知识库读写

把新资料写进知识库,随用随取。

内容整理

把零散资料归纳成结构化笔记。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude、Cursor、VS Code,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在文档知识场景里让模型直接调用外部能力的人。
  • 已经在用 Claude、Cursor 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Sapience当前 未标注 stdio · 本地进程 本地部署 有 未标注
dify 未标注 stdio · 本地进程 本地部署 有 2026-04-11
open-webui 未标注 stdio · 本地进程 本地部署 有 2026-04-11
JeecgBoot 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Cherry Studio 未标注 未标注 未标注 无 2026-05-17
mempalace 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

文档知识
字段来自项目仓库与公开索引,中文说明由本站标注
提供方未标注上游标注的维护方 未标注
分类文档知识本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式未标注远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验未标注上游最后核验时间

详细介绍

10.7 KB
来自项目仓库与上游目录的原文,未做删改

Sapience

Human-like memory and a judgment ledger for AI — an MCP server for Claude Code.

An LLM has intelligence — it processes and analyzes brilliantly — but it's amnesiac between sessions and never accumulates your experience. Humans win on something else: memory that persists and judgment that gets sharper because we keep track of how our past calls turned out. That faculty — the one that makes Homo sapiens more than raw brainpower — is what Sapience adds to your AI.

Two halves:

  • A human-like memory — episodic and semantic memories, ranked by importance, consolidated over time into durable patterns. Not RAG over a scratch file.
  • A judgment ledger — log a prediction with a probability, resolve it against what actually happened, and get a real calibration read (Brier score, reliability by confidence band, a bias map) so you can see where your judgment is systematically off.

> Sapience gives one user's AI a compounding memory + judgment loop. It is not a claim to reproduce human cognition — it's the missing feedback loop that lets an intelligence learn from experience.

The judgment ledger

This is the part you won't find in other memory tools. Every "AI memory" remembers what you said; Sapience keeps score of whether you were right.

  1. Log a forward-looking call with a probability (0–1) and — crucially — the reasoning and conditions as they were at the time. Most retrospectives rewrite history; this preserves the contemporaneous evidence.
  2. Resolve it when the outcome is known (right / partial / wrong).
  3. Calibrate. Sapience computes a Brier score against a base-rate baseline, breaks accuracy down by confidence band, and flags over/under-confidence. A Claude-written narrative sits on top of the numbers — never instead of them.

Honesty by design: below a sample threshold (20 binary-scored resolutions by default — partial resolutions don't count), Sapience refuses to call anything a "bias" and explicitly labels its output "reflection, not statistics." A bias is not a bias at n=3.

How the memory works

  • Storage — a local ChromaDB vector store; the ledger is local SQLite. No third-party SaaS account.
  • Embeddings — OpenAI (text-embedding-3 family) for semantic similarity.
  • Synthesis — Anthropic Claude for context briefs, consolidation, calibration, and bias maps.
  • Retrieval — candidates are over-fetched by similarity, then reranked by similarity × salience, so an important-but-slightly-less-similar memory can still surface.

Memory types: episodic (events/decisions), semantic (patterns, written by consolidation), user (facts about you), feedback (how to work with you), project (initiatives), reference (external pointers).

Privacy — read this precisely

Your data is stored locally (vector DB + SQLite on your machine; no hosted account). By default Sapience is not fully local compute: memory content is sent to OpenAI to create embeddings, and selected memories are sent to Anthropic for briefs, consolidation, and calibration. Embeddings can be made fully local with EMBEDDINGS_PROVIDER=local (a bundled MiniLM model — no key, no network after the first model download); briefs/consolidation/calibration narratives still require Anthropic. If that tradeoff doesn't work for your data, don't point Sapience at it.

Tools

Memory — search_memory, save_memory, get_context_brief, get_related, consolidate, list_memories, memory_stats

Memory admin — get_memory (inspect by id), edit_memory (fix content/salience/topic/type in place, re-embeds automatically), delete_memory, export_memories (JSONL backup), find_duplicate_memories (report-only — nothing is auto-deleted)

Judgment ledger — log_assessment (prefer a numeric probability), list_pending_assessments, resolve_assessment, generate_calibration (Brier + reliability, gated for sufficiency), get_bias_map

Setup

Requires Python 3.12+.

Install from PyPI:```bash
pip install sapience-mcp


> The PyPI distribution is named `sapience-mcp` — PyPI's name-similarity rules blocked the bare `sapience` name — but everything else keeps the original name: `import sapience`, the installed command is `sapience`, and the four console scripts (`sapience`, `sapience-weekly-review`, `sapience-consolidate`, `sapience-demo`) are unchanged.

Then create a `.env` in your project directory (variables below) or export them directly — Sapience picks up `.env` from your current working directory.

**Or, from source (for development):**```bash
git clone https://github.com/allenc84/sapience.git
cd sapience
python3.12 -m venv venv
./venv/bin/pip install -e .
cp .env.example .env   # then edit

Configure .env (see .env.example):```
MEMORY_USER_CONTEXT="Jane Doe, founder of Acme" # who the memory serves
OPENAI_API_KEY=sk-proj-...
ANTHROPIC_API_KEY=sk-ant-...

Optional:

LEDGER_DOMAINS="predictions,decisions,commitments" # your judgment domains
SAPIENCE_DATA_DIR=/absolute/path/to/data # defaults to a per-user OS dir
SAPIENCE_NAMESPACE=work # memory namespace (default: "default")
EMBEDDINGS_PROVIDER=openai # or "local" (bundled MiniLM, no key needed)
EMBEDDINGS_MODEL=text-embedding-3-small # OpenAI model when provider is openai


> **Switching embedding providers** on an existing database requires re-embedding everything (dimensions differ). With the server stopped:
>```
> EMBEDDINGS_PROVIDER=local python -m sapience.repair --rebuild --re-embed --server-stopped
> ```

### Namespaces

Memories are partitioned by **namespace** — set `SAPIENCE_NAMESPACE` per project/workspace (e.g. in a project's `.mcp.json` `env` block) to keep contexts separate inside one database. Reads and writes default to the server's namespace; pass `namespace: "*"` to `search_memory`/`list_memories` to read across all of them, and `memory_stats` shows the per-namespace breakdown. Records created before namespaces existed are stamped `default` automatically on first read. The judgment ledger is deliberately **not** namespaced — your track record is yours, not a project's.

> **macOS Keychain (optional):** the `run_*.sh` scripts read keys from the Keychain if present, falling back to `.env`. Store keys as the `-w` **argument**, never via the interactive prompt — the prompt truncates at 128 chars and silently corrupts longer keys:
>```
> security add-generic-password -U -s "OPENAI_API_KEY" -a "claude-memory" -w 'sk-proj-...'
> ```

### Install as a Claude Code plugin (easiest)

With uv installed and `OPENAI_API_KEY` + `ANTHROPIC_API_KEY` in your environment:```
/plugin marketplace add allenc84/sapience
/plugin install sapience@sapience

This wires up everything below in one step: the MCP server (launched via uvx, no manual install) and the /sapience:log judgment-ledger command. Consolidation and the weekly ledger review run inside the shared server, so there are no hooks or cron jobs to set up. Configuration still comes from your environment — set MEMORY_USER_CONTEXT, LEDGER_DOMAINS, SAPIENCE_DATA_DIR, or SAPIENCE_PORT there if you want non-defaults.

Wire into Claude Code manually

Add to your MCP config (~/.claude.json or project .mcp.json):```json
{
"mcpServers": {
"sapience": {
"command": "/absolute/path/to/sapience/run_server.sh"
}
}
}


Or, with the package installed, point directly at the console script / module:```json
{ "mcpServers": { "sapience": {
  "command": "/absolute/path/to/sapience/venv/bin/python",
  "args": ["-m", "sapience.server"],
  "env": { "SAPIENCE_DATA_DIR": "/absolute/path/to/data" }
} } }

Restart Claude Code. The server reads keys and config at launch — restart after changing either.

How it runs: one shared server, any number of sessions

Chroma's on-disk vector index is single-writer: two processes holding the same chroma_db each flush their own copy of the index and overwrite each other, and the index silently drifts until a server segfaults on open. So Sapience never runs one server per session.

What each Claude Code session launches (sapience, run_server.sh, or python -m sapience.server) is a thin stdio relay. It looks for the shared server on 127.0.0.1:8765 (SAPIENCE_PORT to change), starts it in the background if none is up, and forwards the session's MCP traffic to it. The shared server:

  • is the only process that opens the DB, enforced by an exclusive lock (chroma_db.lock) — anything else that tries fails fast with Another sapience process already owns ... instead of corrupting the index;
  • binds to localhost only and is stateless, so sessions keep working across a server restart — if it dies, the next request from any session restarts it;
  • runs consolidation for every namespace every 6 hours (SAPIENCE_CONSOLIDATE_EVERY_S) and checks whether the weekly ledger review is due every hour;
  • logs to server.log in the data directory, and is replaced automatically when a relay from a different installed version connects. Per-project SAPIENCE_NAMESPACE still works: each relay applies its own namespace to its calls.

Nothing to configure. If you'd rather keep the server under your own supervisor (launchd, systemd), run sapience --http there; relays will use it as-is. sapience --direct is the old in-process stdio server — single session only, since it holds the lock. Stop the server before python -m sapience.repair --rebuild; the lock refuses otherwise.

The /log command

.claude/commands/log.md provides a /log slash command for the ledger — logging, reviewing, resolving, and generating calibrations/bias maps in natural language. Copy it into your project's .claude/commands/.

Automation (optional)

Both jobs run inside the shared server and need no setup. The scripts remain for one-off manual runs while the server is stopped (each opens the DB and will hit the lock otherwise):

  • run_consolidate.sh — nightly: extract semantic patterns from recent episodes (cron/launchd).
  • run_weekly_review.sh — weekly ledger review; designed for a Claude Code Stop hook.

Try it on demo data

Don't want to point Sapience at real data yet? Seed a fictional founder's dataset — 21 memories and a 30-call judgment ledger with a real calibration story for the bias map to find (overconfident on product bets, calibrated on hiring, underconfident on growth):```bash
OPENAI_API_KEY=... sapience-demo --dir ./sapience-demo-data


It prints the MCP config to paste, plus a 4-step demo flow. Everything is fictional; the target directory must be new or empty.

## Migrating existing markdown memories```bash
MEMORY_MIGRATE_DIR="$HOME/path/to/memory" ./venv/bin/python -m sapience.migrate

License

MIT — see LICENSE.

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Sapience 怎么安装?

在客户端按下面的安装命令接入:uvx。装完在客户端配置里引用同一个包或端点。

Sapience 怎么在 Claude、Cursor、VS Code 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Sapience 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Sapience 需要 API Key 吗?

资料没有标注鉴权方式,是否需要密钥取决于服务本身,接入前按官方文档确认。

Sapience 支持哪些客户端?

资料标注支持 Claude、Cursor、VS Code、Gemini CLI、Codex、Zed;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Sapience 能提供哪些能力?

资料显示能力标签包括 记忆。具体工具清单以官方文档为准。

Sapience 需要什么运行环境?

属于本地进程,需要在本机装好运行环境。

Sapience 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 未标注。