arkgate 4.6.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/README.md +9 -5
  3. package/bin/ark-check-runtime.mjs +98 -7
  4. package/bin/ark-mcp-runtime.mjs +17 -1
  5. package/bin/ark.mjs +5 -3
  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-plan.mjs +4 -4
  14. package/bin/lib/field-install.mjs +1 -1
  15. package/bin/lib/html-report-advisories.mjs +20 -0
  16. package/bin/lib/improvement-compass-map.mjs +20 -20
  17. package/bin/lib/pilot-loop.mjs +1 -1
  18. package/bin/lib/post-green-path.mjs +2 -2
  19. package/bin/lib/prepare-change.mjs +9 -0
  20. package/bin/lib/product-copy.mjs +1 -1
  21. package/bin/lib/status-command.mjs +14 -0
  22. package/bin/lib/status-manifest.mjs +17 -0
  23. package/bin/lib/team-parliament-io.mjs +338 -0
  24. package/bin/lib/team-parliament.mjs +383 -0
  25. package/bin/lib/upgrade-whats-new.mjs +16 -0
  26. package/bin/lib/violations.mjs +8 -4
  27. package/dist/{configTypes-CC0FEXoF.d.ts → configTypes-B8uIcLaG.d.ts} +5 -0
  28. package/dist/eslint/index.cjs +2 -2
  29. package/dist/eslint/index.d.ts +1 -1
  30. package/dist/eslint/index.js +2 -2
  31. package/dist/index.cjs +19 -19
  32. package/dist/index.d.ts +61 -2
  33. package/dist/index.js +22 -22
  34. package/docs/README.md +5 -5
  35. package/docs/agent-guide.md +21 -17
  36. package/docs/configuration.md +36 -2
  37. package/docs/develop.md +13 -1
  38. package/docs/enthusiast/README.md +1 -1
  39. package/docs/enthusiast/how-to-agent-gates.md +3 -3
  40. package/docs/enthusiast/how-to-pick-shape.md +2 -2
  41. package/docs/enthusiast/tutorial-first-project.md +4 -3
  42. package/docs/package-surface.md +5 -3
  43. package/docs/product-voice.md +48 -10
  44. package/docs/use.md +6 -1
  45. package/package.json +2 -2
  46. package/schemas/ark.config.schema.json +9 -0
  47. package/schemas/ark.status-manifest.schema.json +51 -0
  48. package/server.json +3 -3
  49. package/templates/agent-skills/README.md +1 -1
  50. package/templates/agent-skills/ark-adopt/SKILL.md +46 -19
  51. package/templates/agent-skills/ark-architect/SKILL.md +24 -145
  52. package/templates/agent-skills/ark-autopilot/SKILL.md +40 -30
  53. package/templates/agent-skills/ark-contract/SKILL.md +21 -105
  54. package/templates/agent-skills/ark-coverage/SKILL.md +3 -0
  55. package/templates/agent-skills/ark-explain/SKILL.md +7 -4
  56. package/templates/agent-skills/ark-explore/SKILL.md +25 -17
  57. package/templates/agent-skills/ark-fix/SKILL.md +34 -157
  58. package/templates/agent-skills/ark-loop/SKILL.md +31 -153
  59. package/templates/agent-skills/ark-place/SKILL.md +25 -13
  60. package/templates/agent-skills/ark-runtime/SKILL.md +3 -3
  61. package/templates/agent-skills/ark-think/SKILL.md +5 -2
  62. package/templates/agent-skills/ark-upgrade/SKILL.md +11 -7
  63. package/templates/skills/ark-adopt.md +46 -19
  64. package/templates/skills/ark-architect.md +24 -145
  65. package/templates/skills/ark-autopilot.md +40 -30
  66. package/templates/skills/ark-contract.md +21 -105
  67. package/templates/skills/ark-coverage.md +3 -0
  68. package/templates/skills/ark-explain.md +7 -4
  69. package/templates/skills/ark-explore.md +25 -17
  70. package/templates/skills/ark-fix.md +34 -157
  71. package/templates/skills/ark-loop.md +31 -153
  72. package/templates/skills/ark-place.md +25 -13
  73. package/templates/skills/ark-runtime.md +3 -3
  74. package/templates/skills/ark-think.md +5 -2
  75. package/templates/skills/ark-upgrade.md +11 -7
