arkgate 4.6.0 → 4.6.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +54 -1
  2. package/README.md +11 -5
  3. package/bin/ark-check-runtime.mjs +115 -128
  4. package/bin/ark-mcp-runtime.mjs +86 -48
  5. package/bin/ark.mjs +21 -78
  6. package/bin/lib/agent-projection.mjs +1 -1
  7. package/bin/lib/analysis-engine.mjs +3 -3
  8. package/bin/lib/ci-and-commands.mjs +11 -11
  9. package/bin/lib/config-contract.mjs +2 -0
  10. package/bin/lib/contract-smells.mjs +5 -5
  11. package/bin/lib/design-smells.mjs +1 -1
  12. package/bin/lib/doctor-advisories.mjs +9 -0
  13. package/bin/lib/doctor-next-actions.mjs +92 -0
  14. package/bin/lib/doctor-plan.mjs +61 -71
  15. package/bin/lib/field-install.mjs +1 -1
  16. package/bin/lib/first-run-help.mjs +221 -0
  17. package/bin/lib/html-report-advisories.mjs +20 -0
  18. package/bin/lib/improvement-compass-map.mjs +20 -20
  19. package/bin/lib/pilot-loop.mjs +1 -1
  20. package/bin/lib/post-green-path.mjs +2 -2
  21. package/bin/lib/prepare-change.mjs +9 -0
  22. package/bin/lib/product-copy.mjs +1 -1
  23. package/bin/lib/start-preview.mjs +17 -10
  24. package/bin/lib/status-command.mjs +19 -0
  25. package/bin/lib/status-manifest.mjs +23 -0
  26. package/bin/lib/team-parliament-io.mjs +338 -0
  27. package/bin/lib/team-parliament.mjs +383 -0
  28. package/bin/lib/upgrade-whats-new.mjs +16 -0
  29. package/bin/lib/violations.mjs +8 -4
  30. package/dist/{configTypes-CC0FEXoF.d.ts → configTypes-B8uIcLaG.d.ts} +5 -0
  31. package/dist/eslint/index.cjs +2 -2
  32. package/dist/eslint/index.d.ts +1 -1
  33. package/dist/eslint/index.js +2 -2
  34. package/dist/index.cjs +8 -8
  35. package/dist/index.d.ts +66 -2
  36. package/dist/index.js +8 -8
  37. package/docs/README.md +5 -5
  38. package/docs/agent-guide.md +21 -17
  39. package/docs/configuration.md +36 -2
  40. package/docs/develop.md +13 -1
  41. package/docs/enthusiast/README.md +1 -1
  42. package/docs/enthusiast/how-to-agent-gates.md +3 -3
  43. package/docs/enthusiast/how-to-pick-shape.md +2 -2
  44. package/docs/enthusiast/tutorial-first-project.md +4 -3
  45. package/docs/package-surface.md +5 -3
  46. package/docs/product-voice.md +48 -10
  47. package/docs/use.md +10 -5
  48. package/package.json +2 -2
  49. package/schemas/ark.config.schema.json +9 -0
  50. package/schemas/ark.status-manifest.schema.json +51 -0
  51. package/server.json +3 -3
  52. package/templates/agent-skills/README.md +1 -1
  53. package/templates/agent-skills/ark-adopt/SKILL.md +59 -23
  54. package/templates/agent-skills/ark-architect/SKILL.md +24 -145
  55. package/templates/agent-skills/ark-autopilot/SKILL.md +49 -32
  56. package/templates/agent-skills/ark-contract/SKILL.md +21 -105
  57. package/templates/agent-skills/ark-coverage/SKILL.md +7 -3
  58. package/templates/agent-skills/ark-explain/SKILL.md +8 -4
  59. package/templates/agent-skills/ark-explore/SKILL.md +38 -21
  60. package/templates/agent-skills/ark-fix/SKILL.md +34 -157
  61. package/templates/agent-skills/ark-loop/SKILL.md +31 -153
  62. package/templates/agent-skills/ark-place/SKILL.md +35 -14
  63. package/templates/agent-skills/ark-runtime/SKILL.md +3 -3
  64. package/templates/agent-skills/ark-think/SKILL.md +6 -2
  65. package/templates/agent-skills/ark-upgrade/SKILL.md +21 -10
  66. package/templates/skills/ark-adopt.md +59 -23
  67. package/templates/skills/ark-architect.md +24 -145
  68. package/templates/skills/ark-autopilot.md +49 -32
  69. package/templates/skills/ark-contract.md +21 -105
  70. package/templates/skills/ark-coverage.md +7 -3
  71. package/templates/skills/ark-explain.md +8 -4
  72. package/templates/skills/ark-explore.md +38 -21
  73. package/templates/skills/ark-fix.md +34 -157
  74. package/templates/skills/ark-loop.md +31 -153
  75. package/templates/skills/ark-place.md +35 -14
  76. package/templates/skills/ark-runtime.md +3 -3
  77. package/templates/skills/ark-think.md +6 -2
  78. package/templates/skills/ark-upgrade.md +21 -10
@@ -1,81 +1,41 @@
1
1
  ---
2
2
  name: ark-fix
3
- description: Resolve Ark architecture violations at the root cause — read importers and product context, design ports/adapters/moves/intent alignment. Never weaken the contract. CLI only validates.
3
+ description: Shortcut to /ark-autopilot for a small violation cluster. Deprecated as a first-class door.
4
4
  ---
