arkgate 2.13.0 → 3.0.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 (85) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +53 -36
  3. package/bin/ark-check.mjs +72 -6
  4. package/bin/ark-mcp.mjs +108 -1
  5. package/bin/ark-shared.mjs +204 -149
  6. package/bin/ark.mjs +90 -25
  7. package/bin/lib/adapter-contract.mjs +93 -0
  8. package/bin/lib/agent-gates.mjs +1 -0
  9. package/bin/lib/analysis-engine.mjs +1171 -0
  10. package/bin/lib/architecture-scan.mjs +84 -135
  11. package/bin/lib/ci-and-commands.mjs +51 -15
  12. package/bin/lib/config-warnings.mjs +7 -205
  13. package/bin/lib/design-smells.mjs +434 -0
  14. package/bin/lib/doctor-plan.mjs +149 -16
  15. package/bin/lib/field-install.mjs +67 -10
  16. package/bin/lib/gate-files.mjs +42 -3
  17. package/bin/lib/graph-cycles.mjs +4 -54
  18. package/bin/lib/hook-templates.mjs +33 -1
  19. package/bin/lib/host-support-matrix.mjs +7 -1
  20. package/bin/lib/install-migrate.mjs +54 -16
  21. package/bin/lib/presets.mjs +42 -2
  22. package/bin/lib/safety-diagnostics.mjs +18 -17
  23. package/bin/lib/scan-files.mjs +12 -1
  24. package/bin/lib/skill-install.mjs +8 -1
  25. package/bin/lib/source-policy.mjs +36 -0
  26. package/bin/lib/start-preview.mjs +271 -0
  27. package/bin/lib/ts-resolve.mjs +11 -2
  28. package/bin/lib/write-path-capabilities.mjs +4 -0
  29. package/compat/nestjs.cjs +2 -0
  30. package/compat/nestjs.d.ts +2 -0
  31. package/compat/nestjs.js +1 -0
  32. package/compat/runtime.cjs +2 -0
  33. package/compat/runtime.d.ts +2 -0
  34. package/compat/runtime.js +1 -0
  35. package/dist/configContract-BxSIwVRo.d.cts +259 -0
  36. package/dist/configContract-BxSIwVRo.d.ts +259 -0
  37. package/dist/eslint/index.cjs +125 -48
  38. package/dist/eslint/index.d.cts +7 -1
  39. package/dist/eslint/index.d.ts +7 -1
  40. package/dist/eslint/index.js +125 -48
  41. package/dist/index.cjs +1248 -3302
  42. package/dist/index.d.cts +359 -483
  43. package/dist/index.d.ts +359 -483
  44. package/dist/index.js +1231 -3248
  45. package/docs/agent-guide.md +34 -16
  46. package/docs/ai-gates.md +30 -7
  47. package/docs/brownfield-adoption.md +52 -1
  48. package/docs/migrate-from-ark-runtime-kernel.md +2 -3
  49. package/docs/package-surface.md +10 -13
  50. package/docs/production-hardening.md +17 -4
  51. package/docs/typescript-support.md +27 -0
  52. package/package.json +33 -11
  53. package/schemas/ark.analysis-result.schema.json +91 -0
  54. package/server.json +2 -2
  55. package/templates/skills/ark-adopt.md +26 -3
  56. package/templates/skills/ark-architect.md +10 -2
  57. package/templates/skills/ark-autopilot.md +37 -20
  58. package/templates/skills/ark-contract.md +7 -0
  59. package/templates/skills/ark-coverage.md +44 -45
  60. package/templates/skills/ark-explain.md +8 -0
  61. package/templates/skills/ark-explore.md +117 -47
  62. package/templates/skills/ark-fix.md +22 -0
  63. package/templates/skills/ark-loop.md +15 -1
  64. package/templates/skills/ark-place.md +7 -0
  65. package/templates/skills/ark-think.md +24 -20
  66. package/dist/configContract-iBLxx5Tz.d.cts +0 -53
  67. package/dist/configContract-iBLxx5Tz.d.ts +0 -53
  68. package/dist/eslint/index.cjs.map +0 -1
  69. package/dist/eslint/index.js.map +0 -1
  70. package/dist/index.cjs.map +0 -1
  71. package/dist/index.js.map +0 -1
  72. package/dist/nestjs/index.cjs +0 -2606
  73. package/dist/nestjs/index.cjs.map +0 -1
  74. package/dist/nestjs/index.d.cts +0 -23
  75. package/dist/nestjs/index.d.ts +0 -23
  76. package/dist/nestjs/index.js +0 -2582
  77. package/dist/nestjs/index.js.map +0 -1
  78. package/dist/runtime/index.cjs +0 -4014
  79. package/dist/runtime/index.cjs.map +0 -1
  80. package/dist/runtime/index.d.cts +0 -3
  81. package/dist/runtime/index.d.ts +0 -3
  82. package/dist/runtime/index.js +0 -3925
  83. package/dist/runtime/index.js.map +0 -1
  84. package/dist/types-BxBwnBpC.d.cts +0 -1041
  85. package/dist/types-Wcs_l1_J.d.ts +0 -1041
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ark-adopt
3
- description: Brownfield onboarding — exploratory match of contract to real product code, classify ungoverned dirs, mine business rules into the manifest, freeze only real debt. Deep source analysis required.
3
+ description: Brownfield onboarding — match contract to real product code, classify ungoverned dirs, mine business rules, freeze only real debt, seed Shape dual-plan B for spaghetti residual. Deep source analysis required.
4
4
  ---
