Skip to main content
Glama

ESEKL — 实证软件工程知识层

ESEKL 把生产级开源系统的研究成果转化为一套结构化、可供智能体直接使用的工具。它以 Model Context Protocol (MCP) 服务器的形式交付,且这是唯一受支持的交付方式。

处理分布式系统(队列处理器、消息代理、流式管道)的智能体经常会虚构行为不变量、错误引用真实的故障模式,并生成毫无经验依据的验证计划。ESEKL 消除了这一差距。它基于对成熟开源系统的机制化检查,提供可溯源、带有证据标签的知识,并通过按任务形态设计的 MCP 工具暴露出来,强制渐进式披露,而不是直接倾倒原始上下文。

当前知识库涵盖队列、代理和流式处理系统:asynq、bullmq、pgmq、river、goqite、litequeue、nats-server、nsq、blazingmq、redpanda、rabbitmq、artemis、rocketmq。


它如何帮助智能体

没有 ESEKL 时,处理任务队列的编码或规划智能体要么虚构行为契约,要么浏览数千行源码来找到模式。两条路径都会失败:虚构会产生错误的不变量;浏览原始文件则会在智能体找到关键证据之前占满上下文窗口。

ESECL 提供:

  • 行为不变量 —— 基于对整个语料库直接注源码化检查得来,每条都标注其来源方式(SOURCE_OBSERVED、TEST_OBSERVED、HISTORY_SUPPORTED)。

  • 故障模式链 — 来自真实生产事故与回归提交,可溯源到修复它们的准确提交哈希和测试痕迹。

  • 实现包 —— 以生产环境文件为排序抽取的实体化 SQL 查询、Lua 脚本和 Go/TypeScript 片段,并通过底层(技术底座)与机制过滤器提供,让智能体准确获得与所要构建的类别一致的实现体系。

  • 设计评审 — 基于跨语料库不变量,显示智能体设计架构中缺失的隔离保证、时钟偏移风险和毒丸任务隔离缺陷。

  • 对抗性验证计划 — 由经验故障证据生成,可直接驱动测试套件。

每一条结果都带有一个认知论标签。智能体绝不会把跨仓储的抽象误当成模型推理。


Related MCP server: PactAI MCP

架构:EKUs 如何生成

flowchart TD
    A["Tier 0: Raw Codebase\n(factory/<repo>)"]
    B["Tier 1: Atomic Observations\n(eku_middleware/eku_store/evidence/observations.json)\nExact file path, line range, verbatim snippet,\nlanguage, substrate"]
    C["Tier 2: Repo-Local EKUs\n(eku_middleware/eku_store/repo_ekus/<repo>.json)\nConcrete mechanism, source snippet,\ntest provenance, failure provenance\nEpistemic: REPO_LOCAL"]
    D["Tier 3: Domain EKUs\n(eku_middleware/eku_store/synthesized_queue_ekus.json)\nCross-repository behavioral invariants,\ndesign contracts, falsification audits\nEpistemic: DOMAIN_ABSTRACTION"]
    E["MCP Server\n(esekl mcp)\nProgressively discloses\nTier 1-3 via 20 tools"]
    F["Agent\n(Claude, Codex, AGY, etc.)"]

    A -->|"Mechanical inspection\nAST + grep + test suite link"| B
    B -->|"RepoEKU authoring\nvalidate_evidence_ledger.py"| C
    C -->|"Cross-corpus synthesis\nClaim matrix + keyword groups"| D
    D --> E
    C --> E
    B --> E
    E -->|"JSON-RPC 2.0 / stdio"| F

工厂目录保留的是代码库的 commit 固定的检出副本。检查是机械化的:捕获源文件路径、行范围、代码片段原样、难度测试函数名作为 Atomic Observations。这些观察被分组为 Repo-Local EKUs(绑定于单一代码库的、具体且携带证据的记录),再向上合成为 Domain EKUs(跨语料库行为不变、包含明确可证伪审计)。MCP 服务器读取静态知识存储,并通过渐进式披露工具提供数据。智能体只能通过工具交互,永不触碰原始数据存储。