5
5
 
6
- # /ark-fix — Fix architecture violations at the root
6
+ # /ark-fix — Shortcut to /ark-autopilot
7
7
 
8
- You fix violations Ark reports. Prefer structural fixes over silencing the gate.
9
- **Read the surrounding product code** (callers, package role, feature ownership) — not only
10
- the two files on the violation edge.
8
+ **Not a first-run door.** This leftover name is a shortcut. Gate violations are
9
+ **`/ark-autopilot`**. Do that job now. CLI only validates.
11
10
 
12
- ## Improvement compass (process preflight)
11
+ ## Autonomy contract
13
12
 
14
- When doctor is available, read `doctor.improvementCompass` (or the human **Improvement compass** section).
15
- Name 1–3 **residual** lenses in plain language before skill-shopping. Always `notAScore` — never invent
16
- 0–10 scores or Excellent/Good ranks.
13
+ Invoking this leftover name **is** the approval to write the fix. Open importers,
14
+ design the port/move, apply, `ark-check`. Never weaken the config. Never invent
15
+ `mechanical-safe` kinds.
17
16
 
18
- **What the user should feel next:** fewer blocked AI writes, clearer folders, safer domain — then jargon.
19
-
20
- **Anti false-done:** empty plan A + residual lenses / design-weak → **Incomplete? yes**. Green edges alone
21
- are not “architecture finished.”
22
-
23
- **AI-easy architecture:** ports over concrete I/O in domain; one concern per module; golden pattern for
24
- new files; place before write (`/ark-place` / prepare-write).
25
-
26
- **Out of scope (honest):** scalability/performance, full app-security tooling (SAST), and full resilience
27
- patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement for them.
28
-
29
- **Name residual lenses** on each cluster (SoC, DIP, coupling, …). Still no weaken-gate to clear a lens.
30
-
31
- ## Deep modules (process)
17
+ ## When / not when
32
18
 
33
- - Prefer fixes that leave a **deep module** at a named **seam** (port in the owning layer; adapter outside).
34
- - Apply the **deletion test** before extracting a layer “just so tests can mock it.”
35
- - After a port/inject fix, **test at the public interface** of the seam (match remediation `nextAction` language), not only private internals.
19
+ | Use this leftover name when… | Prefer instead |
20
+ |------------------------------|----------------|
21
+ | One change / small cluster just failed the gate | **`/ark-autopilot`** |
22
+ | Judgment design for a known violation | Session 0 / false-green → **`/ark-adopt`** |
36
23
 
37
- ## When / not when
24
+ ## Plan B one-pilot checklist (when leftover design, not a single edge)
38
25
 
39
- | Use `/ark-fix` when… | Do **not** use it when… |
40
- |----------------------|-------------------------|
41
- | One change / small cluster just failed the gate | Bulk residual / many edges → `/ark-loop` or `/ark-autopilot` |
42
- | Need a structural fix (port, move, intent rename) | Map residual / pattern Shape plan → `/ark-explore` |
43
- | Judgment design for a known violation | Contract wrong / false-green → STOP to `/ark-contract` / `/ark-adopt` |
44
-
45
- When the fix is really a **Shape** extraction (I/O out of routes, god module split), write an
46
- **extraction card** before editing — same template as `docs/brownfield-adoption.md`
47
- §6 and explore §G. Fixed fields (never mechanical-safe, never silent B apply).
48
-
49
- ### Plan B one-pilot checklist (when Shape residual, not a single edge fix)
50
-
51
- Empty plan A + `designWeak` is **not** architecture finished. One pilot only:
52
-
53
- 1. **Confirm** doctor `designFitness.designWeak` / non-empty `patternBets` (or agent-detected smell).
54
- 2. **One pilot** — prefer `pilotLoop.nextPilot`; never multi-batch concurrent Shape extractions.
55
- 3. **Extraction card** with **Kill-switch** + falsifiable Success (required).
56
- 4. **User OK** before apply — `autoApplyPlanBForbidden` / never mechanical-safe.
57
- 5. **Edit only that pilot scope** — then `ark-check` / re-doctor; residual outside pilot may remain.
58
- 6. **Stop** if kill-switch fires; do not open pilot #2 in the same batch.
59
-
60
- ```text
61
- ### Extraction card
62
- Pilot: <one directory or feature path — or pilotLoop.nextPilot.pilotTarget>
63
- Smell: <doctor designSmells id if present>
64
- Move: <verbatim relocate / split>
65
- Do not: rewrite queries; weaken ark.config; invent mechanical-safe kinds; big-bang; multi-pilot batch
66
- Success: <falsifiable — re-doctor on pilot paths>
67
- Kill-switch: <stop condition — required>
68
- Next: re-run ark-check; shrink baseline if applicable
69
- ```
26
+ Empty plan A + leftover design work is **not** architecture finished. One pilot only.
27
+ Write an **extraction card** (`docs/brownfield-adoption.md` §6) — never mechanical-safe,
28
+ never silent B apply. **Kill-switch** required. `multiPilotBatchForbidden` never
29
+ multi-pilot batch.
70
30
 
71
31
  ## Dual engine (mandatory)
72
32
 
73
33
  | Engine | Role |
74
34
  |--------|------|