5
5
 
6
6
  # /ark-adopt — Bring Ark into an existing codebase
@@ -8,6 +8,18 @@ description: Brownfield onboarding — exploratory match of contract to real pro
8
8
  Goal: contract reflects **product reality**, most code governed, only genuine debt frozen
9
9
  with a burn-down. A green check over a wrong contract is a **false green**.
10
10
 
11
+ **Adopt is Align + Stabilize, then seed Shape.** Freezing debt without a pattern plan leaves
12
+ spaghetti “ENFORCE · design-weak”. Always end with dual-plan **B** seeds (or handoff explore)
13
+ when design smells remain after the contract is honest.
14
+
15
+ ## When / not when
16
+
17
+ | Use `/ark-adopt` when… | Do **not** use it when… |
18
+ |------------------------|-------------------------|
19
+ | Existing messy repo; contract ≠ folders | Empty greenfield shape → `/ark-architect` |
20
+ | False-green / concentrated edge needs contract truth | Map-only without writing config/baseline → `/ark-explore` |
21
+ | Mine loose business rules into Domain / intents | Single violation fix → `/ark-fix` |
22
+ | Freeze **real** debt after contract is honest | Grind plan A only → `/ark-loop`; full apply loop → `/ark-autopilot` |
11
23
 
12
24
  ## Dual engine (mandatory)
13
25
 
@@ -78,22 +90,33 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
78
90
  - Deliver section **“Así te lo re-soluciono en el manifiesto”** with before/after contract snippets.
79
91
  5. **Freeze only real debt** — `--update-baseline` (zero debt → **no empty baseline file** left behind).
80
92
  6. **Gates + skills** — `--install-agent-gates` (CI monorepo-aware when `frontend/package.json` exists).
81
- 7. **Ratchet + opportunity plan** ranked residual edges + **explore-style bets** (what to improve next week).
93
+ 7. **Ratchet + Shape seed (mandatory exploratory close)** after freeze/gates:
94
+ - Name phase: **Align** (contract honesty) → **Stabilize** (baseline real) → **Shape** (golden pattern).
95
+ - If plan A is empty but the tree still shows concurrent patterns, god modules, facade SQL,
96
+ domain logic in UI, or semantic false-green: emit **dual-plan B** (3–5 bets) with pilot,
97
+ success signal, kill-switch, and extraction cards for I/O moves — same bar as `/ark-explore` §G.
98
+ - Do **not** claim “adopt complete / healthy” solely because the check is green.
99
+ - Prefer handoff `/ark-autopilot` for B execution with user ok, or `/ark-explore` shape-focus
100
+ if the user only wanted a plan.
82
101
 
