arkgate 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ark-explore
3
- description: Decision-grade architecture recon — sensor + tree + field path + coupling evidence. Rank residual that changes action; optional dual-plan seed (not multi-week roadmaps). CLI is a sensor; you read the tree. No gate bypass.
3
+ description: Decision-grade architecture recon — sensor + tree + field path + coupling + design-correct residual. Dual-plan seed for spaghetti/pattern debt (never multi-week roadmaps). CLI is a sensor; you read the tree. No gate bypass.
4
4
  ---
5
5
 
6
6
  # /ark-explore — Recon the real project
@@ -11,56 +11,73 @@ install hooks, examples/starters, and coupling evidence. Output is **decision-gr
11
11
  ranked residual that changes the next command — **not** a celebration of ENFORCE and
12
12
  **not** a paraphrase of README/ROADMAP.
13
13
 
14
- Use alone when the user wants a map / options / “what should we do next?”.
15
- `/ark-autopilot`, `/ark-coverage`, and `/ark-adopt` embed a lighter version of this pass.
14
+ ## When / not when
15
+
16
+ | Use `/ark-explore` when… | Do **not** use it when… |
17
+ |--------------------------|-------------------------|
18
+ | Map / “what next?” / residual after ENFORCE | User wants edits applied → `/ark-autopilot` or `/ark-fix` |
19
+ | Spaghetti brownfield: patterns concurrent, design-weak under green check | Only “governed% + gates installed?” numbers → `/ark-coverage` |
20
+ | Dual-plan **seed** (A remediation + B pattern bets) without applying | One design trade-off between 2–3 options already mapped → `/ark-think` |
21
+ | Path-correct vs design-correct honesty | Plain-language tour / HTML report → `/ark-explain` |
22
+
23
+ `/ark-autopilot`, `/ark-adopt`, and `/ark-coverage` embed a **lighter** version of this pass.
24
+ **You** are the full recon + pattern-planning skill.
16
25
 
17
26
  ## Related onboarding
18
27
 
19
28
  - **Greenfield / thin tree:** `/ark-architect` or `ark-check --recommend` / `ark start`.
20
- - **Brownfield:** `/ark-adopt` after the map (or hand off from explore STOP paths).
29
+ - **Brownfield action (write contract/baseline):** `/ark-adopt` after the map.
30
+ - **Execute dual plan:** `/ark-autopilot` (explore seeds; autopilot applies A, proposes B).
21
31
  - **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
22
- - **Execute dual plan + apply:** `/ark-autopilot` (explore is recon / seed, not the loop).
23
32
 
24
33
  ## Dual engine (mandatory)
25
34
 
26
35
  | Engine | Role | Never confuse with |
27
36
  |--------|------|--------------------|
28
37
  | **Deterministic** | Contract truth: layers, rules, violations, `mechanical-safe` kinds, exit codes | Product vision or “good enough” |
29
- | **Exploratory** | Your judgment from **reading this tree**: product surface, field path, hotspots, false greens / false promises, design patterns lived | Only paraphrasing CLI JSON or docs |
38
+ | **Exploratory** | Judgment from **reading this tree**: product surface, field path, hotspots, false greens, **lived design patterns**, spaghetti residual | Only paraphrasing CLI JSON or docs |
30
39
 
31
40
  **Incomplete:** doctor/coverage dump with no file paths you opened; or a long map that
32
- only restates README; or a multi-week roadmap when the user only asked for a map.
41
+ only restates README; or a multi-week roadmap when the user only asked for a map;
42
+ or “healthy” because plan A is empty while design-weak smells remain unlisted.
33
43
  **Complete:** dry headline + field evidence + ranked bets with **así te lo re-soluciono**
34
44
  (real paths, concrete next step, **success signal**) + honest handoff when residual is
35
45
  *not* layer debt.
36
46
 
37
47
  **ENFORCE / 100% governed / empty plan is baseline, not a finding.** Lead with residual
