arkgate 4.4.0 → 4.5.5

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 (52) hide show
  1. package/CHANGELOG.md +71 -2
  2. package/README.md +7 -4
  3. package/bin/ark-check-runtime.mjs +38 -13
  4. package/bin/ark-layer-match.mjs +25 -12
  5. package/bin/lib/adapter-contract.mjs +5 -5
  6. package/bin/lib/analysis-engine.mjs +5 -5
  7. package/bin/lib/ci-and-commands.mjs +5 -0
  8. package/bin/lib/deep-module-coach.mjs +177 -0
  9. package/bin/lib/deepening-coach.mjs +177 -0
  10. package/bin/lib/doctor-plan.mjs +14 -0
  11. package/bin/lib/html-report-advisories.mjs +33 -0
  12. package/bin/lib/html-report-depth.mjs +9 -0
  13. package/bin/lib/html-report.mjs +8 -1
  14. package/bin/lib/improvement-compass-map.mjs +507 -0
  15. package/bin/lib/improvement-compass-types.mjs +85 -0
  16. package/bin/lib/improvement-compass.mjs +10 -561
  17. package/bin/lib/managed-upgrade-honesty.mjs +201 -0
  18. package/bin/lib/managed-upgrade.mjs +54 -4
  19. package/bin/lib/remediation.mjs +5 -5
  20. package/bin/lib/status-command.mjs +127 -2
  21. package/bin/lib/status-manifest.mjs +163 -14
  22. package/bin/lib/upgrade-whats-new.mjs +110 -0
  23. package/dist/eslint/index.cjs +2 -2
  24. package/dist/eslint/index.js +2 -2
  25. package/dist/index.cjs +28 -28
  26. package/dist/index.d.ts +126 -21
  27. package/dist/index.js +28 -28
  28. package/docs/README.md +5 -5
  29. package/docs/agent-guide.md +50 -8
  30. package/docs/brownfield-adoption.md +12 -0
  31. package/docs/develop.md +3 -1
  32. package/docs/package-surface.md +8 -6
  33. package/docs/product-voice.md +25 -1
  34. package/docs/use.md +33 -0
  35. package/package.json +1 -1
  36. package/schemas/ark.status-manifest.schema.json +28 -1
  37. package/server.json +2 -2
  38. package/templates/agent-skills/README.md +2 -2
  39. package/templates/agent-skills/ark-adopt/SKILL.md +13 -0
  40. package/templates/agent-skills/ark-explore/SKILL.md +21 -0
  41. package/templates/agent-skills/ark-fix/SKILL.md +7 -0
  42. package/templates/agent-skills/ark-loop/SKILL.md +7 -0
  43. package/templates/agent-skills/ark-place/SKILL.md +7 -0
  44. package/templates/agent-skills/ark-think/SKILL.md +7 -0
  45. package/templates/agent-skills/ark-upgrade/SKILL.md +14 -0
  46. package/templates/skills/ark-adopt.md +13 -0
  47. package/templates/skills/ark-explore.md +21 -0
  48. package/templates/skills/ark-fix.md +7 -0
  49. package/templates/skills/ark-loop.md +7 -0
  50. package/templates/skills/ark-place.md +7 -0
  51. package/templates/skills/ark-think.md +7 -0
  52. package/templates/skills/ark-upgrade.md +14 -0
package/docs/README.md CHANGED
@@ -53,15 +53,15 @@ These are **not** the day-to-day product path. They stay in the repo for evidenc
53
53
  | Area | Path |
54
54
  |------|------|
55
55
  | Release notes (by version) | [releases/](releases/) · [CHANGELOG.md](../CHANGELOG.md) |
56
- | Epic plans (seeded + shipped) | [plans/](plans/) — maintainer seeds (e.g. improvement compass for **4.4.0**, agent contract surface for **4.3.0**). Product how-to stays in use/develop/agent-guide; plans are not required reading to use the package. |
56
+ | Epic plans (seeded + shipped) | [plans/](plans/) — maintainer seeds (e.g. deep-module coach post-4.5 **implemented, not published**; domain fitness & session truth for **4.5.0**; improvement compass for **4.4.0**; agent contract surface for **4.3.0**). Product how-to stays in use/develop/agent-guide; plans are not required reading to use the package. |
57
57
  | Claims audit | [audit/claims-matrix.md](audit/claims-matrix.md) |
58
58
  | Field adoption kit (scaffolding, not closed) | [field/](field/) |
59
59
  | Runtime hardening (experimental) | [production-hardening.md](production-hardening.md) |
60
60
 
61
- Current published: [releases/4.3.0.md](releases/4.3.0.md) (`arkgate@4.3.0` on npm `latest`).
62
- Next prepare: [releases/4.4.0.md](releases/4.4.0.md) (Status: prepared — not on npm until publish verify).
63
- Prior: [releases/4.2.1.md](releases/4.2.1.md) (`arkgate@4.2.1`).
64
- Previous: [releases/4.2.0.md](releases/4.2.0.md) (`arkgate@4.2.0`) · [releases/4.1.1.md](releases/4.1.1.md) (`arkgate@4.1.1`).
61
+ Current published: [releases/4.5.0.md](releases/4.5.0.md) (`arkgate@4.5.0` on npm `latest`).
62
+ Prepared next: [releases/4.5.5.md](releases/4.5.5.md) (`arkgate@4.5.5` — not on `latest` until publish).
63
+ Prior: [releases/4.4.0.md](releases/4.4.0.md) (`arkgate@4.4.0`).
64
+ Previous: [releases/4.3.0.md](releases/4.3.0.md) · [releases/4.2.1.md](releases/4.2.1.md) · [releases/4.2.0.md](releases/4.2.0.md) · [releases/4.1.1.md](releases/4.1.1.md).
65
65
  Previous major: [releases/4.0.0.md](releases/4.0.0.md) (`arkgate@4.0.0`).
66
66
  Config: [configuration.md](configuration.md) · Agent skills dual-plane: [agent-guide.md](agent-guide.md).
67
67
 
@@ -59,7 +59,46 @@ path is authoritative only when that matching project id is also supplied. Only
59
59
  `binding.status: "matched"` with `authoritative: true` is authoritative; calls that omit the
60
60
  expectation remain compatible but are explicitly `unverified`.
61
61
 