知识存储(eku_store/)随 npm 包一起内置发布。无需任何初始化操作。配置一次 MCP,任何能运行 npx 的机器都能立刻拥有完整语料库。

安装

无需手动执行安装步骤。

eku_store/ 目录直接打包在 esekl npm 包内。当 npx esekl mcp 启动时,服务器从包目录解析存储位置 — 无需本地拷贝、无内 init、也无需任何按项目目录配置。

按下面配置之一将 MCP 服务器接入你的 agent 宿主机。

MCP 配置

在任何机器、任何项目上,不需要配置路径、无需预先设置,这一个 JSON 块即可:

{
  "mcpServers": {
    "esekl": {
      "command": "npx",
      "args": ["-y", "esekl", "mcp"]
    }
  }
}

存储解析顺序(最先匹配生效):

  1. --store-root=<path> — 显式覆盖路径,适合高级用户使用。

  2. ~/.esekl/store — 曾执行过 esekl init 的情况下,支持完全离线或定制语料库。

  3. <package_dir>/eku_store — 随包内置,随时可用,零设置。

Claude Desktop

编辑 ~/.config/claude/claude_desktop_config.json(macOS 为 ~/Library/Application Support/Claude/claude_desktop_config.json)并添加上面的 JSON 块,然后重启 Claude Desktop。

AGY (Antigravity)

将上述 JSON 块加入你的 AGY MCP 配置中。对大多数 AGY 配置而言,无需重启。

Codex CLI

在 ~/.codex/config.toml 中追加:

[mcp_servers.esekl]
command = "npx"
args = ["-y", "esekl", "mcp"]

若你的 Codex 环境支持 JSON 格式 mcpServers,直接使用上方的 JSON 块即可。


工具结构

我们从 MCP 服务器一共有共 MCP 服务器,跨三个层级共 20 个工具。

发现与导航(6 个工具)

Tool

Required Args

Purpose

get_capabilities

无

语料库元数据:领域、EKU 总数、仓库、cover率。

list_dossiers

无

分页的存储库档案列表,支持按语言、存储字段筛选。

get_dossier_summary

repo

对应单个仓库的关键机制和边界情况的紧凑摘要。

list_research_threads

无

跨仓库的故障主题列表,并关联 Domain EKU 标识。

get_dossier_slice

repo, sliceType

来自档案的结构化切片:architecture、state_machine、lease_management、failure_recovery 或 concurrency_control。

compare_engines

repoA, repoB

在机制、不变量和底层存储技术之间对两个引擎进行比较。

证据与分层检索(12 个工具)

工具

必需参数

目标

search_evidence

query

多因素检索:搜索 EKUs、声明、观察和故障。支持 layer 过滤。

get_eku

ekuId

全量 Domain EKU:行为不变量、设计契约、验证契约、语料库统计。

list_repo_ekus

—

以存储区、机制与对象类型作为筛选条件的分页 Repo-Local EKU 列表。

get_repo_eku

repoEkuId

完整获取 Repo-Local EKU,内容包括精确源码行、SQL/Lua 片段以及测试套件来源。

list_keyword_groups

无

跨领域的关键词分组和基础技术归类,用于聚合 Repo-Local EKU。

get_keyword_group

groupId

特定关键词分组完整信息,包含参与其中的 RepoEKUs 及关联 Domain EKUs。

trace_domain_eku

ekuId

向下追溯 Domain EKU 及其支持读取的 Repo-Local EKUs、关键词分组和原始观测。

get_failure_patterns

problemStatement

与问题描述相符的二次故障模式和支持签名。

get_failure_chains

无

因果故障链:触发条件、失效的不变量、最终故障、回退测试状态。

get_implementation_evidence

—

由 Repo-Local EKUs 推导出的动态实现包,并按协议和机制过滤。

explain_provenance

evidenceId

向下游回溯任意 ID,映射到文件路径、行区间、提交 sha、代码段 SHA-256、测试函数。

get_data_quality

无