38
48
  that still matters (dogfood gaps, soft starters, identity drift, **semantic false-green**,
39
- coupling that blocks evolution). If residual is truly none, say so in one line and hand
40
- off `stop`.
49
+ **design-weak under ENFORCE**, coupling that blocks evolution). If residual is truly none,
50
+ say so in one line and hand off `stop`.
41
51
 
42
- ## Output mode (pick one — do not invent a third)
52
+ ## Output mode (pick one — do not invent a fourth)
43
53
 
44
54
  | Mode | When | Deliverable |
45
55
  |------|------|-------------|
46
56
  | **Recon (default)** | map / residual / “what next?” / bare `/ark-explore` | Headline → map → ranked table → **Top 3** → residue → Completion |
47
- | **Dual-plan seed** | user asks for a **plan**, mejora, roadmap, o “Ark + patrón de diseño” | Same recon **plus** a short **§ Dual-plan seed** (below). **Cap 3–5 B bets.** |
57
+ | **Dual-plan seed** | user asks for a **plan**, mejora, roadmap, “Ark + patrón”, **or** spaghetti signals fire (§G) | Same recon **plus** **§ Dual-plan seed** (A + B). **Cap 3–5 B bets.** |
58
+ | **Shape-focus** | plan A already empty / ENFORCE, user wants **pattern** depth only | Abbreviated map + **mandatory** concurrent-patterns table + B bets only (A = “goal.met / empty”) |
59
+
60
+ **Auto-upgrade:** if §G spaghetti signals fire, you **must** use dual-plan seed or shape-focus
61
+ — never end on recon-only with “layers are clean.”
48
62
 
49
- **Forbidden in either mode:**
63
+ **Forbidden in every mode:**
50
64
  - A 6-phase / multi-week implementation roadmap as the default explore product.
51
65
  - Phases with week estimates, long PR stacks, or vanity “Domain ≥ N files” as done criteria.
52
66
  - Auto-applying anything (explore does not edit the contract or product code unless the user
53
67
  separately asks to execute a bet).
54
68
 
55
- **Dual-plan seed shape (mode 2 only):**
69
+ **Dual-plan seed shape (mode dual-plan seed | shape-focus):**
56
70
 
57
71
  | Section | Content |
58
72
  |---------|---------|
59
73
  | **A. Remediation** | From `--plan` — usually empty when ENFORCE; one line if so |
60
- | **B. Pattern / evolution** | **3–5** bets max from the ranked table; each: evidence · así te lo re-soluciono · **success signal** · next skill · **kill-switch** if proposing a new layer/big move |
74
+ | **B. Pattern / evolution** | **3–5** bets max; each: evidence · así te lo re-soluciono · **success signal** · next skill · **pilot** · **kill-switch** if new layer/big move |
75
+ | **Phase ladder** | Name which of Align / Stabilize / **Shape** the repo is in (§G) |
61
76
 
62
- Long multi-PR execution plans belong to **`/ark-autopilot`** (or a human-owned doc after
63
- the seed), not to explore by default.
77
+ Long multi-PR execution belongs to **`/ark-autopilot`**. If residual spans sessions/PRs,
78
+ optionally point the user at a durable Shape plan (e.g. `docs/plans/shape-<pilot>/`) seeded
79
+ from patternBets + extraction cards — **optional**, not a gate requirement
80
+ (see `docs/brownfield-adoption.md` §6).
64
81
 
65
82
  ## Subagent fan-out (optional, host-dependent)
66
83
 
@@ -79,9 +96,7 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
79
96
  4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
80
97
  5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
81
98
 
82
- Useful split when present: **core product tree** vs **field path** (`examples/`,
83
- `templates/`, gallery starters, eval fixtures) vs **agent install surfaces** (hooks,
84
- MCP, CI templates).
99
+ Useful split: **core product tree** | **field path** (`examples/`, starters) | **agent install surfaces** (hooks vs templates).
85
100
 
86
101
  ## Anti-wrapper rule
87
102
 
@@ -90,18 +105,19 @@ MCP, CI templates).
90
105
  - Echoing README / ROADMAP / marketing as if it were recon.
