arkgate 4.2.0 → 4.3.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 (46) hide show
  1. package/CHANGELOG.md +86 -4
  2. package/README.md +20 -6
  3. package/bin/ark-mcp-runtime.mjs +64 -0
  4. package/bin/ark-shared.mjs +16 -4
  5. package/bin/ark.mjs +55 -1
  6. package/bin/lib/adapter-contract.mjs +88 -5
  7. package/bin/lib/agent-projection-command.mjs +396 -0
  8. package/bin/lib/agent-projection.mjs +319 -0
  9. package/bin/lib/agent-skills-package.mjs +266 -0
  10. package/bin/lib/baseline-key.mjs +32 -0
  11. package/bin/lib/ci-and-commands.mjs +44 -0
  12. package/bin/lib/diagnostic-catalog.mjs +155 -0
  13. package/bin/lib/physical-cohesion.mjs +2 -1
  14. package/bin/lib/status-command.mjs +369 -0
  15. package/bin/lib/status-manifest.mjs +394 -0
  16. package/dist/eslint/index.cjs +3 -3
  17. package/dist/eslint/index.js +3 -3
  18. package/dist/index.cjs +46 -11
  19. package/dist/index.d.ts +729 -6
  20. package/dist/index.js +46 -11
  21. package/docs/README.md +6 -6
  22. package/docs/agent-guide.md +112 -14
  23. package/docs/configuration.md +7 -0
  24. package/docs/develop.md +8 -0
  25. package/docs/diagnostics.md +606 -0
  26. package/docs/package-surface.md +19 -8
  27. package/docs/product-voice.md +45 -0
  28. package/docs/use.md +23 -0
  29. package/package.json +11 -1
  30. package/schemas/ark.analysis-result.schema.json +14 -1
  31. package/schemas/ark.status-manifest.schema.json +244 -0
  32. package/server.json +2 -2
  33. package/templates/agent-skills/README.md +59 -0
  34. package/templates/agent-skills/ark-adopt/SKILL.md +171 -0
  35. package/templates/agent-skills/ark-architect/SKILL.md +175 -0
  36. package/templates/agent-skills/ark-autopilot/SKILL.md +242 -0
  37. package/templates/agent-skills/ark-contract/SKILL.md +136 -0
  38. package/templates/agent-skills/ark-coverage/SKILL.md +167 -0
  39. package/templates/agent-skills/ark-explain/SKILL.md +210 -0
  40. package/templates/agent-skills/ark-explore/SKILL.md +377 -0
  41. package/templates/agent-skills/ark-fix/SKILL.md +185 -0
  42. package/templates/agent-skills/ark-loop/SKILL.md +180 -0
  43. package/templates/agent-skills/ark-place/SKILL.md +162 -0
  44. package/templates/agent-skills/ark-runtime/SKILL.md +120 -0
  45. package/templates/agent-skills/ark-think/SKILL.md +133 -0
  46. package/templates/agent-skills/ark-upgrade/SKILL.md +218 -0
@@ -16,7 +16,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
16
16
 
17
17
  | Surface | How you use it | Stability notes |
18
18
  |---------|----------------|-----------------|
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) are stable within a major. Additive fields OK; removals/renames are major. In 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. |
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. In 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 ACS03 unified status snapshot. `ark agents-md` is the ACS04 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
21
  | **Doctor design fitness (P02+)** | `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`. Y02 extends `handler-in-persistence` to 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`** (Q02). Does **not** fail the gate by itself. |
22
22
  | **Post-green path (Q01)** | `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. |
