arkgate 4.8.13 → 4.8.15

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 (126) hide show
  1. package/CHANGELOG.md +219 -4
  2. package/README.md +33 -22
  3. package/SECURITY.md +5 -3
  4. package/bin/ark-check-runtime.mjs +25 -57
  5. package/bin/ark-mcp-runtime.mjs +111 -2
  6. package/bin/ark-shared.mjs +140 -11
  7. package/bin/ark.mjs +7 -25
  8. package/bin/lib/adr-presence.mjs +97 -0
  9. package/bin/lib/agent-projection-formatters.mjs +2 -0
  10. package/bin/lib/agent-skills-package.mjs +241 -8
  11. package/bin/lib/analysis-completeness.mjs +38 -2
  12. package/bin/lib/analysis-engine.mjs +6 -6
  13. package/bin/lib/architecture-scan.mjs +33 -5
  14. package/bin/lib/ark-order-doctor.mjs +7 -1
  15. package/bin/lib/ark-order-report.mjs +2 -1
  16. package/bin/lib/ark-run-doctor.mjs +6 -0
  17. package/bin/lib/ark-run-report.mjs +6 -2
  18. package/bin/lib/arkrules-sensors.mjs +81 -0
  19. package/bin/lib/baseline-key.mjs +4 -1
  20. package/bin/lib/check-args.mjs +52 -2
  21. package/bin/lib/ci-and-commands.mjs +7 -2
  22. package/bin/lib/config-contract.mjs +64 -1
  23. package/bin/lib/design-smells.mjs +21 -1
  24. package/bin/lib/diagnostic-catalog.mjs +5 -3
  25. package/bin/lib/doctor-advisories.mjs +109 -17
  26. package/bin/lib/doctor-human.mjs +20 -6
  27. package/bin/lib/doctor-next-actions.mjs +14 -0
  28. package/bin/lib/doctor-plan.mjs +32 -2
  29. package/bin/lib/enforcement-honesty.mjs +47 -2
  30. package/bin/lib/first-run-help.mjs +19 -3
  31. package/bin/lib/gate-files.mjs +40 -3
  32. package/bin/lib/host-support-matrix.mjs +9 -1
  33. package/bin/lib/html-report-depth.mjs +2 -0
  34. package/bin/lib/html-report.mjs +13 -2
  35. package/bin/lib/import-resolve.mjs +74 -13
  36. package/bin/lib/improvement-compass-doctor.mjs +6 -1
  37. package/bin/lib/improvement-compass-map.mjs +3 -1
  38. package/bin/lib/install-migrate.mjs +23 -0
  39. package/bin/lib/layer-description.mjs +90 -8
  40. package/bin/lib/mcp-hook-payload.mjs +57 -1
  41. package/bin/lib/no-domain-frontend.mjs +91 -0
  42. package/bin/lib/presets.mjs +3 -4
  43. package/bin/lib/product-copy.mjs +19 -0
  44. package/bin/lib/projected-governed-coverage.mjs +114 -0
  45. package/bin/lib/recommend-cli.mjs +54 -0
  46. package/bin/lib/remediation.mjs +6 -2
  47. package/bin/lib/resolved-candidate-facts.mjs +225 -100
  48. package/bin/lib/rules-under-contract.mjs +117 -2
  49. package/bin/lib/scan-files.mjs +39 -0
  50. package/bin/lib/snippet-analysis.mjs +14 -8
  51. package/bin/lib/start-preview.mjs +8 -2
  52. package/bin/lib/states-transitions-presence.mjs +212 -0
  53. package/bin/lib/status-command.mjs +2 -0
  54. package/bin/lib/status-transition-catalog.mjs +410 -0
  55. package/bin/lib/team-parliament-io.mjs +10 -0
  56. package/bin/lib/upgrade-whats-new.mjs +3 -3
  57. package/bin/lib/violations.mjs +43 -1
  58. package/bin/lib/write-path-capabilities.mjs +20 -5
  59. package/bin/lib/write-path-detect.mjs +27 -2
  60. package/dist/{configTypes-j7so8B4O.d.ts → configTypes-Dt3DpVbd.d.ts} +19 -0
  61. package/dist/{diagnosticCatalog-DA565Lja.d.ts → diagnosticCatalog-BEg85XlE.d.ts} +3 -3
  62. package/dist/eslint/index.cjs +4 -4
  63. package/dist/eslint/index.d.ts +1 -1
  64. package/dist/eslint/index.js +4 -4
  65. package/dist/index.cjs +31 -31
  66. package/dist/index.d.ts +126 -19
  67. package/dist/index.js +31 -31
  68. package/dist/nestjs/index.cjs +5 -5
  69. package/dist/nestjs/index.d.ts +3 -3
  70. package/dist/nestjs/index.js +5 -5
  71. package/dist/runtime/index.cjs +15 -15
  72. package/dist/runtime/index.d.ts +6 -6
  73. package/dist/runtime/index.js +15 -15
  74. package/dist/{types-Djbs3KjE.d.ts → types-CN9tVMPz.d.ts} +3 -1
  75. package/dist/{types-tGhZUiGX.d.ts → types-TBiv0WHL.d.ts} +1 -1
  76. package/docs/README.md +8 -6
  77. package/docs/agent-guide.md +35 -17
  78. package/docs/ai-gates.md +13 -4
  79. package/docs/arkorder.md +11 -4
  80. package/docs/brownfield-adoption.md +4 -1
  81. package/docs/configuration.md +63 -14
  82. package/docs/develop.md +4 -1
  83. package/docs/diagnostics.md +30 -10
  84. package/docs/enthusiast/README.md +6 -1
  85. package/docs/enthusiast/how-to-agent-gates.md +5 -0
  86. package/docs/enthusiast/how-to-gallery-starter.md +2 -1
  87. package/docs/enthusiast/how-to-pick-shape.md +1 -1
  88. package/docs/package-surface.md +10 -6
  89. package/docs/product-voice.md +32 -6
  90. package/docs/threat-model.md +2 -2
  91. package/docs/typescript-support.md +3 -3
  92. package/docs/use.md +23 -11
  93. package/package.json +1 -1
  94. package/schemas/ark.config.schema.json +23 -2
  95. package/server.json +2 -2
  96. package/templates/agent-skills/README.md +7 -4
  97. package/templates/agent-skills/ark-adopt/SKILL.md +91 -6
  98. package/templates/agent-skills/ark-architect/SKILL.md +5 -18
  99. package/templates/agent-skills/ark-autopilot/SKILL.md +14 -6
  100. package/templates/agent-skills/ark-contract/SKILL.md +9 -20
  101. package/templates/agent-skills/ark-coverage/SKILL.md +13 -9
  102. package/templates/agent-skills/ark-explain/SKILL.md +11 -5
  103. package/templates/agent-skills/ark-explore/SKILL.md +39 -5
  104. package/templates/agent-skills/ark-fix/SKILL.md +15 -20
  105. package/templates/agent-skills/ark-loop/SKILL.md +14 -20
  106. package/templates/agent-skills/ark-order/SKILL.md +200 -0
  107. package/templates/agent-skills/ark-place/SKILL.md +49 -11
  108. package/templates/agent-skills/ark-runtime/SKILL.md +21 -6
  109. package/templates/agent-skills/ark-think/SKILL.md +24 -126
  110. package/templates/agent-skills/ark-upgrade/SKILL.md +14 -3
  111. package/templates/arkrules/DomainModel.json +14 -1
  112. package/templates/skills/ark-adopt.md +91 -6
  113. package/templates/skills/ark-architect.md +5 -18
  114. package/templates/skills/ark-autopilot.md +14 -6
  115. package/templates/skills/ark-contract.md +9 -20
  116. package/templates/skills/ark-coverage.md +13 -9
  117. package/templates/skills/ark-explain.md +11 -5
  118. package/templates/skills/ark-explore.md +39 -5
  119. package/templates/skills/ark-fix.md +15 -20
  120. package/templates/skills/ark-loop.md +14 -20
  121. package/templates/skills/ark-order.md +200 -0
  122. package/templates/skills/ark-place.md +49 -11
  123. package/templates/skills/ark-runtime.md +21 -6
  124. package/templates/skills/ark-think.md +24 -126
  125. package/templates/skills/ark-upgrade.md +14 -3
  126. package/templates/tests/ark-adoption-gaps.test.ts +5 -4
