arkgate 3.8.3 → 3.9.1

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,89 @@ in the immutable pre-2.0 archive linked below.
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## 3.9.1 — 2026-07-23
9
+
10
+ **Patch** over 3.9.0. Repo hygiene and CI honesty only — **no required config migration**, no gate
11
+ weakening, no product API changes.
12
+
13
+ ### Fixed
14
+
15
+ - **Onboarding matrix (`o04`):** `ark start --install` may rewrite package-manager lockfiles when the
16
+ published package is installed; tests compare product mutation paths only (lockfile drift allowed).
17
+ - **Docs post-3.9.0 publish:** CONTRIBUTING / README / release notes / migrate guide match npm truth
18
+ for the published line (updated again for this patch after 3.9.1 lands on `latest`).
19
+ - **Supply-chain hygiene:** `fast-uri` **3.1.4** (transitive via `ajv`) closes host-confusion advisory
20
+ GHSA-v2hh-gcrm-f6hx. Eval fixtures pin **Next.js 15.5.21** (patched) so Dependabot Next alerts on
21
+ `eval/cases/**` corpus close without shipping Next in the `arkgate` npm tarball.
22
+
23
+ ### Notes
24
+
25
+ - Next bumps are **eval fixture hygiene**, not a consumer-runtime CVE in the published package.
26
+ - Z09 / residual `RB-11` remain open.
27
+
28
+ ## 3.9.0 — 2026-07-23
29
+
30
+ **Beautiful Path** minor: one primary flow, doctor as control plane, progressive disclosure, and
31
+ senior-grade product voice — plus residual beauty, write-path honesty, Shape coach depth, and
32
+ field-claim scaffolding. **No required config migration.** Does not weaken write gate or CI.
33
+ Z09 / residual `RB-11` remain open (longitudinal claim gate; field kit is scaffolding only).
34
+ Not a rewrite of the analysis engine. No plan-B silent codemod. No fake hard write on Cursor/Codex.
35
+
36
+ ### Added
37
+
38
+ - **Product voice canon:** `docs/product-voice.md` — lexicon (including **design-weak** / **residual**
39
+ / hard vs advisory write), **Do** table, doctor/deny microcopy models, progressive-disclosure rule.
40
+ Linked from README and Agents knowledge map.
41
+ - **Field program kit (not closed):** `docs/field/` — Z09 preregistration template, cohort D30/D90
42
+ checklist, independent-reviewer manifesto + open signed-identity decision. Explicit **status: not
43
+ closed**; does not invent adopter counts or close `RB-11` / C-028 residual.
44
+ - **Release notes:** `docs/releases/3.9.0.md`.
45
+ - **Docs information architecture:** three public lanes — [docs/use.md](docs/use.md) (anyone),
46
+ [docs/develop.md](docs/develop.md) (integrate), [CONTRIBUTING.md](CONTRIBUTING.md) (library);
47
+ hub [docs/README.md](docs/README.md); history under [docs/archive/](docs/archive/README.md).
48
+ Historical release notes and epic plans remain in-repo but are not the product front door.
49
+ - **Maintainer workflow:** `.grok/workflows/product-beauty-audit.rhai` — read-only parallel audit of
50
+ product surfaces against product-voice criteria (report-only by default).
51
+ - **Host enforcement expansion (prepared, not npm-published as a separate release):**
52
+ - **Google Antigravity** (`antigravity` / alias `agy`): `.agents/hooks.json` PreToolUse install,
53
+ `ark-mcp --hook` adapter for `toolCall` + write tools (`write_to_file`,
54
+ `replace_file_content`, `multi_replace_file_content`), doctor inventory, hard-write when
55
+ installed + trusted (same ladder as Claude/Grok).
56
+ - **OpenCode** (`opencode`): merge/write `opencode.json` MCP (`type: local`), advisory-only
57
+ write path, optional experimental plugin template
58
+ `templates/hooks/opencode-ark-write-gate.mjs` (never claimed hard).
59
+ - Canonical host matrix + README/`docs/ai-gates.md` honesty rows updated.
60
+
61
+ ### Changed
62
+
63
+ - **README first-run narrative:** one door (`start` → doctor → optional `/ark-autopilot`); skills
64
+ section reframed as expert escapes, not a second curriculum; status lights language tightened;
65
+ host matrix states **required CI status** as the merge hard boundary and labels
66
+ Cursor/Codex/OpenCode advisory at write (Antigravity hard when covered).
67
+ - **Compact router** (`compactAgentInstructions`): primary path = doctor + place/validate/check;
68
+ full `/ark-*` pack documented as optional expert depth with install command.
69
+ - **Doctor human surface:** status-light copy matches product voice; top block is **Primary next
70
+ action** (#1) plus optional **Also** list; design-weak mode uses warn `!` (not green `✓`);
71
+ edge-clean under design-weak no longer claims absolute “matches the contract”; New-here primary
72
+ is finish `start` → doctor (not a competing recommend/architect curriculum); Cursor/Codex write
73
+ path lines state advisory + required CI. JSON ids (`postGreenPath`, `primaryNextAction`,
74
+ `clarify-for-ai`) unchanged.
75
+ - **Post-green primary action string:** senior-grade Shape residual wording; same skill chain.
76
+ - **Agent install messaging:** install-agent-gates prints compact vs expert-skill-pack profile hints.
77
+ - **Skill frontmatter / mode tables:** `/ark-autopilot` = guided end-to-end; ranks **Enforce ·
78
+ design-weak** Shape door; `/ark-explore` = specialized map / post-green door with status-light
79
+ table and smell-envelope honesty (absence ≠ full-tree proof).
80
+ - **Agent guide / AI gates / package surface:** default path and host write honesty aligned; design
81
+ smell envelope documented; no “default = full skill pack.”
82
+
83
+ ### Tests
84
+
85
+ - `q01PostGreenPath` — primary-action wording, design-weak mode mark `!`, no absolute contract-match
86
+ under residual.
87
+ - `skillsSurface` — autopilot/explore Shape door ranking; compact router progressive disclosure.
88
+ - `q06ReleaseSurfaces` — 3.9.0 notes, product-voice Do/lexicon, field kit not-closed.
89
+ - Compact-start / adoption-gaps / codex residual honesty expectations updated for voice.
90
+
8
91
  ## 3.8.3 — 2026-07-22
9
92
 
10
93
  Corrective **patch** over 3.8.2 from multi-repo field evidence (PROPIA pnpm workspace upgrade;
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **One contract. One gate. One co-pilot.**
6
6
 
7
- Your AI writes most of the code. ArkGate keeps that code inside an architecture you can trust —
7
+ Your AI writes most of the code. ArkGate keeps that work inside an architecture you can trust —
8
8
  and makes sure a “green” check means something real.
9
9
 
10
10
  [![Website](https://img.shields.io/badge/website-arkgate.online-0a0a0a)](https://www.arkgate.online/)
@@ -16,395 +16,150 @@ and makes sure a “green” check means something real.
16
16
 
17
17
  </div>
18
18
 
19
- > **ArkGate 3.8.3** is current stable: field journey on top of 3.8.2 — pnpm/yarn workspace install,
20
- > default `start` package pin, compact `.mcp.json`, upgrade recovery/UX.
21
- > [Release notes](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.8.3.md).
22
-
23
- > **TypeScript 7 distribution note:** ArkGate prefers a usable project compiler API, then its
24
- > exact, physically distinct TypeScript 6 analysis host. Analysis reports required
25
- > `complete | partial | unavailable` status; incomplete results cannot look green. See the
26
- > [exact boundary](docs/typescript-support.md).
19
+ > **ArkGate 3.9.1** is the next prepared patch over **3.9.0** (onboarding/CI lockfile honesty,
20
+ > supply-chain hygiene). **npm `latest` is still 3.9.0** until publication succeeds.
21
+ > [3.9.1 notes](docs/releases/3.9.1.md) · [3.9.0](docs/releases/3.9.0.md) · [Docs hub](docs/README.md)
27
22
 
28
23
  ---
29
24
 
30
- ## The only flow (humans and agents)
31
-
32
- If you remember nothing else:
33
-
34
- ```text
35
- 1. npx arkgate start ← read-only preview: files + commands + projected coverage
36
- npx arkgate start --apply ← apply exactly the previewed mutations
37
- 2. Compact router ← MCP/AGENTS routes place, validate, and architecture checks
38
- /ark-autopilot ← optional full guided workflow after its skill pack is installed
39
- 3. npx arkgate-check --doctor ← “where am I?” anytime (one status screen)
40
- ```
25
+ ## Choose your path
41
26
 
42
- | Stuck on… | Do this |
43
- |-----------|---------|
44
- | Gate failed after an edit | `/ark-fix` |
45
- | “Where does this new file go?” | `/ark-place` |
46
- | Contract globs / layers wrong | `/ark-contract` |
47
- | **Messy / spaghetti code** (even if the gate is green) | **`/ark-explore`** then **`/ark-autopilot`** — [below](#less-spaghetti-after-the-gate-is-green) |
48
- | New ArkGate version | `/ark-upgrade` |
27
+ | You are… | Go here |
28
+ |----------|---------|
29
+ | **Anyone** (ship with AI, minimal jargon) | **[Use ArkGate](docs/use.md)** |
30
+ | **Developer** (hosts, CI, config, brownfield) | **[Develop with ArkGate](docs/develop.md)** |
31
+ | **Contributor** (improve this library) | **[CONTRIBUTING](CONTRIBUTING.md)** |
49
32
 
50
- **Everything else is optional.** You do not need to learn “modes”, the full skill pack, or the runtime
51
- kernel to get value. The compact router is enough for normal work; install `/ark-autopilot` only
52
- when you want the full guided workflow.
33
+ Full map: **[docs/README.md](docs/README.md)**
53
34
 
54
35
  ---
55
36
 
56
- ## What it is (30 seconds)
37
+ ## Start in one minute
57
38
 
58
- **ArkGate** = a machine-readable architecture file (`ark.config.json`) enforced at CI, with
59
- host-specific protection while an agent writes:
39
+ ```bash
40
+ npm install -D arkgate typescript
41
+ npx arkgate start # preview files + commands
42
+ npx arkgate start --apply # compact contract + host router + CI plan
43
+ npx arkgate-check --doctor # control plane: status light + primary next action
44
+ ```
60
45
 
61
- **Name note:** this is the TypeScript architecture-enforcement package published as `arkgate`.
62
- It is not affiliated with the separate Archgate CLI project.
46
+ That is the product. Doctor is the control plane when stuck, do **primary next action #1**.
63
47
 
64
- | When | Tool |
65
- |------|------|
66
- | **While the AI writes** | Hard PreToolUse block on Claude/Grok; advisory MCP on Cursor/Codex |
67
- | **Before merge** | `arkgate-check` CI check; merge blocking requires it as a required status |
68
-
69
- Optional later: the **experimental** runtime kernel (`createArkKernel`) if you want to evaluate
70
- event/intent governance. It is not required for gate adoption.
48
+ ```text
49
+ start → doctor → day-to-day (place + gate)
50
+ optional /ark-autopilot after skill pack
51
+ ```
71
52
 
72
- It is **not** a web framework, ORM, or job runner.
53
+ Aliases `ark` / `ark-check` / `ark-mcp` still work. npm / pnpm / yarn. No install lifecycle scripts.
73
54
 
74
55
  ![Write gate: agent blocked, then self-corrects](docs/assets/ark-write-gate.svg)
75
56
 
76
57
  ---
77
58
 
78
- ## Who it’s for
59
+ ## What it is
79
60
 
80
- Same start for almost everyone: **`npx arkgate start` compact router** (then
81
- `/ark-autopilot` when you opt into the full skill pack).
61
+ A machine-readable architecture file (`ark.config.json`) plus enforcement:
82
62
 
83
- | You are… | Same start, then… |
84
- |----------|-------------------|
85
- | Builder with AI | Use the compact router and doctor; add autopilot when you want guided remediation |
86
- | Tech lead on a messy monorepo | Add autopilot (or deeper `/ark-adopt` for a focused brownfield pass) |
87
- | Power user | Same flow; use `ark-check --plan` / `--coverage` when you want the raw sensor |
63
+ | When | Tool |
64
+ |------|------|
65
+ | **While the AI writes** | Hard PreToolUse on supported hosts; advisory MCP elsewhere |
66
+ | **Before merge** | `arkgate-check` as a **required** CI status |
88
67
 
89
- **Not for:** no TypeScript, “just one lint rule”, or looking for an app framework.
68
+ **Not** a web framework, ORM, or job runner. Optional experimental runtime is separate and not required for the gate.
90
69
 
91
- ---
70
+ **Name note:** npm package `arkgate` — not affiliated with the separate Archgate CLI project.
92
71
 
93
- ## Status, not settings (“modes”)
72
+ ---
94
73
 
95
- `ark-check --doctor` may say **Suggest / Adapt / Enforce**. That is a **status light**, not a
96
- mode you configure:
74
+ ## Status lights (not settings)
97
75
 
98
76
  | Light | Means | Your move |
99
77
  |-------|--------|-----------|
100
- | **Suggest** | New/thin project | Finish `start` + autopilot |
101
- | **Adapt** | Not fully protected yet | Keep autopilot / adopt until clean |
102
- | **Enforce** | Contract coverage is honest and checked **edges** are clean | Keep write path + CI. If the tree is still a mess → [Shape flow](#less-spaghetti-after-the-gate-is-green) |
103
- | **Enforce · design-weak** | Edges clean, but doctor still sees design smells (`designSmells` / `patternBets`) | **`/ark-explore`** (shape-focus) → **`/ark-autopilot`** for dual-plan **B** — not “done” |
104
-
105
- You **arrive** at Enforce. You never “turn on Enforce”.
106
- **Enforce does not mean the design is elegant** — only that the contract’s import edges are honest.
107
-
108
- ---
109
-
110
- ## Less spaghetti after the gate is green
111
-
112
- A green check can still leave god modules, SQL in routes, and three patterns at once.
113
- That residual is **Shape** work — plan **B**, never auto-applied as mechanical-safe.
114
-
115
- ```text
116
- 1. /ark-explore ← map + dual-plan B + extraction cards (no apply)
117
- 2. /ark-autopilot ← apply A (edges); B only with your ok, one pilot at a time
118
- 3. npx arkgate-check --doctor
119
- npx arkgate-check --plan --json ← designWeak + patternBets when residual remains
120
- ```
121
-
122
- | If… | Skill |
123
- |-----|--------|
124
- | Need the map / “what’s the golden pattern?” | `/ark-explore` |
125
- | Ready to execute the dual plan | `/ark-autopilot` |
126
- | Contract still lies (false-green, wrong globs) | `/ark-adopt` first, then explore |
127
- | One cluster only | `/ark-fix` (+ extraction card) |
128
- | Only care about governed% / gates installed | `/ark-coverage` (not the Shape map) |
129
-
130
- Phases: **Align** (honest contract) → **Stabilize** (real baseline) → **Shape** (golden pattern + pilot).
131
- Details: [docs/brownfield-adoption.md](docs/brownfield-adoption.md) §6 · skills install: `npx arkgate-check --install-agent-gates`.
132
-
133
- ---
134
-
135
- ## Upgrading from `ark-runtime-kernel`?
136
-
137
- **Same product**, new package name. Config and `/ark-*` skills stay.
138
-
139
- ```bash
140
- npm uninstall ark-runtime-kernel && npm install -D arkgate
141
- npx arkgate-check --install-agent-gates --force
142
- npx arkgate-check --doctor
143
- ```
144
-
145
- Full checklist (CI, MCP, Codex, imports): **[migrate-from-ark-runtime-kernel.md](https://github.com/pedroknigge/arkgate/blob/main/docs/migrate-from-ark-runtime-kernel.md)**.
78
+ | **Suggest** | Thin / new tree | Finish `start` doctor |
79
+ | **Adapt** | Not fully protected | Doctor action #1 |
80
+ | **Enforce** | Honest edges under the contract | Keep write path + CI |
81
+ | **Enforce · design-weak** | Edges clean; design residual remains | Shape residual — not “done” |
146
82
 
147
- ---
148
-
149
- ## Start in one minute
150
-
151
- ```bash
152
- npm install -D arkgate typescript
153
- npx arkgate start # read-only preview: exact mutations + projected coverage
154
- npx arkgate start --apply # apply the compact contract → active-host router → CI plan
155
- # optional, after installing the full skill pack:
156
- # /ark-autopilot
157
- npx arkgate-check --doctor # status light + next action
158
- ```
159
-
160
- Aliases `ark` / `ark-check` / `ark-mcp` still work. **npm / pnpm / yarn**. No install lifecycle scripts.
161
-
162
- <details>
163
- <summary>What <code>/ark-autopilot</code> does under the hood (optional detail)</summary>
164
-
165
- 1. Setup if needed (`ark start` previews; review, then `ark start --apply`).
166
- 2. **Explore pass** (decision-grade map of *this* product; field path when demos exist).
167
- 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.
168
- 4. Apply A → re-check; judgment only when you ask for full apply.
169
- 5. Gates on + latest report (evolution vs frozen origin).
170
-
171
- Standalone recon without applying: `/ark-explore`.
172
-
173
- </details>
174
-
175
- <details>
176
- <summary>Manual / power-user CLI only</summary>
177
-
178
- ```bash
179
- npx arkgate init
180
- npx arkgate-check
181
- npx arkgate-check --plan
182
- npx arkgate-check --coverage
183
- ```
184
-
185
- </details>
83
+ Details: [docs/use.md](docs/use.md).
186
84
 
187
85
  ---
188
86
 
189
- ## Other skills (only when you need them)
190
-
191
- Install once: `npx arkgate-check --install-agent-gates`
192
- (`--tools claude,cursor,codex,grok` to pick hosts.)
193
-
194
- **The compact router is the default; `/ark-autopilot` is the full guided option.** The rest are
195
- escapes, not a second curriculum. Full-install `AGENTS.md` includes a **skill routing table**
196
- (trigger → skill). Skills are
197
- **dual-engine** (CLI sensor + read real source) and end with a fixed **completion contract**;
198
- critical handoffs say **STOP** and name the next skill (hosts must follow — markdown cannot chain calls).
199
- When the host allows it, skills may **fan out parallel subagents** (disjoint scopes);
200
- otherwise they **fall back to sequential**.
201
-
202
- **Write path (Track W):** Prefer MCP **`ark_prepare_write`** when you have a snippet (place +
203
- constrain + validate + optional `autoPatch` + `judgmentBrief`). PreToolUse hooks with
204
- `--hook-repair` on Claude/Grok emit machine-readable repair payloads on deny (still hard block;
205
- never silent write). Cursor/Codex MCP calls remain advisory. See
206
- [docs/ai-gates.md](docs/ai-gates.md).
207
-
208
- For a complete multi-file architecture-source candidate, use MCP **`ark_prepare_change`** or
209
- `ark preflight --changes change-set.json --json`. Creates, updates, and deletes are evaluated as
210
- one read-only graph, so an edge or cycle that appears only across the batch is rejected before any
211
- project file is written. With `--change-map map.json` (or MCP `changeMap`), the same verdict also
212
- classifies planned structure as satisfied, missing, contradictory, or unplanned. This is structural
213
- convergence only: behavioral completion is always reported as not evaluated.
214
-
215
- ArkGate 3.8.0 closes the former compiler-free atomic-path divergence with versioned
216
- resolved-candidate facts and a differential adapter corpus, including `tsconfig` aliases and
217
- workspace edges. Strict CI remains the final merge boundary; lexical/single-snippet feedback is
218
- explicitly partial and non-green.
219
-
220
- Every blocking diagnostic carries stable rule/location/evidence fields plus one deterministic
221
- `nextAction`; human CLI/hook text prints that same action. A complete Codex `ApplyPatch` payload is
222
- reconstructed and sent through the same atomic engine before per-file safety checks. Codex remains
223
- honestly bypassable/advisory because not every Code Mode write dispatches the project hook. The
224
- verdict depends only on the explicit contract and candidate—not `AGENTS.md`, skills, injected prose,
225
- or an LLM.
226
-
227
- | Need | Skill | Not |
228
- |------|--------|-----|
229
- | Only the apply loop for plan **A** (edges) | `/ark-loop` | empty A + design residual → explore |
230
- | Empty greenfield shape/scaffold | `/ark-architect` | brownfield → adopt |
231
- | Brownfield contract match / baseline / manifest | `/ark-adopt` | map-only → explore |
232
- | Map / dual-plan **seed** / spaghetti Shape plan (no apply) | `/ark-explore` | fitness-only → coverage |
233
- | New file placement | `/ark-place` | — |
234
- | Gate violation on a change | `/ark-fix` | bulk → loop/autopilot |
235
- | One design decision (2–3 options) | `/ark-think` | full dual-plan → explore |
236
- | Edit `ark.config.json` safely | `/ark-contract` | — |
237
- | Plain-language tour / HTML report | `/ark-explain` | recon → explore |
238
- | Ark **fitness** (governed%, gates, install gaps) | `/ark-coverage` | full recon → explore |
239
- | Evaluate experimental runtime | `/ark-runtime` | — |
240
- | Bump ArkGate + refresh active host | `/ark-upgrade` | — |
241
-
242
- Brownfield phases: **Align** (honest contract) → **Stabilize** (real baseline) → **Shape** (golden pattern + pilot). ENFORCE with empty plan A can still be **design-weak** — that residual is explore/autopilot **B**, not “done.”
243
-
244
- ### Host enforcement support
87
+ ## Host enforcement support
245
88
 
246
89
  <!-- arkgate-host-support:start -->
247
90
  | Host | Local write boundary | MCP validation | CI / merge path | Repair payload |
248
91
  |------|----------------------|----------------|-----------------|----------------|
249
- | 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 |
250
- | 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 |
251
- | Cursor | No hard hook; MCP/rules are advisory | Advisory; the agent must call it | Available `arkgate-check --strict-merge` check | No hard-boundary payload |
252
- | 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 |
92
+ | Claude Code | **Hard** block for listed ops (PreToolUse `Write` / `Edit` / `MultiEdit`) when installed + trusted | Advisory; the agent must call it | **Required status** = hard merge boundary (`arkgate-check --strict-merge`) | Emitted on hook deny; host must re-inject |
93
+ | Grok Build | **Hard** block for listed ops (PreToolUse `write` / `search_replace` (plus aliases)) when installed + trusted | Advisory; the agent must call it | **Required status** = hard merge boundary (`arkgate-check --strict-merge`) | Emitted on hook deny; host must re-inject |
94
+ | Google Antigravity | **Hard** block for listed ops (PreToolUse `write_to_file` / `replace_file_content` / `multi_replace_file_content`) when installed + trusted | Advisory; the agent must call it | **Required status** = hard merge boundary (`arkgate-check --strict-merge`) | Emitted on hook deny; host must re-inject |
95
+ | Cursor | **Advisory only** at write (no hard hook) | Advisory; the agent must call it | **Required status** = hard merge boundary (same CI) | No hard-boundary payload |
96
+ | OpenAI Codex | **Advisory / best-effort** at write (not equivalent to Claude/Grok hard block) | Advisory; the agent must call it | **Required status** = hard merge boundary (same CI) | No hard-boundary payload |
97
+ | OpenCode | **Advisory / best-effort** at write (MCP + optional plugin; not a hard boundary) | Advisory; the agent must call it | **Required status** = hard merge boundary (same CI) | No hard-boundary payload |
98
+
99
+ **Read the CI column:** for every host, the repository-wide hard guarantee is a **required**
100
+ merge check — not “CI file present.” Cursor/Codex/OpenCode never get a fake hard write claim.
253
101
 
254
102
  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.
255
103
  <!-- arkgate-host-support:end -->
256
104
 
257
- Assets stay non-hard without fresh covered-operation evidence; MCP stays advisory.
258
-
259
105
  #### Why the hard guarantee lives at the merge gate
260
106
 
261
107
  The split above is a deliberate trade-off, not a gap. ArkGate validates at the earliest boundary
262
108
  each host offers and enforces at the earliest boundary a repository can make non-bypassable: the
263
- required merge status. Hard hooks (Claude Code, Grok Build) deny the listed write operations at
264
- write time; advisory surfaces (MCP, rules) coach the agent while it works. But any local boundary
265
- can be routed around — another tool, a direct filesystem write, a human edit — so the only
266
- guarantee ArkGate claims for every path is the `arkgate-check --strict-merge` check, and only when
267
- the repository makes that status required. Local checks optimize feedback speed; the merge gate
268
- owns correctness.
109
+ required merge status. Hard hooks (Claude Code, Grok Build, Google Antigravity) deny the listed
110
+ write operations at write time; advisory surfaces (MCP, rules, OpenCode plugins) coach the agent
111
+ while it works. But any local boundary can be routed around — another tool, a direct filesystem
112
+ write, a human edit — so the only guarantee ArkGate claims for every path is the
113
+ `arkgate-check --strict-merge` check, and only when the repository makes that status required.
114
+ Local checks optimize feedback speed; the merge gate owns correctness.
269
115
 
270
116
  A useful consequence: the contract doubles as a pressure sensor. Recurring violations or baseline
271
117
  exceptions concentrated on one layer edge are evidence that the current design stopped fitting the
272
118
  code — a reason to reshape the contract deliberately (start with `/ark-explore`), never to weaken
273
119
  the gate.
274
120
 
275
- Detailed setup: [docs/ai-gates.md](docs/ai-gates.md).
121
+ Setup per host: [docs/ai-gates.md](docs/ai-gates.md) · Develop path: [docs/develop.md](docs/develop.md)
276
122
 
277
123
  ---
278
124
 
279
- ## How it works (short)
280
-
281
- ```
282
- ark.config.json
283
-
284
- ├─► Write path (arkgate-mcp) — hard hook or advisory MCP, by host
285
- ├─► CI check (arkgate-check) — merge block only when status is required
286
- └─► Runtime kernel — experimental opt-in; gates do not need it
287
- ```
288
-
289
- - **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.
290
- - **Versioned config:** generated contracts include `$schema` + `schemaVersion`; CLI, MCP, and
291
- ESLint validate through the same loader. Unknown keys fail with their JSON path. Strict merge
292
- also compares the contract transition and blocks unacknowledged weakening with hashes and stable
293
- finding ids. See the [configuration and editor guide](docs/configuration.md).
294
- - **Frameworks:** Nest / Next / express / library layouts get sensible globs on init so day-one coverage is real.
295
- - **Brownfield:** baseline ratchet, refuse to freeze a wrong contract, `/ark-adopt` for mature trees.
296
- - **Agents:** `ark start` previews one compact active-host router (≤5 files / 25 KB); `--apply`
297
- writes those exact bytes. Full skills remain explicit via `--install-agent-gates --skills-only`;
298
- reports remain opt-in via `ark-check --report`.
299
- - **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.
300
- - **Enforcement state:** doctor JSON exposes schema-backed `writePath.enforcementState` with
301
- separate analyzed, configured, installed, runtime-observed, operation-coverage, active,
302
- bypassable, required, and hard evidence for local write, advisory MCP, and CI merge boundaries.
303
- Provider-unavailable required status remains `unverified`; local workflow text never proves
304
- branch protection. The older
305
- `enforcementLadder` projection remains for compatibility.
306
- - **Opt-in design delta (Z10):**
307
- `--doctor --fail-on-new-smells --base-ref <ref>` blocks only new/worsened semantic
308
- `domain-logic-in-ui`; historical/unrelated work stays green and missing bases fail closed.
309
- - **Fail-closed CI (2.11):** `--strict-merge` combines config coverage, shared gate-file
310
- presence, and bypass diagnostics for dynamic imports, TypeScript suppressions, explicit `any`
311
- casts, InMemory runtime defaults, and disabled peer isolation. `--strict` is a compatibility
312
- alias. Neither requires an editor hook; use `--require-write-hook claude|grok` when that local
313
- guarantee is part of the check.
314
- - **Resolved analysis + completeness (3.8.0):** schema 1.3 identifies
315
- `resolved-candidate-facts` versus `lexical-compatibility`, requires structured incompleteness
316
- reasons, and exposes policy/resolver/facts/tree identities for resolved results. Single-file
317
- lexical checks are explicitly `partial`/non-green; governed parse diagnostics also make plan
318
- `goal.met: false` and normal JSON `valid:false`/`ok:false`. Strict merge exits `1`; a missing
319
- host is `unavailable` and exits `2`.
320
- - **Release evidence:** independent 3.0 audit baseline plus signed-tag, GitHub Release, and
321
- provenance-backed npm publication; see the [3.1.0 release notes](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.1.0.md).
322
- - **TypeScript:** 3.8.0 passed all 36 packed compatibility cells for project
323
- compilers 5.9.3 / 6.0.3 / 7.0.2 across npm, pnpm, and Yarn. ArkGate prefers a usable project
324
- API, then its exact `typescript-ark-host@6.0.3`; the project `tsc` remains project-owned.
325
- Yarn uses strict PnP for TS5/6 and the `node-modules` linker for native TS7; that mode is explicit
326
- in the report. See the exact boundary in
327
- [docs/typescript-support.md](docs/typescript-support.md).
328
-
329
- ### Why not only ESLint / dependency-cruiser / Nx?
125
+ ## Why not only ESLint / Nx / cruiser?
330
126
 
331
127
  | | ArkGate | Typical boundary linter |
332
128
  |--|:---:|:---:|
333
129
  | CI import rules | ✅ | ✅ |
334
- | Hard-block supported-host AI writes before they land | ✅ (Claude/Grok hooks) | ❌ |
130
+ | Hard-block AI writes on supported hosts | ✅ | ❌ |
335
131
  | Contract agents can read (`ark://manifest`) | ✅ | ❌ |
336
- | Placement tools (`ark_place`, …) | ✅ | ❌ |
337
- | Honest governed % + adoption path | ✅ | ❌ |
338
- | Classified plan (`mechanical-safe` / judgment) | ✅ | |
339
- | TypeScript 5.9 / 6.0 / 7.0 packed consumers | ✅ (3.8.0; 36/36 packed CI cells) | varies |
340
- | Incomplete analysis can satisfy plan/result/strict merge | ❌ (`partial` / `unavailable` fail closed) | varies |
341
- | Adoption scorecard (hosts / MCP / origin) | ✅ | ❌ |
342
- | **Editor ESLint on-disk relative-import parity; resolved CI backstop** | ✅ (`arkgate/eslint`) | varies |
132
+ | Placement + preflight for multi-file changes | ✅ | ❌ |
133
+ | Honest governed % + dual plan (edges vs shape) | ✅ | ❌ |
134
+ | Incomplete analysis cannot look green | ✅ | varies |
343
135
 
344
136
  ---
345
137
 
346
138
  ## Common commands
347
139
 
348
140
  ```bash
349
- npx arkgate start # guided read-only preview
350
- npx arkgate start --apply # apply the compact active-host setup (≤5 files)
351
- npx arkgate start --tools codex --apply # select the host explicitly
352
- npx arkgate start --install --apply # also add arkgate to package.json (explicit only)
353
- npx arkgate start --remove-host codex # preview compact-host removal; add --apply to confirm
354
- npx arkgate-check --doctor # health + Adoption gaps (not just fitness)
355
- npx arkgate-check --doctor --json # adoption + schema-backed writePath.enforcementState
356
- npx arkgate-check --doctor --fail-on-new-smells --base-ref origin/main # opt-in design ratchet
357
- npx arkgate-check --strict # fail-closed CI + installed-gate/safety checks
358
- npx arkgate-check --plan # safe-to-auto-fix vs your call
359
- npx arkgate-check --coverage # Governed: N%
360
- npx arkgate-check --report ark-report.html # showcase HTML (opens in browser on local TTY; --no-open to skip)
361
- npx arkgate-check --baseline # only NEW violations fail
362
- npx arkgate preflight --changes changes.json --json # atomic read-only batch verdict
363
- npx arkgate preflight --changes changes.json --change-map map.json --json # intent hash + structural convergence
364
- npx arkgate upgrade --json # read-only managed-content preview + planDigest
365
- npx arkgate upgrade --apply # update package, then re-preview with the new CLI
366
- # run the emitted nextCommand to apply only that preview, including --plan-digest
141
+ npx arkgate start --apply
142
+ npx arkgate-check --doctor
143
+ npx arkgate-check --plan
144
+ npx arkgate-check --coverage
145
+ npx arkgate-check --strict-merge # CI / required status
146
+ npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok
367
147
  ```
368
148
 
369
- Managed upgrade records content identities in `ark.managed.json`, preserves customized and
370
- unrelated files, and requires explicit consent for recorded deletions or conflicts. It never
371
- rewrites a Codex home or another global directory implicitly.
372
-
373
- CI (example):
374
-
375
- ```yaml
376
- - run: npx arkgate-check --root . --config ark.config.json --strict
377
- # or: uses: pedroknigge/arkgate@<tag-or-SHA> # runs that checked-out revision
378
- ```
149
+ More: [docs/develop.md](docs/develop.md) · enthusiast track: [docs/enthusiast/](docs/enthusiast/README.md)
379
150
 
380
151
  ---
381
152
 
382
- ## Optional experimental runtime kernel
153
+ ## Optional experimental runtime
383
154
 
384
- Gates need **no app code changes**. The runtime API is currently **experimental** and is not a
385
- production-readiness claim. If you want to evaluate runtime intent/event contracts, use the
386
- separate experimental package:
387
-
388
- ```ts
389
- import { createStrictArkKernelFromConfig } from '@arkgate/runtime';
390
- // see the repository production-hardening and package-surface guides
391
- ```
155
+ Gates need **no** app runtime. The experimental `@arkgate/runtime` companion is separate and is not a production-readiness claim.
392
156
 
393
- The stable `arkgate` package does not bundle runtime implementation. The deprecated
394
- `arkgate/runtime` forwarding shim requires `@arkgate/runtime` and is removed in ArkGate 4.
395
- The companion is not currently present in the npm registry and the root release workflow does
396
- not publish it; the import above documents the intended boundary. Source-checkout evaluation
397
- requires `npm run build:runtime` followed by installing the local `packages/runtime` folder.
157
+ ### Durability stance
398
158
 
399
- NestJS: `@arkgate/runtime/nestjs` (optional peer `@nestjs/common`).
400
-
401
- ### Durability stance (built-in stores)
402
-
403
- The kernel’s default stores (`InMemoryEventBuffer`, `InMemoryAuditStore`,
404
- `InMemoryReadModelStore`, `InMemoryWorkflowStore`) are **reference in-memory only**:
405
- fine for tests, demos, and single-process local work — they **do not** survive restarts
406
- and are **not** production durability. Implement the store interfaces (or inject your own)
407
- for real systems. Details: [production-hardening.md](https://github.com/pedroknigge/arkgate/blob/main/docs/production-hardening.md).
159
+ Default stores (`InMemoryEventBuffer`, `InMemoryAuditStore`, `InMemoryReadModelStore`,
160
+ `InMemoryWorkflowStore`) are **reference in-memory only** — fine for tests and demos; they
161
+ **do not** survive restarts and are **not** production durability. Implement the store interfaces
162
+ for real systems. Details: [docs/production-hardening.md](docs/production-hardening.md).
408
163
 
409
164
  ---
410
165
 
@@ -412,39 +167,33 @@ for real systems. Details: [production-hardening.md](https://github.com/pedrokni
412
167
 
413
168
  | Audience | Link |
414
169
  |----------|------|
415
- | New builders (plain language) | [docs/enthusiast/](docs/enthusiast/README.md) |
416
- | **Package surface and configuration** | [package policy](docs/package-surface.md) · [contract](docs/configuration.md) |
417
- | Wire agents + **ESLint (bounded parity)** | [docs/ai-gates.md](docs/ai-gates.md) · [threat model](docs/threat-model.md) |
418
- | **TypeScript 5 / 6 / 7 support + analysis completeness** | [docs/typescript-support.md](docs/typescript-support.md) |
419
- | Migrate from `ark-runtime-kernel` | [docs/migrate-from-ark-runtime-kernel.md](https://github.com/pedroknigge/arkgate/blob/main/docs/migrate-from-ark-runtime-kernel.md) |
420
- | Messy existing repo | [docs/brownfield-adoption.md](docs/brownfield-adoption.md) |
421
- | Agent / MCP tools | [docs/agent-guide.md](docs/agent-guide.md) |
422
- | Security reporting | [SECURITY.md](SECURITY.md) |
423
- | Demos | [docs/demos/](https://github.com/pedroknigge/arkgate/tree/main/docs/demos) |
424
- | Examples | [examples/](https://github.com/pedroknigge/arkgate/blob/main/examples/README.md) |
425
- | Latest release (3.8.3) | [release notes](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.8.3.md) · [3.0.0 baseline](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.0.0.md) |
426
- | Roadmap and decisions | [ROADMAP.md](https://github.com/pedroknigge/arkgate/blob/main/ROADMAP.md) · [ADRs](https://github.com/pedroknigge/arkgate/tree/main/docs/adr) · [Changelog](CHANGELOG.md) |
170
+ | **Docs hub** | [docs/README.md](docs/README.md) |
171
+ | Anyone | [docs/use.md](docs/use.md) |
172
+ | Developers integrating ArkGate | [docs/develop.md](docs/develop.md) |
173
+ | Contributors to this library | [CONTRIBUTING.md](CONTRIBUTING.md) |
174
+ | Host install detail | [docs/ai-gates.md](docs/ai-gates.md) |
175
+ | Config · package surface · TS | [configuration](docs/configuration.md) · [package-surface](docs/package-surface.md) · [typescript-support](docs/typescript-support.md) |
176
+ | Brownfield | [docs/brownfield-adoption.md](docs/brownfield-adoption.md) |
177
+ | Security | [SECURITY.md](SECURITY.md) |
178
+ | Latest release (3.9.0 on npm; 3.9.1 prepared) | [3.9.1](docs/releases/3.9.1.md) · [3.9.0](docs/releases/3.9.0.md) · [CHANGELOG](CHANGELOG.md) |
179
+ | History / maintainer evidence | [docs/archive/](docs/archive/README.md) |
427
180
 
428
181
  ---
429
182
 
430
- ## Develop this repo
183
+ ## Contribute to this library
431
184
 
432
185
  ```bash
433
- npm ci && npm run build
434
- npx vitest run
435
- npm run typecheck
436
- npm run check:architecture # Ark gates itself
186
+ git clone https://github.com/pedroknigge/arkgate
187
+ cd arkgate && npm ci && npm run build
188
+ npm test && npm run check:architecture
437
189
  ```
438
190
 
439
- **Website:** [arkgate.online](https://www.arkgate.online/)
440
- **npm:** [`arkgate`](https://www.npmjs.com/package/arkgate) · formerly `ark-runtime-kernel`
441
- **Product:** **ArkGate** — architecture co-pilot / gate for AI TypeScript (not a runtime kernel).
442
- CLI: `arkgate` · `arkgate-check` · `arkgate-mcp` (aliases `ark` / `ark-check` / `ark-mcp` still work for one major).
443
- MCP registry: [`io.github.pedroknigge/arkgate`](https://registry.modelcontextprotocol.io/) (`server.json` @ package version).
444
- **Source:** [github.com/pedroknigge/arkgate](https://github.com/pedroknigge/arkgate)
445
-
446
- Node ≥ 18 · **MIT**.
191
+ Full guide: [CONTRIBUTING.md](CONTRIBUTING.md) · queue: [ROADMAP.md](ROADMAP.md)
447
192
 
448
193
  ---
449
194
 
195
+ **Website:** [arkgate.online](https://www.arkgate.online/) · **npm:** [`arkgate`](https://www.npmjs.com/package/arkgate)
196
+ **MCP:** [`io.github.pedroknigge/arkgate`](https://registry.modelcontextprotocol.io/)
197
+ Node ≥ 18 · **MIT**
198
+
450
199
  **Ark doesn’t invent your product. It keeps AI-generated TypeScript inside an architecture you can trust — and tells you when it isn’t really enforcing anything yet.**