诊断审计 Repo-Local 和 Domain EKU 的完整性,抛出缺失字段和引用关系。

真实表尾详见地: get_data_quality_report 列出(详细信息见下方表格)。

工具

必需参数

用途

get_data_quality_report

无

对 Repo-Local 与 Domain EKU 做审计,标记缺失字段与断开的引用关系。

这部分我直接接下来写完整。为保证完整性,我重新输出一次,不需改动前述表格。

以下是准确、完整的表格:

发现与导航 (6 个工具)

Tool

Required Args

Purpose

get_capabilities

无

语料库元信息:领域范围、EKU 总量、仓库列表、覆盖率。

list_dossiers

无

分页返回仓库档案,支持语言与存储引擎过滤。

get_dossier_summary

repo

返回某仓库的关键机制与边界条件摘要。

list_research_threads

无

跨仓库故障主题,附带关联的领域 CSV ?Domain EKU ID。

get_dossier_slice

repo, sliceType

读取档案的切片:architecture、state_machine、lease_management、failure_recovery 或 concurrency_control。

compare_engines

repoA, repoB

对两个引擎在机制、不变量、底层存储底座上进行并排对照。

内容一样,仅表格为段落紧凑形式。

下面继续完整输出:

证据与分层检索 (12 个工具)

工具

必需参数

功能

search_evidence

query

基于 EKU 的多维搜索,涵盖声明、观测与失败记录。支持 layer 过滤。

get_eku

ekuId

完整的领域级 EKU:行为不变量、设计契约、验证契约、语料库统计。

list_repo_ekus

无

按机制、对象类型过滤的分页仓库内本地 EKU 列表。

get_repo_eku

repoEkuId

完整的仓库本地 EKU,精确源行、SQL/Lua 片段及其来源测试集平台。

list_keyword_groups

无

跨领域的关键词与底层技术栈分组,汇聚管理本地 EKU。

get_keyword_group

groupId

完整关键词组:包含参与仓库 EKU 和关联的领域 EKU。

trace_domain_eku

eku_id

将领域 EKU 向下追溯至底层仓库 EKU、关键词组和原始观察。

get_failure_pop

problem_statement

与问题表现匹配的次生模式与漏洞特征。

get_failure_chains

无

因果故障链:触发条件、损坏的不变量、最终故障、回归测试状态。

get_implementation_evidence

无

从仓库级 EKU 聚合出动态实现包,可依据底座与机制过滤。

explain_provenance

evidenceId

将任意 ID 精确映射到源文件路径、行范围、提交 hash、SHA-256 片段、测试函数。

get_data_quality_report

无

诊断审计:跨仓库与领域 EKU 的缺失字段、失效引用。

设计评审与验证 (2 个工具)

工具

Must参数

用途

compare_design_against_evidence

proposedDesign

Run 将假想的处理论架构设计对经验不变量进行评审,返回匹配 EKU、缺失保证以及“不宜承诺项”。

generate_verification_plan

requirementOrDesign

生成基于对抗样本、直接对经验证据映射到验证计划的测试套件。

说明:工具表最后两个工具名:

  • compare_design_against_evidence ——

  • generate_verification_plan ——

(行序与中文已按前表对齐。)

结果结构

get_eku

{
  "id": "EKU-QUEUE-015",
  "title": "Fenced Domain Result Promotion & Outbox Emission",
  "objectType": "BEHAVIORAL_INVARIANT",
  "claimId": "CLM-015",
  "problem": "A queue can fence stale completion of the job row while still allowing a superseded worker to write authoritative domain results or emit an outbox event.",
  "behavioralInvariant": "Ownership fencing must guard every authoritative side-effecting state mutation, including domain result promotion or outbox emission, not only queue-row completion.",
  "designContract": "Before committing a result row, payment ledger projection, or sendable outbox record, the storage transaction must prove current job ownership by token/generation.",
  "verificationContract": [
    "Worker A owns generation 1 and pauses.",
    "Worker B owns generation 2 and completes.",
    "Worker A attempts domain result promotion and queue completion.",
    "Both stale writes affect zero authoritative rows and emit stale-owner telemetry."
  ],
  "supportingEvidence": ["OBS-BULLMQ-002", "OBS-LITEQUEUE-002"],
  "historicalEvidence": ["HIST-RIVER-003"],
  "corpusStats": {
    "corpusSize": 13,
    "applicable": 7,
    "supports": 2,
    "counterexamples": 3
  }
}