75
- | **Deterministic** | Violation list, plan kinds, post-edit `ark-check` |
76
- | **Exploratory** | Why this edge exists in *this* product; better home; manifiesto if the rule is business |
77
-
35
+ | **Deterministic** | CLI / MCP / contract sensors — exit codes, plan kinds, coverage numbers, install status |
36
+ | **Exploratory** | You open **this** repo's real files and product surface before concluding |
78
37
 
38
+ The CLI is a **sensor**, never the whole job. Claiming done without the exploratory bar for this skill is **incomplete**.
79
39
 
80
40
  ## MCP workspace binding (mandatory)
81
41
 
@@ -88,89 +48,25 @@ restart/retargeting is required. `ark://manifest` never satisfies this preflight
88
48
 
89
49
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
90
50
 
91
- ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
92
-
93
- | Plane | What it protects | Where it lives | Sensors / tools |
94
- |-------|------------------|----------------|-----------------|
95
- | **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
96
- | **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
97
-
98
- **Rules for every report / answer:**
99
- 1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
100
- 2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
101
- 3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
102
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
103
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
104
-
105
-
106
- ### Fix + ArkRules
107
- - Classify each violation: `LAYER_*` / capability → **[Layer]**; `ARKRULE_*` / `INVARIANT_*` → **[ArkRules]**.
108
- - Structure sensor fixes are judgment (ports, factories, private state) — not mechanical-safe.
51
+ Label findings **`[Layer]`** vs **`[ArkRules]`**. Structure sensor fixes are judgment.
109
52
 
110
53
  ## Subagent fan-out (optional, host-dependent)
111
54
 
112
- When the user asks to go faster **or** the work naturally splits (multiple packages,
113
- feature dirs, plan clusters), you **may** dispatch **subagents**:
114
-
115
- | Host capability | Behavior |
116
- |-----------------|----------|
117
- | **Parallel subagents supported** (e.g. multi-agent / `spawn_subagent` / concurrent Agent tools) | Launch **2–N** agents in **one wave** with **disjoint path scopes**. Prefer **read-only** explore agents for mapping; at most **one writer** unless the host gives isolated worktrees. Parent merges findings, then runs `ark-check` once. |
118
- | **Not supported** (single agent only) | **Fall back to sequential** — same checklist, one cluster/step at a time. Never claim parallel work you did not run. |
119
-
120
- **Rules:**
121
- 1. Give each subagent a **tight brief**: paths in scope, sensor commands allowed, deliverable shape (paths opened + findings JSON or bullets).
122
- 2. **No shared mutable files** across parallel writers.
123
- 3. STOP handoffs and dual-engine rules still apply in every agent.
124
- 4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
125
- 5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
55
+ If the host supports **parallel subagents**, fan out read-only scouts; otherwise
56
+ **fall back to sequential**. Never weaken the gate.
126
57
 
127
58
  ## Related onboarding
128
59
 
129
- - **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
130
- - **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
131
- - **Map first:** `/ark-explore` when the violation is one of many structural smells.
132
- - **peerIsolation / cross-slice:** always **judgment** — extract to shared, events/ports, or redesign ownership. Never auto-apply cross-feature or cross-context moves.
133
- - **`vertical-slice` ownership:** feature code stays under `src/features/<slice>/…` (no sibling-slice imports); shared primitives in `src/shared/`; infra in `src/lib/`; shell in `src/app/`. Cross-feature edges are peerIsolation — extract shared or use events/ports.
134
- - **`ddd-bounded-contexts` ownership:** code under `src/contexts/<context>/{domain,application,infrastructure,presentation}/`; shared kernel only under `src/shared/kernel/`. Cross-context imports (same or cross technical layer) are peerIsolation — integrate via application APIs/events, not peer technical layers.
135
- - **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
60
+ - **Greenfield:** `/ark-adopt` or `ark-check --recommend` / `ark start`.
61
+ - **Brownfield:** `/ark-adopt`.
136
62
 
137
- ## Anti-wrapper rule (mandatory)
63
+ ## Steps
138
64
 
