arkgate 4.5.7 → 4.6.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/README.md +18 -12
  3. package/bin/ark-check-runtime.mjs +107 -8
  4. package/bin/ark-mcp-runtime.mjs +17 -1
  5. package/bin/ark.mjs +5 -3
  6. package/bin/lib/agent-homes.mjs +296 -0
  7. package/bin/lib/agent-projection.mjs +2 -2
  8. package/bin/lib/analysis-engine.mjs +3 -3
  9. package/bin/lib/ci-and-commands.mjs +16 -16
  10. package/bin/lib/config-contract.mjs +2 -0
  11. package/bin/lib/contract-smells.mjs +5 -5
  12. package/bin/lib/design-smells.mjs +4 -8
  13. package/bin/lib/doctor-advisories.mjs +9 -0
  14. package/bin/lib/doctor-plan.mjs +39 -15
  15. package/bin/lib/field-install.mjs +1 -1
  16. package/bin/lib/golden-pattern.mjs +1 -1
  17. package/bin/lib/host-support-matrix.mjs +4 -4
  18. package/bin/lib/html-report-advisories.mjs +20 -0
  19. package/bin/lib/html-report-depth.mjs +7 -8
  20. package/bin/lib/html-report.mjs +2 -1
  21. package/bin/lib/improvement-compass-map.mjs +20 -20
  22. package/bin/lib/install-migrate.mjs +12 -0
  23. package/bin/lib/pilot-loop.mjs +1 -1
  24. package/bin/lib/post-green-path.mjs +5 -4
  25. package/bin/lib/prepare-change.mjs +9 -0
  26. package/bin/lib/product-copy.mjs +32 -0
  27. package/bin/lib/skill-write.mjs +1 -1
  28. package/bin/lib/status-command.mjs +14 -0
  29. package/bin/lib/status-manifest.mjs +17 -0
  30. package/bin/lib/team-parliament-io.mjs +338 -0
  31. package/bin/lib/team-parliament.mjs +383 -0
  32. package/bin/lib/upgrade-whats-new.mjs +32 -0
  33. package/bin/lib/violations.mjs +8 -4
  34. package/dist/{configTypes-CC0FEXoF.d.ts → configTypes-B8uIcLaG.d.ts} +5 -0
  35. package/dist/eslint/index.cjs +2 -2
  36. package/dist/eslint/index.d.ts +1 -1
  37. package/dist/eslint/index.js +2 -2
  38. package/dist/index.cjs +8 -8
  39. package/dist/index.d.ts +61 -2
  40. package/dist/index.js +8 -8
  41. package/docs/README.md +5 -4
  42. package/docs/agent-guide.md +31 -24
  43. package/docs/ai-gates.md +19 -0
  44. package/docs/configuration.md +36 -2
  45. package/docs/develop.md +16 -4
  46. package/docs/enthusiast/README.md +1 -1
  47. package/docs/enthusiast/how-to-agent-gates.md +3 -3
  48. package/docs/enthusiast/how-to-pick-shape.md +2 -2
  49. package/docs/enthusiast/tutorial-first-project.md +4 -3
  50. package/docs/package-surface.md +5 -3
  51. package/docs/product-voice.md +126 -82
  52. package/docs/use.md +13 -6
  53. package/package.json +1 -1
  54. package/schemas/ark.config.schema.json +9 -0
  55. package/schemas/ark.status-manifest.schema.json +51 -0
  56. package/server.json +2 -2
  57. package/templates/agent-skills/README.md +1 -1
  58. package/templates/agent-skills/ark-adopt/SKILL.md +46 -19
  59. package/templates/agent-skills/ark-architect/SKILL.md +24 -145
  60. package/templates/agent-skills/ark-autopilot/SKILL.md +40 -30
  61. package/templates/agent-skills/ark-contract/SKILL.md +21 -105
  62. package/templates/agent-skills/ark-coverage/SKILL.md +3 -0
  63. package/templates/agent-skills/ark-explain/SKILL.md +7 -4
  64. package/templates/agent-skills/ark-explore/SKILL.md +29 -21
  65. package/templates/agent-skills/ark-fix/SKILL.md +34 -157
  66. package/templates/agent-skills/ark-loop/SKILL.md +31 -153
  67. package/templates/agent-skills/ark-place/SKILL.md +25 -13
  68. package/templates/agent-skills/ark-runtime/SKILL.md +3 -3
  69. package/templates/agent-skills/ark-think/SKILL.md +5 -2
  70. package/templates/agent-skills/ark-upgrade/SKILL.md +13 -8
  71. package/templates/skills/ark-adopt.md +46 -19
  72. package/templates/skills/ark-architect.md +24 -145
  73. package/templates/skills/ark-autopilot.md +40 -30
  74. package/templates/skills/ark-contract.md +21 -105
  75. package/templates/skills/ark-coverage.md +3 -0
  76. package/templates/skills/ark-explain.md +7 -4
  77. package/templates/skills/ark-explore.md +29 -21
  78. package/templates/skills/ark-fix.md +34 -157
  79. package/templates/skills/ark-loop.md +31 -153
  80. package/templates/skills/ark-place.md +25 -13
  81. package/templates/skills/ark-runtime.md +3 -3
  82. package/templates/skills/ark-think.md +5 -2
  83. package/templates/skills/ark-upgrade.md +13 -8
@@ -1,43 +1,24 @@
1
1
  ---
2
2
  name: ark-architect