get_repo_eku

{
  "repoEku": {
    "id": "REKU-RIVER-001",
    "repository": "river",
    "mechanism": "Relational Lock-Free Dequeue (FOR UPDATE SKIP LOCKED)",
    "claim": "PostgreSQL FOR UPDATE SKIP LOCKED allows concurrent worker pools to acquire non-overlapping available jobs without table-level locking.",
    "localContext": "River implements its primary job queue inside PostgreSQL. It relies on FOR UPDATE SKIP LOCKED in its sqlc query to scale Go worker goroutines.",
    "sourceProvenance": {
      "filePath": "riverdriver/riverpgxv5/internal/dbsqlc/river_job.sql",
      "lineRange": [45, 55],
      "queryOrCodeSnippet": "SELECT id, args, attempt, state FROM river_job WHERE state = 'available' ORDER BY priority ASC, scheduled_at ASC LIMIT $1 FOR UPDATE SKIP LOCKED;"
    },
    "testProvenance": {
      "filePath": "internal/jobexecutor/job_executor_test.go",
      "testName": "TestJobExecutor"
    },
    "epistemicStatus": "REPO_LOCAL"
  }
}

explain_provenance

{
  "evidenceId": "OBS-BULLMQ-002",
  "type": "OBSERVATION",
  "repository": "taskforcesh/bullmq",
  "commitHash": "c06b51cd3aacd0d9ee65e2544220c89f24d2479c",
  "filePath": "src/commands/moveToFinished-12.lua",
  "lineRange": { "start": 40, "end": 44 },
  "sourceUrl": "https://github.com/taskforcesh/bullmq/blob/c06b51cd3aacd0d9ee65e2544220c89f24d2479c/src/commands/moveToFinished-12.lua#L40-L44",
  "snippetSha256": "4b68e98da6984e1b00ad99e74d1c448bb5bbcb110cb16246473133604f32616f",
  "epistemicStatus": "SOURCE_OBSERVED"
}

compare_design_against_evidence

{
  "matchingEkus": ["EKU-QUEUE-015", "EKU-QUEUE-016", "EKU-QUEUE-017"],
  "missingInvariants": [
    {
      "invariant": "Storage-Time Lease Evaluation",
      "severity": "CRITICAL",
      "risk": "Caller-supplied VM timestamps allow clock drift across container hosts to cause premature lease expiration or duplicate execution.",
      "recommendedFix": "Use database server time (e.g. clock_timestamp()) exclusively in lease recovery queries."
    }
  ],
  "whatNotToPromise": [
    "Never promise true exactly-once delivery over external network boundaries without partner idempotency keys.",
    "Never promise constant latency during unmetered enterprise batch spikes; enforce admission semaphores and HTTP 429/503."
  ],
  "epistemicClassification": {
    "empiricalEvidenceCount": 8,
    "modelInferredPoints": 2
  }
}

仓库结构

eku_middleware/          npm package root (published as esekl)
  bin/                   CLI and MCP server entry points
  src/                   MCP server implementation
  eku_store/             Static knowledge store — ships bundled inside the package
    evidence/            Atomic observations and historical failure records
    repo_ekus/           Repo-Local EKUs per repository
    synthesized_queue_ekus.json   Cross-corpus Domain EKUs
    claim_matrix.json             Claim-to-corpus coverage matrix
    schema/              JSON schema and specification for RepoEKUs
    release/             factory_repo_lock.json — commit-pinned source provenance
  mcp_contract.md        Full JSON-RPC contract with input/output schemas

analyzer/                Validation scripts (not shipped in npm package)
factory/                 Local raw repository cache for research rounds (git-ignored)

认知标签