83
102
  ## Operating modes
84
103
 
85
104
  Explain modes as **detected stages** (Setup / Align / Guard), not user settings.
105
+ **Guard on the contract ≠ Shape done.** Say `ENFORCE · design-weak` when B residual remains.
86
106
 
87
107
  ## Verify
88
108
 
89
109
  `ark-check --root . --config ark.config.json --strict-config` (+ baseline only if non-empty file retained).
90
- Report: governed% before/after, files written, frozen count, false positives avoided, manifest/intent proposals applied or deferred, **top opportunities still open**.
110
+ Report: governed% before/after, files written, frozen count, false positives avoided, manifest/intent
111
+ proposals applied or deferred, **phase**, **top Shape / design-weak opportunities still open**
112
+ (with success signals).
91
113
 
92
114
  ## Never
93
115
 
94
116
  - Freeze false positives to get green.
95
117
  - Force runtime kernel over existing Nest/DI.
96
118
  - Claim Enforce while governed% is low, cores empty with I/O in Application, or core bags ungoverned.
119
+ - End adopt with only “baseline written” when design-weak residual is visible in files you opened.
97
120
 
98
121
  ## Completion contract (skill incomplete if missing)
99
122
 
@@ -5,6 +5,13 @@ description: Choose the application shape, adopt phase-1 layers, scaffold direct
5
5
 
6
6
  # /ark-architect — Choose your application shape and adopt Ark
7
7
 
8
+ ## When / not when
9
+
10
+ | Use `/ark-architect` when… | Do **not** use it when… |
11
+ |----------------------------|-------------------------|
12
+ | Greenfield / thin tree; pick shape + phase-1 layers | Existing spaghetti brownfield → `/ark-adopt` (+ `/ark-explore` first if map missing) |
13
+ | Enthusiast before heavy codegen | Enforcement residual on mature tree → `/ark-autopilot` |
14
+
8
15
  The user is building something new or early in Ark adoption. They may not know
9
16
  layered architecture jargon. Your job: translate **what they want to build**
10
17
  (application shape, not framework name) into an Ark preset, a phase-1 layer plan,
@@ -44,8 +51,9 @@ the same files or weaken the gate.
44
51
 
45
52
  1. **Detect the shape** — call MCP tool **`ark_recommend`** (or run
46
53
  `ark-check --recommend --json`). Read `archetype`, `preset`, `confidence`,
47
- `adoptInOrder.phase1`, `analogy`, and `why`. Ask at most **two** questions only
48
- if `confidence < 0.5`:
54
+ `adoptInOrder.phase1`, `analogy`, `why`, `evidence`, and `requiresConfirmation`.
55
+ Ask at most **two** questions only if `requiresConfirmation` is true (or for compatibility
56
+ with older ArkGate output, `confidence < 0.5`):
49
57
  - "Will this app save data between sessions?"
50
58
  - "Is this one app or several in one repository?"
51
59
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ark-autopilot
3
- description: End-to-end architecture co-pilot — decision-grade explore first, dual plan (remediation + pattern improvements), mechanical-safe fixes, judgment design. CLI is a sensor; you read and remediate files.
3
+ description: End-to-end co-pilot — explore first, dual plan A remediation + B pattern/Shape bets, mechanical-safe fixes, judgment design. Empty plan A is not healthy if design-weak. CLI is a sensor; you read and remediate files.
4
4
  ---
5
5
 
