arkgate 2.11.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +70 -41
  3. package/bin/ark-check.mjs +95 -36
  4. package/bin/ark-mcp.mjs +11 -5
  5. package/bin/ark-shared.mjs +88 -56
  6. package/bin/ark.mjs +97 -29
  7. package/bin/lib/agent-gates.mjs +79 -2093
  8. package/bin/lib/architecture-scan.mjs +8 -0
  9. package/bin/lib/ci-and-commands.mjs +392 -0
  10. package/bin/lib/codex-home.mjs +7 -0
  11. package/bin/lib/config-contract.mjs +331 -0
  12. package/bin/lib/deploy-path.mjs +205 -0
  13. package/bin/lib/doctor-plan.mjs +43 -16
  14. package/bin/lib/enforcement-profiles.mjs +97 -0
  15. package/bin/lib/gate-files.mjs +223 -0
  16. package/bin/lib/hook-templates.mjs +99 -0
  17. package/bin/lib/host-support-matrix.mjs +77 -0
  18. package/bin/lib/install-migrate.mjs +473 -0
  19. package/bin/lib/mcp-adoption.mjs +455 -0
  20. package/bin/lib/open-html.mjs +75 -0
  21. package/bin/lib/presets.mjs +6 -2
  22. package/bin/lib/safety-diagnostics.mjs +31 -11
  23. package/bin/lib/skill-install.mjs +323 -0
  24. package/bin/lib/ts-resolve.mjs +2 -1
  25. package/bin/lib/typescript-host.mjs +88 -0
  26. package/bin/lib/weakest-link.mjs +417 -0
  27. package/bin/lib/write-path-capabilities.mjs +182 -0
  28. package/bin/lib/write-path-detect.mjs +101 -0
  29. package/dist/configContract-iBLxx5Tz.d.cts +53 -0
  30. package/dist/configContract-iBLxx5Tz.d.ts +53 -0
  31. package/dist/eslint/index.cjs +375 -13
  32. package/dist/eslint/index.cjs.map +1 -1
  33. package/dist/eslint/index.d.cts +30 -20
  34. package/dist/eslint/index.d.ts +30 -20
  35. package/dist/eslint/index.js +375 -13
  36. package/dist/eslint/index.js.map +1 -1
  37. package/dist/index.cjs +723 -61
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +95 -5
  40. package/dist/index.d.ts +95 -5
  41. package/dist/index.js +716 -61
  42. package/dist/index.js.map +1 -1
  43. package/dist/nestjs/index.cjs +150 -42
  44. package/dist/nestjs/index.cjs.map +1 -1
  45. package/dist/nestjs/index.d.cts +2 -1
  46. package/dist/nestjs/index.d.ts +2 -1
  47. package/dist/nestjs/index.js +150 -42
  48. package/dist/nestjs/index.js.map +1 -1
  49. package/dist/runtime/index.cjs +723 -61
  50. package/dist/runtime/index.cjs.map +1 -1
  51. package/dist/runtime/index.d.cts +3 -2
  52. package/dist/runtime/index.d.ts +3 -2
  53. package/dist/runtime/index.js +716 -61
  54. package/dist/runtime/index.js.map +1 -1
  55. package/dist/{types-BZ17b9i5.d.cts → types-BxBwnBpC.d.cts} +9 -36
  56. package/dist/{types-BZ17b9i5.d.ts → types-Wcs_l1_J.d.ts} +9 -36
  57. package/docs/agent-guide.md +43 -21
  58. package/docs/ai-gates.md +53 -18
  59. package/docs/configuration.md +97 -0
  60. package/docs/enthusiast/README.md +3 -3
  61. package/docs/enthusiast/how-to-agent-gates.md +7 -3
  62. package/docs/migrate-from-ark-runtime-kernel.md +3 -0
  63. package/docs/package-surface.md +22 -10
  64. package/docs/production-hardening.md +15 -2
  65. package/docs/threat-model.md +65 -0
  66. package/docs/typescript-support.md +3 -3
  67. package/package.json +15 -2
  68. package/schemas/ark.config.schema.json +750 -0
  69. package/server.json +2 -2
  70. package/templates/hooks/pre-commit-ark +37 -0
  71. package/templates/skills/ark-autopilot.md +77 -45
  72. package/templates/skills/ark-coverage.md +2 -2
  73. package/templates/skills/ark-explain.md +2 -1
  74. package/templates/skills/ark-explore.md +135 -34
  75. package/templates/skills/ark-runtime.md +8 -5
  76. package/templates/skills/ark-upgrade.md +36 -16
  77. package/tests/fixtures/ts-consumer/ark.config.json +2 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,153 @@ All notable changes to ArkGate (`arkgate`; formerly `ark-runtime-kernel`) are do
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 2.13.0 — 2026-07-11
8
+
9
+ - Added the stable, deterministic analysis IR and public in-memory API: `loadContract`,
10
+ `analyzeProject`, `analyzeChange`, and `explainViolation`.
11
+
12
+ ### Fixed
13
+
14
+ - **Temp-worktree release verification:** Codex multi-project fixtures now keep the simulated
15
+ primary project outside temp-root policy even when the repository itself is checked out under
16
+ `/tmp`, so the release confidence gate is reproducible without weakening fail-closed temp MCP
17
+ rewrites.
18
+ - **Test and Codex-home isolation:** Vitest now redirects `CODEX_HOME` to a disposable test home,
19
+ so direct helper calls and spawned CLIs cannot rewrite the developer's real Codex config. Temp
20
+ project installs also recognize an explicitly exported default `~/.codex` as the real home and
21
+ skip implicit MCP rewiring unless `--codex-home` is requested.
22
+ - **Workflow retry boundary:** `RetryPolicy` now retries only `step.execute` failures and
23
+ timeouts. A snapshot-store or completion-audit failure after a successful effect is terminal,
24
+ enters compensation, and never executes the completed effect again.
25
+ - **Scanner bypass corpus:** forbidden-global checks now use single-file TypeScript symbols, so
26
+ local `fetch` / `Date` bindings do not false-positive while ambient aliases and
27
+ `globalThis.Date.now()` remain violations. CLI, AICodeGate, and ESLint share the verdict.
28
+ TypeScript `import x = require('...')` now creates a dependency edge, and direct
29
+ `require(expr)` emits `DYNAMIC_REQUIRE_NOT_ALLOWLISTED` (strict profiles fail unless the file
30
+ is reviewed in `dynamicImportAllowlist`). The scan cache is versioned past the old semantics.
31
+
32
+ ### Added
33
+
34
+ - **Versioned configuration contract:** `ark.config.json` now carries `$schema` and
35
+ `schemaVersion: "1.0"`. One canonical loader validates and migrates the contract for CLI, MCP,
36
+ and ESLint with path-specific diagnostics and a fail-closed unknown-key policy. The generated
37
+ JSON Schema ships at the stable `arkgate/schema` subpath; unversioned configs from the previous
38
+ major migrate deterministically in memory.
39
+ - **Active-host enforcement capabilities:** doctor and adoption checks now project
40
+ `hard-write`, `advisory-write`, `merge-gate`, and `repair-payload` from the active host only,
41
+ with evidence paths and a separate repo-wide inventory. Claude/Grok hooks can no longer make
42
+ Codex, Cursor, or an unknown host appear hard-enforced; human doctor output names the host and
43
+ separates advisory MCP checks from the shared CI check and its external required-status policy.
44
+ - **Host-compatible enforcement profiles:** generated CI now uses `--strict-merge`, while
45
+ `--strict` remains a compatibility alias; neither depends on an editor hook. The optional
46
+ `--require-write-hook <host>` check verifies Claude/Grok explicitly, reports Cursor/Codex as
47
+ advisory-write plus the shared CI check only, and makes `ark start` reject impossible,
48
+ mismatched, or preserved-incompatible requests before writing project files.
49
+ - **Executable regression confidence gate:** `npm run test:confidence` now combines the existing
50
+ broad Vitest coverage thresholds with real Stryker mutation testing over write-path detection,
51
+ dependency extraction, forbidden-global detection, baseline keys, and workflow retry logic.
52
+ CI and both npm release paths invoke the same gate; mutation score fails below 90%.
53
+ - **Q2 repair dogfood closed:** deny → `ARK_REPAIR_JSON`/`autoPatch` → host re-inject →
54
+ revalidation allow proven via shipped `bin/ark-mcp.mjs` (Claude/Grok hooks already
55
+ `--hook-repair`; `doctor.writePath.mode = repair`).
56
+ - **Q3 weakest-link sensors:** `bin/lib/weakest-link.mjs` + doctor adoption gaps
57
+ (`enforcement-ci-*`, config drift, pre-commit missing); maintained
58
+ `templates/hooks/pre-commit-ark`; optional `ARK_DOCTOR_GITHUB=1` branch-protection
59
+ report (honest unavailable / not-protected — never fake green).
60
+ - **Q5 scale bench:** `scripts/ark-scale-bench.mjs` / `npm run bench:scale` (real
61
+ ark-check cold/warm p50/p95 on generated trees).
62
+ - **Q6 module budgets:** `scripts/check-module-budgets.mjs` / `npm run check:module-budgets`.
63
+ - **Q8 fault-injection tests:** compensation failure audit, cancellation-ignoring timeout,
64
+ outbox retry attempts + clear (durability boundary).
65
+ - **Q9 threat model + package allowlist:** `docs/threat-model.md`,
66
+ `scripts/verify-package-files.mjs` / `npm run check:package-files`.
67
+
68
+ ### Changed
69
+
70
+ - **Product identity retained:** ArkGate, `arkgate`, the `arkgate*` / `ark*` commands,
71
+ `ark.config.json`, `ark://`, `ARK_*`, the existing GitHub repository, and `arkgate.online` remain
72
+ canonical. The unpublished local rename experiment was reversed before any external cutover.
73
+ - **Truthful host support matrix and runtime status:** one capability-backed matrix now drives
74
+ README and generated `AGENTS.md` guarantees for Claude, Grok, Cursor, and Codex. Doctor exposes
75
+ both the supported host profile and repository evidence; public docs distinguish hard local
76
+ hooks, advisory MCP, CI checks, and required-status merge blocking. The optional runtime/Nest
77
+ surface is explicitly experimental and is not required for architecture-gate adoption.
78
+ - **Active host vs deferred Codex on upgrade/doctor:** `/ark-upgrade` greens the
79
+ **session host** first; Codex `$CODEX_HOME` prompts/MCP multi-project debt is
80
+ **deferred** when the session host is **known and not Codex** (Grok/Claude/Cursor).
81
+ Unknown host (CI/plain shell) keeps original severity. Doctor marks deferred gaps
82
+ `deferred: true` (severity `info`), prefixes the message, and omits them from Top
83
+ actions. Temp/upgrade MCP `--root` stays urgent (fail-closed). New helpers:
84
+ `detectActiveAgentHost`, `codexConcernIsActive` (do not treat `CODEX_HOME` alone
85
+ as Codex). `ark-check` advisory for stale Codex-home skills notes the deferral.
86
+ Completion contract adds **Active host** / **Deferred hosts**.
87
+ - **ROADMAP Track Q:** Q2 `done`; Q3/Q5/Q6/Q8/Q9 `doing` with residual external/DoD
88
+ items listed; Q4/Q7/Q10 remain `todo` (no false complete).
89
+
90
+ ## 2.12.0 — 2026-07-10
91
+
92
+ ### Fixed
93
+
94
+ - **Install agent gates on temp roots:** skip rewriting the developer's real
95
+ `~/.codex/config.toml` when the project root is a temp/upgrade scratch and
96
+ `CODEX_HOME` is unset. Home MCP wire failures no longer fail an otherwise
97
+ successful repo gate install (sandbox/EPERM). Explicit `CODEX_HOME` and
98
+ `--codex-home` still wire as before.
99
+ - **Q1 coverage floors (broad include, 80/85/95):** Vitest thresholds statements/lines **≥80%**,
100
+ branches/functions **≥85%** on the **full product unit surface** (`src/**` + `bin/lib/**` +
101
+ `bin/ark-shared.mjs`; only process-entry shells excluded — no cherry-picked enforcement-core
102
+ include). Per-path critical floors: write-path-detect / auto-patch / prepare-write /
103
+ safety-diagnostics / baseline-key / graph-cycles at **≥95%** branch. Real branch-driving tests
104
+ under `tests/unit/static-check/` (critical + surface/topup/seam suites). Two consecutive
105
+ green `npm run test:coverage` captures (stmts/lines **92.71%**, branches **85%**, functions
106
+ **94.76%**; critical modules all **≥95%** branch).
107
+ - **agent-gates modularization:** thin facade (`bin/lib/agent-gates.mjs` ~100 LOC) re-exports
108
+ `gate-files`, `skill-install`, `ci-and-commands`, `mcp-adoption`, `install-migrate`,
109
+ `typescript-host`, `hook-templates`, `write-path-detect`, plus field/codex helpers.
110
+ `detectDeployPathQuality` extracted to `bin/lib/deploy-path.mjs` so `mcp-adoption.mjs` stays
111
+ under the 600 LOC module budget. Import hygiene on extract modules; `loadTypeScript` uses
112
+ `__arkCheckCli` for the nested arkgate TypeScript fallback.
113
+ - **Deny→repair CI proof:** `tests/unit/static-check/writePathDetect.test.ts` drives
114
+ shipped `bin/ark-mcp.mjs --hook --hook-repair` and asserts `ARK_REPAIR_JSON` /
115
+ `ARK_AUTOPATCH_JSON` on deny (exit 2); reject-only without repair flag still supported.
116
+ - **Dogfood write path repair:** local Claude/Grok hooks use `--hook-repair`; doctor
117
+ reports `writePath.mode = repair` on this tree.
118
+ - **Self-hosted AGENTS.md:** `--install-agent-gates --force` no longer overwrites library
119
+ mother-repo Identity (`skipped-self-hosted`).
120
+ - **hexagonal-order-api:** `safety.allowInMemory` for ephemeral demo kernel; prefer
121
+ `arkgate/runtime` imports; `npm run check` green under `--strict-config`.
122
+ - **multi-app / monorepo rules:** deny App→Persistence, Presentation→Domain, and
123
+ Persistence→Presentation (parity with crud-product starter).
124
+ - **Generated CI Node default lags local npm (again):** when a project had no
125
+ `.nvmrc` / `engines.node`, the Ark architecture gate workflow defaulted to
126
+ Node 22. Lockfiles written on Node 24/26 then failed `npm ci` with
127
+ "Missing: … from lock file" before `ark-check` ran — CI green, Ark red.
128
+ Detection order is now `.nvmrc` / `.node-version` → `engines.node` → **highest
129
+ `node-version` from sibling workflows** (excludes `ark-check.yml` so a stale
130
+ gate cannot re-pin itself) → default **24**. Refresh existing gates with
131
+ `ark-check --install-agent-gates --force` (or edit `node-version` in
132
+ `.github/workflows/ark-check.yml`).
133
+
134
+ ### Changed
135
+
136
+ - **Hook templates extracted** to `bin/lib/hook-templates.mjs` (agent-gates seam).
137
+ - **Write-path detect extracted** to `bin/lib/write-path-detect.mjs` (doctor W5; re-exported
138
+ from agent-gates).
139
+ - **Coverage thresholds** raised to Q1 floors on the broad include set: statements/lines **≥80**,
140
+ branches/functions **≥85**, critical write/safety modules **≥95%** branch (see Fixed above).
141
+ - **`/ark-explore` skill:** decision-grade recon — field path (run starters/checks),
142
+ installed hooks vs install templates, coupling via fan-in/exports (not LOC alone),
143
+ ranked “así te lo re-soluciono” rows only when residual changes action; ENFORCE /
144
+ empty plan treated as baseline, not the story. **v2.1:** output modes (recon vs
145
+ dual-plan seed, no multi-week roadmaps by default); path-correct vs design-correct
146
+ + semantic false-green; success signals and kill-switches on bets (anti-vanity).
147
+ - **`/ark-autopilot` skill:** explore-first (decision-grade), **dual plan** —
148
+ A remediation from `--plan` + B pattern/evolution bets (never auto-apply B as
149
+ mechanical-safe); empty plan no longer means “healthy” without explore/B.
150
+ - **Day-zero origin first:** `ark start` / `ark init` freeze `.ark/reports/origin.*`
151
+ immediately after `ark.config.json` exists and **before** agent docs, skills, and CI
152
+ templates. Later `--report` still shows evolution vs that snapshot.
153
+
7
154
  ## 2.11.0 — 2026-07-10