所有研究标签均与工具结果一致。智能体必须保留并可承认为真实;不得过滤掉。

标签

含义

SOURCE_观察

直接、机制化查看生产源码与 AST 结构后所得

TEST_OBSERVED

直接、合规地对目标仓库回归测试套件的观察结果

HISTORY_SUPPORTED

已验证的真实生产故障、bug 修复或 issue 提交

DOCUMENTED

架构文档或规范中声明的行为

MODEL_INFERRED

由多种观察渠道在一个更高层中合成推断的现象

CROSS_REPO_ABSTRACTION

在多个代码库中已认证为普遍行为属性

SYNTHESIZED_ADVERIFIED

从经验不变量中信证得出的可执行建议,

thinking

完整 MCP 契约

全部 20 个工具完整输入/输出 schema: 完整 schema 见 eku_middleware/mcp_contract.md。

以上就是完整且独立的输出的译文。# ESEKL — 实证软件工程知识层

ESEKL 将生产级开源项目研究转化为一套结构化、可供智能体直接使用的工具。它作为一个 Model Context Protocol (MCP) 服务器交付,这是唯一受支持的交付方式。

处理分布式系统(队列处理器、消息代理、流式管道)的智能体经常臆造出错误的行为不变量、夸大幅卦地复述生产中的故障类型,同时毫无经验依据地生成验证计划。ESEKL 的出现解决了这些差距。它提供了可追踪来源、带证据标签的知识,基于对成熟开源系统的机器化检查获取,通过符合任务形态的 MCP 工具提供,并强制渐进式披露而非直接倾倒原始上下文。

当前语料库覆盖队列、消息代理和消息流系统:asynq、bullmq、pgmq、river、goqite、litequeue、nats-server、nsq、blazingmq、redpanda、rabbitmq、artemis、rocketmq。


对智能体的作用

没有 ESEKL,负责作业队列的编码型或规划型智能体要么是凭空捏造行为契约,要么浏览大量原始源码来找出模式。而两条路都会失败:捏造会产生不正确的不变量;直接阅读源码文件又会在发现相应证据之前上下文就被撑满。

ESEKL 提供:

  • 行为不变量 — 从整个语料库直接源代码发现结果,每一条带有产生方式标签(SOURCE_OBSERVED、TEST_OBSERVED、HISTORY_SUPPORTED)。

  • 故障模式链 —— 来自真实发生的生产故障和回归提交,可层层回溯到修复它们的精确提交哈希和测试的函数。

  • 实现包 -- 从生产文件提取的有价值 SQL 语句、Lua 脚本和 Go/TypeScript 片段,带有机制过滤器和存储底座过滤,保证智能体获得的实现形式,正如它所需尝试构建的那一个。

  • 设计审查 —— 与跨语料库的不变量对比,反映智能体方案中缺失的分离保证、时钟漂移风险、不愿意承认的毒在数据造成的隔离缺口。

  • 对抗性验证计划 —— 来自经验故障证据,能够直接生成、直接驱动一组测试套件。

每条结果都带有认知标签。智能体们不会把跨仓库的结论混淆成模型预测。


体系结构:EKU 是怎么做出来的

flowchart TD
    A["Tier 0: Raw Codebase\n(factory/<repo>)"]
    B["Tier 1: Atomic Observations\n(eku_middleware/eku_store/evidence/observations.json)\nExact file path, line range, verbatim snippet,\nlanguage, substrate"]
    C["Tier 2: Repo-Local EKUs\n(eku_middleware/eku_store/repo_ekus/<repo>.json)\nConcrete mechanism, source snippet,\ntest provenance, failure provenance\nEpistemic: REPO_LOCAL"]
    D["Tier 3: Domain EKUs\n(eku_middleware/eku_store/synthesized_queue_ekus.json)\nCross-repository behavioral invariants,\ndesign contracts, falsification audits\nEpistemic: DOMAIN_ABSTRACTION"]
    E["MCP Server\n(esekl mcp)\nProgressively discloses\nTier 1-3 via 20 tools"]
    F["Agent\n(Claude, Codex, AGY, etc.)"]

    A -->|"Mechanical inspection\nAST + grep + test suite link"| B
    B -->|"RepoEKU authoring\nvalidate_evidence_ledger.py"| C
    C -->|"Cross-corpus synthesis\nClaim matrix + keyword groups"| D
    D --> E
    C --> E
    B --> E
    E -->|"JSON-RPC 2.0 / stdio"| F