139
- **Forbidden:** only listing violations from JSON without reading importers/targets.
140
-
141
- **Required:**
142
- 1. Run `ark-check` as **sensor** (and `--plan --json` if multi-step) — CLI validates; you remediate.
143
- 2. **Read** each violated file and its import target (plus callers that explain product role).
144
- If the wall is a concentrated contract smell: **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).
145
- If false-green cores: **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`.
146
- If many residuals: **STOP — do not continue this skill as complete.** **STOP — bulk residual debt: invoke /ark-loop or /ark-autopilot** instead of ad-hoc multi-file grinding without a plan.
147
- 3. **“Así te lo re-soluciono”** — concrete change before editing.
148
- 4. After edits: `ark-check --strict-config` (and baseline if configured).
149
-
150
- ## Common fix patterns
151
-
152
- | Symptom | Fix |
153
- |---------|-----|
154
- | App → Presentation type-only | Extract type to application/core; re-export from UI |
155
- | App → Presentation value (UI in core) | Move component wrappers to presentation |
156
- | Domain → outer layer | Port/interface in Domain; adapter outside; or relocate false Domain file (`**/types.ts` trap) |
157
- | Intent prefix mismatch | Rename intent to layer’s `intentPrefixes` or fix prefix in config via `/ark-contract` |
158
- | Forbidden global in Domain | Inject a port (Clock, Id, Http) — don’t allow `Date.now` in Domain |
159
- | Concentrated edge wall | Stop grinding; `/ark-contract` facade/surface split |
160
-
161
- ## Manifiesto
162
-
163
- If the “fix” is really a missing business intent or Domain home for a rule:
164
-
165
- - Propose intent name + layer placement.
166
- - Register / place code so `ark_manifest` / config can enforce it.
167
- - Do not only delete the import.
168
-
169
- ## Rules
170
-
171
- - No `ark-*-disable`, no allowing a bad edge “to finish”, no baselining a **new** violation you introduced.
172
- - Prefer mechanical-safe kinds when the plan tags them; otherwise design judgment carefully.
173
- - Code only — no DB migrations unless user asked.
65
+ 1. Sensor: `ark-check` / `--plan --json`.
66
+ 2. If false-green or concentrated edge: **STOP — do not continue this skill as complete.**
67
+ **STOP — false-green:** / **STOP — concentrated edge:** execute **`/ark-adopt`** in this turn.
68
+ 3. Otherwise execute **`/ark-autopilot`** for the cluster (extraction card if Shape).
69
+ 4. Re-check.
174
70
 
175
71
  ## Mechanical-edit hygiene (outcome gate)
176
72
 
@@ -179,24 +75,9 @@ If the “fix” is really a missing business intent or Domain home for a rule:
179
75
  - A convention-only `*-data.ts` stub is not a fix: move the real code or **leave the placeholder file uncreated**; never write `import "server-only"; export {}` as an empty naming token.
180
76
  - Keep the edit only when the **previously clean file stays typecheck-clean**. Otherwise roll it back and treat the change as judgment.
181
77
 
182
- ## Reshape findings (physical cohesion — never mechanical)
183
-
184
- If `doctor.physicalCohesion` fires while you fix: do **not** fold reshape moves into your fix
185
- batch. Physical moves run only through `/ark-loop`'s one-pilot loop; merge decisions only as
186
- `/ark-architect` merge cards. A cohesion finding is context for your fix, never a license to
187
- reorganize. Respect `physicalCohesion.reshapeDecisions`: never revive a current rejected/deferred
188
- target from the still-visible facts. If the user makes a verdict while reviewing the finding,
189
- record its exact `decisionTarget` + reason in `.ark/reshape-decisions.json`; never infer one from
190
- golden-pattern prose.
191
-
192
- ## Done
193
-
194
- - Targeted violations gone; no new ones.
195
- - Report: what moved, what was intentional default, what needs user decision.
196
-
197
78
  ## Completion contract (skill incomplete if missing)
198
79
 
199
- End with **exactly** these headings (markdown `###`):
80
+ Skill incomplete if missing any field below.
200
81
 
201
82
  ### Completion
202
83
  - **Sensor:** commands/tools run
@@ -204,9 +85,5 @@ End with **exactly** these headings (markdown `###`):
204
85
  - **Result:** one-line outcome
205
86
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
206
87
  - **Compass:** top residual lenses | `n/a`
207
- - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
208
- - **Handoff:** `/ark-…` / CLI / `none`
88
+ - **Handoff:** `/ark-autopilot` / `/ark-adopt` / `none`
209
89
  - **Incomplete?** `no` | `yes — <what is missing>`
210
-
211
- If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
212
- **Skill incomplete if missing** any of the bullets above.
@@ -1,71 +1,34 @@
1
1
  ---
2
2
  name: ark-loop
3
- description: Drive ark-check --plan to zero active violations. Read real source, auto-apply only mechanical-safe kinds, design judgment from the product tree. CLI validates — you edit code.
3
+ description: Shortcut to /ark-autopilot for driving plan A to zero. Deprecated as a first-class door. CLI validates — you edit code.
4
4
  ---
5
5
 
6
- # /ark-loop — Apply the plan safely
6
+ # /ark-loop — Shortcut to /ark-autopilot
7
7
 
8
- Read Ark’s classified **plan**, work toward **goal.met**, one small step at a time,
9
- validating every change with `ark-check` and rolling back regressions.
8
+ **Not a first-run door.** This leftover name is a shortcut. Driving `--plan` to `goal.met` is **`/ark-autopilot`**.
9
+ Do that job now. Auto-apply only the four `mechanical-safe` kinds; judgment you write.
10
10
 
11
- Deterministic kinds stay **tight**. Your job is still **exploratory on the files**: open
12
- importers/targets, see if the plan step is a symptom of wrong shape / false Domain / I/O
13
- under Application — escalate to `/ark-contract` or `/ark-explore` when the wall is structural.
11
+ ## Autonomy contract
14
12
 
15
- ## Improvement compass (process preflight)
16
-
17
- When doctor is available, read `doctor.improvementCompass` (or the human **Improvement compass** section).
18
- Name 1–3 **residual** lenses in plain language before skill-shopping. Always `notAScore` — never invent
19
- 0–10 scores or Excellent/Good ranks.
20
-
21
- **What the user should feel next:** fewer blocked AI writes, clearer folders, safer domain — then jargon.
22
-
23
- **Anti false-done:** empty plan A + residual lenses / design-weak → **Incomplete? yes**. Green edges alone
24
- are not “architecture finished.”
25
-
26
- **AI-easy architecture:** ports over concrete I/O in domain; one concern per module; golden pattern for
27
- new files; place before write (`/ark-place` / prepare-write).
28
-
29
- **Out of scope (honest):** scalability/performance, full app-security tooling (SAST), and full resilience
30
- patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement for them.
31
-
32
- **Lens language on each cluster** while looping edges; residual shape lenses hand off to explore/autopilot.
33
-
34
- ## Deep modules (process)
35
-
36
- - Judgment remediations that introduce ports: **name the seam**, prefer deep modules, **test at the public interface**.
37
- - Do not invent pass-through files that fail the **deletion test** just to clear a plan step.
38
- - Empty plan A is edge residual only — Shape residual still needs explore/autopilot; green edges ≠ feature done.
13
+ Invoking this leftover name **is** the approval to apply plan A. Open every step file.
14
+ Write. Re-check. Empty plan A + leftover design → **`/ark-explore`** then **`/ark-autopilot`**
15
+ for one extraction card (never mechanical-safe B).
39
16
 