8
155
 
9
156
  Fail-closed enforcement hardening: `--strict` now combines contract coverage, installed-gate
package/README.md CHANGED
@@ -23,8 +23,8 @@ and makes sure a “green” check means something real.
23
23
  If you remember nothing else:
24
24
 
25
25
  ```text
26
- 1. npx arkgate start ← install shape + gates + origin report
27
- 2. /ark-autopilot ← in your agent: adopt, fix, leave gates on
26
+ 1. npx arkgate start ← walk tree contract **day-zero origin** → gates
27
+ 2. /ark-autopilot ← explore first, dual plan, safe fixes, leave gates on
28
28
  3. npx arkgate-check --doctor ← “where am I?” anytime (one status screen)
29
29
  ```
30
30
 
@@ -43,15 +43,19 @@ commands above).
43
43
 
44
44
  ## What it is (30 seconds)
45
45
 
46
- **ArkGate** = a machine-readable architecture file (`ark.config.json`) enforced in two places
47
- you always care about:
46
+ **ArkGate** = a machine-readable architecture file (`ark.config.json`) enforced at CI, with
47
+ host-specific protection while an agent writes:
48
+
49
+ **Name note:** this is the TypeScript architecture-enforcement package published as `arkgate`.
50
+ It is not affiliated with the separate Archgate CLI project.
48
51
 
