arkgate 4.8.14 → 4.8.15

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 (97) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.md +13 -5
  3. package/bin/ark-check-runtime.mjs +17 -49
  4. package/bin/ark-mcp-runtime.mjs +111 -2
  5. package/bin/ark-shared.mjs +140 -11
  6. package/bin/ark.mjs +7 -25
  7. package/bin/lib/adr-presence.mjs +97 -0
  8. package/bin/lib/agent-skills-package.mjs +179 -1
  9. package/bin/lib/analysis-completeness.mjs +38 -2
  10. package/bin/lib/analysis-engine.mjs +6 -6
  11. package/bin/lib/architecture-scan.mjs +26 -4
  12. package/bin/lib/ark-run-doctor.mjs +6 -0
  13. package/bin/lib/ark-run-report.mjs +6 -2
  14. package/bin/lib/arkrules-sensors.mjs +81 -0
  15. package/bin/lib/baseline-key.mjs +4 -1
  16. package/bin/lib/check-args.mjs +52 -2
  17. package/bin/lib/config-contract.mjs +64 -1
  18. package/bin/lib/diagnostic-catalog.mjs +3 -1
  19. package/bin/lib/doctor-advisories.mjs +94 -10
  20. package/bin/lib/doctor-human.mjs +18 -5
  21. package/bin/lib/doctor-next-actions.mjs +14 -0
  22. package/bin/lib/doctor-plan.mjs +32 -2
  23. package/bin/lib/enforcement-honesty.mjs +47 -2
  24. package/bin/lib/first-run-help.mjs +8 -1
  25. package/bin/lib/host-support-matrix.mjs +9 -1
  26. package/bin/lib/html-report-depth.mjs +2 -0
  27. package/bin/lib/html-report.mjs +13 -2
  28. package/bin/lib/import-resolve.mjs +74 -13
  29. package/bin/lib/improvement-compass-doctor.mjs +6 -1
  30. package/bin/lib/improvement-compass-map.mjs +3 -1
  31. package/bin/lib/layer-description.mjs +90 -8
  32. package/bin/lib/mcp-hook-payload.mjs +56 -0
  33. package/bin/lib/no-domain-frontend.mjs +91 -0
  34. package/bin/lib/presets.mjs +3 -4
  35. package/bin/lib/product-copy.mjs +15 -0
  36. package/bin/lib/projected-governed-coverage.mjs +114 -0
  37. package/bin/lib/recommend-cli.mjs +54 -0
  38. package/bin/lib/remediation.mjs +4 -0
  39. package/bin/lib/resolved-candidate-facts.mjs +83 -66
  40. package/bin/lib/rules-under-contract.mjs +117 -2
  41. package/bin/lib/snippet-analysis.mjs +14 -8
  42. package/bin/lib/start-preview.mjs +5 -2
  43. package/bin/lib/states-transitions-presence.mjs +212 -0
  44. package/bin/lib/status-command.mjs +2 -0
  45. package/bin/lib/status-transition-catalog.mjs +410 -0
  46. package/bin/lib/team-parliament-io.mjs +10 -0
  47. package/bin/lib/violations.mjs +13 -1
  48. package/bin/lib/write-path-capabilities.mjs +20 -5
  49. package/bin/lib/write-path-detect.mjs +27 -2
  50. package/dist/{configTypes-j7so8B4O.d.ts → configTypes-Dt3DpVbd.d.ts} +19 -0
  51. package/dist/{diagnosticCatalog-DVx_2RmF.d.ts → diagnosticCatalog-BEg85XlE.d.ts} +3 -3
  52. package/dist/eslint/index.cjs +4 -4
  53. package/dist/eslint/index.d.ts +1 -1
  54. package/dist/eslint/index.js +4 -4
  55. package/dist/index.cjs +31 -31
  56. package/dist/index.d.ts +70 -9
  57. package/dist/index.js +31 -31
  58. package/dist/nestjs/index.cjs +5 -5
  59. package/dist/nestjs/index.d.ts +3 -3
  60. package/dist/nestjs/index.js +5 -5
  61. package/dist/runtime/index.cjs +15 -15
  62. package/dist/runtime/index.d.ts +6 -6
  63. package/dist/runtime/index.js +15 -15
  64. package/dist/{types-Djbs3KjE.d.ts → types-CN9tVMPz.d.ts} +3 -1
  65. package/dist/{types-tGhZUiGX.d.ts → types-TBiv0WHL.d.ts} +1 -1
  66. package/docs/README.md +1 -1
  67. package/docs/agent-guide.md +6 -4
  68. package/docs/ai-gates.md +10 -3
  69. package/docs/brownfield-adoption.md +4 -1
  70. package/docs/configuration.md +55 -7
  71. package/docs/develop.md +1 -0
  72. package/docs/diagnostics.md +23 -3
  73. package/docs/enthusiast/how-to-agent-gates.md +5 -0
  74. package/docs/enthusiast/how-to-pick-shape.md +1 -1
  75. package/docs/package-surface.md +7 -5
  76. package/docs/use.md +5 -0
  77. package/package.json +1 -1
  78. package/schemas/ark.config.schema.json +23 -2
  79. package/server.json +2 -2
  80. package/templates/agent-skills/README.md +1 -1
  81. package/templates/agent-skills/ark-adopt/SKILL.md +82 -1
  82. package/templates/agent-skills/ark-autopilot/SKILL.md +6 -2
  83. package/templates/agent-skills/ark-coverage/SKILL.md +1 -1
  84. package/templates/agent-skills/ark-explain/SKILL.md +4 -2
  85. package/templates/agent-skills/ark-explore/SKILL.md +14 -1
  86. package/templates/agent-skills/ark-place/SKILL.md +38 -3
  87. package/templates/agent-skills/ark-runtime/SKILL.md +4 -2
  88. package/templates/agent-skills/ark-upgrade/SKILL.md +1 -1
  89. package/templates/arkrules/DomainModel.json +14 -1
  90. package/templates/skills/ark-adopt.md +82 -1
  91. package/templates/skills/ark-autopilot.md +6 -2
  92. package/templates/skills/ark-coverage.md +1 -1
  93. package/templates/skills/ark-explain.md +4 -2
  94. package/templates/skills/ark-explore.md +14 -1
  95. package/templates/skills/ark-place.md +38 -3
  96. package/templates/skills/ark-runtime.md +4 -2
  97. package/templates/skills/ark-upgrade.md +1 -1