40
17
  ## When / not when
41
18
 
42
- | Use `/ark-loop` when… | Do **not** use it when… |
43
- |-----------------------|-------------------------|
44
- | Plan A has steps; drive to `goal.met` | Plan A empty — **stop**; residual Shape → `/ark-explore` / `/ark-autopilot` B |
45
- | Mechanical-safe + approved judgment only | Full product recon first → explore inside `/ark-autopilot` |
46
- | User already has a plan and wants the apply loop | Brownfield contract false-green → `/ark-adopt` |
47
-
48
- **Empty plan is not success for the product** — only for *edge remediation*. If `goal.met` and
49
- (`goal.designWeak` or non-empty `patternBets` from `--plan --json`): do **not** invent
50
- mechanical-safe kinds; hand off `/ark-explore` shape-focus or `/ark-autopilot` for dual-plan B.
51
- Pattern bets always have `neverMechanicalSafe: true` — extraction cards only
52
- (`docs/brownfield-adoption.md` §6).
53
-
54
- ## Related onboarding
55
-
56
- - **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
57
- - **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
58
- - **Map / opportunities:** `/ark-explore`.
59
- - **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
19
+ | Use this leftover name when… | Prefer instead |
20
+ |------------------------------|----------------|
21
+ | Plan A has steps; drive to `goal.met` | **`/ark-autopilot`** |
22
+ | Mechanical-safe + judgment apply | Map only`/ark-explore`; session 0 → `/ark-adopt` |
60
23
 
61
24
  ## Dual engine (mandatory)
62
25
 
63
26
  | Engine | Role |
64
27
  |--------|------|
65
28
  | **Deterministic** | Only the four `mechanical-safe` kinds auto-apply; plan tags; gate re-check |
66
- | **Exploratory** | Read sources; detect concentrated edges / false-green / wrong layer home before grinding |
67
-
29
+ | **Exploratory** | Read sources; detect concentrated edges / false-green before grinding |
68
30
 
31
+ The CLI is a **sensor**, never the whole job. Claiming done without the exploratory bar for this skill is **incomplete**.
69
32
 
70
33
  ## MCP workspace binding (mandatory)
71
34
 
@@ -76,67 +39,30 @@ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedP
76
39
  uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
77
40
  restart/retargeting is required. `ark://manifest` never satisfies this preflight.
78
41
 
79
- ## Dual plane layers + ArkRules (mandatory, except /ark-runtime)
80
-
81
- ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
82
-
83
- | Plane | What it protects | Where it lives | Sensors / tools |
84
- |-------|------------------|----------------|-----------------|
85
- | **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
86
- | **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
87
-
88
- **Rules for every report / answer:**
89
- 1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
90
- 2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
91
- 3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
92
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
93
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
42
+ Atomic multi-file work uses **`ark_prepare_change`** with the same matched `project` envelope.
94
43
 
44
+ ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
95
45
 
96
- ### Loop + ArkRules
97
- - Drive plan to zero **active** debt on the plane the user cares about; keep **[Layer]** and **[ArkRules]** queues separate.
98
- - One pilot at a time for ArkRules extraction cards (`pilotLoop` / inventory).
46
+ Label findings **`[Layer]`** vs **`[ArkRules]`**. Never invent `mechanical-safe` kinds.
99
47
 
100
48
  ## Subagent fan-out (optional, host-dependent)
101
49
 
102
- When the user asks to go faster **or** the work naturally splits (multiple packages,
103
- feature dirs, plan clusters), you **may** dispatch **subagents**:
104
-
105
- | Host capability | Behavior |
106
- |-----------------|----------|
107
- | **Parallel subagents supported** (e.g. multi-agent / `spawn_subagent` / concurrent Agent tools) | Launch **2–N** agents in **one wave** with **disjoint path scopes**. Prefer **read-only** explore agents for mapping; at most **one writer** unless the host gives isolated worktrees. Parent merges findings, then runs `ark-check` once. |
108
- | **Not supported** (single agent only) | **Fall back to sequential** — same checklist, one cluster/step at a time. Never claim parallel work you did not run. |
109
-
110
- **Rules:**
111
- 1. Give each subagent a **tight brief**: paths in scope, sensor commands allowed, deliverable shape (paths opened + findings JSON or bullets).
112
- 2. **No shared mutable files** across parallel writers.
113
- 3. STOP handoffs and dual-engine rules still apply in every agent.
114
- 4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
115
- 5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
116
-
117
- ## Anti-wrapper rule (mandatory)
50
+ If the host supports **parallel subagents**, fan out read-only scouts; otherwise
51
+ **fall back to sequential**. Never weaken the gate.
118
52
 