@@ -34,7 +34,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
34
34
  | **Governance weight (W02)** | `ark-check --doctor --json` → `doctor.contractHealth.governanceWeight` | Additive, **advisory only** — raw facts (`declaredLayers`, `populatedLayers`, `governedFiles`, `rules`, `deniedEdges`, `allowedEdges`, `filesPerLayer`, `rulesPerLayer`) plus a fixed comparative band `weight: heavy | typical | light | unknown` and its fixed `note`. Fixed deterministic thresholds: **heavy** = fewer than 25 governed files per declared layer AND (6+ layers OR 4+ well-formed rules per layer); **light** = at most 2 layers over 150+ governed files; **unknown** = no layers or no governed files; everything else is **typical** (banding uses raw ratios; the reported ratios are rounded for display). `notAScore: true` is explicit: never a composite score, ranking, or gate input; the heavy note asks to justify NEW layers/rules and never suggests deleting working ones. Human doctor prints a line only for `heavy`/`light`. |
35
35
  | **Report parity and snapshot evidence (X01/4.2)** | `ark-check --report` → advisory sections (`data-advisory="contractHealth\|ambientState\|parseHealth"`, nested `governanceWeight`) + layer wall badges; `.ark/reports/*.json` | The report is a rendering of doctor truth. **Standing rule:** every doctor advisory ships with its report section — enforced by the `reportParity` guard, which enumerates the doctor's advisory keys and fails on any missing section. Snapshots add best-effort Git `HEAD`/branch/dirty provenance without a shell; unavailable Git is explicit. Evolution renders the Ark score delta only when both snapshots name the same ArkGate version, while retaining raw facts across versions. |
36
36
  | **MCP project identity (4.2)** | `ark_identity`; `arkgate/schema/project-identity` or `arkgate/schema/ark.project-identity.schema.json`; root API constants/helpers/types | Schema `1.0`. `projectId` hashes canonical root + config path and stays stable across contract edits/restarts; runtime id/start time are separate. Every project-bound tool result and error carries `projectIdentity`, `binding` (`matched` / `unverified` / `mismatch`), and `authoritative`. Canonical out-of-root config/file evidence fails before project data. |
37
- | **MCP tools and compatibility resource** | `arkgate-mcp`; `ark_manifest`; `ark://manifest` | Tool names and primary argument shapes are stable within a major. Every tool accepts additive `project.expectedRoot` / optional `expectedProjectId`. The initial handshake requires the exact project root; a contained descendant is authoritative only together with the matching project id. Legacy tool calls remain callable but `unverified` and non-authoritative. `ark_manifest` is the authoritative contract surface after binding. Standard `resources/read` cannot portably carry the expectation, so `ark://manifest` remains compatibility-only and always unverified/non-authoritative. The server never retargets from input. |
37
+ | **MCP tools and compatibility resource** | `arkgate-mcp`; `ark_manifest`; `ark_status`; `ark://manifest` | Tool names and primary argument shapes are stable within a major. Every tool accepts additive `project.expectedRoot` / optional `expectedProjectId`. The initial handshake requires the exact project root; a contained descendant is authoritative only together with the matching project id. Legacy tool calls remain callable but `unverified` and non-authoritative. `ark_manifest` is the authoritative contract surface after binding. **`ark_status`** returns the ACS03 status manifest envelope (parity with `ark status --json`). Standard `resources/read` cannot portably carry the expectation, so `ark://manifest` remains compatibility-only and always unverified/non-authoritative. The server never retargets from input. |
38
38
  | **`ark.config.json`** | Layer globs, rules, include/exclude, forbiddenGlobals, intent prefixes, `peerIsolation`, `dynamicImportAllowlist`, `safety` thresholds; optional **`arkRules`** map (schema `1.1+`) | Versioned by `schemaVersion`; unknown fields fail closed and migrations preserve the previous supported major. Absence of `arkRules` is byte-for-byte silent on inter-layer verdicts. |
39
39
  | **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. |
40
40
  | **`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`. |
@@ -47,11 +47,16 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
47
47
  | **Enforcement ladder + fixed journey (T05, 3.1.0)** | `doctor.writePath.enforcementLadder`; hook repair `enforcement`; `npm run eval:change-integrity` | Additive schema `1.0` separates supported/installed/active/bypassable state and evidence. Hard is operation-scoped only for a supported covered hook; MCP is advisory; required CI status stays unverified locally. Fixed no-context fixture proves CLI/MCP/hook/final parity, one casual denial, acceptance behavior, and strict Ark. |