@@ -21,11 +21,33 @@ has honest houses. Skills never enforce — CLI / hooks / CI do.
21
21
  ## Checklist
22
22
 
23
23
  - Existing tree: propose **SharedKernel** (types/constants) + **CompositionRoot** (wiring) + `src/**/domain/**`. Never dump bare `src/lib/**` into Application.
24
+ - Every `include` path must land in a layer. Include that classifies no file is the
25
+ same as an empty check — not a pass. Fix globs here; do not leave a loose gap.
24
26
  - Generate `.ark/golden-pattern.json` (load-bearing for `/ark-place`).
25
27
  - Future houses: mark unused layer globs `reserved` / `allowEmpty` so `--strict-config` does not fail.
26
28
  - When the product map or glossary names a house, write `layers[].description` as
27
29
  app-context copy (what this folder is *in the product*). Compact starter may omit.
28
30
  Do not invent captions. Do not invent `/ark-describe`.
31
+ - When the product map names who a folder is for, write `layers[].trustBoundary`
32
+ (`public` | `auth` | `admin` | `internal`). Compact starter may omit. Do not
33
+ invent tags. Absence is silent. No `/ark-trust`.
34
+ - When the product map names who owns a folder, write `layers[].owners`
35
+ (GitHub handle or email). Compact starter may omit. Do not invent people.
36
+ Absence is silent unless the user asked for required owners — then write
37
+ `requireLayerOwners: true` after the live houses have names. No `/ark-owners`.
38
+ - When the user wants required gates (`--require-gates` / `--strict-merge` /
39
+ required GitHub check) and there is no `docs/adr/` (or `docs/decisions/`),
40
+ leave a short decision note there — only if they loosen a rule or add a real
41
+ gate. Not every change. Doctor residual is soft. No `/ark-adr`.
42
+ - When a product-domain doc is already in play (`docs/domain.md` or a sibling)
43
+ and doctor JSON has `statesTransitions` or `statusTransitionCatalog`, add a
44
+ short states → transitions table (or one link) there. Use catalog names when
45
+ present. No flag soup. Soft residual. Silent when that doc is absent or
46
+ Domain has no status vocabulary. No `/ark-states`.
47
+ - When doctor JSON has `noDomainFrontend`, keep the empty Domain house — do not
48
+ delete it to “clean” empty layers. Next is one Domain file (`/ark-place`), not
49
+ a weaker contract. Soft. Silent when there is no frontend or Domain already
50
+ has files. No `/ark-domain`.
29
51
  - CLI-first: if `arkgate-check` already resolved the root, do not wait on MCP.
30
52
  - Do not add `arkRun` or `arkOrder` unless the user wants that extra. When they do, write
31
53
  **advisory** extra in this turn (`arkRun` schema `1.2+`; `arkOrder` schema `1.3+`).
@@ -106,6 +128,46 @@ received."), not architecture jargon. Compact starter / `ark start` may omit the
106
128
  field. Absence is silent — never fail `--strict-config` for a missing caption.
107
129
  Do **not** invent captions. Do not invent `/ark-describe`.
108
130
 
131
+ ## Layer trust (process)
132
+
133
+ Optional `layers[].trustBoundary`: `public` | `auth` | `admin` | `internal`.
134
+ Marks who this folder is for (anyone, signed-in users, operators, or only
135
+ other code). Write it when the product map already names that door. Compact
136
+ starter / `ark start` may omit it. Absence is silent — never fail
137
+ `--strict-config`, never invent a doctor residual. Do **not** invent tags.
138
+ This is not host/CI TLS and does not add import-rule teeth. No `/ark-trust`.
139
+
140
+ ## Layer owners (process)
141
+
142
+ Optional `layers[].owners`: GitHub handles or emails (same identity as
143
+ `stewards` — not a display name). Write them when the product map already
144
+ names who owns the house. Compact starter / `ark start` may omit. Absence is
145
+ silent unless the user asked for required owners. Then write
146
+ `requireLayerOwners: true` only after every live (non-reserved) layer has
147
+ at least one owner. Do **not** invent people. No `/ark-owners`. The require
148
+ flag is the fail-closed switch; owners themselves are metadata.
149
+
150
+ ## Decision notes (process)
151
+
152
+ When gates are required (`--require-gates` / `--strict-merge` / required merge
153
+ status) and there is no short decision-note home yet, doctor may ask for one
154
+ under `docs/adr/` or `docs/decisions/`. Write a note when you loosen a rule or
155
+ add a real gate — not on every file. Absence is silent unless that demand is
156
+ on. The hint does not fail the check. Do **not** invent `/ark-adr`. Policy
157
+ weaken still uses `--policy-ack`; this is only a place to write the why.
158
+
159
+ ## States and transitions (process)
160
+
161
+ When a product-domain / domain-model doc is already on disk (`docs/domain.md`,
162
+ `docs/data-model.md`, or a dedicated `docs/states.md`) and there is no short
163
+ states → transitions table (or one link), doctor may ask for one. Write the
164
+ table on that home — entity · states · allowed from → to. Names from the
165
+ code or the captain. When doctor JSON has `statusTransitionCatalog`, use those
166
+ entity · states names — Domain already opted in by having that vocabulary.
167
+ Do **not** invent states or flag soup. Absence of the domain doc, or Domain
168
+ with no status union/enum, stays silent. The hint does not fail the check.
169
+ Do **not** invent `/ark-states`. Do not walk the tree to invent a roster.
170
+
109
171
  ## When / not when
110
172
 
111
173
  | Use `/ark-adopt` when… | Do **not** use it when… |
@@ -151,7 +213,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
151
213
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
152
214
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
153
215
  4. Editing `arkrules/*` or promoting modes is **this skill** (session 0) or **`/ark-autopilot`** later; never invent `mechanical-safe`.
154
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
216
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
155
217
  6. Absence of `arkRun` is **valid**. Write it only when the user wants the extra. Skills never enforce.
