arkgate 4.6.2 → 4.6.4

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.
@@ -8,9 +8,9 @@ reference for agents and codegen: write hooks, advisory MCP tools, CI, and `/ark
8
8
  - Docs hub: [README.md](README.md)
9
9
 
10
10
  Guarantees differ by host; start with the
11
- [canonical host support matrix](../README.md#host-enforcement-support). The advisory-local /
12
- hard-CI split is a deliberate trade-off, not a gap: local hooks and MCP coach at write time,
13
- while a required merge status is the one boundary a repository can make every write path share.
11
+ [canonical host support matrix](../README.md#host-enforcement-support). The operation-scoped
12
+ local / all-path CI split is a deliberate trade-off, not a gap: covered local hooks block early,
13
+ MCP coaches, and a required merge status is the one boundary every write path can share.
14
14
 
15
15
  CLI names: prefer **`arkgate` / `arkgate-check` / `arkgate-mcp`**; aliases `ark` / `ark-check` /
16
16
  `ark-mcp` still work for one major. **arkgate@3.8.0+** tests packed project TypeScript
@@ -41,17 +41,20 @@ npx ark-check --install-agent-gates --skills-only --force
41
41
  ### Write-path honesty
42
42
 
43
43
  Claude/Grok/Antigravity/Cursor can hard-block listed PreToolUse / preToolUse ops when installed
44
- and trusted (Cursor: `Write` / `StrReplace` via `.cursor/hooks.json`). Codex/OpenCode remain
45
- **advisory at write**. For every host, the repository-wide hard boundary is a **required GitHub
46
- status context** that runs `arkgate-check --strict-merge` (alias `ark-check --strict-merge`)
47
- the CLI name is not the status context name. Never claim Codex/OpenCode hard write; never claim
48
- Cursor hard write without the trusted hooks file covering Write|StrReplace. Soft-write alone does
49
- not mean the project is unfinished; doctor keeps it as an environment residual. See
44
+ and trusted (Cursor: `Write` / `StrReplace` via `.cursor/hooks.json`). Codex CLI and local
45
+ ChatGPT Desktop/App Server can hard-block a complete `apply_patch` through a trusted
46
+ `.codex/hooks.json`; installed files stay unverified until a fresh covered invocation. Hosted
47
+ tools, specialized opt-out paths, shell/direct writes, incomplete patch reconstruction, and
48
+ OpenCode remain CI-backed or advisory. For every host, the repository-wide hard boundary is a
49
+ **required GitHub status context** that runs `arkgate-check --strict-merge` (alias
50
+ `ark-check --strict-merge`) — the CLI name is not the status context name. Soft-write or
51
+ unverified-hook evidence alone does not mean the project is unfinished. See
50
52
  [ai-gates.md](ai-gates.md) and the README host matrix.
51
53
 
52
54
  Surface the same plane from the CLI: pair **`ark status --json`** (activation facts) with
53
- **`ark-check --doctor`** (`doctor.writePath`) — advisory local write on soft hosts → **required**
54
- merge status as the hard boundary. Product path: [use.md — What you get](use.md#what-you-get) ·
55
+ **`ark-check --doctor`** (`doctor.writePath`) — operation-scoped local hard evidence where
56
+ observed, then **required** merge status as the all-path boundary. Product path:
57
+ [use.md — What you get](use.md#what-you-get) ·
55
58
  [README host matrix](../README.md#host-enforcement-support).
56
59
 
57
60
  **MCP project identity (4.2.0):** before trusting project-specific MCP evidence, call
@@ -94,7 +97,8 @@ One human often has **N checkouts** and **N package pins**. Product rules:
94
97
  | One checkout = one `project.expectedRoot` | Identity (WI01) fail-closes cross-project evidence when used correctly |
95
98
  | After `npm install arkgate@…`, restart/retarget Ark MCP | Process `arkgateVersion` is startup-loaded; long-lived MCP can lag install |
96
99
  | Read `processPackage` on every tool response | `processPackageMismatch` / `processStale` + `nextAction` when process ≠ project install |
97
- | Prefer project-local CLI until versions align | CLI always available; MCP analysis is not “fully current” while process is stale |
100
+ | Stale MCP in 4.6.4+ | `ark_identity` stays diagnostic; project tools return `PROCESS_PACKAGE_STALE` and top-level `authoritative:false` until restart |
101
+ | Prefer project-local CLI until versions align | A modern stale global `ark upgrade` hands off automatically; pre-4.6.4 globals need one `npx arkgate upgrade` entry |
98
102
  | Upgrade each package that pins arkgate | Monorepo “done” is not one package’s pin |
99
103
  | Registry-aware `ark upgrade --apply` | Does not false-skip when CLI == pin but registry is ahead; skip JSON has `reasonCode` + `suggestedInstallCmd` |
100
104
  | Skills: `skillDrift` + optional `--refresh-skills` | Customized skill bodies stay preserved unless you opt in; never silent overwrite of true edits |
@@ -1187,8 +1191,10 @@ Register the server itself in `.mcp.json` so the agent can handshake with `ark_i
1187
1191
  }
