
Credence — Epistemic Guard
io.github.Lakshmi-Chakradhar-Vijayarao由 GitHub 帳號 Lakshmi-Chakradhar-Vijayarao 發布v1.2.5更新於 Nov 10, 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 分
請在儲存庫或註冊中心條目中宣告授權條款。