156
218
  7. Absence of `arkOrder` is **valid**. Write it only when the user wants the extra. After the extra is honest: handoff **`/ark-order`** to wire one candidate. Skills never enforce.
157
219
 
@@ -159,6 +221,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
159
221
  ### Adopt + ArkRules
160
222
  - After classify: emit or refresh `arkRules` for matched layers (exact names; generic mold for unknowns).
161
223
  - Mine rules → inventory + write advisory invariants/structure into `arkrules/<Layer>.json` **in this turn**.
224
+ - Empty `invariants[]` on a populated Domain while `arkRules` is on is residual (`INVARIANT_CATALOG_EMPTY`), not done. Fill 1–2 short phrases. Advisory until a domain structure rule is `enforced`.
162
225
  - Application / Features templates include advisory `writes-via-aggregate`: driver import + write token in a use case is the skip. Do not copy `Externals/` / `admission.ts` folder religion.
163
226
  - Freeze baseline is **[Layer]** debt; inventory residual is **[ArkRules]** — report both.
164
227
 
@@ -222,6 +285,9 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
222
285
  - **Brownfield:** this skill — match config to reality; do not force a starter preset.
223
286
  - **Deep map only:** `/ark-explore`.
224
287
  - **Default path:** `ark start` → **`/ark-adopt`** → `/ark-place` / `/ark-autopilot`.
288
+ `start --apply` may refuse (coverage below 50% or weak shape) — that lock is
289
+ deliberate. Lock the shape with `--archetype`, `--preset`, or `--force`, or
290
+ inspect ranked shapes with `ark-check --recommend`.
225
291
 
226
292
  ## Anti-wrapper rule (mandatory)
227
293
 
@@ -248,6 +314,9 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
248
314
  If `src/contexts` or `src/bounded-contexts` exists, prefer `ddd-bounded-contexts`.
249
315
  **Next.js:** `app/api/**` / `pages/api/**` (and route-group `app/(…)/api/**`) default to
250
316
  **ApplicationOrchestration**, not Presentation — do not reclassify API shells as UI.
317
+ Write Next-flavored `layers[].description` only when Next is actually present
318
+ (`next` dependency, `next.config.*`, or `app/page` / `pages/*` routes). Library and
319
+ package monorepos keep framework-free captions — `ark start` already does this.
251
320
  User wants the ArkRun extra → write **advisory** `arkRun` (schema `1.2+`, real
252
321
  `kernelRoots` preferred — `compositionRoots` alias, existing `managedLayers`) **in this turn**.