48
48
  | **Enforcement state (Z06/Z10)** | `doctor.writePath.enforcementState`; schema/type | Schema `1.1`: runtime observation, operation coverage, and operation-scoped `hard`. Only fresh covered active-host evidence permits `hard:true`; unverified assets and MCP remain non-hard. |
49
49
  | **Design delta (Z10)** | `--fail-on-new-smells --base-ref <ref>`; hook/MCP; schema/types | Schema `1.0`: identities, touched paths, stable evidence/verdict. Missing base fails closed; only new/worsened `domain-logic-in-ui` blocks; global doctor smells stay advisory. |
50
- | **`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.4` adds 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. |
50
+ | **`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`** (ACS06) 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. |
51
+ | **Stable finding refs (ACS06 / 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`. |
52
+ | **Diagnostic code catalog (ACS02)** | 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. |
53
+ | **Status manifest (ACS03)** | 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. **Not a score.** Never prompts (`CI=1` forces JSON). Optional `--expected-root` / `--expected-project-id` (MCP `project`) for matched vs stale identity. |
54
+ | **Agent contract projection (ACS04)** | 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. |
55
+ | **Agent Skills packaging (ACS05)** | `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`. |
51
56
  | **`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`). |
52
57
  | **`arkgate/schema/resolved-candidate-facts`** or **`arkgate/schema/ark.resolved-candidate-facts.schema.json`** | Versioned parity-capable input for `analyzeResolvedProject` / `preflightResolvedChange` | Schema `1.0` is serializable and deterministic. Tooling owns filesystem/compiler resolution; Domain/Kernel validate and evaluate supplied facts without importing those effects. Facts name resolver/compiler inputs, governed files, dependency evidence, completeness reasons, and candidate tree/facts hashes. |
53
58
  | **Config JSON Schema** | `arkgate/schema` or `arkgate/schema/ark.config.schema.json` | Stable package resource subpaths for editor completion and contract tooling. |
54
- | **Agent skills** | `/ark-*` templates; install via `--install-agent-gates` (often `--skills-only` on top of compact) | **Day zero** is the compact router from `ark start` / `start --apply` + doctor control plane — not the full skill pack. Skill *names* and the guided expert path (`/ark-autopilot` after pack install) are stable; internal skill prose may evolve. **4.0:** all skills except experimental `/ark-runtime` integrate **layers + ArkRules** and must label residual `[Layer]` vs `[ArkRules]`. **4.2:** repo catalogs are content-idempotent; the optional shared Codex home catalog is monotonic across 4.2.0+ installers. Pre-4.2 writers are outside that protocol and must be upgraded first. A durable pending-catalog journal preserves the floor across an interrupted install and is cleared only by its owning same/newer recovery. |
59
+ | **Agent skills** | `/ark-*` templates; install via `--install-agent-gates` (often `--skills-only` on top of compact) **or** Agent Skills ecosystem path | **Day zero** is the compact router from `ark start` / `start --apply` + doctor control plane — not the full skill pack. Skill *names* (frozen **13**) and the guided expert path (`/ark-autopilot` after pack install) are stable; internal skill prose may evolve. **4.0:** all skills except experimental `/ark-runtime` integrate **layers + ArkRules** and must label residual `[Layer]` vs `[ArkRules]`. **4.2:** repo catalogs are content-idempotent; the optional shared Codex home catalog is monotonic across 4.2.0+ installers. Pre-4.2 writers are outside that protocol and must be upgraded first. A durable pending-catalog journal preserves the floor across an interrupted install and is cleared only by its owning same/newer recovery. **4.3 / ACS05:** Agent Skills–compatible layout at `templates/agent-skills/<name>/SKILL.md` (1:1 with flat `templates/skills/*.md`); install via `npx skills add ./node_modules/arkgate/templates/agent-skills` (or the GitHub tree). Domain `ARK_SKILL_NAMES` + `validateAgentSkillsPackage`; drift `npm run check:agent-skills`. Skills never enforce. |
55
60
  | **ESLint subpath** | `arkgate/eslint` | Config-driven layer/import rules; loads consumer `ark.config.json`. |
56
61
  | **GitHub Action** | `pedroknigge/arkgate` (see `action.yml`) | The `uses:` tag/SHA selects the checker source; `version` remains an optional exact npm compatibility override. |
57
62
  | **Package metadata** | `arkgate/package.json` | Stable resource subpath for tooling that needs the installed manifest. |
@@ -87,7 +92,10 @@ are grouped below.
87
92
 
88
93
  | Group | Exported runtime values |
89
94
  |-------|-------------------------|
90
- | Metadata and adapter diagnostics | `version`, `ARK_ANALYSIS_RESULT_SCHEMA_VERSION`, `ARK_ANALYSIS_RESULT_SCHEMA`, `createAdapterResult`, `toAdapterDiagnostic` |
95
+ | Metadata and adapter diagnostics | `version`, `ARK_ANALYSIS_RESULT_SCHEMA_VERSION`, `ARK_ANALYSIS_RESULT_SCHEMA`, `ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH`, `createAdapterResult`, `toAdapterDiagnostic`, `adapterFindingTargetKey`, `adapterFindingOccurrenceTargetKeys`, `adapterFindingRefFromTargetKey`, `adapterDocsCodePath` |
96
+ | Diagnostic code catalog (ACS02 / 4.3) | `DIAGNOSTIC_CATALOG`, `DIAGNOSTIC_RULE_IDS`, `DIAGNOSTIC_CATALOG_SCHEMA_VERSION`, `DIAGNOSTIC_DOCS_RELATIVE_PATH`, `getDiagnosticCatalogEntry`, `isKnownDiagnosticCode`, `isCataloguedOrArkRuleFamily`, `diagnosticDocsPath`, `diagnosticDocsFragment`, `catalogWhyForRuleId`, `catalogFixForRuleId`, `serializeDiagnosticCatalog` |
97
+ | Status manifest (ACS03 / 4.3) | `ARK_STATUS_MANIFEST_SCHEMA_VERSION`, `ARK_STATUS_MANIFEST_SCHEMA_URL`, `ARK_STATUS_MANIFEST_SCHEMA`, `buildStatusManifest`, `evaluateStatusBinding`, `classifyStatusWritePath`, `resolveStatusNextAction`, `defaultHonestLabel` |
98
+ | Agent contract projection (ACS04 / 4.3) | `ARK_AGENT_PROJECTION_SCHEMA_VERSION`, `DEFAULT_AGENT_PROJECTION_RULE_IDS`, `AGENT_PROJECTION_NON_ENFORCEMENT_LABEL`, `buildAgentProjectionBlock`, `buildAgentProjectionBody`, `buildAgentProjectionMeta`, `mergeAgentProjectionDocument`, `extractAgentProjectionBlock`, `projectionMatchesPackageVersion`, `agentProjectionContentIdentity` |
91
99
  | MCP project identity | `ARK_PROJECT_IDENTITY_SCHEMA_VERSION`, `ARK_PROJECT_IDENTITY_SCHEMA_URL`, `ARK_PROJECT_IDENTITY_SCHEMA`, `PROJECT_EXPECTATION_SCHEMA`, `PROJECT_BINDING_SCHEMA`, `createProjectId`, `createProjectIdentity` |
92
100
  | AI snippet gate | `createAICodeGate` |
93
101
  | Profiles and config factories | `createArchitectureProfile`, `createArchitectureProfileFromArkConfig`, `createElevenLayerArkConfig`, `elevenLayerProfile` |
@@ -101,6 +109,7 @@ The type-only root exports are also semver-supported:
101
109
 
102
110
  - Adapter diagnostics: `AdapterDiagnostic`, `AdapterResult`, `AdapterSeverity`,
103
111
  `AdapterViolationInput`, `AdapterCompletenessReason`, `AnalysisCompleteness`, `AnalysisMode`.
112
+ - Diagnostic catalog: `DiagnosticCatalogEntry`, `DiagnosticCategory`.
104
113
  - MCP project identity: `ProjectIdentity`, `ProjectExpectation`, `ProjectBinding`.
105
114
  - Resolved facts: `ResolvedCandidateFacts`, `ResolvedCandidateFactsInput`, and their
106
115
  dependency/file/evidence component types.
@@ -194,9 +203,11 @@ production deployment would need to satisfy; it is not a readiness certification
194
203
  ## Release notes (maintainers)
195
204
 
196
205
  Ship notes for a version live under [releases/](https://github.com/pedroknigge/arkgate/tree/main/docs/releases)
197
- (prepared: [4.2.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.0.md);
198
- current published: [4.1.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.1.md);
199
- previous: [4.1.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.0.md),
206
+ (prepared candidate: [4.3.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.3.0.md);
207
+ current published: [4.2.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.1.md);
208
+ previous: [4.2.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.2.0.md),
209
+ [4.1.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.1.md),
210
+ [4.1.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.1.0.md),
200
211
  [4.0.1.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.0.1.md),
201
212
  [4.0.0.md](https://github.com/pedroknigge/arkgate/blob/main/docs/releases/4.0.0.md)).
202
213
  Publish path: signed annotated tag → GitHub Release → `publish-npm.yml` (see [CONTRIBUTING.md](https://github.com/pedroknigge/arkgate/blob/main/CONTRIBUTING.md)).
@@ -21,6 +21,9 @@ because the design space is small and honest.
21
21
  opt-in.
22
22
  - **Co-pilot side:** where code belongs, who talks to whom, how; dual plan **A** (edges) +
23
23
  **B** (shape); one pilot at a time; never silent judgment codemod; never weaken the contract.
24
+ - **Agent contract surface (4.3.0):** agents read **guardrail catalogs** and **scan** evidence;
25
+ they **process** (judge / coach) outside the package. Projection and skills never become the
26
+ pass/fail gate.
24
27
  - **False done is forbidden:** Enforce ≠ elegant design. `design-weak` / residual must not
25
28
  read as “healthy finished.” Empty ArkRules inventory is not a score. MCP configuration on
26
29
  disk is not proof that the current process belongs to this project.
@@ -83,6 +86,31 @@ Examples:
83
86
  | **required CI / status context** | Merge hard boundary when the repository makes the Ark job a **required GitHub status context** (CLI: `arkgate-check --strict-merge` / `ark-check --strict-merge`) |
84
87
  | **contract ready** | Project/layers/ArkRules honesty residual clear — not the same as “hard local write” |
85
88
  | **environment residual** | Permanent host/provider posture (e.g. soft-write Codex) kept in evidence without forcing global **Not finished** |
89
+ | **guardrail catalog** | Closed vocabulary of allowed sensors, capabilities, diagnostic `ruleId`s, and skill roles — agents and copy choose from the catalog; they do not invent free-form enforcement claims |
90
+ | **scan** | Deterministic engine / CLI / MCP evidence pass (layers, ArkRules sensors, status facts, prepare-write). Same inputs → same verdict. No LLM. |
91
+ | **process** (agent judgment) | Skill- or agent-side coaching: placement, dual-plan, pilot choice, remediation order. Improves prevention; **never** package pass/fail |
92
+ | **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)) |
93
+ | **agent projection** | Version-matched AGENTS/CLAUDE (or equivalent) block generated from package + contract; **non-authoritative** — enforcement is ark-check / hooks / CI |
94
+ | **finding ref** | Stable id for a finding across turns (ruleId + target key), so agents re-address without fuzzy message match |
95
+ | **status snapshot** | One machine-readable project/session manifest (`ark status --json` shape): identity, activation honesty, last check, residual counts — not a numeric score |
96
+
97
+ ## Scan vs process (dual depth)
98
+
99
+ Borrow the harness *shape* (scan facts, then process with judgment) without shipping an LLM
100
+ verdict in core:
101
+
102
+ ```text
103
+ scan → deterministic contract graph + host activation evidence
104
+ process → skills / human / host agent choose pilots and wording
105
+ gate → same binary verdict on every parity-capable adapter
106
+ ```
107
+
108
+ | Surface | Language to use | Language to avoid |
109
+ |---------|-----------------|-------------------|
110
+ | CLI / MCP / CI | “Scan found…”, “Checked edges…”, “Verdict: pass/fail/incomplete” | “The model decided…”, “AI validated architecture” |
111
+ | Skills / doctor coach | “Process next: one pilot…”, “Judgment: Shape door…” | “Process mode enforces…”, “Skill pass/fail” |
112
+ | Catalog / codes | “ruleId from the diagnostic catalog”, “closed capability set” | Open-ended “any rule string”, free-generated sensors |
113
+ | Projection / AGENTS.md | “Agent-facing summary; not the gate” | “Follow AGENTS.md to pass CI” |
86
114
 
87
115
  ## Do (product copy)
88
116
 
@@ -100,6 +128,10 @@ Examples:
100
128
  | Keep inventory claims evidence-bound | “Possible rule candidate in the configured Application layer.” A filename or technical constant alone is not Domain evidence. |
101
129
  | Honesty clear ≠ architecture healthy | `productHonesty.finished` means residual **architecture** honesty sensors are clear — not a green graph score. Open blocking violations, ADAPT/SUGGEST with debt, dual-truth pin, or design residual keep `unfinished: true`. Permanent soft-write alone does **not**. |
102
130
  | Separate CI runtime from provider policy | Successful CI run ≠ required status; GitHub Free plan 403 → `unavailable-plan`, not “CI never ran.” |
131
+ | Prefer catalog language for agent DX | “Stable `ruleId` with why/fix anchors.” Not a free-form list of “things that might be wrong.” |
132
+ | Name scan before process | “Scan: two layer import violations. Process: fix the Application→Domain edge first.” |
133
+ | Label projection non-enforcing | “Regenerated agent contract for this package version. Enforcement remains ark-check / hooks / required CI.” |
134
+ | Keep status counts honest | “Inventory and residual counts are evidence — not a health score.” |
103
135
 
104
136
  ## Avoid
105
137
 
@@ -124,6 +156,11 @@ Examples:
124
156
  | “Max arkRules packs = merge fails structure” | **Advisory ArkRules ≠ merge teeth.** Only `mode: "enforced"` can add teeth, and only after honest classification (FG-ARKRULES-ADVISORY-ONLY) |
125
157
  | “Type-only volume means the gate is broken” | High type-only count is placement debt (behavior OK); group under plan A type-only, offer SharedTypes starter |
126
158
  | Blurring import edges with invariants | Always label **`[Layer]`** vs **`[ArkRules]`** |
159
+ | “Ark uses AI to decide pass/fail” / package “process verdict” | Package is zero-LLM; process is agent-side judgment only |
160
+ | Inventing new skill **names** or preset packs as product copy filler | 4.3.0 freeze: deepen + package the 13; no new names/presets without ROADMAP promotion |
161
+ | Treating AGENTS.md / projection / skills as the write gate | Advisory surface; hard path is hooks / MCP prepare / required CI |
162
+ | Free-generated sensor or rule ids outside the catalog | Guardrail catalog is closed; unknown codes are a bug, not creativity |
163
+ | Numeric “architecture health” or trust score in status JSON | Counts and residuals yes; scored trust no |
127
164
 
128
165
  ---
129
166
 
@@ -153,6 +190,9 @@ Skills table in docs = **escapes / expert**, not a second onboarding track.
153
190
  - Empty plan A is not “architecture healthy” when design residual remains.
154
191
  - One pilot at a time. Pattern bets are never mechanical-safe.
155
192
  - Doctor is the control plane: status light + next action.
193
+ - Scan is deterministic. Process is judgment. Only the gate decides pass/fail.
194
+ - Guardrails are a catalog, not free generation.
195
+ - Agent docs project the contract; they never replace the gate.
156
196
 
157
197
  ## Hero phrases (forbidden)
158
198
 
@@ -160,6 +200,8 @@ Skills table in docs = **escapes / expert**, not a second onboarding track.
160
200
  - You don’t need to understand architecture.
161
201
  - We auto-fix everything safely.
162
202
  - Ship it 🚀 / crush the spaghetti with vibes.
203
+ - The AI validated your architecture / model pass/fail.
204
+ - Follow AGENTS.md to pass the architecture gate.
163
205
 
164
206
  ---
165
207
 
@@ -225,4 +267,7 @@ Keep dual-engine rules and **STOP** handoffs. Never claim silent full-tree resha
225
267
  - [ ] No false done under design-weak / incomplete analysis.
226
268
  - [ ] Technical terms present (contract, gate, edges, pilot) without slang.
227
269
  - [ ] Expert skills are labeled expert — not the default curriculum.
270
+ - [ ] Scan vs process is not blurred with package LLM pass/fail.
271
+ - [ ] Codes, sensors, and capabilities stay inside the guardrail catalog.
272
+ - [ ] Projection / AGENTS.md never claimed as enforcement.
228
273
  - [ ] Seniors would not be embarrassed to paste the line into a PR.
package/docs/use.md CHANGED
@@ -28,6 +28,19 @@ Full skill pack is **optional** (expert depth). Day-to-day: compact router + doc
28
28
 
29
29
  ---
30
30
 
31
+ ## When not to adopt
32
+
33
+ Skip ArkGate (or treat it as overkill) when:
34
+
35
+ - The project has **no AI coding agents** and **no multi-layer integration boundaries** worth pinning.
36
+ - It is a **single-developer hobby CRUD** with no pressure to keep layers honest over time.
37
+ - The team will **not** maintain `ark.config.json` layers or make `arkgate-check --strict-merge` a
38
+ **required** GitHub status context — without that, local advisory write stays avoidable.
39
+
40
+ In those cases a boundary linter or editor rules may be enough; see [README — Why not only ESLint / Nx / cruiser?](../README.md#why-not-only-eslint--nx--cruiser). When you *do* adopt, day-to-day honesty is still: advisory write on soft hosts → required merge status. Surface that with `npx arkgate-check --doctor` or `npx arkgate status --json` ([agent guide — Write-path honesty](agent-guide.md#write-path-honesty)).
41
+
42
+ ---
43
+
31
44
  ## What you get
32
45
 
33
46
  | When | What happens |
@@ -51,6 +64,16 @@ Start always gives you **layers**. ArkRules templates may ship with start/init;
51
64
 
52
65
  **Do not confuse:** green Layers ≠ perfect design (Shape residual can remain). Covered invariants ≠ “the business always does the right thing” — they mean the named policy is declared and has symbol/test evidence.
53
66
 
67
+ ### New modules vs config edits
68
+
69
+ **Happy path:** put a new module under an existing layer directory/glob (`layers[].patterns`). Usually
70
+ **no** `ark.config.json` edit — the file classifies and the existing rules apply.
71
+
72
+ **Touch the contract only when** you invent a new boundary (new layer or allow/deny edge), leave an
73
+ ungoverned path under `include`, or need a capability / forbidden-global exception. Optional ArkRules
74
+ `appliesTo` globs narrow invariants inside a layer; empty `appliesTo: []` fails closed. Full field
75
+ list: [configuration.md](configuration.md).
76
+
54
77
  ---
55
78
 
56
79
  ## Status lights (not settings)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkgate",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
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",
@@ -33,6 +33,8 @@
33
33
  "./schema/ark.design-delta.schema.json": "./schemas/ark.design-delta.schema.json",
34
34
  "./schema/arkrules": "./schemas/ark.arkrules.schema.json",
35
35
  "./schema/ark.arkrules.schema.json": "./schemas/ark.arkrules.schema.json",
36
+ "./schema/status-manifest": "./schemas/ark.status-manifest.schema.json",
37
+ "./schema/ark.status-manifest.schema.json": "./schemas/ark.status-manifest.schema.json",
36
38
  "./package.json": "./package.json"
37
39
  },
38
40
  "bin": {
@@ -72,6 +74,7 @@
72
74
  "docs/brownfield-adoption.md",
73
75
  "docs/configuration.md",
74
76
  "docs/package-surface.md",
77
+ "docs/diagnostics.md",
75
78
  "docs/threat-model.md",
76
79
  "tests/fixtures/ts-consumer",
77
80
  "templates",
@@ -107,6 +110,8 @@
107
110
  "check:layer-match": "node scripts/generate-layer-match.mjs --check",
108
111
  "generate:cli-pure": "node scripts/generate-cli-pure.mjs",
109
112
  "check:cli-pure": "node scripts/generate-cli-pure.mjs --check",
113
+ "generate:agent-skills": "node scripts/generate-agent-skills.mjs",
114
+ "check:agent-skills": "node scripts/generate-agent-skills.mjs --check",
110
115
  "generate:packaged-tooling": "node scripts/generate-packaged-tooling.mjs",
111
116
  "check:packaged-tooling": "node scripts/generate-packaged-tooling.mjs --check",
112
117
  "generate:analysis-engine": "node scripts/generate-analysis-engine.mjs",
@@ -124,6 +129,7 @@
124
129
  "eval:agent": "node eval/run.mjs",
125
130
  "eval:corpus": "node eval/validate-corpus.mjs",
126
131
  "eval:comparative": "node eval/comparative-run.mjs",
132
+ "eval:placement-ab": "node eval/placement-ab-run.mjs --dry",
127
133
  "eval:loop-cost": "node eval/loop-cost-run.mjs",
128
134
  "eval:ai-velocity": "node eval/ai-velocity-run.mjs",
129
135
  "eval:change-integrity": "node eval/change-integrity-run.mjs",
@@ -160,6 +166,10 @@
160
166
  "qs": "6.15.3",
161
167
  "vite": "6.4.3",
162
168
  "postcss": "8.5.23",
169
+ "fast-uri": "3.1.5",
170
+ "nanoid": "3.3.18",
171
+ "brace-expansion@2": "2.1.4",
172
+ "brace-expansion@5": "5.0.9",
163
173
  "tsup": {
164
174
  "esbuild": "0.28.1"
165
175
  },
@@ -91,7 +91,7 @@
91
91
  ],
92
92
  "properties": {
93
93
  "schemaVersion": {
94
- "const": "1.4"
94
+ "const": "1.5"
95
95
  },
96
96
  "mode": {
97
97
  "enum": [
@@ -252,6 +252,19 @@
252
252
  "nextAction": {
253
253
  "type": "string",
254
254
  "minLength": 1
255
+ },
256
+ "findingRef": {
257
+ "type": "string",
258
+ "minLength": 1,
259
+ "pattern": "^fnv1a-[0-9a-f]{8}$"
260
+ },
261
+ "targetKey": {
262
+ "type": "string",
263
+ "minLength": 1
264
+ },
265
+ "docsCodePath": {
266
+ "type": "string",
267
+ "minLength": 1
255
268
  }
256
269
  }
257
270
  }
@@ -0,0 +1,244 @@
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
+ }
244
+ }
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.2.0",
9
+ "version": "4.3.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "arkgate",
14
- "version": "4.2.0",
14
+ "version": "4.3.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 (ACS05).** 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.2.1**
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).