Skip to main content
Glama

Nobulex

自主 AI 代理的行为证明协议。

每个 AI 代理都会做出承诺——“我不会转账超过 500 美元”、“我只会访问已批准的 API”、“我不会触碰生产数据”。但目前,没有任何方法可以证明代理遵守了这些承诺。日志是由被审计的同一软件编写的。合规性只是被声明,从未被证明。

Nobulex 改变了这一点。定义行为规则。在执行前强制执行。用密码学而非信任来证明合规性。

CI Tests License TypeScript

什么是行为证明?

你无法审计神经网络。但你可以根据既定的承诺审计其行为。

verify(covenant, actionLog) → { compliant: boolean, violations: Violation[] }

这是始终可判定的、确定性的且高效的。没有机器学习,没有启发式方法——只有数学证明。

行为证明意味着每个自主代理的行为都是:

  • 已声明 — 在部署前以形式化语言定义行为规则

  • 已强制执行 — 在运行时、执行前拦截违规行为

  • 已证明 — 每个行为都通过哈希链链接到防篡改的审计追踪中,第三方可以独立验证

Related MCP server: Agent Receipts

快速入门

npm install @nobulex/sdk
import { createDID } from '@nobulex/identity';
import { parseSource } from '@nobulex/covenant-lang';
import { EnforcementMiddleware } from '@nobulex/middleware';
import { verify } from '@nobulex/verification';

// 1. Create an agent identity
const agent = await createDID();

// 2. Write behavioral rules
const spec = parseSource(`
  covenant SafeTrader {
    permit read;
    permit transfer (amount <= 500);
    forbid transfer (amount > 500);
    forbid delete;
  }
`);

// 3. Enforce at runtime
const mw = new EnforcementMiddleware({ agentDid: agent.did, spec });

// $300 transfer — allowed
await mw.execute(
  { action: 'transfer', params: { amount: 300 } },
  async () => ({ success: true }),
);

// $600 transfer — BLOCKED before execution
await mw.execute(
  { action: 'transfer', params: { amount: 600 } },
  async () => ({ success: true }),  // never runs
);

// 4. Prove compliance
const result = verify(spec, mw.getLog());
console.log(result.compliant);    // true
console.log(result.violations);   // []

跨代理验证握手

在两个代理进行交易之前,它们会验证彼此的行为证明。没有证明,就没有交易。

import { generateProof, verifyCounterparty } from '@nobulex/sdk';

// Agent A generates its proof-of-behavior
const proof = await generateProof({
  identity: agentA,
  covenant: spec,
  actionLog: middleware.getLog(),
});

// Agent B verifies Agent A before transacting
const result = await verifyCounterparty(proof);

if (!result.trusted) {
  console.log('Refusing transaction:', result.reason);
  return; // No proof, no transaction
}

// Safe to transact — Agent A is verified
await executeTransaction(proof.agentDid, amount);

握手按顺序检查六项内容:契约签名、证明签名、日志完整性、合规性、历史记录最小值以及必需的契约。如果任何检查失败,交易将被拒绝。

为什么行为证明很重要

现有技术

缺失内容

护栏过滤提示词和输出

无法证明代理在行为层遵循了规则

监控在事后观察代理的行为

无法在执行前进行强制执行

身份验证验证代理的身份

无法验证代理做了什么

治理平台提供仪表板和策略

缺乏第三方可独立验证的加密证据

行为证明填补了这一空白:声明 → 强制执行 → 证明。

契约 DSL

covenant SafeTrader {
  permit read;
  permit transfer (amount <= 500);
  forbid transfer (amount > 500);
  forbid delete;
  require counterparty.compliance_score >= 0.8;
}

禁止优先。 如果任何 forbid 匹配,无论是否允许,该行为都会立即被拦截。对于未匹配的行为,默认拒绝。条件支持对数值、字符串和布尔字段使用 >, <, >=, <=, ==, !=。

三个关键字。没有配置文件。没有 YAML。没有 JSON 模式。只有规则。

架构