6
6
  # /ark-autopilot — Get to a sound architecture, end to end
@@ -11,15 +11,23 @@ execute **judgment** fixes you design from reading source (still validate with a
11
11
  never weaken the gate).
12
12
 
13
13
  **Not a plan grinder.** Empty `--plan` does **not** mean “architecture is healthy” without
14
- the explore pass and dual-plan section B (pattern bets).
14
+ the explore pass and dual-plan section B (pattern / Shape bets).
15
15
 
16
+ ## When / not when
17
+
18
+ | Use `/ark-autopilot` when… | Do **not** use it when… |
19
+ |----------------------------|-------------------------|
20
+ | “Make architecture sound” end-to-end | Map only, no apply → `/ark-explore` |
21
+ | Brownfield or greenfield with apply | Only fitness numbers → `/ark-coverage` |
22
+ | User wants A + B planned and A executed | Single edge fix → `/ark-fix`; plan A only → `/ark-loop` |
23
+ | Spaghetti under ENFORCE: Shape work with user ok on B | Contract false-green first → `/ark-adopt` / `/ark-contract` STOP paths |
16
24
 
17
25
  ## Related onboarding
18
26
 
19
27
  - **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
20
28
  - **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
21
- - **Deep map only:** `/ark-explore` — full recon report without applying fixes.
22
- - **Adoption metrics only:** `/ark-coverage` — governed% + capability gaps (feeds dual plan B).
29
+ - **Deep map only:** `/ark-explore` — full recon / dual-plan seed without applying.
30
+ - **Adoption fitness only:** `/ark-coverage` — governed% + capability gaps (not pattern dual-plan).
23
31
  - **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
24
32
 
25
33
  ## Dual engine (mandatory)
@@ -64,30 +72,38 @@ Useful first wave: **core product tree** | **field path** (examples/starters) |
64
72
 
65
73
  Do this **before** grinding plan A — plan lists *violations*, not *product reality*.
66
74
  Use the **`/ark-explore` decision-grade bar** (compressed into the autopilot report, not optional fluff).
