arkgate 2.11.0 → 2.13.0
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.
- package/CHANGELOG.md +147 -0
- package/README.md +70 -41
- package/bin/ark-check.mjs +95 -36
- package/bin/ark-mcp.mjs +11 -5
- package/bin/ark-shared.mjs +88 -56
- package/bin/ark.mjs +97 -29
- package/bin/lib/agent-gates.mjs +79 -2093
- package/bin/lib/architecture-scan.mjs +8 -0
- package/bin/lib/ci-and-commands.mjs +392 -0
- package/bin/lib/codex-home.mjs +7 -0
- package/bin/lib/config-contract.mjs +331 -0
- package/bin/lib/deploy-path.mjs +205 -0
- package/bin/lib/doctor-plan.mjs +43 -16
- package/bin/lib/enforcement-profiles.mjs +97 -0
- package/bin/lib/gate-files.mjs +223 -0
- package/bin/lib/hook-templates.mjs +99 -0
- package/bin/lib/host-support-matrix.mjs +77 -0
- package/bin/lib/install-migrate.mjs +473 -0
- package/bin/lib/mcp-adoption.mjs +455 -0
- package/bin/lib/open-html.mjs +75 -0
- package/bin/lib/presets.mjs +6 -2
- package/bin/lib/safety-diagnostics.mjs +31 -11
- package/bin/lib/skill-install.mjs +323 -0
- package/bin/lib/ts-resolve.mjs +2 -1
- package/bin/lib/typescript-host.mjs +88 -0
- package/bin/lib/weakest-link.mjs +417 -0
- package/bin/lib/write-path-capabilities.mjs +182 -0
- package/bin/lib/write-path-detect.mjs +101 -0
- package/dist/configContract-iBLxx5Tz.d.cts +53 -0
- package/dist/configContract-iBLxx5Tz.d.ts +53 -0
- package/dist/eslint/index.cjs +375 -13
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.cts +30 -20
- package/dist/eslint/index.d.ts +30 -20
- package/dist/eslint/index.js +375 -13
- package/dist/eslint/index.js.map +1 -1
- package/dist/index.cjs +723 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -5
- package/dist/index.d.ts +95 -5
- package/dist/index.js +716 -61
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.cjs +150 -42
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +2 -1
- package/dist/nestjs/index.d.ts +2 -1
- package/dist/nestjs/index.js +150 -42
- package/dist/nestjs/index.js.map +1 -1
- package/dist/runtime/index.cjs +723 -61
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +3 -2
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.js +716 -61
- package/dist/runtime/index.js.map +1 -1
- package/dist/{types-BZ17b9i5.d.cts → types-BxBwnBpC.d.cts} +9 -36
- package/dist/{types-BZ17b9i5.d.ts → types-Wcs_l1_J.d.ts} +9 -36
- package/docs/agent-guide.md +43 -21
- package/docs/ai-gates.md +53 -18
- package/docs/configuration.md +97 -0
- package/docs/enthusiast/README.md +3 -3
- package/docs/enthusiast/how-to-agent-gates.md +7 -3
- package/docs/migrate-from-ark-runtime-kernel.md +3 -0
- package/docs/package-surface.md +22 -10
- package/docs/production-hardening.md +15 -2
- package/docs/threat-model.md +65 -0
- package/docs/typescript-support.md +3 -3
- package/package.json +15 -2
- package/schemas/ark.config.schema.json +750 -0
- package/server.json +2 -2
- package/templates/hooks/pre-commit-ark +37 -0
- package/templates/skills/ark-autopilot.md +77 -45
- package/templates/skills/ark-coverage.md +2 -2
- package/templates/skills/ark-explain.md +2 -1
- package/templates/skills/ark-explore.md +135 -34
- package/templates/skills/ark-runtime.md +8 -5
- package/templates/skills/ark-upgrade.md +36 -16
- package/tests/fixtures/ts-consumer/ark.config.json +2 -0
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/pedroknigge/arkgate",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.13.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "arkgate",
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.13.0",
|
|
15
15
|
"runtimeHint": "npx",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Maintained by ArkGate (Q3) — human-edit architecture gate.
|
|
3
|
+
# Install (git hooks):
|
|
4
|
+
# cp templates/hooks/pre-commit-ark .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
|
|
5
|
+
# Or with husky:
|
|
6
|
+
# cp templates/hooks/pre-commit-ark .husky/pre-commit && chmod +x .husky/pre-commit
|
|
7
|
+
#
|
|
8
|
+
# Blocks commit when ark-check fails. Does not replace CI branch protection.
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
12
|
+
cd "$ROOT"
|
|
13
|
+
|
|
14
|
+
run_check() {
|
|
15
|
+
if [ -f package.json ] && node -e "const p=require('./package.json');process.exit(p.scripts&&p.scripts['check:architecture']?0:1)" 2>/dev/null; then
|
|
16
|
+
npm run -s check:architecture
|
|
17
|
+
return $?
|
|
18
|
+
fi
|
|
19
|
+
if [ -f bin/ark-check.mjs ]; then
|
|
20
|
+
node bin/ark-check.mjs --root . --config ark.config.json --strict-config
|
|
21
|
+
return $?
|
|
22
|
+
fi
|
|
23
|
+
if command -v arkgate-check >/dev/null 2>&1; then
|
|
24
|
+
arkgate-check --root . --config ark.config.json --strict-config
|
|
25
|
+
return $?
|
|
26
|
+
fi
|
|
27
|
+
if command -v npx >/dev/null 2>&1; then
|
|
28
|
+
# --yes: pre-commit is non-interactive; never hang on npx install prompts
|
|
29
|
+
npx --yes --no-install arkgate-check --root . --config ark.config.json --strict-config 2>/dev/null \
|
|
30
|
+
|| npx --yes arkgate-check --root . --config ark.config.json --strict-config
|
|
31
|
+
return $?
|
|
32
|
+
fi
|
|
33
|
+
echo "ark-check not found — install arkgate or add check:architecture script" >&2
|
|
34
|
+
return 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
run_check
|
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-autopilot
|
|
3
|
-
description: End-to-end architecture co-pilot —
|
|
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.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /ark-autopilot — Get to a sound architecture, end to end
|
|
7
7
|
|
|
8
|
-
Composes **explore
|
|
9
|
-
when the user says full apply / “al mango” / apply everything, also
|
|
10
|
-
**judgment** fixes you design from reading source (still validate with ark-check,
|
|
8
|
+
Composes **explore → sensors → dual plan → loop**. Safe default: auto-apply only
|
|
9
|
+
`mechanical-safe`; when the user says full apply / “al mango” / apply everything, also
|
|
10
|
+
execute **judgment** fixes you design from reading source (still validate with ark-check,
|
|
11
11
|
never weaken the gate).
|
|
12
12
|
|
|
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).
|
|
15
|
+
|
|
13
16
|
|
|
14
17
|
## Related onboarding
|
|
15
18
|
|
|
16
19
|
- **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
|
|
17
20
|
- **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
|
|
18
|
-
- **Deep map only:** `/ark-explore` —
|
|
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).
|
|
19
23
|
- **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
|
|
20
24
|
|
|
21
25
|
## Dual engine (mandatory)
|
|
22
26
|
|
|
23
27
|
| Engine | Role |
|
|
24
28
|
|--------|------|
|
|
25
|
-
| **Deterministic** | `ark-check` plan/coverage/doctor, mechanical-safe kinds, write/CI gates, exit codes |
|
|
26
|
-
| **Exploratory** | You map **this** product’s real tree: entry points,
|
|
29
|
+
| **Deterministic** | `ark-check` plan/coverage/doctor, mechanical-safe kinds, write/CI gates, exit codes, origin snapshot |
|
|
30
|
+
| **Exploratory** | You map **this** product’s real tree: entry points, coupling, false greens, field path, pattern debt |
|
|
27
31
|
|
|
28
|
-
**Forbidden:** only printing `--plan` JSON or “4 safe / 4 judgment — approve?” without
|
|
32
|
+
**Forbidden:** only printing `--plan` JSON or “4 safe / 4 judgment — approve?” without a
|
|
33
|
+
decision-grade explore pass **and** without opening violating files.
|
|
29
34
|
|
|
30
35
|
**Required:**
|
|
31
|
-
1. **Explore pass** (below) before claiming a loop strategy.
|
|
32
|
-
2. CLI
|
|
33
|
-
3. **
|
|
34
|
-
4.
|
|
35
|
-
5.
|
|
36
|
+
1. **Explore pass** (below) **before** claiming a loop strategy — same bar as `/ark-explore`, budgeted.
|
|
37
|
+
2. CLI sensors: `--plan --json`, `--coverage --json` / `--doctor` as needed.
|
|
38
|
+
3. **Dual plan** always emitted (sections A and B).
|
|
39
|
+
4. **Open every file** in plan A `steps[]` (and `target` if present) before classifying a fix.
|
|
40
|
+
5. **“Así te lo re-soluciono”** for each A cluster and each B pattern bet.
|
|
41
|
+
6. Apply A → re-run ark-check → rollback on regression. **Never auto-apply B** as mechanical-safe.
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
## Subagent fan-out (optional, host-dependent)
|
|
@@ -52,64 +58,90 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
|
|
|
52
58
|
4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
|
|
53
59
|
5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
Useful first wave: **core product tree** | **field path** (examples/starters) | **agent install surfaces** (hooks vs templates).
|
|
62
|
+
|
|
63
|
+
## Explore pass (phase 0 — mandatory, first)
|
|
56
64
|
|
|
57
|
-
Do this
|
|
65
|
+
Do this **before** grinding plan A — plan lists *violations*, not *product reality*.
|
|
66
|
+
Use the **`/ark-explore` decision-grade bar** (compressed into the autopilot report, not optional fluff).
|
|
58
67
|
|
|
59
|
-
1. **
|
|
60
|
-
2. **
|
|
61
|
-
3. **
|
|
62
|
-
4. **
|
|
63
|
-
|
|
64
|
-
|
|
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:
|
|
65
74
|
**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`.
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
7. **Seed dual plan B** — 2–5 pattern / evolution bets ranked (impact × effort × enforceability).
|
|
76
|
+
|
|
77
|
+
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`.
|
|
79
|
+
|
|
80
|
+
## Dual plan (always emit)
|
|
81
|
+
|
|
82
|
+
| Section | Source | Question | Auto-apply? |
|
|
83
|
+
|---------|--------|----------|-------------|
|
|
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 |
|
|
86
|
+
|
|
87
|
+
**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.
|
|
89
|
+
|
|
90
|
+
B does **not** count as “architecture healthy finished.” Report B as `proposed | deferred | applied-with-user-ok`.
|
|
68
91
|
|
|
69
|
-
|
|
92
|
+
## Origin snapshot (day-zero picture)
|
|
70
93
|
|
|
71
|
-
|
|
94
|
+
- **When:** as soon as `ark.config.json` exists and `.ark/reports/origin.json` is missing — **before** applying fixes and **before** treating “done”. Prefer that `ark start` / `ark init` already froze origin **before** agent docs; if missing, freeze now.
|
|
95
|
+
- **How:** `ark-check --report ark-report.html` (writes origin once under `.ark/reports/`).
|
|
96
|
+
- **Never** `--reset-origin` unless the user explicitly wants a new baseline.
|
|
97
|
+
- **Do not** wait until the end of the loop to create origin the first time — later reports need a frozen “before” picture.
|
|
98
|
+
- End of run: re-`--report` for **latest** + evolution vs origin (origin stays frozen).
|
|
72
99
|
|
|
73
100
|
## Operating modes (detected, not picked)
|
|
74
101
|
|
|
75
|
-
- **Setup (Suggest):** no config → `ark start` / recommend shape.
|
|
102
|
+
- **Setup (Suggest):** no config → `ark start` / recommend shape (start freezes origin after config, before gates).
|
|
76
103
|
- **Align (Adapt):** open debt, low honesty, or false-green → explore + adopt/loop; do not claim “guarded”.
|
|
77
|
-
- **Guard (Enforce):** `goal.met`, solid governed%, no false-green →
|
|
104
|
+
- **Guard (Enforce):** `goal.met`, solid governed%, no false-green → confirm gates; still emit dual plan B if explore found residual.
|
|
78
105
|
|
|
79
106
|
## Flow
|
|
80
107
|
|
|
81
|
-
0. **Explore pass** —
|
|
108
|
+
0. **Explore pass** — decision-grade recon (see above); seed plan B.
|
|
82
109
|
1. **Setup if needed** — `ark start` if no `ark.config.json`. Trust `--recommend` / playbook:
|
|
83
110
|
`vertical-slice-product` and `ddd-bounded-contexts` are first-class shapes (not hexagonal by default).
|
|
84
|
-
2. **Origin
|
|
85
|
-
3. **
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
2. **Origin if missing** — freeze day-zero (`--report`) immediately after contract exists.
|
|
112
|
+
3. **Sensors** — `--plan --json`, doctor/coverage as needed.
|
|
113
|
+
4. **Emit dual plan** — A from plan steps (files opened); B from explore (3–5 bets).
|
|
114
|
+
5. **Concentrated edge?** — if one edge dominates A:
|
|
88
115
|
**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).
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
116
|
+
6. **Worktree preferred** — discardable git worktree when possible.
|
|
117
|
+
7. **Mechanical-safe (A only)** — kinds from `/ark-loop` table; one step, validate, rollback.
|
|
118
|
+
8. **Judgment (A)** — default: propose with full “así te lo re-soluciono”. If user authorized full apply: implement, validate, rollback on fail.
|
|
119
|
+
9. **Pattern bets (B)** — propose; apply only with explicit user go + correct skill (`/ark-contract`, refactor, install gates, etc.). Never weaken the gate to clear B.
|
|
120
|
+
10. **Manifiesto** — loose business rules → Domain placement + `intentPrefixes` / intents via `/ark-contract` discipline.
|
|
121
|
+
11. **Final report** — re-`--report`; evolution vs origin; A applied vs open; B proposed/deferred; gates on.
|
|
122
|
+
12. **Strict check** — `ark-check --strict-config` (dead preset globs are advisory; real violations still fail).
|
|
123
|
+
13. **Core ratchet (when green)** — if plan `goal.met` and doctor still **ADAPT** only because
|
|
96
124
|
populated cores are `optional: true`, run `ark-check --ratchet-cores` then `--doctor`.
|
|
97
125
|
Never ratchet while active violations remain or false-green gap is open.
|
|
98
126
|
|
|
99
127
|
## Never
|
|
100
128
|
|
|
101
129
|
- Disable rules, broaden allows, or baseline **new** debt to “finish”.
|
|
102
|
-
- Claim clean while judgment steps were skipped without user decision.
|
|
130
|
+
- Claim clean while judgment A steps were skipped without user decision.
|
|
103
131
|
- Claim ENFORCE / “done” when doctor reports `contract-false-green-io-under-application` (adopt first).
|
|
132
|
+
- Claim “done” solely because plan A is empty while explore/B residual remains unlisted.
|
|
104
133
|
- Replace host Nest/DI with the runtime kernel unasked.
|
|
105
|
-
-
|
|
134
|
+
- Auto-apply pattern (B) bets as if they were mechanical-safe.
|
|
135
|
+
- Create origin only after a long cleanup (freezes a polished “before” that never was).
|
|
106
136
|
|
|
107
137
|
## Done criteria
|
|
108
138
|
|
|
109
|
-
- Explore pass completed (
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
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).
|
|
141
|
+
- Origin present under `.ark/reports/origin.*` (frozen this run or earlier).
|
|
142
|
+
- Every applied A step validated by real `ark-check`.
|
|
143
|
+
- Final plan `goal.met` true **or** remaining A steps listed with file-level proposals.
|
|
144
|
+
- Open **B opportunities** listed; report HTML paths cited.
|
|
113
145
|
|
|
114
146
|
## Completion contract (skill incomplete if missing)
|
|
115
147
|
|
|
@@ -56,7 +56,7 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
|
|
|
56
56
|
|------|----------------|--------------------|
|
|
57
57
|
| **Suggest / Setup** | Thin or new tree | “Ark will propose a starting shape — you don’t switch a mode.” |
|
|
58
58
|
| **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
|
|
59
|
+
| **Enforce / Guard** | Coverage + clean edges + honest cores | “You arrived here — keep the host-appropriate write path and CI check on.” |
|
|
60
60
|
|
|
61
61
|
Never say “your architecture is guarded” while `goal.met` is false, governed% is low,
|
|
62
62
|
or false-green doctor gaps are open.
|
|
@@ -73,7 +73,7 @@ or false-green doctor gaps are open.
|
|
|
73
73
|
|
|
74
74
|
1. Config + `ark-check --strict-config` (dead preset globs advisory; unclassified files still fail strict).
|
|
75
75
|
2. Baseline policy (orphan empty file? wire or delete).
|
|
76
|
-
3.
|
|
76
|
+
3. Host-appropriate write path + `/ark-*` skills per detected agent.
|
|
77
77
|
4. CI workflow + monorepo install reality (`frontend/package.json`?).
|
|
78
78
|
5. ESLint `arkgate/eslint` if ESLint exists.
|
|
79
79
|
6. Domain `forbiddenGlobals`.
|
|
@@ -37,7 +37,8 @@ the same files or weaken the gate.
|
|
|
37
37
|
(`pnpm … exec ark-check` / `yarn` / `npx`).
|
|
38
38
|
|
|
39
39
|
This also maintains snapshots under **`.ark/reports/`**:
|
|
40
|
-
- `origin.json` / `origin.html` — frozen **
|
|
40
|
+
- `origin.json` / `origin.html` — frozen **day-zero** report (`ark start`/`ark init`
|
|
41
|
+
freezes this **right after** `ark.config.json`, before agent docs/CI templates)
|
|
41
42
|
- `latest.json` / `latest.html` — every run
|
|
42
43
|
- `history/*.json` — last ~20 machine-readable points for later tooling
|
|
43
44
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-explore
|
|
3
|
-
description:
|
|
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.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /ark-explore — Recon the real project
|
|
7
7
|
|
|
8
8
|
You are a **staff engineer doing architecture reconnaissance** on *this* repository.
|
|
9
|
-
Ark’s CLI is a **sensor** (coverage, doctor, plan). **You** open source,
|
|
10
|
-
|
|
9
|
+
Ark’s CLI is a **sensor** (coverage, doctor, plan). **You** open source, entry points,
|
|
10
|
+
install hooks, examples/starters, and coupling evidence. Output is **decision-grade**:
|
|
11
|
+
ranked residual that changes the next command — **not** a celebration of ENFORCE and
|
|
12
|
+
**not** a paraphrase of README/ROADMAP.
|
|
11
13
|
|
|
12
14
|
Use alone when the user wants a map / options / “what should we do next?”.
|
|
13
15
|
`/ark-autopilot`, `/ark-coverage`, and `/ark-adopt` embed a lighter version of this pass.
|
|
@@ -17,17 +19,48 @@ Use alone when the user wants a map / options / “what should we do next?”.
|
|
|
17
19
|
- **Greenfield / thin tree:** `/ark-architect` or `ark-check --recommend` / `ark start`.
|
|
18
20
|
- **Brownfield:** `/ark-adopt` after the map (or hand off from explore STOP paths).
|
|
19
21
|
- **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
|
|
22
|
+
- **Execute dual plan + apply:** `/ark-autopilot` (explore is recon / seed, not the loop).
|
|
20
23
|
|
|
21
24
|
## Dual engine (mandatory)
|
|
22
25
|
|
|
23
26
|
| Engine | Role | Never confuse with |
|
|
24
27
|
|--------|------|--------------------|
|
|
25
28
|
| **Deterministic** | Contract truth: layers, rules, violations, `mechanical-safe` kinds, exit codes | Product vision or “good enough” |
|
|
26
|
-
| **Exploratory** | Your judgment from **reading this tree**: product surface, hotspots, false greens,
|
|
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 |
|
|
27
30
|
|
|
28
|
-
**Incomplete:** doctor/coverage dump with no file paths you opened
|
|
29
|
-
|
|
31
|
+
**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.
|
|
33
|
+
**Complete:** dry headline + field evidence + ranked bets with **así te lo re-soluciono**
|
|
34
|
+
(real paths, concrete next step, **success signal**) + honest handoff when residual is
|
|
35
|
+
*not* layer debt.
|
|
30
36
|
|
|
37
|
+
**ENFORCE / 100% governed / empty plan is baseline, not a finding.** Lead with residual
|
|
38
|
+
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`.
|
|
41
|
+
|
|
42
|
+
## Output mode (pick one — do not invent a third)
|
|
43
|
+
|
|
44
|
+
| Mode | When | Deliverable |
|
|
45
|
+
|------|------|-------------|
|
|
46
|
+
| **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.** |
|
|
48
|
+
|
|
49
|
+
**Forbidden in either mode:**
|
|
50
|
+
- A 6-phase / multi-week implementation roadmap as the default explore product.
|
|
51
|
+
- Phases with week estimates, long PR stacks, or vanity “Domain ≥ N files” as done criteria.
|
|
52
|
+
- Auto-applying anything (explore does not edit the contract or product code unless the user
|
|
53
|
+
separately asks to execute a bet).
|
|
54
|
+
|
|
55
|
+
**Dual-plan seed shape (mode 2 only):**
|
|
56
|
+
|
|
57
|
+
| Section | Content |
|
|
58
|
+
|---------|---------|
|
|
59
|
+
| **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 |
|
|
61
|
+
|
|
62
|
+
Long multi-PR execution plans belong to **`/ark-autopilot`** (or a human-owned doc after
|
|
63
|
+
the seed), not to explore by default.
|
|
31
64
|
|
|
32
65
|
## Subagent fan-out (optional, host-dependent)
|
|
33
66
|
|
|
@@ -46,63 +79,131 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
|
|
|
46
79
|
4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
|
|
47
80
|
5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
|
|
48
81
|
|
|
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).
|
|
85
|
+
|
|
49
86
|
## Anti-wrapper rule
|
|
50
87
|
|
|
51
|
-
**Forbidden:**
|
|
88
|
+
**Forbidden:**
|
|
89
|
+
- Only `ark-check --json` / `--coverage` / `--doctor` paraphrase.
|
|
90
|
+
- Echoing README / ROADMAP / marketing as if it were recon.
|
|
91
|
+
- Padding the ranked table with “architecture is clean” rows when the sensor already said that.
|
|
92
|
+
- 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.
|
|
95
|
+
- Multi-week roadmaps when mode is recon-only.
|
|
52
96
|
|
|
53
97
|
**Required:**
|
|
54
98
|
1. Sensor: `--coverage --json`, `--doctor`, optional `--plan --json` / normal check.
|
|
55
|
-
2. **Product + code pass**
|
|
56
|
-
3.
|
|
57
|
-
4.
|
|
99
|
+
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
|
+
3. **Field path** when scaffolds exist (see §E); for pure apps, **internal field path** (see §E).
|
|
101
|
+
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.
|
|
58
105
|
|
|
59
106
|
## Reconnaissance pass (do all that apply)
|
|
60
107
|
|
|
61
108
|
### A. Product surface (what the system is)
|
|
62
|
-
- README / package.json `description` / scripts / monorepo workspace roots.
|
|
63
|
-
- User-facing entry: Next/Nest/Express routes, CLIs, workers, public APIs.
|
|
109
|
+
- README / package.json `description` / scripts / monorepo workspace roots — **skim for entry points**, do not restate the pitch.
|
|
110
|
+
- User-facing entry: Next/Nest/Express routes, CLIs, workers, public APIs, package exports.
|
|
64
111
|
- Deploy shape if obvious (apps/, packages/, services/).
|
|
65
|
-
- One
|
|
112
|
+
- One dry line: **what a real user/agent gets** (not the slogan).
|
|
66
113
|
|
|
67
|
-
### B. Architecture as lived
|
|
114
|
+
### B. Architecture as lived — path-correct vs design-correct
|
|
68
115
|
- Map top dirs → intended layer vs what code *actually* does (UI, use-cases, I/O, pure domain).
|
|
69
|
-
-
|
|
116
|
+
- Classic false-green: empty Domain / Persistence while Application owns `airtable|supabase|prisma|repositories` → doctor id `contract-false-green-io-under-application`.
|
|
117
|
+
- **Semantic false-green** (edges green, names lie) — flag when you see it:
|
|
118
|
+
- HTTP handlers / route bodies living under `repositories/` or Persistence globs.
|
|
119
|
+
- Presentation/routes defaulting to a data facade (`platform/*`, raw db) while “repos exist”.
|
|
120
|
+
- Domain layer thin while pure business rules sit in Application with no I/O (should be Domain).
|
|
121
|
+
- Layer labels that match globs but not role (gate path-correct, design wrong).
|
|
70
122
|
- Framework guts vs product code (Nest modules, Next app router, generated clients).
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
123
|
+
- **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.
|
|
127
|
+
|
|
128
|
+
### C. Coupling & debt (measure, don’t guess)
|
|
129
|
+
Prefer evidence over aesthetics:
|
|
130
|
+
- **Fan-in / importers** of hot modules (who imports the suspect file?).
|
|
131
|
+
- **Export surface** (how many public symbols does the orchestration module re-export?).
|
|
132
|
+
- Import cycles, cross-feature leaks (`peerIsolation` candidates).
|
|
74
133
|
- Business rules in UI/hooks (`can*`, `calculate*`, policy constants) → Domain / intents.
|
|
75
|
-
- Dead or aspirational globs; layers with files but no rules.
|
|
134
|
+
- Dead or aspirational globs; layers with files but no rules; **starter/preset rules weaker than sibling archetypes** (soft green).
|
|
135
|
+
- LOC is a **hint** only — pair it with fan-in or export count before calling something a god module.
|
|
76
136
|
|
|
77
|
-
### D. Agent / gate reality
|
|
137
|
+
### D. Agent / gate reality (installed vs generated)
|
|
78
138
|
- 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**.
|
|
140
|
+
- MCP config present and pointing at a real binary? `prepare-write` / autoPatch surface vs hook mode.
|
|
79
141
|
- Baseline: real debt or hiding contract smell?
|
|
80
|
-
|
|
81
|
-
|
|
142
|
+
- 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.)
|
|
144
|
+
|
|
145
|
+
### E. Field path (consumer promise or internal)
|
|
146
|
+
When `examples/`, `templates/`, gallery starters, eval fixtures, or docs claim “copy this and stay green”:
|
|
147
|
+
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.
|
|
149
|
+
3. Diff **rule strength** across archetypes (missing denies = soft false-green for consumers).
|
|
150
|
+
4. Note import style vs package surface docs (`arkgate` root barrel vs preferred subpath).
|
|
151
|
+
5. Flag **false promises**: demo fails under its own check, or green with a hollow contract.
|
|
152
|
+
|
|
153
|
+
If the repo is a **pure app** (no examples): state **Field path: internal** and do one of:
|
|
154
|
+
- 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.
|
|
156
|
+
|
|
157
|
+
### F. Suggestive bets (not commits yet)
|
|
82
158
|
For each opportunity: **impact × effort × enforceability** (can the gate hold it after?).
|
|
83
159
|
|
|
84
|
-
|
|
160
|
+
**Success signal (required per bet)** — observable, not vanity:
|
|
161
|
+
- Good: `doctor.writePath = repair`; `ark-check` green after promote; API + UI import same pure `computeX`; 0 new routes with facade SQL; pilot cluster migrated + kill-switch decision recorded.
|
|
162
|
+
- Bad: “Domain has ≥ N files”; “add layer X”; “more documentation”.
|
|
163
|
+
|
|
164
|
+
**Kill-switch (required if the bet adds a layer, peerIsolation wall, or big-bang move):**
|
|
165
|
+
- Name a **pilot** (one cluster) and a **stop condition** (e.g. “if pilot does not reduce confusion in 2 real PRs → prefer handlers-under-domain without a new layer”).
|
|
166
|
+
- Prefer **forward-only + migrate-on-touch** over big-bang.
|
|
167
|
+
|
|
168
|
+
Prefer bets the user can run next (`command` / skill), not vague “improve DX”.
|
|
169
|
+
|
|
170
|
+
## Output format (keep tight)
|
|
85
171
|
|
|
86
|
-
|
|
87
|
-
2. **Map** — entry points, major packages/dirs, shape name (or “no honest shape yet”).
|
|
88
|
-
3. **What I opened** — bullet list of paths (prove the explore pass).
|
|
89
|
-
4. **Ranked table**
|
|
172
|
+
State **Mode: recon | dual-plan seed** in the headline or first line.
|
|
90
173
|
|
|
91
|
-
|
|
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.
|
|
178
|
+
|
|
179
|
+
| # | Kind | Finding | Evidence (path) | Así te lo re-soluciono | Success signal | Next skill / command |
|
|
92
180
|
|
|
93
181
|
Kinds: `risk` | `false-green` | `debt` | `opportunity` | `shape` | `manifiesto` | `agent-dx`
|
|
94
182
|
|
|
95
|
-
|
|
183
|
+
**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.
|
|
185
|
+
|
|
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”).
|
|
96
188
|
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`.
|
|
97
189
|
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).
|
|
98
|
-
|
|
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.
|
|
193
|
+
|
|
194
|
+
Optional when useful: **Diff vs naive sensor-only read** (one short list: what reading the tree changed).
|
|
99
195
|
|
|
100
196
|
## Done criteria
|
|
101
197
|
|
|
102
|
-
- ≥12 source files read and cited.
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
198
|
+
- ≥12 source files read and cited across ≥4 directories.
|
|
199
|
+
- Field path: scaffolds run/opened **or** pure-app internal norm stated.
|
|
200
|
+
- At least **3 decision-grade** rows (not “fix violation X” and not “layers are clean”).
|
|
201
|
+
- 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**.
|
|
204
|
+
- 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`.
|
|
206
|
+
- No gate weakening; no false ENFORCE claim; no README echo as primary content.
|
|
106
207
|
|
|
107
208
|
## Completion contract (skill incomplete if missing)
|
|
108
209
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ark-runtime
|
|
3
|
-
description:
|
|
3
|
+
description: Evaluate the experimental Ark runtime kernel against hand-rolled event bus, outbox, audit, saga, projection, policy, or NestJS code. Finds one candidate, wires one, verifies.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# /ark-runtime —
|
|
6
|
+
# /ark-runtime — Evaluate the runtime kernel (experimental opt-in)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The runtime kernel is currently **experimental** and is not required for ArkGate enforcement or
|
|
9
|
+
presented as production-ready. Use this skill only when the user explicitly wants to evaluate it.
|
|
10
|
+
|
|
11
|
+
`arkgate` ships the experimental runtime kernel
|
|
9
12
|
(`createArkKernel`) with an event bus, event contracts, outbox, audit trail,
|
|
10
13
|
policy engine, workflow/saga coordination, projections, observability hooks,
|
|
11
14
|
and NestJS adapters. This skill migrates hand-rolled versions of those to the
|
|
@@ -43,12 +46,12 @@ the same files or weaken the gate.
|
|
|
43
46
|
2. **Pick ONE target** — the smallest, most self-contained candidate (fewest
|
|
44
47
|
call sites). Migrating everything at once is how adoptions die. List the
|
|
45
48
|
rest as follow-ups in the report.
|
|
46
|
-
3. **Migrate** — import from `arkgate` (
|
|
49
|
+
3. **Migrate** — import from `arkgate/runtime` (preferred experimental subpath) or
|
|
47
50
|
`arkgate/nestjs`, and read the package's `docs/agent-guide.md`
|
|
48
51
|
(in `node_modules/arkgate/docs/`) for the runtime API before
|
|
49
52
|
writing code. Wire the kernel at the composition root; keep the domain
|
|
50
53
|
ignorant of it (handlers/ports, not kernel imports inside domain code —
|
|
51
|
-
the
|
|
54
|
+
the architecture check enforces this; Claude/Grok hooks can block it earlier). Note: the kernel bounds in-memory
|
|
52
55
|
history by default (`maxHistorySize` 1000); mention this if the hand-rolled
|
|
53
56
|
version retained everything.
|
|
54
57
|
4. **Delete the hand-rolled version** once call sites are moved — the point is
|