┌─────────────────────────────────────────────────────────────┐
│                        Platform                             │
│              cli  ·  sdk  ·  mcp-server                     │
├─────────────────────────────────────────────────────────────┤
│                  Proof-of-Behavior Stack                    │
│                                                             │
│  ┌──────────┐  ┌──────────────┐  ┌────────────┐            │
│  │ identity │  │ covenant-lang│  │ action-log │            │
│  │  (DID)   │  │    (DSL)     │  │(hash-chain)│            │
│  └──────────┘  └──────────────┘  └────────────┘            │
│                                                             │
│  ┌────────────┐  ┌──────────────┐  ┌───────────────┐       │
│  │ middleware  │  │ verification │  │ composability │       │
│  │(pre-exec)  │  │ (post-hoc)   │  │(trust graph)  │       │
│  └────────────┘  └──────────────┘  └───────────────┘       │
├─────────────────────────────────────────────────────────────┤
│                      Foundation                             │
│            core-types  ·  crypto  ·  types                  │
└─────────────────────────────────────────────────────────────┘

核心包

包

功能

@nobulex/identity

使用 Ed25519 密钥创建 W3C DID

@nobulex/covenant-lang

受 Cedar 启发的 DSL:词法分析器、解析器、编译器

@nobulex/action-log

带有 Merkle 证明的 SHA-256 哈希链式防篡改日志

@nobulex/middleware

执行前强制执行 — 在运行前拦截违规行为

@nobulex/verification

确定性合规性验证

@nobulex/sdk

结合所有原语的统一 API

@nobulex/mcp-server

适用于任何兼容 MCP 的代理的 MCP 合规服务器

@nobulex/cli

命令行工具:nobulex init, verify, inspect

@nobulex/langchain

LangChain 中间件集成 (PyPI)

集成

  • npm — npm install @nobulex/sdk

  • PyPI — pip install langchain-nobulex

  • MCP — npx @nobulex/mcp-server (适用于 Claude Desktop, Cursor, VS Code)

  • LangChain — 即插即用的合规中间件

  • ElizaOS — 用于行为、评估器和提供程序的插件

概念对比

比特币

以太坊

Nobulex

验证内容

货币转账

合约执行

代理行为

机制

工作量证明

权益证明

行为证明

证明内容

交易有效性

状态转换

行为合规性

保证

无需信任的货币

无需信任的合约

无需信任的代理

在线演示

npx tsx demo/covenant-demo.ts

创建一个脚本,定义两个代理,设定行为规则,在运行时强制执行,拦截违规转账,并以加密方式验证合规性。

开发

git clone https://github.com/arian-gogani/nobulex.git
cd nobulex
npm install
npx vitest run    # 4,237 tests, 80 files, 0 failures

文档

链接

许可证

MIT — 随意使用。

Available Tools

4 tools
check_actionA

Check whether an action is allowed or blocked by the current covenant rules.

Inputs: action (required), params.

get_audit_logB

Returns the full hash-chained audit trail of all compliance checks.

Inputs: no named parameters.

set_rulesA

Set covenant rules using permit/forbid/require syntax. Each rule is a string like 'forbid delete_user' or 'permit read_data safe to read'.

Inputs: rules (required).

verify_logA

Independently verify the integrity of the hash-chained audit log. Detects any tampering.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: checking actions, retrieving audit logs, setting rules, and verifying log integrity. No overlap or ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (check_action, get_audit_log, set_rules, verify_log).

    Tool Count5/5

    Four tools is an appropriate scope for a compliance/auditing server; each tool serves a necessary function without redundancy.

    Completeness4/5

    Covers core operations: rule setting, action checking, audit log retrieval, and log integrity verification. Minor gap: no explicit rule deletion or modification beyond full replacement, but this is acceptable for the domain.

    Maintenance

    ActivityNo data
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Provides covenant rule enforcement, hash-chained audit logs, and integrity verification for MCP-compatible agents. It enables users to define granular permission rules and maintain a tamper-evident audit trail of all actions.
      4
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides permission gates and tamper-evident audit logging for AI agent tool executions, with declarative policies, consent ladders, and hash-chained verification.
      MIT