49
52
  | When | Tool |
50
53
  |------|------|
51
- | **While the AI writes** | `arkgate-mcp` write gate (blocks bad edits) |
52
- | **Before merge** | `arkgate-check` CI |
54
+ | **While the AI writes** | Hard PreToolUse block on Claude/Grok; advisory MCP on Cursor/Codex |
55
+ | **Before merge** | `arkgate-check` CI check; merge blocking requires it as a required status |
53
56
 
54
- Optional later: runtime kernel (`createArkKernel`) if you want event/intent governance.
57
+ Optional later: the **experimental** runtime kernel (`createArkKernel`) if you want to evaluate
58
+ event/intent governance. It is not required for gate adoption.
55
59
 
56
60
  It is **not** a web framework, ORM, or job runner.
57
61
 
@@ -82,7 +86,7 @@ mode you configure:
82
86
  |-------|--------|-----------|
83
87
  | **Suggest** | New/thin project | Finish `start` + autopilot |
84
88
  | **Adapt** | Not fully protected yet | Keep autopilot / adopt until clean |
85
- | **Enforce** | Gates can honestly protect you | Build features; fix with `/ark-fix` if blocked |
89
+ | **Enforce** | Contract coverage is honest and checked edges are clean | Keep the host-appropriate write path; require the CI status if it must block merges |
86
90
 