119
- **Forbidden:** re-printing plan JSON without opening sources, or inventing new “safe” kinds.
120
-
121
- **Required:**
122
- 1. `--plan --json` as sensor.
123
- 2. For each step you touch: **read** `file` and `target` source (and enough callers to know the edge).
124
- 3. **“Así te lo re-soluciono”** — exact edit before applying.
125
- 4. After each apply: full gate re-run; rollback if targeted violation remains or new ones appear.
126
- 5. If one edge dominates: **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).
127
- 6. If empty cores + I/O under Application: **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`.
53
+ ## Related onboarding
128
54
 
129
- ## mechanical-safe only (auto)
55
+ - **Greenfield:** `/ark-adopt` or `ark-check --recommend` / `ark start`.
56
+ - **Brownfield:** `/ark-adopt`.
130
57
 
131
- | `remediationKind` | What to do |
132
- |-------------------|------------|
133
- | `type-only-import-move` | Move type to owning layer; re-export for back-compat |
134
- | `pure-type-file-relocate` | Relocate pure-type file to owning layer (or rename out of false Domain globs) |
135
- | `import-type-from-pure-type-module` | Convert value import of pure-type module to `import type` |
136
- | `import-type-of-type-exports` | Convert value-syntax named import/export of type-only exports from a mixed module to `import type` / `export type` |
137
- | *(none for port-proof)* | **W6** `port-proof-inject-binding` is **judgment** (arity change) — propose inject; do not auto-apply |
58
+ ## Steps
138
59
 
139
- Never auto: free value uses of imports, multi-import files, dynamic import/require, forbidden globals, cycles, port-proof inject, multi-file adapter scaffolding without proof.
60
+ 1. `--plan --json`. Open every `steps[]` file.
61
+ 2. If one edge dominates: **STOP — do not continue this skill as complete.**
62
+ **STOP — concentrated edge:** execute **`/ark-adopt`**.
63
+ 3. If empty cores + I/O under Application: **STOP — do not continue this skill as complete.**
64
+ **STOP — false-green:** execute **`/ark-adopt`**.
65
+ 4. Else execute **`/ark-autopilot`** (mechanical-safe + judgment). Extraction card for Shape B.
140
66
 
141
67
  ## Mechanical-edit hygiene (outcome gate)
142
68
 
@@ -145,53 +71,9 @@ Never auto: free value uses of imports, multi-import files, dynamic import/requi
145
71
  - A convention-only `*-data.ts` stub is not a fix: move the real code or **leave the placeholder file uncreated**; never write `import "server-only"; export {}` as an empty naming token.
146
72
  - Keep the edit only when the **previously clean file stays typecheck-clean**. Otherwise roll it back and treat the change as judgment.
147
73
 
148
- ## Reshape pilots (physical cohesion — physical cohesion, advisory)
149
-
150
- When `ark-check --doctor --json` carries `doctor.physicalCohesion.reshapePilot.nextPilot`,
151
- you may run **that one pilot** — never more:
152
-
153
- 1. Read `physicalCohesion.reshapeDecisions` first. A current rejected/deferred target has no live
154
- card: respect the explicit record and do not reconstruct it from raw facts. Read a live card's
155
- `pilotTarget`, `decisionTarget`, `moveSample`/`movesTotal`, `successSignal`, `killSwitch`, `doNot[]`.
156
- 2. Moves are **proposed only** — enumerate the full move set for the pilot anchor, express it as
157
- an architecture change map, and validate through the atomic preflight (`ark_prepare_change`
158
- with the matched `project` envelope / the write gate) **before** any file moves. A move the preflight rejects is a finding, not a
159
- thing to force.
160
- 3. Never move anything under `app/` or `pages/` (fixed by framework convention). Never merge
161
- files here — merges are judgment cards for `/ark-architect` / `/ark-fix`.
162
- 4. After the move set: full gate re-run + re-doctor. Success = the concept's cluster count drops
163
- and the verdict stays green; otherwise use the kill switch (revert the move set, nothing else).
164
- 5. Re-doctor decides whether a next card exists. One pilot per loop iteration, always.
165
- 6. If the user accepts, defers, or rejects the target, persist that explicit verdict in
166
- `.ark/reshape-decisions.json` using the card's exact `decisionTarget`, a reason, and optional
167
- `reviewBy`. `accepted` keeps this execution path; `deferred`/`rejected` stop repeat pressure.
168
- Never infer a decision from `.ark/golden-pattern.json` prose.
169
-
170
- ## Steps
171
-
172
- 1. **Plan** — `ark-check --plan --json` (+ `--baseline` if used). If `goal.met`: stop **A**;
173
- if design-weak residual is visible, hand off explore/autopilot B — do not claim architecture done.
174
- 2. **Worktree** — prefer discardable git worktree.
175
- 3. **Apply mechanical-safe** one-by-one with validate/rollback.
176
- 4. **Judgment** — propose with source-based design; apply only if user approved (or parent autopilot said full apply).
177
- 5. **Re-plan** after each round until dry, `goal.met`, or only judgment left without approval.
178
- 6. **Report** — auto-applied / proposed / deferred with paths; never claim clean if skipped.
179
-
180
- ## Operating rules
181
-
182
- - Never weaken the gate (no rule disables, no fresh baselining of new debt).
183
- - Concentrated single edge → stop and hand to `/ark-contract` with code evidence.
184
- - When unsure behavior preservation → judgment, not mechanical-safe.
185
-
186
- ## Done criteria
187
-
188
- - Gate confirms each kept edit.
189
- - Honest residual list with **Así te lo re-soluciono** for anything left.
190
- - If residual steps hide domain/business rules in the wrong layer, call out **manifiesto** work (`intentPrefixes` / Domain placement) via `/ark-contract` or `/ark-adopt`.
191
-
192
74
  ## Completion contract (skill incomplete if missing)
193
75
 
194
- End with **exactly** these headings (markdown `###`):
76
+ Skill incomplete if missing any field below.
195
77
 