67
-
68
- 1. **Headline** — product one-liner + honesty (mode, governed%, false-green / false-promise risk).
69
- 2. **Map** — entry points, lived layout vs globs (one screen).
70
- 3. **Field path** — if `examples/` / gallery / starter docs exist: open ≥2, **run** their check when cheap; flag soft-green or broken demos. Else `Field path: n/a`.
71
- 4. **Agent/gate reality** — installed hooks vs install templates (e.g. `--hook` vs `--hook-repair`); MCP; CI gate present.
72
- 5. **Coupling** — fan-in / exports / importers for hotspots (LOC alone is a hint).
73
- 6. **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:
75
+ Include explore **§G** when spaghetti / design-weak signals fire.
76
+
77
+ 1. **Headline** — product one-liner + honesty (mode, governed%, false-green / false-promise /
78
+ **ENFORCE·design-weak** risk).
79
+ 2. **Map** — entry points, lived layout vs globs (one screen). **Concurrent patterns** table when ≥2 styles.
80
+ 3. **Phase ladder** — name **Align | Stabilize | Shape** (explore §G).
81
+ 4. **Field path** — if `examples/` / gallery / starter docs exist: open ≥2, **run** their check when cheap; flag soft-green or broken demos. Else `Field path: n/a` + internal norm.
82
+ 5. **Agent/gate reality** — installed hooks vs install templates (e.g. `--hook` vs `--hook-repair`); MCP; CI gate present.
83
+ 6. **Coupling** — fan-in / exports / importers for hotspots (LOC alone is a hint).
84
+ 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:
74
85
  **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`.
75
- 7. **Seed dual plan B** — 2–5 pattern / evolution bets ranked (impact × effort × enforceability).
86
+ 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).
76
87
 
77
88
  Min bar: **≥12 source files** across **≥4 meaningful directories** (not only files in `steps[]`).
78
- Standalone long report: `/ark-explore`. Adoption numbers deep-dive: `/ark-coverage`.
89
+ Standalone long report: `/ark-explore`. Adoption fitness only: `/ark-coverage`.
79
90
 
80
91
  ## Dual plan (always emit)
81
92
 
82
93
  | Section | Source | Question | Auto-apply? |
83
94
  |---------|--------|----------|-------------|
84
- | **A. Remediation** | `--plan --json` + opened step files | What must change so the gate is honest? | Only `mechanical-safe` by default |
85
- | **B. Pattern / evolution** | Explore + coverage/doctor | What existing patterns should improve even if A is empty? | **Never** as mechanical-safe |
95
+ | **A. Remediation** | `--plan --json` + opened step files | What must change so the **gate** is honest? | Only `mechanical-safe` by default |
96
+ | **B. Pattern / Shape** | Explore §B/§G (not coverage alone) | What **design** must improve even if A is empty? | **Never** as mechanical-safe |
86
97
 
87
98
  **Section A** — group by edge; treat `peerIsolation` / cross-slice as **judgment**.
88
- **Section B** examples: peerIsolation, move rules out of UI, strengthen starter/preset rules, write-path repair, split god orchestration modules, Domain placement / intents, import surface (`/runtime` vs root). Cap **3–5** B rows. Each row: evidence path + **así te lo re-soluciono** + next skill/command + success signal.
99
+ **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).
89
100
 
90
- B does **not** count as “architecture healthy finished.” Report B as `proposed | deferred | applied-with-user-ok`.
101
+ B does **not** count as “architecture healthy finished.” Report B as `proposed | deferred | applied-with-user-ok`.
102
+ When A is empty and B is non-empty: status is **`goal.met on edges · Shape residual open`** — never “done” without listing B.
103
+ Prefer CLI `patternBets[]` / `designSmells[]` when present; apply B only with explicit user ok using
104
+ **extraction cards** (`docs/brownfield-adoption.md` §6) — never mechanical-safe, never silent.
105
+ If B will take multiple PRs, offer (do not require) persisting a short Shape plan under the
106
+ repo so the next agent session continues the same pilot — still never auto-apply B.
91
107
 
92
108
  ## Origin snapshot (day-zero picture)
93
109
 
@@ -136,12 +152,13 @@ B does **not** count as “architecture healthy finished.” Report B as `propos
136
152
 
137
153
  ## Done criteria
138
154
 
139
- - Explore pass completed (decision-grade map + paths + field path or n/a + B seeds).
140
- - Dual plan emitted (A and/or B; if both empty, one-line justification).
155
+ - Explore pass completed (decision-grade map + paths + field path or n/a + phase + B seeds).
156
+ - Dual plan emitted (A and/or B; if both empty, one-line justification with evidence no design-weak smells).
141
157
  - Origin present under `.ark/reports/origin.*` (frozen this run or earlier).
142
158
  - Every applied A step validated by real `ark-check`.
143
159
  - Final plan `goal.met` true **or** remaining A steps listed with file-level proposals.
144
- - Open **B opportunities** listed; report HTML paths cited.
160
+ - Open **B / Shape opportunities** listed with success signals; report HTML paths cited when used.
161
+ - If A empty and design-weak present: B listed — **Incomplete?** must not claim full healthy stop.
145
162
 
146
163
  ## Completion contract (skill incomplete if missing)
147
164
 