1188
1192
  ```
1189
1193
 
1190
- On Claude/Grok, the installed PreToolUse hook makes matched writes an enforced checkpoint. MCP
1191
- registration by itself remains advisory on every host because the agent must call the tool.
1194
+ On Claude/Grok, the installed PreToolUse hook makes matched writes an enforced checkpoint. Cursor
1195
+ does the same for Write/StrReplace, and Codex CLI/local Desktop does so for complete
1196
+ `apply_patch` calls after trust and runtime observation. MCP registration by itself remains
1197
+ advisory on every host because the agent must call the tool.
1192
1198
 
1193
1199
  Decision rationale: [ADR 0017 — MCP verdicts require explicit project identity](adr/0017-mcp-project-identity-binding.md).
1194
1200
 
package/docs/ai-gates.md CHANGED
@@ -12,15 +12,17 @@ overview: [develop.md](develop.md) · hub: [README.md](README.md).
12
12
  | **Claude Code** | Hard PreToolUse for listed ops when installed + trusted + (for `hard:true`) runtime-observed | Required `arkgate-check --strict-merge` status |
13
13
  | **Grok Build** | Hard PreToolUse for listed ops when installed + trusted + (for `hard:true`) runtime-observed | Required `arkgate-check --strict-merge` status |
14
14
  | **Google Antigravity** | Hard PreToolUse for listed write tools when installed + trusted + (for `hard:true`) runtime-observed | Required `arkgate-check --strict-merge` status |
15
- | **Cursor** | **Advisory only** (MCP/rules) no hard PreToolUse | Required CI status (same check) |
16
- | **OpenAI Codex** | **Advisory / best-effort** (MCP + optional hooks.json) **not** equivalent to Claude/Grok hard block | Required CI status (same check) |
15
+ | **Cursor** | Hard preToolUse for Write/StrReplace when installed + trusted + runtime-observed | Required CI status (same check) |
16
+ | **OpenAI Codex** | Hard PreToolUse for complete local `apply_patch` in CLI/Desktop when installed + trusted + runtime-observed | Required CI status (same check) |
17
17
  | **OpenCode** | **Advisory / best-effort** (MCP + optional experimental plugin) — **not** a hard boundary | Required CI status (same check) |
18
18
 
19
- On Claude Code, Grok Build, and Google Antigravity, an installed and trusted PreToolUse hook can
20
- block matched writes before they land on disk. Cursor, OpenAI Codex, and OpenCode use advisory MCP
21
- validation at write time; CI is their hard repository check. Codex 0.123+ dispatches hooks for its
22
- native `apply_patch` handler, but Code Mode hosts can execute deferred nested writes without that
23
- project hook event. OpenCode `tool.execute.before` plugins have known subagent bypass holes. See
19
+ On Claude Code, Grok Build, Google Antigravity, Cursor, and Codex, an installed and trusted
20
+ PreToolUse hook can block the listed local operation before it lands on disk. Codex’s claim is
21
+ intentionally narrow: Ark must reconstruct the complete `apply_patch`, and a fresh hook invocation
22
+ must prove the operation. Current Codex CLI and local ChatGPT Desktop/App Server send the patch in
23
+ `tool_input.command`; hosted tools, specialized opt-out paths, shell/direct writes, and incomplete
24
+ patches remain outside that local claim. OpenCode `tool.execute.before` plugins have known subagent
25
+ bypass holes. See
24
26
  the [canonical host support matrix](../README.md#host-enforcement-support) before installing. The
25
27
  advisory-local / hard-CI split is a deliberate trade-off: local surfaces optimize feedback speed,
26
28
  while a required merge status is the one boundary a repository can make every write path share.
@@ -327,29 +329,34 @@ Your repository backstop remains CI: `ark-check` fails its check on anything tha
327
329
  through (Shell bypass, Tab, incomplete coverage). It blocks the merge only when that status
328
330
  is required by repository policy.
329
331
 
330
- ## OpenAI Codex CLI
332
+ ## OpenAI Codex CLI and local Desktop
331
333
 
332
334
  Recommended for Ark projects.
333
335
 
336
+ Platform authority: [Codex Hooks](https://developers.openai.com/codex/hooks) ·
337
+ [Advanced configuration](https://developers.openai.com/codex/config-advanced) ·
338
+ [App Server](https://developers.openai.com/codex/app-server). Project-local hooks run only after
339
+ the project and exact hook definition are trusted.
340
+
334
341
  Codex 0.123+ dispatches `PreToolUse` for the native `apply_patch` handler. Ark installs
335
342
  `.codex/hooks.json` with `ApplyPatch|apply_patch|Write|Edit|MultiEdit` aliases and reconstructs
336
343
  every added or updated file in a multi-file patch before allowing it. The hook passes
337
344
  `--root . --root-env CODEX_PROJECT_DIR`: ArkGate reads the environment directly without
338
345
  POSIX shell expansion and safely falls back to the hook working directory.
339
346
 
340
- This hook is best-effort in Codex Code Mode: some hosts execute deferred nested `apply_patch`
341
- calls without dispatching the project `PreToolUse` event. ArkGate therefore does not treat the
342
- presence of `.codex/hooks.json` as a universal hard-write guarantee; MCP remains advisory and the
343
- required CI status is the hard repository boundary.
347
+ The trusted hook is a hard boundary for the covered local operation, not a universal Codex
348
+ guarantee. ArkGate claims `hard:true` only while processing a complete runtime-observed
349
+ `apply_patch`; `.codex/hooks.json` on disk is merely configured/unverified. Hosted tools,
350
+ specialized opt-out paths, shell/direct writes, and incomplete reconstruction remain CI-backed.
344
351
 
345
352
  ```bash
346
353
  npx ark-check --install-agent-gates --tools codex