91
106
  - Padding the ranked table with “architecture is clean” rows when the sensor already said that.
92
107
  - Ranking debt by **LOC alone** without fan-in, exports, or call-site evidence.
93
- - **Vanity success metrics** as bet done criteria (e.g. “Domain ≥ 20 files”, “add a layer
94
- because the diagram is prettier”) without multi-surface proof or a kill-switch.
108
+ - **Vanity success metrics** as bet done criteria (e.g. “Domain ≥ 20 files”) without multi-surface proof or a kill-switch.
95
109
  - Multi-week roadmaps when mode is recon-only.
110
+ - Claiming “nothing to do” because plan A is empty while §G design smells remain.
96
111
 
97
112
  **Required:**
98
113
  1. Sensor: `--coverage --json`, `--doctor`, optional `--plan --json` / normal check.
99
114
  2. **Product + code pass** — min **12 source files** across **≥4 directories** that matter for *this* product (apps, packages, features, domain, adapters, API routes, CLIs).
100
115
  3. **Field path** when scaffolds exist (see §E); for pure apps, **internal field path** (see §E).
101
116
  4. **Coupling evidence** beyond “large file” (see §C).
102
- 5. **Path-correct vs design-correct** pass (see §B).
103
- 6. Ranked rows that **change a decision**; each bet has a **success signal** (not a file count).
104
- 7. Hard lines: never weaken the contract; never invent mechanical-safe kinds; never claim ENFORCE from type-only cleanup while false-green doctor ids are active.
117
+ 5. **Path-correct vs design-correct** pass (see §B) — always on brownfield or when plan is empty.
118
+ 6. **§G spaghetti / design-depth** when signals fire (or always on brownfield).
119
+ 7. Ranked rows that **change a decision**; each bet has a **success signal** (not a file count).
120
+ 8. Hard lines: never weaken the contract; never invent mechanical-safe kinds; never claim ENFORCE from type-only cleanup while false-green doctor ids are active.
105
121
 
106
122
  ## Reconnaissance pass (do all that apply)
107
123
 
@@ -121,9 +137,13 @@ MCP, CI templates).
121
137
  - Layer labels that match globs but not role (gate path-correct, design wrong).
122
138
  - Framework guts vs product code (Nest modules, Next app router, generated clients).
123
139
  - **Identity risk:** which layer owns the product *wedge* vs file-count / public barrel.
124
- - **Concurrent design patterns** (short table when ≥2 styles coexist): name each pattern,
125
- one example path, quality (`canonical` / `gate-green design-weak` / `legacy`). Mark the
126
- **golden** pattern to copy. Do not only list layer file counts.
140
+ - **Concurrent design patterns** (short table when ≥2 styles coexist **or** when spaghetti signals fire):
141
+
142
+ | Pattern name | Example path | Quality |
143
+ |--------------|--------------|---------|
144
+ | … | `src/…` | `canonical` / `gate-green design-weak` / `legacy` |
145
+
146
+ Mark the **golden** pattern to copy. Do not only list layer file counts.
127
147
 
128
148
  ### C. Coupling & debt (measure, don’t guess)
129
149
  Prefer evidence over aesthetics:
@@ -136,23 +156,23 @@ Prefer evidence over aesthetics:
136
156
 
137
157
  ### D. Agent / gate reality (installed vs generated)
138
158
  - Write gate + CI + `/ark-*` skills present? Stale skills? Global vs pinned `arkgate`?
139
- - **Installed hooks vs install templates:** compare project PreToolUse / write-hook commands to what `--install-agent-gates` would emit (e.g. reject-only `--hook` vs `--hook-repair`). Doctor `writePath` / adoption gaps are leads — **verify on disk**.
159
+ - **Installed hooks vs install templates:** compare project PreToolUse / write-hook commands to what `--install-agent-gates` would emit. Doctor `writePath` / adoption gaps are leads — **verify on disk**.
140
160
  - MCP config present and pointing at a real binary? `prepare-write` / autoPatch surface vs hook mode.
141
161
  - Baseline: real debt or hiding contract smell?