253
322
  User wants the ArkOrder extra → write **advisory** `arkOrder` (schema `1.3+`, real
@@ -255,6 +324,12 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
255
324
  to a compact starter. Do not promote to enforced as the session-0 default.
256
325
  When the product map or glossary names a house, write `layers[].description` on that
257
326
  layer (app-context sentence). Compact starter may omit. Do not invent captions.
327
+ When the product map names who a folder is for, write `layers[].trustBoundary`
328
+ (`public` | `auth` | `admin` | `internal`). Do not invent tags.
329
+ When the product map names who owns a folder, write `layers[].owners`
330
+ (GitHub handle or email). Do not invent people. Write `requireLayerOwners`
331
+ only when the user asked for required owners and the live houses already
332
+ have names.
258
333
  2. **Check + diagnose** — `summary.concentrated` / dominant edge → fix contract first, don’t freeze.
259
334
  Cross-slice / cross-context `peerIsolation` hits are judgment: extract shared or events.
260
335
  The denial names its reason. `unclassifiable path` in bulk means shared code lives outside
@@ -268,6 +343,8 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
268
343
  3. **Classify ungoverned** — use coverage `suggestions` **plus** dirs you discovered by reading;
269
344
  add layers/patterns **here** (write `ark.config.json`). When adding a layer the product map
270
345
  or glossary already names, write `layers[].description` on it (do not invent filler).
346
+ Write `layers[].trustBoundary` only when the product map already names that door.
347
+ Write `layers[].owners` only when the product map already names who owns the house.
271
348
  4. **Mine business rules → manifiesto** (model job — this is why the skill exists):
272
349
  - Scan for loose domain: validators, pricing/policy functions, `can*`/`calculate*`, magic business constants, publish/intent strings, logic in UI/hooks that belongs in Domain.
273
350
  - **ArkRules inventory (AR13):** run `ark-check --rules-inventory --json` for deterministic candidates
@@ -307,6 +384,10 @@ proposals applied or deferred, **phase**, **top Shape / design-weak opportunitie
307
384
  - Claim in-memory kernel stores are production durability.
308
385
  - Invent `/ark-run`. Use `/ark-order` after this door turns the extra on.
309
386
  - Invent `layers[].description` filler or a `/ark-describe` skill.
387
+ - Invent `layers[].trustBoundary` tags or a `/ark-trust` skill.
388
+ - Invent `layers[].owners` names or a `/ark-owners` skill.
389
+ - Invent `/ark-adr` or require a decision note on every change.
390
+ - Invent `/ark-states` or invent entity states / flag soup.
310
391
  - Claim Enforce while governed% is low, cores empty with I/O in Application, or core bags ungoverned.
311
392
  - End adopt with only “baseline written” when design-weak residual is visible in files you opened.
312
393
 
@@ -16,6 +16,8 @@ imports, one small change at a time. Skills never enforce — CLI / hooks / CI d
16
16
 
17
17
  1. Read `arkgate-check --doctor` (do #1).
18
18
  2. Fix import-rule debt; if leftover design remains, apply **one** small refactor.
19
+ When doctor JSON has `noDomainFrontend`, that refactor is one pure rule into
20
+ Domain — not another UI helper. Soft. Silent when Domain already has files.
19
21
  3. Re-run doctor. Never weaken `ark.config.json`.
20
22
 
21
23
  **This is the apply door.** Invoking it **is** the approval. Run `arkgate-check --doctor` for the next step.
@@ -32,7 +34,9 @@ Apply plan A (`mechanical-safe` **and** judgment). If leftover design work remai
32
34
  Composes **explore → sensors → dual plan → write**. Validate with ark-check; never weaken the gate.
33
35
  **Team lock:** do not edit `ark.config.json`, `arkrules/*`, or `.ark-baseline.json` in this
34
36
  turn unless the user invoked a steward contract session. Feature diffs use
35
- `ark-check --changed --base <merge-ref>`. Growing the baseline is steward-only.
37
+ `ark-check --local --base <merge-ref>` or `ark-check --changed --base <merge-ref>`.
38
+ `--local` is the optional cheap path for many worktrees; it cannot combine with
39
+ `--strict-merge`. Growing the baseline is steward-only.
36
40
 
37
41
  **Not a plan grinder.** Empty `--plan` does **not** mean “architecture is healthy” without
38
42
  the explore pass and dual-plan section B (pattern / Shape bets).
@@ -131,7 +135,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
131
135
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
132
136
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
133
137
  4. Editing `arkrules/*` or promoting modes and fixing structure sensors is **this skill** (judgment, never invent `mechanical-safe`).
134
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
138
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
135
139
  6. Absence of extras is **valid**. Extra skip clusters grind **here** after the extra is on. Evaluate one bus → `/ark-runtime`; evaluate one order-plane candidate → `/ark-order`. Do not invent `/ark-run`. Skills never enforce.
136
140
 
137
141
 
@@ -95,7 +95,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
95
95
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
96
96
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
97
97
  4. Editing `arkrules/*` or promoting modes is **`/ark-adopt`**; fixing code under a structure sensor is **`/ark-autopilot`** (judgment, never invent mechanical-safe).
98
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
98
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
99
99
  5b. Invariant coverage is a **text match, never an execution**: a file walk plus the invariant id in a `describe`/`it` title. Never report `INVARIANT_UNCOVERED: 0` as “the tests pass” or “the tests run” — ArkGate does not run tests and reads no runner config. When the project declares `coverage.coverageRoots`, a covering test found outside them raises the advisory `INVARIANT_COVERAGE_OUTSIDE_ROOTS`; without that declaration ArkGate makes no claim about where tests run.
100
100
  6. Extras silent when off. Doctor `arkRun` / `arkOrder` is `notAScore`. Do not force extras. Wire one kernel candidate via `/ark-runtime`; one order-plane candidate via `/ark-order`. Do not invent `/ark-run`.
101
101
 
@@ -79,7 +79,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
79
79
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
80
80
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
81
81
  4. Editing `arkrules/*` or applying structure fixes is **`/ark-adopt`** / **`/ark-autopilot`** (never invent `mechanical-safe`).
82
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
82
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
83
83
  6. Extras silent when off. Doctor `arkRun` / `arkOrder` is `notAScore`. Do not force extras. Wire one kernel candidate via `/ark-runtime`; one order-plane candidate via `/ark-order`. Do not invent `/ark-run`.
84
84
 
85
85
 
@@ -87,7 +87,9 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
87
87
  - HTML/plain tour: section **Layers** and section **Rules under contract (ArkRules)** —
88
88
  when `arkRules` is active the showcase lists **per-layer counts**, **structure sensors**
89
89
  (id / sensor / mode), **uncovered** invariants (call them out), and a **covered sample**.
90
- Inactive map stays a short opt-in note. Counts are never a score.
90
+ Compact doctor names ArkRules only when the map is on; absence stays silent.
91
+ Empty `invariants[]` on a populated Domain is residual (`INVARIANT_CATALOG_EMPTY`), not “all covered”.
92
+ Inactive HTML map stays a short opt-in note. Counts are never a score.
91
93
  - Spoken tour: name 2–4 real invariant IDs and one structure sensor from this repo’s
92
94
  `arkrules/*` (open the files — do not invent). Residual candidates → `--rules-inventory`.
93
95
  - **Teach the product model (required when arkRules is active):**
@@ -22,6 +22,18 @@ one bounded decision needs 2–3 enforceable options.
22
22
  ## Checklist
23
23
 
24
24
  - Doctor #1: if ENFORCE + empty plan A and gates are already installed → **Shape** (`/ark-explore` then `/ark-autopilot`). Do not say install-agent-gates.
25
+ - When `--require-gates` / adopted-strict is on and doctor JSON has `adrPresence`,
26
+ the next step is a short note under `docs/adr/` (or `docs/decisions/`). Soft.
27
+ Not every change. Off when require-gates is off. No `/ark-adr`.
28
+ - When doctor JSON has `statesTransitions` or `statusTransitionCatalog`, the
29
+ next step is a short states → transitions table (or one link) on the domain
30
+ doc already in play. Use catalog names when present. Soft. Silent when that
31
+ doc is absent or Domain has no status vocabulary. No `/ark-states`. Do not
32
+ invent states.
33
+ - When doctor JSON has `noDomainFrontend`, Domain is empty and the UI holds the
34
+ rules. Next: one Domain file (`/ark-place`) then one small refactor
35
+ (`/ark-autopilot`). Soft. Silent when there is no frontend or Domain already
36
+ has files. No `/ark-domain`. Do not invent a Domain house.
25
37
  - Distinguish **missing** skills vs **stale** catalog. Installed ≠ stale.
26
38
  - Hook green is not tree green (scripted edits bypass PreToolUse).
27
39
  - Bug / false green / false red / missing doc / improvable behavior **in ArkGate itself** → draft one upstream GitHub issue (`pedroknigge/arkgate` or the installed package `repository.url`), **ask the human to confirm send**, then `gh issue create`. Never auto-file. Never file ArkGate defects on the consumer product repo.
@@ -179,13 +191,14 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
179
191
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
180
192
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
181
193
  4. Editing `arkrules/*` or applying structure fixes is **`/ark-adopt`** / **`/ark-autopilot`** — explore does not write (never invent `mechanical-safe`).
182
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
194
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
183
195
  6. Never write `arkRun` or `arkOrder` from this skill. When extras are present, label residual **`[ArkRun]`** / **`[ArkOrder]`**. Wire one kernel candidate via `/ark-runtime`; one order-plane candidate via `/ark-order`. Do not invent `/ark-run`.
184
196
 
185
197
 
186
198
  ### Explore + ArkRules
187
199
  - Always run sensors for **both** planes when present: coverage/doctor **and** `--rules-inventory` if `arkRules` exists or brownfield may hide spaghetti rules.
188
200
  - Ranked table kinds may include `arkrules-opportunity` and `invariant-gap`.
201
+ - Empty `invariants[]` on a populated Domain while `arkRules` is on is residual (`INVARIANT_CATALOG_EMPTY`), not done. Point at `arkrules/<Domain>.json`.
189
202
  - Dual-plan **B** may include: place advisory structure rules, extract one inventory candidate to Domain + `arkrules` entry, promote one covered invariant.
190
203
  - Field path: note whether starters emit `arkrules/*`.
191
204
 
@@ -22,9 +22,21 @@ right house. Skills never enforce — CLI / hooks / CI do.
22
22
 
23
23
  - `filePath` is known before the call. Description alone is not a path.
24
24
  - Golden pattern is load-bearing when present. Adopt generates it.
25
+ - An included file that matches no layer is not a pass. The write gate denies it
26
+ (`CONFIG_UNCLASSIFIED_FILES`). Place it in a layer folder, or send include/layer
27
+ drift to `/ark-adopt`. Do not write into a loose include gap.
25
28
  - Do not default a repository to Presentation.
29
+ - When doctor JSON has `noDomainFrontend`, the new file is a Domain rule — not
30
+ another UI helper. Soft. Silent when Domain already has files or there is no
31
+ frontend. No `/ark-domain`.
26
32
  - When the matched layer has `layers[].description`, print that caption next to the
27
33
  layer name and globs. Omit when absent — do not invent a caption or `/ark-describe`.
34
+ - When the matched layer has `layers[].trustBoundary`, print `trust: <tag>` next
35
+ to the layer name and globs. Omit when absent — do not invent a tag or `/ark-trust`.
36
+ - When the matched layer has `layers[].owners`, print `owner: @handle` next
37
+ to the layer name and globs. Omit when absent — do not invent a person or `/ark-owners`.
38
+ When `requireLayerOwners` is on and the house has no owners, send that gap to
39
+ `/ark-adopt` before writing.
28
40
  - When `arkRun` is on: scaffold through the kernel (no `new` of managed types; declare
29
41
  `uses` / `reactsTo` / `raises` / `sends`; factory only in `arkRun.kernelRoots`,
30
42
  `compositionRoots` alias). Extra off → do not introduce the kernel. Enable it
@@ -69,6 +81,21 @@ When `ark_place` / the contract includes `layers[].description`, print that capt
69
81
  next to the layer name and globs. Omit it when the field is absent. Do **not** invent
70
82
  a caption or `/ark-describe`.
71
83
 
84
+ ## Layer trust (process)
85
+
86
+ When the matched layer has `layers[].trustBoundary` (`public` | `auth` |
87
+ `admin` | `internal`), print `trust: <tag>` next to the layer name and globs.
88
+ Omit it when the field is absent. Do **not** invent a tag or `/ark-trust`.
89
+ The tag is guidance, not an import-rule deny.
90
+
91
+ ## Layer owners (process)
92
+
93
+ When the matched layer has `layers[].owners`, print `owner: @handle` (or
94
+ `owner: name@host`) next to the layer name and globs. Omit when absent.
95
+ Do **not** invent a person or `/ark-owners`. When `requireLayerOwners` is
96
+ on and this house has no owners, do not write — hand off `/ark-adopt` to
97
+ name who owns the folder.
98
+
72
99
  ## Deep modules (process)
73
100
 
74
101
  - Place so new code stays **deep**: one small public surface per concern; hide implementation details.
@@ -92,7 +119,9 @@ and — if they asked to build it — scaffold it there correctly.
92
119
  **No artifact given?** If the skill is invoked with nothing to place, don't error
93
120
  and don't guess — the artifact is the one thing only the user knows. Read the
94
121
  contract (step 1) and print the placement map from it: one row per declared layer
95
- with layer name, globs, and `layers[].description` when present (omit when absent),
122
+ with layer name, globs, `layers[].description` when present,
123
+ `layers[].trustBoundary` when present, and `layers[].owners` when present
124
+ (omit any when absent),
96
125
  what belongs there, its directory, and which layers it may/may not import,
97
126
  plus the not-yet-adopted `suggestedLayers` as a footnote. Then ask what they want
98
127
  to place. That map is derived entirely from the repo, so producing it is real work,
@@ -134,7 +163,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
134
163
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
135
164
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
136
165
  4. Missing layer home: add it via **`/ark-adopt`** in this session if needed, then write the file; never invent `mechanical-safe`.
137
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
166
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
138
167
  6. Absence of `arkRun` is **valid**. Do not introduce the kernel speculatively. Skills never enforce this extra.
139
168
  7. Absence of `arkOrder` is **valid**. When on: Domain stays plane-free; first freeze ξ with `release()`; later ξ is `proposeRelease` then `apply`; never `update`/`patch`/`set` the pattern. Import `createOrderPlane` from `arkgate/order` (same npm package). Evaluate / wire one candidate via **`/ark-order`**.
140
169
 
@@ -180,7 +209,11 @@ the same files or weaken the gate.
180
209
  its forbidden globals, and exactly which layers the file may / must not import,
181
210
  straight from the contract (no guessing). When the matched layer has
182
211
  `layers[].description`, print that caption next to the layer name and globs;
183
- omit it when absent. When present, also honor optional
212
+ omit it when absent. When the matched layer has `layers[].trustBoundary`,
213
+ print `trust: <tag>` next to the layer name and globs; omit it when absent.
214
+ When the matched layer has `layers[].owners`, print `owner: @handle`; omit
215
+ when absent.
216
+ When present, also honor optional
184
217
  **`goldenPattern`** (from `.ark/golden-pattern.json`) for **NEW code only** —
185
218
  advisory layout norm; never overrides the gate and never clears design-weak.
186
219
  Absent golden is normal. Otherwise load `ark.config.json`; after the matched preflight,
@@ -215,6 +248,8 @@ the same files or weaken the gate.
215
248
  `patterns`), intent-name prefix if the layer declares `intentPrefixes`, and
216
249
  which layers it may/may not import (from `rules`). When present, print
217
250
  `layers[].description` next to the layer name and globs; omit when absent.
251
+ Print `layers[].trustBoundary` as `trust: <tag>` when present; omit when absent.
252
+ Print `layers[].owners` as `owner: @handle` when present; omit when absent.
218
253
  4. **If the layer isn't adopted yet** (suggested but no directory): write the
219
254
  layer into `ark.config.json` (session-0 honesty — same as `/ark-adopt` for
220
255
  that glob) **then** write the file. Don't silently drop the code into a
@@ -34,8 +34,10 @@ grind (`/ark-autopilot`); wire the order plane (`/ark-order`).
34
34
  | **ArkRun extra** (`arkRun` on `ark.config.json`, schema `1.2+`) | Gate contract: kernel usage + complete declarations | A score; Layers / ArkRules replacement; merge teeth while `advisory` |
35
35
  | **Kernel** `arkgate/runtime` | Kernel you construct with `createStrictArkKernel` (one instance per call) | A process-wide `getKernel()`; shipped cloud broker SDKs; production durability |
36
36
 
37
- Absence of the extra is **silent** — Layers and ArkRules verdicts stay identical. Doctor / status
38
- `arkRun` is always `notAScore`. Never invent 0–10 scores or pass/fail from this skill.
37
+ Absence of the extra is **silent** — Layers and ArkRules verdicts stay identical. Compact
38
+ doctor names ArkRun only when the extra is on (experimental, in-memory, not Postgres;
39
+ `/ark-runtime` when residual remains). Doctor / status `arkRun` is always `notAScore`.
40
+ Never invent 0–10 scores or pass/fail from this skill.
39
41
 
40
42
  ## Improvement compass note
41
43
 
@@ -143,7 +143,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
143
143
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
144
144
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
145
145
  4. After upgrade, leftover architecture work is **`/ark-autopilot`** (never invent `mechanical-safe`).
146
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
146
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
147
147
  6. Schema `1.3` extras stay off unless already on. Pin teaches `arkgate/runtime` and `arkgate/order` (same tarball), not a second install. Wire after upgrade via `/ark-runtime` / `/ark-order`. Do not invent `/ark-run`.
148
148
 
149
149
 
@@ -28,5 +28,18 @@
28
28
  "description": "Prefer rich domain types over data-only bags (advisory only)."
29
29
  }