@@ -5,6 +5,13 @@ description: Safely edit ark.config.json (layers, rules, forbiddenGlobals, inten
5
5
 
6
6
  # /ark-contract — Change the architecture contract (safely)
7
7
 
8
+ ## When / not when
9
+
10
+ | Use `/ark-contract` when… | Do **not** use it when… |
11
+ |---------------------------|-------------------------|
12
+ | Edit layers/rules/includes/intents with source evidence | Move product code without config change → `/ark-fix` / `/ark-loop` |
13
+ | Concentrated-edge / false-green STOP from other skills | Full map without config edit → `/ark-explore` |
14
+
8
15
  The **one sanctioned way** to change layers/rules/`intentPrefixes`/includes.
9
16
  Also used to **land mined business rules** into the executable manifest (`ark.config.json` + intent naming that `ark://manifest` exposes).
10
17
 
@@ -1,37 +1,46 @@
1
1
  ---
2
2
  name: ark-coverage
3
- description: Exploratory deep-audit of real code + Ark adoption gaps. CLI is a sensor only map the product, read source, propose concrete remediations and ranked opportunities with "así te lo re-soluciono".
3
+ description: Ark adoption fitness audit governed%, gates, baseline honesty, capability gaps. CLI is a sensor; read enough source to prove gaps. Full product recon and pattern dual-plan belong to /ark-explore.
4
4
  ---
5
5
 
6
- # /ark-coverage — Deep coverage + capability gaps
6
+ # /ark-coverage — Ark adoption fitness (not full recon)
7
7
 
8
- You audit how this repo uses ArkGate **and** what the **real product tree** needs next.
9
- Work autonomously. End with a ranked report that is both **deterministic** (numbers) and
10
- **exploratory** (source-backed suggestions).
8
+ You audit **how this repo uses ArkGate** (coverage, gates, baseline, host write path) and
9
+ what adoption gaps remain. Work autonomously. End with a ranked fitness report.
11
10
 
11
+ **This is not `/ark-explore`.** You do **not** produce a multi-pattern dual-plan or spaghetti
12
+ Shape ladder by default. If the tree is design-weak under ENFORCE, **handoff** to explore.
13
+
14
+ ## When / not when
15
+
16
+ | Use `/ark-coverage` when… | Do **not** use it when… |
17
+ |---------------------------|-------------------------|
18
+ | “How adopted is Ark?” governed%, gates, baseline, skills stale | Full product map / what-next architecture → `/ark-explore` |
19
+ | Capability gaps (CI, write path, ESLint, optional layers) | Apply fixes end-to-end → `/ark-autopilot` |
20
+ | Ranked *adoption* opportunities (install, ratchet, contract classify) | Spaghetti pattern plan / golden pattern → `/ark-explore` dual-plan seed |
21
+ | Quick honesty before a release checklist | One design trade-off → `/ark-think` |
12
22
 
13
23
  ## Dual engine (mandatory)
14
24
 
15
25
  | Engine | Deliverable |
16
26
  |--------|-------------|
17
27
  | **Deterministic** | governed%, layers, gates, baseline, doctor gaps, summary edges |
18
- | **Exploratory** | product map, clusters opened, opportunities beyond “fix violation X” |
28
+ | **Exploratory** | Enough source to prove ungoverned clusters / false-green are real (not JSON-only) |
19
29
 
20
- **Forbidden:** only `ark-check --coverage/--doctor/--json` paraphrase or gate checklists with no source evidence.
30
+ **Forbidden:** only `ark-check --coverage/--doctor/--json` paraphrase with no source evidence.
21
31
 
22
32
  **Required before you finish:**
23
33
  1. CLI sensor: `--coverage --json`, `--doctor`, normal `--json` for `summary`.
24
- 2. **Product surface** — README, workspaces, entry apps/APIs (name them).
25
- 3. **Read real source** in the top ungoverned / high-coupling clusters (minimum **10 files**
26
- across at least **4 directories** that matter for this product). Prefer domain, features,
27
- adapters, app routes not only config.
28
- 4. **“Así te lo re-soluciono”** file-level moves, contract globs, intent/manifest proposals.
29
- 5. **Suggestive section** — opportunities (shape, extract, peerIsolation, manifiesto, DX)
30
- ranked by impact × enforceability, even if the check is already green.
34
+ 2. **Product surface** — name the app/package(s) in one line (not a full recon).
35
+ 3. **Read real source** in the top ungoverned / high-risk clusters (minimum **10 files**
36
+ across at least **4 directories**). Prefer domain, features, adapters, routes — not only config.
37
+ 4. **“Así te lo re-soluciono”** for adoption gaps (globs, install, baseline, intents).
38
+ 5. If plan A is empty but you see design-weak / concurrent patterns / god modules:
39
+ list them briefly and **STOPdo not continue this skill as complete** for pattern work —
40
+ **handoff `/ark-explore` (dual-plan seed or shape-focus)**. Do not invent a second explore report here.
31
41
 
32
42
  If you did not open source files, the skill is **not complete**.
33
- Full recon-only mode: `/ark-explore`.
34
-
43
+ Full recon + pattern planning: `/ark-explore`.
35
44
 
36
45
  ## Subagent fan-out (optional, host-dependent)
37
46
 
@@ -56,25 +65,25 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
56
65
  |------|----------------|--------------------|
57
66
  | **Suggest / Setup** | Thin or new tree | “Ark will propose a starting shape — you don’t switch a mode.” |
58
67
  | **Adapt / Align** | Contract ≠ folders or open debt | “Gates don’t fully protect you yet — classify + fix plan.” |
59
- | **Enforce / Guard** | Coverage + clean edges + honest cores | “You arrived here — keep the host-appropriate write path and CI check on.” |
68
+ | **Enforce / Guard** | Coverage + clean edges + honest cores | “You arrived here for *contract* fitness design may still be weak; use explore for Shape.” |
60
69
 
61
70
  Never say “your architecture is guarded” while `goal.met` is false, governed% is low,
62
- or false-green doctor gaps are open.
71
+ or false-green doctor gaps are open. Never say “architecture is healthy finished” solely
72
+ because governed% is 100% and plan is empty.
63
73
 
64
74
  ## Related onboarding
65
75
 
66
76
  - **Greenfield:** low governed% → `/ark-architect` or `ark-check --recommend`.
67
- - **Brownfield:** `/ark-adopt` + this skill’s deep map — **not** `/ark-architect`.
68
- - **Business rules / intents loose in the tree:** also cover in **Así te lo re-soluciono**
69
- (mine `intentPrefixes` / Domain placement / kernel `defineIntent` stubs).
70
- - **Explore-only report:** `/ark-explore`.
77
+ - **Brownfield:** `/ark-adopt` for action; this skill for fitness metrics.
78
+ - **Pattern / spaghetti residual:** `/ark-explore` dual-plan seed / shape-focus.
79
+ - **Business rules loose:** note in table; mining action → `/ark-adopt` or `/ark-contract`.
71
80
 
72
- ## Checklist (sensor)
81
+ ## Checklist (sensor + light code)
73
82
 
74
- 1. Config + `ark-check --strict-config` (dead preset globs advisory; unclassified files still fail strict).
83
+ 1. Config + `ark-check --strict-config`.
75
84
  2. Baseline policy (orphan empty file? wire or delete).
76
85
  3. Host-appropriate write path + `/ark-*` skills per detected agent.
77
- 4. CI workflow + monorepo install reality (`frontend/package.json`?).
86
+ 4. CI workflow + monorepo install reality.
78
87
  5. ESLint `arkgate/eslint` if ESLint exists.
79
88
  6. Domain `forbiddenGlobals`.
80
89
  7. **Governed%** + unclassified + `suggestions` from `--coverage --json`.
@@ -82,37 +91,27 @@ or false-green doctor gaps are open.
82
91
  9. `layersWithoutRules` + empty cores with I/O under Application (false-green).
83
92
  On false-green: **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`.
84
93
  On one-edge wall: **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).
85
- 10. Runtime kernel / Nest only if deps prove it — never force-fit Next+Python.
86
-
87
- ## Deep code pass (exploratory — the model job)
88
-
89
- For each top cluster (e.g. `src/features/*`, `src/lib/*`, `apps/*/src`):
90
-
91
- - Who imports whom (App→Presentation? Domain→App? cross-feature?).
92
- - Is “core” / “lib” really application, UI, I/O, or mixed?
93
- - Loose business logic: `calculate*`, `can*`, `validate*`, policy numbers, publish/intent strings without registry.
94
- - Propose: layer home, `ark.config.json` patterns, Domain extract, intent names (`Domain.*` / `Application.*`).
95
- - **Opportunity**, not only residual debt: what would make agents safer next week?
94
+ 10. Runtime kernel / Nest only if deps prove it — never force-fit.
96
95
 
97
96
  ## Output format
98
97
 
99
- 1. **Headline honesty** — product one-liner, governed%, mode, violations, false-green risk.
100
- 2. **Code map** — clusters you read + what you found (paths).
101
- 3. **Ranked table** (mix residual gaps + opportunities)
98
+ 1. **Headline honesty** — product one-liner, governed%, mode, violations, false-green risk, **design-weak handoff?** (yes/no).
99
+ 2. **Adoption map** — clusters you read for *fitness* (paths) — keep short.
100
+ 3. **Ranked table** (adoption residual + install/capability opportunities)
102
101
 
103
- | # | Kind | Gap / opportunity | Evidence (path or CLI) | Así te lo re-soluciono (concrete) |
102
+ | # | Kind | Gap / opportunity | Evidence (path or CLI) | Así te lo re-soluciono (concrete) | Next |
104
103
 
105
- Kinds: `debt` | `false-green` | `shape` | `manifiesto` | `gates` | `opportunity`
104
+ Kinds: `debt` | `false-green` | `shape` | `manifiesto` | `gates` | `opportunity` | `design-weak`
106
105
 
107
- 4. **Manifiesto / reglas de negocio** (if any): proposed intents / Domain files / config edits.
108
- 5. Offer: “Apply top N?” / “Run /ark-adopt?” — apply only if user agrees; then re-run strict check.
106
+ 4. If any `design-weak` rows: **Handoff required** `/ark-explore` (do not expand into full dual-plan here).
107
+ 5. Offer: “Apply top adoption N?” / “Run /ark-adopt?” / “Run /ark-explore for Shape?” — apply only if user agrees.
109
108
 
110
109
  ## Done criteria
111
110
 
112
111
  - ≥10 source files read and cited; product surface named.
113
- - At least one **Así te lo re-soluciono** block with real paths.
114
- - At least **two** exploratory suggestions (not only CLI residual debt).
112
+ - At least one **Así te lo re-soluciono** block with real paths or install commands.
115
113
  - CLI numbers used as evidence, not as the whole report.
114
+ - Design residual either absent with evidence or explicitly handed to `/ark-explore`.
116
115
 
117
116
  ## Completion contract (skill incomplete if missing)
118
117
 
@@ -6,6 +6,14 @@ description: Explain this project's architecture in plain language and generate
6
6
  # /ark-explain — Understand this project's architecture
7
7
 
8
8
  The user wants to understand the architecture, a specific rule, or why the gate blocked them.
9
+
10
+ ## When / not when
11
+
12
+ | Use `/ark-explain` when… | Do **not** use it when… |
13
+ |--------------------------|-------------------------|
14
+ | Plain-language tour of layers/rules/report | Decision-grade recon / dual-plan → `/ark-explore` |
15
+ | “Why did the gate block me?” pedagogy | Apply fixes → `/ark-fix` / `/ark-autopilot` |
16
+ | Generate / walk HTML showcase report | Fitness numbers only → `/ark-coverage`; brownfield action → `/ark-adopt` |
9
17
  Your job is to **teach with this repo's real data** and leave a shareable visual artifact.
10
18
 
11
19
  ## Dual engine (mandatory)