arkgate 4.2.1 → 4.4.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 +85 -3
- package/README.md +24 -8
- package/bin/ark-check-runtime.mjs +16 -1
- package/bin/ark-mcp-runtime.mjs +64 -0
- package/bin/ark.mjs +55 -1
- package/bin/lib/adapter-contract.mjs +88 -5
- package/bin/lib/agent-projection-command.mjs +396 -0
- package/bin/lib/agent-projection.mjs +319 -0
- package/bin/lib/agent-skills-package.mjs +266 -0
- package/bin/lib/baseline-key.mjs +32 -0
- package/bin/lib/ci-and-commands.mjs +55 -5
- package/bin/lib/diagnostic-catalog.mjs +155 -0
- package/bin/lib/doctor-plan.mjs +25 -0
- package/bin/lib/html-report-advisories.mjs +33 -0
- package/bin/lib/html-report-depth.mjs +24 -0
- package/bin/lib/improvement-compass-doctor.mjs +106 -0
- package/bin/lib/improvement-compass.mjs +630 -0
- package/bin/lib/status-command.mjs +369 -0
- package/bin/lib/status-manifest.mjs +431 -0
- package/dist/eslint/index.cjs +3 -3
- package/dist/eslint/index.js +3 -3
- package/dist/index.cjs +46 -11
- package/dist/index.d.ts +886 -6
- package/dist/index.js +46 -11
- package/docs/README.md +9 -8
- package/docs/agent-guide.md +128 -14
- package/docs/configuration.md +7 -0
- package/docs/develop.md +12 -1
- package/docs/diagnostics.md +606 -0
- package/docs/package-surface.md +44 -31
- package/docs/product-voice.md +71 -0
- package/docs/use.md +60 -1
- package/package.json +7 -1
- package/schemas/ark.analysis-result.schema.json +14 -1
- package/schemas/ark.status-manifest.schema.json +270 -0
- package/server.json +2 -2
- package/templates/agent-skills/README.md +59 -0
- package/templates/agent-skills/ark-adopt/SKILL.md +191 -0
- package/templates/agent-skills/ark-architect/SKILL.md +195 -0
- package/templates/agent-skills/ark-autopilot/SKILL.md +262 -0
- package/templates/agent-skills/ark-contract/SKILL.md +156 -0
- package/templates/agent-skills/ark-coverage/SKILL.md +187 -0
- package/templates/agent-skills/ark-explain/SKILL.md +230 -0
- package/templates/agent-skills/ark-explore/SKILL.md +397 -0
- package/templates/agent-skills/ark-fix/SKILL.md +205 -0
- package/templates/agent-skills/ark-loop/SKILL.md +200 -0
- package/templates/agent-skills/ark-place/SKILL.md +182 -0
- package/templates/agent-skills/ark-runtime/SKILL.md +127 -0
- package/templates/agent-skills/ark-think/SKILL.md +153 -0
- package/templates/agent-skills/ark-upgrade/SKILL.md +238 -0
- package/templates/skills/ark-adopt.md +20 -0
- package/templates/skills/ark-architect.md +21 -1
- package/templates/skills/ark-autopilot.md +25 -5
- package/templates/skills/ark-contract.md +20 -0
- package/templates/skills/ark-coverage.md +20 -0
- package/templates/skills/ark-explain.md +20 -0
- package/templates/skills/ark-explore.md +23 -3
- package/templates/skills/ark-fix.md +22 -2
- package/templates/skills/ark-loop.md +22 -2
- package/templates/skills/ark-place.md +20 -0
- package/templates/skills/ark-runtime.md +7 -0
- package/templates/skills/ark-think.md +20 -0
- package/templates/skills/ark-upgrade.md +20 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/arkgate@4/schemas/ark.status-manifest.schema.json",
|
|
4
|
+
"title": "ArkGate status manifest",
|
|
5
|
+
"description": "Unified session/project status snapshot for agents (identity, activation honesty, last check, rules counts, next action). Not a score.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schemaVersion",
|
|
10
|
+
"arkgateVersion",
|
|
11
|
+
"projectIdentity",
|
|
12
|
+
"activation",
|
|
13
|
+
"lastCheck",
|
|
14
|
+
"rules",
|
|
15
|
+
"nextAction"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schemaVersion": {
|
|
19
|
+
"const": "1.0"
|
|
20
|
+
},
|
|
21
|
+
"arkgateVersion": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"minLength": 1
|
|
24
|
+
},
|
|
25
|
+
"projectIdentity": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": [
|
|
29
|
+
"projectId",
|
|
30
|
+
"resolvedRoot",
|
|
31
|
+
"resolvedConfigPath",
|
|
32
|
+
"binding",
|
|
33
|
+
"authoritative"
|
|
34
|
+
],
|
|
35
|
+
"properties": {
|
|
36
|
+
"projectId": {
|
|
37
|
+
"anyOf": [
|
|
38
|
+
{
|
|
39
|
+
"type": "string",
|
|
40
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "null"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"resolvedRoot": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1
|
|
50
|
+
},
|
|
51
|
+
"resolvedConfigPath": {
|
|
52
|
+
"anyOf": [
|
|
53
|
+
{
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "null"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"binding": {
|
|
63
|
+
"enum": [
|
|
64
|
+
"matched",
|
|
65
|
+
"unverified",
|
|
66
|
+
"mismatch"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"authoritative": {
|
|
70
|
+
"type": "boolean"
|
|
71
|
+
},
|
|
72
|
+
"code": {
|
|
73
|
+
"enum": [
|
|
74
|
+
"PROJECT_ROOT_MISMATCH",
|
|
75
|
+
"PROJECT_ID_MISMATCH",
|
|
76
|
+
"INVALID_PROJECT_EXPECTATION"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"message": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"minLength": 1
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"activation": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"required": [
|
|
89
|
+
"writePath",
|
|
90
|
+
"host",
|
|
91
|
+
"honestLabel"
|
|
92
|
+
],
|
|
93
|
+
"properties": {
|
|
94
|
+
"writePath": {
|
|
95
|
+
"enum": [
|
|
96
|
+
"hard",
|
|
97
|
+
"advisory",
|
|
98
|
+
"unavailable"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"host": {
|
|
102
|
+
"anyOf": [
|
|
103
|
+
{
|
|
104
|
+
"type": "string",
|
|
105
|
+
"minLength": 1
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "null"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"honestLabel": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"minLength": 1
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"lastCheck": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"additionalProperties": false,
|
|
121
|
+
"required": [
|
|
122
|
+
"at",
|
|
123
|
+
"verdict",
|
|
124
|
+
"activeViolations",
|
|
125
|
+
"frozenResidual"
|
|
126
|
+
],
|
|
127
|
+
"properties": {
|
|
128
|
+
"at": {
|
|
129
|
+
"anyOf": [
|
|
130
|
+
{
|
|
131
|
+
"type": "string",
|
|
132
|
+
"minLength": 1
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"type": "null"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"verdict": {
|
|
140
|
+
"anyOf": [
|
|
141
|
+
{
|
|
142
|
+
"enum": [
|
|
143
|
+
"pass",
|
|
144
|
+
"fail",
|
|
145
|
+
"incomplete"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"type": "null"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"activeViolations": {
|
|
154
|
+
"anyOf": [
|
|
155
|
+
{
|
|
156
|
+
"type": "integer",
|
|
157
|
+
"minimum": 0
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"type": "null"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"frozenResidual": {
|
|
165
|
+
"anyOf": [
|
|
166
|
+
{
|
|
167
|
+
"type": "integer",
|
|
168
|
+
"minimum": 0
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"type": "null"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"rules": {
|
|
178
|
+
"type": "object",
|
|
179
|
+
"additionalProperties": false,
|
|
180
|
+
"required": [
|
|
181
|
+
"arkRulesLoaded",
|
|
182
|
+
"inventoried",
|
|
183
|
+
"underContract",
|
|
184
|
+
"frozenResidual"
|
|
185
|
+
],
|
|
186
|
+
"properties": {
|
|
187
|
+
"arkRulesLoaded": {
|
|
188
|
+
"type": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"inventoried": {
|
|
191
|
+
"anyOf": [
|
|
192
|
+
{
|
|
193
|
+
"type": "integer",
|
|
194
|
+
"minimum": 0
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"type": "null"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"underContract": {
|
|
202
|
+
"anyOf": [
|
|
203
|
+
{
|
|
204
|
+
"type": "integer",
|
|
205
|
+
"minimum": 0
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"type": "null"
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
"frozenResidual": {
|
|
213
|
+
"anyOf": [
|
|
214
|
+
{
|
|
215
|
+
"type": "integer",
|
|
216
|
+
"minimum": 0
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"type": "null"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"nextAction": {
|
|
226
|
+
"type": "object",
|
|
227
|
+
"additionalProperties": false,
|
|
228
|
+
"required": [
|
|
229
|
+
"id",
|
|
230
|
+
"summary"
|
|
231
|
+
],
|
|
232
|
+
"properties": {
|
|
233
|
+
"id": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"minLength": 1
|
|
236
|
+
},
|
|
237
|
+
"summary": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"minLength": 1
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"improvementCompass": {
|
|
244
|
+
"type": "object",
|
|
245
|
+
"description": "Optional thin improvement-compass residual ids (notAScore). Never a gate input; full lenses on doctor JSON.",
|
|
246
|
+
"additionalProperties": false,
|
|
247
|
+
"required": [
|
|
248
|
+
"schemaVersion",
|
|
249
|
+
"notAScore",
|
|
250
|
+
"topResidual"
|
|
251
|
+
],
|
|
252
|
+
"properties": {
|
|
253
|
+
"schemaVersion": {
|
|
254
|
+
"const": "1.0"
|
|
255
|
+
},
|
|
256
|
+
"notAScore": {
|
|
257
|
+
"const": true
|
|
258
|
+
},
|
|
259
|
+
"topResidual": {
|
|
260
|
+
"type": "array",
|
|
261
|
+
"items": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"minLength": 1
|
|
264
|
+
},
|
|
265
|
+
"maxItems": 15
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/pedroknigge/arkgate",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.4.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "arkgate",
|
|
14
|
-
"version": "4.
|
|
14
|
+
"version": "4.4.0",
|
|
15
15
|
"runtimeHint": "npx",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# ArkGate Agent Skills package
|
|
2
|
+
|
|
3
|
+
> **Generated layout (Agent Skills packaging).** Do not edit SKILL.md files here by hand.
|
|
4
|
+
> Author skill bodies in `templates/skills/<name>.md`, then run
|
|
5
|
+
> `npm run generate:agent-skills`. Drift: `npm run check:agent-skills`.
|
|
6
|
+
|
|
7
|
+
This directory is the **Agent Skills–compatible** packaging of the same **13**
|
|
8
|
+
`/ark-*` skills shipped as flat templates for Ark install. **No new skill names.**
|
|
9
|
+
|
|
10
|
+
Package version when last generated context: **arkgate@4.3.0**
|
|
11
|
+
Schema: agent-skills package contract `1.0`
|
|
12
|
+
|
|
13
|
+
## Skills (frozen catalog)
|
|
14
|
+
|
|
15
|
+
- `ark-adopt`
|
|
16
|
+
- `ark-architect`
|
|
17
|
+
- `ark-autopilot`
|
|
18
|
+
- `ark-contract`
|
|
19
|
+
- `ark-coverage`
|
|
20
|
+
- `ark-explain`
|
|
21
|
+
- `ark-explore`
|
|
22
|
+
- `ark-fix`
|
|
23
|
+
- `ark-loop`
|
|
24
|
+
- `ark-place`
|
|
25
|
+
- `ark-runtime`
|
|
26
|
+
- `ark-think`
|
|
27
|
+
- `ark-upgrade`
|
|
28
|
+
|
|
29
|
+
## Install — Ark (host write path + skill catalogs)
|
|
30
|
+
|
|
31
|
+
Preferred when you also want hooks/MCP/CI wiring:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx ark-check --install-agent-gates --skills-only --force
|
|
35
|
+
# or full host install (hooks + MCP + skills):
|
|
36
|
+
npx arkgate-check --install-agent-gates --tools claude,cursor,codex,grok,antigravity,opencode
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Install — skills ecosystem (`npx skills`)
|
|
40
|
+
|
|
41
|
+
From this package directory (checkout or `node_modules/arkgate`):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Local path (after npm install arkgate, or from a git checkout)
|
|
45
|
+
npx skills add ./templates/agent-skills
|
|
46
|
+
# or:
|
|
47
|
+
npx skills add ./node_modules/arkgate/templates/agent-skills
|
|
48
|
+
|
|
49
|
+
# GitHub tree (Agent Skills package root)
|
|
50
|
+
npx skills add https://github.com/pedroknigge/arkgate/tree/main/templates/agent-skills
|
|
51
|
+
|
|
52
|
+
# List without installing
|
|
53
|
+
npx skills add ./templates/agent-skills --list
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Skills are **process** depth (host judgment + routing). They are **not** enforcement.
|
|
57
|
+
Enforcement is `ark-check` / host write hooks / required CI (`--strict-merge`).
|
|
58
|
+
|
|
59
|
+
See [docs/agent-guide.md](../../docs/agent-guide.md#install-skills-ark-and-ecosystem).
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ark-adopt
|
|
3
|
+
description: Brownfield onboarding — match contract to real product code, classify ungoverned dirs, mine business rules, freeze only real debt, seed Shape dual-plan B for spaghetti residual. Deep source analysis required.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /ark-adopt — Bring Ark into an existing codebase
|
|
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**.
|
|
10
|
+
|
|
11
|
+
**Adopt is Align + Stabilize, then seed Shape.** Freezing debt without a pattern plan leaves
|
|
12
|
+
spaghetti “ENFORCE · design-weak”. Always end with dual-plan **B** seeds (or handoff explore)
|
|
13
|
+
when design smells remain after the contract is honest.
|
|
14
|
+
|
|
15
|
+
## 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
|
+
**Spaghetti → honest contract.** SoC/DIP false-green STOP paths in plain language; residual lenses stay Incomplete until mapped.
|
|
33
|
+
|
|
34
|
+
## When / not when
|
|
35
|
+
|
|
36
|
+
| Use `/ark-adopt` when… | Do **not** use it when… |
|
|
37
|
+
|------------------------|-------------------------|
|
|
38
|
+
| Existing messy repo; contract ≠ folders | Empty greenfield shape → `/ark-architect` |
|
|
39
|
+
| False-green / concentrated edge needs contract truth | Map-only without writing config/baseline → `/ark-explore` |
|
|
40
|
+
| Mine loose business rules into Domain / intents | Single violation fix → `/ark-fix` |
|
|
41
|
+
| Freeze **real** debt after contract is honest | Grind plan A only → `/ark-loop`; full apply loop → `/ark-autopilot` |
|
|
42
|
+
|
|
43
|
+
## Dual engine (mandatory)
|
|
44
|
+
|
|
45
|
+
| Engine | Role |
|
|
46
|
+
|--------|------|
|
|
47
|
+
| **Deterministic** | coverage, doctor, baseline, strict-config after edits |
|
|
48
|
+
| **Exploratory** | walk the real monorepo/app layout; reclassify; mine rules; suggest shape |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## MCP workspace binding (mandatory)
|
|
53
|
+
|
|
54
|
+
Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
|
|
55
|
+
workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
|
|
56
|
+
retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
|
|
57
|
+
`project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
|
|
58
|
+
uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
|
|
59
|
+
restart/retargeting is required. `ark://manifest` never satisfies this preflight.
|
|
60
|
+
|
|
61
|
+
## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
|
|
62
|
+
|
|
63
|
+
ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
|
|
64
|
+
|
|
65
|
+
| Plane | What it protects | Where it lives | Sensors / tools |
|
|
66
|
+
|-------|------------------|----------------|-----------------|
|
|
67
|
+
| **Layers** (inter-layer) | Who may import whom, capabilities, pure/forbiddenGlobals, peerIsolation | `ark.config.json` → `layers[]`, `rules[]` | graph check, baseline edges, doctor coverage % |
|
|
68
|
+
| **ArkRules** (intra-layer) | Structure inside a layer + domain invariants as data | `arkRules` map + `arkrules/<ExactLayerName>.json` | structure sensors, invariant coverage, `--rules-inventory`, doctor `rulesUnderContract` |
|
|
69
|
+
|
|
70
|
+
**Rules for every report / answer:**
|
|
71
|
+
1. Prefix each finding or next step with **`[Layer]`** or **`[ArkRules]`** (or a two-column table with those headers).
|
|
72
|
+
2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
|
|
73
|
+
3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
|
|
74
|
+
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).
|
|
75
|
+
5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Adopt + ArkRules
|
|
79
|
+
- After classify: emit or refresh `arkRules` for matched layers (exact names; generic mold for unknowns).
|
|
80
|
+
- Mine rules → inventory + propose invariants/structure; land via `/ark-contract`.
|
|
81
|
+
- Freeze baseline is **[Layer]** debt; inventory residual is **[ArkRules]** — report both.
|
|
82
|
+
|
|
83
|
+
## Subagent fan-out (optional, host-dependent)
|
|
84
|
+
|
|
85
|
+
When the user asks to go faster **or** the work naturally splits (multiple packages,
|
|
86
|
+
feature dirs, plan clusters), you **may** dispatch **subagents**:
|
|
87
|
+
|
|
88
|
+
| Host capability | Behavior |
|
|
89
|
+
|-----------------|----------|
|
|
90
|
+
| **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. |
|
|
91
|
+
| **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. |
|
|
92
|
+
|
|
93
|
+
**Rules:**
|
|
94
|
+
1. Give each subagent a **tight brief**: paths in scope, sensor commands allowed, deliverable shape (paths opened + findings JSON or bullets).
|
|
95
|
+
2. **No shared mutable files** across parallel writers.
|
|
96
|
+
3. STOP handoffs and dual-engine rules still apply in every agent.
|
|
97
|
+
4. Parent owns the **### Completion** block (union of **Opened**, single **Handoff**).
|
|
98
|
+
5. Do **not** use subagents to weaken the gate or invent `mechanical-safe` kinds.
|
|
99
|
+
|
|
100
|
+
## Related onboarding
|
|
101
|
+
|
|
102
|
+
- **Greenfield:** `/ark-architect` or `ark-check --recommend` / `ark start`.
|
|
103
|
+
- **Brownfield:** `/ark-adopt` — match contract to reality; do not force a starter preset.
|
|
104
|
+
- **Deep map only:** `/ark-explore`.
|
|
105
|
+
- **Default path:** `ark start` → `/ark-autopilot` → `ark-check --doctor`.
|
|
106
|
+
|
|
107
|
+
## Anti-wrapper rule (mandatory)
|
|
108
|
+
|
|
109
|
+
**Forbidden:** only running `--init` / `--update-baseline` / coverage JSON without reading the tree.
|
|
110
|
+
|
|
111
|
+
**Required:**
|
|
112
|
+
1. CLI sensor: `--coverage --json`, check `--json` (`summary`), doctor.
|
|
113
|
+
2. **Product map** — what ships, which apps/packages, entry routes/CLIs.
|
|
114
|
+
3. **Read real source** in largest ungoverned dirs and top import edges (min **12 files**
|
|
115
|
+
across **≥4 dirs**).
|
|
116
|
+
4. **“Así te lo re-soluciono”** — concrete layer globs, file moves, manifest/intent proposals.
|
|
117
|
+
5. **Suggestive burn-down** — ranked next steps after adopt (not only “baseline done”).
|
|
118
|
+
6. Never freeze a concentrated edge without investigating contract smell / false-green.
|
|
119
|
+
|
|
120
|
+
## Guiding principle
|
|
121
|
+
|
|
122
|
+
Ark protects the **boundary around** a framework, not its internals. Nest/DI public surface = one layer; internals black box.
|
|
123
|
+
|
|
124
|
+
## Steps
|
|
125
|
+
|
|
126
|
+
1. **Config** — missing → `ark-check --init` (detection). Keep existing unless asked to regenerate.
|
|
127
|
+
If the tree is `src/features` + `shared`/`lib` **without** FSD `entities`/`widgets`, prefer
|
|
128
|
+
`vertical-slice` (or pack `enthusiast-vertical-slice`) — do **not** force hexagonal.
|
|
129
|
+
If `src/contexts` or `src/bounded-contexts` exists, prefer `ddd-bounded-contexts`.
|
|
130
|
+
**Next.js:** `app/api/**` / `pages/api/**` (and route-group `app/(…)/api/**`) default to
|
|
131
|
+
**ApplicationOrchestration**, not Presentation — do not reclassify API shells as UI.
|
|
132
|
+
2. **Check + diagnose** — `summary.concentrated` / dominant edge → fix contract first, don’t freeze.
|
|
133
|
+
Cross-slice / cross-context `peerIsolation` hits are judgment: extract shared or events.
|
|
134
|
+
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).
|
|
135
|
+
Empty Domain/Persistence + I/O under Application → false-green.
|
|
136
|
+
**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`.
|
|
137
|
+
3. **Classify ungoverned** — use coverage `suggestions` **plus** dirs you discovered by reading;
|
|
138
|
+
add layers/patterns via `/ark-contract`.
|
|
139
|
+
4. **Mine business rules → manifiesto** (model job — this is why the skill exists):
|
|
140
|
+
- Scan for loose domain: validators, pricing/policy functions, `can*`/`calculate*`, magic business constants, publish/intent strings, logic in UI/hooks that belongs in Domain.
|
|
141
|
+
- **ArkRules inventory (AR13):** run `ark-check --rules-inventory --json` for deterministic candidates
|
|
142
|
+
(validation-in-controller, magic constants, anemic entities). Counts are **not a score**.
|
|
143
|
+
- Propose: Domain files, `intentPrefixes`, intent names (`Domain.*` / `Application.*`), kernel `defineIntent` stubs if runtime is used;
|
|
144
|
+
land structure/invariant entries under `arkrules/<Layer>.json` via `/ark-contract` (ADR 0015 routing).
|
|
145
|
+
- Apply config through `/ark-contract` discipline; move pure rules into Domain when safe; validate with ark-check.
|
|
146
|
+
- Deliver section **“Así te lo re-soluciono en el manifiesto”** with before/after contract snippets.
|
|
147
|
+
5. **Freeze only real debt** — `--update-baseline` (zero debt → **no empty baseline file** left behind).
|
|
148
|
+
6. **Gates + skills** — `--install-agent-gates` (CI monorepo-aware when `frontend/package.json` exists).
|
|
149
|
+
7. **Ratchet + Shape seed (mandatory exploratory close)** — after freeze/gates:
|
|
150
|
+
- Name phase: **Align** (contract honesty) → **Stabilize** (baseline real) → **Shape** (golden pattern).
|
|
151
|
+
- If plan A is empty but the tree still shows concurrent patterns, god modules, facade SQL,
|
|
152
|
+
domain logic in UI, or semantic false-green: emit **dual-plan B** (3–5 bets) with pilot,
|
|
153
|
+
success signal, kill-switch, and extraction cards for I/O moves — same bar as `/ark-explore` §G.
|
|
154
|
+
- Do **not** claim “adopt complete / healthy” solely because the check is green.
|
|
155
|
+
- Prefer handoff `/ark-autopilot` for B execution with user ok, or `/ark-explore` shape-focus
|
|
156
|
+
if the user only wanted a plan.
|
|
157
|
+
|
|
158
|
+
## Operating modes
|
|
159
|
+
|
|
160
|
+
Explain modes as **detected stages** (Setup / Align / Guard), not user settings.
|
|
161
|
+
**Guard on the contract ≠ Shape done.** Say `ENFORCE · design-weak` when B residual remains.
|
|
162
|
+
|
|
163
|
+
## Verify
|
|
164
|
+
|
|
165
|
+
`ark-check --root . --config ark.config.json --strict-config` (+ baseline only if non-empty file retained).
|
|
166
|
+
Report: governed% before/after, files written, frozen count, false positives avoided, manifest/intent
|
|
167
|
+
proposals applied or deferred, **phase**, **top Shape / design-weak opportunities still open**
|
|
168
|
+
(with success signals).
|
|
169
|
+
|
|
170
|
+
## Never
|
|
171
|
+
|
|
172
|
+
- Freeze false positives to get green.
|
|
173
|
+
- Force runtime kernel over existing Nest/DI.
|
|
174
|
+
- Claim Enforce while governed% is low, cores empty with I/O in Application, or core bags ungoverned.
|
|
175
|
+
- End adopt with only “baseline written” when design-weak residual is visible in files you opened.
|
|
176
|
+
|
|
177
|
+
## Completion contract (skill incomplete if missing)
|
|
178
|
+
|
|
179
|
+
End with **exactly** these headings (markdown `###`):
|
|
180
|
+
|
|
181
|
+
### Completion
|
|
182
|
+
- **Sensor:** commands/tools run
|
|
183
|
+
- **Opened:** real paths read (or `n/a` only if pure install/upgrade with no source analysis)
|
|
184
|
+
- **Result:** one-line outcome
|
|
185
|
+
- **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
|
|
186
|
+
- **Compass:** top residual lenses | `n/a`
|
|
187
|
+
- **Handoff:** `/ark-…` / CLI / `none`
|
|
188
|
+
- **Incomplete?** `no` | `yes — <what is missing>`
|
|
189
|
+
|
|
190
|
+
If a **STOP** handoff applies and you continued as if done, set **Incomplete?** to `yes`.
|
|
191
|
+
**Skill incomplete if missing** any of the bullets above.
|