30
30
  ],
31
- "invariants": []
31
+ "invariants": [
32
+ {
33
+ "id": "INV-ALWAYS-VALID",
34
+ "description": "A domain object is never stored in an invalid state",
35
+ "mode": "advisory",
36
+ "coverage": { "test": false }
37
+ },
38
+ {
39
+ "id": "INV-ONE-DECISION",
40
+ "description": "Each business fact has one place that decides it",
41
+ "mode": "advisory",
42
+ "coverage": { "test": false }
43
+ }
44
+ ]
32
45
  }
@@ -21,11 +21,33 @@ has honest houses. Skills never enforce — CLI / hooks / CI do.
21
21
  ## Checklist
22
22
 
23
23
  - Existing tree: propose **SharedKernel** (types/constants) + **CompositionRoot** (wiring) + `src/**/domain/**`. Never dump bare `src/lib/**` into Application.
24
+ - Every `include` path must land in a layer. Include that classifies no file is the
25
+ same as an empty check — not a pass. Fix globs here; do not leave a loose gap.
24
26
  - Generate `.ark/golden-pattern.json` (load-bearing for `/ark-place`).
25
27
  - Future houses: mark unused layer globs `reserved` / `allowEmpty` so `--strict-config` does not fail.
26
28
  - When the product map or glossary names a house, write `layers[].description` as