347
354
  ```
348
355
 
349
356
  The generated hook includes `--hook-repair`, so a rejected patch **may emit** a structured
350
- repair envelope (same JSON shape as Claude/Grok). **Reinjection is not guaranteed** on Codex
351
- local write stays advisory/bypassable; the host must re-apply any fix, and required CI remains
352
- the hard merge boundary. Codex still needs hook trust enabled for the project.
357
+ repair envelope (same JSON shape as Claude/Grok). **Reinjection is not guaranteed** on Codex:
358
+ the host must re-apply any fix. Exit `2` is the supported deny, and required CI remains the
359
+ all-path hard merge boundary. Codex still needs hook trust enabled for the project.
353
360
 
354
361
  Modern Codex resolves MCP servers from the active project's `.codex/config.toml`. Ark writes
355
362
  that file with relative paths, so every repository owns its primary `ark` binding without
@@ -409,8 +416,14 @@ observe a later MCP conversation from files alone. The matched `ark_identity` re
409
416
  runtime observation for that caller and live process; it does not mutate the setup JSON.
410
417
  `.codex/config.toml` by itself never upgrades `runtimeObserved` or `active`.
411
418
 
412
- Codex uses the best-effort local patch hook plus advisory MCP for discovery/validation and
413
- `ark-check` as the hard merge backstop. Register all three as soon as the repo is adopted.
419
+ After a package bump, a long-lived Ark MCP whose package version no longer matches the project is
420
+ non-authoritative. `ark_identity` reports `processPackage.processStale`; project tools return
421
+ `PROCESS_PACKAGE_STALE` until Codex/local Desktop restarts or retargets the server. A modern
422
+ outside-tree/global `ark upgrade` hands the original invocation to the project-local CLI.
423
+
424
+ Codex uses an operation-scoped hard local patch hook plus advisory MCP for discovery/validation
425
+ and `ark-check` as the all-path hard merge backstop. Register all three as soon as the repo is
426
+ adopted.
414
427
 
415
428
  ### Legacy Codex home fallback
416
429
 
@@ -501,9 +514,10 @@ released from Ark ownership.
501
514
  home (`$CODEX_HOME/skills`). Home debt is **deferred** when the session host is not Codex.
502
515
  - Legacy flat prompts alone are reported as non-loadable skill debt with a
503
516
  `--skills-only --tools codex --force` (repo) or `--codex-home --force` (home) fix.
504
- - Codex **write path is advisory**: MCP + best-effort `.codex/hooks.json` is **not** a hard
505
- write boundary and is **not** equivalent to Claude/Grok PreToolUse hard-write + repair.
506
- The hard merge backstop is CI `--strict-merge` (or `--strict`) as a **required GitHub status context** (not “workflow file present”).
517
+ - Codex **complete local `apply_patch` is hard** when `.codex/hooks.json` is trusted and the
518
+ invocation is runtime-observed. MCP remains advisory; incomplete, hosted, specialized, shell,
519
+ and direct-write paths rely on CI `--strict-merge` (or `--strict`) as a **required GitHub status
520
+ context** (not “workflow file present”).
507
521
  - CI workflows that run ark-check without the fail-closed profile (or with only
508
522
  `--strict-config`) surface gap `enforcement-ci-not-fail-closed`.
509
523
 
package/docs/develop.md CHANGED
@@ -36,8 +36,9 @@ Local write hardness **differs by host**. CI required status is the shared hard
36
36
  | Host | Local write | MCP | Merge |
37
37
  |------|-------------|-----|-------|
38
38
  | Claude · Grok · Antigravity | Pre-write block when installed + trusted | Advisory | Required status context |
39
- | Codex · OpenCode | Warning only (not blocked) | Advisory | Required status context |
40
39
  | Cursor | Pre-write block for Write/StrReplace when `.cursor/hooks.json` is trusted | Advisory | Required status context |
40
+ | Codex CLI · local Desktop/App Server | Pre-write block for complete `apply_patch` when `.codex/hooks.json` is trusted | Advisory | Required status context |
41
+ | OpenCode | Warning only (not blocked) | Advisory | Required status context |
41
42
 
42
43
  Full matrix and install commands: [ai-gates.md](ai-gates.md) · canonical table in [README](../README.md#host-enforcement-support).
43
44
 
@@ -52,6 +53,8 @@ npx arkgate-check --install-agent-gates --skills-only --force
52
53
 
53
54
  Doctor reports what is actually installed and observed (`writePath` / enforcement state). Installed
54
55
  files alone do not imply `hard:true` without runtime evidence where the product requires it.
56
+ Codex hosted tools, specialized opt-out paths, shell/direct filesystem writes, and incomplete
57
+ patch reconstruction remain outside the local hard claim and rely on required CI.
55
58
 
56
59
  **Evidence split (Phase EH):** soft-write hosts keep `soft-write-host` in evidence without forcing
57
60
  global **Not finished** when the contract is ready. With `ARK_DOCTOR_GITHUB=1`, successful CI runs
@@ -72,6 +75,7 @@ can show `runtimeObserved: true` even when branch-protection policy is plan-unav
72
75
  | Session / project status snapshot | `ark status --json` · MCP `ark_status` · [session recipe](agent-guide.md#session-recipe-agent-turn) · schema `arkgate/schema/status-manifest` |
73
76
  | Status compass honesty | `improvementCompass.mode`: `full` \| `subset` \| `unavailable` · residual ⊆ doctor when `full` · [package-surface](package-surface.md) |
74
77
  | Managed upgrade self-service | `ark upgrade --json` → `selfService` (activation labels + customized preserve) · [package-surface](package-surface.md) |
78
+ | Stale MCP/global CLI recovery | `processPackage.processStale` → non-authoritative + `PROCESS_PACKAGE_STALE`; modern outside-tree `ark upgrade` hands off to project-local CLI |
75
79
  | Version-matched AGENTS projection | `ark agents-md` · [agent-guide](agent-guide.md) · **non-authoritative** (never enforces) |
76
80
  | Stable finding refs (`findingRef` / `targetKey`) | analysis-result schema **1.5** · [agent-guide](agent-guide.md) · [package-surface](package-surface.md) |
77
81
  | Agent Skills layout (same 13 names) | `templates/agent-skills/` · [agent-guide](agent-guide.md#install-skills-ark-and-ecosystem) · `npx skills add …` |
@@ -9,7 +9,7 @@ npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok
9
9
  Installs:
10
10
 
11
11
  - Write-path configuration (Claude/Grok/Antigravity/Cursor hard PreToolUse when covered;
12
- Codex advisory MCP)
12
+ Codex hard complete local `apply_patch`; OpenCode advisory)
13
13
  — PreToolUse / Cursor `preToolUse` uses **`--hook-repair`** (W4): on deny, stderr may include
14
14
  `ARK_REPAIR_JSON` / `ARK_AUTOPATCH_JSON` for hosts that re-inject a patch.
15
15
  Still exit 2 / hard block; never silent write. Drop `--hook-repair` for
@@ -17,12 +17,13 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
17
17
  | Surface | How you use it | Stability notes |
18
18
  |---------|----------------|-----------------|
19
19
  | **CLI** | `arkgate` / `arkgate-check` (aliases `ark` / `ark-check`) | Flags and human text may improve; **JSON output shapes** for `--json` (check, doctor, plan, coverage, recommend, **status**, **agents-md**) are stable within a major. Additive fields OK; removals/renames are major. From 4.2, `--require-gates` implies strict config and verifies semantic Ark AGENTS, project-rooted MCP/compact Codex registration, and fail-closed CI rather than file presence alone. `ark status --json` is the unified status snapshot. `ark agents-md` is the version-matched agent projection (non-authoritative). |
20
+ | **Host write boundaries** | Generated trusted PreToolUse/preToolUse hooks + `ark-mcp --hook`; inspect with doctor/status | Hard is always operation-scoped and runtime-evidenced. From 4.6.3, Codex CLI and local ChatGPT Desktop/App Server can hard-block a complete `apply_patch` sent as `tool_input.command`; `.codex/hooks.json` on disk remains unverified until a fresh covered invocation. Hosted tools, specialized hook opt-outs, shell/direct writes, incomplete reconstruction, and humans rely on required CI. Repair envelopes may emit, but Codex reinjection is not guaranteed. |
20
21
  | **Programmatic gate API** | `import { analyzeProject, loadContract, createAICodeGate, ... } from 'arkgate'` | The root export is the static gate/config/analysis contract listed below. It intentionally contains no runtime-kernel implementation. |
21
22
  | **Improvement compass (4.4; status honesty 4.5)** | `ark-check --doctor --json` → `doctor.improvementCompass`; human doctor section **Improvement compass (not a score)**; HTML report `data-advisory="improvementCompass"`. **`ark status --json` / MCP `ark_status`** project a thin `improvementCompass` residual map with explicit honesty **`mode`**: `full` \| `subset` \| `unavailable` (always `notAScore: true`). When `mode` is `full`, status residual lens **ids** are a **subset of** doctor residual for the same facts (report snapshot stores the thin slice after `--report`). Incomplete or missing session facts → `subset` / `unavailable` + `reasonCode` / `reason` — **never invent green residual**. Residual never flips `valid` / strict-merge / `goal.met`. When status mode ≠ full, run doctor for full 15-lens detail. | Additive schema `1.0`. Closed **15** lens ids (`soc`, `cohesion`, `coupling`, `srp`, `dip`, `ocp`, `encapsulation`, `modularity`, `scalability`, `resilience`, `security`, `maintainability`, `testability`, `domain`, `stack`) with status `ok` \| `residual` \| `not-instrumented` \| `out-of-scope`, evidence refs, optional `nextAction`, capped `topResidual`, always **`notAScore: true`**. Projection from existing smells / walls / cohesion / ArkRules / design-weak only — **never** a gate input. Out-of-scope locked for scalability, resilience, and app security (no residual invent from missing SAST/APM). Root API: `buildImprovementCompass` / `IMPROVEMENT_LENS_IDS`; status: `projectStatusImprovementCompass` / `STATUS_COMPASS_MODES`. |
22
23
  | **Deep-module coach (post-4.5 advisory)** | `ark-check --doctor --json` → `doctor.deepModuleCoach`; human doctor section **Deep-module coach (advisory — not a score)** always when doctor runs (empty candidates / hot-path `unavailable` are honesty, not omission); HTML `data-advisory="deepModuleCoach"`. | Additive schema `1.0`. Always **`notAScore: true`**. **`hotPaths`**: recent-churn heuristic from bounded git log; `available` + `status` `ok` \| `unavailable`; empty `paths` when history missing/incomplete — **never invent**. **`deepeningCandidates`**: cards projected only from existing design smells / physical cohesion / reshape pilot / pilotLoop / residual compass lenses — **empty when no evidence** (no fake candidates). Never flips `valid`, strict-merge, completeness green, or `goal.met`. Prefer deep modules / named seams / test-at-public-interface process language in skills. Domain pure + CLI gen mirror (`deepeningCoach.ts` / `bin/lib/deepening-coach.mjs`); **not** a root package export — consume via `doctor.deepModuleCoach` (or the gen mirror in Tooling). |
23
- | **Upgrade what’s new (4.5.6+)** | `ark upgrade --json` → `whatsNew` (+ human **Suggested improvements** block; also on preview). | Always **`notAScore: true`**, **`neverGateInput: true`**. Closed try/inspect list: deep-module coach, improvement compass, session/status honesty, two-axis done, self-service honesty, registry-aware upgrade, skill drift/refresh, multi-project MCP. Never invents residual or flips gates. |
24
+ | **Upgrade what’s new (4.5.6+)** | `ark upgrade --json` → `whatsNew` (+ human **Suggested improvements** block; also on preview). | Always **`notAScore: true`**, **`neverGateInput: true`**. Closed try/inspect list: deep-module coach, improvement compass, session/status honesty, two-axis done, self-service honesty, registry-aware upgrade, skill drift/refresh, multi-project MCP, Codex hard-write refresh/trust/restart/verify, stale MCP/global CLI recovery. Never invents residual or flips gates. |
24
25
  | **Field upgrade truth (4.5.6)** | `ark upgrade` registry-aware install; JSON `reasonCode` / `suggestedInstallCmd`; `skillDrift`; `--refresh-skills`; `postUpgradeChecks`; `hostSelection`. | No false-skip when registry ahead; offline honesty; customized skills preserved unless opt-in refresh; checks are advisory only. |
25
- | **MCP process package honesty (4.5.6)** | Every MCP tool context → `processPackage` (`processPackageMismatch` / `processStale`, versions, `nextAction`). | Multi-checkout users: restart MCP after pin bump; prefer project-local CLI until identity matched and versions align. Fail-closed identity (WI01) unchanged. |
26
+ | **MCP process package honesty (4.5.6; fail-closed in 4.6.4)** | Every MCP tool context → `processPackage` (`processPackageMismatch` / `processStale`, versions, `nextAction`). | Multi-checkout users: restart MCP after pin bump. From 4.6.4, stale process context is non-authoritative; `ark_identity` remains diagnostic and project tools return `PROCESS_PACKAGE_STALE` until restart/retarget. Prefer project-local CLI until identity matched and versions align. |
26
27
  | **Doctor design fitness** | `ark-check --doctor --json` → `doctor.designFitness`, `doctor.designSmells[]` | Additive. Stable smell `id`s: `io-under-application`, `handler-in-persistence`, `god-module`, `domain-logic-in-ui`, `facade-sql-in-routes`, `mixed-pattern-cluster`, `soft-contract`. `handler-in-persistence` covers static ES imports/re-exports of framework HTTP surfaces (`next/server`), `defineRoute` calls, and existing handler bodies inside Persistence-role layers or specific persistence paths; `require()` and dynamic `import()` are outside this narrow advisory, and a generic `Infrastructure` role alone is not Persistence. Persistence candidates are filtered and sorted before the bounded content scan so large application prefixes cannot hide the advisory. The detector inspects the first 800 sorted Persistence candidates; later candidates are uninspected, so **absence of a smell is not full-tree proof** above that envelope (incomplete/`partial` analysis also never proves “no smells”). **4.2 feedback hardening:** mode labels preserve the observed SUGGEST/ADAPT/ENFORCE state; a local permission/UI-state `canEdit` name alone is not a domain smell; real UI business rules route Domain → Application → UI; seed/fixture/demo/migration/generated files are not god-module pilots. Each smell has `evidence[]`, `fix`, technical `message`, and plain-language **`outcome`**. Does **not** fail the gate by itself. |
27
28
  | **Post-green Shape door** | `doctor.postGreenPath`, `doctor.primaryNextAction`, `doctor.healthyFinishedForbidden` | Additive when `designFitness.designWeak`. Single Shape door (`id: clarify-for-ai`): explore shape-focus → dual-plan B → autopilot only with OK. Never empty plan A = healthy finished. |
28
29
  | **Golden pattern (new code)** | Optional `.ark/golden-pattern.json`; doctor JSON `doctor.goldenPattern`; MCP `ark_place` / `ark_prepare_write` → `goldenPattern` | Additive, **advisory for NEW code only**. Required fields: `name`, `norm`; optional `newCodeHome`, `examplePath`, `schemaVersion`. **Absent is normal** (no claim). Never ENFORCE; never clears design-weak. Malformed → `invalid: true`, not silent guidance. |
@@ -210,9 +211,9 @@ production deployment would need to satisfy; it is not a readiness certification
210
211
  ## Release notes (maintainers)
211
212
 
212
213
  Ship notes for a version live under [releases/](https://github.com/pedroknigge/arkgate/tree/main/docs/releases)
213
- (prepared: [4.6.2.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.2.md);
214
- current published: [4.6.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.1.md);
215
- prior published: [4.6.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.0.md), [4.5.7.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.7.md), [4.5.6.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.6.md), [4.5.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.0.md), [4.4.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.4.0.md), [4.3.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.3.0.md),
214
+ (prepared: [4.6.4.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.4.md);
215
+ current published: [4.6.3.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.3.md);
216
+ prior published: [4.6.2.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.2.md), [4.6.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.1.md), [4.6.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.6.0.md), [4.5.7.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.7.md), [4.5.6.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.6.md), [4.5.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.0.md), [4.4.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.4.0.md), [4.3.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.3.0.md),
216
217
  [4.2.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.1.md);
217
218
  previous: [4.2.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.0.md),
218
219
  [4.1.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.1.md),
@@ -106,7 +106,7 @@ stay stable unless a change explicitly adds an alias.
106
106
  | **runtime observed** | runtime observed | A live `ark_identity` matched this workspace |
107
107
  | **required CI status** | required CI / status context | Merge hard boundary: required GitHub status running `arkgate-check --strict-merge` |
108
108
  | **config ready** | contract ready | Project/import-rules/ArkRules honesty clear — not the same as a local pre-write block |
109
- | **host limitation** | environment residual | Permanent soft-write host (e.g. Codex) — do not paint the whole project unfinished |
109
+ | **host limitation** | environment residual | Soft-write or uncovered host path (e.g. OpenCode, hosted/specialized tools) — do not paint the whole project unfinished |
110
110
  | **allowed rule ids** | guardrail catalog | Closed vocabulary of sensors, capabilities, `ruleId`s, skill roles |
111
111
  | **check (tool)** | scan | Deterministic engine / CLI / MCP. Same inputs → same verdict. No LLM. |
112
112
  | **coaching / your judgment** | process | Skill- or agent-side. **Never** package pass/fail |
@@ -178,8 +178,8 @@ gate → same binary verdict on every parity-capable adapter
178
178
  | Name the status light + plain fact + next action | “Enforce · leftover design work. Import rules check out; design smells remain. Next: one Shape door — explore → plan B → autopilot with OK.” |
179
179
  | Rank one primary door under residual | Doctor **Primary next action** #1; **Also** only for secondary |
180
180
  | Label expert skills as escapes | “Install skill pack only when doctor or a STOP handoff names a skill.” |
181
- | State host write honesty | “Cursor: pre-write block for Write/StrReplace when hooks are trusted. Codex: warning only (not blocked). Required GitHub status is the merge boundary.” |
182
- | Soft-write ≠ unfinished project | “Architecture contract ready; Codex local writes are advisory.” Keep `soft-write-host` in evidence; reserve **Not finished** for contract/project debt. |
181
+ | State host write honesty | “Cursor blocks trusted Write/StrReplace. Codex blocks complete trusted local `apply_patch` after runtime observation. Required GitHub status covers every path.” |
182
+ | Soft/unverified write ≠ unfinished project | “Architecture config ready; this host operation is advisory or unverified.” Keep environment residual in evidence; reserve **Not finished** for config/project debt. |
183
183
  | Keep Suggest on start → doctor | New-here primary is finish `start`, not a competing recommend/architect curriculum |
184
184
  | Qualify import-clean under leftover design | “None on checked imports … leftover design work remains. Not healthy finished.” |
185
185
  | Prefer unverified-as-not-green | Incomplete analysis, unobserved hooks, and soft MCP never paint as a hard green pre-write block |
@@ -208,7 +208,7 @@ gate → same binary verdict on every parity-capable adapter
208
208
  | Skill-shopping lists as the default curriculum | Progressive disclosure: one door first |
209
209
  | “Healthy / done” while leftover design work remains | False done |
210
210
  | “Honesty clear” as “architecture finished” | Honesty clear only means residual honesty sensors are quiet; graph/mode debt is separate |
211
- | “Not finished” solely because host is Codex/Cursor | Soft-write is environment residual; do not paint a green whole-tree project as unfinished architecture |
211
+ | “Not finished” solely because a host hook is unverified or one host path is advisory | Environment residual is not architecture debt; do not paint a green whole-tree project as unfinished architecture |
212
212
  | “MCP installed / active” because a config file exists | Say **configured on disk · runtime unverified** until `ark_identity` matches the expected root |
213
213
  | Treating an unverified legacy MCP call as authoritative | Compatibility is not proof; require `binding.status: "matched"` and `authoritative: true` |
214
214
  | “Handler means controller” / “every constant is a business rule” | ArkRules inventory uses configured layer context and suppresses narrow technical/test evidence; candidates remain prompts for judgment |
@@ -32,7 +32,7 @@ infrastructure beyond how this package is published.
32
32
  | T3 | CI job missing / not required | Merge green without architecture | doctor `enforcement-ci-*` gaps; `--strict-merge`; required-status remains locally `unverified` |
33
33
  | T4 | Config weakened (`peerIsolation: false`, empty rules) | False green | semantic policy-delta guard in strict merge; hash-bound explicit acknowledgement; present-state safety diagnostics |
34
34
  | T5 | Baseline ratcheted open | Debt reintroduced | baseline unused/stale signals; occurrence keys |
35
- | T6 | Dual MCP bin / wrong root | Gate points at wrong tree | migrate-commands; Codex fail-closed temp roots |
35
+ | T6 | Stale MCP/global CLI or wrong root | Gate points at old package / wrong tree | project identity binding; stale process non-authoritative + `PROCESS_PACKAGE_STALE`; project-local upgrade handoff |
36
36
  | T7 | Malicious dependency in publish | Compromised gate | signed tags, npm provenance, dependency-review, CodeQL, Semgrep, `verify-package-files` |
37
37
  | T8 | Path traversal in hooks/check | Read/write outside project | root resolution + under-root import resolve |
38
38
  | T9 | Runtime InMemory mistaken for durable | Data loss | durability stance docs + safety InMemory production detector |
@@ -44,13 +44,17 @@ infrastructure beyond how this package is published.
44
44
 
45
45
  ```