142
162
  - CI: is architecture check required on the default branch path this repo actually uses?
143
- - **Origin:** is `.ark/reports/origin.json` present? (Day-zero picture; missing → note as agent-dx / adopt gap, not a layer violation.)
163
+ - **Origin:** is `.ark/reports/origin.json` present? (Day-zero picture; missing → agent-dx / adopt gap, not a layer violation.)
144
164
 
145
165
  ### E. Field path (consumer promise or internal)
146
166
  When `examples/`, `templates/`, gallery starters, eval fixtures, or docs claim “copy this and stay green”:
147
167
  1. Open **≥2** scaffolds (prefer one minimal gallery + one “deep” / runnable demo).
148
- 2. **Run** their documented check script when cheap (`npm run check`, `ark-check --strict-config`); record pass/fail — do not trust README alone.
168
+ 2. **Run** their documented check script when cheap; record pass/fail — do not trust README alone.
149
169
  3. Diff **rule strength** across archetypes (missing denies = soft false-green for consumers).
150
170
  4. Note import style vs package surface docs (`arkgate` root barrel vs preferred subpath).
151
171
  5. Flag **false promises**: demo fails under its own check, or green with a hollow contract.
152
172
 
153
173
  If the repo is a **pure app** (no examples): state **Field path: internal** and do one of:
154
174
  - Name the **norm for new code** that the residual implies (e.g. “no new `platform/db` in routes”), or
155
- - Point at one **smoke** the team could add (lint/CI allowlist, PR checklist) — do not invent a full CI system.
175
+ - Point at one **smoke** the team could add — do not invent a full CI system.
156
176
 
157
177
  ### F. Suggestive bets (not commits yet)
158
178
  For each opportunity: **impact × effort × enforceability** (can the gate hold it after?).
