arkgate 4.1.1 → 4.2.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +81 -3
  2. package/README.md +15 -4
  3. package/bin/ark-check-runtime.mjs +16 -5
  4. package/bin/ark-mcp-runtime.mjs +766 -64
  5. package/bin/lib/agent-gates.mjs +1 -0
  6. package/bin/lib/ci-and-commands.mjs +16 -7
  7. package/bin/lib/codex-home.mjs +90 -8
  8. package/bin/lib/design-smells.mjs +71 -9
  9. package/bin/lib/doctor-plan.mjs +36 -36
  10. package/bin/lib/effective-contract-load.mjs +73 -9
  11. package/bin/lib/enforcement-state.mjs +1 -1
  12. package/bin/lib/gate-files.mjs +441 -9
  13. package/bin/lib/github-enforcement.mjs +16 -3
  14. package/bin/lib/hook-templates.mjs +12 -11
  15. package/bin/lib/html-report-evolution.mjs +114 -0
  16. package/bin/lib/html-report.mjs +11 -89
  17. package/bin/lib/import-resolve.mjs +33 -11
  18. package/bin/lib/install-activation.mjs +87 -0
  19. package/bin/lib/install-migrate.mjs +66 -50
  20. package/bin/lib/managed-upgrade.mjs +10 -41
  21. package/bin/lib/mcp-adoption.mjs +15 -5
  22. package/bin/lib/pilot-loop.mjs +25 -8
  23. package/bin/lib/project-identity.mjs +103 -0
  24. package/bin/lib/report-snapshot-context.mjs +28 -0
  25. package/bin/lib/resident-hook.mjs +33 -9
  26. package/bin/lib/rules-inventory.mjs +100 -8
  27. package/bin/lib/skill-install.mjs +272 -22
  28. package/bin/lib/skill-write.mjs +899 -0
  29. package/bin/lib/start-preview.mjs +84 -1
  30. package/bin/lib/upgrade-command.mjs +2 -5
  31. package/dist/index.cjs +13 -13
  32. package/dist/index.d.ts +194 -2
  33. package/dist/index.js +13 -13
  34. package/docs/README.md +5 -3
  35. package/docs/agent-guide.md +110 -14
  36. package/docs/ai-gates.md +103 -18
  37. package/docs/assets/ark-write-gate.svg +2 -2
  38. package/docs/enthusiast/how-to-agent-gates.md +6 -0
  39. package/docs/package-surface.md +14 -9
  40. package/docs/product-voice.md +13 -1
  41. package/package.json +3 -1
  42. package/schemas/ark.project-identity.schema.json +116 -0
  43. package/server.json +2 -2
  44. package/templates/skills/ark-adopt.md +9 -0
  45. package/templates/skills/ark-architect.md +12 -2
  46. package/templates/skills/ark-autopilot.md +9 -0
  47. package/templates/skills/ark-contract.md +11 -1
  48. package/templates/skills/ark-coverage.md +9 -0
  49. package/templates/skills/ark-explain.md +13 -1
  50. package/templates/skills/ark-explore.md +9 -0
  51. package/templates/skills/ark-fix.md +10 -1
  52. package/templates/skills/ark-loop.md +11 -2
  53. package/templates/skills/ark-place.md +17 -6
  54. package/templates/skills/ark-runtime.md +8 -0
  55. package/templates/skills/ark-think.md +14 -2
  56. package/templates/skills/ark-upgrade.md +9 -0
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json",
4
+ "title": "ArkGate MCP project identity",
5
+ "description": "Stable project binding plus separate runtime and architecture-contract evidence.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schemaVersion",
10
+ "projectId",
11
+ "resolvedRoot",
12
+ "resolvedConfigPath",
13
+ "arkgateVersion",
14
+ "contractHash",
15
+ "contractSource",
16
+ "runtimeId",
17
+ "processStartedAt"
18
+ ],
19
+ "properties": {
20
+ "schemaVersion": {
21
+ "const": "1.0"
22
+ },
23
+ "projectId": {
24
+ "type": "string",
25
+ "pattern": "^sha256:[a-f0-9]{64}$"
26
+ },
27
+ "resolvedRoot": {
28
+ "type": "string",
29
+ "minLength": 1
30
+ },
31
+ "resolvedConfigPath": {
32
+ "type": "string",
33
+ "minLength": 1
34
+ },
35
+ "arkgateVersion": {
36
+ "type": "string",
37
+ "minLength": 1
38
+ },
39
+ "contractHash": {
40
+ "type": "string",
41
+ "pattern": "^sha256:[a-f0-9]{64}$"
42
+ },
43
+ "contractSource": {
44
+ "enum": [
45
+ "project",
46
+ "default-profile",
47
+ "manifest"
48
+ ]
49
+ },
50
+ "runtimeId": {
51
+ "type": "string",
52
+ "minLength": 1
53
+ },
54
+ "processStartedAt": {
55
+ "type": "string",
56
+ "format": "date-time"
57
+ }
58
+ },
59
+ "$defs": {
60
+ "expectation": {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "properties": {
64
+ "expectedRoot": {
65
+ "type": "string",
66
+ "minLength": 1,
67
+ "description": "Absolute expected workspace/project directory. The initial authoritative handshake requires the exact project root; descendant calls also require expectedProjectId."
68
+ },
69
+ "expectedProjectId": {
70
+ "type": "string",
71
+ "pattern": "^sha256:[a-f0-9]{64}$",
72
+ "description": "Project id previously returned by ark_identity or ark_manifest."
73
+ }
74
+ }
75
+ },
76
+ "binding": {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": [
80
+ "status",
81
+ "authoritative"
82
+ ],
83
+ "properties": {
84
+ "status": {
85
+ "enum": [
86
+ "matched",
87
+ "unverified",
88
+ "mismatch"
89
+ ]
90
+ },
91
+ "authoritative": {
92
+ "type": "boolean"
93
+ },
94
+ "expectedRoot": {
95
+ "type": "string",
96
+ "minLength": 1
97
+ },
98
+ "expectedProjectId": {
99
+ "type": "string",
100
+ "pattern": "^sha256:[a-f0-9]{64}$"
101
+ },
102
+ "code": {
103
+ "enum": [
104
+ "PROJECT_ROOT_MISMATCH",
105
+ "PROJECT_ID_MISMATCH",
106
+ "INVALID_PROJECT_EXPECTATION"
107
+ ]
108
+ },
109
+ "message": {
110
+ "type": "string",
111
+ "minLength": 1
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
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.1.1",
9
+ "version": "4.2.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "arkgate",
14
- "version": "4.1.1",
14
+ "version": "4.2.0",
15
15
  "runtimeHint": "npx",
16
16
  "transport": {
17
17
  "type": "stdio"
@@ -30,6 +30,15 @@ when design smells remain after the contract is honest.
30
30
 
31
31
 
32
32
 
33
+ ## MCP workspace binding (mandatory)
34
+
35
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
36
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
37
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
38
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
39
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
40
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
41
+
33
42
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
34
43
 
35
44
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -31,6 +31,15 @@ The CLI is a **sensor**, never the whole job. Claiming done without the explorat
31
31
 
32
32
 
33
33
 
34
+ ## MCP workspace binding (mandatory)
35
+
36
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
37
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
38
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
39
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
40
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
41
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
42
+
34
43
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
35
44
 
36
45
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -71,8 +80,9 @@ the same files or weaken the gate.
71
80
 
72
81
  ## Steps
73
82
 
74
- 1. **Detect the shape** — call MCP tool **`ark_recommend`** (or run
75
- `ark-check --recommend --json`). Read `archetype`, `preset`, `confidence`,
83
+ 1. **Bind and detect the shape** — complete the mandatory `ark_identity` preflight first, then
84
+ call MCP tool **`ark_recommend`** with the bound `project` envelope (or run the workspace-local
85
+ `ark-check --recommend --json`). Never use an unverified recommendation. Read `archetype`, `preset`, `confidence`,
76
86
  `adoptInOrder.phase1`, `analogy`, `why`, `evidence`, and `requiresConfirmation`.
77
87
  Ask at most **two** questions only if `requiresConfirmation` is true (or for compatibility
78
88
  with older ArkGate output, `confidence < 0.5`):
@@ -65,6 +65,15 @@ decision-grade explore pass **and** without opening violating files.
65
65
 
66
66
 
67
67
 
68
+ ## MCP workspace binding (mandatory)
69
+
70
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
71
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
72
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
73
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
74
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
75
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
76
+
68
77
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
69
78
 
70
79
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -13,7 +13,8 @@ description: Safely edit ark.config.json layers/rules and arkrules/* (structure
13
13
  | Concentrated-edge / false-green STOP from other skills | Full map without config edit → `/ark-explore` |
14
14
 
15
15
  The **one sanctioned way** to change layers/rules/`intentPrefixes`/includes.
16
- Also used to **land mined business rules** into the executable manifest (`ark.config.json` + intent naming that `ark://manifest` exposes).
16
+ Also used to **land mined business rules** into the executable manifest (`ark.config.json` +
17
+ intent naming that the project-bound `ark_manifest` tool exposes authoritatively).
17
18
 
18
19
 
19
20
  ## Dual engine (mandatory)
@@ -27,6 +28,15 @@ The CLI is a **sensor**, never the whole job. Claiming done without the explorat
27
28
 
28
29
 
29
30
 
31
+ ## MCP workspace binding (mandatory)
32
+
33
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
34
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
35
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
36
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
37
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
38
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
39
+
30
40
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
31
41
 
32
42
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -43,6 +43,15 @@ If you did not open source files, the skill is **not complete**.
43
43
  Full recon + pattern planning: `/ark-explore`.
44
44
 
45
45
 
46
+ ## MCP workspace binding (mandatory)
47
+
48
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
49
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
50
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
51
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
52
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
53
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
54
+
46
55
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
47
56
 
48
57
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -27,6 +27,15 @@ The CLI is a **sensor**, never the whole job. Claiming done without the explorat
27
27
 
28
28
 
29
29
 
30
+ ## MCP workspace binding (mandatory)
31
+
32
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
33
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
34
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
35
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
36
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
37
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
38
+
30
39
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
31
40
 
32
41
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -146,7 +155,10 @@ when residual signals remain.
146
155
 
147
156
  ## Spoken / written explanation
148
157
 
149
- 1. **Load the real contract**: `ark.config.json`, `ark://manifest` if available, `AGENTS.md`.
158
+ 1. **Load the real contract**: `ark.config.json`, `AGENTS.md`, and—when MCP is available
159
+ `ark_identity` with the exact project root followed by `ark_manifest` with the same root plus
160
+ returned project id. `ark://manifest` is compatibility-only and always
161
+ unverified/non-authoritative.
150
162
  2. **If asked generally** ("explain the architecture"), produce a guided tour:
151
163
  - Operating mode + governed% (honest: low coverage means green checks almost nothing).
152
164
  - Each major layer: name, purpose, one real file from this repo, file count if known.
@@ -68,6 +68,15 @@ that still matters (dogfood gaps, soft starters, identity drift, **semantic fals
68
68
  say so in one line and hand off `stop`.
69
69
 
70
70
 
71
+ ## MCP workspace binding (mandatory)
72
+
73
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
74
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
75
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
76
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
77
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
78
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
79
+
71
80
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
72
81
 
73
82
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -52,6 +52,15 @@ Next: re-run ark-check; shrink baseline if applicable
52
52
 
53
53
 
54
54
 
55
+ ## MCP workspace binding (mandatory)
56
+
57
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
58
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
59
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
60
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
61
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
62
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
63
+
55
64
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
56
65
 
57
66
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -129,7 +138,7 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
129
138
  If the “fix” is really a missing business intent or Domain home for a rule:
130
139
 
131
140
  - Propose intent name + layer placement.
132
- - Register / place code so `ark://manifest` / config can enforce it.
141
+ - Register / place code so `ark_manifest` / config can enforce it.
133
142
  - Do not only delete the import.
134
143
 
135
144
  ## Rules
@@ -42,6 +42,15 @@ Pattern bets always have `neverMechanicalSafe: true` — extraction cards only
42
42
 
43
43
 
44
44
 
45
+ ## MCP workspace binding (mandatory)
46
+
47
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
48
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
49
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
50
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
51
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
52
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
53
+
45
54
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
46
55
 
47
56
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -120,8 +129,8 @@ you may run **that one pilot** — never more:
120
129
  card: respect the explicit record and do not reconstruct it from raw facts. Read a live card's
121
130
  `pilotTarget`, `decisionTarget`, `moveSample`/`movesTotal`, `successSignal`, `killSwitch`, `doNot[]`.
122
131
  2. Moves are **proposed only** — enumerate the full move set for the pilot anchor, express it as
123
- an architecture change map, and validate through the atomic preflight (`ark_prepare_change` /
124
- the write gate) **before** any file moves. A move the preflight rejects is a finding, not a
132
+ an architecture change map, and validate through the atomic preflight (`ark_prepare_change`
133
+ with the matched `project` envelope / the write gate) **before** any file moves. A move the preflight rejects is a finding, not a
125
134
  thing to force.
126
135
  3. Never move anything under `app/` or `pages/` (fixed by framework convention). Never merge
127
136
  files here — merges are judgment cards for `/ark-architect` / `/ark-fix`.
@@ -36,6 +36,15 @@ The CLI is a **sensor**, never the whole job. Claiming done without the explorat
36
36
 
37
37
 
38
38
 
39
+ ## MCP workspace binding (mandatory)
40
+
41
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
42
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
43
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
44
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
45
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
46
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
47
+
39
48
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
40
49
 
41
50
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -66,16 +75,18 @@ the same files or weaken the gate.
66
75
 
67
76
  ## Steps
68
77
 
69
- 1. **Read the contract, not your intuition.** If the `ark` MCP server is available,
70
- call the **`ark_place`** tool with the target file path — it returns the layer,
78
+ 1. **Read the contract, not your intuition.** If the `ark` MCP server is available, complete
79
+ the mandatory `ark_identity` preflight first, then call **`ark_place`** with the target file
80
+ path and bound `project` envelope — it returns the layer,
71
81
  its forbidden globals, and exactly which layers the file may / must not import,
72
82
  straight from the contract (no guessing). When present, also honor optional
73
83
  **`goldenPattern`** (from `.ark/golden-pattern.json`) for **NEW code only** —
74
84
  advisory layout norm; never overrides the gate and never clears design-weak.
75
- Absent golden is normal. Otherwise load `ark.config.json` and the
76
- `ark://manifest` MCP resource (it includes `suggestedLayers` with conventional
77
- directories for layers not yet adopted). The project's `AGENTS.md` placement table,
78
- if present, is authoritative too.
85
+ Absent golden is normal. Otherwise load `ark.config.json`; after the matched preflight,
86
+ `ark_manifest` with the same bound envelope includes `suggestedLayers` with conventional
87
+ directories for layers not yet adopted. The `ark://manifest` resource is compatibility-only and always
88
+ unverified/non-authoritative. The project's `AGENTS.md` placement table, if present, is
89
+ authoritative too.
79
90
  2. **Classify the artifact** by what it does, not what it's called:
80
91
  - Pure business rules/entities/value objects → domain-model layer.
81
92
  - When Domain ArkRules require private state / factories (`aggregate-private-state`,
@@ -24,6 +24,14 @@ one feature at a time.
24
24
 
25
25
  The CLI is a **sensor**, never the whole job. Claiming done without the exploratory bar for this skill is **incomplete**.
26
26
 
27
+ ## MCP workspace binding (mandatory)
28
+
29
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
30
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
31
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
32
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
33
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
34
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
27
35
 
28
36
  ## Out of scope for ArkRules
29
37
 
@@ -31,6 +31,15 @@ If you lack a product map and the tree is messy: run a **compressed** explore pa
31
31
  Never reason only from abstract hexagons. Open real modules before recommending a shape.
32
32
 
33
33
 
34
+ ## MCP workspace binding (mandatory)
35
+
36
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
37
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
38
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
39
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
40
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
41
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
42
+
34
43
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
35
44
 
36
45
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.
@@ -71,8 +80,11 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
71
80
 
72
81
  ## Steps
73
82
 
74
- 1. **Load the contract** — `ark.config.json`, MCP `ark://manifest` if available, and
75
- `ark-check --coverage --json` / `--doctor` for honesty about governed% and false-green.
83
+ 1. **Load the contract** — `ark.config.json`; when MCP is available, call `ark_identity` with
84
+ the exact project root followed by `ark_manifest` with the same root plus returned project
85
+ id. The `ark://manifest` resource is compatibility-only and always
86
+ unverified/non-authoritative. Use `ark-check --coverage --json` / `--doctor` for honesty
87
+ about governed% and false-green.
76
88
  2. **Touch the decision surface** — README skim + **≥5 source files** on the feature/package/boundary
77
89
  under discussion. Name paths in the answer.
78
90
  3. **Name the active shape** — which preset/archetype fits (hexagonal, vertical-slice,
@@ -20,6 +20,15 @@ check) and direct inspection of every managed file the preview will change.
20
20
  Neither signal replaces the other.
21
21
 
22
22
 
23
+ ## MCP workspace binding (mandatory)
24
+
25
+ Before any `ark_*` MCP tool, call `ark_identity` with `project.expectedRoot` set to the exact
26
+ workspace root. Continue only when `binding.status === "matched"` and `authoritative === true`;
27
+ retain `projectIdentity.projectId`, then pass both `expectedRoot` and `expectedProjectId` under
28
+ `project` on every later MCP call. If identity is missing, mismatched, unverified, or the root is
29
+ uncertain, do not consume MCP analysis: use the workspace-local CLI and report that MCP
30
+ restart/retargeting is required. `ark://manifest` never satisfies this preflight.
31
+
23
32
  ## Dual plane — layers + ArkRules (mandatory, except /ark-runtime)
24
33
 
25
34
  ArkGate has **two opt-in planes**. The user chooses which to use; you **always label** findings so they never blur.