
Credence — Epistemic Guard
io.github.Lakshmi-Chakradhar-Vijayarao由 GitHub 账号 Lakshmi-Chakradhar-Vijayarao 发布v1.2.5更新于 Oct 24, 2026
Epistemic guard for AI coding: tracks uncertain values and blocks writes until verified.
概览
一个面向 AI 编程的本地认知守卫:记录你声明为不确定的数值,并在你确认前阻止写入或执行包含这些数值的文件与命令。
- 可以做什么
- 通过被动观察钩子在助手回应前登记你提示中不确定的数值,并保存在本地 SQLite 注册表中,支持会话跟踪与约束数量上限。拦截包含未验证或过期数值的 Write、Edit、Bash 与 NotebookEdit 操作,确认数值后解除拦截。查看待处理约束,以及门禁统计与反馈标记。在命令行运行演示冒烟测试与延迟报告。
- 适用场景
- 当助手编写的代码会硬编码你只是猜测的配置值、限额、版本或过期时间,而你想在这些猜测进入文件或命令前强制拦截时适用。适合希望强制执行而非仅提示的 Claude Code 用户。
- 运行要求
- 需要本地 Python 环境并安装 credence-guard 包;README 还提到可选的 Rust 门禁。配置需在项目设置中添加 MCP 服务器条目以及 UserPromptSubmit 和 PreToolUse 的 Claude Code 钩子。无需 API 密钥。可选环境变量用于设置注册表路径、会话 ID、事件日志与约束上限。
安装
在 SourceWeft 中
- 打开 控制台中的 Credence — Epistemic Guard,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Credence
AI doesn't remember what it wasn't sure about. Credence does.
[PyPI] [CI] [Python] [License: Apache 2.0]
[mcp] adds the FastMCP server for Claude Code. Core package has zero hard dependencies.
The problem
You say: "The rate limit is probably around 50 — I haven't confirmed it yet."
Fifteen turns later, Claude writes:
The API rejects every request at 2am. The real limit was 10. Claude forgot you weren't sure.
This isn't hallucination. The model reproduced exactly what it read. What it read had the qualifier stripped — by context compression, fifteen turns back.
What Credence does
Tracks uncertain values the moment you state them. Blocks writes that embed those values until you confirm them.
Every other tool warns. Credence enforces.
What it looks like
After you confirm: "Confirmed — rate limit is 100 req/min per stripe.com/docs" → gate clears.
Setup
1. Add to .mcp.json:
2. Add to .claude/settings.json:
Done. No API key required.
Registry: Credence creates
epistemic_registry.dbin your working directory. Add*.dbto your.gitignore, or setCREDENCE_DB=~/.credence/registry.dbto keep it global.Session tracking: Set
CREDENCE_SESSION_ID=my-projectto keep constraints stable across directory changes and terminal restarts.Event log: The gate writes block/allow events to
~/.credence/events.jsonl(local only, never sent anywhere). SetCREDENCE_NO_LOG=1to disable.Constraint cap: The registry allows up to 500 constraints per session by default. Override with
CREDENCE_MAX_CONSTRAINTS=<n>.
How it works
Two layers, neither requires model cooperation:
The observer fires before the model processes your message. If you say "I think the rate limit is 50", the registry has that entry before Claude generates a single token.
What gets blocked
Once verified, the gate clears.
What Credence does NOT do
- Does not verify facts — it cannot tell you if a value is correct
- Does not catch uncertainty that was never stated
- Does not block the model from saying a wrong value in prose — only from writing it to a file or command
Known issue (November 2026): the PreToolUse gate (python3 -m credence.hooks) only enforces when CREDENCE_SESSION_ID is set. Without it, the observer files constraints under an id derived from the working directory, which the gate never reads, so nothing is blocked. The Rust gate filters by Claude Code's own session id and reads CREDENCE_DB_PATH rather than CREDENCE_DB, so it can miss them too. Making the ids match is planned, together with a stricter value-level match: the current two-shared-words rule over-blocks once it enforces.
Measured results
46% of uncertainty qualifiers are stripped by Claude Haiku during context compression. Credence's probe skips compression for 100% of those segments (n=50), so no qualifier is lost.
Validated across 7 open-weight models (Qwen, Mistral, Llama, Phi, Gemma) from 5 organizations: same failure mode, same block rate.
Full methodology: docs/TECHNICAL_REPORT.md
Project layout
Research
The scientific basis for Credence is documented in paper/ (EQL / EQLR / FCR).
The companion geometry thesis — on confabulation detection and why the detection axis is dissociable from the causal control axis — lives in a separate repo: → Detection Without Control
Built by
Lakshmi Chakradhar Vijayarao — GitHub · LinkedIn · X
Apache 2.0 License
来源:README.md,提交 a75329a
工具
0版本历史
1- v1.2.5最新Sep 16, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。