87
91
  You **arrive** at Enforce. You never “turn on Enforce”.
88
92
 
@@ -106,7 +110,7 @@ Full checklist (CI, MCP, Codex, imports): **[docs/migrate-from-ark-runtime-kerne
106
110
 
107
111
  ```bash
108
112
  npm install -D arkgate typescript
109
- npx arkgate start # setup + origin report
113
+ npx arkgate start # contract day-zero origin → gates + plan
110
114
  # in agent:
111
115
  # /ark-autopilot
112
116
  npx arkgate-check --doctor # status light + next action
@@ -117,11 +121,13 @@ Aliases `ark` / `ark-check` / `ark-mcp` still work. **npm / pnpm / yarn**. No in
117
121
  <details>
118
122
  <summary>What <code>/ark-autopilot</code> does under the hood (optional detail)</summary>
119
123
 
120
- 1. Setup if needed (`ark start`).
121
- 2. Origin architecture report (before picture in `.ark/reports/`).
122
- 3. Adoption: match contract to real folders, raise governed %.
123
- 4. Plan + safe auto-fixes; judgment when you ask for full apply.
124
- 5. Gates on + after report (evolution vs origin).
124
+ 1. Setup if needed (`ark start` — contract, then **day-zero origin**, then gates).
125
+ 2. **Explore pass** (decision-grade map of *this* product; field path when demos exist).
126
+ 3. **Dual plan:** **A** remediation from `--plan` (mechanical-safe only by default); **B** pattern/evolution bets (never auto-applied as mechanical-safe). Empty plan ≠ “healthy” without explore/B.
127
+ 4. Apply A re-check; judgment only when you ask for full apply.
128
+ 5. Gates on + latest report (evolution vs frozen origin).
129
+
130
+ Standalone recon without applying: `/ark-explore`.
125
131
 
126
132
  </details>
127
133
 
@@ -141,7 +147,7 @@ npx arkgate-check --coverage
141
147
 
142
148
  ## Other skills (only when you need them)
143
149
 
144
- Install once: `npx arkgate-check --install-agent-gates`
150
+ Install once: `npx arkgate-check --install-agent-gates`
145
151
  (`--tools claude,cursor,codex,grok` to pick hosts.)
146
152
 
147
153
  **Default is always `/ark-autopilot`.** The rest are escapes, not a second curriculum.
@@ -153,8 +159,9 @@ otherwise they **fall back to sequential**.
153
159
 
154
160
  **Write path (Track W):** Prefer MCP **`ark_prepare_write`** when you have a snippet (place +
155
161
  constrain + validate + optional `autoPatch` + `judgmentBrief`). PreToolUse hooks with
156
- `--hook-repair` emit machine-readable repair payloads on deny (still hard block; never silent
157
- write). See [docs/ai-gates.md](docs/ai-gates.md).
162
+ `--hook-repair` on Claude/Grok emit machine-readable repair payloads on deny (still hard block;
163
+ never silent write). Cursor/Codex MCP calls remain advisory. See
164
+ [docs/ai-gates.md](docs/ai-gates.md).
158
165
 
159
166
  | Need | Skill |
160
167
  |------|--------|
@@ -168,11 +175,24 @@ write). See [docs/ai-gates.md](docs/ai-gates.md).
168
175
  | Edit `ark.config.json` safely | `/ark-contract` |
169
176
  | Plain-language tour of the report | `/ark-explain` |
170
177
  | Deep coverage + opportunities audit | `/ark-coverage` |
171
- | Migrate hand-rolled bus/outbox (TS) | `/ark-runtime` |
172
- | Bump ArkGate + refresh all agent hosts | `/ark-upgrade` |
178
+ | Evaluate the experimental runtime against hand-rolled bus/outbox (TS) | `/ark-runtime` |
179
+ | Bump ArkGate + refresh active host (defer Codex when not on Codex) | `/ark-upgrade` |
180
+
181
+ ### Host enforcement support
182
+
183
+ <!-- arkgate-host-support:start -->
184
+ | Host | Local write boundary | MCP validation | CI / merge path | Repair payload |
185
+ |------|----------------------|----------------|-----------------|----------------|
186
+ | Claude Code | Hard block for PreToolUse `Write` / `Edit` / `MultiEdit` | Advisory; the agent must call it | Available `arkgate-check --strict-merge` check | Emitted on hook deny; host must re-inject |
187
+ | Grok Build | Hard block for PreToolUse `write` / `search_replace` (plus aliases) | Advisory; the agent must call it | Available `arkgate-check --strict-merge` check | Emitted on hook deny; host must re-inject |
188
+ | Cursor | No hard hook; MCP/rules are advisory | Advisory; the agent must call it | Available `arkgate-check --strict-merge` check | No hard-boundary payload |
189
+ | OpenAI Codex | No hard hook; MCP/rules are advisory | Advisory; the agent must call it | Available `arkgate-check --strict-merge` check | No hard-boundary payload |
190
+
191
+ This table describes the supported profile **after its files are installed and the host loads/trusts them**. A hard local boundary covers only the listed hook operations; alternate tools, direct filesystem writes, and human edits still rely on CI. MCP validation is advisory because the agent must call it. The CI check blocks a merge only when the repository makes that status required. Repair payloads never write code silently: the host must re-inject the candidate and ArkGate revalidates it. Run `arkgate-check --doctor` for the evidence actually detected in the current repository.
192
+ <!-- arkgate-host-support:end -->
193
+
194
+ Detailed setup: [docs/ai-gates.md](docs/ai-gates.md).
173
195
 
174
- Hosts with full MCP/hooks: **Claude Code**, **Cursor**, **Codex**, **Grok Build**.
175
- More: [docs/ai-gates.md](docs/ai-gates.md). Health: **`npx arkgate-check --doctor`**.
176
196
  ---
177
197
 
178
198
  ## How it works (short)
@@ -180,19 +200,27 @@ More: [docs/ai-gates.md](docs/ai-gates.md). Health: **`npx arkgate-check --docto
180
200
  ```
181
201
  ark.config.json
182
202
 
183
- ├─► Write gate (arkgate-mcp) — agent PreToolUse / MCP tools
184
- ├─► CI gate (arkgate-check) PR / main
185
- └─► Runtime kernel (opt-in) — only if you call it
203
+ ├─► Write path (arkgate-mcp) — hard hook or advisory MCP, by host
204
+ ├─► CI check (arkgate-check) merge block only when status is required
205
+ └─► Runtime kernel experimental opt-in; gates do not need it
186
206
  ```
187
207
 
188
208
  - **Presets:** hexagonal, layered, feature-sliced, monorepo, ui-surface, vertical-slice, ddd-bounded-contexts (+ aliases clean-architecture / onion-architecture). Layers start optional; doctor suggests tightening populated cores. Cross-slice / cross-context bans use optional `peerIsolation` rules.
209
+ - **Versioned config:** generated contracts include `$schema` + `schemaVersion`; CLI, MCP, and
210
+ ESLint validate through the same loader. Unknown keys fail with their JSON path. See the
211
+ [configuration and editor guide](docs/configuration.md).
189
212
  - **Frameworks:** Nest / Next / express / library layouts get sensible globs on init so day-one coverage is real.
190
213
  - **Brownfield:** baseline ratchet, refuse to freeze a wrong contract, `/ark-adopt` for mature trees.
191
- - **Agents:** skills install into Claude / Cursor / Codex / Grok; `ark start` freezes an origin report under `.ark/reports/`.
214
+ - **Agents:** skills install into Claude / Cursor / Codex / Grok; `ark start` freezes **day-zero origin** under `.ark/reports/` **before** agent docs/CI templates.
192
215
  - **Write protocol (2.10 / Track W):** mechanical-safe **autoPatch** on the write gate (`import type`); MCP **`ark_prepare_write`** (place + validate + patch + judgmentBrief); opt-in hook **`--hook-repair`** (`ARK_REPAIR_JSON`); doctor **`writePath`** (repair vs reject-only); loop-cost eval (`npm run eval:loop-cost`). Port-proof inject is **judgment** (arity change), not silent auto-apply.
193
- - **Fail-closed CI (2.11):** `--strict` combines config coverage, required CI/MCP/write gates,
194
- PreToolUse hook presence, and bypass diagnostics for dynamic imports, TypeScript suppressions,
195
- explicit `any` casts, InMemory runtime defaults, and disabled peer isolation.
216
+ - **Fail-closed CI (2.11):** `--strict-merge` combines config coverage, shared gate-file
217
+ presence, and bypass diagnostics for dynamic imports, TypeScript suppressions, explicit `any`
218
+ casts, InMemory runtime defaults, and disabled peer isolation. `--strict` is a compatibility
219
+ alias. Neither requires an editor hook; use `--require-write-hook claude|grok` when that local
220
+ guarantee is part of the check.
221
+ - **Trust / coverage (2.12):** package unit-test floors on the broad product surface
222
+ (statements/lines **≥80%**, branches/functions **≥85%**; enforcement-critical modules **≥95%**
223
+ branch). Explore dual-plan + day-zero origin first (see above). Roadmap next: Q2 repair dogfood matrix.
196
224
  - **TypeScript:** project compilers 5.x / 6.x / 7.x — gate falls back to a nested JS-API TypeScript when TS 7’s main export is version-only ([docs/typescript-support.md](docs/typescript-support.md)).
197
225
 
198
226
  ### Why not only ESLint / dependency-cruiser / Nx?
@@ -200,7 +228,7 @@ ark.config.json
200
228
  | | ArkGate | Typical boundary linter |
201
229
  |--|:---:|:---:|
202
230
  | CI import rules | ✅ | ✅ |
203
- | Block **AI writes** before they land | ✅ | ❌ |
231
+ | Hard-block supported-host AI writes before they land | ✅ (Claude/Grok hooks) | ❌ |
204
232
  | Contract agents can read (`ark://manifest`) | ✅ | ❌ |
205
233
  | Placement tools (`ark_place`, …) | ✅ | ❌ |
206
234
  | Honest governed % + adoption path | ✅ | ❌ |
@@ -214,13 +242,13 @@ ark.config.json
214
242
  ## Common commands
215
243
 
216
244
  ```bash
217
- npx arkgate start # guided setup + plan + origin report
245
+ npx arkgate start # guided setup: contract origin → gates → plan
218
246
  npx arkgate-check --doctor # health + Adoption gaps (not just fitness)
219
247
  npx arkgate-check --doctor --json # machine-readable doctor.adoption
220
248
  npx arkgate-check --strict # fail-closed CI + installed-gate/safety checks
221
249
  npx arkgate-check --plan # safe-to-auto-fix vs your call
222
250
  npx arkgate-check --coverage # Governed: N%
223
- npx arkgate-check --report ark-report.html # showcase HTML + Adoption card + origin/latest
251
+ npx arkgate-check --report ark-report.html # showcase HTML (opens in browser on local TTY; --no-open to skip)
224
252
  npx arkgate-check --baseline # only NEW violations fail
225
253
  npx arkgate upgrade # package + gates/skills + MCP/Codex normalize
226
254
  ```
@@ -234,10 +262,11 @@ CI (example):
234
262
 
235
263
  ---
236
264
 
237
- ## Optional: runtime kernel
265
+ ## Optional experimental runtime kernel
238
266
 
239
- Gates need **no app code changes**. If you also want runtime intent/event contracts,
240
- use the **opt-in** subpath (preferred):
267
+ Gates need **no app code changes**. The runtime API is currently **experimental** and is not a
268
+ production-readiness claim. If you want to evaluate runtime intent/event contracts, use the
269
+ opt-in subpath (preferred):
241
270
 
242
271
  ```ts
243
272
  import { createStrictArkKernelFromConfig } from 'arkgate/runtime';
@@ -245,7 +274,7 @@ import { createStrictArkKernelFromConfig } from 'arkgate/runtime';
245
274
  ```
246
275
 
247
276
  Root `import { … } from 'arkgate'` still re-exports kernel symbols for compatibility
248
- in this major; prefer `arkgate/runtime` for new code.
277
+ in this major; use `arkgate/runtime` when evaluating the experimental surface.
249
278
 
250
279
  NestJS: `arkgate/nestjs` (optional peer `@nestjs/common`).
251
280
 
@@ -264,7 +293,7 @@ for real systems. Details: [docs/production-hardening.md](docs/production-harden
264
293
  | Audience | Link |
265
294
  |----------|------|
266
295
  | New builders (plain language) | [docs/enthusiast/](docs/enthusiast/README.md) |
267
- | **Package surface (stable vs opt-in)** | [docs/package-surface.md](docs/package-surface.md) |
296
+ | **Package surface (stable vs experimental)** | [docs/package-surface.md](docs/package-surface.md) |
268
297
  | Wire Claude / Cursor / Codex / Grok + **ESLint (CI-parity)** | [docs/ai-gates.md](docs/ai-gates.md) |
269
298
  | **TypeScript 5 / 6 / 7 support** | [docs/typescript-support.md](docs/typescript-support.md) |
270
299
  | Migrate from `ark-runtime-kernel` | [docs/migrate-from-ark-runtime-kernel.md](docs/migrate-from-ark-runtime-kernel.md) |
@@ -285,11 +314,11 @@ npm run typecheck
285
314
  npm run check:architecture # Ark gates itself
286
315
  ```
287
316
 
288
- **Website:** [arkgate.online](https://www.arkgate.online/)
289
- **npm:** [`arkgate`](https://www.npmjs.com/package/arkgate) · formerly `ark-runtime-kernel`
290
- **Product:** **ArkGate** — architecture co-pilot / gate for AI TypeScript (not a runtime kernel).
291
- CLI: `arkgate` · `arkgate-check` · `arkgate-mcp` (aliases `ark` / `ark-check` / `ark-mcp` still work for one major).
292
- MCP registry: `io.github.pedroknigge/arkgate`.
317
+ **Website:** [arkgate.online](https://www.arkgate.online/)
318
+ **npm:** [`arkgate`](https://www.npmjs.com/package/arkgate) · formerly `ark-runtime-kernel`
319
+ **Product:** **ArkGate** — architecture co-pilot / gate for AI TypeScript (not a runtime kernel).
320
+ CLI: `arkgate` · `arkgate-check` · `arkgate-mcp` (aliases `ark` / `ark-check` / `ark-mcp` still work for one major).
321
+ MCP registry: `io.github.pedroknigge/arkgate`.
293
322
  **Source:** [github.com/pedroknigge/arkgate](https://github.com/pedroknigge/arkgate)
294
323
 
295
324
  Node ≥ 18 · **MIT**.