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.
@@ -1,8 +1,13 @@
1
1
  # ArkGate — Agent Integration Guide
2
2
 
3
- **ArkGate** (`arkgate`) — architecture co-pilot for AI TypeScript. This guide describes how AI
4
- agents and codegen tools safely interact with write hooks, advisory MCP tools, CI, and `/ark-*`
5
- skills. Guarantees differ by host; start with the
3
+ **ArkGate** (`arkgate`) — architecture co-pilot for AI TypeScript. This guide is the **develop**
4
+ reference for agents and codegen: write hooks, advisory MCP tools, CI, and `/ark-*` skills.
5
+
6
+ - Product path (anyone): [use.md](use.md)
7
+ - Integration overview: [develop.md](develop.md)
8
+ - Docs hub: [README.md](README.md)
9
+
10
+ Guarantees differ by host; start with the
6
11
  [canonical host support matrix](../README.md#host-enforcement-support). The advisory-local /
7
12
  hard-CI split is a deliberate trade-off, not a gap: local hooks and MCP coach at write time,
8
13
  while a required merge status is the one boundary a repository can make every write path share.
@@ -10,8 +15,30 @@ while a required merge status is the one boundary a repository can make every wr
10
15
  CLI names: prefer **`arkgate` / `arkgate-check` / `arkgate-mcp`**; aliases `ark` / `ark-check` /
11
16
  `ark-mcp` still work for one major. **arkgate@3.8.0+** tests packed project TypeScript
12
17
  **5.9.3 / 6.0.3 / 7.0.2** and uses an exact, physically distinct TypeScript 6 analysis host when
13
- the project API is unusable. Published 3.7.0 predates that correction; see the distribution and
14
- completeness boundary in [typescript-support.md](typescript-support.md).
18
+ the project API is unusable. See the distribution and completeness boundary in
19
+ [typescript-support.md](typescript-support.md). Product English and progressive-disclosure rules:
20
+ [product-voice.md](product-voice.md).
21
+
22
+ ### Default path (3.9.0)
23
+
24
+ ```text
25
+ ark start → ark start --apply → ark-check --doctor
26
+ day to day: compact router / MCP place + validate + check
27
+ guided work: install skill pack → /ark-autopilot
28
+ ```
29
+
30
+ Doctor is the **control plane** (status light + primary next action). The compact router from
31
+ `ark start` is enough for normal feature work. Full `/ark-*` skills are **expert depth**:
32
+
33
+ ```bash
34
+ npx ark-check --install-agent-gates --skills-only --force
35
+ ```
36
+
37
+ **Write-path honesty:** Claude/Grok/Antigravity can hard-block listed PreToolUse ops when
38
+ installed and trusted. Cursor/Codex/OpenCode remain **advisory at write**. For every host, the
39
+ repository-wide hard boundary is a **required** CI status (`arkgate-check --strict-merge`) —
40
+ never claim Cursor/Codex/OpenCode hard write. See [ai-gates.md](ai-gates.md) and the README host
41
+ matrix.
15
42
 
16
43
  ## Architecture playbook and `ark-check --recommend`
17
44
 
@@ -72,8 +99,8 @@ npx ark-check --watch # debounced re-check when govern
72
99
  ```
73
100
 
74
101
  **Day-zero origin (2.12+):** `ark init` freezes `.ark/reports/origin.*` before writing agent
75
- docs or CI templates. Compact `ark start` previews first and keeps the applied setup under five
76
- project files and 25 KB;
102
+ docs or CI templates. Compact `ark start` previews first and keeps the applied setup small
103
+ (budget: 8 files / 32 KB including project `.mcp.json`);
77
104
  run `ark-check --report ark-report.html` explicitly when you want to establish an origin/evolution
78
105
  baseline. Do not `--reset-origin` unless the user explicitly wants a new baseline.
79
106
  `ark-check --report --no-archive` still creates `origin.*` on the first report (or on an explicit
@@ -89,12 +116,13 @@ To remove a compact host integration, preview `ark start --remove-host <host>` a
89
116
  only after review. Ark removes only its exact compact artifacts, leaves customized files untouched
90
117
  as unresolved decisions, and restores the integration with `ark start --tools <host> --apply`.
91
118
 
92
- **Skill roles (avoid overlap):** `/ark-explore` = map + dual-plan **seed** + Shape residual
93
- (no apply). `/ark-coverage` = Ark **fitness** only (governed/gates). `/ark-think` = one decision
94
- (2–3 options). `/ark-adopt` = brownfield Align/Stabilize + seed Shape B. `/ark-autopilot` =
95
- explore then apply A + propose/apply-with-ok B. `/ark-loop` = plan A only. Empty plan A is not
119
+ **Skill roles (expert depth — avoid overlap):** `/ark-autopilot` = **guided end-to-end** default
120
+ when skills are installed (explore apply A + propose/apply-with-ok B). `/ark-explore` = map +
121
+ dual-plan **seed** + Shape residual (no apply); primary post-green map half. `/ark-coverage` = Ark
122
+ **fitness** only (governed/gates). `/ark-think` = one decision (2–3 options). `/ark-adopt` =
123
+ brownfield Align/Stabilize + seed Shape B. `/ark-loop` = plan A only. Empty plan A is not
96
124
  “architecture healthy” if design-weak residual remains. Full routing table: full-install
97
- `AGENTS.md` / [README skill table](../README.md#other-skills-only-when-you-need-them).
125
+ `AGENTS.md` / [README expert skills](../README.md#expert-skills-escapes--not-onboarding).
98
126
 
99
127
  **Design fitness (3.0.1+ / Phase Q 3.0.3):** after edges are clean, doctor can still report **ENFORCE · design-weak**.
100
128
 
@@ -335,12 +363,16 @@ reference, and explanation for the full path (recommend → init → gallery →
335
363
 
336
364
  ### Agent workflow (before codegen)
337
365
 
366
+ **Default path first:** `ark start` → `ark start --apply` → `ark-check --doctor`. Doctor’s primary next action is the control plane; do not skill-shop around it.
367
+
368
+ Greenfield / empty-tree **depth** (only when doctor or a thin tree points here — not a second day-zero curriculum):
369
+
338
370
  1. Run `ark-check --recommend --json` or MCP `ark_recommend`.
339
371
  2. Read `archetype`, `preset`, and `adoptInOrder.phase1` — scaffold only those directories first.
340
- 3. Run `ark init --archetype <id> --yes`, `--apply-policy-pack enthusiast-<preset>`, or `ark init --preset <preset> --yes` when no `ark.config.json` exists.
372
+ 3. Run `ark init --archetype <id> --yes`, `--apply-policy-pack enthusiast-<preset>`, or `ark init --preset <preset> --yes` when no `ark.config.json` exists (or let `ark start --apply` install the compact contract).
341
373
  4. Optional: `--write-plan` for `ark-adoption-plan.json`; copy a gallery starter from `examples/README.md`.
342
374
  5. Use `/ark-place` or `ark_place` for individual files after the contract exists.
343
- 6. Verify with `ark-check --root . --config ark.config.json --strict`.
375
+ 6. Re-check with `ark-check --doctor`, then `ark-check --root . --config ark.config.json --strict`.
344
376
 
345
377
  ### Golden pattern for new code (Q03)
346
378
 
@@ -403,10 +435,14 @@ directories (`utils/`, `lib/`) must be classified explicitly via `/ark-contract`
403
435
 
404
436
  ## Supported agent hosts
405
437
 
406
- Wire write-gate + MCP + the full `/ark-*` skill set with:
438
+ **Day zero** is the compact path from `ark start` / `ark start --apply` (router + write path + CI plan) — not the full skill pack.
439
+
440
+ Wire write-gate + MCP for the active host; add the full `/ark-*` skill pack only as **expert depth** (`--skills-only` or full install when you want guided autopilot):
407
441
 
408
442
  ```bash
409
- npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok
443
+ npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok,antigravity,opencode
444
+ # expert pack on an existing compact install:
445
+ # npx ark-check --install-agent-gates --skills-only --force
410
446
  # alias: npx ark-check --install-agent-gates --tools claude,cursor,codex,grok
411
447
  ```
412
448
 
@@ -416,6 +452,8 @@ npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok
416
452
  | Cursor | `.cursor/mcp.json` + `.cursor/rules/ark.mdc` | `.cursor/commands/` |
417
453
  | OpenAI Codex | `.codex/config.toml` (project primary, relative `--root .`); optional legacy `$CODEX_HOME/config.toml` fallback uses absolute roots and scoped secondaries — see [ai-gates.md](ai-gates.md) | **Repo:** `.agents/skills/<name>/SKILL.md`; **home:** `$CODEX_HOME/skills/<name>/SKILL.md` (`--codex-home`) |
418
454
  | **Grok Build** | `.grok/hooks/ark-write-gate.json` + `.grok/config.toml` / `.mcp.json` | `.grok/skills/<name>/SKILL.md` |
455
+ | Google Antigravity | `.agents/hooks.json` (+ `GEMINI.md` for shared Gemini consumers) | `.agents/skills/<name>/SKILL.md` |
456
+ | OpenCode | `opencode.json` MCP (`type: local`; advisory) | `.opencode/skills/<name>/SKILL.md` |
419
457
 
420
458
  This is a path reference, not a guarantee table. Full copy-paste setups:
421
459
  [ai-gates.md](ai-gates.md). Skill inventory: main
@@ -866,7 +904,11 @@ Register the server itself in `.mcp.json` so the agent can read `ark://manifest`
866
904
  On Claude/Grok, the installed PreToolUse hook makes matched writes an enforced checkpoint. MCP
867
905
  registration by itself remains advisory on every host because the agent must call the tool.
868
906
 
869
- ## Recommended Agent Workflow
907
+ ## Experimental runtime kernel workflow (not the default path)
908
+
909
+ This section is for adopters who **opt into** the experimental `@arkgate/runtime` / kernel surfaces.
910
+ It is **not** the Beautiful Path day-zero curriculum. Default remains: `ark start` → doctor → compact
911
+ router (and `/ark-autopilot` only after the skill pack).
870
912
 
871
913
  1. **Read** manifest via `ark.manifest().toJSON()`
872
914
  2. **Generate** code using registered intents, profiles, metadata, projections, and workflow definitions
package/docs/ai-gates.md CHANGED
@@ -1,13 +1,30 @@
1
1
  # Gating AI Agents with ArkGate
2
2
 
3
3
  **ArkGate** (`arkgate`) is the architecture co-pilot for AI TypeScript (write gate · CI · plan/loop).
4
- On Claude Code and Grok Build, an installed and trusted PreToolUse hook can block matched writes
5
- before they land on disk. Cursor and OpenAI Codex use advisory MCP validation at write time; CI is
6
- their hard repository check. Codex 0.123+ dispatches hooks for its native `apply_patch` handler,
7
- but Code Mode hosts can execute deferred nested writes without that project hook event. See the
8
- [canonical host support matrix](../README.md#host-enforcement-support) before installing. The
4
+
5
+ This page is **develop** depth (install hooks/MCP/CI per host). Product path: [use.md](use.md) ·
6
+ overview: [develop.md](develop.md) · hub: [README.md](README.md).
7
+
8
+ ### Host write honesty (fail-closed)
9
+
10
+ | Host | Write-time boundary | Hard merge boundary |
11
+ |------|---------------------|---------------------|
12
+ | **Claude Code** | Hard PreToolUse for listed ops when installed + trusted + (for `hard:true`) runtime-observed | Required `arkgate-check --strict-merge` status |
13
+ | **Grok Build** | Hard PreToolUse for listed ops when installed + trusted + (for `hard:true`) runtime-observed | Required `arkgate-check --strict-merge` status |
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) |
17
+ | **OpenCode** | **Advisory / best-effort** (MCP + optional experimental plugin) — **not** a hard boundary | Required CI status (same check) |
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
24
+ the [canonical host support matrix](../README.md#host-enforcement-support) before installing. The
9
25
  advisory-local / hard-CI split is a deliberate trade-off: local surfaces optimize feedback speed,
10
26
  while a required merge status is the one boundary a repository can make every write path share.
27
+ Prefer fail-closed honesty over fake hard guarantees on advisory hosts.
11
28
 
12
29
  Everything below uses the same `ark.config.json` as `arkgate-check` / `ark-check` (CI) — one
13
30
  contract shared by every surface. Generate it once:
@@ -37,7 +54,8 @@ npx arkgate-check --install-agent-gates
37
54
 
38
55
  The command writes templates for `.mcp.json`, Claude hooks, Cursor MCP/rules,
39
56
  GitHub Actions, `AGENTS.md`, Codex `.codex/hooks.json` plus a TOML snippet under `docs/`, and (when
40
- selected) Grok Build project files under `.grok/`. It skips existing files unless
57
+ selected) Grok Build project files under `.grok/`, Antigravity `.agents/hooks.json`, and OpenCode
58
+ `opencode.json` MCP registration. It skips existing files unless
41
59
  you pass `--force`, so review and commit only the templates that match your project.
42
60
 
43
61
  **Doctor (W5):** `ark-check --doctor --json` includes `doctor.writePath`
@@ -338,9 +356,10 @@ When a valid project `.codex/config.toml` exists, doctor treats it as the effect
338
356
  does not report an unrelated home primary. Without a project binding, doctor surfaces the
339
357
  legacy multi-project state. **Deferred (fix when using Codex):**
340
358
  non-temp Codex-home gaps (`codex-home-multi-project`, stale `$CODEX_HOME/skills`) are
341
- severity **info**, marked `deferred: true`, and omitted from Top actions when the session
342
- host is known and not Codex `/ark-upgrade` on Grok/Claude is not Incomplete because of
343
- them. **Temp/upgrade primary roots** stay fail-closed urgent (rewritten, not multi-project).
359
+ severity **info**, marked `deferred: true`, and omitted from doctor **Primary next action** /
360
+ **Also** list (formerly “Top actions”) when the session host is known and not Codex
361
+ `/ark-upgrade` on Grok/Claude is not Incomplete because of them. **Temp/upgrade primary roots**
362
+ stay fail-closed urgent (rewritten, not multi-project).
344
363
 
345
364
  ### Codex skill catalog (SKILL.md, not flat prompts)
346
365
 
@@ -412,6 +431,69 @@ args = ["ark-mcp", "--root", ".", "--config", "ark.config.json"]
412
431
  Then restart Grok or refresh via `/mcps`. Pair with CI `ark-check`; require that status if it
413
432
  must block merges.
414
433
 
434
+ ## Google Antigravity (`antigravity` / `agy`)
435
+
436
+ Antigravity loads project hooks from **`.agents/hooks.json`** (also
437
+ `~/.gemini/config/hooks.json` for user-global). Official PreToolUse **`decision: "deny"`** is a
438
+ hard block for matched tools.
439
+
440
+ Install:
441
+
442
+ ```bash
443
+ npx ark-check --install-agent-gates --tools antigravity
444
+ # alias:
445
+ npx ark-check --install-agent-gates --tools agy
446
+ ```
447
+
448
+ | File | Role |
449
+ |------|------|
450
+ | `.agents/hooks.json` | Named hook `ark-write-gate` with PreToolUse on write tools |
451
+ | `GEMINI.md` | Instruction rule for Gemini CLI / legacy consumers sharing the tree |
452
+ | `.agents/skills/*/SKILL.md` | Agent Skills catalog (shared path with Codex) |
453
+ | `AGENTS.md` + `.mcp.json` + CI | Shared with other hosts |
454
+
455
+ **Write tools covered:** `write_to_file`, `replace_file_content`, `multi_replace_file_content`.
456
+ `ark-mcp --hook` accepts the Antigravity stdin shape (`toolCall.name` / `toolCall.args` with
457
+ PascalCase fields such as `TargetFile`, `CodeContent`, `TargetContent`, `ReplacementContent`,
458
+ `ReplacementChunks`). **Gating is stdout `decision`** (official PreToolUse contract): allow →
459
+ `{ "decision": "allow" }` on stdout (exit 0); deny → `{ "decision": "deny", "reason": "…" }` on
460
+ stdout (exit 2). Exit codes are secondary/plumbing for hosts that also honor them.
461
+
462
+ **Honesty:** hard for listed ops when installed + trusted, and for `hard:true` only with
463
+ runtime-observed covered PreToolUse evidence (same ladder as Claude/Grok). Alternate tools,
464
+ `run_command` shell writes, and human edits still rely on required CI. Doctor reports installed
465
+ evidence under host `antigravity`.
466
+
467
+ **Do not** confuse with the instruction-tier `gemini` tool id (GEMINI.md only) — selecting
468
+ `antigravity` also refreshes `GEMINI.md` for shared consumers without removing the separate
469
+ `gemini` install path.
470
+
471
+ ## OpenCode
472
+
473
+ OpenCode is first-class for MCP (`opencode.json` / `~/.config/opencode/opencode.json`) and supports
474
+ plugin hooks such as `tool.execute.before`. Plugin coverage is **not** a complete write boundary
475
+ (subagent and alternate tool paths may bypass).
476
+
477
+ Install:
478
+
479
+ ```bash
480
+ npx ark-check --install-agent-gates --tools opencode
481
+ ```
482
+
483
+ | File | Role |
484
+ |------|------|
485
+ | `opencode.json` | Merges local MCP server `ark` (`type: "local"`, command argv) |
486
+ | `.opencode/skills/*/SKILL.md` | Optional skill catalog when skills are installed |
487
+ | `AGENTS.md` + CI | Shared with other hosts |
488
+
489
+ **Write path (honest):** advisory MCP only. An optional experimental plugin template lives at
490
+ `templates/hooks/opencode-ark-write-gate.mjs` (copy into `.opencode/plugins/` if you want
491
+ best-effort `tool.execute.before` → `ark-mcp --hook`). Never claim hard write for OpenCode.
492
+ Pair with required CI `--strict-merge`.
493
+
494
+ Doctor detects `opencode.json` / `opencode.jsonc` MCP registration as advisory-write evidence for
495
+ host `opencode`.
496
+
415
497
  ## Instruction-tier agents: Windsurf, Cline, Copilot, Kiro, Roo Code, Continue, Gemini CLI
416
498
 
417
499
  Agents without MCP or hook support still follow the contract through an always-on
@@ -444,9 +526,13 @@ If your runtime can run a shell command before file writes and pass the tool pay
444
526
  - stdin (Claude): JSON `{ "tool_name": "Write|Edit|MultiEdit", "tool_input": { "file_path": ..., ... } }`
445
527
  - stdin (Grok): JSON `{ "toolName": "write|search_replace|…", "toolInput": { "file_path": ..., ... } }` (also accepts Claude names)
446
528
  - stdin (Codex): JSON `{ "tool_name": "apply_patch", "tool_input": { "patch": "*** Begin Patch…" } }`
529
+ - stdin (Antigravity): JSON `{ "toolCall": { "name": "write_to_file|…", "args": { "TargetFile": …, … } } }`
447
530
  - exit `0` → allow; exit `2` → block, human-readable violations on stderr
448
- - Grok payloads also get `{ "decision": "deny", "reason": "…" }` on stdout when blocked
449
- - plumbing problems (no stdin, non-source files, files outside `--root`) never block
531
+ - Grok: `{ "decision": "deny", "reason": "…" }` on stdout when blocked
532
+ - Antigravity: **stdout `decision` is required** allow `{ "decision": "allow" }`; deny →
533
+ `{ "decision": "deny", "reason": "…" }` (exit 2 still set on deny)
534
+ - plumbing problems (no stdin, non-source files, files outside `--root`) never block; Antigravity
535
+ still emits `{ "decision": "allow" }` on those fail-open paths
450
536
 
451
537
  ## ESLint (editor feedback) — bounded parity envelope
452
538
 
@@ -0,0 +1,127 @@
1
+ # Develop with ArkGate
2
+
3
+ For **developers** integrating ArkGate into a product repo: agents, CI, config, brownfield, and power tools.
4
+
5
+ If you only want the happy path, start at [use.md](use.md).
6
+
7
+ ---
8
+
9
+ ## Default integration
10
+
11
+ ```bash
12
+ npm install -D arkgate typescript
13
+ npx arkgate start --apply
14
+ npx arkgate-check --doctor
15
+ ```
16
+
17
+ Make the architecture check a **required** merge status (GitHub/GitLab/etc.):
18
+
19
+ ```yaml
20
+ - run: npx arkgate-check --root . --config ark.config.json --strict-merge
21
+ # or: uses: pedroknigge/arkgate@<tag-or-SHA>
22
+ ```
23
+
24
+ `--strict-merge` (or compatibility `--strict`) is the repository-wide hard boundary for every agent host.
25
+
26
+ ---
27
+
28
+ ## Host write path (honesty)
29
+
30
+ Local write hardness **differs by host**. CI required status is the shared hard merge gate.
31
+
32
+ | Host | Local write | MCP | Merge |
33
+ |------|-------------|-----|-------|
34
+ | Claude · Grok · Antigravity | Hard PreToolUse when installed + trusted | Advisory | Required status |
35
+ | Codex · OpenCode | Best-effort / advisory | Advisory | Required status |
36
+ | Cursor | Advisory only | Advisory | Required status |
37
+
38
+ Full matrix and install commands: [ai-gates.md](ai-gates.md) · canonical table in [README](../README.md#host-enforcement-support).
39
+
40
+ ```bash
41
+ # All common hosts (examples)
42
+ npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok
43
+ npx arkgate-check --install-agent-gates --tools antigravity # alias: agy
44
+ npx arkgate-check --install-agent-gates --tools opencode
45
+ # Full /ark-* skill pack (optional expert depth)
46
+ npx arkgate-check --install-agent-gates --skills-only --force
47
+ ```
48
+
49
+ Doctor reports what is actually installed and observed (`writePath` / enforcement state). Installed files alone do not imply `hard:true` without runtime evidence where the product requires it.
50
+
51
+ ---
52
+
53
+ ## Contract and placement
54
+
55
+ | Concern | Doc / tool |
56
+ |---------|------------|
57
+ | Layers, rules, globs | [configuration.md](configuration.md) · `ark.config.json` |
58
+ | Stable package API | [package-surface.md](package-surface.md) |
59
+ | Where new code goes | MCP `ark_place` · skill `/ark-place` |
60
+ | Preflight multi-file change | MCP `ark_prepare_change` · `ark preflight --changes …` |
61
+ | Write snippet preflight | MCP `ark_prepare_write` |
62
+
63
+ Prefer prepare/preflight before the host commits disk. Mechanical-safe patches only for proven kinds; judgment stays explicit.
64
+
65
+ ---
66
+
67
+ ## Brownfield and Shape
68
+
69
+ Existing messy trees: [brownfield-adoption.md](brownfield-adoption.md).
70
+
71
+ Phases in short:
72
+
73
+ 1. **Align** — contract matches reality (not false green)
74
+ 2. **Stabilize** — baseline freezes real debt; ratchet only new violations
75
+ 3. **Shape** — design residual (plan B), one pilot at a time, never silent codemod
76
+
77
+ Sensors:
78
+
79
+ ```bash
80
+ npx arkgate-check --plan
81
+ npx arkgate-check --coverage
82
+ npx arkgate-check --doctor --json
83
+ ```
84
+
85
+ Agent reference (tools, skills, dual path): [agent-guide.md](agent-guide.md).
86
+
87
+ ---
88
+
89
+ ## TypeScript boundary
90
+
91
+ Project TypeScript 5 / 6 / 7: [typescript-support.md](typescript-support.md).
92
+ Incomplete analysis (`partial` / `unavailable`) cannot satisfy plan or strict merge.
93
+
94
+ ---
95
+
96
+ ## Common power commands
97
+
98
+ ```bash
99
+ npx arkgate start --tools <host> --apply
100
+ npx arkgate-check --doctor --json
101
+ npx arkgate-check --plan --json
102
+ npx arkgate-check --coverage
103
+ npx arkgate-check --baseline
104
+ npx arkgate preflight --changes changes.json --json
105
+ npx arkgate upgrade --json # managed content preview
106
+ npx arkgate upgrade --apply
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Optional experimental runtime
112
+
113
+ Gates need **no** runtime kernel. `@arkgate/runtime` is experimental, separate package, not the day-zero product. See [package-surface.md](package-surface.md) and [production-hardening.md](production-hardening.md).
114
+
115
+ ---
116
+
117
+ ## Migrate from `ark-runtime-kernel`
118
+
119
+ Same product, new package name: [migrate-from-ark-runtime-kernel.md](migrate-from-ark-runtime-kernel.md).
120
+
121
+ ---
122
+
123
+ ## Improve the library
124
+
125
+ If you are changing ArkGate itself (not just adopting it): [CONTRIBUTING.md](../CONTRIBUTING.md).
126
+
127
+ ← [All docs](README.md) · [Use path](use.md)
@@ -5,6 +5,8 @@ developers. This track follows [Diátaxis](https://diataxis.fr/): tutorial, how-
5
5
  reference, and explanation. Package: **`arkgate`** (CLI: `arkgate` / `arkgate-check`;
6
6
  aliases `ark` / `ark-check` still work).
7
7
 
8
+ **Start shorter?** [docs/use.md](../use.md) · **All docs:** [docs/README.md](../README.md)
9
+
8
10
  ## How ArkGate talks to you
9
11
 
10
12
  **Entry style** — who is driving: *newbie* (`ark start` / `/ark-autopilot`) vs *expert* (individual commands).
@@ -18,7 +18,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
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) are stable within a major. Additive fields OK; removals/renames are major. |
20
20
  | **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
- | **Doctor design fitness (P02+)** | `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`. Y02 extends `handler-in-persistence` to 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 this advisory is not whole-tree proof above that envelope. Each smell has `evidence[]`, `fix`, technical `message`, and plain-language **`outcome`** (Q02). Does **not** fail the gate by itself. |
21
+ | **Doctor design fitness (P02+)** | `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`. Y02 extends `handler-in-persistence` to 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”). Each smell has `evidence[]`, `fix`, technical `message`, and plain-language **`outcome`** (Q02). Does **not** fail the gate by itself. |
22
22
  | **Post-green path (Q01)** | `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. |
23
23
  | **Golden pattern (Q03)** | 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. |
24
24
  | **Plan pattern B (P03+)** | `ark-check --plan --json` → `plan.patternBets[]`, `plan.goal.designWeak` | Additive. Each bet: `id`, `smellId`, `pilot`, `evidence`, `successSignal`, `killSwitch`, **`neverMechanicalSafe: true`**, `class: "judgment"`. **Never** auto-applied by loop/autoPatch; not a `remediationKind` mechanical-safe. `goal.met` remains edge honesty only. |
@@ -45,7 +45,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
45
45
  | **`arkgate/schema/analysis-result`** or **`arkgate/schema/ark.analysis-result.schema.json`** | Public CLI/MCP/hook diagnostic envelope (`schemaVersion`, `mode`, `valid`, `completeness`, `completenessReasons`, `diagnostics`, resolved identities) | Schema `1.3` distinguishes `resolved-candidate-facts` from `lexical-compatibility`; partial/unavailable analysis is always non-green, and resolved complete/partial results require policy/resolver/facts/tree identities. `1.2` added completeness and remains accepted alongside consumer-owned 1.0/1.1 values. |
46
46
  | **`arkgate/schema/resolved-candidate-facts`** or **`arkgate/schema/ark.resolved-candidate-facts.schema.json`** | Versioned parity-capable input for `analyzeResolvedProject` / `preflightResolvedChange` | Schema `1.0` is serializable and deterministic. Tooling owns filesystem/compiler resolution; Domain/Kernel validate and evaluate supplied facts without importing those effects. Facts name resolver/compiler inputs, governed files, dependency evidence, completeness reasons, and candidate tree/facts hashes. |
47
47
  | **Config JSON Schema** | `arkgate/schema` or `arkgate/schema/ark.config.schema.json` | Stable package resource subpaths for editor completion and contract tooling. |
48
- | **Agent skills** | `/ark-*` templates installed by `--install-agent-gates` | Skill *names* and “default flow” are stable; internal skill prose may evolve (e.g. When/not when, explore Shape dual-plan seed, extraction cards, day-zero origin order). |
48
+ | **Agent skills** | `/ark-*` templates; install via `--install-agent-gates` (often `--skills-only` on top of compact) | **Day zero** is the compact router from `ark start` / `start --apply` + doctor control plane — not the full skill pack. Skill *names* and the guided expert path (`/ark-autopilot` after pack install) are stable; internal skill prose may evolve (When/not when, explore Shape dual-plan seed, extraction cards). |
49
49
  | **ESLint subpath** | `arkgate/eslint` | Config-driven layer/import rules; loads consumer `ark.config.json`. |
50
50
  | **GitHub Action** | `pedroknigge/arkgate` (see `action.yml`) | The `uses:` tag/SHA selects the checker source; `version` remains an optional exact npm compatibility override. |
51
51
  | **Package metadata** | `arkgate/package.json` | Stable resource subpath for tooling that needs the installed manifest. |
@@ -186,6 +186,7 @@ production deployment would need to satisfy; it is not a readiness certification
186
186
 
187
187
  ## Release notes (maintainers)
188
188
 
189
- Ship notes for a version live under [releases/](https://github.com/pedroknigge/arkgate/tree/main/docs/releases) (latest:
190
- [3.8.3.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.8.3.md)).
189
+ Ship notes for a version live under [releases/](https://github.com/pedroknigge/arkgate/tree/main/docs/releases) (latest on npm:
190
+ [3.9.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.9.0.md); next prepared:
191
+ [3.9.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/3.9.1.md)).
191
192
  Publish path: signed annotated tag → GitHub Release → `publish-npm.yml` (see [CONTRIBUTING.md](https://github.com/pedroknigge/arkgate/blob/main/CONTRIBUTING.md)).
@@ -0,0 +1,194 @@
1
+ # ArkGate product voice
2
+
3
+ Canonical English for public product surfaces: README, doctor/CLI human output, compact
4
+ router, skill frontmatter, release notes, and agent-facing first-run copy.
5
+
6
+ **Who this is for:** anyone writing or reviewing user-visible ArkGate text.
7
+ **Who this is not for:** internal ADR drafts, ROADMAP engineering notes, or pure code comments.
8
+
9
+ When this document disagrees with shipped UI strings, **fix the strings** (or update this doc
10
+ deliberately in the same change). Voice is product surface, not marketing decoration.
11
+
12
+ ---
13
+
14
+ ## North star
15
+
16
+ A track so simple a newcomer enters, so strict a senior trusts — and the AI ships faster
17
+ because the design space is small and honest.
18
+
19
+ - **Gate side:** machine-readable contract + write gate + CI. Deterministic. Fail-closed.
20
+ Green must mean something real.
21
+ - **Co-pilot side:** where code belongs, who talks to whom, how; dual plan **A** (edges) +
22
+ **B** (shape); one pilot at a time; never silent judgment codemod; never weaken the contract.
23
+ - **False done is forbidden:** Enforce ≠ elegant design. `design-weak` / residual must not
24
+ read as “healthy finished.”
25
+
26
+ ---
27
+
28
+ ## Sentence template
29
+
30
+ Prefer three beats when a line teaches:
31
+
32
+ ```text
33
+ [plain fact]. [precise term + implication]. [one next action].
34
+ ```
35
+
36
+ Examples:
37
+
38
+ | Bad | Good |
39
+ |-----|------|
40
+ | Ship it 🚀 your architecture is crushed! | Checked edges are clean. Residual design smells mean the tree is still design-weak. Next: `/ark-explore` shape-focus. |
41
+ | You don’t need to understand anything. | Doctor reports one status light and one primary next action. Run `ark-check --doctor`. |
42
+ | Become an architect in 60 seconds. | Install pins the contract and compact router. Full guided cleanup is `/ark-autopilot` after skills install. |
43
+
44
+ ---
45
+
46
+ ## Lexicon (prefer)
47
+
48
+ | Term | Use for |
49
+ |------|---------|
50
+ | **contract** | `ark.config.json` layers, rules, include — the machine-readable architecture file |
51
+ | **gate** / **write gate** | Host boundary that blocks or advises on invalid writes |
52
+ | **edges** | Allowed import graph (plan **A** / remediation) |
53
+ | **baseline** | Frozen known debt; does not make a wrong contract honest |
54
+ | **remediation** | Fixing violations against the contract |
55
+ | **pilot** | One extraction / reshape cluster at a time |
56
+ | **shape** | Design residual after edges are clean (plan **B**) |
57
+ | **design-weak** | Edges clean under Enforce, but design smells / pattern residual remain — not “done” |
58
+ | **residual** | Work still open after a green edge check (usually Shape / plan **B**) |
59
+ | **co-pilot** | Guidance that proposes order and pilots without silent codemod |
60
+ | **fail-closed** | Incomplete analysis or unproven enforcement never looks green |
61
+ | **honest coverage** | Governed % and empty scope that cannot false-green |
62
+ | **mechanical-safe** | Deterministic auto-apply class only |
63
+ | **judgment** | Human/agent design work; never silent auto-apply as mechanical-safe |
64
+ | **doctor** | Control plane: status light + next action |
65
+ | **compact router** | Default onboarding agent instructions (not the full skill pack) |
66
+ | **hard write** | Non-bypassable PreToolUse block for listed ops (Claude/Grok when installed + trusted) |
67
+ | **advisory write** | MCP/rules coach only (Cursor/Codex at write time) — not a hard block |
68
+ | **required CI** | Merge hard boundary when the repository makes `arkgate-check` a required status |
69
+
70
+ ## Do (product copy)
71
+
72
+ | Do | Example |
73
+ |----|---------|
74
+ | Name the status light + plain fact + term + next action | “Enforce · design-weak. Checked edges are honest; design smells remain. Next: one Shape door — explore → dual-plan B → autopilot with OK.” |
75
+ | Rank one primary door under residual | Doctor **Primary next action** #1; **Also** only for secondary |
76
+ | Label expert skills as escapes | “Install skill pack only when doctor or a STOP handoff names a skill.” |
77
+ | State host write honesty | “Cursor/Codex: advisory write. Required CI is the hard merge boundary.” |
78
+ | Keep Suggest on start → doctor | New-here primary is finish `start`, not a competing recommend/architect curriculum |
79
+ | Qualify edge-clean under design-weak | “None on checked edges … design residual remains. Not healthy finished.” |
80
+ | Prefer fail-closed over fake hard | Incomplete analysis, unobserved hooks, and soft MCP never paint as hard green |
81
+
82
+ ## Avoid
83
+
84
+ | Avoid | Why |
85
+ |-------|-----|
86
+ | vibes, “crush it,” emoji rain | Cheap; seniors dismiss it |
87
+ | “eh amigo,” fake familiarity | Condescension |
88
+ | “you don’t need to understand anything” | Lies about the product |
89
+ | “auto-refactor your whole app” / magic codemod claims | We never silent-apply plan B |
90
+ | “modes you pick” for Suggest/Adapt/Enforce | Those are **status lights**, not settings |
91
+ | Skill-shopping lists as the default curriculum | Progressive disclosure: one door first |
92
+ | “Healthy / done” while design-weak | False done |
93
+
94
+ ---
95
+
96
+ ## Progressive disclosure (product rule)
97
+
98
+ 1. **One primary path** — newcomer does not skill-shop among thirteen `/ark-*` skills.
99
+ 2. **Doctor is the control plane** — one status light, one next action (human-grade + technical).
100
+ 3. **Compact router / default install first** — full skill pack is **expert depth**, not onboarding UI.
101
+ 4. **Post-green shape** is a first-class single door when edges are clean but residual remains.
102
+ 5. **Day-to-day** — place + gate protect; guided organize via `/ark-autopilot` when needed.
103
+
104
+ ```text
105
+ npx arkgate start → start --apply → ark-check --doctor
106
+ → (optional) install skill pack → /ark-autopilot
107
+ ```
108
+
109
+ Skills table in docs = **escapes / expert**, not a second onboarding track.
110
+
111
+ ---
112
+
113
+ ## Hero phrases (approved)
114
+
115
+ - One contract. One gate. One co-pilot.
116
+ - Green must mean something real.
117
+ - You arrive at Enforce; you never turn it on.
118
+ - Enforce does not mean the design is elegant — only that checked edges are honest.
119
+ - Empty plan A is not “architecture healthy” when design residual remains.
120
+ - One pilot at a time. Pattern bets are never mechanical-safe.
121
+ - Doctor is the control plane: status light + next action.
122
+
123
+ ## Hero phrases (forbidden)
124
+
125
+ - Become an architect in 60 seconds.
126
+ - You don’t need to understand architecture.
127
+ - We auto-fix everything safely.
128
+ - Ship it 🚀 / crush the spaghetti with vibes.
129
+
130
+ ---
131
+
132
+ ## Doctor / deny microcopy models
133
+
134
+ ### Status light (operating mode)
135
+
136
+ Each model line follows the sentence template: **plain fact · term · next action**.
137
+
138
+ | Light | Model line |
139
+ |-------|------------|
140
+ | **Suggest** | Thin or new tree. Contract is not yet the control plane. Next: `ark start` preview, then `--apply`; re-run doctor. |
141
+ | **Adapt** | Contract and tree still disagree, or debt is open. Write path does not fully protect you yet. Next: doctor top action #1. |
142
+ | **Enforce** | Honest coverage and clean checked edges. Keep host write path + required CI. |
143
+ | **Enforce · design-weak** | Checked edges are honest; design smells remain. Green is not elegant design. Next: one Shape door — map (`/ark-explore` shape-focus) → dual-plan B → apply B only with `/ark-autopilot` and OK. |
144
+
145
+ ### Primary next action
146
+
147
+ - Lead with the **outcome**, then the **skill or command**, then the **constraint** (never mechanical-safe / never skill-shop).
148
+ - When design-weak, rank the single Shape path first; do not list explore / coverage / think as equal first choices.
149
+
150
+ ### Deny / gate failure
151
+
152
+ ```text
153
+ [What failed in plain terms]. [Rule or evidence id]. Next: [one fix path — /ark-fix, prepare-write, or contract edit].
154
+ ```
155
+
156
+ Never: mock the user, imply the gate is optional, or suggest disabling rules to “finish.”
157
+
158
+ ### Healthy finished
159
+
160
+ Print “Healthy — nothing to do” **only** when there is no design-weak residual and no open top actions.
161
+ Otherwise name the residual.
162
+
163
+ ---
164
+
165
+ ## Compact router model
166
+
167
+ Keep short. Three jobs only:
168
+
169
+ 1. Point at **doctor** as status.
170
+ 2. Day-to-day place / validate / check.
171
+ 3. Point at **full skill pack install** as optional expert depth — not a skill catalog dump.
172
+
173
+ ---
174
+
175
+ ## Skill description model
176
+
177
+ | Skill role | Frontmatter tone |
178
+ |------------|------------------|
179
+ | `/ark-autopilot` | Guided **end-to-end** path (explore → dual plan → apply A; B with OK) |
180
+ | `/ark-explore` | Map / dual-plan **seed** only; primary post-green map half |
181
+ | Others | Specialized escape; name when **not** to use them |
182
+
183
+ Keep dual-engine rules and **STOP** handoffs. Never claim silent full-tree reshape.
184
+
185
+ ---
186
+
187
+ ## Checklist before shipping copy
188
+
189
+ - [ ] One next action is obvious.
190
+ - [ ] Status light is not a mode picker.
191
+ - [ ] No false done under design-weak / incomplete analysis.
192
+ - [ ] Technical terms present (contract, gate, edges, pilot) without slang.
193
+ - [ ] Expert skills are labeled expert — not the default curriculum.
194
+ - [ ] Seniors would not be embarrassed to paste the line into a PR.