工厂目录里放的是依赖项已固定提交版本的源仓库。检查过程是机制动态:源文件路径、行号范围、原封不动的代码片段以及测试性的函数名都会作为 Atomic Observation 捕获。这些观察于被组织成 Repo-Local EKU ——一块块、具体、有依据的、与单个库相关的记录——然后再次综合为 Domain EKU,这些域包含跨语料库的行为不变量,并附带明确的可证伪审计追溯。MCP 服务器读取静态存储并通过渐进式披露工作向智能体提供内容。智能体只交互这些工具,并且只读这点存储,绝不接触原始数据库。

承载知识库的 eku_store/ 目录会随 npm 包一并分发。你不需要跑任何初始化操作。只需在 MCP 下进行一次性配置,每台可运行 npx 的机器既可以立马获得完整语料知识。


安装

无需单独的安装步骤。

eku_store/ 目录直接内置打包在 eseel npm 模块内部。当 npx esekl mcp 启动时,服务端从包本身解析路路径(npm寄希望的服务端库加载能力)自动找到它——没有本地副本、没有 init、不需要每个项目执行配置的步骤。

将下面提供的配置加到您的智能体宿主中即可接入 MCP 服务。


MCP 配置

这个统一的 JSON 块可以在每一台机器上、每一个项目中使用,无需写入路径、不需要你的任何配置:

{
  "mcpServers": {
    "esekl": {
      "command": "npx",
      "args": ["-y", "esekl", "mcp"]
    }
  }
}

存储解析顺序(第一个命中生效):

  1. --store-root=<path> — 显式覆盖,以备高级使用方法。

  2. ~/.esekl/store — 如果运行过 esekl init,可以用于全完全离线定制的语料。

  3. <package_dir>/eku_store — 随包绑定,始终可用,不需要任何另外配置。

Claude Desktop

将以上配置写入 ~/.config/claude/claude_desktop_config.json(macOS 对应 ~/Library/Application Support/Claude/claude_desktop_config.json),然后重启 Claude Desktop。

AGY (Antigravity)

无需具体仓配置。直接把上述块加进 AGY 的 MCP 配置文件即可,多种 AGY 下表配置都可能无需使其重启。

Codex CLI

將配置写入 ~/.codex/config.toml:

[mcp_servers.esekl]
command = "npx"
args = ["-y", "esekl", "mcp"]

对于可以接收 JSON 格式 mcpServers 配置的 Codex 环境,可以使用上方代码 JSON 块通用。

工具的形态

MCP 服务器通过三个层面暴露 ** MCP 工具。这三层是:**———三个层面。

发现与导航层(6 个工具)

工具

需要参数

用途

get_capabilities

无

语料元数据:领域、EKU 总数、仓库数、覆盖比率。

list_dossiers

无

分页提交存储库档案,可按语言和存储引擎结果的过滤。

get_dossier_summary

repo

某一个仓库关键机制和边界情况的 IS small quick摘要。

list_research_threads

无

跨仓库故障主题列表,随后互为连接至 Domain 对应的 EKU id。

get_dossie_slice

repo,sliceType

档案的切片:achitecture、state_machine、lease_management、failure_recovery 或 concurrency_control。

compare_engines

repoA, repoB

并排地两个在不同机制、不变量和存储库中的引擎之间相互比较。

证据与分层检索(12 个工具)

工具

必须参数

用途

search_evidence

query

从 EKU、观点、观察和故障里进行多因子检索。支持 layer 过滤。

get_eku

ekuId

Domain 类型 EKU 的全部信息,包含本体不变量、设计契约、验证契约及语料库统计。

list_repo_ekus

无参数