196
78
  ### Completion
197
79
  - **Sensor:** commands/tools run
@@ -199,9 +81,5 @@ End with **exactly** these headings (markdown `###`):
199
81
  - **Result:** one-line outcome
200
82
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
201
83
  - **Compass:** top residual lenses | `n/a`
202
- - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
203
- - **Handoff:** `/ark-…` / CLI / `none`
84
+ - **Handoff:** `/ark-autopilot` / `/ark-explore` / `none`
204
85
  - **Incomplete?** `no` | `yes — <what is missing>`
205
-
206
- If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
207
- **Skill incomplete if missing** any of the bullets above.
@@ -1,10 +1,29 @@
1
1
  ---
2
2
  name: ark-place
3
- description: "Where does new code go? Names the layer, directory, and naming for a new artifact from the contract, and scaffolds it there. Autonomous."
3
+ description: "Where does new code go? Names the layer, directory, and naming for a new artifact from the contract, and writes it there. Autonomous."
4
4
  ---
5
5
 
6
6
  # /ark-place — Where does this code go?
7
7
 
8
+ **When:** you are adding a new file or artifact and need the layer, folder, and name.
9
+ **Not when:** session 0 / config is missing or lying (`/ark-adopt`) or an existing violation cluster (`/ark-autopilot`).
10
+
11
+ ## Steps
12
+
13
+ 1. Bind identity if using MCP (`ark_identity` with the exact project root).
14
+ 2. Place the file (`ark_place` or read `ark.config.json`).
15
+ 3. Write it there. Then `arkgate-check`.
16
+
17
+ ## Autonomy contract
18
+
19
+ Invoking this skill **is** the approval. If the user described an artifact, **write the
20
+ files** in this turn (prepare-write + scaffold). A path table alone is incomplete.
21
+ The CLI is a **sensor and gate**. **CLI budget:** `ark_identity` then `ark_place` (or
22
+ read `ark.config.json`); write; `ark-check`. Do not ask which layer they prefer.
23
+
24
+ **Still never:** weaken `ark.config.json`; invent `mechanical-safe` kinds; claim leftover
25
+ design work is finished because one file landed.
26
+
8
27
  ## Improvement compass (process preflight)
9
28
 
10
29
  When doctor is available, read `doctor.improvementCompass` (or the human **Improvement compass** section).
@@ -34,8 +53,8 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
34
53
 
35
54
  | Use `/ark-place` when… | Do **not** use it when… |
36
55
  |------------------------|-------------------------|
37
- | New artifact: where + scaffold under contract | Existing violation fix → `/ark-fix` |
38
- | Naming / directory for a known kind | Contract layers wrong `/ark-contract`; full shape choice greenfield → `/ark-architect` |
56
+ | New artifact: where + **write** under the config | Existing violation cluster → `/ark-autopilot` |
57
+ | Naming / directory for a known kind | Session 0 / config missing or lying → `/ark-adopt` (then come back) |
39
58
 
40
59
  The user describes something they need to build (a saga, a background job, an
41
60
  event handler, a repository, an HTTP client, a use case, a projection, …).
@@ -83,7 +102,7 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
83
102
  1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
84
103
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
85
104
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
86
- 4. Editing `arkrules/*` or promoting modes is **`/ark-contract`**; fixing code under a structure sensor is **`/ark-fix`** / **`/ark-loop`** (judgment, never invent mechanical-safe).
105
+ 4. Missing layer home: add it via **`/ark-adopt`** in this session if needed, then write the file; never invent `mechanical-safe`.
87
106
  5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
88
107
 
89
108
 
@@ -132,18 +151,20 @@ the same files or weaken the gate.
132
151
  3. **Answer concretely**: layer name, target directory (from the layer's
133
152
  `patterns`), intent-name prefix if the layer declares `intentPrefixes`, and
134
153
  which layers it may/may not import (from `rules`).
135
- 4. **If the layer isn't adopted yet** (suggested but no directory): say so,
136
- give the conventional directory from `suggestedLayers`, and offer
137
- `/ark-contract` to adopt it don't silently drop the code into a
154
+ 4. **If the layer isn't adopted yet** (suggested but no directory): write the
155
+ layer into `ark.config.json` (session-0 honesty — same as `/ark-adopt` for
156
+ that glob) **then** write the file. Don't silently drop the code into a
138
157
  wrong-but-existing layer.
139
- 5. **If asked to create it**: scaffold the file(s) in place, following the
140
- nearest existing sibling's style, and any port/adapter split the rules force.
158
+ 5. **Write it.** If the user described the artifact, scaffold the file(s) in
159
+ place this turn (prepare-write), following the nearest existing sibling's
160
+ style, and any port/adapter split the rules force. A path table without
161
+ files is incomplete unless they asked “where only.”
141
162
 