27
29
  app-context copy (what this folder is *in the product*). Compact starter may omit.
28
30
  Do not invent captions. Do not invent `/ark-describe`.
31
+ - When the product map names who a folder is for, write `layers[].trustBoundary`
32
+ (`public` | `auth` | `admin` | `internal`). Compact starter may omit. Do not
33
+ invent tags. Absence is silent. No `/ark-trust`.
34
+ - When the product map names who owns a folder, write `layers[].owners`
35
+ (GitHub handle or email). Compact starter may omit. Do not invent people.
36
+ Absence is silent unless the user asked for required owners — then write
37
+ `requireLayerOwners: true` after the live houses have names. No `/ark-owners`.
38
+ - When the user wants required gates (`--require-gates` / `--strict-merge` /
39
+ required GitHub check) and there is no `docs/adr/` (or `docs/decisions/`),
40
+ leave a short decision note there — only if they loosen a rule or add a real
41
+ gate. Not every change. Doctor residual is soft. No `/ark-adr`.
42
+ - When a product-domain doc is already in play (`docs/domain.md` or a sibling)
43
+ and doctor JSON has `statesTransitions` or `statusTransitionCatalog`, add a
44
+ short states → transitions table (or one link) there. Use catalog names when
45
+ present. No flag soup. Soft residual. Silent when that doc is absent or
46
+ Domain has no status vocabulary. No `/ark-states`.
47
+ - When doctor JSON has `noDomainFrontend`, keep the empty Domain house — do not
48
+ delete it to “clean” empty layers. Next is one Domain file (`/ark-place`), not
49
+ a weaker contract. Soft. Silent when there is no frontend or Domain already
50
+ has files. No `/ark-domain`.
29
51
  - CLI-first: if `arkgate-check` already resolved the root, do not wait on MCP.
30
52
  - Do not add `arkRun` or `arkOrder` unless the user wants that extra. When they do, write
31
53
  **advisory** extra in this turn (`arkRun` schema `1.2+`; `arkOrder` schema `1.3+`).
@@ -106,6 +128,46 @@ received."), not architecture jargon. Compact starter / `ark start` may omit the
106
128
  field. Absence is silent — never fail `--strict-config` for a missing caption.
107
129
  Do **not** invent captions. Do not invent `/ark-describe`.
108
130
 