@@ -12,12 +12,13 @@ npm run check
12
12
 
13
13
  Pick by archetype — see [examples/README.md](https://github.com/pedroknigge/arkgate/blob/main/examples/README.md).
14
14
 
15
- ## When to use a starter vs hexagonal-order-api
15
+ ## When to use a starter vs hexagonal-order-api vs billing
16
16
 
17
17
  | Need | Use |
18
18
  |------|-----|
19
19
  | Fast baseline layout | `*-starter/` gallery |
20
20
  | Runnable API + break exercises | `hexagonal-order-api/` |
21
+ | ArkOrder freeze / valve (optional extra) | [arkorder-billing](https://github.com/pedroknigge/arkgate/tree/main/examples/arkorder-billing) — not a starter, not in the npm tarball |
21
22
 
22
23
  ## After copying
23
24
 
@@ -26,7 +26,7 @@ Run **`/ark-adopt`** on a greenfield or early-adoption repo (leftover `/ark-arch
26
26
  | `adoptInOrder.phase1` | Folders to create first |
27
27
  | `analogy` | Plain-language mental model |
28
28
  | `antiPatterns` | What Ark will block later |
29
- | `firstCommand` | Usually `ark init --archetype <id> --yes` |
29
+ | `firstCommand` | Usually `ark start --apply --archetype <id>` |
30
30
 
31
31
  Framework names appear only as secondary `toolHints` in JSON — never as the archetype label.
32
32
 
@@ -10,10 +10,12 @@ AI can build fast—and make a mess just as fast.
10
10
 
11
11
  Keep the product easy to understand, change, and trust.
12
12
 
13
- ArkGate stops bad shortcuts. ArkRules protects how each part should behave. ArkRun keeps work moving. ArkOrder protects the few big choices that should not change by accident.
13
+ Contain what the AI may write, and in what shape. Guide you with proven patterns and one next step. Order leftover mess toward a clean tree, a little at a time.
14
14
 
15
15
  Safer changes, fewer surprises, and extra protection only when you choose it.
16
16
 
17
+ That is **Contener · Guiar · Ordenar**.
18
+
17
19
  That is the product wedge (host hook + required CI). Skills name the next step after that.
18
20
  **Not the wedge:** the optional in-process **ArkRun** runtime (`arkgate/runtime`) and the
19
21
  optional **ArkOrder** pattern extra (`arkgate/order`).
@@ -37,7 +39,7 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
37
39
 
38
40
  | Surface | How you use it | Stability notes |
39
41
  |---------|----------------|-----------------|
40
- | **CLI** | `arkgate` / `arkgate-check` (aliases `ark` / `ark-check`); optional ArkRun **`ark-dashboard`** / **`arkgate-dashboard`** | Flags and human text may improve; **JSON output shapes** for `--json` (check, doctor, plan, coverage, recommend, **status**, **agents-md**, **report**) 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). **`arkgate report` / `ark report`** drafts an upstream GitHub issue for `pedroknigge/arkgate` (`package.json` `bugs.url`) — never the consumer repo. **Dashboard bins** poll an ArkRun inspector snapshot (ANSI + interval polling; `--url` / `--interval`); they are not a gate verdict. The main CLI also accepts `ark dashboard` / `arkgate dashboard` as a passthrough to those bins. |
42
+ | **CLI** | `arkgate` / `arkgate-check` (aliases `ark` / `ark-check`); optional ArkRun **`ark-dashboard`** / **`arkgate-dashboard`** | Flags and human text may improve; **JSON output shapes** for `--json` (check, doctor, plan, coverage, recommend, **status**, **agents-md**, **report**) 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. Soft ADR presence: when that demand (or doctor `required-merge`) is on and `docs/adr/` / `docs/decisions/` is missing, doctor JSON may add `adrPresence` and human copy points at a short decision note — never a fail, omitted when the demand is off. Soft states/transitions: when a conventional domain doc is already in play and the map is missing or heading-only, doctor JSON may add `statesTransitions` and human copy points at a short table (or one link) — never a fail, omitted when that doc is absent. Narrow status/transition catalog: when Domain-role code already names a closed status/state vocabulary and that map is still thin, doctor JSON may add `statusTransitionCatalog` with those names — never a fail, omitted when Domain has no such vocabulary, the domain doc is absent, or the map is already present. Soft no-Domain / UI-logic residual: when a Domain-role layer is declared but empty and presentation holds the tree (or `domain-logic-in-ui` is already present), doctor JSON may add `noDomainFrontend` and human copy points at one Domain file — never a fail, omitted when there is no frontend, Domain already has files, or the UI bag is too thin. `ark status --json` is the unified status snapshot. `ark agents-md` is the version-matched agent projection (non-authoritative). **`arkgate report` / `ark report`** drafts an upstream GitHub issue for `pedroknigge/arkgate` (`package.json` `bugs.url`) — never the consumer repo. **Dashboard bins** poll an ArkRun inspector snapshot (ANSI + interval polling; `--url` / `--interval`); they are not a gate verdict. The main CLI also accepts `ark dashboard` / `arkgate dashboard` as a passthrough to those bins. |
41
43
  | **Upstream report CLI (4.8.10)** | `arkgate report` / `ark report` on the existing dual bins (no new bin, no new skill) | Default prints a draft for **upstream** `pedroknigge/arkgate` (`package.json` `bugs.url`) with the arkgate version and optional last-check snippet. Create only with `--submit` **and** `--i-confirm-submit` (after HITL) or TTY `Type submit to send`. `--yes` does not submit. Missing/unauthenticated `gh`: print the draft plus the exact `gh issue create --repo pedroknigge/arkgate` command, exit 2. Never files against the consumer repo. Not `ark-check --report` (HTML architecture report). |
42
44
  | **Host write boundaries** | Generated trusted PreToolUse/preToolUse hooks + `ark-mcp --hook`; inspect with doctor/status | Hard is always operation-scoped and runtime-evidenced. From 4.6.3, Codex CLI and local ChatGPT Desktop/App Server can hard-block a complete `apply_patch` sent as `tool_input.command`; `.codex/hooks.json` on disk remains unverified until a fresh covered invocation. Hosted tools, specialized hook opt-outs, shell/direct writes, incomplete reconstruction, and humans rely on required CI. Repair envelopes may emit, but Codex reinjection is not guaranteed. |
43
45
  | **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. |
@@ -64,15 +66,17 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
64
66
  | **Report parity and snapshot evidence (4.2)** | `ark-check --report` → advisory sections (`data-advisory="contractHealth\|ambientState\|parseHealth\|arkRun"`, 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. Thin `arkRun` on `latest.json` is `notAScore` residual honesty for `ark status`. |
65
67
  | **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. |
66
68
  | **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 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. |
67
- | **`ark.config.json`** | Layer globs, optional `layers[].description`, rules, include/exclude, forbiddenGlobals, intent prefixes, `peerIsolation`, `dynamicImportAllowlist`, `safety` thresholds; optional **`coverage`** controls (`testGlobs`, `maxFiles`); optional **`arkRules`** map (schema `1.1+`); optional **`arkRun`** extra (schema `1.2+`); optional **`arkOrder`** extra (schema `1.3+`) | Versioned by `schemaVersion`; unknown fields fail closed and migrations preserve the previous supported major. Absence of `coverage`, `arkRules`, `arkRun`, or `arkOrder` is byte-for-byte silent on Layers / ArkRules verdicts. Enforced extra teeth share the CLI / MCP / hook / preflight / CI verdict and arm only when the layer plane is classified (same ArkRules floor). |
69
+ | **`ark.config.json`** | Layer globs, optional `layers[].description`, optional `layers[].trustBoundary`, optional `layers[].owners`, optional `requireLayerOwners`, rules, include/exclude, forbiddenGlobals, intent prefixes, `peerIsolation`, `dynamicImportAllowlist`, `safety` thresholds; optional **`coverage`** controls (`testGlobs`, `maxFiles`); optional **`arkRules`** map (schema `1.1+`); optional **`arkRun`** extra (schema `1.2+`); optional **`arkOrder`** extra (schema `1.3+`) | Versioned by `schemaVersion`; unknown fields fail closed and migrations preserve the previous supported major. Absence of `coverage`, `arkRules`, `arkRun`, or `arkOrder` is byte-for-byte silent on Layers / ArkRules verdicts. Enforced extra teeth share the CLI / MCP / hook / preflight / CI verdict and arm only when the layer plane is classified (same ArkRules floor). |
68
70
  | **Layer caption (`layers[].description`, 4.8.7)** | Optional string on each layer. Projected onto `ark_place` / prepare-write / MCP place JSON, doctor JSON + human, coverage JSON, and the HTML Purpose column when present. `/ark-adopt` writes it from the product map or glossary; `/ark-place` prints it next to layer name + globs. | Existing optional field — **no `schemaVersion` bump**, no new key, no 14th skill. Copy is **app context** (a product sentence such as `Purchase requests — from asked to received.`), not architecture jargon. Stripped from `policyHash` like `stewards`; caption-only edits are neutral. Absence is silent: never a residual, never a score, never `--strict-config` fail, never flips `valid`. Compact starters may omit. |
71
+ | **Layer trust (`layers[].trustBoundary`)** | Optional closed tag on each layer: `public` \| `auth` \| `admin` \| `internal`. Projected onto `ark_place` / prepare-write / MCP place JSON, doctor JSON + human, coverage JSON, and the HTML report when present. `/ark-adopt` writes it when the product map names that door; `/ark-place` prints `trust: public`. | Additive optional field — **no `schemaVersion` bump**, no new skill. Stripped from `policyHash` like `stewards` and `layers[].description`; tag-only edits are neutral. Absence is silent: never a residual, never a score, never `--strict-config` fail, never flips `valid`. Invalid values fail the schema. Compact starters may omit. Not host/CI TLS. Not an import-rule matrix. |
72
+ | **Layer owners (`layers[].owners` + `requireLayerOwners`)** | Optional GitHub handles or emails on each layer. Projected onto place / prepare-write / MCP / doctor / coverage / HTML when present. `requireLayerOwners: true` asks for owners on every live (non-reserved) layer: doctor names the first missing house, `--strict-config` refuses, and the write gate denies a write into that house. | Additive optional fields — **no `schemaVersion` bump**, no new skill. Owners are stripped from `policyHash` like captions; owner-only edits are neutral. The require flag stays in the hash. Absence of owners is silent unless the require flag is on. Invalid identity (display name) fails the schema. Compact starters may omit. Not import-rule teeth. No `/ark-owners`. |
69
73
  | **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. |
70
74
  | **`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`. |
71
75
  | **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. |
72
76
  | **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`. |
73
77
  | **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. |
74
78
  | **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. |
75
- | **Team parliament (law vs feature)** | Optional `stewards` on `ark.config.json` (GitHub handle or email); CLI `--changed` / `--against` / `--base` / `--contract-diff` / `--contract-session` / `--persona` / `--author`; check JSON `teamParliament`; `ark status --vs`; write-gate mixed-batch deny | Additive. Law files must not mix with product source. Loosen / baseline-grow are steward-only when `stewards` is set. `--against` ratchets vs the base-ref baseline. `--changed` scans touched sources. `stewards` and `layers[].description` are excluded from policy hash. Identity is handle or email, not git `user.name`. No org plane. |
79
+ | **Team parliament (law vs feature)** | Optional `stewards` on `ark.config.json` (GitHub handle or email); CLI `--local` / `--changed` / `--against` / `--base` / `--contract-diff` / `--contract-session` / `--persona` / `--author`; check JSON `teamParliament`; `ark status --vs`; write-gate mixed-batch deny | Additive. Law files must not mix with product source. Loosen / baseline-grow are steward-only when `stewards` is set. `--against` ratchets vs the base-ref baseline. `--changed` scans touched sources plus their import closure. `--local` (or `ARK_CHECK_LOCAL=1`) is the same cheap path and stays per `--root`; it cannot combine with `--strict-merge`. Check JSON may add `local`, `scope: "changed"`, `analysisRoot`. `stewards`, `layers[].description`, `layers[].trustBoundary`, and `layers[].owners` are excluded from policy hash. `requireLayerOwners` stays in the hash. Identity is handle or email, not git `user.name`. No org plane. |
76
80
  | **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. |
77
81
  | **Architecture change map (3.1.0)** | `arkgate/schema/change-map` or `arkgate/schema/ark.change-map.schema.json`; CLI `ark preflight --change-map <file>`; MCP `ark_prepare_change.changeMap` | Optional strict schema `1.0`. Canonical planned paths + operations + resolved Ark layers + dependencies between planned files. Preflight returns `changeMapHash`; absence is normal and adds no project file. Structural intent only, never behavioral completion. |
78
82
  | **Structural convergence (3.1.0)** | `analyzeArchitectureConvergence(...)`; map-enabled `preflightChange(...)`; existing CLI/MCP preflight adapters | Additive `convergence` result with stable `satisfied`, `missing`, `contradictory`, and `unplanned` findings. Uses the supplied/current project tree as base and the explicit complete change set as candidate; no implicit Git or LLM input. `readOnly: true`; `behavioralCompletion: "not-evaluated"`. Structural mismatch makes preflight invalid. |
@@ -84,11 +88,11 @@ hardening guide remains repository-hosted rather than duplicated in the gate tar
84
88
  | **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. ArkRun `ARKRUN_*` codes (RN05) share dual-depth `nextAction` / `enthusiastHint`; declaration-list adds are mechanical-safe only when the call-site literal already exists. Docs ship in the npm tarball. |
85
89
  | **Status manifest** | CLI `ark status [--json] [--vs <ref>]`; 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, **`improvementCompass`** with honesty **`mode`** `full`\|`subset`\|`unavailable` (residual ids only; always `notAScore: true`; optional `reasonCode`/`reason`/`factsSource`/`contractHash`), optional **`vsBase`** (pin / contract / baseline grow vs a git ref; advisory only), and additive **`arkRun`** (`notAScore`; `present` / `mode` / `extraMergeTeeth` / residual count — null residual is unknown, not green). **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. |
86
90
  | **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. |
87
- | **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`. |
91
+ | **Agent Skills packaging** | `templates/agent-skills/<name>/SKILL.md` (+ package README); root API `ARK_SKILL_NAMES` / `ARK_FIRST_CLASS_SKILL_NAMES` / `validateAgentSkillsPackage` / `validateSkillProductCapacity`; `npm run check:agent-skills` | Schema `1.0` (package contract). Closed catalog (`ARK_SKILL_NAMES`): first-class doors plus one-release stubs, 1:1 with flat `templates/skills/*.md`. First-class `/ark-order` (issue #216 / ADR 0036). `check:agent-skills` fails closed when a product plane or the north star drops out of skill bodies or living hubs. Add a name only with a live ROADMAP item. |
88
92
  | **`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`). |
89
93
  | **`arkgate/schema/resolved-candidate-facts`** or **`arkgate/schema/ark.resolved-candidate-facts.schema.json`** | Versioned parity-capable input for `analyzeResolvedProject` / `preflightResolvedChange` | Schema `1.2` is additive: optional `classShapes` (1.1) plus ArkRun `arkRunKernelCalls` / `arkRunManagedNews` / `arkRunCompositionRootHits` / `arkRunDeclarations` (RN03–RN04) and ArkOrder `arkOrderPlaneCalls` / `arkOrderGenericUpdates` / `arkOrderRootHits` (OR05). `1.0`/`1.1` payloads remain loadable. 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, candidate tree/facts hashes, and (when present) ArkRun/ArkOrder call-site evidence. Tier-1 sensors emit `ARKRUN_*` / `ARKORDER_*` diagnostics from those facts: advisory never flips `valid`; enforced blocks. Extra absence is silent. |
90
94
  | **Config JSON Schema** | `arkgate/schema` or `arkgate/schema/ark.config.schema.json` | Stable package resource subpaths for editor completion and contract tooling. |
91
- | **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 — 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:** 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. |
95
+ | **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 — not the full skill pack. Closed catalog (`ARK_SKILL_NAMES`): first-class doors (including `/ark-order`) plus one-release stubs. Guided expert path remains `/ark-autopilot` after pack install. **4.0:** first-class doors except experimental `/ark-runtime` / `/ark-order` 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:** 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). **#216:** first-class `/ark-order`; ACS05 freeze opened (ADR 0036). Domain `ARK_SKILL_NAMES` + `validateAgentSkillsPackage` + `validateSkillProductCapacity`; drift `npm run check:agent-skills` (layout **and** 100% product coverage). Skills never enforce. |
92
96
  | **ESLint subpath** | `arkgate/eslint` | Config-driven layer/import/purity rules plus ArkRun import/`new` envelope (`ark/no-arkrun-kernel-in-domain`, `ark/no-arkrun-direct-new`, `ark/no-arkrun-transport-bypass`) when `arkRun` is on, and ArkOrder envelope (`ark/no-arkorder-kernel-in-domain`, `ark/no-arkorder-generic-update`) when `arkOrder` is on; loads consumer `ark.config.json`. Absence of an extra is silent. Missing-root / missing-plane and undeclared-* stay CLI/MCP. |
93
97
  | **GitHub Action** | `pedroknigge/arkgate` (see `action.yml`) | The `uses:` tag/SHA selects the checker source; `version` remains an optional exact npm compatibility override. |
94
98
  | **Package metadata** | `arkgate/package.json` | Stable resource subpath for tooling that needs the installed manifest. |
@@ -42,6 +42,26 @@ ArkOrder optional big product choices (billing plan, not seat counts)
42
42
  Status first (`arkgate-check --doctor`). One next step. CLI flag `--doctor` stays;
43
43
  human copy says **status**.
44
44
 
45
+ **Contener · Guiar · Ordenar** is the product north star (not a score). First
46
+ contact says it in ordinary English: contain the write, guide the next step,
47
+ order leftover mess.
48
+
49
+ - **Contener** — decide what the AI may write, and in what shape. ArkGate is
50
+ this: import rules, write + required CI. ArkRules is optional shape inside a
51
+ part.
52
+ - **Guiar** — show a proven next step so a non-expert is not stuck. Doctor
53
+ action #1. Skills. ArkRun is an optional experimental runtime.
54
+ - **Ordenar** — tidy a messy tree toward a clean one, one small refactor at a
55
+ time. ArkOrder is the optional extra for the few big product choices (billing
56
+ plan, not seat counts).
57
+
58
+ The skill *set* must cover Layers + ArkRules + ArkRun + ArkOrder and say when /
59
+ not when / handoff. First-class `/ark-order`; leftover `/ark-*` names are
60
+ one-release stubs. ACS05 freeze was opened for that door
61
+ ([ADR 0036](adr/0036-skill-catalog-product-capacity.md)); Domain `ARK_SKILL_NAMES`
62
+ still closes the list. See [agent guide — skills](agent-guide.md#install-skills-ark-and-ecosystem).
63
+ Skills never enforce. ξ / Haken stay below the fold.
64
+
45
65
  ---
46
66
 
47
67
  ## Locked first-contact
@@ -53,8 +73,9 @@ On the eight canonical public openings — `README.md`, `docs/use.md`,
53
73
  1. **Verbs:** `Write. Check. Ship.`
54
74
  2. **Deny:** `When the agent writes a bad import, the write doesn’t land. The same check fails the pull request.`
55
75
  3. **Not-that (below the fold, one line):** `Not an API Gateway. Not a folder linter. If the check is not required on the PR, the config is just documentation.`
56
- 4. **Story:** the exact four-paragraph introduction below, with no visible heading or labels.
57
- 5. **Technical nouns (below the introduction):** ArkGate is import rules. ArkRules is optional policies. ArkRun is an optional experimental runtime. ArkOrder stops rewriting a big product choice (like billing plan) as if it were a seat count — named when the consumer opts in, never as the first noun. No ξ / Haken / slaving on the first screen.
76
+ 4. **Story:** the exact four-paragraph introduction below, with no visible heading or labels. Paragraph 3 is the north star in ordinary English.
77
+ 5. **Caption (immediately after the four paragraphs):** `That is **Contener · Guiar · Ordenar**.`
78
+ 6. **Technical nouns (below the introduction):** ArkGate is import rules. ArkRules is optional policies. ArkRun is an optional experimental runtime. ArkOrder is the extra for the few big product choices (billing plan, not seat counts) — named when the consumer opts in, never as the first noun. No ξ / Haken / slaving on the first screen.
58
79
 
59
80
  Do not lead with folders, `ark.config.json`, “contract”, “gate”, “house”, or “doctor”
60
81
  as the first noun. Historical: `If the AI writes an illegal import, the write is rejected`
@@ -75,10 +96,12 @@ AI can build fast—and make a mess just as fast.
75
96
 
76
97
  Keep the product easy to understand, change, and trust.
77
98
 
78
- ArkGate stops bad shortcuts. ArkRules protects how each part should behave. ArkRun keeps work moving. ArkOrder protects the few big choices that should not change by accident.
99
+ Contain what the AI may write, and in what shape. Guide you with proven patterns and one next step. Order leftover mess toward a clean tree, a little at a time.
79
100
 
80
101
  Safer changes, fewer surprises, and extra protection only when you choose it.
81
102
 
103
+ That is **Contener · Guiar · Ordenar**.
104
+
82
105
  Do not add technical terms to these four paragraphs. In the next section, explain that
83
106
  ArkGate checks imports, ArkRules is optional, ArkRun is experimental and in-memory,
84
107
  and ArkOrder is optional and stops rewriting a big product choice like the billing plan.
@@ -173,7 +196,7 @@ a product PR — that is an owner `--contract-session` (config change).
173
196
  - Emoji rain, crush-it, fake amigo, “you don’t need to understand”
174
197
  - Auto-fix-everything / magic codemod
175
198
  - Suggest / Adapt / Enforce as settings you pick — they are lights (Setup / In progress / Ready)
176
- - Skill-shopping thirteen names as onboarding
199
+ - Skill-shopping leftover shortcut names as onboarding
177
200
  - “Healthy / done” while leftover design work remains
178
201
  - “MCP is active” because a file exists
179
202
  - Package AI decided pass/fail
@@ -193,13 +216,16 @@ npx arkgate start → start --apply → arkgate-check
193
216
  ```
194
217
 
195
218
  Five commands, not a menu exam: adopt · place · autopilot · explore · upgrade.
196
- Invoking a command **is** the approval. CLI checks; it does not silently rewrite.
219
+ First-class extras: runtime (ArkRun) · **order** (ArkOrder). Other `/ark-*` names
220
+ are one-release shortcuts. Invoking a command **is** the approval. CLI checks; it
221
+ does not silently rewrite.
197
222
 
198
223
  ---
199
224
 
200
225
  ## Checklist before shipping copy
201
226
 
202
- - [ ] **Write. Check. Ship.** is on first-contact.
227
+ - [ ] **Write. Check. Ship.** is on first-contact (the deny / wedge).
228
+ - [ ] **Contener · Guiar · Ordenar** is on first-contact in ordinary English (contain the write, guide the next step, order leftover mess).
203
229
  - [ ] Deny is `When the agent writes a bad import, the write doesn’t land.`
204
230
  - [ ] One next action is obvious.
205
231
  - [ ] ArkGate / ArkRules / ArkRun / ArkOrder are import rules / policies / experimental runtime / the extra that stops a big product choice being rewritten like a seat count.
@@ -33,7 +33,7 @@ infrastructure beyond how this package is published.
33
33
  | T4 | Config weakened (`peerIsolation: false`, empty rules) | False green | semantic policy-delta guard in strict merge; hash-bound `--policy-ack`; `--contract-session` required even when `stewards[]` is empty; present-state safety diagnostics |
34
34
  | T5 | Baseline ratcheted open | Debt reintroduced | `--update-baseline` requires `--contract-session` even with an empty steward list (`--force` is concentration, not parliament); unused/stale signals; occurrence keys |
35
35
  | T6 | Stale MCP/global CLI or wrong root | Gate points at old package / wrong tree | project identity binding; stale process non-authoritative + `PROCESS_PACKAGE_STALE`; project-local upgrade handoff |
36
- | T7 | Malicious dependency in publish | Compromised gate | signed tags, npm provenance, dependency-review, CodeQL, Semgrep, `verify-package-files` |
36
+ | T7 | Malicious dependency in publish | Compromised gate | annotated tags, npm provenance, dependency-review, CodeQL, Semgrep, `verify-package-files` |
37
37
  | T8 | Path traversal in hooks/check | Read/write outside project | root resolution + under-root import resolve |
38
38
  | T9 | Runtime InMemory mistaken for durable | Data loss | durability stance docs + safety InMemory production detector |
39
39
  | T10 | Repair payload silently applied | Unexpected rewrites | repair never writes; host must re-inject; exit 2 on deny |
@@ -48,7 +48,7 @@ Codex apply_patch --PreToolUse--> arkgate-mcp (hard for complete trusted + obser
48
48
  Any MCP host --tool call----> arkgate-mcp (advisory validation)
49
49
  Human IDE --disk/git-----> working tree
50
50
  working tree --PR-----------> CI ark-check --strict-merge
51
- npm publish <-- signed tag --- GitHub Release + provenance
51
+ npm publish <-- annotated tag --- GitHub Release + provenance
52
52
  ```
53
53
 
54
54
  Codex hosted tools, specialized hook opt-outs, shell/direct writes, and incomplete patch
@@ -176,10 +176,10 @@ The release compatibility workflow packs the candidate first, then tests clean c
176
176
  - **npm / pnpm / Yarn**;
177
177
  - project TypeScript **5.9.3 / 6.0.3 / 7.0.2**.
178
178
 
179
- That is **36** installed-artifact cells on the **full matrix** path (`push` to `main`, PR labels
180
- `full-matrix` / `release`, or release-prep branch names such as `feat/4.1*`). Ordinary PRs run a
179
+ That is **36** installed-artifact cells on the **full matrix** path (`push` to `main`, or an
180
+ explicit `full-matrix` label). Ordinary PRs run a
181
181
  **slim** packed smoke: **one** cell (Node 20 + npm) that still exercises TS 5/6/7 in-process.
182
- See [CONTRIBUTING.md — CI profiles](../CONTRIBUTING.md#ci-profiles-pr-slim-vs-full-matrix).
182
+ See [CONTRIBUTING.md — CI](../CONTRIBUTING.md#ci-this-repo).
183
183
 
184
184
  Each cell verifies that the project's `tsc` stays on the requested project compiler and that
185
185
  ArkGate resolves its fallback as exact 6.0.3 when the project API is unusable. Reports record
package/docs/use.md CHANGED
@@ -11,10 +11,12 @@ AI can build fast—and make a mess just as fast.
11
11
 
12
12
  Keep the product easy to understand, change, and trust.
13
13
 
14
- ArkGate stops bad shortcuts. ArkRules protects how each part should behave. ArkRun keeps work moving. ArkOrder protects the few big choices that should not change by accident.
14
+ Contain what the AI may write, and in what shape. Guide you with proven patterns and one next step. Order leftover mess toward a clean tree, a little at a time.
15
15
 
16
16
  Safer changes, fewer surprises, and extra protection only when you choose it.
17
17
 
18
+ That is **Contener · Guiar · Ordenar**.
19
+
18
20
  For **anyone** shipping TypeScript with an AI coding agent.
19
21
 
20
22
  ---
@@ -24,11 +26,16 @@ For **anyone** shipping TypeScript with an AI coding agent.
24
26
  ```bash
25
27
  npm install -D arkgate typescript
26
28
  npx arkgate start # preview what will change
27
- npx arkgate start --apply # install compact config + host router + CI plan
29
+ npx arkgate start --apply # install compact config + host router + CI; merge write-path gates into existing AGENTS.md / .mcp.json
28
30
  npx arkgate-check --doctor # status — one next step
29
31
  npx arkgate-check --doctor --all # full details
30
32
  ```
31
33
 
34
+ `start --apply` refuses when projected governed coverage is below 50% or
35
+ shape confidence is weak (below 0.6 with coverage under 80%). That lock is
36
+ deliberate. Lock the shape with `--archetype <id>`, `--preset <name>`, or
37
+ `--force`, or inspect ranked shapes with `npx arkgate-check --recommend`.
38
+
32
39
  Then keep working with your agent. Stuck? Run `--doctor` and do action **#1**. Compact first; `--all` for details.
33
40
 
34
41
  | Stuck on… | Do this |
@@ -56,11 +63,10 @@ In those cases a boundary linter or editor rules may be enough; see [README —
56
63
 
57
64
  ### Why it exists
58
65
 
59
- AI coding agents write code at unprecedented speeds, but they tend to take the shortest path to solve a problem. If an agent needs data in a Domain layer, it might directly import a database adapter. Left unchecked, this creates spaghetti code and technical debt at light speed.
60
-
61
- Traditional linters catch these architectural violations in CI *after* the agent has finished its work, breaking the flow and requiring manual intervention.
62
-
63
- ArkGate solves this by shifting the check to the exact moment of writing. By intercepting file writes, it ensures that if the agent writes a bad import, the write doesn't land. The agent gets immediate feedback and can self-correct before the code even touches your disk.
66
+ AI takes the shortest path. Contain the write so a bad import never lands. Guide
67
+ the next step so a non-expert is not stuck. Order leftover mess toward a clean
68
+ tree, one small refactor at a time. Traditional linters catch this only after
69
+ the agent finished; ArkGate checks at write time and again on the PR.
64
70
 
65
71
  ---
66
72
 
@@ -86,10 +92,10 @@ The config only binds when the write doesn’t land and CI is required.
86
92
 
87
93
  | | Plain English | Default |
88
94
  |--|---------------|---------|
89
- | **ArkGate** (layers) | Import rules. The write doesn’t land. The PR fails. | Always — this is the product |
90
- | **ArkRules** | Optional policies *inside* a layer. | Off until you turn it on (start may ship advisory templates) |
91
- | **ArkRun** | Optional experimental runtime (`arkgate/runtime`) | Off. In-memory. Not Postgres. |
92
- | **ArkOrder** | Stops rewriting a big product choice (like billing plan) as if it were a seat count. Change it through a valve, not a generic update. Library + sensors, [not a service](arkorder.md). | Off. Same npm package (`arkgate/order`). Name the few choices (`xiKeys`). Invoices and seats still flow. In-memory. Not durable. |
95
+ | **ArkGate** (layers) | **Contener** — import rules. The write doesn’t land. The PR fails. | Always — this is the product |
96
+ | **ArkRules** | **Contener** — optional policies *inside* a layer. | Off until you turn it on (start may ship advisory templates) |
97
+ | **ArkRun** | **Guiar** — optional experimental runtime (`arkgate/runtime`) | Off. In-memory. Not Postgres. |
98
+ | **ArkOrder** | **Ordenar** extra the few big choices (billing plan, not seat counts). Library + sensors, [not a service](arkorder.md). | Off. Same npm package (`arkgate/order`). Name the few choices (`xiKeys`). Invoices and seats still flow. In-memory. Not durable. |
93
99
 
94
100
  Start always gives you **layers**. Compact starters do **not** turn on ArkRun or
95
101
  ArkOrder. No extras is fine — only ArkGate runs. Leftovers are labeled
@@ -97,6 +103,11 @@ ArkOrder. No extras is fine — only ArkGate runs. Leftovers are labeled
97
103
  imports ≠ elegant design. Green imports also ≠ a frozen billing plan. ArkRun ≠
98
104
  durable stores. ArkOrder does not replace ArkRun.
99
105
 
106
+ Want to see the freeze and valve? The billing gallery lives on GitHub, not in
107
+ the npm tarball:
108
+ [examples/arkorder-billing](https://github.com/pedroknigge/arkgate/tree/main/examples/arkorder-billing).
109
+ First freeze is `release()`. Later plan change is `proposeRelease` then `apply`.
110
+
100
111
  ### New modules vs config edits
101
112
 
102
113
  **Happy path:** put a new module under an existing layer directory/glob (`layers[].patterns`). Usually
@@ -229,6 +240,7 @@ Empty plan A is **not** “architecture finished.”
229
240
  - Plain-language track: [enthusiast/](enthusiast/README.md)
230
241
  - First project tutorial: [enthusiast/tutorial-first-project.md](enthusiast/tutorial-first-project.md)
231
242
  - Demos: [demos/](demos/)
243
+ - ArkOrder proof (first freeze, then valve): [billing gallery](https://github.com/pedroknigge/arkgate/tree/main/examples/arkorder-billing) (GitHub, not in the npm tarball)
232
244
 
233
245
  ---
234
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkgate",
3
- "version": "4.8.13",
3
+ "version": "4.8.15",
4
4
  "description": "When the agent writes a bad import, the write doesn’t land. The same check fails the pull request.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unpkg.com/arkgate@2/schemas/ark.config.schema.json",
3
+ "$id": "https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",
4
4
  "title": "ArkGate architecture contract",
5
5
  "description": "Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.",
6
6
  "type": "object",
@@ -16,7 +16,7 @@
16
16
  "$schema": {
17
17
  "type": "string",
18
18
  "minLength": 1,
19
- "default": "https://unpkg.com/arkgate@2/schemas/ark.config.schema.json",
19
+ "default": "https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",
20
20
  "description": "Editor-facing URL or local path for this JSON Schema."
21
21
  },
22
22
  "schemaVersion": {
@@ -650,6 +650,9 @@
650
650
  },
651
651
  "uniqueItems": true,
652
652
  "default": []
653
+ },
654
+ "requireLayerOwners": {
655
+ "type": "boolean"
653
656
  }
654
657
  },
655
658
  "$defs": {
@@ -694,6 +697,24 @@
694
697
  "type": "string",
695
698
  "minLength": 1
696
699
  },
700
+ "trustBoundary": {
701
+ "type": "string",
702
+ "enum": [
703
+ "public",
704
+ "auth",
705
+ "admin",
706
+ "internal"
707
+ ]
708
+ },
709
+ "owners": {
710
+ "type": "array",
711
+ "items": {
712
+ "type": "string",
713
+ "minLength": 1
714
+ },
715
+ "uniqueItems": true,
716
+ "minItems": 1
717
+ },
697
718
  "forbiddenGlobals": {
698
719
  "type": "array",
699
720
  "items": {
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.8.13",
9
+ "version": "4.8.15",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "arkgate",
14
- "version": "4.8.13",
14
+ "version": "4.8.15",
15
15
  "runtimeHint": "npx",
16
16
  "transport": {
17
17
  "type": "stdio"
@@ -4,13 +4,15 @@
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
- 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.**
7
+ This directory is the **Agent Skills–compatible** packaging of the same
8
+ closed `/ark-*` catalog shipped as flat templates for Ark install.
9
+ **Closed catalog** (`ARK_SKILL_NAMES`) — first-class doors plus one-release
10
+ redirect stubs. Add a name only with a live ROADMAP item.
9
11
 
10
- Package version when last generated context: **arkgate@4.8.9**
12
+ Package version when last generated context: **arkgate@4.8.15**
11
13
  Schema: agent-skills package contract `1.0`
12
14
 
13
- ## Skills (frozen catalog)
15
+ ## Skills (closed catalog)
14
16
 
15
17
  - `ark-adopt`
16
18
  - `ark-architect`
@@ -21,6 +23,7 @@ Schema: agent-skills package contract `1.0`
21
23
  - `ark-explore`
22
24
  - `ark-fix`
23
25
  - `ark-loop`
26
+ - `ark-order`
24
27
  - `ark-place`
25
28
  - `ark-runtime`
26
29
  - `ark-think`
@@ -5,6 +5,10 @@ description: Session 0 — write the rules file (ark.config.json) to match the r
5
5
 
6
6
  # /ark-adopt — Mark the path (session 0)
7
7
 
8
+ **Contener · Guiar · Ordenar.** In plain words: contain the write, guide the next
9
+ step, order leftover mess. This door is **Contener**: write the path so the tree
10
+ has honest houses. Skills never enforce — CLI / hooks / CI do.
11
+
8
12
  **When:** empty tree, or the rules file does not match the real folders (session 0).
9
13
  **Not when:** a single new file (`/ark-place`) or leftover design after the path is honest (`/ark-explore` then `/ark-autopilot`).
10
14
 
@@ -17,11 +21,33 @@ description: Session 0 — write the rules file (ark.config.json) to match the r
17
21
  ## Checklist
18
22
 
19
23
  - Existing tree: propose **SharedKernel** (types/constants) + **CompositionRoot** (wiring) + `src/**/domain/**`. Never dump bare `src/lib/**` into Application.
24
+ - Every `include` path must land in a layer. Include that classifies no file is the
25
+ same as an empty check — not a pass. Fix globs here; do not leave a loose gap.
20
26
  - Generate `.ark/golden-pattern.json` (load-bearing for `/ark-place`).
21
27
  - Future houses: mark unused layer globs `reserved` / `allowEmpty` so `--strict-config` does not fail.
22
28
  - When the product map or glossary names a house, write `layers[].description` as
23
29
  app-context copy (what this folder is *in the product*). Compact starter may omit.
24
30
  Do not invent captions. Do not invent `/ark-describe`.
31
+ - When the product map names who a folder is for, write `layers[].trustBoundary`
32
+ (`public` | `auth` | `admin` | `internal`). Compact starter may omit. Do not
33
+ invent tags. Absence is silent. No `/ark-trust`.
34
+ - When the product map names who owns a folder, write `layers[].owners`
35
+ (GitHub handle or email). Compact starter may omit. Do not invent people.
36
+ Absence is silent unless the user asked for required owners — then write
37
+ `requireLayerOwners: true` after the live houses have names. No `/ark-owners`.
38
+ - When the user wants required gates (`--require-gates` / `--strict-merge` /
39
+ required GitHub check) and there is no `docs/adr/` (or `docs/decisions/`),
40
+ leave a short decision note there — only if they loosen a rule or add a real
41
+ gate. Not every change. Doctor residual is soft. No `/ark-adr`.
42
+ - When a product-domain doc is already in play (`docs/domain.md` or a sibling)
43
+ and doctor JSON has `statesTransitions` or `statusTransitionCatalog`, add a
44
+ short states → transitions table (or one link) there. Use catalog names when
45
+ present. No flag soup. Soft residual. Silent when that doc is absent or
46
+ Domain has no status vocabulary. No `/ark-states`.
47
+ - When doctor JSON has `noDomainFrontend`, keep the empty Domain house — do not
48
+ delete it to “clean” empty layers. Next is one Domain file (`/ark-place`), not
49
+ a weaker contract. Soft. Silent when there is no frontend or Domain already
50
+ has files. No `/ark-domain`.
25
51
  - CLI-first: if `arkgate-check` already resolved the root, do not wait on MCP.
26
52
  - Do not add `arkRun` or `arkOrder` unless the user wants that extra. When they do, write
27
53
  **advisory** extra in this turn (`arkRun` schema `1.2+`; `arkOrder` schema `1.3+`).
@@ -102,6 +128,46 @@ received."), not architecture jargon. Compact starter / `ark start` may omit the
102
128
  field. Absence is silent — never fail `--strict-config` for a missing caption.
103
129
  Do **not** invent captions. Do not invent `/ark-describe`.
104
130
 
131
+ ## Layer trust (process)
132
+
133
+ Optional `layers[].trustBoundary`: `public` | `auth` | `admin` | `internal`.
134
+ Marks who this folder is for (anyone, signed-in users, operators, or only
135
+ other code). Write it when the product map already names that door. Compact
136
+ starter / `ark start` may omit it. Absence is silent — never fail
137
+ `--strict-config`, never invent a doctor residual. Do **not** invent tags.
138
+ This is not host/CI TLS and does not add import-rule teeth. No `/ark-trust`.
139
+
140
+ ## Layer owners (process)
141
+
142
+ Optional `layers[].owners`: GitHub handles or emails (same identity as
143
+ `stewards` — not a display name). Write them when the product map already
144
+ names who owns the house. Compact starter / `ark start` may omit. Absence is
145
+ silent unless the user asked for required owners. Then write
146
+ `requireLayerOwners: true` only after every live (non-reserved) layer has
147
+ at least one owner. Do **not** invent people. No `/ark-owners`. The require
148
+ flag is the fail-closed switch; owners themselves are metadata.
149
+
150
+ ## Decision notes (process)
151
+
152
+ When gates are required (`--require-gates` / `--strict-merge` / required merge
153
+ status) and there is no short decision-note home yet, doctor may ask for one
154
+ under `docs/adr/` or `docs/decisions/`. Write a note when you loosen a rule or
155
+ add a real gate — not on every file. Absence is silent unless that demand is
156
+ on. The hint does not fail the check. Do **not** invent `/ark-adr`. Policy
157
+ weaken still uses `--policy-ack`; this is only a place to write the why.
158
+
159
+ ## States and transitions (process)
160
+
161
+ When a product-domain / domain-model doc is already on disk (`docs/domain.md`,
162
+ `docs/data-model.md`, or a dedicated `docs/states.md`) and there is no short
163
+ states → transitions table (or one link), doctor may ask for one. Write the
164
+ table on that home — entity · states · allowed from → to. Names from the
165
+ code or the captain. When doctor JSON has `statusTransitionCatalog`, use those
166
+ entity · states names — Domain already opted in by having that vocabulary.
167
+ Do **not** invent states or flag soup. Absence of the domain doc, or Domain
168
+ with no status union/enum, stays silent. The hint does not fail the check.
169
+ Do **not** invent `/ark-states`. Do not walk the tree to invent a roster.
170
+
105
171
  ## When / not when
106
172
 
107
173
  | Use `/ark-adopt` when… | Do **not** use it when… |
@@ -111,7 +177,7 @@ Do **not** invent captions. Do not invent `/ark-describe`.
111
177
  | Mine loose business rules into Domain / advisory ArkRules | Apply leftover design after the path is honest → `/ark-autopilot` |
112
178
  | Freeze **real** debt after the config is honest | User said map only |
113
179
  | Turn **advisory** ArkRun on (`arkRun` extra, schema `1.2+`; **`kernelRoots` preferred**) | Evaluate / wire a hand-rolled bus → `/ark-runtime`; new kernel-managed file → `/ark-place` |
114
- | Turn **advisory** ArkOrder on (`arkOrder` extra, schema `1.3+`, `planeRoots`) | New plane-root file after extra is on → `/ark-place`; grind skip clusters → `/ark-autopilot` |
180
+ | Turn **advisory** ArkOrder on (`arkOrder` extra, schema `1.3+`, `planeRoots`) | Wire one plane candidate after extra is on → `/ark-order`; new plane-root file → `/ark-place`; grind skip clusters → `/ark-autopilot` |
115
181
 
116
182
  ## Dual engine (mandatory)
117
183
 
@@ -147,14 +213,15 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
147
213
  2. Never call an import-edge violation an “invariant” or an aggregate sensor a “layer deny.”
148
214
  3. Absence of `arkRules` is **valid** — do not force ArkRules unless the user wants them or residual inventory clearly wants a pilot.
149
215
  4. Editing `arkrules/*` or promoting modes is **this skill** (session 0) or **`/ark-autopilot`** later; never invent `mechanical-safe`.
150
- 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` with `evidence.arkruleId`.
216
+ 5. CLI helpers: `ark-check --rules-inventory --json`, doctor JSON `rulesUnderContract`, sensors emit `ARKRULE_*` / `INVARIANT_UNCOVERED` / `INVARIANT_CATALOG_EMPTY` with `evidence.arkruleId`.
151
217
  6. Absence of `arkRun` is **valid**. Write it only when the user wants the extra. Skills never enforce.
152
- 7. Absence of `arkOrder` is **valid**. Write it only when the user wants the extra. Do not invent `/ark-order`. Skills never enforce.
218
+ 7. Absence of `arkOrder` is **valid**. Write it only when the user wants the extra. After the extra is honest: handoff **`/ark-order`** to wire one candidate. Skills never enforce.
153
219
 
154
220
 
155
221
  ### Adopt + ArkRules
156
222
  - After classify: emit or refresh `arkRules` for matched layers (exact names; generic mold for unknowns).
157
223
  - Mine rules → inventory + write advisory invariants/structure into `arkrules/<Layer>.json` **in this turn**.
224
+ - Empty `invariants[]` on a populated Domain while `arkRules` is on is residual (`INVARIANT_CATALOG_EMPTY`), not done. Fill 1–2 short phrases. Advisory until a domain structure rule is `enforced`.
158
225
  - Application / Features templates include advisory `writes-via-aggregate`: driver import + write token in a use case is the skip. Do not copy `Externals/` / `admission.ts` folder religion.
159
226
  - Freeze baseline is **[Layer]** debt; inventory residual is **[ArkRules]** — report both.
160
227
 
@@ -191,9 +258,9 @@ ArkGate has **always-on Layers** plus opt-in extras. The user chooses extras; yo
191
258
  - A use-case that `prisma.*.update({ plan })` while `plan` is in `xiKeys` is **[ArkOrder]** `ARKORDER_XI_FIELD_WRITE`. Invoices and seats still flow through `ingest`.
192
259
 
193
260
  - Do **not** put `arkOrder` on the compact starter / `ark start` scaffold. Domain stays plane-free. Import `createOrderPlane` from `arkgate/order` (same npm package).
194
- - Absence is valid and **silent** — never force the extra. Do not invent `/ark-order`.
261
+ - Absence is valid and **silent** — never force the extra.
195
262
  - Demoting enforced → advisory or deleting the extra is policy-delta **weakening**.
196
- - After the extra is honest: handoff `/ark-place` for new plane-root files; grind skip via `/ark-autopilot`. Skills never enforce.
263
+ - After the extra is honest: handoff **`/ark-order`** to wire one candidate, `/ark-place` for new plane-root files; grind skip via `/ark-autopilot`. Skills never enforce.
197
264
 
198
265
  ## Subagent fan-out (optional, host-dependent)
199
266
 
@@ -218,6 +285,9 @@ feature dirs, plan clusters), you **may** dispatch **subagents**:
218
285
  - **Brownfield:** this skill — match config to reality; do not force a starter preset.
219
286
  - **Deep map only:** `/ark-explore`.
220
287
  - **Default path:** `ark start` → **`/ark-adopt`** → `/ark-place` / `/ark-autopilot`.
288
+ `start --apply` may refuse (coverage below 50% or weak shape) — that lock is
289
+ deliberate. Lock the shape with `--archetype`, `--preset`, or `--force`, or
290
+ inspect ranked shapes with `ark-check --recommend`.
221
291
 
222
292
  ## Anti-wrapper rule (mandatory)
223
293
 
@@ -244,6 +314,9 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
244
314
  If `src/contexts` or `src/bounded-contexts` exists, prefer `ddd-bounded-contexts`.
245
315
  **Next.js:** `app/api/**` / `pages/api/**` (and route-group `app/(…)/api/**`) default to
246
316
  **ApplicationOrchestration**, not Presentation — do not reclassify API shells as UI.
317
+ Write Next-flavored `layers[].description` only when Next is actually present
318
+ (`next` dependency, `next.config.*`, or `app/page` / `pages/*` routes). Library and
319
+ package monorepos keep framework-free captions — `ark start` already does this.
247
320
  User wants the ArkRun extra → write **advisory** `arkRun` (schema `1.2+`, real
248
321
  `kernelRoots` preferred — `compositionRoots` alias, existing `managedLayers`) **in this turn**.
249
322
  User wants the ArkOrder extra → write **advisory** `arkOrder` (schema `1.3+`, real
@@ -251,6 +324,12 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
251
324
  to a compact starter. Do not promote to enforced as the session-0 default.
252
325
  When the product map or glossary names a house, write `layers[].description` on that
253
326
  layer (app-context sentence). Compact starter may omit. Do not invent captions.
327
+ When the product map names who a folder is for, write `layers[].trustBoundary`
328
+ (`public` | `auth` | `admin` | `internal`). Do not invent tags.
329
+ When the product map names who owns a folder, write `layers[].owners`
330
+ (GitHub handle or email). Do not invent people. Write `requireLayerOwners`
331
+ only when the user asked for required owners and the live houses already
332
+ have names.
254
333
  2. **Check + diagnose** — `summary.concentrated` / dominant edge → fix contract first, don’t freeze.
255
334
  Cross-slice / cross-context `peerIsolation` hits are judgment: extract shared or events.
256
335
  The denial names its reason. `unclassifiable path` in bulk means shared code lives outside
@@ -264,6 +343,8 @@ Ark protects the **boundary around** a framework, not its internals. Nest/DI pub
264
343
  3. **Classify ungoverned** — use coverage `suggestions` **plus** dirs you discovered by reading;
265
344
  add layers/patterns **here** (write `ark.config.json`). When adding a layer the product map
266
345
  or glossary already names, write `layers[].description` on it (do not invent filler).
346
+ Write `layers[].trustBoundary` only when the product map already names that door.
347
+ Write `layers[].owners` only when the product map already names who owns the house.
267
348
  4. **Mine business rules → manifiesto** (model job — this is why the skill exists):
268
349
  - Scan for loose domain: validators, pricing/policy functions, `can*`/`calculate*`, magic business constants, publish/intent strings, logic in UI/hooks that belongs in Domain.
269
350
  - **ArkRules inventory (AR13):** run `ark-check --rules-inventory --json` for deterministic candidates
@@ -301,8 +382,12 @@ proposals applied or deferred, **phase**, **top Shape / design-weak opportunitie
301
382
  - Force runtime kernel over existing Nest/DI.
302
383
  - Put `arkRun` or `arkOrder` on the compact starter / `ark start` scaffold.
303
384
  - Claim in-memory kernel stores are production durability.
304
- - Invent `/ark-run` or `/ark-order`.
385
+ - Invent `/ark-run`. Use `/ark-order` after this door turns the extra on.
305
386
  - Invent `layers[].description` filler or a `/ark-describe` skill.
387
+ - Invent `layers[].trustBoundary` tags or a `/ark-trust` skill.
388
+ - Invent `layers[].owners` names or a `/ark-owners` skill.
389
+ - Invent `/ark-adr` or require a decision note on every change.
390
+ - Invent `/ark-states` or invent entity states / flag soup.
306
391
  - Claim Enforce while governed% is low, cores empty with I/O in Application, or core bags ungoverned.
307
392
  - End adopt with only “baseline written” when design-weak residual is visible in files you opened.
308
393