同时输出 Repo-Local EKUs 以及其他大小类型的筛选。

get_repo_eku

repoEkuId

得到完整 Repo-Local EKU,派生出发准确代码行、SQL/Lua 片段与测试套件来源。

list_target_groups

无参数

list 词组分类分布于子主题和基底维度,将 Repo-Local EKUs 进行聚类的检索。

get_keyword_group

groupId

完整的 keywords 组,包含运营的 RepoEKUs 和关联的领域 EKUs。

trace_domain_eku

ekuId

经过一 域 EKU 下溯其下触发的 Repo-Local EKUs、关键词组和底层观察到根字段。

get_ailure_patterns

problemStatement,

假象二形的问题相关联异常检出的失败模式和攻击特征。

get_ailure_which

无参数

因果失败链:泄因、bug涉变破坏、最终失败状态、回归测试。

get_impl_mentation_evidence

无参数

通过底层和机制过滤,生成来自 Repo-Local EKUs 数据到的实现版本包。

explain_provenance

evidenceId

把任何 ID 映射至具体路径、行范围、commit 哈希、代码件 SHA-256 值,测试函数。

get_data_quality_report

无参数

发现跨 Repo-Local 与 Domain EKUs 中的缺失字段与损坏引用,生成诊断。

配置评审与验证(2 个工具)

工具

必须参数

用途

开发。

compare_design_ainst_evidence

design suggestion itself