131
+ ## Layer trust (process)
132
+
133
+ Optional `layers[].trustBoundary`: `public` | `auth` | `admin` | `internal`.
134
+ Marks who this folder is for (anyone, signed-in users, operators, or only
135
+ other code). Write it when the product map already names that door. Compact
136
+ starter / `ark start` may omit it. Absence is silent — never fail
137
+ `--strict-config`, never invent a doctor residual. Do **not** invent tags.
138
+ This is not host/CI TLS and does not add import-rule teeth. No `/ark-trust`.
139
+
140
+ ## Layer owners (process)
141
+
142
+ Optional `layers[].owners`: GitHub handles or emails (same identity as
143
+ `stewards` — not a display name). Write them when the product map already
144
+ names who owns the house. Compact starter / `ark start` may omit. Absence is
145
+ silent unless the user asked for required owners. Then write
146
+ `requireLayerOwners: true` only after every live (non-reserved) layer has
147
+ at least one owner. Do **not** invent people. No `/ark-owners`. The require
148
+ flag is the fail-closed switch; owners themselves are metadata.
149
+
150
+ ## Decision notes (process)
151
+
152
+ When gates are required (`--require-gates` / `--strict-merge` / required merge
153
+ status) and there is no short decision-note home yet, doctor may ask for one
154
+ under `docs/adr/` or `docs/decisions/`. Write a note when you loosen a rule or
155
+ add a real gate — not on every file. Absence is silent unless that demand is
156
+ on. The hint does not fail the check. Do **not** invent `/ark-adr`. Policy
157
+ weaken still uses `--policy-ack`; this is only a place to write the why.
158
+
159
+ ## States and transitions (process)
160
+
161
+ When a product-domain / domain-model doc is already on disk (`docs/domain.md`,
162
+ `docs/data-model.md`, or a dedicated `docs/states.md`) and there is no short
163
+ states → transitions table (or one link), doctor may ask for one. Write the
164
+ table on that home — entity · states · allowed from → to. Names from the
165
+ code or the captain. When doctor JSON has `statusTransitionCatalog`, use those
166
+ entity · states names — Domain already opted in by having that vocabulary.
167
+ Do **not** invent states or flag soup. Absence of the domain doc, or Domain
168
+ with no status union/enum, stays silent. The hint does not fail the check.
169
+ Do **not** invent `/ark-states`. Do not walk the tree to invent a roster.
170
+
109
171
  ## When / not when
110
172
 
111
173
  | Use `/ark-adopt` when… | Do **not** use it when… |
@@ -151,7 +213,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
151
213
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
152
214
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
153
215
  4. Editing `arkrules/*` or promoting modes is **this skill** (session 0) or **`/ark-autopilot`** later; never invent `mechanical-safe`.
154
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
216
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
155
217
  6. Absence of `arkRun` is **valid**. Write it only when the user wants the extra. Skills never enforce.
156
218
  7. Absence of `arkOrder` is **valid**. Write it only when the user wants the extra. After the extra is honest: handoff **`/ark-order`** to wire one candidate. Skills never enforce.
157
219
 
@@ -159,6 +221,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
159
221
  ### Adopt + ArkRules
160
222
  - After classify: emit or refresh `arkRules` for matched layers (exact names; generic mold for unknowns).
161
223
  - Mine rules → inventory + write advisory invariants/structure into `arkrules/<Layer>.json` **in this turn**.
224
+ - Empty `invariants[]` on a populated Domain while `arkRules` is on is residual (`INVARIANT_CATALOG_EMPTY`), not done. Fill 1–2 short phrases. Advisory until a domain structure rule is `enforced`.
162
225
  - Application / Features templates include advisory `writes-via-aggregate`: driver import + write token in a use case is the skip. Do not copy `Externals/` / `admission.ts` folder religion.
163
226
  - Freeze baseline is **[Layer]** debt; inventory residual is **[ArkRules]** — report both.
164
227
 
@@ -222,6 +285,9 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
222
285
  - **Brownfield:** this skill — match config to reality; do not force a starter preset.
223
286
  - **Deep map only:** `/ark-explore`.
224
287
  - **Default path:** `ark start` → **`/ark-adopt`** → `/ark-place` / `/ark-autopilot`.
288
+ `start --apply` may refuse (coverage below 50% or weak shape) — that lock is
289
+ deliberate. Lock the shape with `--archetype`, `--preset`, or `--force`, or
290
+ inspect ranked shapes with `ark-check --recommend`.
225
291
 
226
292
  ## Anti-wrapper rule (mandatory)
227
293
 
@@ -248,6 +314,9 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
248
314
  If `src/contexts` or `src/bounded-contexts` exists, prefer `ddd-bounded-contexts`.
249
315
  **Next.js:** `app/api/**` / `pages/api/**` (and route-group `app/(…)/api/**`) default to
250
316
  **ApplicationOrchestration**, not Presentation — do not reclassify API shells as UI.
317
+ Write Next-flavored `layers[].description` only when Next is actually present
318
+ (`next` dependency, `next.config.*`, or `app/page` / `pages/*` routes). Library and
319
+ package monorepos keep framework-free captions — `ark start` already does this.
251
320
  User wants the ArkRun extra → write **advisory** `arkRun` (schema `1.2+`, real
252
321
  `kernelRoots` preferred — `compositionRoots` alias, existing `managedLayers`) **in this turn**.
