Skip to main content
Glama

Nobulex

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

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

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

CI Tests License TypeScript

什么是行为证明?

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

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

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

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

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

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

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

快速入门

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)

集成

  • npmnpm install @nobulex/sdk

  • PyPIpip install langchain-nobulex

  • MCPnpx @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 — 随意使用。

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - A tier

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arian-gogani/nobulex'

If you have feedback or need assistance with the MCP directory API, please join our Discord server