142
163
  ## Critical handoffs
143
164
 
144
- - If the user needs bulk adoption / wrong contract, not a single artifact: **STOP — do not continue this skill as complete.** **STOP wrong skill: invoke /ark-adopt or /ark-contract** instead of ad-hoc multi-file grinding without a plan.
145
- - If contract lacks a home for the artifact: **STOP do not continue this skill as complete.** Adopt the layer via `/ark-contract` first.
146
- - If doctor is **ENFORCE · design-weak** and the user is asking to reshape existing structure
165
+ - If the user needs bulk adoption / wrong config, not a single artifact: **STOP — do not continue this skill as complete.** Switch to **`/ark-adopt`** (write the path) instead of ad-hoc multi-file grinding without a plan.
166
+ - If the config lacks a home for the artifact: add the layer **in this turn**, then write the file.
167
+ - If doctor shows leftover design work and the user is asking to reshape existing structure
147
168
  (not place one new artifact): place only the new file under the golden/contract home, then
148
169
  hand off **one** pilot via `pilotLoop.nextPilot` / `/ark-explore` shape-focus — never multi-pilot
149
170
  batch reshape from this skill.
@@ -159,8 +180,8 @@ the same files or weaken the gate.
159
180
 
160
181
  ## Related onboarding
161
182
 
162
- - Run **after** shape adoption: `/ark-architect` or `ark init --archetype` on greenfield;
163
- `/ark-adopt` on brownfield.
183
+ - Run **after** session 0: `/ark-adopt` (or `ark init --archetype` / `ark-check --recommend`
184
+ on greenfield). Brownfield: `/ark-adopt` first if the config is missing or lying.
164
185
  - `ark-check --recommend` / MCP `ark_recommend` picks phase-1 dirs; gallery starters in
165
186
  `examples/*-starter/` show correct placement per archetype.
166
187
  - Related demos: `docs/demos/` (write-gate self-correction, brownfield, autopilot).
@@ -19,7 +19,7 @@ one feature at a time.
19
19
 
20
20
  This skill is **experimental runtime** only. Do **not** treat runtime adoption as residual on the
21
21
  resilience lens unless the user explicitly opts into the experimental kernel. Prefer doctor compass
22
- for static architecture residual; hand static residual to `/ark-explore` / `/ark-fix`.
22
+ for static architecture residual; hand static residual to `/ark-explore` / `/ark-autopilot`.
23
23
 
24
24
  ## Dual engine (mandatory)
25
25
 
@@ -86,7 +86,7 @@ the same files or weaken the gate.
86
86
 
87
87
  ## Critical handoffs
88
88
 
89
- - No static gates yet: **STOP — do not continue this skill as complete.** Run `/ark-architect` or `/ark-adopt` first.
89
+ - No static gates yet: **STOP — do not continue this skill as complete.** Run `/ark-adopt` first (`ark-check --recommend` / leftover `/ark-architect`).
90
90
  - Runtime companion unavailable from npm and no ArkGate source checkout: **STOP** and report the distribution boundary.
91
91
  - Inventory finds nothing: stop; do not introduce kernel speculatively.
92
92
 
@@ -102,7 +102,7 @@ the same files or weaken the gate.
102
102
 
103
103
  ## Related onboarding
104
104
 
105
- - Adopt static gates and application shape **first** (`/ark-architect`, `/ark-adopt`).
105
+ - Adopt static gates and application shape **first** (`/ark-adopt`).
106
106
  - Runtime kernel is optional and separate from enthusiast onboarding.
107
107
 
108
108
  ## Verify and report
@@ -5,6 +5,10 @@ description: Host-side architectural reasoning — 2–3 enforceable options on
5
5
 
6
6
  # /ark-think — Architectural reasoning (host LLM only)
7
7
 
8
+ **Not a first-run door.** One decision only. Session 0 → **`/ark-adopt`**.
9
+ Full map → **`/ark-explore`**. Apply → **`/ark-autopilot`**.
10
+ Do not send the user to leftover `/ark-contract` or `/ark-fix`.
11
+
8
12
  You are the user's architecture thinking partner **inside** the project's Ark contract.
9
13
  This skill does **not** call any LLM API from the arkgate package. **You** (the host agent)
10
14
  reason; the write-gate and CI remain deterministic.
@@ -39,8 +43,8 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
39
43
  | Use `/ark-think` when… | Do **not** use it when… |
40
44
  |------------------------|-------------------------|
41
45
  | One decision: new layer vs slice, port vs shared, peerIsolation choice | Full map / ranked residual / dual-plan seed → `/ark-explore` |
42
- | 2–3 options already bounded by a known surface | Apply remediation → `/ark-fix` / `/ark-loop` / `/ark-autopilot` |
43
- | Trade-offs before writing a **new** feature | Brownfield contract wrong / false-green → `/ark-adopt` then `/ark-contract` |
46
+ | 2–3 options already bounded by a known surface | Apply remediation → `/ark-autopilot` |
47
+ | Trade-offs before writing a **new** feature | Brownfield config wrong / false-green → `/ark-adopt` |
44
48
  | Explain *why* a rule exists in *this* tree | HTML tour → `/ark-explain`; fitness numbers → `/ark-coverage` |
45
49
 
46
50
  If you lack a product map and the tree is messy: run a **compressed** explore pass first