Glassbox Framework

io.github.TheBarmaEffect由 GitHub 账号 TheBarmaEffect 发布v1.0.3更新于 Oct 27, 2026

Runtime constitutional verification for AI answers — claim reasoning, ECS, red team, audits.

已验证STDIO仅桌面安全与监控AI 与机器学习

概览

AI 生成的概览

本地 MCP 服务器,对问题和 AI 回答运行验证流程,返回主张、ECS 评分、红队探测与 Trust Card。

可以做什么
  • 对问题与回答运行完整流程,得到含裁决的 Trust Card
  • 从回答中抽取原子主张,并为每条附上推理链
  • 按公开公式计算认知置信度评分并给出各维度明细
  • 对回答执行七项对抗性红队探测
  • 把自然语言部署意图编译为运行时规则并据此评估回答
  • 用现成部件组装 Trust Card,或导出带确定性 SHA-256 审计编号的审计报告
适用场景
适合让助手检查自己或其他模型的回答是否存在无依据主张、过度自信或违反策略,并给出可追溯的裁决与审计编号。也适合在发布 AI 生成内容前增加一道验证环节的团队。
运行要求
以 stdio 在本地运行,可通过 npm 包或 npx 安装,另有 Python 客户端包。主张抽取、红队、宪法引擎与 ECS 检查需要 ANTHROPIC_API_KEY,仅组装 Trust Card 的工具无需密钥。可选配置包括 GLASSBOX_MODEL、GLASSBOX_MAX_TOKENS 与 GLASSBOX_ECS_MODE。仅支持桌面端。
安装前请注意
需要 Anthropic API 密钥,通过环境变量传入,费用计入你的 Anthropic 账户;验证调用会消耗付费模型 token。提交的问题与回答文本会发送给 Anthropic 模型处理。裁决与评分是模型辅助判断,并不等同于已确立的事实真相。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Glassbox Framework,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Glass Box Framework

Runtime constitutional verification for AI answers. Every claim carries a reasoning chain. Every score breaks down. Every verdict is traceable.

[CI] [PyPI version] [npm version] [Homebrew] [MCP Registry] [PyPI downloads] [License] [GitHub stars]

⭐️ Star this repo if you want runtime AI verification to become the default. Every star moves Glassbox up the search ranking on GitHub, the MCP Registry, and Smithery — which means more developers find this before they ship an AI feature without a Trust Card.

[Glassbox in 70 seconds — walkthrough of all 6 tools]

bash
pip install glassbox-framework         # Pythonnpm install -g @glassbox-framework/mcp # Node / MCPbrew install thebarmaeffect/glassbox/glassbox-mcp   # macOS

Zero-cost public GlassBox Lite

The repository also ships a separate deterministic Lite verifier and cross-platform gateway that require no paid model API:

Lite performs bounded structural checks and does not browse or establish factual truth. The original six-tool model-assisted MCP documented below remains a separate surface.

See PLATFORMS.md for the exact live, downloadable, pilot, and external-review status of every integration.

What it is

The Glass Box Framework hands an (question, answer) pair to a runtime verification pipeline and returns a structured Trust Card containing:

  • Claims — every atomic assertion in the answer, paired with a reasoning chain explaining why it's asserted, what would support it, and what would falsify it.
  • Epistemic Confidence Score (ECS) — a transparent, weighted aggregate over five dimensions with a published formula and an always-visible per-dimension breakdown.
  • Glassbox Court — seven adversarial probes (fabrication, source manipulation, bias injection, context attack, overconfidence, underspecification, constitutional violation).
  • Constitution — your natural-language deployer intents compiled into structured runtime rules and evaluated against the answer.
  • Verdict — trust / caution / reject, with the exact reasoning that derived it.
  • Audit reference — a deterministic SHA-256 log_id; identical inputs reproduce the same identifier across runs and languages.

It is intentionally not a wrapper around a single LLM call — the reasoning chain on every claim, the formula on the ECS, and the determinism of the audit hash together form the "Glass Box" principle: no opaque scores.

Quick start (Python)

python
from glassbox_framework import Glassbox
with Glassbox() as gb:    card = gb.verify_answer(        question="Can intermittent fasting cure type 2 diabetes?",        answer="Yes ...",        intents=[            "Never make specific medical claims without citing peer-reviewed sources.",            "Always recommend consultation with a licensed healthcare professional.",        ],    )
print(card["verdict"])              # "reject"print(card["ecs"]["total"])         # 0.6032print(card["audit"]["log_id"])      # glassbox-85cc09903bd4...  (deterministic)

The six tools

ToolPurpose
glassbox_verify_answerFull pipeline → Trust Card
glassbox_extract_claimsAtomic claims with reasoning chains
glassbox_score_ecsECS with full breakdown + formula
glassbox_red_teamGlassbox Court — 7 adversarial probes
glassbox_generate_trust_cardAssemble a Trust Card from prebuilt parts (no LLM call)
glassbox_export_audit_reportFull pipeline + deterministic SHA-256 audit log

