
Deterministic
io.github.archradhq由 GitHub 帳號 archradhq 發布v0.4.1更新於 Oct 24, 2026
Deterministic IR/IR-LINT validation, policy packs, drift vs exports (archrad). Apache-2.0.
發布方自己的服務:Deterministic
概覽
ArchRAD Deterministic 以確定性規則驗證架構圖(IR),可從程式碼倉庫草擬 IR,並檢查設計與實際程式碼的落差。
- 可以做什麼
- 驗證與檢查架構 IR 圖,提供規則代碼與修正建議,依代碼解釋單一規則,並為簽章策略包產生校驗清單。掃描倉庫中的 Docker Compose、Kubernetes、Terraform、OpenAPI、相依清單與原始碼來草擬 IR,或僅從原始碼重建 IR,每個節點都標註 file:line 並附上信心程度。將 OpenAPI 規格或 Backstage 目錄匯入為 IR,並依節點 id 合併多個 IR 片段。將撰寫的 IR 與實際程式碼庫比對以找出實作落差,並檢查 IR 與磁碟上產生的程式碼是否一致。把 IR 匯出為 FastAPI 或 Express 加 Docker,並可透過設定檔與結束碼在 CI 中阻擋合併。
- 適用情境
- 適合把架構模型當成程式碼維護的團隊:讓助理檢查架構規則、從現有倉庫草擬架構圖,或在合併前確認實際程式碼是否仍符合文件中的設計。
- 執行需求
- 以本機程序執行,透過 npm 套件 @archrad/deterministic 安裝,需要 Node.js 與 npm。未宣告任何驗證、環境變數或請求標頭。從 URL 匯入 OpenAPI 需要網路存取,可能還需在命令列傳入驗證標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Deterministic,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@archrad/deterministic
[Apache-2.0] [no LLM] [no account]
Your architecture drifts before you write a single line of code. archrad validate catches it — deterministically, in CI, before the PR merges.
Define your system as a graph. ArchRAD compiles it, lints it against architecture rules, and tells you exactly what's wrong — with rule codes, not opinions.
New in 0.7.x —
archrad demoruns a full example with zero setup, andarchrad scandrafts an IR from any repo with every node cited tofile:line. Lint findings only decrease in this release; nothing that passed on 0.6.x can start failing. See the changelog.
Quick start (60 seconds)
No IR file, no flags, no config — runs from any directory. Lints a bundled example and shows you the findings:
Then run it on your own repo
scan reads your Docker Compose, Kubernetes manifests, Terraform, OpenAPI, package manifests, and source
code, then grades every node by confidence so you can see what was parsed versus guessed. The output is a
normal IR file — review it, edit it, commit it.
Already have an OpenAPI spec or a Backstage catalog? Skip the scan:
Once a graph is committed, archrad validate is your CI gate — exit 1 blocks the merge.
What it does
ArchRAD is a blueprint compiler and governance layer. You define your architecture as an IR — nodes, edges, allowed connections — and ArchRAD validates it against a deterministic rule engine. The same IR, the same rules, the same inputs always produce the same findings.
Ingest + merge workflows: docs/INGEST.md. All commands / flags: docs/CLI_REFERENCE.md. Codegen (export): docs/EXPORT.md.
Draft an IR from a real repo (archrad scan)
archrad scan points at a repository and emits a draft IR — never a final
answer, always something to review and edit. It runs six extractors, graded by
how much they have to guess:
Every node and edge carries config.provenance[] — inferred_from: "file:line",
a confidence, and which extractor found it — so nothing has to be taken on
faith. When two extractors describe the same thing, scan merges them (keeping
the highest-confidence body, unioning all provenance) instead of duplicating or
erroring.
CLI scans default to --scope production so fixtures, documentation examples,
Storybook stories, and test-only manifests do not become production findings.
Use --scope all when those artifacts are the subject of the review. Library
callers retain the backwards-compatible scope: 'all' default.
The output is a normal IR file — pipe it straight into archrad validate once
you've reviewed it. Full flags: docs/CLI_REFERENCE.md.
Implementation governance (archrad reconstruct + --codebase)
"The IR looks clean — but is that what was actually shipped?"
The validation pipeline above checks your authored IR (the design contract). The --codebase flag bridges the gap to the real codebase by reconstructing an IR from source code and comparing them.
The "dummy IR" attack — and how to catch it
A developer can author a compliant IR (passes all IR-STRUCT-* and IR-LINT-* rules) while the actual code bypasses the documented architecture. The most dangerous pattern: an IR that shows a clean service layer but code that directly queries the database.
When --codebase is provided, the pipeline runs three stages:
- IR-STRUCT-* structural validation on the authored IR
- IR-LINT-* architecture lint on the authored IR
- IR-DRIFT-IMPL-* comparison of authored IR vs reconstructed codebase IR
IR-DRIFT-IMPL-* rules
Implementation drift uses a separate exit threshold: --fail-on, --fail-on-warning, and --max-warnings apply only to IR-STRUCT-, IR-LINT-, and merged PolicyPack findings. IR-DRIFT-IMPL-* are gated solely by --impl-drift-fail-on (default: drift severities error fail the command).
IR-DRIFT-IMPL-003 is the critical one. An error there means the authored IR hides a direct DB dependency.
Reconstruct standalone
Supported languages
Service decomposition (Node.js)
The reconstructor detects service boundaries and creates one node per service rather than collapsing everything into a single gateway:
Edges between nodes reflect what the reconstruction found:
- gateway → service edges are added for all decomposed services.
- service → database edges appear only when the route file itself contains a DB import or env var reference (not when DB access is hidden behind a shared utility module).
Node naming
DB and cache nodes use the most user-recognizable name available:
- Env var name —
process.env.REDIS_URL→ node named"redis",process.env.SESSION_REDIS_URL→"session-redis" - Connection variable name —
const userDb = new Pool(…)→ node named"userDb"(for unique variable names) - Library / driver name — fallback when no env var or named variable is detectable
Node IDs and names never include env_var or other detection-method metadata.
External service identification
Outbound HTTP/gRPC calls create distinct external nodes per destination:
axios.post('https://api.stripe.com/…')→ node"stripe"fetch('https://auth0.com/oauth/token')→ node"auth0"new PaymentServiceClient('payments-svc:50051')→ node"payment"(gRPC)- Generic fallback for clients without a detectable URL: one shared
"external-service"node
Honest scope limits
Reconstruction is best-effort signal, not certainty:
- Dynamic patterns —
eval, reflection, metaprogramming, and generated code are not detected. - Runtime config — topology decisions made at runtime (feature flags, config-driven routing) cannot be statically analyzed.
- Cross-language services — a single codebase containing multiple language runtimes reduces accuracy.
- Heavy abstractions — macro-based or annotation-processor-heavy frameworks may obscure routes or connections.
- Shared data access layers — when DB connections live in a shared utility file (e.g.,
db.ts,firebaseAdmin.ts) rather than the route files themselves, those connections are not linked to individual service nodes. The reconstructed IR honestly omits edges it cannot trace statically.
Interpreting lint findings on reconstructed IR
Run archrad validate on a reconstructed IR and you may see:
IR-LINT-DIRECT-DB-ACCESS-002 on reconstructed IR is the high-signal rule: if it fires on a gateway node, it means the entry file itself has direct DB access (not delegated to a service layer). If the decomposition correctly identified service nodes between the gateway and the database, this rule should be silent.
Treat reconstructed IR as a draft for human review, not as ground truth. Use it to catch obvious drift between authored architecture and actual code, not as an authoritative picture of the system.
Treat IR-DRIFT-IMPL-* findings as "review required", not absolute truth. The reconstructed IR is signal, not certainty.
Worked example — catching a "dummy IR"
Authored IR (authored.json) shows clean layered architecture:
But src/api/routes.ts contains:
Running archrad validate --ir authored.json --codebase ./src:
The IR said no direct DB access. The code said otherwise. IR-DRIFT-IMPL-003 caught the gap.
Project config (archrad.yml)
Drop an archrad.yml at the root of your repo and skip re-typing flags:
archrad walks upward from the CWD looking for archrad.yml (or
archrad.yaml). Explicit CLI flags always override the config. Use
--no-config to ignore any discovered file, or --config <path> to
point at a non-standard location. Full schema: docs/CONFIG.md.
Fast inner loop: archrad lint + archrad explain
archrad lint is the fast inner loop; use archrad validate once before the CI gate to also enforce IR structural shape. With archrad.yml at repo root, both run with no flags.
CI integration
MCP server (Cursor / Claude Desktop)
After install, archrad-mcp is on your PATH. Add it to your IDE:
Your agent can call the same engine as the CLI via six MCP tools (e.g. archrad_validate_ir, archrad_lint_summary, archrad_validate_drift, archrad_policy_packs_load, archrad_list_rule_codes, archrad_suggest_fix). See docs/MCP.md for parameters and local testing.
How it works (architecture)
Validation levels (quick contract)
- JSON Schema validation — IR document shape vs
schemas/archrad-ir-graph-v1.schema.json(editor/CI; optional at runtime). - IR structural validation —
validateIrStructural: arrays, ids, HTTPconfig, edge refs, cycles (IR-STRUCT-*). Uses an internal normalized graph (seedocs/IR_CONTRACT.md). - Export-time generated OpenAPI structural validation — Parse + required fields on the generated
openapi.yaml(document shape, not Spectral).
Architecture lint (IR-LINT-*) sits after structural checks: rule visitors on the parsed graph (heuristics, not schema).
Validation layers (naming)
- IR structural validation: duplicate/missing node ids, bad HTTP
config.url/config.method, unknown edge endpoints, directed cycles. - Architecture lint: Implemented as a registry of visitor functions on a parsed graph (
buildParsedLintGraph→LINT_RULE_REGISTRYinsrc/lint-rules.ts). If the IR cannot be parsed,buildParsedLintGraphreturns{ findings }(IR-STRUCT-) instead ofnull; useisParsedLintGraph()or callvalidateIrLint, which forwards those findings. Each rule returnsIrStructuralFinding[];runArchitectureLinting/validateIrLintflatten them. Custom org rules: composerunArchitectureLintingwith your own(g) => findingsin CI (worked example:docs/CUSTOM_RULES.md), or fork and append toLINT_RULE_REGISTRYif the stockarchrad validateCLI must emit your codes. CLIarchrad validate/archrad exportprint lint under **Architecture lint (IR-LINT-)** (grouped separately from structural). Codes include IR-LINT-DIRECT-DB-ACCESS-002, IR-LINT-SYNC-CHAIN-001, IR-LINT-NO-HEALTHCHECK-003, IR-LINT-HIGH-FANOUT-004, IR-LINT-ISOLATED-NODE-005, IR-LINT-DUPLICATE-EDGE-006, IR-LINT-HTTP-MISSING-NAME-007, IR-LINT-DATASTORE-NO-INCOMING-008, IR-LINT-MULTIPLE-HTTP-ENTRIES-009, IR-LINT-MISSING-AUTH-010, IR-LINT-DEAD-NODE-011. Sync-chain depth counts synchronous edges only; mark message/queue/async hops viaedge.metadata.protocol/config.async(seeedgeRepresentsAsyncBoundaryinlint-graph.tsanddocs/ENGINEERING_NOTES.md). - Generators →
openapi.yaml, handlers, deps. - Golden path →
make run/docker compose up --build. - OpenAPI document shape on the bundle — not Spectral-level lint. Issues →
openApiStructuralWarnings.
IR contract: schemas/archrad-ir-graph-v1.schema.json. Parser boundary + normalized shapes: docs/IR_CONTRACT.md (normalizeIrGraph → materializeNormalizedGraph).
Trust builder: IR-STRUCT-* errors block export; IR-LINT-* warnings are visible and can gate CI via --fail-on-warning / --max-warnings; OpenAPI shape issues surface as export warnings.
Reference (OSS): docs/DRIFT.md (deterministic validate-drift), docs/RULE_CODES.md (finding codes; MCP docsUrl targets GitHub anchors), docs/MCP.md (MCP tools + local testing).
Codegen vs validation (retry, timeouts, policy)
Generators may emit retry/timeout/circuit-breaker code when the IR carries matching edge or node config (e.g. retryPolicy). That is code generation, not a guarantee. OSS does not currently require or lint “every external call must have timeout/retry” — that class of rule is semantic / policy and fits ArchRad Cloud or custom linters on top of the IR.
Ways to use it
MCP (Cursor example): after npm i -g @archrad/deterministic (or npx), add a server with command archrad-mcp and no args (stdio). Pass ir inline or irPath to a JSON file for large graphs. archrad_suggest_fix returns curated text for a finding code (e.g. IR-LINT-MISSING-AUTH-010) — not machine-generated IR patches. Step-by-step testing (smoke script, MCP Inspector, Cursor chat prompts): docs/MCP.md, section Local testing.
CLI
Input is structured IR (JSON), not natural language. There is no archrad export --prompt "...". Pass a graph file (nodes/edges).
Fixtures (in this repo): fixtures/minimal-graph.json (small); fixtures/demo-direct-db-violation.json / fixtures/demo-direct-db-layered.json (before/after IR-LINT-DIRECT-DB-ACCESS-002); fixtures/ecommerce-with-warnings.json (many lint rules); fixtures/payment-retry-demo.json (retry-related codegen in export). --target python is the FastAPI bundle; there is no separate fastapi target. To go from plain English → IR, use ArchRad Cloud or your own LLM step; this package only does IR → files.
Recording demos and GIFs (VHS, storyboards, drift replay): scripts/README_DEMO_RECORDING.md only — not required to use the CLI.
OpenAPI → JSON (spec as source of truth): each operation under paths becomes an http node (config.url + config.method). Then validate and export like any other IR:
OpenAPI security → IR → lint: ingestion copies global and per-operation security requirement names onto each HTTP node as config.security (sorted, deterministic). An operation with explicit security: [] becomes config.authRequired: false (intentionally public). If the spec declares no security at any level, nodes are left without those fields — then archrad validate can surface IR-LINT-MISSING-AUTH-010 on HTTP-like entry nodes (compliance gap from the spec artifact alone).
YAML → JSON (lighter authoring): edit fixtures/minimal-graph.yaml (or your own file) and compile to IR JSON, then validate or export:
YAML must have either top-level graph: (object) or top-level nodes: (array); bare graphs are wrapped as { "graph": { ... } } automatically.
After npm install -g or npx (typical):
From a git clone (contributors): run npm ci && npm run build in the package root (there is no prepare hook — see docs/ENGINEERING_NOTES.md), then use node dist/cli.js the same way you would use archrad (e.g. node dist/cli.js validate --ir fixtures/minimal-graph.json).
Deterministic drift (thin, OSS): compare an existing export tree on disk to a fresh export from the same IR. Detects missing / changed generated files (line endings normalized). Optional --strict-extra flags files present on disk but not in the reference export. Not semantic “does code match intent” — ArchRad Cloud adds builder/UI drift checks and broader governance.
Example: validate architecture
Example output (stderr):
Structural errors look like ❌ IR-STRUCT-... with Fix: lines. Use --json to consume findings in GitHub Actions or other CI.
--ir— JSON:{ "graph": { "nodes", "edges", "metadata" } }or a raw graph (CLI wraps it).--target—python|node|nodejs--out— output directory (created if needed)--host-port <n>— host port Docker publishes (default 8080; container still listens on 8080 inside). Same as envARCHRAD_HOST_PORT.--skip-host-port-check— don’t probe127.0.0.1before export.--strict-host-port— exit with error if the host port appears in use (CI-friendly).--danger-skip-ir-structural-validation— UNSAFE: skipvalidateIrStructuralbefore export (never in CI). Parse/normalize failures (invalid root, empty graph) are still detected viavalidateIrLintand block export withIR-STRUCT-*inirStructuralFindings. A hidden--skip-ir-structural-validationremains as a deprecated alias.--skip-ir-lint— skipvalidateIrLintduring export.--fail-on-warning/--max-warnings <n>— if set, no files are written when IR structural + lint findings violate the policy (same semantics asvalidate).
By default, if 8080 (or your --host-port) looks busy on localhost, the CLI warns so you can change the port before docker compose fails with a bind error.
Export runs IR structural validation, then architecture lint, then codegen. Structural errors abort with no files written. irLintFindings contains only IR-LINT-*; IR-STRUCT-* from a failed parse always appear under irStructuralFindings (including when structural validation was skipped). Lint warnings print by default; use --fail-on-warning / --max-warnings to block writes for CI.
Library
Optional: isLocalHostPortFree / normalizeGoldenHostPort from the same package if you want your own preflight.
Golden path (contributors — local clone)
This path assumes you cloned the repo and ran npm ci && npm run build in the package root. If you only installed with npm install -g @archrad/deterministic, use archrad instead of node dist/cli.js (same flags).
You should see 422 Unprocessable Entity (FastAPI/Pydantic) or 400 with a clear body — proof the stack is live and validation matches the spec, not a silent 500.
Quick check from a clone: cd packages/deterministic && npm ci && npm run build && npm test, then export to ./tmp-out, cd tmp-out && make run, curl as above. Use --host-port 18080 (or node dist/cli.js export ... --host-port 18080) if 8080 is busy.
Optional: bash scripts/golden-path-demo.sh runs the same flow. Demo recording (GIFs, tapes, drift replays): scripts/README_DEMO_RECORDING.md.
Open source vs ArchRad Cloud
This repository is only the deterministic engine — local, offline, no phone-home.
You can depend on this CLI and library without ArchRad Cloud. The cloud product stacks collaboration and AI on top of the same deterministic contract.
Contributing
See CONTRIBUTING.md.
License
Apache-2.0 — see LICENSE.
來源:README.md,提交 3018acf
工具
0版本歷史
1- v0.4.1最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。
其他 Deterministic 整合
Deterministic
sh.deterministic官方發布者
一個遠端 MCP 伺服器,讓助理對模擬結果進行基於物理的驗證,並回傳含逐項檢查結論的收據。
EU EN-16931 & XRechnung Deterministic Validator
eu.iotpay
遠端 MCP 端點,用於驗證 EN 16931 與 XRechnung 電子發票 XML,並簽發 Ed25519 簽章的可驗證憑證。

Website Change Monitor & Deterministic Diff
由 GitHub 帳號 industrial-platform-ai 發布
付費遠端 MCP 服務,用來偵測公開網頁的確定性變化,回傳雜湊與文字差異,適合週期性監控。

SQAI — deterministic, read-only structured data
由 GitHub 帳號 thyn-ai 發布
本機 stdio MCP 伺服器,為助理提供受治理、確定性、唯讀的結構化資料查詢與運算工具,可讀取 CSV 等資料來源。
Quesen Deterministic Agent Decision Layer
由 GitHub 帳號 Shxnque 發布
遠端 MCP 端點,讓助理在執行動作前取得確定性的 PROCEED/REVIEW/SKIP 風險裁決,並附原因碼與可重算的收據。