46
46
  Claude/Grok host --PreToolUse--> arkgate-mcp (hard only for observed covered operation)
47
- Codex ApplyPatch --PreToolUse--> arkgate-mcp (atomic feedback; bypassable/non-hard host profile)
47
+ Codex apply_patch --PreToolUse--> arkgate-mcp (hard for complete trusted + observed local operation)
48
48
  Any MCP host --tool call----> arkgate-mcp (advisory validation)
49
49
  Human IDE --disk/git-----> working tree
50
50
  working tree --PR-----------> CI ark-check --strict-merge
51
51
  npm publish <-- signed tag --- GitHub Release + provenance
52
52
  ```
53
53
 
54
+ Codex hosted tools, specialized hook opt-outs, shell/direct writes, and incomplete patch
55
+ reconstruction do not inherit the local `apply_patch` claim; required CI remains the shared
56
+ all-path merge boundary.
57
+
54
58
  ## Residual risk (accepted)
55
59
 
56
60
  - Branch protection is **external GitHub state** — doctor reports honestly when unavailable.
package/docs/use.md CHANGED
@@ -49,7 +49,12 @@ In those cases a boundary linter or editor rules may be enough; see [README —
49
49
  | Before merge | Make the Ark job a **required GitHub status context** running `arkgate-check --strict-merge` (alias `ark-check`) |
50
50
  | Anytime | Doctor: Suggest / Adapt / Enforce (+ leftover design work if the design is still messy) |
51
51
 
52
- **Cursor:** pre-write block for Write/StrReplace when `.cursor/hooks.json` is trusted. **Codex / OpenCode:** local write stays advisory (warning only, not blocked) — that is not unfinished architecture. Doctor may say **contract ready** while still reminding you that those hosts do not hard-block writes; **Not finished** is reserved for real project/contract debt.
52
+ **Cursor:** pre-write block for Write/StrReplace when `.cursor/hooks.json` is trusted.
53
+ **Codex CLI / local Desktop:** pre-write block for a complete `apply_patch` when
54
+ `.codex/hooks.json` is trusted and the operation is observed. Hosted/specialized paths,
55
+ shell/direct writes, and incomplete patches still rely on CI. **OpenCode:** local write stays
56
+ advisory (warning only, not blocked). An unverified host hook is environment evidence, not
57
+ unfinished architecture; **Not finished** is reserved for real project/config debt.
53
58
 
54
59
  ArkGate is **not** a web framework, ORM, or app runtime. It is architecture enforcement + a coach for AI TypeScript.
55
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkgate",
3
- "version": "4.6.2",
3
+ "version": "4.6.4",
4
4
  "description": "One architecture config. One check. One coach.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/server.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.pedroknigge/arkgate",
4
- "description": "When your agent writes TypeScript, ArkGate stops it from breaking the layers — and CI rejects the merge if it still does.",
4
+ "description": "When your agent writes TypeScript, ArkGate stops it from breaking the layers.",
5
5
  "repository": {
6
6
  "url": "https://github.com/pedroknigge/arkgate",
7
7
  "source": "github"
8
8
  },
9
- "version": "4.6.2",
9
+ "version": "4.6.4",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "arkgate",
14
- "version": "4.6.2",
14
+ "version": "4.6.4",
15
15
  "runtimeHint": "npx",
16
16
  "transport": {
17
17
  "type": "stdio"
@@ -7,7 +7,7 @@
7
7
  This directory is the **Agent Skills–compatible** packaging of the same **13**
8
8
  `/ark-*` skills shipped as flat templates for Ark install. **No new skill names.**
9
9
 
10
- Package version when last generated context: **arkgate@4.6.2**
10
+ Package version when last generated context: **arkgate@4.6.4**
11
11
  Schema: agent-skills package contract `1.0`
12
12
 
13
13
  ## Skills (frozen catalog)
@@ -128,9 +128,10 @@ because governed% is 100% and plan is empty.
128
128
  **Honesty hard lines (doctor JSON):**
129
129
  - `coverageHonesty.worseThanNoGate` / weak coverage (~&lt;50%): green is **worse than no gate**.
130
130
  - `baseline.honesty.dirtyBaselineRisk`: green-via-freeze may hide false-positive debt.
131
- - `writePath.honesty.softWriteHost` (Cursor / Codex / OpenCode): write path is **advisory /
132
- best-effort**, not hard PreToolUse — required CI status is the hard merge boundary.
133
- - Do not invent hard write guarantees for soft hosts.
131
+ - `writePath.honesty.softWriteHost` (OpenCode or another uncovered path): write path is
132
+ **advisory / best-effort**, not hard PreToolUse — required CI status is the hard merge boundary.
133
+ - Cursor hard evidence is limited to trusted Write/StrReplace; Codex is limited to a complete,
134
+ trusted, runtime-observed local `apply_patch`. Do not borrow either claim for other paths.
134
135
 
135
136
  ## Related onboarding
136
137
 
@@ -58,6 +58,15 @@ line (advisory only — not a score):
58
58
  6. **Registry-aware upgrade** — `reasonCode` / `suggestedInstallCmd` when package install is skipped or needed
59
59
  7. **Skill drift + refresh** — `skillDrift`; opt-in `--refresh-skills` for customized skill rewrite
60
60
  8. **Multi-project MCP** — `processPackage` mismatch/stale on every MCP tool; restart after package bump
61
+ 9. **Codex hard write refresh** — run
62
+ `npx arkgate-check --install-agent-gates --tools codex --force`, restart Codex/local Desktop,
63
+ review and trust the exact hook, then inspect `doctor.writePath` after a governed
64
+ `apply_patch`. Only a complete runtime-observed local patch is hard; every other path still
65
+ relies on required CI.
66
+ 10. **Stale process recovery** — a stale Ark MCP is non-authoritative and project tools return
67
+ `PROCESS_PACKAGE_STALE` until restart/retarget. If a modern global `ark upgrade` is older than
68
+ the project install, it hands the same invocation to the project-local CLI instead of managing
69
+ the project from the stale PATH binary.
61
70
 
62
71
  Never invent gate verdicts from these suggestions. Missing residual is honest empty, not green.
63
72
 
@@ -95,8 +104,10 @@ restart/retargeting is required. `ark://manifest` never satisfies this preflight
95
104
 