Full schemas, examples, and configuration: mcp/README.md. Python pip-specific docs: mcp/python/README.md.

Architecture (two-layer)

┌──────────────────────────────────────────────────────────┐│ glassbox-framework (PyPI)         Python client          ││   thin JSON-RPC stdio wrapper                            ││   spawns ↓                                               │├──────────────────────────────────────────────────────────┤│ @glassbox-framework/mcp (npm)     Node MCP server        ││   6 tools, Zod-validated I/O                             ││   ↳ verify_answer  ↳ extract_claims  ↳ score_ecs         ││   ↳ red_team       ↳ generate_trust_card                 ││   ↳ export_audit_report                                  │└──────────────────────────────────────────────────────────┘

The Python client makes zero LLM calls itself; it forwards arguments to the MCP server over stdio and renders the returned JSON. Set ANTHROPIC_API_KEY once and both layers use it.

Use with Claude Desktop

json
{  "mcpServers": {    "glass-box": {      "command": "npx",      "args": ["-y", "@glassbox-framework/mcp"],      "env": { "ANTHROPIC_API_KEY": "sk-ant-..." }    }  }}

~/Library/Application Support/Claude/claude_desktop_config.json on macOS.

Determinism

Audit log_ids are SHA-256 over canonicalised JSON of (inputs_hash, claims, ECS dimensions, red-team probe verdicts, constitution evaluations). Timestamps are recorded but never enter the hash, so identical inputs and identical engine outputs always produce the same log_id — across runs, machines, and even languages (the Python client → Node server → JSON canonicalisation produces byte-identical hashes).

Verifiable example, no API key needed:

bash
pip install glassbox-frameworkpython -c "import jsonfrom glassbox_framework import Glassboxwith open('mcp/demo/raw-inputs.json') as f: i = json.load(f)with Glassbox() as gb:    c = gb.generate_trust_card(        question=i['question'], answer=i['answer'],        claims=i['claims'], red_team=i['red_team'], ecs=i['ecs'],        constitution=i['constitution'])print(c['audit']['log_id'])   # glassbox-85cc09903bd4b3f8022a4087"

Project layout

mcp/                       — the MCP server + Python client (this release)  ├── src/                 — TypeScript MCP server (6 tools)  ├── python/              — Python pip package (glassbox-framework)  ├── homebrew/            — Homebrew formula  ├── assets/              — Launch video + reveal + title cards  ├── demo/                — Live terminal demo with prebuilt Trust Card  ├── Dockerfile           — Container image  ├── server.json          — MCP Registry manifest  ├── smithery.yaml        — Smithery.ai manifest  ├── LAUNCH.md            — Launch kit  └── DISTRIBUTION.md      — Every channel's status + commandsLICENSE                    — Apache 2.0ROADMAP.md                 — Phase 5 (governor) plans for the broader frameworkCONTRIBUTING.mdCHANGELOG.md

Contributing

Glassbox is open source under Apache 2.0 and actively wants forks and PRs. A few specific places we'd love help:

  • More red-team probes — mcp/src/engines/redteam.ts has // v2: placeholders for alignment_faking, reasoning_trace_deception, eval_awareness_gaming, agentic_misalignment, and sustained_jailbreak. Each is a tractable PR — same shape as the existing 7 probes, just a different angle. See .github/ISSUE_TEMPLATE/good_first_issue.md.
  • More language clients — currently Python (glassbox-framework) and Node (@glassbox-framework/mcp). Go, Rust, Ruby, Swift, Kotlin would all be welcome as thin JSON-RPC clients that spawn the existing MCP server.
  • More integrations — Cursor / Cline / Continue / Roo Cline / Zed / Neovim — wherever MCP is read, Glassbox should be one paste away.
  • Real-world Trust Card examples — submit (Q, A) pairs from your own AI workflows so the test suite covers more terrain.

Process:

  1. Pick a good first issue or open one with your idea
  2. Fork, branch, work — the PR template walks you through verification
  3. CI must pass (.github/workflows/ci.yml) — TS strict mode, Python wheel build, cross-language determinism on the canonical audit hash
  4. Open the PR; we aim for review within 48 hours

Code of conduct: Contributor Covenant 2.1. Be kind, stay on substance, no harassment, contact [email protected] for anything off-public-channel.

Star ⭐ this repo

The fastest way to help right now is to star the repo. Every star:

  • Surfaces Glassbox higher in GitHub's MCP topic listings
  • Pushes the project up on the MCP Registry and Smithery rankings
  • Tells the next developer evaluating AI-safety tooling that this is the one with eyes on it

⭐ Star Glassbox

Author

Karthik Barma · MS Artificial Intelligence · Northeastern University.

Powered by Aura.

Issues + PRs: https://github.com/TheBarmaEffect/glassbox/issues

来源:README.md,提交 97a7fe7

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.3最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分