
Ai Architect Mcp Spec
io.github.cdeust由 GitHub 账号 cdeust 发布v0.8.0更新于 Oct 25, 2026
PRD verification and host-driven generation with multi-judge consensus across 17 MCP tools.
概览
一个本地 MCP 服务器,用于生成并校验 PRD 规格文档,在写代码前确定性地检查符号、可追溯性与各项声明。
- 可以做什么
- 启动并逐步推进 PRD 生成流水线,提交动作结果并读取流水线状态用于诊断(完整流水线依赖宿主)。按确定性结构规则校验单个 PRD 章节或整份文档,包括需求到验收标准的可追溯性。规划章节或文档级验证,再汇总多评审意见得出共识报告。分配各章节的上下文预算,并把校验失败转换为纠正性检索查询。查看配置、健康状态、质量历史与策略有效性。
- 适用场景
- 适合在助手起草产品需求文档时使用,希望在内容进入代码生成、工单导入或迭代规划之前,发现虚构的符号、无法追溯的验收标准和未经测量的性能声明。可移植的校验器也适合 CI 或其他只需两个确定性校验工具的 stdio MCP 宿主。
- 运行要求
- 以本地 stdio 进程在用户机器上运行(仅桌面端)。从源码构建需要 Node.js 20.x 或 22.x 以及 pnpm v10+。完整流水线需要能执行编排动作的宿主,目前只有 Claude Code 有打包支持。为获得完整效果,建议安装配套插件(代码库图谱、记忆、子代理)。未声明任何认证或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Ai Architect Mcp Spec,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
[AI Architect MCP Spec — verified PRDs for agentic delivery pipelines]
[MIT License] [TypeScript 7.0+] [Node 20/22] [1506 passing] [10 packages] [17 MCP tools] [Hard Output Rules] [Closed-loop reliability calibration] [OpenSSF Best Practices]
Catch a hallucinated spec before it becomes code.
It checks that every symbol exists, every acceptance criterion traces to a requirement, and no performance claim passes without a measurement — deterministically, with no model in the checking loop.
Works in Codex, Gemini CLI, Claude Code, and CI. Runs on your machine.
What An Agent Asks · Getting Started · Pipeline · Tools · Verification · Calibration · Architecture · Zetetic Standard
One of three MCP servers that each run standalone — memory, code graph, spec verification. How they compose ↓
Every AI agent that drafts a PRD eventually invents a function that doesn't exist, claims latency it can't measure, or writes acceptance criteria that don't tie back to the requirements they're supposed to test. The output sounds confident. It is not actionable. The next stage in the pipeline — code generation, ticket import, sprint planning — silently inherits the hallucination, ships it, and pays for it later.
AI Architect MCP Spec is a TypeScript MCP server that fixes this at the structural level. Its portable verifier gives Codex, Gemini CLI, Claude Code, CI, and other stdio MCP hosts the same deterministic Hard Output Rules and cross-section traceability checks. The full pipeline is a stateless reducer (step(state, result?) → next_state, action) driven by a host that can execute its orchestration actions; Claude Code is the only packaged full-pipeline host today. Sections are produced one at a time, validated before the host ever sees them, and every load-bearing claim is judged by a panel of genius reasoning agents drawn from zetetic-team-subagents against the codebase graph from ai-architect-mcp-codebase. The loop is closed: per-judge reliability is calibrated from history, retry budgets are derived from survival statistics, KPI gates are tuned against frozen baselines, and held-out partitions are mechanically sealed so no calibration result can be peeked at before evaluation.
What you get
- A spec that survives contact with code. Symbols are cross-checked against the real codebase graph, so a PRD cannot reference a function that was renamed last week.
- Traceability that is actually checked. Every acceptance criterion must tie back to a requirement; numbering gaps are caught, not assumed away.
- No PASS without a measurement. The verdict taxonomy refuses to pass a latency, throughput, fps or storage claim — it returns SPEC-COMPLETE or NEEDS-RUNTIME instead of a confident guess.
- A guard against agreeable judges. A panel that agrees 100% of the time over 5+ claims raises
distribution_suspiciousrather than being read as consensus. - It works where you work. The deterministic verifier travels to Codex, Gemini CLI, Claude Code and CI; the full generation pipeline runs on hosts that can execute its orchestration actions.
Sovereign verification, eco-responsible by intent
Sovereign is what it is today. The server is a stateless reducer — step(state, result?) → next_state, action. It emits actions; your host executes them. It runs on your machine, and it never phones home for a verdict.
Eco-responsible is what we're aiming at. This one's lever is different from its siblings': it is avoided rework. A hallucinated PRD is inherited by code generation, ticket import and sprint planning before anyone notices — and every stage that consumed it has to be redone. The spec stage is the cheapest place in the pipeline to catch that, and three design choices keep the catching itself cheap:
- The checks run no model. Hard Output Rules and cross-section traceability are deterministic; finding a broken FR-AC link costs zero inference.
- Sections fail before they are finished. Each is validated before the host ever sees it, instead of being generated in full and then discarded.
- Retry budgets are derived, not guessed.
MAX_ATTEMPTScomes from Kaplan-Meier survival math, andmap_failure_to_retrievalsends a corrective query before a retry — a retry that reuses the context that just failed is waste with a receipt.
As in the sibling repos, we publish no energy or CO₂ figure: this repository measures no joules, and avoided rework is a design argument rather than a measurement.
10 packages. 17 MCP tools. 20 pipeline steps (11 PRD generation + 9 opt-in implementation). Multi-judge verification with consensus. Closed-loop calibration with externally-grounded falsifiers. 1506 tests. Every numeric constant traces to a citation, a benchmark, or a // source: provisional heuristic admission.
Closed-loop reliability calibration
Verification is not a one-shot pass/fail report. Every claim resolution can flush an observation back to a calibration repository, every consensus run can pull calibrated posteriors from history, and every closed loop runs an external control arm so the calibration's effect is measured, not assumed.
- Per-judge Bayesian reliability calibration — Beta(7,3) prior with sensitivity / specificity split per
claim_type. Posteriors stored in a SQLite-backedReliabilityRepository; observations flushed on every claim resolution. - MAX_ATTEMPTS retry calibration — Kaplan-Meier survival math (
kmEstimate/kmMedianAttempts/logRankTestwith Greenwood + Brookmeyer-Crowley CIs); Schoenfeld sample-size derivation event-rate-corrected to ~519 (was 823) against the measuredevent_rate=0.4762, CP CI[0.4456, 0.5069]. - KPI gate tuning — Clopper-Pearson exact CIs; per-machine-class wall_time normalization with 5-bucket
detectMachineClass; frozen-baseline content-hash assertion;loadCalibratedGates+hold_provisionalratchet protection. - Plan-mismatch fire-rate — measured via XmR control charts (Wheeler 1995, Western Electric 1956) with a synthetic injection round-trip pre-flight that catches drift between the diagnostic prefix and the regex matcher.
- Externally-grounded held-out subsets — Ajv schema oracle, mathjs oracle,
tscsubprocess code oracle,validateSectionspec oracle.OracleUnavailableErrortyped throw replaces stub-mode fabrication. This is the layer that breaks annotator-circularity — judges and oracles share no inference path. - CC-3 forced-exploration control arms — every closed loop carves out a 20% partition that reverts to the prior. Without it, calibration-on-calibration looks like progress whether or not it actually is.
- Cross-arm comparison metrics —
computeAblationComparison/computeReliabilityComparison/computeKpiGateComparisonproduce paired-bootstrap CIs (Efron & Tibshirani 1993 §16.4; deterministic mulberry32 RNG; 12-decimal reproducibility pin). Outcome is a falsifiable recommendation:calibrated_helps,prior_helps, orinconclusive_underpowered. - Mechanically-enforced held-out partition seals — three sealed lock files (
maxattempts-heldout.lock.json,kpigates-heldout.lock.json,heldout-partition.lock.json) commit a sha256 of the partition before evaluation. TheSEAL_VERIFIEDtypeof sentinel is the only way to compute cross-arm metrics on a sealed partition; passing anything else is a type error at the boundary. - Production-mode dispatcher —
makeProductionDispatcher+AgentInvokerinterface. The CLI--mode production|cannedflag selects whether calibration sees real verdicts or canned ones; the canned arm is preserved for offline reproducibility.
What an agent can ask it
Getting started
A note on naming. This is published as ai-architect-mcp-spec across its Claude Code, Codex, Gemini, MCPB, PyPI/npm and MCP Registry surfaces. 0.7.0 moved the Registry entry and primary bundle to that identity; 0.8.0 completed the migration, so no prd-spec-generator plugin or release alias is retained anywhere. The former io.github.cdeust/prd-spec-generator Registry versions are deprecated with a pointer to the canonical entry rather than left active and frozen.
Install (marketplace — recommended)
Restart your Claude Code session. The 17 MCP tools register on first stdio handshake. Then:
The plugin's bundled MCP server at mcp-server/index.js is self-contained
(only better-sqlite3 is an optional native dependency for the evidence
repository — gracefully degrades to in-memory mode when absent).
Migrating from prd-spec-generator
The old plugin and marketplace are deprecated publications, not aliases. Remove them before installing the canonical package:
Callers that used prd-spec-generator:generate-prd must use
ai-architect-mcp-spec:generate-prd. The prd-gen MCP server name,
@prd-gen/* private workspace packages, PRD_GEN_* environment variables,
and .prd-gen local data directory remain stable internal interfaces; they do
not keep the deprecated publication installed.
Plugin-scoped MCP tool names include both the publication name and the stable server key, so prompts, automation, and allowlists must migrate the complete prefix:
- old:
mcp__plugin_prd-spec-generator_prd-gen__<tool> - new:
mcp__plugin_ai-architect-mcp-spec_prd-gen__<tool>
Gemini CLI also keys installed extensions by the manifest name. Replace an installed extension under the former identity instead of updating it in place:
Companion ecosystem
For full effect, install the three companion plugins so the pipeline can consume codebase intelligence, persistent memory, and the genius-agent panel:
Each plugin is independently useful; together they are the ai-architect ecosystem. See Companion ecosystem above.
Building from source
For development or to run the audit cycle locally:
pnpm verify runs all of the above (install + build + bundle + test) —
same as CI.
Prerequisites for source builds: Node.js 20.x or 22.x, pnpm v10+
(corepack enable && corepack prepare pnpm@10).
Smoke-test offline
Both run in <2s on an M-series Mac. No LLM calls, no MCP traffic — the reducer is fully driven by canned ActionResults so you can audit behaviour offline.
Use with other MCP hosts
Honest scoping first. The full pipeline is host-dependent: the reducer
returns actions (ask_user, spawn_subagents, write_file) that assume a
host which executes them and feeds results back. Claude Code (via the plugin +
/generate-prd skill) remains the only packaged host for that workflow.
Codex and Gemini instead receive the portable Spec Verifier: a no-LLM
surface with exactly two deterministic tools and the same audit-prd and
validate-spec skills:
validate_prd_section— Hard Output Rules against a single sectionvalidate_prd_document— cross-section checks (SP/AC/FR/test traceability)
Install it in Codex from the repository marketplace:
Install the same package as a Gemini CLI extension:
Both manifests launch mcp-server/index.js with --profile verifier. The
existing Claude manifest passes no profile and therefore retains the default
17-tool full surface.
A zero-violation result means that the document satisfies the implemented structural rules. It does not prove factual accuracy, product value, implementation feasibility, security, or semantic correctness.
For an un-packaged MCP host, clone the repository and select the same narrow
profile explicitly. Replace /abs/path with the clone location.
OpenAI Codex CLI (~/.codex/config.toml, shared with the ChatGPT
desktop app and Codex IDE extension):
Cursor (.cursor/mcp.json) and Windsurf
(~/.codeium/windsurf/mcp_config.json):
VS Code (.vscode/mcp.json):
The pipeline
The reducer produces twenty sequential steps: eleven PRD-generation steps, then nine opt-in post-specs implementation steps entered only through a human gate. Each step emits at most one substantive action; the host executes it and feeds the result back. A typical trial-tier feature run (11 sections) takes ~62 host-visible iterations.
Steps 12–20 are the opt-in post-specs implementation loop: implementation_gate (human gate — "Implement" vs "PRD only"; also writes 10-verification-report.md) → pre_impl_grounding → implementation (engineer subagent in an isolated worktree) → post_impl_verification (index → detect changes → semantic diff → security gates) → testing → review (a FAIL verdict retries implementation on the same worktree, bounded by REVIEW_RETRY_CAP) → pr_gate (mandatory human gate before any push) → pr_creation → finalize. Answering "PRD only" at implementation_gate skips straight to finalize; complete is the terminal marker, not a step.
Every step is independently testable (stepOnce(state, result?) returns the same shape as the runner). The runner coalesces emit_message actions internally so the host never sees a no-op.
The MCP tools
Three surfaces. The reducer drives the full pipeline; the validation + verification
- budget tools can be consumed directly by other systems without entering the pipeline; the diagnostics surface exposes config + health + history.
Each tool takes structured Zod-validated arguments and returns a typed response. No tool calls an LLM — section drafts and judge verdicts come back via the host's spawn_subagents action so the same pipeline runs against any agent runtime.
Multi-judge verification
The self_check step is a two-phase contract. Phase A plans the verification batch and persists a snapshot of (claim_ids, judges) to state. Phase B receives the verdicts, parses them against the snapshot, and aggregates via the consensus engine.
The verdict taxonomy is deliberately five-level — not binary. NFR claims (latency, fps, throughput, storage) MUST NOT receive PASS: they are SPEC-COMPLETE if a measurement method is specified, NEEDS-RUNTIME otherwise. Judges that default to PASS for everything are caught by the distribution_suspicious detector and flagged in the typed done.verification field.
Calibration & falsification
The verification subsystem is itself a hypothesis: that consensus weighted by historically-calibrated reliability outperforms consensus weighted by a uniform prior. The closed loop below is what tests it.
- Observe. Each verification run can flush per-judge observations (claim_id, claim_type, judge_id, verdict, oracle_truth?) to a SQLite reliability repository. Observations carry an
external_groundingfield that propagates fromClaimthrough the orchestrator to the oracle resolution path; when an external oracle (Ajv schema, mathjs,tsc,validateSection) can resolve the claim, its truth replaces LLM-only consensus. - Calibrate. On subsequent runs, calibrated posteriors weight consensus per judge, per
claim_type. A 20% control-arm partition is forced-explored using the prior (getReliabilityForRun/getRetryArmForRundecide which arm a given run lands in deterministically fromrun_id). Without the control arm, calibration-on-calibration looks like progress whether or not it actually is. - Compare. Cross-arm metrics (
computeAblationComparison,computeReliabilityComparison,computeKpiGateComparison) run paired-bootstrap CIs (Efron & Tibshirani 1993 §16.4; deterministic mulberry32 RNG; 12-decimal reproducibility pin) and emit one of three falsifiable recommendations:calibrated_helps,prior_helps, orinconclusive_underpowered. - Seal. Held-out partitions are committed to lock files (
maxattempts-heldout.lock.jsonfor §4.2,kpigates-heldout.lock.jsonfor §4.5,heldout-partition.lock.jsonfor the §4.1 50-claim externally-grounded corpus) with a sha256 hash of the partition. The cross-arm metric functions accept aSEAL_VERIFIEDtypeof sentinel as a parameter; the only way to obtain that sentinel is to verify the seal first. Peeking at a held-out partition before evaluation is a type error. - Ground. Where an external oracle can resolve a claim deterministically, it does. Where it cannot,
OracleUnavailableErroris thrown rather than fabricating a stub-mode truth. This is the line that breaks annotator-circularity: judges trained against (or biased toward) LLM-style reasoning cannot poison calibration that uses non-LLM truth.
The lock files, the seal-verification dance, and the control-arm partition together mean: when a cross-arm comparison says "calibrated_helps with 95% CI excluding zero," the claim is measured, not vibes-checked. When it says "inconclusive_underpowered," that is also a falsifiable claim — you need more data, not more confidence.
Architecture
Ten workspace packages, each independently buildable, with strict Clean Architecture layering enforced by package boundaries.
Dependency rule (absolute)
Every package's package.json is checked: core depends only on zod; verification depends only on core; orchestration depends on core/validation/verification/meta-prompting (NOT on ecosystem-adapters); ecosystem-adapters depends on core + verification; mcp-server is the only place where everything composes.
A cross-audit found and fixed two layer violations:
orchestrationwas importingextractJsonObjectandbuildJudgePromptfromecosystem-adapters— pure utilities lived in the wrong package; moved tocoreandverificationrespectively.- Pure domain types (
Claim,JudgeVerdict,JudgeRequest,AgentIdentity) lived inecosystem-adapters/contracts/subagent.ts; moved tocore/domain/agent.ts. The infrastructure package now re-exports them as a backward-compat shim.
What this fixes that previous PRD generators don't
How it composes with the rest of the ecosystem
Each project owns one concern. ai-architect-mcp-codebase knows what's true about the code. Cortex knows what we already decided. zetetic-team-subagents knows how to reason about a specific shape of claim. AI Architect MCP Spec is the deterministic glue that turns those three signals into a PRD an agent can act on.
The Zetetic Standard
Every load-bearing constant in this codebase carries a // source: annotation. Three forms are accepted:
The cross-audit found and tagged every previously bare constant. Examples:
The four pillars (consistent / true / useful / necessary) and the seven rules of zetetic inquiry are inherited from the zetetic-team-subagents standard. Provisional values are not silently propagated as truth.
What this system does not do
The same standard applied to itself.
- The PRD pipeline does not write code — and the server itself never does. Steps 1–11 produce a PRD; symbols in the PRD are validated against the graph but never edited by us. The opt-in implementation loop (steps 12–20) runs only when a human answers "Implement" at
implementation_gate; there, the host's engineer/test-engineer/code-reviewer subagents write, test, and review the implementation in an isolated worktree, and nothing is pushed or turned into a PR without the mandatorypr_gateapproval. This server only emitsspawn_subagentsactions — it never edits source files or pushes branches itself. - It does not validate prose quality. Hard Output Rules check structural invariants (FR numbering, AC traceability, NFR shape, cross-references). They do not check whether a sentence is well-written or persuasive. That is what the multi-judge phase is for, and even there the judges return verdicts on claims — atomic assertions — not on style.
- The judge phase is end-to-end testable but the judges are not deterministic. In tests we use a canned dispatcher that returns 100% PASS by construction; the
distribution_suspiciousdetector exists precisely because real judge panels can also degenerate into confirmatory consensus, and we do not pretend otherwise. - The KPI gates are calibrated, not hand-picked.
iteration_count_max,wall_time_ms_max, andmean_section_attempts_maxare calibrated against the K=100 frozen baseline with Clopper-Pearson exact CIs, per-machine-class wall_time normalization, andloadCalibratedGates+hold_provisionalratchet protection. The lock file commits a content-hash of the baseline; mutating it post hoc fails the seal verification. Where data is still thin, gates remainhold_provisionalrather than locked. See docs/PHASE_4_PLAN.md for the full pre-registration. - Citation presence ≠ citation validity. A
// source: Knuth 1998comment satisfies the convention whether or not Knuth 1998 exists or supports the value. We enforce that the citation IS THERE; the cross-audit cycle (genius + team review every phase) is what keeps it honest.
Reproducing the audit cycle
The repo ships a multi-agent cross-audit workflow. After every non-trivial phase:
Each agent reads the current state of the code (not from memory) and produces a ranked finding list, severity-ranked. Findings are closed in the cycle that raised them; anything that cannot be closed without new measurement is carried with the evidence required to close it written down, so a deferral is a stated obligation rather than a silence.
Project layout
License
MIT — see LICENSE.
Project documents: ROADMAP (what the project intends to do, and what it will not do, for the next year) · CONTRIBUTING (how to propose a change, and the testing policy) · GOVERNANCE (who decides, and what happens to the project if the maintainer stops) · SECURITY (how to report a vulnerability, and the supply-chain guarantees) · Assurance case (the security argument and where it stops) · CODE OF CONDUCT · CHANGELOG.
This software is the independent work of Clément Deust. It was developed outside any employment relationship and is not affiliated with, endorsed by, or owned by any past or present employer. It is part of the ai-architect ecosystem (Cortex, ai-architect-mcp-codebase, zetetic-team-subagents).
Citations and primary sources for algorithms and constants are documented
inline in the code via // source: annotations per the project's
source-discipline rules. Removing those annotations does not change the
license terms but does forfeit attribution to the original research the
code is built on.
Don't ship a PRD that hallucinates a function it can't measure.
Ship one whose every claim was judged by Pearl, Curie, Liskov, and a panel of seven others, validated against the call graph, and grounded in what Cortex remembers from yesterday.
来源:README.md,提交 7d8fa1f
工具
0版本历史
1- v0.8.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分