62
- ### Improvement compass (doctor)
62
+ ### Session recipe (agent turn)
63
+
64
+ Default loop for each agent session (product language — no inventing residual):
65
+
66
+ 1. **Bind identity** — call `ark_identity` with `project.expectedRoot` = exact absolute project
67
+ root. Reuse root + returned `projectId` on later tools. Only `binding.status: "matched"` with
68
+ `authoritative: true` is authoritative.
69
+ 2. **Read status** — `ark status --json` / MCP `ark_status` for identity, write-path activation,
70
+ last-check summary, residual lens ids (`improvementCompass`), and primary next action.
71
+ 3. **Act** — address residual / next action / stable `findingRef` from diagnostics. Never invent
72
+ green residual lenses. Projection, skills, and AGENTS.md never enforce.
73
+ 4. **Doctor when compass mode is not full** — if `improvementCompass.mode` is `subset` or
74
+ `unavailable`, run `ark-check --doctor` (and `--json` for the full 15-lens map) before treating
75
+ residual as complete. When mode is `full`, status residual ids are a subset of doctor residual
76
+ for the same facts.
77
+
78
+ ```bash
79
+ npx ark status --json --expected-root /abs/project/root
80
+ # mode !== full → full residual map:
81
+ npx ark-check --doctor --json
82
+ ```
83
+
84
+ Product path: [use.md — Session recipe](use.md#session-recipe-agent-turn).
85
+
86
+ ### Two-axis done recipe
87
+
88
+ Architecture residual and feature residual are **separate axes**. Never collapse them:
89
+
90
+ | Axis | Where truth lives | Done means |
91
+ |------|-------------------|------------|
92
+ | **1. Architecture residual** | `ark status` / `ark-check --doctor` / improvement compass (scan) | Edges honest under the contract; residual lenses / design-weak addressed or deliberately deferred |
93
+ | **2. Feature / ticket residual** | User brief, PR, tracker (process **outside** the package) | Requested behavior matches acceptance; product QA |
94
+
95
+ **Enforce green ≠ feature done.** Green edges (or quiet residual lenses) only clear axis 1.
96
+ Axis 2 is never a package LLM verdict or second scoreboard — agents and humans judge the ticket.
97
+
98
+ Optional Completion bullet for skills: **Done axes** — architecture residual | feature residual.
99
+ Compact router restates the same rule for day-zero installs.
100
+
101
+ ### Improvement compass (doctor + status)
63
102
 
64
103
  `ark-check --doctor` (human + `--json`) projects residual architecture work as a closed set of
65
104
  **lenses** (`doctor.improvementCompass`). Always `notAScore: true`. Never feeds `valid`,
@@ -67,17 +106,20 @@ strict-merge exit, or plan `goal.met`. Out-of-scope lenses (scalability, app sec
67
106
  full resilience) stay honest. Product path: [use.md — Improvement compass](use.md#improvement-compass-not-a-score).
68
107
  Package surface row: [package-surface.md](package-surface.md).
69
108
 
70
- **Status snapshot:** the status schema may carry a thin optional residual-id slice when Tooling
71
- passes it through, but **`ark status --json` does not compute the compass yet** — use doctor for
72
- residual lenses. Residual never changes status `nextAction` by itself.
109
+ **Status snapshot:** `ark status --json` / MCP `ark_status` project a thin `improvementCompass`
110
+ with explicit honesty **`mode`**: `full` \| `subset` \| `unavailable` (always `notAScore: true`).
111
+ Incomplete facts `subset` / `unavailable` + reason — **never invent green residual**. Residual
112
+ never flips gate verdicts and never alone rewrites status `nextAction` as a score. When mode is
113
+ not `full`, follow the [session recipe](#session-recipe-agent-turn) and run doctor.
73
114
 
74
115
  Compact router and skills read residual lenses in plain language; green edges alone are never
75
116
  “architecture finished” while residual remains.
76
117
 
77
- ### Unified status snapshot (4.3)
118
+ ### Unified status snapshot (4.3+)
78
119
 
79
120
  For one machine-readable session/project manifest (identity binding, honest write-path activation,
80
- last-check summary, rules residual counts, primary next action) use:
121
+ last-check summary, rules residual counts, primary next action, improvement-compass residual map)
122
+ use:
81
123
 
82
124
  ```bash
83
125
  npx ark status --json
@@ -87,8 +129,8 @@ npx ark status --json --expected-root /abs/project/root
87
129
 
88
130
  MCP parity tool: **`ark_status`** (same envelope; pass `project.expectedRoot` after `ark_identity`).
89
131
  Schema: `arkgate/schema/status-manifest`. Never prompts; under `CI=1` JSON is forced. **Not a
90
- score** — counts and verdicts only. Write-path interpretation of activation vs merge teeth is under
91
- [Write-path honesty](#write-path-honesty).
132
+ score** — counts, honesty modes, and residual ids only. Write-path interpretation of activation vs
133
+ merge teeth is under [Write-path honesty](#write-path-honesty).
92
134
 
93
135
  **Stable finding refs (4.3):** every factory-emitted diagnostic on CLI JSON, MCP analysis
94
136
  envelopes, and opt-in hook repair payloads (`ARK_REPAIR_JSON`) carries:
@@ -9,6 +9,18 @@ The rule underneath all of it: **`ark.config.json` is authoritative.** A green c
9
9
  governs 40% of the tree, or a baseline full of false positives, is worse than no gate — it
10
10
  looks safe. Report the truth, then fix it.
11
11
 
12
+ ### Domain glossary (process only)
13
+
14
+ If the repo already has a product/domain glossary, prefer those terms when naming layers,
15
+ slices, intents, and Shape pilots. Common root names (detect; none required):
16
+
17
+ - `CONTEXT.md`
18
+ - `docs/glossary.md` · `docs/domain.md` · `docs/ubiquitous-language.md` · `docs/CONTEXT.md`
19
+
20
+ Call out glossary language vs lived code when they disagree. **Missing glossary is normal** —
21
+ do not spam warnings and do not invent a glossary file. Glossary content never enforces; the
22
+ gate remains the contract + scan. Skills: `/ark-adopt`, `/ark-explore`.
23
+
12
24
  ## 1. Config — reflect what exists, propose the rest
13
25
 
14
26
  ```bash
package/docs/develop.md CHANGED
@@ -69,7 +69,9 @@ can show `runtimeObserved: true` even when branch-protection policy is plan-unav
69
69
  | Rules inventory (brownfield) | `arkgate-check --rules-inventory` · MCP `ark_rules_inventory` |
70
70
  | Stable package API | [package-surface.md](package-surface.md) |
71
71
  | Diagnostic codes (`ruleId` why/fix) | [diagnostics.md](diagnostics.md) · root `DIAGNOSTIC_CATALOG` |
72
- | Session / project status snapshot | `ark status --json` · MCP `ark_status` · [agent-guide](agent-guide.md) · schema `arkgate/schema/status-manifest` |
72
+ | Session / project status snapshot | `ark status --json` · MCP `ark_status` · [session recipe](agent-guide.md#session-recipe-agent-turn) · schema `arkgate/schema/status-manifest` |
73
+ | Status compass honesty | `improvementCompass.mode`: `full` \| `subset` \| `unavailable` · residual ⊆ doctor when `full` · [package-surface](package-surface.md) |
74
+ | Managed upgrade self-service | `ark upgrade --json` → `selfService` (activation labels + customized preserve) · [package-surface](package-surface.md) |
73
75
  | Version-matched AGENTS projection | `ark agents-md` · [agent-guide](agent-guide.md) · **non-authoritative** (never enforces) |
74
76
  | Stable finding refs (`findingRef` / `targetKey`) | analysis-result schema **1.5** · [agent-guide](agent-guide.md) · [package-surface](package-surface.md) |
75
77
  | Agent Skills layout (same 13 names) | `templates/agent-skills/` · [agent-guide](agent-guide.md#install-skills-ark-and-ecosystem) · `npx skills add …` |
@@ -18,7 +18,9 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
18
18
  |---------|----------------|-----------------|
19
19
  | **CLI** | `arkgate` / `arkgate-check` (aliases `ark` / `ark-check`) | Flags and human text may improve; **JSON output shapes** for `--json` (check, doctor, plan, coverage, recommend, **status**, **agents-md**) are stable within a major. Additive fields OK; removals/renames are major. From 4.2, `--require-gates` implies strict config and verifies semantic Ark AGENTS, project-rooted MCP/compact Codex registration, and fail-closed CI rather than file presence alone. `ark status --json` is the unified status snapshot. `ark agents-md` is the version-matched agent projection (non-authoritative). |
20
20
  | **Programmatic gate API** | `import { analyzeProject, loadContract, createAICodeGate, ... } from 'arkgate'` | The root export is the static gate/config/analysis contract listed below. It intentionally contains no runtime-kernel implementation. |
21
- | **Improvement compass (4.4)** | `ark-check --doctor --json` → `doctor.improvementCompass`; human doctor section **Improvement compass (not a score)**; HTML report `data-advisory="improvementCompass"`. Status schema accepts an optional thin `improvementCompass` residual-id slice for Tooling pass-through**`ark status` does not compute lenses yet**; agents should read doctor for residual. | Additive schema `1.0`. Closed **15** lens ids (`soc`, `cohesion`, `coupling`, `srp`, `dip`, `ocp`, `encapsulation`, `modularity`, `scalability`, `resilience`, `security`, `maintainability`, `testability`, `domain`, `stack`) with status `ok` \| `residual` \| `not-instrumented` \| `out-of-scope`, evidence refs, optional `nextAction`, capped `topResidual`, always **`notAScore: true`**. Projection from existing smells / walls / cohesion / ArkRules / design-weak only — **never** a gate input (`valid` / strict-merge / `goal.met` unchanged). Out-of-scope locked for scalability, resilience, and app security (no residual invent from missing SAST/APM). Root API: `buildImprovementCompass` / `IMPROVEMENT_LENS_IDS`. |
21
+ | **Improvement compass (4.4; status honesty 4.5)** | `ark-check --doctor --json` → `doctor.improvementCompass`; human doctor section **Improvement compass (not a score)**; HTML report `data-advisory="improvementCompass"`. **`ark status --json` / MCP `ark_status`** project a thin `improvementCompass` residual map with explicit honesty **`mode`**: `full` \| `subset` \| `unavailable` (always `notAScore: true`). When `mode` is `full`, status residual lens **ids** are a **subset of** doctor residual for the same facts (report snapshot stores the thin slice after `--report`). Incomplete or missing session facts → `subset` / `unavailable` + `reasonCode` / `reason` **never invent green residual**. Residual never flips `valid` / strict-merge / `goal.met`. When status mode full, run doctor for full 15-lens detail. | Additive schema `1.0`. Closed **15** lens ids (`soc`, `cohesion`, `coupling`, `srp`, `dip`, `ocp`, `encapsulation`, `modularity`, `scalability`, `resilience`, `security`, `maintainability`, `testability`, `domain`, `stack`) with status `ok` \| `residual` \| `not-instrumented` \| `out-of-scope`, evidence refs, optional `nextAction`, capped `topResidual`, always **`notAScore: true`**. Projection from existing smells / walls / cohesion / ArkRules / design-weak only — **never** a gate input. Out-of-scope locked for scalability, resilience, and app security (no residual invent from missing SAST/APM). Root API: `buildImprovementCompass` / `IMPROVEMENT_LENS_IDS`; status: `projectStatusImprovementCompass` / `STATUS_COMPASS_MODES`. |
22
+ | **Deep-module coach (post-4.5 advisory)** | `ark-check --doctor --json` → `doctor.deepModuleCoach`; human doctor section **Deep-module coach (advisory — not a score)** always when doctor runs (empty candidates / hot-path `unavailable` are honesty, not omission); HTML `data-advisory="deepModuleCoach"`. | Additive schema `1.0`. Always **`notAScore: true`**. **`hotPaths`**: recent-churn heuristic from bounded git log; `available` + `status` `ok` \| `unavailable`; empty `paths` when history missing/incomplete — **never invent**. **`deepeningCandidates`**: cards projected only from existing design smells / physical cohesion / reshape pilot / pilotLoop / residual compass lenses — **empty when no evidence** (no fake candidates). Never flips `valid`, strict-merge, completeness green, or `goal.met`. Prefer deep modules / named seams / test-at-public-interface process language in skills. Domain pure + CLI gen mirror (`deepeningCoach.ts` / `bin/lib/deepening-coach.mjs`); **not** a root package export — consume via `doctor.deepModuleCoach` (or the gen mirror in Tooling). |
23
+ | **Upgrade what’s new (4.5.5)** | `ark upgrade --json` → `whatsNew` (+ human **Suggested improvements** block). | Always **`notAScore: true`**, **`neverGateInput: true`**. Closed try/inspect list: deep-module coach, improvement compass, session/status honesty, two-axis done, self-service honesty. Never invents residual or flips gates. |
22
24
  | **Doctor design fitness** | `ark-check --doctor --json` → `doctor.designFitness`, `doctor.designSmells[]` | Additive. Stable smell `id`s: `io-under-application`, `handler-in-persistence`, `god-module`, `domain-logic-in-ui`, `facade-sql-in-routes`, `mixed-pattern-cluster`, `soft-contract`. `handler-in-persistence` covers static ES imports/re-exports of framework HTTP surfaces (`next/server`), `defineRoute` calls, and existing handler bodies inside Persistence-role layers or specific persistence paths; `require()` and dynamic `import()` are outside this narrow advisory, and a generic `Infrastructure` role alone is not Persistence. Persistence candidates are filtered and sorted before the bounded content scan so large application prefixes cannot hide the advisory. The detector inspects the first 800 sorted Persistence candidates; later candidates are uninspected, so **absence of a smell is not full-tree proof** above that envelope (incomplete/`partial` analysis also never proves “no smells”). **4.2 feedback hardening:** mode labels preserve the observed SUGGEST/ADAPT/ENFORCE state; a local permission/UI-state `canEdit` name alone is not a domain smell; real UI business rules route Domain → Application → UI; seed/fixture/demo/migration/generated files are not god-module pilots. Each smell has `evidence[]`, `fix`, technical `message`, and plain-language **`outcome`**. Does **not** fail the gate by itself. |
23
25
  | **Post-green Shape door** | `doctor.postGreenPath`, `doctor.primaryNextAction`, `doctor.healthyFinishedForbidden` | Additive when `designFitness.designWeak`. Single Shape door (`id: clarify-for-ai`): explore shape-focus → dual-plan B → autopilot only with OK. Never empty plan A = healthy finished. |
24
26
  | **Golden pattern (new code)** | Optional `.ark/golden-pattern.json`; doctor JSON `doctor.goldenPattern`; MCP `ark_place` / `ark_prepare_write` → `goldenPattern` | Additive, **advisory for NEW code only**. Required fields: `name`, `norm`; optional `newCodeHome`, `examplePath`, `schemaVersion`. **Absent is normal** (no claim). Never ENFORCE; never clears design-weak. Malformed → `invalid: true`, not silent guidance. |
@@ -40,6 +42,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
40
42
  | **ArkRules inventory / under-contract (4.0; layer context 4.2)** | `ark-check --rules-inventory [--json]`; doctor `rulesUnderContract`; MCP `ark_rules_inventory` | Additive. Honest counts (inventoried / under-contract / frozen) — **never a score**. When configured layer evidence exists it overrides filename role guesses: a Domain file named `handler` is not a controller candidate. Test/fixture/seed/migration/exclusion surfaces plus narrow development-identity, PostgreSQL OID, and technical I/O constants are silent. Without layer evidence, backward-compatible path/content heuristics remain. Structure/invariant diagnostics use adapter `1.4` provenance. |
41
43
  | **`arkgate/schema/project-identity`** or **`arkgate/schema/ark.project-identity.schema.json`** | MCP canonical project, contract, runtime, expectation, and binding envelope | Schema `1.0`. Initial `expectedRoot` must be the exact project root. A contained descendant can match only when `expectedProjectId` is also present and correct; id-only matching stays non-authoritative. Mismatch codes are `PROJECT_ROOT_MISMATCH`, `PROJECT_ID_MISMATCH`, and `INVALID_PROJECT_EXPECTATION`. |
42
44
  | **Package pin dual-truth (4.0)** | doctor JSON `packageVersionTruth`; upgrade JSON/human note when pin behind CLI | Additive, advisory. Surfaces after `upgrade --no-install` when managed CLI is ahead of package.json. |
45
+ | **Managed upgrade self-service honesty (4.5 / DF05)** | `ark upgrade [--json]` → `selfService` (+ human “Self-service honesty” lines) | Additive, advisory. Answers without a maintainer: write-path activation labels per selected host (`hard`\|`advisory`\|`unavailable`) and customized content-identity preserve (`customizedPaths` / `customizedContentPreserved`). Soft hosts never hard; upgrade never invents `hardWriteActive` from disk alone. Always `notAScore: true`. Not a gate input; not part of `planDigest`. |
43
46
  | **Product honesty readiness split (4.1.1)** | doctor JSON `productHonesty` | Additive. `unfinished` / `headline` / `primaryNextAction` / `reasonIds` remain; EH adds `contractReadiness` (`ready`\|`partial`\|`not-ready`), `localWriteBoundary` (`advisory`\|`hard`\|`unverified`\|`unknown`), `architectureReasonIds`, `environmentResidualIds` / `environmentResiduals`. Soft-write hosts stay in evidence without alone forcing global **Not finished**. `notAScore: true` always. |
44
47
  | **Policy transition analysis (3.1.0)** | `analyzePolicyDelta(...)`; MCP `ark_policy_delta`; CLI `--policy-base` / `--policy-base-ref` / `--policy-ack`; check JSON `policyDelta` | Additive schema `1.0`. Classifications and finding ids are deterministic. Weakening/judgment requires an acknowledgement bound to both policy hashes and the exact blocking finding set. |
45
48
  | **Atomic change preflight (3.1.0)** | `preflightChange(...)`; CLI `ark preflight --changes <file> --json`; MCP `ark_prepare_change` | Additive schema `1.0`. One complete governed production-source `{path,content}` / `{path,delete:true}` batch; read-only; returns operation, content/tree/policy/compiler fingerprints and stable graph findings. MCP availability alone is advisory. |
@@ -51,7 +54,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
51
54
  | **`arkgate/schema/analysis-result`** or **`arkgate/schema/ark.analysis-result.schema.json`** | Public CLI/MCP/hook diagnostic envelope (`schemaVersion`, `mode`, `valid`, `completeness`, `completenessReasons`, `diagnostics`, resolved identities) | Schema **`1.5`** adds optional stable finding refs on diagnostics: `findingRef` (`fnv1a-` + hex), `targetKey` (baseline-compatible freeze identity), `docsCodePath` (`docs/diagnostics.md#RULE_ID`). Factory-emitted diagnostics always include them; consumer-owned 1.0–1.4 values remain valid without them. `1.4` added optional `evidence.arkruleId` / `evidence.arkruleSource` for ArkRules; `1.3` distinguished `resolved-candidate-facts` from `lexical-compatibility`; partial/unavailable analysis is always non-green, and resolved complete/partial results require policy/resolver/facts/tree identities. `1.2` added completeness and remains accepted alongside consumer-owned 1.0/1.1 values. |
52
55
  | **Stable finding refs (4.3)** | Root API `adapterFindingTargetKey` / `adapterFindingRefFromTargetKey` / `toAdapterDiagnostic` / `createAdapterResult`; CLI/MCP/repair envelopes via analysis-result diagnostics | Multi-turn re-address without fuzzy message match. `targetKey` **is** the baseline (occurrence) key so freeze identity is never orphaned; `findingRef` is a compact FNV-1a of that key. Line/message drift does not change the ref. Multi-turn fixture: `tests/fixtures/finding-refs/multi-turn-stability.json`. |
53
56
  | **Diagnostic code catalog** | Root API `DIAGNOSTIC_CATALOG` / `getDiagnosticCatalogEntry` / `diagnosticDocsPath`; docs [diagnostics.md](diagnostics.md) (`#RULE_ID` anchors) | Closed vocabulary of public `ruleId`s with why/fix anchors. Cataloguing only — no new rule semantics. Remediation parity is test-guarded. Docs ship in the npm tarball. |
54
- | **Status manifest** | CLI `ark status [--json]`; MCP `ark_status`; `arkgate/schema/status-manifest`; root API `buildStatusManifest` / `ARK_STATUS_MANIFEST_SCHEMA` | Schema `1.0`. One session/project snapshot: identity binding, honest write-path activation (`hard`\|`advisory`\|`unavailable`), last-check summary, rules residual counts, primary next action. Optional thin `improvementCompass` residual ids when Tooling supplies them. **Not a score.** Never prompts (`CI=1` forces JSON). Optional `--expected-root` / `--expected-project-id` (MCP `project`) for matched vs stale identity. |
57
+ | **Status manifest** | CLI `ark status [--json]`; MCP `ark_status`; `arkgate/schema/status-manifest`; root API `buildStatusManifest` / `ARK_STATUS_MANIFEST_SCHEMA` / `projectStatusImprovementCompass` | Schema `1.0`. One session/project snapshot: identity binding, honest write-path activation (`hard`\|`advisory`\|`unavailable`), last-check summary, rules residual counts, primary next action, and **`improvementCompass`** with honesty **`mode`** `full`\|`subset`\|`unavailable` (residual ids only; always `notAScore: true`; optional `reasonCode`/`reason`/`factsSource`/`contractHash`). **Not a score.** Residual never changes gate verdicts. Never prompts (`CI=1` forces JSON). Optional `--expected-root` / `--expected-project-id` (MCP `project`) for matched vs stale identity. |
55
58
  | **Agent contract projection** | CLI `ark agents-md [--write] [--check] [--stdout] [--json]`; install/upgrade AGENTS templates; root API `buildAgentProjectionBlock` / `mergeAgentProjectionDocument` | Schema `1.0` (projection markers). Version-stamped managed block (`arkgateVersion` + contract summary + diagnostic short list). **Non-authoritative** — not a gate input; enforcement is ark-check / hooks / CI. Content-identity merge preserves customized regions outside markers. Drift: `--check` vs package version. |
56
59
  | **Agent Skills packaging** | `templates/agent-skills/<name>/SKILL.md` (+ package README); root API `ARK_SKILL_NAMES` / `validateAgentSkillsPackage`; `npm run check:agent-skills` | Schema `1.0` (package contract). Same **13** skill names as flat templates; Agent Skills–compatible layout for `npx skills add`. No new skill names. Layout is generated 1:1 from `templates/skills/*.md`. |
57
60
  | **`arkgate/schema/arkrules`** or **`arkgate/schema/ark.arkrules.schema.json`** | Per-layer structure sensors + invariant catalog (ADR 0012) | Schema `1.0`. Opt-in via root `arkRules` map (`ark.config` schema `1.1`). |
@@ -204,10 +207,9 @@ production deployment would need to satisfy; it is not a readiness certification
204
207
  ## Release notes (maintainers)
205
208
 
206
209
  Ship notes for a version live under [releases/](https://github.com/pedroknigge/arkgate/tree/main/docs/releases)
207
- (current published: [4.3.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.3.0.md);
208
- next prepare: [4.4.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.4.0.md);
209
-
210
- prior published: [4.2.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.1.md);
210
+ (current published: [4.5.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.0.md); prepared: [4.5.5.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.5.5.md);
211
+ prior published: [4.4.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.4.0.md), [4.3.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.3.0.md),
212
+ [4.2.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.1.md);
211
213
  previous: [4.2.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.0.md),
212
214
  [4.1.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.1.md),
213
215
  [4.1.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.0.md),
@@ -97,12 +97,28 @@ Examples:
97
97
  | **diagnostic code** / **ruleId** | Stable public violation id (e.g. `LAYER_IMPORT_VIOLATION`) with shared why/fix anchors — catalog-linked, not prose-only ([diagnostics.md](diagnostics.md)) |
98
98
  | **agent projection** | Version-matched AGENTS/CLAUDE (or equivalent) block generated from package + contract; **non-authoritative** — enforcement is ark-check / hooks / CI |
99
99
  | **finding ref** | Stable id for a finding across turns (ruleId + target key), so agents re-address without fuzzy message match |
100
- | **status snapshot** | One machine-readable project/session manifest (`ark status --json` shape): identity, activation honesty, last check, residual counts — not a numeric score |
100
+ | **status snapshot** | One machine-readable project/session manifest (`ark status --json` shape): identity, activation honesty, last check, residual counts, thin compass residual map — not a numeric score |
101
+ | **session recipe** | Agent loop: bind identity → read status → act on residual / findingRef; run doctor when status compass mode is not `full` |
102
+ | **compass mode** | Status honesty label for the projected residual map: `full` \| `subset` \| `unavailable` — never invent green residual |
101
103
  | **improvement compass** | Closed projection of residual architecture work across fixed **lenses** (aligned to 15 common principles). Always `notAScore`. Never a gate input. |
102
104
  | **lens** | One named principle dimension (`soc`, `dip`, `domain`, …) with status `ok` / `residual` / `not-instrumented` / `out-of-scope` and evidence refs from existing sensors |
103
105
  | **topResidual** | Deterministic short list of residual lens ids — what to improve next, not a ranking score |
104
106
  | **out-of-scope lens** | Principle Ark does not instrument (e.g. scalability APM, SAST) — say so; do not invent residual |
105
107
  | **AI-easy architecture** | Small, pure, placeable modules and a golden pattern so the next agent turn stays ordered under the contract |
108
+ | **self-service upgrade honesty** | After managed upgrade, consumers can see write-path activation labels and customized-content preserve without asking a maintainer |
109
+ | **module** | Anything with a surface callers depend on and an implementation behind it (function, package, slice) — not only a TypeScript `module` keyword |
110
+ | **interface** (product sense) | Everything a caller must know: types, invariants, errors, ordering, config — not only a TypeScript `interface` keyword |
111
+ | **depth** / **deep module** | Much behavior behind a **small interface** (deep) vs interface almost as complex as the body (shallow). Prefer deep modules. **Never** a 0–10 depth score |
112
+ | **seam** | Place where behavior can be swapped or tested without editing callers (port boundary). Name seams when proposing ports/adapters or Shape pilots |
113
+ | **adapter** | Concrete thing that satisfies an interface at a seam |
114
+ | **leverage** | Capability callers get per unit of interface they must learn |
115
+ | **locality** | Change, bugs, and verification concentrate in one place |
116
+ | **deletion test** | Process heuristic before extracting “just for tests”: if you delete the module and complexity *vanishes*, it was mostly pass-through; if complexity *reappears* across many callers, it was earning its keep. One adapter → seam still hypothetical; two real adapters → seam justified |
117
+ | **test at the public interface** | Prefer verifying behavior through the seam’s public surface, not through private pass-through layers or extraction-for-test-only modules |
118
+ | **hot path** (advisory) | Repo-relative path with elevated **recent change volume** (heuristic from git history when available). Advisory residual only — never a gate input; omit or mark unavailable when history is missing |
119
+ | **deepening candidate** (advisory) | Shape residual card projected only from **existing** smells / cohesion / compass evidence — locality/leverage intent; never invents candidates without evidence; never flips the verdict |
120
+ | **domain glossary** | Optional consumer file of product terms (common roots: `CONTEXT.md`, `docs/glossary.md`, `docs/domain.md`, `docs/ubiquitous-language.md`). Prefer terms for layer/slice/pilot naming when present. Missing glossary is normal — no warning spam; never enforces |
121
+ | **two-axis done** | (1) architecture residual via status/doctor/compass (scan); (2) feature/ticket residual outside the package (process). **Enforce green ≠ feature done** |
106
122
 
107
123
  ## Public docs are product-only (from 4.4.0)
108
124
 
@@ -158,6 +174,10 @@ gate → same binary verdict on every parity-capable adapter
158
174
  | Name scan before process | “Scan: two layer import violations. Process: fix the Application→Domain edge first.” |
159
175
  | Label projection non-enforcing | “Regenerated agent contract for this package version. Enforcement remains ark-check / hooks / required CI.” |
160
176
  | Keep status counts honest | “Inventory and residual counts are evidence — not a health score.” |
177
+ | Prefer deep modules | “Small interface, hide the complexity. Name the seam; test at the public interface.” |
178
+ | Apply the deletion test | “If deleting this extract would vanish the complexity, skip the pass-through; if callers re-absorb it, keep the module.” |
179
+ | Two-axis done | “Edges green and residual lenses quiet is architecture residual; ticket acceptance is a separate axis — Enforce green ≠ feature done.” |
180
+ | Glossary when present | “Prefer `CONTEXT.md` / product glossary terms for pilot and layer names; missing glossary is fine.” |
161
181
 
162
182
  ## Avoid
163
183
 
@@ -187,6 +207,10 @@ gate → same binary verdict on every parity-capable adapter
187
207
  | Treating AGENTS.md / projection / skills as the write gate | Advisory surface; hard path is hooks / MCP prepare / required CI |
188
208
  | Free-generated sensor or rule ids outside the catalog | Guardrail catalog is closed; unknown codes are a bug, not creativity |
189
209
  | Numeric “architecture health” or trust score in status JSON | Counts and residuals yes; scored trust no |
210
+ | Depth score / “deepness rank” / Excellent module bands | Depth is vocabulary for process judgment, not a score surface |
211
+ | Extract “just for tests” without a deletion test | Pass-through modules add interface without locality or leverage |
212
+ | Treat hot paths or deepening candidates as gate failures | Advisory residual only; missing git never invents hot paths |
213
+ | Claim feature done solely because Enforce is green | Two-axis done: architecture residual and ticket residual are separate |
190
214
 
191
215
  ---
192
216
 
package/docs/use.md CHANGED
@@ -87,6 +87,9 @@ list: [configuration.md](configuration.md).
87
87
 
88
88
  **Green edges ≠ elegant design.** Empty remediation plan is not “architecture finished” if design residual remains.
89
89
 
90
+ **Two-axis done:** (1) architecture residual via status/doctor/compass; (2) feature/ticket residual
91
+ outside the package. **Enforce green ≠ feature done.**
92
+
90
93
  ---
91
94
 
92
95
  ## When the gate is green but the code is still messy
@@ -105,6 +108,34 @@ npx arkgate-check --install-agent-gates --skills-only --force
105
108
 
106
109
  ---
107
110
 
111
+ ## Session recipe (agent turn)
112
+
113
+ Short loop so agents do not invent residual or re-run doctor every message:
114
+
115
+ 1. **Bind identity** — MCP: call `ark_identity` with `project.expectedRoot` set to the project’s
116
+ exact absolute root; reuse that root plus the returned `projectId` on later Ark tools. CLI:
117
+ pass `--expected-root /abs/project/root` on `ark status` when you need matched vs stale binding.
118
+ 2. **Read status** — `npx ark status --json` (or MCP `ark_status`) for identity, write-path
119
+ activation honesty, last-check summary, residual lens ids, and primary next action.
120
+ 3. **Act** — work the residual / next action / stable `findingRef` from check diagnostics. Do not
121
+ invent green residual lenses. Green edges alone are never “architecture finished.”
122
+ 4. **Doctor when status is incomplete** — if status `improvementCompass.mode` is **`subset`** or
123
+ **`unavailable`** (or compass facts are missing), run `npx ark-check --doctor` (add `--json` for
124
+ the full 15-lens map) before treating residual as complete. When mode is **`full`**, status
125
+ residual ids are a safe subset of doctor residual for the same facts.
126
+
127
+ ```bash
128
+ npx ark status --json --expected-root /abs/project/root
129
+ # when mode is not full:
130
+ npx ark-check --doctor
131
+ npx ark-check --doctor --json # doctor.improvementCompass
132
+ ```
133
+
134
+ Details: [agent-guide — Session recipe](agent-guide.md#session-recipe-agent-turn) ·
135
+ [package surface — status / compass](package-surface.md).
136
+
137
+ ---
138
+
108
139
  ## Improvement compass (not a score)
109
140
 
110
141
  Doctor shows an **improvement compass**: a closed set of architecture **lenses** (separation of
@@ -125,6 +156,8 @@ Improvement compass (not a score)
125
156
  | Never a gate input | Residual alone does **not** fail CI or flip `valid` |
126
157
 
127
158
  JSON: `ark-check --doctor --json` → `doctor.improvementCompass` (full lenses + `topResidual`).
159
+ Status also projects a thin residual map with honesty **`mode`**: `full` \| `subset` \| `unavailable`
160
+ (always `notAScore`) — see [Session recipe](#session-recipe-agent-turn).
128
161
  Human doctor prints the short section above.
129
162
 
130
163
  ### Align → Stabilize → Shape
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkgate",
3
- "version": "4.4.0",
3
+ "version": "4.5.5",
4
4
  "description": "ArkGate — architecture co-pilot for AI TypeScript (write gate, CI gate, plan/loop; optional ArkRules)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -242,11 +242,12 @@
242
242
  },
243
243
  "improvementCompass": {
244
244
  "type": "object",
245
- "description": "Optional thin improvement-compass residual ids (notAScore). Never a gate input; full lenses on doctor JSON.",
245
+ "description": "Thin improvement-compass residual ids with honesty mode (notAScore). full | subset | unavailable. Never a gate input; full lenses on doctor JSON. When full, residual ids ⊆ doctor residual for the same facts. unavailable never invents green residual.",
246
246
  "additionalProperties": false,
247
247
  "required": [
248
248
  "schemaVersion",
249
249
  "notAScore",
250
+ "mode",
250
251
  "topResidual"
251
252
  ],
252
253
  "properties": {
@@ -256,6 +257,13 @@
256
257
  "notAScore": {
257
258
  "const": true
258
259
  },
260
+ "mode": {
261
+ "enum": [
262
+ "full",
263
+ "subset",
264
+ "unavailable"
265
+ ]
266
+ },
259
267
  "topResidual": {
260
268
  "type": "array",
261
269
  "items": {
@@ -263,6 +271,25 @@
263
271
  "minLength": 1
264
272
  },
265
273
  "maxItems": 15
274
+ },
275
+ "reasonCode": {
276
+ "type": "string",
277
+ "minLength": 1
278
+ },
279
+ "reason": {
280
+ "type": "string",
281
+ "minLength": 1
282
+ },
283
+ "factsSource": {
284
+ "enum": [
285
+ "doctor-facts",
286
+ "report-snapshot",
287
+ "none"
288
+ ]
289
+ },
290
+ "contractHash": {
291
+ "type": "string",
292
+ "minLength": 1
266
293
  }
267
294
  }
268
295
  }
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.4.0",
9
+ "version": "4.5.5",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "arkgate",
14
- "version": "4.4.0",
14
+ "version": "4.5.5",
15
15
  "runtimeHint": "npx",
16
16
  "transport": {
17
17
  "type": "stdio"
@@ -1,13 +1,13 @@
1
1
  # ArkGate Agent Skills package
2
2
 
3
- > **Generated layout (Agent Skills packaging).** Do not edit SKILL.md files here by hand.
3
+ > **Generated layout (ACS05).** Do not edit SKILL.md files here by hand.
4
4
  > Author skill bodies in `templates/skills/<name>.md`, then run
5
5
  > `npm run generate:agent-skills`. Drift: `npm run check:agent-skills`.
6
6
 
7
7
  This directory is the **Agent Skills–compatible** packaging of the same **13**
8
8
  `/ark-*` skills shipped as flat templates for Ark install. **No new skill names.**
9
9
 
10
- Package version when last generated context: **arkgate@4.3.0**
10
+ Package version when last generated context: **arkgate@4.5.0**
11
11
  Schema: agent-skills package contract `1.0`
12
12
 
13
13
  ## Skills (frozen catalog)
@@ -31,6 +31,18 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
31
31
 
32
32
  **Spaghetti → honest contract.** SoC/DIP false-green STOP paths in plain language; residual lenses stay Incomplete until mapped.
33
33
 
34
+ ## Domain glossary (process)
35
+
36
+ When present, prefer the consumer **domain glossary** for layer names, slice folders, intent names, and pilot wording:
37
+
38
+ | Detect (no requirement) |
39
+ |-------------------------|
40
+ | `CONTEXT.md`, `docs/glossary.md`, `docs/domain.md`, `docs/ubiquitous-language.md`, `docs/CONTEXT.md` |
41
+
42
+ - Prefer glossary terms over inventing parallel vocabulary.
43
+ - Call out conflicts between glossary language and code reality (process judgment).
44
+ - **Missing glossary is normal** — continue without warning spam. Never treat glossary prose as enforcement.
45
+
34
46
  ## When / not when
35
47
 
36
48
  | Use `/ark-adopt` when… | Do **not** use it when… |
@@ -184,6 +196,7 @@ End with **exactly** these headings (markdown `###`):
184
196
  - **Result:** one-line outcome
185
197
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
186
198
  - **Compass:** top residual lenses | `n/a`
199
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
187
200
  - **Handoff:** `/ark-…` / CLI / `none`
188
201
  - **Incomplete?** `no` | `yes — <what is missing>`
189
202
 
@@ -34,6 +34,26 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
34
34
 
35
35
  **Map residual lenses → dual-plan B seeds.** Plain Align / Stabilize / Shape from compass + design-weak — not a scorecard.
36
36
 
37
+ ## Deep modules (process)
38
+
39
+ - Prefer **deep modules**: small **interface**, complexity hidden behind it (not a depth score).
40
+ - When proposing a port/adapter or Shape pilot, **name the seam** (callers stay stable; behavior swaps behind it). One adapter → seam still hypothetical; two real adapters → seam justified.
41
+ - Apply the **deletion test** before extracting “just for tests”: if deleting the module makes complexity *vanish*, it was pass-through; if complexity *reappears* across callers, it earned its keep.
42
+ - Prefer verification **at the public interface** of the seam (locality/leverage), not private pass-through layers.
43
+ - When doctor surfaces **hot paths** or **deepening candidates**, treat them as advisory residual only — never as a gate fail; bias dual-plan B pilots toward recent churn when listed.
44
+
45
+ ## Domain glossary (process)
46
+
47
+ If the consumer tree has a **domain glossary**, prefer its terms for layer/slice folders, pilot names, and next-action prose:
48
+
49
+ | Common root names (detect, do not require) |
50
+ |--------------------------------------------|
51
+ | `CONTEXT.md`, `docs/glossary.md`, `docs/domain.md`, `docs/ubiquitous-language.md`, `docs/CONTEXT.md` |
52
+
53
+ - Call out **glossary vs code** conflicts when names disagree with lived folders.
54
+ - **Missing glossary is normal** — do not warn-spam or invent a glossary file.
55
+ - Glossary content never enforces; the gate remains `ark.config.json` + scan.
56
+
37
57
  ## When / not when
38
58
 
39
59
  | Use `/ark-explore` when… | Do **not** use it when… |
@@ -390,6 +410,7 @@ End with **exactly** these headings (markdown `###`):
390
410
  - **Result:** one-line outcome
391
411
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
392
412
  - **Compass:** top residual lenses | `n/a`
413
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
393
414
  - **Handoff:** `/ark-…` / CLI / `none`
394
415
  - **Incomplete?** `no` | `yes — <what is missing>`
395
416
 
@@ -28,6 +28,12 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
28
28
 
29
29
  **Name residual lenses** on each cluster (SoC, DIP, coupling, …). Still no weaken-gate to clear a lens.
30
30
 
31
+ ## Deep modules (process)
32
+
33
+ - Prefer fixes that leave a **deep module** at a named **seam** (port in the owning layer; adapter outside).
34
+ - Apply the **deletion test** before extracting a layer “just so tests can mock it.”
35
+ - After a port/inject fix, **test at the public interface** of the seam (match remediation `nextAction` language), not only private internals.
36
+
31
37
  ## When / not when
32
38
 
33
39
  | Use `/ark-fix` when… | Do **not** use it when… |
@@ -198,6 +204,7 @@ End with **exactly** these headings (markdown `###`):
198
204
  - **Result:** one-line outcome
199
205
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
200
206
  - **Compass:** top residual lenses | `n/a`
207
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
201
208
  - **Handoff:** `/ark-…` / CLI / `none`
202
209
  - **Incomplete?** `no` | `yes — <what is missing>`
203
210
 
@@ -31,6 +31,12 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
31
31
 
32
32
  **Lens language on each cluster** while looping edges; residual shape lenses hand off to explore/autopilot.
33
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.
39
+
34
40
  ## When / not when
35
41
 
36
42
  | Use `/ark-loop` when… | Do **not** use it when… |
@@ -193,6 +199,7 @@ End with **exactly** these headings (markdown `###`):
193
199
  - **Result:** one-line outcome
194
200
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
195
201
  - **Compass:** top residual lenses | `n/a`
202
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
196
203
  - **Handoff:** `/ark-…` / CLI / `none`
197
204
  - **Incomplete?** `no` | `yes — <what is missing>`
198
205
 
@@ -24,6 +24,12 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
24
24
 
25
25
  **Where so the AI doesn’t mess up next time** — golden pattern + layer home before the write.
26
26
 
27
+ ## Deep modules (process)
28
+
29
+ - Place so new code stays **deep**: one small public surface per concern; hide implementation details.
30
+ - If the artifact is a port or adapter, **name the seam** and put the interface where callers should depend (usually Domain/Application), implementation on the outer side.
31
+ - Do not scaffold empty pass-through modules that fail the **deletion test** (complexity would vanish if deleted).
32
+
27
33
  ## When / not when
28
34
 
29
35
  | Use `/ark-place` when… | Do **not** use it when… |
@@ -175,6 +181,7 @@ End with **exactly** these headings (markdown `###`):
175
181
  - **Result:** one-line outcome
176
182
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
177
183
  - **Compass:** top residual lenses | `n/a`
184
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
178
185
  - **Handoff:** `/ark-…` / CLI / `none`
179
186
  - **Incomplete?** `no` | `yes — <what is missing>`
180
187
 
@@ -28,6 +28,12 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
28
28
 
29
29
  **2–3 options labeled by lens impact** (what residual improves / what stays out-of-scope).
30
30
 
31
+ ## Deep modules (process)
32
+
33
+ - Prefer **deep modules** (small interface, hidden complexity). Never invent a depth score.
34
+ - Label the **seam** on each option that introduces a port/adapter; apply the **deletion test** before pass-through extracts “for testability.”
35
+ - Recommend tests **at the public interface** of the chosen seam.
36
+
31
37
  ## When / not when
32
38
 
33
39
  | Use `/ark-think` when… | Do **not** use it when… |
@@ -146,6 +152,7 @@ End with **exactly** these headings (markdown `###`):
146
152
  - **Result:** one-line outcome
147
153
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
148
154
  - **Compass:** top residual lenses | `n/a`
155
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
149
156
  - **Handoff:** `/ark-…` / CLI / `none`
150
157
  - **Incomplete?** `no` | `yes — <what is missing>`
151
158
 
@@ -32,6 +32,20 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
32
32
 
33
33
  **After upgrade:** refresh projection; re-doctor; compass residual still drives process, not scores.
34
34
 
35
+ ## Suggested improvements (what to try next)
36
+
37
+ After `ark upgrade` (preview or apply), read JSON **`whatsNew`** or the human **Suggested improvements**
38
+ block. It lists concrete try/inspect actions for this package line (advisory only — not a score):
39
+
40
+ 1. **Deep-module coach** — `ark-check --doctor` → `doctor.deepModuleCoach` (hot paths + deepening)
41
+ 2. **Improvement compass** — residual lenses on doctor/HTML (not a score)
42
+ 3. **Session recipe** — `ark status --json` honesty modes; doctor when mode is not full
43
+ 4. **Two-axis done** — architecture residual vs feature/ticket residual (Enforce green ≠ feature done)
44
+ 5. **Self-service honesty** — upgrade `selfService` write-path labels + customized preserve
45
+
46
+ Never invent gate verdicts from these suggestions. Missing residual is honest empty, not green.
47
+
48
+
35
49
  ## Dual engine (mandatory)
36
50
 
37
51
  Use the semantic sensor (`ark-check --doctor --json` plus the strict contract
@@ -31,6 +31,18 @@ patterns are **out-of-scope** lenses — say so; do not invent Ark enforcement f
31
31
 
32
32
  **Spaghetti → honest contract.** SoC/DIP false-green STOP paths in plain language; residual lenses stay Incomplete until mapped.
33
33
 
34
+ ## Domain glossary (process)
35
+
36
+ When present, prefer the consumer **domain glossary** for layer names, slice folders, intent names, and pilot wording:
37
+
38
+ | Detect (no requirement) |
39
+ |-------------------------|
40
+ | `CONTEXT.md`, `docs/glossary.md`, `docs/domain.md`, `docs/ubiquitous-language.md`, `docs/CONTEXT.md` |
41
+
42
+ - Prefer glossary terms over inventing parallel vocabulary.
43
+ - Call out conflicts between glossary language and code reality (process judgment).
44
+ - **Missing glossary is normal** — continue without warning spam. Never treat glossary prose as enforcement.
45
+
34
46
  ## When / not when
35
47
 
36
48
  | Use `/ark-adopt` when… | Do **not** use it when… |
@@ -184,6 +196,7 @@ End with **exactly** these headings (markdown `###`):
184
196
  - **Result:** one-line outcome
185
197
  - **Planes:** one-line split of residual **[Layer]** vs **[ArkRules]** (or `n/a` if unused)
186
198
  - **Compass:** top residual lenses | `n/a`
199
+ - **Done axes:** architecture residual (status/doctor/compass) | feature/ticket residual (outside package). Enforce green ≠ feature done
187
200
  - **Handoff:** `/ark-…` / CLI / `none`
188
201
  - **Incomplete?** `no` | `yes — <what is missing>`
189
202