3
- description: Choose the application shape, adopt phase-1 layers, scaffold directories, and verify honestly for enthusiasts before codegen. Autonomous.
3
+ description: Shortcut to /ark-adopt for greenfield shape. Deprecated as a first-class door. Do adopt’s job.
4
4
  ---
5
5
 
6
- # /ark-architect — Choose your application shape and adopt Ark
6
+ # /ark-architect — Shortcut to /ark-adopt
7
7
 
8
- ## Improvement compass (process preflight)
8
+ **Deprecated as a first-class door.** Session 0 is **`/ark-adopt`**. Do that job now
9
+ (greenfield scaffold via `ark-check --recommend` / MCP `ark_recommend` after `ark_identity`).
9
10
 
10
- When doctor is available, read `doctor.improvementCompass` (or the human **Improvement compass** section).
11
- Name 1–3 **residual** lenses in plain language before skill-shopping. Always `notAScore` — never invent
12
- 0–10 scores or Excellent/Good ranks.
11
+ ## Autonomy contract
13
12
 
14
- **What the user should feel next:** fewer blocked AI writes, clearer folders, safer domain — then jargon.
15
-
16
- **Anti false-done:** empty plan A + residual lenses / design-weak → **Incomplete? yes**. Green edges alone
17
- are not “architecture finished.”
18
-
19
- **AI-easy architecture:** ports over concrete I/O in domain; one concern per module; golden pattern for
20
- new files; place before write (`/ark-place` / prepare-write).
21
-
22
- **Out of scope (honest):** scalability/performance, full app-security tooling (SAST), and full resilience
23
- patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement for them.
24
-
25
- **Greenfield that is AI-easy day one:** golden norm + thin layers so the next agent turn stays ordered.
13
+ Invoking this skill **is** the approval to mark the path. Write `ark.config.json` and
14
+ phase-1 dirs in this turn. Then `ark-check`.
26
15
 
27
16
  ## When / not when
28
17
 
29
- | Use `/ark-architect` when… | Do **not** use it when… |
30
- |----------------------------|-------------------------|
31
- | Greenfield / thin tree; pick shape + phase-1 layers | Existing spaghetti brownfield → `/ark-adopt` (+ `/ark-explore` first if map missing) |
32
- | Enthusiast before heavy codegen | Enforcement residual on mature tree `/ark-autopilot` |
33
-
34
- The user is building something new or early in Ark adoption. They may not know
35
- layered architecture jargon. Your job: translate **what they want to build**
36
- (application shape, not framework name) into an Ark preset, a phase-1 layer plan,
37
- conventional directories, and a passing honest check — without weakening the gate.
38
-
39
- Commands below are written as `ark-check` / `ark`; run each through the project's
40
- package manager (`pnpm exec`, `yarn`, `npx`) — match the lockfile.
18
+ | Use this leftover name when… | Prefer instead |
19
+ |------------------------------|----------------|
20
+ | Muscle memory / old docs say architect | **`/ark-adopt`** (greenfield + brownfield) |
21
+ | Empty tree needs a shape | Same adopt writes the recommend result |
41
22
 
42
23
  ## Dual engine (mandatory)
43
24
 
@@ -48,8 +29,6 @@ package manager (`pnpm exec`, `yarn`, `npx`) — match the lockfile.
48
29
 
49
30
  The CLI is a **sensor**, never the whole job. Claiming done without the exploratory bar for this skill is **incomplete**.
50
31
 
51
-
52
-
53
32
  ## MCP workspace binding (mandatory)
54
33
 
55
34
  Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
@@ -59,128 +38,31 @@ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedP
59
38
  uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
60
39
  restart/retargeting is required. `ark://manifest` never satisfies this preflight.
61
40
 
62
- ## Dual plane layers + ArkRules (mandatory, except /ark-runtime)
63
-
64
- ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
65
-
66
- | Plane | What it protects | Where it lives | Sensors / tools |
67
- |-------|------------------|----------------|-----------------|
68
- | **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
69
- | **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
70
-
71
- **Rules for every report / answer:**
72
- 1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
73
- 2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
74
- 3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
75
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
76
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
41
+ Then call **`ark_recommend`** with the same bound `project` envelope (or `ark-check --recommend`).
77
42
 
43
+ ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
78
44
 
79
- ### Architect + ArkRules
80
- - Preset/init should emit lean `arkRules` + templates for phase-1 layers (exact names).
81
- - Explain to the user: layers = boundaries; arkrules = habits inside Domain/App/adapters (opt-in, start advisory).
45
+ Label findings **`[Layer]`** vs **`[ArkRules]`**. Absence of `arkRules` is valid.
82
46
 
83
47
  ## Subagent fan-out (optional, host-dependent)
84
48
 
85
- If the host supports **parallel subagents** and the task splits cleanly (e.g. multiple
86
- dirs to sample), fan out read-only scouts; otherwise **fall back to sequential**.
87
- Parent merges and still emits the **### Completion** contract. Never parallel-write
88
- the same files or weaken the gate.
49
+ If the host supports **parallel subagents**, fan out read-only scouts; otherwise
50
+ **fall back to sequential**. Never weaken the gate.
89
51
 
90
- ## Relationship to other skills
52
+ ## Related onboarding
91
53
 
92
- | Skill | When |
93
- |-------|------|
94
- | **/ark-architect** | **Before** — greenfield or fresh config; pick shape + phase 1 |
95
- | /ark-adopt | **After** — messy existing repo |
96
- | /ark-contract | **During** — evolve config safely |
97
- | /ark-place | **During** — one new file |
98
- | /ark-explain | **After** — understand what exists |
54
+ - **Greenfield:** this shortcut → **`/ark-adopt`** + `ark-check --recommend` / `ark start`.
55
+ - **Brownfield:** `/ark-adopt` — do not force a starter preset.
99
56
 