@@ -167,31 +187,80 @@ For each opportunity: **impact × effort × enforceability** (can the gate hold
167
187
 
168
188
  Prefer bets the user can run next (`command` / skill), not vague “improve DX”.
169
189
 
190
+ ### G. Spaghetti / design-depth ladder (non-deterministic path — mandatory when signals fire)
191
+
192
+ **Signals (any one → dual-plan seed or shape-focus):**
193
+ - Plan A empty / `goal.met` **and** you still see design-weak / concurrent patterns / god modules.
194
+ - Brownfield with mixed layouts (flat services + “hex” folders + feature dumps).
195
+ - Semantic false-green (path-correct, design-wrong).
196
+ - User words: spaghetti, monstruo, legacy, “está enforce pero horrible”, pattern, refactor shape.
197
+
198
+ **Phase ladder (name exactly one current phase):**
199
+
200
+ | Phase | Goal | Done when (falsifiable) |
201
+ |-------|------|-------------------------|
202
+ | **Align** | Contract matches reality (path-correct); no false-green freeze | Governed high; false-green closed; concentrated edge fixed via contract |
203
+ | **Stabilize** | ENFORCE + honest baseline only for real debt | 0 new edges; doctor not lying about write path/CI |
204
+ | **Shape** | One **golden** pattern + pilot cluster | Pilot smells cleared; rest is migrate-on-touch; B bets have success signals |
205
+
206
+ ENFORCE without Shape progress is **`ENFORCE · design-weak`** — say that out loud. It is **not** “healthy finished.”
207
+
208
+ **Agent-detected design smells** (list any that apply; paths required — these may predate doctor IDs):
209
+
210
+ | Smell id (label) | How you detect it in source |
211
+ |------------------|-----------------------------|
212
+ | `io-under-application` | I/O clients under Application; empty Domain/Persistence (also doctor when present) |
213
+ | `handler-in-persistence` | HTTP/route bodies under repo/db globs |
214
+ | `god-module` | High fan-in + wide export surface + mixed concerns |
215
+ | `domain-logic-in-ui` | `can*` / `calculate*` / policy constants in hooks/pages |
216
+ | `mixed-pattern-cluster` | Same feature area uses ≥2 incompatible layouts |
217
+ | `soft-contract` | Layers without denies / peerIsolation off where peers leak |
218
+ | `facade-sql-in-routes` | Routes import raw ORM/SQL while “repositories exist” elsewhere |
219
+
220
+ **Extraction card** (for each I/O / god-module B bet — judgment, never mechanical-safe).
221
+ Canonical productized template also in `docs/brownfield-adoption.md` §6:
222
+
223
+ ```text
224
+ ### Extraction card
225
+ Pilot: <one dir or feature>
226
+ Smell: <doctor designSmells[].id when present, else agent-detected id>
227
+ Move: <verbatim I/O or rule → port/adapter or Domain file>
228
+ Do not:
229
+ - rewrite queries / touch schema / migrations
230
+ - weaken ark.config.json
231
+ - auto-apply as mechanical-safe or invent new mechanical-safe kinds
232
+ - big-bang the monorepo
233
+ Success: <observable / falsifiable>
234
+ Kill-switch: <stop condition>
235
+ Next: /ark-autopilot (apply with user ok) | /ark-fix (one cluster) | /ark-contract (globs only)
236
+ ```
237
+
238
+ When doctor JSON is available, prefer smell `id`s from `designSmells` / `patternBets[].smellId`.
239
+
170
240
  ## Output format (keep tight)
171
241
 
172
- State **Mode: recon | dual-plan seed** in the headline or first line.
242
+ State **Mode: recon | dual-plan seed | shape-focus** and **Phase: Align | Stabilize | Shape** in the first lines.
173
243
 
174
- 1. **Headline** — product in one sentence + honesty line (mode, governed%, false-green / semantic false-green / false-promise risk). ENFORCE is context, not the story.
175
- 2. **Map** — one short table or bullet map: entry points, major dirs, shape name (or “no honest shape yet”). One screen max. Include **patterns concurrent** table when relevant (§B).
176
- 3. **What I opened** — paths + sensors that prove the pass (include field/hook/origin paths when used).
177
- 4. **Ranked table** — **only rows that change a decision**. Prefer **3–6** hard rows; drop filler.
244
+ 1. **Headline** — product one sentence + honesty (mode, governed%, false-green / semantic false-green / **ENFORCE·design-weak** / false-promise risk). ENFORCE is context, not the story.
245
+ 2. **Map** — entry points, major dirs, shape name (or “no honest shape yet”). One screen. **Patterns concurrent** table when §B/§G requires it.
246
+ 3. **What I opened** — paths + sensors (include field/hook/origin when used).
247
+ 4. **Ranked table** — **only rows that change a decision**. Prefer **3–6** hard rows.
178
248
 
179
249
  | # | Kind | Finding | Evidence (path) | Así te lo re-soluciono | Success signal | Next skill / command |
180
250
 
181
- Kinds: `risk` | `false-green` | `debt` | `opportunity` | `shape` | `manifiesto` | `agent-dx`
251
+ Kinds: `risk` | `false-green` | `debt` | `opportunity` | `shape` | `manifiesto` | `agent-dx` | `design-weak`
182
252
 
183
253
  **Así te lo re-soluciono** must be concrete: files to touch, command to run.
184
- **Success signal** must be falsifiable (see §F). If proposing a new layer / wall: add kill-switch in the así-te-lo cell or a footnote.
254
+ **Success signal** must be falsifiable (see §F).
185
255
 
186
- 5. **Field path summary** (scaffolds and/or internal norm).
187
- 6. **Top 3 bets** — if the user says “go”, ordered execution. First bet = highest leverage residual, even when plan is empty (agent-dx / field honesty / design-correct — not “run loop on zero steps”).
256
+ 5. **Field path summary**.
257
+ 6. **Top 3 bets** — first bet = highest leverage residual, even when plan A is empty (design-correct / agent-dx / field honesty — **not** “run loop on zero steps”).
188
258
  On false-green dominant: **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`.
189
259
  On concentrated edge dominant: **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).
190
- 7. **Dual-plan seed** — **only in mode 2**; A + B with cap 3–5 B rows; no multi-week phase chart.
191
- 8. **Deterministic residue** — compact: plan steps, violations, doctor top action. Point to
192
- `/ark-loop` / `/ark-fix` **only when steps exist**; never pretend loop is the architecture story when goal is already met.
260
+ 7. **Dual-plan seed** — required in dual-plan seed / shape-focus (and when §G auto-upgrades); A + B cap 3–5; extraction cards for I/O bets.
261
+ 8. **Deterministic residue** — plan steps, violations, doctor top action. Point to `/ark-loop` / `/ark-fix` **only when A steps exist**; never pretend loop is the architecture story when goal is already met.
193
262
 
194
- Optional when useful: **Diff vs naive sensor-only read** (one short list: what reading the tree changed).
263
+ Optional: **Diff vs naive sensor-only read** (what reading the tree changed).
195
264
 
196
265
  ## Done criteria
197
266
 
@@ -199,10 +268,11 @@ Optional when useful: **Diff vs naive sensor-only read** (one short list: what r
199
268
  - Field path: scaffolds run/opened **or** pure-app internal norm stated.
200
269
  - At least **3 decision-grade** rows (not “fix violation X” and not “layers are clean”).
201
270
  - Coupling claims backed by fan-in / exports / importers (or clearly marked as LOC-only hint).
202
- - Path vs design called out when concurrent patterns or semantic false-green exist.
203
- - Every Top-3 / B bet has a **success signal**; new-layer bets have a **kill-switch**.
271
+ - Path vs design called out when concurrent patterns, semantic false-green, or §G signals exist.
272
+ - When §G fires: phase named, design smells listed with paths, dual-plan B or shape-focus B present.
273
+ - Every Top-3 / B bet has a **success signal**; new-layer bets have a **kill-switch** + pilot.
204
274
  - Mode respected: no multi-week roadmap in recon mode; dual-plan seed capped at 3–5 B bets.
205
- - Clear handoff: `/ark-adopt` | `/ark-contract` | `/ark-autopilot` | `/ark-loop` | `/ark-fix` | CLI command | `stop`.
275
+ - Clear handoff: `/ark-adopt` | `/ark-contract` | `/ark-autopilot` | `/ark-loop` | `/ark-fix` | CLI | `stop`.
206
276
  - No gate weakening; no false ENFORCE claim; no README echo as primary content.
207
277
 
208
278
  ## Completion contract (skill incomplete if missing)
@@ -9,6 +9,28 @@ You fix violations Ark reports. Prefer structural fixes over silencing the gate.
9
9
  **Read the surrounding product code** (callers, package role, feature ownership) — not only
10
10
  the two files on the violation edge.
11
11
 
12
+ ## When / not when
13
+
14
+ | Use `/ark-fix` when… | Do **not** use it when… |
15
+ |----------------------|-------------------------|
16
+ | One change / small cluster just failed the gate | Bulk residual / many edges → `/ark-loop` or `/ark-autopilot` |
17
+ | Need a structural fix (port, move, intent rename) | Map residual / pattern Shape plan → `/ark-explore` |
18
+ | Judgment design for a known violation | Contract wrong / false-green → STOP to `/ark-contract` / `/ark-adopt` |
19
+
20
+ When the fix is really a **Shape** extraction (I/O out of routes, god module split), write an
21
+ **extraction card** before editing — same template as [brownfield-adoption.md](../../docs/brownfield-adoption.md)
22
+ §6 and explore §G. Fixed fields (never mechanical-safe, never silent B apply):
23
+
24
+ ```text
25
+ ### Extraction card
26
+ Pilot: <one directory or feature path>
27
+ Smell: <doctor designSmells id if present>
28
+ Move: <verbatim relocate / split>
29
+ Do not: rewrite queries; weaken ark.config; invent mechanical-safe kinds; big-bang
30
+ Success: <falsifiable>
31
+ Kill-switch: <stop condition>
32
+ Next: re-run ark-check; shrink baseline if applicable
33
+ ```
12
34
 
13
35
  ## Dual engine (mandatory)
14
36