@@ -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
+ **Deprecated as a first-class door.** 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,20 @@
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
+ ## Autonomy contract
9
+
10
+ Invoking this skill **is** the approval. If the user described an artifact, **write the
11
+ files** in this turn (prepare-write + scaffold). A path table alone is incomplete.
12
+ The CLI is a **sensor and gate**. **CLI budget:** `ark_identity` then `ark_place` (or
13
+ read `ark.config.json`); write; `ark-check`. Do not ask which layer they prefer.
14
+
15
+ **Still never:** weaken `ark.config.json`; invent `mechanical-safe` kinds; claim leftover
16
+ design work is finished because one file landed.
17
+
8
18
  ## Improvement compass (process preflight)
9
19
 
10
20
  When doctor is available, read `doctor.improvementCompass` (or the human **Improvement compass** section).
@@ -34,8 +44,8 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
34
44
 
35
45
  | Use `/ark-place` when… | Do **not** use it when… |
36
46
  |------------------------|-------------------------|
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` |
47
+ | New artifact: where + **write** under the config | Existing violation cluster → `/ark-autopilot` |
48
+ | Naming / directory for a known kind | Session 0 / config missing or lying → `/ark-adopt` (then come back) |
39
49
 
40
50
  The user describes something they need to build (a saga, a background job, an
41
51
  event handler, a repository, an HTTP client, a use case, a projection, …).
@@ -83,7 +93,7 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
83
93
  1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
84
94
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
85
95
  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).
96
+ 4. Missing layer home: add it via **`/ark-adopt`** in this session if needed, then write the file; never invent `mechanical-safe`.
87
97
  5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
88
98
 
89
99
 
@@ -132,17 +142,19 @@ the same files or weaken the gate.
132
142
  3. **Answer concretely**: layer name, target directory (from the layer's
133
143
  `patterns`), intent-name prefix if the layer declares `intentPrefixes`, and
134
144
  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
145
+ 4. **If the layer isn't adopted yet** (suggested but no directory): write the
146
+ layer into `ark.config.json` (session-0 honesty — same as `/ark-adopt` for
147
+ that glob) **then** write the file. Don't silently drop the code into a
138
148
  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.
149
+ 5. **Write it.** If the user described the artifact, scaffold the file(s) in
150
+ place this turn (prepare-write), following the nearest existing sibling's
151
+ style, and any port/adapter split the rules force. A path table without
152
+ files is incomplete unless they asked “where only.”
141
153
 
142
154
  ## Critical handoffs
143
155
 
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.
156
+ - 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.
157
+ - If the config lacks a home for the artifact: add the layer **in this turn**, then write the file.
146
158
  - If doctor is **ENFORCE · design-weak** and the user is asking to reshape existing structure
147
159
  (not place one new artifact): place only the new file under the golden/contract home, then
148
160
  hand off **one** pilot via `pilotLoop.nextPilot` / `/ark-explore` shape-focus — never multi-pilot
@@ -159,8 +171,8 @@ the same files or weaken the gate.
159
171
 
160
172
  ## Related onboarding
161
173
 
162
- - Run **after** shape adoption: `/ark-architect` or `ark init --archetype` on greenfield;
163
- `/ark-adopt` on brownfield.
174
+ - Run **after** session 0: `/ark-adopt` (or `ark init --archetype` / `ark-check --recommend`
175
+ on greenfield). Brownfield: `/ark-adopt` first if the config is missing or lying.
164
176
  - `ark-check --recommend` / MCP `ark_recommend` picks phase-1 dirs; gallery starters in
165
177
  `examples/*-starter/` show correct placement per archetype.
166
178
  - 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,9 @@ description: Host-side architectural reasoning — 2–3 enforceable options on
5
5
 
6
6
  # /ark-think — Architectural reasoning (host LLM only)
7
7
 
8
+ **Shortcut.** One decision only. Full map → **`/ark-explore`**. Apply → **`/ark-autopilot`**.
9
+ Session 0 → **`/ark-adopt`**.
10
+
8
11
  You are the user's architecture thinking partner **inside** the project's Ark contract.
9
12
  This skill does **not** call any LLM API from the arkgate package. **You** (the host agent)
10
13
  reason; the write-gate and CI remain deterministic.
@@ -39,8 +42,8 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
39
42
  | Use `/ark-think` when… | Do **not** use it when… |
40
43
  |------------------------|-------------------------|
41
44
  | 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` |
45
+ | 2–3 options already bounded by a known surface | Apply remediation → `/ark-autopilot` |
46
+ | Trade-offs before writing a **new** feature | Brownfield config wrong / false-green → `/ark-adopt` |
44
47
  | Explain *why* a rule exists in *this* tree | HTML tour → `/ark-explain`; fitness numbers → `/ark-coverage` |
45
48
 
46
49
  If you lack a product map and the tree is messy: run a **compressed** explore pass first
@@ -9,9 +9,14 @@ Upgrade the published `arkgate` package and its managed gates without treating a
9
9
  filename, package version, or similar-looking file as proof of ownership. The
10
10
  preview is the source of truth: inspect it before applying anything.
11
11
 
12
- For greenfield onboarding, start with `/ark-architect` (or
13
- `ark-check --recommend`); for a brownfield repository, use `/ark-adopt` before
14
- this upgrade flow.
12
+ ## Autonomy contract
13
+
14
+ Invoking this skill **is** the approval. Preview, then `--apply` **in this turn**.
15
+ Stopping at preview is incomplete unless the probe failed or a conflict needs
16
+ `--accept-conflicts` / `--refresh-skills` consent.
17
+
18
+ For session 0, start with `/ark-adopt` (or `ark-check --recommend`); brownfield
19
+ honesty is `/ark-adopt` before this upgrade flow.
15
20
 
16
21
  ## Improvement compass (process preflight)
17
22
 
@@ -99,7 +104,7 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
99
104
  1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
100
105
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
101
106
  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).
107
+ 4. After upgrade, leftover architecture work is **`/ark-autopilot`** (never invent `mechanical-safe`).
103
108
  5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
104
109
 
105
110
 
@@ -241,9 +246,8 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
241
246
  `doctor.deepModuleCoach` honesty. Run `npx arkgate agents-md --check` and
242
247
  `npx arkgate status --json`. If MCP was used, restart MCP after package bump and re-bind
243
248
  identity. Treat provider-unavailable CI required-check evidence as `unverified`, never as proof
244
- that merges are blocked. If new violations appear, hand off to `/ark-fix` for a small set or
245
- `/ark-loop` / `/ark-autopilot` for residual debt; do not regenerate a baseline without explicit
246
- approval.
249
+ that merges are blocked. If new violations appear, hand off to `/ark-autopilot`; do not regenerate a baseline without
250
+ explicit approval.
247
251
 
248
252
  ## Active host vs deferred hosts
249
253
 
@@ -1,12 +1,39 @@
1
1
  ---
2
2
  name: ark-adopt
3
- description: Brownfield onboardingmatch 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.
3
+ description: Session 0mark the Ark path. Greenfield scaffold or brownfield honesty. Write ark.config, optional advisory ArkRules, baseline, and gates in this turn. CLI validates.
4
4
  ---
5
5
 
6
- # /ark-adopt — Bring Ark into an existing codebase
6
+ # /ark-adopt — Mark the path (session 0)
7
7
 
8
- Goal: contract reflects **product reality**, most code governed, only genuine debt frozen
9
- with a burn-down. A green check over a wrong contract is a **false green**.
8
+ Invoking this skill **is** the approval. Write the architecture config in this turn.
9
+ Greenfield: scaffold like `--recommend` / today’s architect. Brownfield: match **product
10
+ reality**, freeze only genuine debt. A green check over a wrong config is a **false green**.
11
+
12
+ ## Autonomy contract
13
+
14
+ The CLI is a **sensor and gate**, never the deliverable. **CLI budget:** one
15
+ `ark-check --recommend` or `--coverage` / `--doctor`; then write; then `ark-check`.
16
+ Forbidden as the result: preview-only adopt, “approve?”, or `STOP — invoke /ark-architect`
17
+ / `/ark-contract`. Do that work **here**.
18
+
19
+ **Still never:** weaken `ark.config.json`; invent `mechanical-safe` kinds; claim finished
20
+ while leftover design work remains.
21
+
22
+ **Team lock:** this door **is** a contract session (law-only). Do not mix product source
23
+ into the same diff. After writes, validate with
24
+ `ark-check --contract-diff --contract-session --base <merge-ref> --author <steward>`.
25
+ If `stewards` is set, loosen and baseline-grow require a listed author. Feature work
26
+ uses `/ark-place` / `/ark-autopilot` and must not touch the constitution.
27
+
28
+ **Several hands → ask for stewards.** Read `doctor.stewardNudge` (or the human
29
+ **Stewards (advisory)** line). Act when `needsStewards` **or** `drift` is true.
30
+ **Ask once** before writing `stewards[]`. Identity is a **GitHub handle or email**
31
+ (`pedroknigge` or the GitHub noreply mail), not git `user.name`. Empty list: use
32
+ `proposed` (CODEOWNERS first, else git handles/emails; bots and display names stripped).
33
+ Drift: CODEOWNERS handles in `missingFromList`, or “team grew” (author count > steward
34
+ count) — ask who else owns the law. If the user says yes or names handles or emails,
35
+ write them in this turn. If they say the list is still right, leave it. Never invent
36
+ or auto-remove stewards.
10
37
 
11
38
  **Adopt is Align + Stabilize, then seed Shape.** Freezing debt without a pattern plan leaves
12
39
  spaghetti “ENFORCE · design-weak”. Always end with dual-plan **B** seeds (or handoff explore)
@@ -47,10 +74,10 @@ When present, prefer the consumer **domain glossary** for layer names, slice fol
47
74
 
48
75
  | Use `/ark-adopt` when… | Do **not** use it when… |
49
76
  |------------------------|-------------------------|
50
- | Existing messy repo; contract folders | Empty greenfield shape → `/ark-architect` |
51
- | False-green / concentrated edge needs contract truth | Map-only without writing config/baseline → `/ark-explore` |
52
- | Mine loose business rules into Domain / intents | Single violation fix → `/ark-fix` |
53
- | Freeze **real** debt after contract is honest | Grind plan A only → `/ark-loop`; full apply loop → `/ark-autopilot` |
77
+ | Session 0: empty tree or existing repo needs an honest path | Map-only without writing config → `/ark-explore` |
78
+ | False-green / concentrated edge needs config truth | Feature file only → `/ark-place` |
79
+ | Mine loose business rules into Domain / advisory ArkRules | Apply leftover design after the path is honest → `/ark-autopilot` |
80
+ | Freeze **real** debt after the config is honest | User said map only |
54
81
 
55
82
  ## Dual engine (mandatory)
56
83
 
@@ -83,13 +110,13 @@ ArkGate has **two opt-in planes**. The user chooses which to use; you **always l
83
110
  1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
84
111
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
85
112
  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).
113
+ 4. Editing `arkrules/*` or promoting modes is **this skill** (session 0) or **`/ark-autopilot`** later; never invent `mechanical-safe`.
87
114
  5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
88
115
 
89
116
 
90
117
  ### Adopt + ArkRules
91
118
  - After classify: emit or refresh `arkRules` for matched layers (exact names; generic mold for unknowns).
92
- - Mine rules → inventory + propose invariants/structure; land via `/ark-contract`.
119
+ - Mine rules → inventory + write advisory invariants/structure into `arkrules/<Layer>.json` **in this turn**.
93
120
  - Freeze baseline is **[Layer]** debt; inventory residual is **[ArkRules]** — report both.
94
121
 
95
122
  ## Subagent fan-out (optional, host-dependent)
@@ -111,10 +138,10 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
111
138
 
112
139
  ## Related onboarding
113
140
 
114
- - **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
115
- - **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
141
+ - **Greenfield:** this skill + `ark-check --recommend` / `ark start` — write the scaffold here.
142
+ - **Brownfield:** this skill — match config to reality; do not force a starter preset.
116
143
  - **Deep map only:** `/ark-explore`.
117
- - **Default path:** `ark start` → `/ark-autopilot` `ark-check --doctor`.
144
+ - **Default path:** `ark start` → **`/ark-adopt`** → `/ark-place` / `/ark-autopilot`.
118
145
 
119
146
  ## Anti-wrapper rule (mandatory)
120
147
 
@@ -143,18 +170,18 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
143
170
  **ApplicationOrchestration**, not Presentation — do not reclassify API shells as UI.
144
171
  2. **Check + diagnose** — `summary.concentrated` / dominant edge → fix contract first, don’t freeze.
145
172
  Cross-slice / cross-context `peerIsolation` hits are judgment: extract shared or events.
146
- If one edge dominates residual debt: **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).
173
+ If one edge dominates residual debt: **STOP — do not continue this skill as complete.** **STOP — concentrated edge:** rewrite `ark.config.json` **in this turn** with source evidence (do not freeze a wrong config or grind N freezes).
147
174
  Empty Domain/Persistence + I/O under Application → false-green.
148
- **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`.
175
+ **STOP — do not continue this skill as complete.** **STOP — false-green:** fix the config **in this turn** before claiming ENFORCE. Do not claim goal.met / ENFORCE from type-only cleanup while doctor reports `contract-false-green-io-under-application`.
149
176
  3. **Classify ungoverned** — use coverage `suggestions` **plus** dirs you discovered by reading;
150
- add layers/patterns via `/ark-contract`.
177
+ add layers/patterns **here** (write `ark.config.json`).
151
178
  4. **Mine business rules → manifiesto** (model job — this is why the skill exists):
152
179
  - Scan for loose domain: validators, pricing/policy functions, `can*`/`calculate*`, magic business constants, publish/intent strings, logic in UI/hooks that belongs in Domain.
153
180
  - **ArkRules inventory (AR13):** run `ark-check --rules-inventory --json` for deterministic candidates
154
181
  (validation-in-controller, magic constants, anemic entities). Counts are **not a score**.
155
182
  - Propose: Domain files, `intentPrefixes`, intent names (`Domain.*` / `Application.*`), kernel `defineIntent` stubs if runtime is used;
156
- land structure/invariant entries under `arkrules/<Layer>.json` via `/ark-contract` (ADR 0015 routing).
157
- - Apply config through `/ark-contract` discipline; move pure rules into Domain when safe; validate with ark-check.
183
+ land structure/invariant entries under `arkrules/<Layer>.json` **in this turn** (ADR 0015 routing).
184
+ - Write the config; move pure rules into Domain when safe; validate with ark-check.
158
185
  - Deliver section **“Así te lo re-soluciono en el manifiesto”** with before/after contract snippets.
159
186
  5. **Freeze only real debt** — `--update-baseline` (zero debt → **no empty baseline file** left behind).
160
187
  6. **Gates + skills** — `--install-agent-gates` (CI monorepo-aware when `frontend/package.json` exists).
@@ -164,7 +191,7 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
164
191
  domain logic in UI, or semantic false-green: emit **dual-plan B** (3–5 bets) with pilot,
165
192
  success signal, kill-switch, and extraction cards for I/O moves — same bar as `/ark-explore` §G.
166
193
  - Do **not** claim “adopt complete / healthy” solely because the check is green.
167
- - Prefer handoff `/ark-autopilot` for B execution with user ok, or `/ark-explore` shape-focus
194
+ - Prefer handoff `/ark-autopilot` to apply one Shape refactor, or `/ark-explore` shape-focus
168
195
  if the user only wanted a plan.
169
196
 
170
197
  ## Operating modes