96
105
  **Process package honesty:** every tool response includes `processPackage` (`processArkgateVersion`,
97
106
  `projectInstalledVersion`, `processPackageMismatch` / `processStale`, `nextAction`). After
98
- `npm install arkgate@…`, **restart/retarget MCP** so process version matches install. Until then,
99
- prefer project-local CLI and do not treat MCP analysis as fully current.
107
+ `npm install arkgate@…`, **restart/retarget MCP** so process version matches install. From 4.6.4,
108
+ a stale MCP is non-authoritative: `ark_identity` diagnoses it and project tools return
109
+ `PROCESS_PACKAGE_STALE` until restart. Prefer project-local CLI meanwhile. A modern stale global
110
+ `ark upgrade` hands off automatically; pre-4.6.4 globals need one `npx arkgate upgrade` entry.
100
111
 
101
112
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
102
113
 
@@ -128,9 +128,10 @@ because governed% is 100% and plan is empty.
128
128
  **Honesty hard lines (doctor JSON):**
129
129
  - `coverageHonesty.worseThanNoGate` / weak coverage (~&lt;50%): green is **worse than no gate**.
130
130
  - `baseline.honesty.dirtyBaselineRisk`: green-via-freeze may hide false-positive debt.
131
- - `writePath.honesty.softWriteHost` (Cursor / Codex / OpenCode): write path is **advisory /
132
- best-effort**, not hard PreToolUse — required CI status is the hard merge boundary.
133
- - Do not invent hard write guarantees for soft hosts.
131
+ - `writePath.honesty.softWriteHost` (OpenCode or another uncovered path): write path is
132
+ **advisory / best-effort**, not hard PreToolUse — required CI status is the hard merge boundary.
133
+ - Cursor hard evidence is limited to trusted Write/StrReplace; Codex is limited to a complete,
134
+ trusted, runtime-observed local `apply_patch`. Do not borrow either claim for other paths.
134
135
 