100
57
  ## Steps
101
58
 
102
- 1. **Bind and detect the shape** complete the mandatory `ark_identity` preflight first, then
103
- call MCP tool **`ark_recommend`** with the bound `project` envelope (or run the workspace-local
104
- `ark-check --recommend --json`). Never use an unverified recommendation. Read `archetype`, `preset`, `confidence`,
105
- `adoptInOrder.phase1`, `analogy`, `why`, `evidence`, and `requiresConfirmation`.
106
- Ask at most **two** questions only if `requiresConfirmation` is true (or for compatibility
107
- with older ArkGate output, `confidence < 0.5`):
108
- - "Will this app save data between sessions?"
109
- - "Is this one app or several in one repository?"
110
-
111
- 2. **Present in plain English** — name the application shape (e.g. "product with
112
- UI and stored data"), not the framework. One analogy. List **phase-1 layers only**.
113
-
114
- 3. **Map to Ark** — if `ark.config.json` is missing, run
115
- `ark init --archetype <archetype> --yes` (maps playbook id → preset + gates),
116
- or `ark-check --apply-policy-pack enthusiast-<preset>` for the enthusiast variant.
117
- Optional team record: `ark-check --recommend --write-plan` → `ark-adoption-plan.json`.
118
- If a config already exists, use `/ark-contract` to align it — do not regenerate
119
- unasked. On a messy brownfield tree: **STOP — do not continue this skill as complete.** Invoke **/ark-adopt** instead of forcing greenfield shape.
120
-
121
- 4. **Scaffold phase 1** — create conventional directories from the preset/playbook
122
- (`src/domain`, `src/application`, …). Add a one-line README per folder explaining
123
- what belongs there. Match the nearest sibling file style if code already exists.
124
- Flat layouts (`src/` + `lib/` + `api/` at the repo root) are common in Vite and
125
- serverless projects — use `/ark-contract` to map them to layers instead of forcing
126
- everything under `src/**/domain/**` only.
127
-
128
- 5. **Install gates** when the user uses AI coding tools and gates are missing:
129
- `ark-check --install-agent-gates`.
130
-
131
- 6. **Verify honestly** — run `ark-check --doctor` and `ark-check --coverage --json`.
132
- Report `governed.percent`. Say explicitly what is **not** governed yet
133
- (ungoverned directories, empty layers).
134
-
135
- 7. **Deliver to the user**
136
- - ASCII diagram (≤3 boxes for phase 1, inner → outer)
137
- - Table: "when you build X, put it in Y"
138
- - Three rules the agent must not break (no domain→database imports, no raw
139
- `publish()`, no weakening `ark.config.json` to pass)
140
- - Optional book refs from `books` in the recommendation JSON under "go deeper"
141
- - **Gallery starter** — point the user at the matching clonable example:
142
-
143
- | Archetype | Example directory |
144
- |-----------|-------------------|
145
- | `crud-product` | `examples/crud-product-starter/` |
146
- | `api-backend` | `examples/api-backend-starter/` |
147
- | `worker-pipeline` | `examples/worker-pipeline-starter/` |
148
- | `multi-app-workspace` | `examples/multi-app-workspace-starter/` |
149
- | `vertical-slice-product` | `examples/vertical-slice-starter/` |
150
- | `ddd-bounded-contexts` | `examples/ddd-context-starter/` |
151
-
152
- Say they can copy that folder as a baseline (`npm install && npm run check`).
153
- For a runnable API with break exercises, mention `examples/hexagonal-order-api/`.
154
- Full enthusiast track: `docs/enthusiast/README.md`.
155
-
156
- ## Operating rules
157
-
158
- - Never weaken `ark.config.json`, the baseline, CI, or agent settings to pass.
159
- - Never invent layers outside the 11-layer profile or named presets
160
- (`hexagonal`, `layered`, `feature-sliced`, `monorepo`, `ui-surface`,
161
- `vertical-slice`, `ddd-bounded-contexts`).
162
- - Flag unrecognized dirs (`utils/`, `lib/`) — user must classify via `/ark-contract`.
163
- - Default to smallest viable phase 1; unlock phase 2 only when the user describes need.
164
- - All user-facing copy is **English**.
165
-
166
- ## Merge cards (physical cohesion reshape — judgment only)
167
-
168
- When `doctor.physicalCohesion` reports a mirrored concept and the user asks whether files
169
- should be **merged**, treat it as domain modeling, never deduplication (field fact: zero
170
- structural clones among 123 same-concept files). Produce a **merge card** per candidate group:
171
- which files, the domain concept they express, 2–3 shapes the merged module could take, and what
172
- each shape costs — **no default action, no auto-merge, never a codemod**. Physical **moves**
173
- belong to `/ark-loop`'s pilot loop; your job here is the judgment about what the concept IS.
174
-
175
- ## Verify and report
176
-
177
- End with `ark-check --root . --config ark.config.json --strict-config` when the
178
- tree is ready. Report: archetype + preset, directories created, governed %, and
179
- the next command if anything remains ungoverned.
59
+ 1. Bind MCP (`ark_identity` then `ark_recommend`) or run `ark-check --recommend`.
60
+ 2. Execute **`/ark-adopt`** autonomy: write the config, dirs, optional advisory ArkRules, gates.
61
+ 3. `ark-check --strict-config`. Handoff `/ark-place` for new files.
180
62
 
181
63
  ## Completion contract (skill incomplete if missing)
182
64
 
183
- End with **exactly** these headings (markdown `###`):
65
+ Skill incomplete if missing any field below.
184
66
 
185
67
  ### Completion
186
68
  - **Sensor:** commands/tools run
@@ -188,8 +70,5 @@ End with **exactly** these headings (markdown `###`):
188
70
  - **Result:** one-line outcome
189
71
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
190
72
  - **Compass:** top residual lenses | `n/a`
191
- - **Handoff:** `/ark-…` / CLI / `none`
73
+ - **Handoff:** `/ark-adopt` / `/ark-place` / `none`
192
74
  - **Incomplete?** `no` | `yes — <what is missing>`
193
-
194
- If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
195
- **Skill incomplete if missing** any of the bullets above.
@@ -1,17 +1,27 @@
1
1
  ---
2
2
  name: ark-autopilot
3
- description: Guided end-to-end path for layers and opt-in ArkRules doctor next action when unsure. Explore first; dual plan A (edges) + B (shape); mechanical-safe only by default; B with user OK, one pilot at a time. Empty plan A is not healthy if design-weak. CLI is a sensor; you read and remediate files.
3
+ description: Apply Ark end-to-end — explore first; dual plan A (edges) + B (shape); write mechanical-safe and judgment in this turn; one Shape refactor. Empty plan A is not healthy if leftover design remains. CLI is a sensor; you edit files.
4
4
  ---
5
5
 
6
- # /ark-autopilot — Guided end-to-end architecture path
6
+ # /ark-autopilot — Apply the path
7
7
 
8
- **This is the full guided co-pilot** after the compact router. Prefer it when the user wants
9
- architecture cleaned end-to-end, not when they only need a map (`/ark-explore`) or a single
10
- edge fix (`/ark-fix`). Doctor remains the control plane: re-check status after each major step.
8
+ **This is the apply door.** Invoking it **is** the approval. Prefer it when the user wants
9
+ architecture cleaned end-to-end, not when they only need a map (`/ark-explore`). Doctor
10
+ remains the control plane: re-check status after each major step.
11
11
 
12
- Composes **explore → sensors → dual plan → loop**. Safe default: auto-apply only
13
- `mechanical-safe`; when the user says full apply / apply everything, also execute **judgment**
14
- fixes you design from reading source (still validate with ark-check, never weaken the gate).
12
+ ## Autonomy contract
13
+
14
+ The CLI is a **sensor and gate**. **CLI budget:** one doctor / `--plan`; open files; **write**;
15
+ re-check. Forbidden as the result: “4 safe / 4 judgment — approve?”, dumping `--plan` JSON,
16
+ or `STOP — invoke /ark-fix` / `/ark-loop` / `/ark-contract`. Do that work **here**.
17
+
18
+ Apply plan A (`mechanical-safe` **and** judgment). If leftover design work remains, apply
19
+ **one** small refactor this turn, then re-doctor. Never batch every Shape bet.
20
+
21
+ Composes **explore → sensors → dual plan → write**. Validate with ark-check; never weaken the gate.
22
+ **Team lock:** do not edit `ark.config.json`, `arkrules/*`, or `.ark-baseline.json` in this
23
+ turn unless the user invoked a steward contract session. Feature diffs use
24
+ `ark-check --changed --base <merge-ref>`. Growing the baseline is steward-only.
15
25
 
16
26
  **Not a plan grinder.** Empty `--plan` does **not** mean “architecture is healthy” without
17
27
  the explore pass and dual-plan section B (pattern / Shape bets).
@@ -33,25 +43,25 @@ new files; place before write (`/ark-place` / prepare-write).
33
43
  **Out of scope (honest):** scalability/performance, full app-security tooling (SAST), and full resilience
34
44
  patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement for them.
35
45
 
36
- **Guided vibe path:** phase 0 = doctor + compass residual. Shape only with user OK. Never script “done” while residual lenses remain.
46
+ **Guided vibe path:** phase 0 = doctor + compass residual. Shape: one refactor this turn (invoke = OK). Never script “done” while residual lenses remain.
37
47
 
38
48
  ## When / not when
39
49
 
40
50
  | Use `/ark-autopilot` when… | Do **not** use it when… |
41
51
  |----------------------------|-------------------------|
42
52
  | “Make architecture sound” end-to-end | Map only, no apply → `/ark-explore` |
43
- | Brownfield or greenfield with apply | Only fitness numbers → `/ark-coverage` |
44
- | User wants A + B planned and A executed | Single edge fix → `/ark-fix`; plan A only → `/ark-loop` |
45
- | **Apply half of post-green Shape path** (after explore map / when user wants full apply) | Skipping explore when doctor primary is Shape map-first |
46
- | Spaghetti under ENFORCE: Shape work with user ok on B | Contract false-green first → `/ark-adopt` / `/ark-contract` STOP paths |
53
+ | Brownfield or greenfield with apply | Session 0 / config lying → `/ark-adopt` first, then return |
54
+ | User wants A + B planned and **applied** | New file only → `/ark-place` |
55
+ | **Apply** leftover design (one Shape refactor) | User said map only |
56
+ | Spaghetti under ENFORCE: Shape work (invoke = apply one pilot) | |
47
57
 
48
- **Post-green door:** doctor’s single door is `/ark-explore` shape-focus → dual-plan B, **then** this skill only
49
- to apply B with OK. Prefer that order when `postGreenPath` / design-weak is the primary residual.
58
+ **Post-green door:** `/ark-explore` shape-focus → dual-plan B, **then this skill applies one
59
+ pilot**. Prefer that order when `postGreenPath` / leftover design work is the primary residual.
50
60
 
51
61
  ## Related onboarding
52
62
 
53
- - **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
54
- - **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
63
+ - **Greenfield:** `/ark-adopt` or `ark-check --recommend` / `ark start`.
64
+ - **Brownfield:** `/ark-adopt` — match config to reality; do not force a starter preset.
55
65
  - **Deep map only:** `/ark-explore` — full recon / dual-plan seed without applying.
56
66
  - **Adoption fitness only:** `/ark-coverage` — governed% + capability gaps (not pattern dual-plan).
57
67
  - **Default path:** `ark start` → `ark-check --doctor` → **`/ark-autopilot`** (this skill) for guided work.
@@ -73,8 +83,8 @@ decision-grade explore pass **and** without opening violating files.
73
83
  4. **Open every file** in plan A `steps[]` (and `target` if present) before classifying a fix.
74
84
  5. **“Así te lo re-soluciono”** for each A cluster and each B pattern bet.
75
85
  6. Apply A → re-run ark-check → rollback on regression. **Never auto-apply B** as mechanical-safe.
76
- 7. **One-pilot loop for B:** when design-weak, take **`pilotLoop.nextPilot`** (one extraction card)
77
- → apply **only** that pilot with user OK → **re-doctor**. Never multi-pilot batch B; residual
86
+ 7. **One-pilot loop for B:** when leftover design / design-weak, take **`pilotLoop.nextPilot`** (one extraction card)
87
+ → apply **only** that pilot **in this turn** → **re-doctor**. Never multi-pilot batch B; residual
78
88
  outside the pilot may remain and must not be called “healthy finished.”
79
89
  8. **Reshape decision memory:** read `doctor.physicalCohesion.reshapeDecisions` before acting on
80
90
  mirror facts. Outcome first: a current rejected/deferred verdict means “intentional/deferred
@@ -106,7 +116,7 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
106
116
  1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
107
117
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
108
118
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
109
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
119
+ 4. Editing `arkrules/*` or promoting modes and fixing structure sensors is **this skill** (judgment, never invent `mechanical-safe`).
110
120
  5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
111
121
 
112
122
 
@@ -150,7 +160,7 @@ Include explore **§G** when spaghetti / design-weak signals fire.
150
160
  5. **Agent/gate reality** — installed hooks vs install templates (e.g. `--hook` vs `--hook-repair`); MCP; CI gate present.
151
161
  6. **Coupling** — fan-in / exports / importers for hotspots (LOC alone is a hint).
152
162
  7. **False-green soft block** — doctor/coverage: empty Domain/Persistence while Application owns I/O (`airtable`, `supabase`, `prisma`, `drizzle`, `repositories`, …). Doctor gap id: `contract-false-green-io-under-application`. If so:
153
- **STOP — do not continue this skill as complete.** **STOP — false-green: invoke /ark-adopt or /ark-contract before claiming ENFORCE.** Do not claim goal.met / ENFORCE from type-only cleanup while doctor reports `contract-false-green-io-under-application`.
163
+ **STOP — do not continue this skill as complete.** **STOP — false-green:** fix the architecture config **in this turn** (same job as `/ark-adopt`) before claiming ENFORCE. Do not claim goal.met / ENFORCE from type-only cleanup while doctor reports `contract-false-green-io-under-application`.
154
164
  8. **Seed dual plan B** — 2–5 pattern / Shape bets ranked (impact × effort × enforceability). Each B row needs pilot + success signal; I/O bets need an **extraction card** (explore §G).
155
165
 
156
166
  Min bar: **≥12 source files** across **≥4 meaningful directories** (not only files in `steps[]`).
@@ -160,16 +170,16 @@ Standalone long report: `/ark-explore`. Adoption fitness only: `/ark-coverage`.
160
170
 
161
171
  | Section | Source | Question | Auto-apply? |
162
172
  |---------|--------|----------|-------------|
163
- | **A. Remediation** | `--plan --json` + opened step files | What must change so the **gate** is honest? | Only `mechanical-safe` by default |
173
+ | **A. Remediation** | `--plan --json` + opened step files | What must change so the **gate** is honest? | Write `mechanical-safe` **and** judgment |
164
174
  | **B. Pattern / Shape** | Explore §B/§G (not coverage alone) | What **design** must improve even if A is empty? | **Never** as mechanical-safe |
165
175
 
166
176
  **Section A** — group by edge; treat `peerIsolation` / cross-slice as **judgment**.
167
177
  **Section B** examples: choose golden pattern + pilot migrate-on-touch, peerIsolation, move rules out of UI, write-path repair, split god modules, Domain placement / intents, facade SQL → port/adapter (extraction card). Cap **3–5** B rows. Each row: evidence path + **así te lo re-soluciono** + next skill/command + **success signal** + **pilot** (+ kill-switch if new layer).
168
178
 
169
- B does **not** count as “architecture healthy finished.” Report B as `proposed | deferred | applied-with-user-ok`.
179
+ B does **not** count as “architecture healthy finished.” Report B as `proposed | deferred | applied`.
170
180
  When A is empty and B is non-empty: status is **`goal.met on edges · Shape residual open`** — never “done” without listing B.
171
- Prefer CLI `patternBets[]` / `designSmells[]` when present; apply B only with explicit user ok using
172
- **extraction cards** (`docs/brownfield-adoption.md` §6) — never mechanical-safe, never silent.
181
+ Prefer CLI `patternBets[]` / `designSmells[]` when present; apply **one** B pilot this turn using
182
+ **extraction cards** (`docs/brownfield-adoption.md` §6) — never mechanical-safe, never silent, never multi-pilot.
173
183
  If B will take multiple PRs, offer (do not require) persisting a short Shape plan under the
174
184
  repo so the next agent session continues the same pilot — still never auto-apply B.
175
185
 
@@ -190,7 +200,7 @@ Status lights from doctor — not settings you choose. Rank residual honestly:
190
200
  | **Suggest** | Thin/new tree; contract not control plane | Finish `ark start` → re-doctor; do not skill-shop |
191
201
  | **Adapt** | Contract/tree disagree or debt open | Explore + adopt/loop/contract; do not claim guarded |
192
202
  | **Enforce** | Honest coverage + clean checked **edges** | Confirm gates + CI; emit dual-plan B only if residual found |
193
- | **Enforce · design-weak** | Edges clean; design smells remain | **Primary Shape door:** explore shape-focus → dual-plan **B** → apply **one** pilot with user OK. Empty plan A ≠ done. Never mechanical-safe B. False-done forbidden. |
203
+ | **Enforce · leftover design work** | Imports clean; design still messy | **Primary Shape door:** explore shape-focus → dual-plan **B** → apply **one** small refactor. Empty plan A ≠ done. Never mechanical-safe B. False-done forbidden. |
194
204
 
195
205
  - **Setup (Suggest):** no config → `ark start` (start freezes origin after config, before gates).
196
206
  - **Align (Adapt):** open debt, low honesty, or false-green → explore + adopt/loop; do not claim “guarded”.
@@ -206,12 +216,12 @@ Status lights from doctor — not settings you choose. Rank residual honestly:
206
216
  3. **Sensors** — `--plan --json`, doctor/coverage as needed.
207
217
  4. **Emit dual plan** — A from plan steps (files opened); B from explore (3–5 bets).
208
218
  5. **Concentrated edge?** — if one edge dominates A:
209
- **STOP — do not continue this skill as complete.** **STOP — concentrated edge: invoke /ark-contract with source evidence** (do not freeze a wrong contract or grind N freezes).
219
+ **STOP — do not continue this skill as complete.** **STOP — concentrated edge:** rewrite `ark.config.json` **in this turn** with source evidence (do not freeze a wrong config or grind N freezes).
210
220
  6. **Worktree preferred** — discardable git worktree when possible.
211
221
  7. **Mechanical-safe (A only)** — kinds from `/ark-loop` table; one step, validate, rollback.
212
- 8. **Judgment (A)** — default: propose with full “así te lo re-soluciono”. If user authorized full apply: implement, validate, rollback on fail.
213
- 9. **Pattern bets (B)** — propose; apply only with explicit user go + correct skill (`/ark-contract`, refactor, install gates, etc.). Never weaken the gate to clear B.
214
- 10. **Manifiesto** — loose business rules → Domain placement + `intentPrefixes` / intents via `/ark-contract` discipline.
222
+ 8. **Judgment (A)** — implement with full “así te lo re-soluciono”; validate; rollback on fail.
223
+ 9. **Pattern bets (B)** — apply **one** extraction-card pilot this turn; leave the rest queued. Never weaken the gate to clear B.
224
+ 10. **Manifiesto** — loose business rules → Domain placement + `intentPrefixes` / intents; write config here if the path is still dishonest.
215
225
  11. **Final report** — re-`--report`; evolution vs origin; A applied vs open; B proposed/deferred; gates on.
216
226
  12. **Strict check** — `ark-check --strict-config` (dead preset globs are advisory; real violations still fail).
217
227
  13. **Core ratchet (when green)** — if plan `goal.met` and doctor still **ADAPT** only because
@@ -1,40 +1,24 @@
1
1
  ---
2
2
  name: ark-contract
3
- description: Safely edit ark.config.json layers/rules and arkrules/* (structure + invariants); land business rules under the dual plane. Validated with strict ark-check. Deep source evidence required.
3
+ description: Shortcut to /ark-adopt (session 0) or /ark-autopilot (later config tighten). Deprecated as a first-class door.
4
4
  ---
5
5
 
6
- # /ark-contract — Change the architecture contract (safely)
6
+ # /ark-contract — Shortcut to adopt / autopilot
7
7
 
8
- ## Improvement compass (process preflight)
8
+ **Deprecated as a first-class door.** Writing `ark.config.json` / `arkrules/*` is
9
+ **`/ark-adopt`** at session 0 and **`/ark-autopilot`** afterward. Do that job now.
9
10
 
10
- When doctor is available, read `doctor.improvementCompass` (or the human **Improvement compass** section).
11
- Name 1–3 **residual** lenses in plain language before skill-shopping. Always `notAScore` — never invent
12
- 0–10 scores or Excellent/Good ranks.
11
+ ## Autonomy contract
13
12
 
14
- **What the user should feel next:** fewer blocked AI writes, clearer folders, safer domain — then jargon.
15
-
16
- **Anti false-done:** empty plan A + residual lenses / design-weak → **Incomplete? yes**. Green edges alone
17
- are not “architecture finished.”
18
-
19
- **AI-easy architecture:** ports over concrete I/O in domain; one concern per module; golden pattern for
20
- new files; place before write (`/ark-place` / prepare-write).
21
-
22
- **Out of scope (honest):** scalability/performance, full app-security tooling (SAST), and full resilience
23
- patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement for them.
24
-
25
- **Contract edits are last resort.** Policy-delta honesty; do not weaken rules to clear compass residual.
13
+ Invoking this leftover name **is** the approval to write an honest config. Do not
14
+ preview-only. Never weaken the architecture config.
26
15
 
27
16
  ## When / not when
28
17
 
29
- | Use `/ark-contract` when… | Do **not** use it when… |
30
- |---------------------------|-------------------------|
31
- | Edit layers/rules/includes/intents with source evidence | Move product code without config change → `/ark-fix` / `/ark-loop` |
32
- | Concentrated-edge / false-green STOP from other skills | Full map without config edit → `/ark-explore` |
33
-
34
- The **one sanctioned way** to change layers/rules/`intentPrefixes`/includes.
35
- Also used to **land mined business rules** into the executable manifest (`ark.config.json` +
36
- intent naming that the project-bound `ark_manifest` tool exposes authoritatively).
37
-
18
+ | Use this leftover name when… | Prefer instead |
19
+ |------------------------------|----------------|
20
+ | Layers / include / ArkRules need an edit | **`/ark-adopt`** (path) or **`/ark-autopilot`** (tighten) |
21
+ | False-green / concentrated edge | **`/ark-adopt`** write the honest config |
38
22
 
39
23
  ## Dual engine (mandatory)
40
24
 
@@ -45,8 +29,6 @@ intent naming that the project-bound `ark_manifest` tool exposes authoritatively
45
29
 
46
30
  The CLI is a **sensor**, never the whole job. Claiming done without the exploratory bar for this skill is **incomplete**.
47
31
 
48
-
49
-
50
32
  ## MCP workspace binding (mandatory)
51
33
 
52
34
  Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
@@ -58,90 +40,27 @@ restart/retargeting is required. `ark://manifest` never satisfies this preflight
58
40
 
59
41
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
60
42
 
61
- ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
62
-
63
- | Plane | What it protects | Where it lives | Sensors / tools |
64
- |-------|------------------|----------------|-----------------|
65
- | **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
66
- | **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
67
-
68
- **Rules for every report / answer:**
69
- 1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
70
- 2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
71
- 3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
72
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
73
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
74
-
75
-
76
- ### Contract + ArkRules
77
- - You own **both** `layers/rules` and `arkRules`/`arkrules/*.json`.
78
- - Report diffs in two blocks: **[Layer] config** and **[ArkRules] files**.
79
- - Promotion ladder: advisory→enforced only with coverage; demote = hash-ack weakening.
43
+ Label findings **`[Layer]`** vs **`[ArkRules]`**. Absence of `arkRules` is valid.
80
44
 
81
45
  ## Subagent fan-out (optional, host-dependent)
82
46
 
83
- If the host supports **parallel subagents** and the task splits cleanly (e.g. multiple
84
- dirs to sample), fan out read-only scouts; otherwise **fall back to sequential**.
85
- Parent merges and still emits the **### Completion** contract. Never parallel-write
86
- the same files or weaken the gate.
47
+ If the host supports **parallel subagents**, fan out read-only scouts; otherwise
48
+ **fall back to sequential**. Never weaken the gate.
87
49
 
88
50
  ## Related onboarding
89
51
 
90
- - **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
91
- - **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
92
- - **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
93
-
94
- ## Anti-wrapper rule (mandatory)
95
-
96
- **Forbidden:** editing globs from vibes without reading the directories those globs claim to cover.
97
-
98
- **Required:**
99
- 1. Snapshot before using CLI as **sensor**: coverage + check JSON.
100
- 2. **Read source** in dirs you reclassify (sample files).
101
- 3. **“Así te lo re-soluciono”** — exact JSON fields + which files become governed/ungoverned.
102
- 4. After write: `ark-check --strict-config` must be the validation gate (dead pattern noise is advisory; unclassified + real violations still matter).
103
-
104
- ## What you may edit
105
-
106
- - `include` / `exclude`
107
- - `layers[]` (`name`, `patterns`, `optional`, `forbiddenGlobals`, `intentPrefixes`, layer `exclude`)
108
- - `rules[]` (from/to/allowed)
109
- - **`arkRules` map + `arkrules/<Layer>.json`** (ADR 0012/0014) — structure sensors + invariant catalog;
110
- promote advisory→enforced only with coverage evidence; demote/delete requires hash-bound policy ack
111
- - Never: disable the check, delete CI gates, or add blanket `allowed: true` for a bad edge without a facade design
52
+ - **Greenfield:** `/ark-adopt` or `ark-check --recommend` / `ark start`.
53
+ - **Brownfield:** `/ark-adopt` — match config to reality.
112
54
 
113
55
  ## Steps
114
56
 
115
- 1. **Snapshot** coverage governed%, unclassified samples, current violations.
116
- 2. **Smallest edit** for the user intent:
117
- - New layer + neighbor rules
118
- - Expand patterns for ungoverned dirs (`suggestions` from coverage)
119
- - Facade: public surface patterns more specific than internals
120
- - **Business rules → manifiesto:**
121
- - Add/adjust `intentPrefixes` (`Domain.`, `Application.`, …)
122
- - Point Domain patterns at real pure folders (`**/domain/**`, not bare `**/types.ts`)
123
- - Document proposed intent names for the app to register (kernel) or for agents to use
124
- 3. **Impact** — re-run coverage/check; report before/after governed% and violation delta.
125
- 4. **Rollback** if strict fails for reasons other than pre-existing debt the user accepted.
126
-
127
- ## Operating modes
128
-
129
- Contract edits are most common in **Align (Adapt)**. In **Guard (Enforce)**, treat edits as high-risk product decisions.
130
-
131
- ## Critical handoffs
132
-
133
- - After contract is honest but residual violations remain: **STOP — do not continue this skill as complete.** **STOP — bulk residual debt: invoke /ark-loop or /ark-autopilot** instead of ad-hoc multi-file grinding without a plan.
134
- - New artifact home after reclassify: **STOP — do not continue this skill as complete.** **STOP — new file placement: invoke /ark-place** when the user needs a new artifact home.
135
-
136
- ## Done
137
-
138
- - Diff of `ark.config.json` explained in plain language.
139
- - **Así te lo re-soluciono en el manifiesto** when intents/Domain were part of the request.
140
- - Strict check result captured.
57
+ 1. If the path is missing or lying → execute **`/ark-adopt`**.
58
+ 2. If the path is honest and you are tightening rules → execute **`/ark-autopilot`**.
59
+ 3. `ark-check --strict-config`.
141
60
 
142
61
  ## Completion contract (skill incomplete if missing)
143
62
 
144
- End with **exactly** these headings (markdown `###`):
63
+ Skill incomplete if missing any field below.
145
64
 
146
65
  ### Completion
147
66
  - **Sensor:** commands/tools run
@@ -149,8 +68,5 @@ End with **exactly** these headings (markdown `###`):
149
68
  - **Result:** one-line outcome
150
69
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
151
70
  - **Compass:** top residual lenses | `n/a`
152
- - **Handoff:** `/ark-…` / CLI / `none`
71
+ - **Handoff:** `/ark-adopt` / `/ark-autopilot` / `none`
153
72
  - **Incomplete?** `no` | `yes — <what is missing>`
154
-
155
- If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
156
- **Skill incomplete if missing** any of the bullets above.
@@ -5,6 +5,9 @@ description: Ark adoption fitness audit — governed%, gates, baseline honesty,
5
5
 
6
6
  # /ark-coverage — Ark adoption fitness (not full recon)
7
7
 
8
+ **Shortcut.** Fitness numbers only. Full map / leftover design → **`/ark-explore`**.
9
+ Apply → **`/ark-autopilot`**. Session 0 → **`/ark-adopt`**. This is not `/ark-explore`.
10
+
8
11
  You audit **how this repo uses ArkGate** (coverage, gates, baseline, host write path) and
9
12
  what adoption gaps remain. Work autonomously. End with a ranked fitness report.
10
13
 
@@ -5,6 +5,9 @@ description: Explain this project's architecture in plain language and generate
5
5
 
6
6
  # /ark-explain — Understand this project's architecture
7
7
 
8
+ **Shortcut.** Teach / HTML tour only. Map → **`/ark-explore`**. Apply → **`/ark-autopilot`**.
9
+ Session 0 → **`/ark-adopt`**.
10
+
8
11
  The user wants to understand the architecture, a specific rule, or why the gate blocked them.
9
12
 
10
13
  ## Improvement compass (process preflight)
@@ -31,7 +34,7 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
31
34
  | Use `/ark-explain` when… | Do **not** use it when… |
32
35
  |--------------------------|-------------------------|
33
36
  | Plain-language tour of layers/rules/report | Decision-grade recon / dual-plan → `/ark-explore` |
34
- | “Why did the gate block me?” pedagogy | Apply fixes → `/ark-fix` / `/ark-autopilot` |
37
+ | “Why did the gate block me?” pedagogy | Apply fixes → `/ark-autopilot` |
35
38
  | Generate / walk HTML showcase report | Fitness numbers only → `/ark-coverage`; brownfield action → `/ark-adopt` |
36
39
  Your job is to **teach with this repo's real data** and leave a shareable visual artifact.
37
40
 
@@ -68,7 +71,7 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
68
71
  1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
69
72
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
70
73
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
71
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
74
+ 4. Editing `arkrules/*` or applying structure fixes is **`/ark-adopt`** / **`/ark-autopilot`** (never invent `mechanical-safe`).
72
75
  5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
73
76
 
74
77
 
@@ -186,7 +189,7 @@ when residual signals remain.
186
189
  - If a DI/kernel framework border exists, explain public surface vs internals.
187
190
  3. **If asked about a specific rule or block**, answer with: the rule, the consequence it
188
191
  prevents, and the sanctioned fix (usually a port). If they want it fixed now:
189
- **STOP — do not continue this skill as complete.** **STOP — fix requested: invoke /ark-fix.**
192
+ **STOP — do not continue this skill as complete.** **STOP — fix requested:** invoke `/ark-autopilot`.
190
193
  This skill stays read-only.
191
194
  4. **If asked "what's a port/adapter/saga…"**, two sentences + this-repo example or conventional path.
192
195
 
@@ -206,7 +209,7 @@ when residual signals remain.
206
209
 
207
210
  ## Related
208
211
 
209
- - Onboarding: `/ark-architect`, `ark-check --recommend`, `docs/enthusiast/README.md`
212
+ - Onboarding: `/ark-adopt` (or leftover `/ark-architect`), `ark-check --recommend`, `docs/enthusiast/README.md`
210
213
  - Brownfield: `/ark-adopt`, `docs/brownfield-adoption.md`
211
214
  - Autopilot: `/ark-autopilot` after the user understands the contract
212
215