253
322
  User wants the ArkOrder extra → write **advisory** `arkOrder` (schema `1.3+`, real
@@ -255,6 +324,12 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
255
324
  to a compact starter. Do not promote to enforced as the session-0 default.
256
325
  When the product map or glossary names a house, write `layers[].description` on that
257
326
  layer (app-context sentence). Compact starter may omit. Do not invent captions.
327
+ When the product map names who a folder is for, write `layers[].trustBoundary`
328
+ (`public` | `auth` | `admin` | `internal`). Do not invent tags.
329
+ When the product map names who owns a folder, write `layers[].owners`
330
+ (GitHub handle or email). Do not invent people. Write `requireLayerOwners`
331
+ only when the user asked for required owners and the live houses already
332
+ have names.
258
333
  2. **Check + diagnose** — `summary.concentrated` / dominant edge → fix contract first, don’t freeze.
259
334
  Cross-slice / cross-context `peerIsolation` hits are judgment: extract shared or events.
260
335
  The denial names its reason. `unclassifiable path` in bulk means shared code lives outside
@@ -268,6 +343,8 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
268
343
  3. **Classify ungoverned** — use coverage `suggestions` **plus** dirs you discovered by reading;
269
344
  add layers/patterns **here** (write `ark.config.json`). When adding a layer the product map
270
345
  or glossary already names, write `layers[].description` on it (do not invent filler).
346
+ Write `layers[].trustBoundary` only when the product map already names that door.
347
+ Write `layers[].owners` only when the product map already names who owns the house.
271
348
  4. **Mine business rules → manifiesto** (model job — this is why the skill exists):
272
349
  - Scan for loose domain: validators, pricing/policy functions, `can*`/`calculate*`, magic business constants, publish/intent strings, logic in UI/hooks that belongs in Domain.
273
350
  - **ArkRules inventory (AR13):** run `ark-check --rules-inventory --json` for deterministic candidates
@@ -307,6 +384,10 @@ proposals applied or deferred, **phase**, **top Shape / design-weak opportunitie
307
384
  - Claim in-memory kernel stores are production durability.
308
385
  - Invent `/ark-run`. Use `/ark-order` after this door turns the extra on.
309
386
  - Invent `layers[].description` filler or a `/ark-describe` skill.
387
+ - Invent `layers[].trustBoundary` tags or a `/ark-trust` skill.
388
+ - Invent `layers[].owners` names or a `/ark-owners` skill.
389
+ - Invent `/ark-adr` or require a decision note on every change.
390
+ - Invent `/ark-states` or invent entity states / flag soup.
310
391
  - Claim Enforce while governed% is low, cores empty with I/O in Application, or core bags ungoverned.
311
392
  - End adopt with only “baseline written” when design-weak residual is visible in files you opened.
312
393
 
@@ -16,6 +16,8 @@ imports, one small change at a time. Skills never enforce — CLI / hooks / CI d
16
16
 
17
17
  1. Read `arkgate-check --doctor` (do #1).
18
18
  2. Fix import-rule debt; if leftover design remains, apply **one** small refactor.
19
+ When doctor JSON has `noDomainFrontend`, that refactor is one pure rule into
20
+ Domain — not another UI helper. Soft. Silent when Domain already has files.
19
21
  3. Re-run doctor. Never weaken `ark.config.json`.
20
22
 
21
23
  **This is the apply door.** Invoking it **is** the approval. Run `arkgate-check --doctor` for the next step.
@@ -32,7 +34,9 @@ Apply plan A (`mechanical-safe` **and** judgment). If leftover design work remai
32
34
  Composes **explore → sensors → dual plan → write**. Validate with ark-check; never weaken the gate.
33
35
  **Team lock:** do not edit `ark.config.json`, `arkrules/*`, or `.ark-baseline.json` in this
34
36
  turn unless the user invoked a steward contract session. Feature diffs use
35
- `ark-check --changed --base <merge-ref>`. Growing the baseline is steward-only.
37
+ `ark-check --local --base <merge-ref>` or `ark-check --changed --base <merge-ref>`.
38
+ `--local` is the optional cheap path for many worktrees; it cannot combine with
39
+ `--strict-merge`. Growing the baseline is steward-only.
36
40
 
37
41
  **Not a plan grinder.** Empty `--plan` does **not** mean “architecture is healthy” without
38
42
  the explore pass and dual-plan section B (pattern / Shape bets).
@@ -131,7 +135,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
131
135
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
132
136
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
133
137
  4. Editing `arkrules/*` or promoting modes and fixing structure sensors is **this skill** (judgment, never invent `mechanical-safe`).
134
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
138
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
135
139
  6. Absence of extras is **valid**. Extra skip clusters grind **here** after the extra is on. Evaluate one bus → `/ark-runtime`; evaluate one order-plane candidate → `/ark-order`. Do not invent `/ark-run`. Skills never enforce.
136
140
 
137
141
 
@@ -95,7 +95,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
95
95
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
96
96
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
97
97
  4. Editing `arkrules/*` or promoting modes is **`/ark-adopt`**; fixing code under a structure sensor is **`/ark-autopilot`** (judgment, never invent mechanical-safe).
98
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
98
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
99
99
  5b. Invariant coverage is a **text match, never an execution**: a file walk plus the invariant id in a `describe`/`it` title. Never report `INVARIANT_UNCOVERED: 0` as “the tests pass” or “the tests run” — ArkGate does not run tests and reads no runner config. When the project declares `coverage.coverageRoots`, a covering test found outside them raises the advisory `INVARIANT_COVERAGE_OUTSIDE_ROOTS`; without that declaration ArkGate makes no claim about where tests run.
100
100
  6. Extras silent when off. Doctor `arkRun` / `arkOrder` is `notAScore`. Do not force extras. Wire one kernel candidate via `/ark-runtime`; one order-plane candidate via `/ark-order`. Do not invent `/ark-run`.
101
101
 
@@ -79,7 +79,7 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
79
79
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
80
80
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
81
81
  4. Editing `arkrules/*` or applying structure fixes is **`/ark-adopt`** / **`/ark-autopilot`** (never invent `mechanical-safe`).
82
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
82
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
83
83
  6. Extras silent when off. Doctor `arkRun` / `arkOrder` is `notAScore`. Do not force extras. Wire one kernel candidate via `/ark-runtime`; one order-plane candidate via `/ark-order`. Do not invent `/ark-run`.
84
84
 
85
85
 
@@ -87,7 +87,9 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
87
87
  - HTML/plain tour: section **Layers** and section **Rules under contract (ArkRules)** —
88
88
  when `arkRules` is active the showcase lists **per-layer counts**, **structure sensors**
89
89
  (id / sensor / mode), **uncovered** invariants (call them out), and a **covered sample**.
90
- Inactive map stays a short opt-in note. Counts are never a score.
90
+ Compact doctor names ArkRules only when the map is on; absence stays silent.
91
+ Empty `invariants[]` on a populated Domain is residual (`INVARIANT_CATALOG_EMPTY`), not “all covered”.
92
+ Inactive HTML map stays a short opt-in note. Counts are never a score.
91
93
  - Spoken tour: name 2–4 real invariant IDs and one structure sensor from this repo’s
92
94
  `arkrules/*` (open the files — do not invent). Residual candidates → `--rules-inventory`.
93
95
  - **Teach the product model (required when arkRules is active):**