135
136
  ## Related onboarding
136
137
 
@@ -58,6 +58,15 @@ line (advisory only — not a score):
58
58
  6. **Registry-aware upgrade** — `reasonCode` / `suggestedInstallCmd` when package install is skipped or needed
59
59
  7. **Skill drift + refresh** — `skillDrift`; opt-in `--refresh-skills` for customized skill rewrite
60
60
  8. **Multi-project MCP** — `processPackage` mismatch/stale on every MCP tool; restart after package bump
61
+ 9. **Codex hard write refresh** — run
62
+ `npx arkgate-check --install-agent-gates --tools codex --force`, restart Codex/local Desktop,
63
+ review and trust the exact hook, then inspect `doctor.writePath` after a governed
64
+ `apply_patch`. Only a complete runtime-observed local patch is hard; every other path still
65
+ relies on required CI.
66
+ 10. **Stale process recovery** — a stale Ark MCP is non-authoritative and project tools return
67
+ `PROCESS_PACKAGE_STALE` until restart/retarget. If a modern global `ark upgrade` is older than
68
+ the project install, it hands the same invocation to the project-local CLI instead of managing
69
+ the project from the stale PATH binary.
61
70
 
62
71
  Never invent gate verdicts from these suggestions. Missing residual is honest empty, not green.
63
72
 
@@ -95,8 +104,10 @@ restart/retargeting is required. `ark://manifest` never satisfies this preflight
95
104
 
96
105
  **Process package honesty:** every tool response includes `processPackage` (`processArkgateVersion`,
97
106
  `projectInstalledVersion`, `processPackageMismatch` / `processStale`, `nextAction`). After
98
- `npm install arkgate@…`, **restart/retarget MCP** so process version matches install. Until then,
99
- prefer project-local CLI and do not treat MCP analysis as fully current.
107
+ `npm install arkgate@…`, **restart/retarget MCP** so process version matches install. From 4.6.4,
108
+ a stale MCP is non-authoritative: `ark_identity` diagnoses it and project tools return
109
+ `PROCESS_PACKAGE_STALE` until restart. Prefer project-local CLI meanwhile. A modern stale global
110
+ `ark upgrade` hands off automatically; pre-4.6.4 globals need one `npx arkgate upgrade` entry.
100
111
 
101
112
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
102
113