
Epistemic Integrity Framework (EIF)
io.github.leocelis由 GitHub 帳號 leocelis 發布v4.2.0更新於 Nov 5, 2026
Runtime gate for AI agent claims. Catches sycophantic drift, circular self-validation, causal errors
概覽
對 AI 代理的關鍵論斷執行科學方法流程,依證據把決策導向 ACT、REVISE 或 HALT。
- 可以做什麼
- 建立並檢視工作階段,把框架原則載入上下文
- 透過八階段流程宣告、否證、因果閘門、校準、質疑、更新與解釋假設
- 執行輔助關卡:對抗性輸入偵測、諂媚與立場漂移檢查、假設排序、複現協定與綱領健康度
- 記錄溯源資訊、對應到歐盟 AI 法案條文並產生合規報告
- 記錄標註結果,讀取校準、攔截率與溯源報告
- 一次呼叫完成決策驗證,或從自由文字中擷取結構化論斷
- 適用情境
- 適用於代理進行高風險決策、自信出錯代價高昂的情境,例如合規、工程、金融或不可逆操作,並希望在行動前以獨立證據檢驗假設。
- 執行需求
- 遠端 SSE 端點,需在 Authorization 標頭提供 bearer API 金鑰,金鑰須透過專案的 GitHub Discussions 申請;託管端點被說明為私有 alpha。也可用 Python 與 eif-engine 套件在本機自架,或透過 uvx 執行且不需金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Epistemic Integrity Framework (EIF),將其新增到工作區。
- 連接 Authorization token 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 SSE。 遠端服務在工作區中設定後即可從網頁執行環境執行。
交給代理程式安裝
把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。
閱讀 https://sourceweft.com/mcp/io.github.leocelis%2Feif/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。其他 MCP 客戶端
把它新增到你客戶端的 mcpServers 設定中。
{
"mcpServers": {
"epistemic-integrity-framework-eif": {
"type": "sse",
"url": "https://eif.leocelis.com/sse",
"headers": {
"Authorization": "Bearer <YOUR_TOKEN>"
}
}
}
}README
EIF - Epistemic Integrity Framework
Apply the scientific method to every assumption your AI agent makes.
[License: MIT] [Python 3.11+] [MCP Compatible] [tests] [ComplyEdge runtime enforcement]
The problem
AI agents compound errors. Each assumption that goes unchallenged becomes the foundation for the next one. A 90%-accurate agent running 10-step tasks produces correct output only 35% of the time - that's the compound error curve. That 0.9^10 curve is an upper bound: it assumes independent, non-recoverable per-step errors, whereas real pipelines have correlated and recoverable steps, so EIF's value is framed as reducing the error rate per load-bearing step rather than as the literal compound figure. In high-stakes domains (compliance, engineering decisions, financial advice), this translates to real cost.
The dominant source of that cost is not hallucinated facts, but unchallenged assumptions that are never tested against evidence.
What EIF does
EIF is a Python library and MCP server that runs an 8-phase scientific-method pipeline on every load-bearing assumption in an agent's response:
Plus auxiliary gates that run before/after the core loop:
At the end of each turn, EIF routes the agent's output:
- ACT - posterior ≥ threshold, evidence supports, safe to proceed
- REVISE - some assumptions unresolved, moderate confidence
- HALT - evidence contradicts a HIGH-consequence claim; do not proceed
Corpus evidence
EIF was validated against 14 multi-agent conversation scenarios across 5 domains (clinical, engineering, compliance, investment, M&A).
Scope note: the 14-scenario corpus is constructed and illustrative - it demonstrates the mechanisms, not field results. A separate field-validation track on real agent traffic is the basis for production false-positive measurement. EIF can also estimate a modeled dollar cost per HALT-routed claim (a distinct feature); those figures and their methodology live in
validation/CORPUS_REPORT.md, not here.
P4 (circular LLM self-validation) rate: 0.0% across all 14 scenarios. Every piece of evidence came from an independent source - executable code, coordinator tool outputs, or live web search.
Full evidence: validation/CORPUS_REPORT.md. Per-scenario reports available on request via GitHub Discussions.
Quick start
Two-tool path (recommended for first session)
Register a P0 host tool (highest-accuracy evidence tier)
When your agent has access to an authoritative data source (IGDB, your database, an internal API), register it as a P0 host tool. EIF calls it directly - no web search, no guessing.
P0 is the highest-priority evidence tier. Without a registered tool, EIF falls back to web search (P3), which can return false-positive SUPPORTS for specific numeric metrics. For production use, register the tool.
See examples/quickstart.py for a complete end-to-end example (a different scenario, an infrastructure-migration decision, walking DECLARE through EXPLAIN in one script).
MCP server (Cursor / Claude Code / Claude Desktop integration)
Per-client setup guides (register the server, install the rules block, verify,
troubleshoot) live in docs/integrations/:
Claude Code ·
Cursor ·
Claude Desktop.
The short version:
Option A - hosted endpoint (private alpha, zero install):
Request a key by opening a Discussion, then add the config for your client.
Cursor (~/.cursor/mcp.json) and Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
VS Code / GitHub Copilot (.vscode/mcp.json): use "servers" (not "mcpServers") and add "type": "http" to the entry.
The hosted endpoint is in private alpha. Everything below runs fully on your own machine with no key.
Option B - local venv (works today, fully self-hosted):
Option C - uvx (zero-install, works today):
uv runs the executable matching the package name by default; since the console
scripts are eif-mcp-server / eif-mcp-http-server (not eif-engine), --from
is required. Bare uvx eif-engine fails with "An executable named eif-engine
is not provided by package eif-engine".
EIF exposes 25 tools your agent can call:
Session (1 tool):
Core pipeline (8 tools):
Gates and monitors (5 tools):
Calibration and agenda (4 tools):
Utilities (7 tools):
Recommended agent loop (in your system prompt or MCP server instructions):
Paste the block below into an agent instruction file (.cursorrules, CLAUDE.md,
AGENTS.md, or .cursor/rules/eif.mdc) so eif_check_rules_installed can confirm
it is present and your agent picks up the loop automatically:
The canonical text of this block lives in
docs/integrations/README.md; the checker
accepts any <BEGIN-EIF vX.Y> marker, so existing v1.0 installs stay valid.
Evidence collection tiers
EIF's FALSIFY phase collects evidence from independent sources, prioritised:
P0 is the highest-priority tier and is the mechanism used in the Manor Lords / IGDB demo. P4 is never used for company-specific claims. In the validation corpus, P4 rate was 0.0% across all 14 scenarios.
Architecture
Research foundation
EIF integrates findings from:
Full research citations: docs/research_foundation.md
Primary-source literature reviews (15 documents, ~3,800 lines): research/
Production Integration
Three surfaces for intercepting LLM responses in your code - all run locally (your responses never leave your machine).
A) EIFInterceptor - wrap an existing OpenAI client
Install: pip install "eif-engine[sdk]" (or pip install -e ".[sdk]" from a source checkout)
Note: on any EIF server error the SDK fails open (the response passes through unverified) so your agent never blocks on EIF availability. Treat EIFHaltError as the only enforcement signal.
B) eif.auto - zero-config import hook
Configure via environment:
Start the HTTP server: eif-mcp-http-server
C) EIFCallbackHandler - LangChain / LangGraph
For in-process LangChain integration (no HTTP server required), use the original integration layer:
Design principles
- No LLM calls in the engine - all computation is deterministic local math; LLM calls happen only in evidence collection (P3/P4) and claim extraction (integration layer)
- Pydantic v2 throughout - every input and output is a typed, validated model
- H₀ = claim-is-TRUE - Popper orientation: REJECT means the claim fails
- EIG stopping rule - stop gathering evidence when KL(posterior ∥ prior) < 0.01 nats
- IMP4 direction law -
CONTRADICTSevidence must use lowP(E|H), not the same likelihood asSUPPORTS - P4 = 0% target - parametric self-validation is never used for company-specific or causal claims
Validation corpus
Full corpus: validation/
Additional per-scenario evidence reports (S6v31–S20) available on request via GitHub Discussions.
Development
See CONTRIBUTING.md for the repo layout, code style, and PR checklist.
CI runs the test suite (Python 3.11 and 3.12) plus a TrustLint EU AI Act screen over the intent artifacts (./scripts/compliance/check.sh). See docs/integrations/COMPLYEDGE.md for the full setup and the live trust surface.
Community
- Bugs: GitHub Issues
- Questions and ideas: GitHub Discussions
- Security reports: see SECURITY.md
Legal
Performance and market figures in this README are modeled or third-party estimates, not measured production results: see LEGAL.md.
License
來源:README.md,提交 3150ae5
工具
0版本歷史
1- v4.2.0最新Nov 5, 2026
評分
已滿足適用檢查項的 85%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通必需25 分
- 已宣告認證方式必需10 分
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分