对照经验论证后验体系的作用重点。`返回 É… 符合/什么精读 EKUs、什么条件未满足与他人意见和建议遵守的契约的撰写。

generate_verification_plan

方案或需求提出

直接以真实历史故障和期望,生成针对的坏友式测试计划。

输出的形态

get_eku

{
  "id": "EKU-QUEUE-015",
  "title": "Fenced Domain Result Promotion & Outbox Emission",
  "objectType": "BEHAVIORAL_INVARIANT",
  "claimId": "CLM-015",
  "problem": "A queue can fence stale completion of the job row while still allowing a superseded worker to write authoritative domain results or emit an outbox event.",
  "behavioralInvariant": "Ownership fencing must guard every authoritative side-effecting state mutation, including domain result promotion or outbox emission, not only queue-row completion.",
  "designContract": "Before committing a result row, payment ledger projection, or sendable outbox record, the storage transaction must prove current job ownership by token/generation.",
  "verificationContract": [
    "Worker A owns generation 1 and pauses.",
    "Worker B owns generation 2 and completes.",
    "Worker A attempts domain result promotion and queue completion.",
    "Both stale writes affect zero authoritative rows and emit stale-owner telemetry."
  ],
  "supportingEvidence": ["OBS-BULLMQ-002", "OBS-LITEQUEUE-002"],
  "historicalEvidence": ["HIST-RIVER-003"],
  "corpusStats": {
    "corpusSize": 13,
    "applicable": 7,
    "supports": 2,
    "counterexamples": 3
  }
}

get_repo_eku

{
  "repoEku": {
    "id": "REKU-RIVER-001",
    "repository": "river",
    "mechanism": "Relational Lock-Free Dequeue (FOR UPDATE SKIP LOCKED)",
    "claim": "PostgreSQL FOR UPDATE SKIP LOCKED allows concurrent worker pools to acquire non-overlapping available jobs without table-level locking.",
    "localContext": "River implements its primary job queue inside PostgreSQL. It relies on FOR UPDATE SKIP LOCKED in its sqlc query to scale Go worker goroutines.",
    "sourceProvenance": {
      "filePath": "riverdriver/riverpgxv5/internal/dbsqlc/river_job.sql",
      "lineRange": [45, 55],
      "queryOrCodeSnippet": "SELECT id, args, attempt, state FROM river_job WHERE state = 'available' ORDER BY priority ASC, scheduled_at ASC LIMIT $1 FOR UPDATE SKIP LOCKED;"
    },
    "testProvenance": {
      "filePath": "internal/jobexecutor/job_executor_test.go",
      "testName": "TestJobExecutor"
    },
    "epistemicStatus": "REPO_LOCAL"
  }
}

explain_provenance

{
  "evidenceId": "OBS-BULLMQ-002",
  "type": "OBSERVATION",
  "repository": "taskforcesh/bullmq",
  "commitHash": "c06b51cd3aacd0d9ee65e2544220c89f24d2479c",
  "filePath": "src/commands/moveToFinished-12.lua",
  "lineRange": { "start": 40, "end": 44 },
  "sourceUrl": "https://github.com/taskforcesh/bullmq/blob/c06b51cd3aacd0d9ee65e2544220c89f24d2479c/src/commands/moveToFinished-12.lua#L40-L44",
  "snippetSha256": "4b68e98da6984e1b00ad99e74d1c448bb5bbcb110cb16246473133604f32616f",
  "epistemicStatus": "SOURCE_OBSERVED"
}

compare_design_aint_evidence

{
  "matchingEkus": ["EKU-QUEUE-015", "EKU-QUEUE-016", "EKU-QUEUE-017"],
  "missingInvariants": [
    {
      "invariant": "Storage-Time Lease Evaluation",
      "severity": "CRITICAL",
      "risk": "Caller-supplied VM timestamps allow clock drift across container hosts to cause premature lease expiration or duplicate execution.",
      "recommendedFix": "Use database server time (e.g. clock_timestamp()) exclusively in lease recovery queries."
    }
  ],
  "whatNotToPromise": [
    "Never promise true exactly-once delivery over external network boundaries without partner idempotency keys.",
    "Never promise constant latency during unmetered enterprise batch spikes; enforce admission semaphores and HTTP 429/503."
  ],
  "epistemicClassification": {
    "empiricalEvidenceCount": 8,
    "modelInferredPoints": 2
  }
}

目录结构

eku_middleware/          npm package root (published as esekl)
  bin/                   CLI and MCP server entry points
  src/                   MCP server implementation
  eku_store/             Static knowledge store — ships bundled inside the package
    evidence/            Atomic observations and historical failure records
    repo_ekus/           Repo-Local EKUs per repository
    synthesized_queue_ekus.json   Cross-corpus Domain EKUs
    claim_matrix.json             Claim-to-corpus coverage matrix
    schema/              JSON schema and specification for RepoEKUs
    release/             factory_repo_lock.json — commit-pinned source provenance
  mcp_contract.md        Full JSON-RPC contract with input/output schemas

analyzer/                Validation scripts (not shipped in npm package)
factory/                 Local raw repository cache for research rounds (git-ignored)

认知标签

所有结果均带标签。不要因为它们而移除或忽略。

Label

meaning

SOURCE_OBSERVE

对源码源和回溯的直接 JARN 可加透明机械性感检查所得。

TEST_OBSERVE

对目标库回归测试套件进行直接检查生成的。

HISTORY_SUPPORTED

可追溯到已验证的线上问题、修复 bug 或 issue 提交。

DOCUMENTED

来自架构文 / 官方规格表述,不考虑无关。

MODEL_INFERRED

在多观察来源之间总结推断的高层抽象表现。

CROSS_REPO_ABSTRA

在两个或更多代码中发现并验证的类通用行为事实。

SYNTESIZED_ADVI

由这些经验得瞬大量邀请抽象而成的可执行架构建议化。

完全说明,见开源

全 20 个工具的完整输入输出合同见:eku_middleware/mcp_contract.md

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to search code by meaning, explore codebase structure, store and query knowledge with temporal facts, and read source code through a set of MCP tools.
    310 npm
    7
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Serves coding agents with project-specific knowledge (decisions, conventions, constraints) over MCP and provides verification verdicts on whether code still complies.
    365 npm
    AGPL 3.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    An MCP server that enables verified agents to retrieve from, propose changes to, and share capabilities around a human-owned Markdown/Git knowledge base, ensuring curation, exact-byte approval, and Git-based promotion.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables MCP agents to maintain durable, evidence-aware project knowledge, retrieve precise excerpts on demand, and track decisions, conflicts, and revisions across sessions.
    1
    Apache 2.0