@jeger-ai/opengantry 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +5 -2
  2. package/dist/cli/commands/contract.d.ts +21 -0
  3. package/dist/cli/commands/contract.d.ts.map +1 -0
  4. package/dist/cli/commands/contract.js +113 -0
  5. package/dist/cli/commands/contract.js.map +1 -0
  6. package/dist/cli/commands/tmvc-guard.d.ts.map +1 -1
  7. package/dist/cli/commands/tmvc-guard.js +1 -0
  8. package/dist/cli/commands/tmvc-guard.js.map +1 -1
  9. package/dist/cli/lib/contract/approve-prompt.d.ts +22 -0
  10. package/dist/cli/lib/contract/approve-prompt.d.ts.map +1 -0
  11. package/dist/cli/lib/contract/approve-prompt.js +71 -0
  12. package/dist/cli/lib/contract/approve-prompt.js.map +1 -0
  13. package/dist/cli/lib/contract/contract-hash.d.ts +19 -0
  14. package/dist/cli/lib/contract/contract-hash.d.ts.map +1 -0
  15. package/dist/cli/lib/contract/contract-hash.js +67 -0
  16. package/dist/cli/lib/contract/contract-hash.js.map +1 -0
  17. package/dist/cli/lib/contract/contract-scan.d.ts +27 -0
  18. package/dist/cli/lib/contract/contract-scan.d.ts.map +1 -0
  19. package/dist/cli/lib/contract/contract-scan.js +167 -0
  20. package/dist/cli/lib/contract/contract-scan.js.map +1 -0
  21. package/dist/cli/lib/contract/contract-types.d.ts +38 -0
  22. package/dist/cli/lib/contract/contract-types.d.ts.map +1 -0
  23. package/dist/cli/lib/contract/contract-types.js +11 -0
  24. package/dist/cli/lib/contract/contract-types.js.map +1 -0
  25. package/dist/cli/lib/contract/effective-scope.d.ts +21 -0
  26. package/dist/cli/lib/contract/effective-scope.d.ts.map +1 -0
  27. package/dist/cli/lib/contract/effective-scope.js +77 -0
  28. package/dist/cli/lib/contract/effective-scope.js.map +1 -0
  29. package/dist/cli/lib/contract/format.d.ts +20 -0
  30. package/dist/cli/lib/contract/format.d.ts.map +1 -0
  31. package/dist/cli/lib/contract/format.js +48 -0
  32. package/dist/cli/lib/contract/format.js.map +1 -0
  33. package/dist/cli/lib/contract/propose-gate.d.ts +21 -0
  34. package/dist/cli/lib/contract/propose-gate.d.ts.map +1 -0
  35. package/dist/cli/lib/contract/propose-gate.js +57 -0
  36. package/dist/cli/lib/contract/propose-gate.js.map +1 -0
  37. package/dist/cli/lib/contract/propose-imports.d.ts +26 -0
  38. package/dist/cli/lib/contract/propose-imports.d.ts.map +1 -0
  39. package/dist/cli/lib/contract/propose-imports.js +128 -0
  40. package/dist/cli/lib/contract/propose-imports.js.map +1 -0
  41. package/dist/cli/lib/contract/propose.d.ts +25 -0
  42. package/dist/cli/lib/contract/propose.d.ts.map +1 -0
  43. package/dist/cli/lib/contract/propose.js +100 -0
  44. package/dist/cli/lib/contract/propose.js.map +1 -0
  45. package/dist/cli/lib/contract/resolve-specifier.d.ts +34 -0
  46. package/dist/cli/lib/contract/resolve-specifier.d.ts.map +1 -0
  47. package/dist/cli/lib/contract/resolve-specifier.js +93 -0
  48. package/dist/cli/lib/contract/resolve-specifier.js.map +1 -0
  49. package/dist/cli/lib/draft-token.d.ts +5 -2
  50. package/dist/cli/lib/draft-token.d.ts.map +1 -1
  51. package/dist/cli/lib/draft-token.js +18 -3
  52. package/dist/cli/lib/draft-token.js.map +1 -1
  53. package/dist/cli/lib/errors.d.ts +2 -0
  54. package/dist/cli/lib/errors.d.ts.map +1 -1
  55. package/dist/cli/lib/errors.js +15 -2
  56. package/dist/cli/lib/errors.js.map +1 -1
  57. package/dist/cli/lib/git.d.ts +6 -0
  58. package/dist/cli/lib/git.d.ts.map +1 -1
  59. package/dist/cli/lib/git.js +10 -2
  60. package/dist/cli/lib/git.js.map +1 -1
  61. package/dist/cli/lib/gxt-error-codes.d.ts +5 -0
  62. package/dist/cli/lib/gxt-error-codes.d.ts.map +1 -1
  63. package/dist/cli/lib/gxt-error-codes.js +6 -0
  64. package/dist/cli/lib/gxt-error-codes.js.map +1 -1
  65. package/dist/cli/lib/import-scanner.d.ts +13 -3
  66. package/dist/cli/lib/import-scanner.d.ts.map +1 -1
  67. package/dist/cli/lib/import-scanner.js +185 -23
  68. package/dist/cli/lib/import-scanner.js.map +1 -1
  69. package/dist/cli/lib/interrogate/gaps.d.ts +2 -0
  70. package/dist/cli/lib/interrogate/gaps.d.ts.map +1 -1
  71. package/dist/cli/lib/interrogate/gaps.js +3 -4
  72. package/dist/cli/lib/interrogate/gaps.js.map +1 -1
  73. package/dist/cli/lib/interrogate/run.d.ts +1 -0
  74. package/dist/cli/lib/interrogate/run.d.ts.map +1 -1
  75. package/dist/cli/lib/interrogate/run.js +1 -0
  76. package/dist/cli/lib/interrogate/run.js.map +1 -1
  77. package/dist/cli/lib/legislate-from-intent.d.ts +9 -0
  78. package/dist/cli/lib/legislate-from-intent.d.ts.map +1 -0
  79. package/dist/cli/lib/legislate-from-intent.js +59 -0
  80. package/dist/cli/lib/legislate-from-intent.js.map +1 -0
  81. package/dist/cli/lib/legislate.d.ts +3 -1
  82. package/dist/cli/lib/legislate.d.ts.map +1 -1
  83. package/dist/cli/lib/legislate.js +24 -0
  84. package/dist/cli/lib/legislate.js.map +1 -1
  85. package/dist/cli/lib/mcp-draft-legislation.d.ts.map +1 -1
  86. package/dist/cli/lib/mcp-draft-legislation.js +28 -10
  87. package/dist/cli/lib/mcp-draft-legislation.js.map +1 -1
  88. package/dist/cli/lib/mcp-execute-legislation.d.ts.map +1 -1
  89. package/dist/cli/lib/mcp-execute-legislation.js +1 -0
  90. package/dist/cli/lib/mcp-execute-legislation.js.map +1 -1
  91. package/dist/cli/lib/mcp-governance-shared.d.ts +2 -1
  92. package/dist/cli/lib/mcp-governance-shared.d.ts.map +1 -1
  93. package/dist/cli/lib/mcp-governance-shared.js.map +1 -1
  94. package/dist/cli/lib/mcp-propose-contract.d.ts +22 -0
  95. package/dist/cli/lib/mcp-propose-contract.d.ts.map +1 -0
  96. package/dist/cli/lib/mcp-propose-contract.js +51 -0
  97. package/dist/cli/lib/mcp-propose-contract.js.map +1 -0
  98. package/dist/cli/lib/mcp-tools-register.d.ts.map +1 -1
  99. package/dist/cli/lib/mcp-tools-register.js +20 -0
  100. package/dist/cli/lib/mcp-tools-register.js.map +1 -1
  101. package/dist/cli/lib/missions/formatter.d.ts.map +1 -1
  102. package/dist/cli/lib/missions/formatter.js +2 -0
  103. package/dist/cli/lib/missions/formatter.js.map +1 -1
  104. package/dist/cli/lib/missions/parser.d.ts.map +1 -1
  105. package/dist/cli/lib/missions/parser.js +14 -0
  106. package/dist/cli/lib/missions/parser.js.map +1 -1
  107. package/dist/cli/lib/runtime-env.d.ts +3 -0
  108. package/dist/cli/lib/runtime-env.d.ts.map +1 -1
  109. package/dist/cli/lib/runtime-env.js +12 -2
  110. package/dist/cli/lib/runtime-env.js.map +1 -1
  111. package/dist/cli/lib/runtime-exec.d.ts +5 -1
  112. package/dist/cli/lib/runtime-exec.d.ts.map +1 -1
  113. package/dist/cli/lib/runtime-exec.js +18 -1
  114. package/dist/cli/lib/runtime-exec.js.map +1 -1
  115. package/dist/cli/lib/staged-tmvc-guard.d.ts +3 -0
  116. package/dist/cli/lib/staged-tmvc-guard.d.ts.map +1 -1
  117. package/dist/cli/lib/staged-tmvc-guard.js +4 -2
  118. package/dist/cli/lib/staged-tmvc-guard.js.map +1 -1
  119. package/dist/cli/lib/types.d.ts +7 -0
  120. package/dist/cli/lib/types.d.ts.map +1 -1
  121. package/dist/cli/lib/types.js.map +1 -1
  122. package/dist/cli/lib/verify-contract.d.ts +22 -0
  123. package/dist/cli/lib/verify-contract.d.ts.map +1 -0
  124. package/dist/cli/lib/verify-contract.js +110 -0
  125. package/dist/cli/lib/verify-contract.js.map +1 -0
  126. package/dist/cli/lib/verify-engine.d.ts.map +1 -1
  127. package/dist/cli/lib/verify-engine.js +6 -0
  128. package/dist/cli/lib/verify-engine.js.map +1 -1
  129. package/dist/cli/lib/verify-failure-normalize.d.ts.map +1 -1
  130. package/dist/cli/lib/verify-failure-normalize.js +10 -0
  131. package/dist/cli/lib/verify-failure-normalize.js.map +1 -1
  132. package/dist/cli/lib/verify-failure.d.ts +7 -2
  133. package/dist/cli/lib/verify-failure.d.ts.map +1 -1
  134. package/dist/cli/lib/verify-finding.d.ts +1 -1
  135. package/dist/cli/lib/verify-finding.d.ts.map +1 -1
  136. package/dist/cli/lib/verify-finding.js.map +1 -1
  137. package/dist/cli/lib/verify-hints.d.ts.map +1 -1
  138. package/dist/cli/lib/verify-hints.js +13 -0
  139. package/dist/cli/lib/verify-hints.js.map +1 -1
  140. package/dist/cli/lib/verify-interrogation.d.ts +2 -0
  141. package/dist/cli/lib/verify-interrogation.d.ts.map +1 -1
  142. package/dist/cli/lib/verify-interrogation.js +2 -2
  143. package/dist/cli/lib/verify-interrogation.js.map +1 -1
  144. package/dist/cli/lib/verify-payload.d.ts.map +1 -1
  145. package/dist/cli/lib/verify-payload.js +1 -0
  146. package/dist/cli/lib/verify-payload.js.map +1 -1
  147. package/dist/cli/lib/verify-phase-clock.d.ts +1 -1
  148. package/dist/cli/lib/verify-phase-clock.d.ts.map +1 -1
  149. package/dist/cli/lib/verify-phase-clock.js +1 -0
  150. package/dist/cli/lib/verify-phase-clock.js.map +1 -1
  151. package/dist/cli/lib/version.gen.d.ts +1 -1
  152. package/dist/cli/lib/version.gen.js +1 -1
  153. package/dist/cli/program-mission.d.ts.map +1 -1
  154. package/dist/cli/program-mission.js +38 -0
  155. package/dist/cli/program-mission.js.map +1 -1
  156. package/dist/cli/program-workflow.d.ts +4 -1
  157. package/dist/cli/program-workflow.d.ts.map +1 -1
  158. package/dist/cli/program-workflow.js +23 -4
  159. package/dist/cli/program-workflow.js.map +1 -1
  160. package/package.json +1 -1
  161. package/templates/.gitagent/foreman/SUBSTRATE.version.json +1 -1
  162. package/templates/.gitagent/planner/MISSION-ARCHITECT.md +26 -5
  163. package/templates/.gitagent/planner/MISSION.schema.yaml +52 -0
  164. package/templates/.gitagent/planner/RULES.md +55 -36
  165. package/templates/.githooks/pre-commit +12 -0
  166. package/templates/integrations/compatibility.json +1 -1
@@ -28,6 +28,24 @@ Before proposing legislation, read (do not lecture the user):
28
28
 
29
29
  **Do not** run `gantry triage` in chat. Reason from manifest + architecture directly.
30
30
 
31
+ ## Phase 1 — Contract (autoformalize the cage)
32
+
33
+ Before interrogation handoff, call **`gxt_propose_contract`** (MCP) or **`gantry contract propose`** (CLI) with the intent, optional `skill_key`, and path hints.
34
+
35
+ 1. Present the returned compact block (Scope / Forbidden / Gate / Allowed Imports / Banned Imports) plus `rationale[]`.
36
+ 2. Apply operator tweaks (edit the `contract` object; do not invent roots outside the skill).
37
+ 3. Pass the (possibly edited) `contract` into **`gxt_draft_legislation`**. CLI fallback is `gantry legislate --from-intent "<story>" --msn MSN-NNNN` (TTY `[a]pprove / [e]dit / [q]uit`, or `--yes` / `--contract-file`).
38
+ 4. Declared `contract.tmvc_roots` satisfies the empty-skill-roots interrogation finding.
39
+
40
+ ## Phase 1.5 — Interrogation (gap analysis)
41
+
42
+ Before legislation handoff, run **`gxt_interrogate`** (MCP) or **`gantry interrogate`** (CLI) until `status: "clear"`.
43
+
44
+ - The tool returns **exactly one** unanswered finding per call (`halt`). Do not batch questions.
45
+ - Record operator answers verbatim; never fabricate `operator_answer` values.
46
+ - Fast-path (§ below) is allowed only when interrogation returns `clear` with zero unanswered findings.
47
+ - Pass the accumulated `interrogation` array into **`gxt_draft_legislation`**; the substrate recomputes gaps and refuses a draft token when incomplete.
48
+
31
49
  ## Fast-path vs full interview
32
50
 
33
51
  ### Fast-path (trivial work)
@@ -56,7 +74,7 @@ Use for new features, multi-file scope, forbidden-zone proximity, path_risks/ris
56
74
 
57
75
  When the OpenGantry MCP server is configured (`.cursor/mcp.json`):
58
76
 
59
- 1. Call **`gxt_draft_legislation`** with `title`, `msn_id`, `skill_key`, `gate_command`, optional `gate_success_substring`.
77
+ 1. Call **`gxt_propose_contract`**, then **`gxt_draft_legislation`** with `title`, `msn_id`, `skill_key`, `gate_command`, optional `gate_success_substring`, **`interrogation`** (from clear `gxt_interrogate`), and the approved **`contract`**.
60
78
  2. Present the returned `chat_message_to_user` to the human.
61
79
  3. Wait for clear approval intent in chat (`yes`, `approve`, `looks good`, `do it`) or rejection (`no`, `deny`, `stop`). If ambiguous, ask one short clarification.
62
80
  4. On approval only, call **`gxt_execute_legislation`** with the `draft_token`.
@@ -70,13 +88,16 @@ This two-step draft/execute gate prevents silent legislation even when Cursor ru
70
88
  One bash command the user copies into their terminal:
71
89
 
72
90
  ```bash
91
+ gantry legislate --from-intent "<intent summary>" --msn MSN-NNNN --skill-key <key>
92
+ # or, without autoformalize:
73
93
  gantry legislate "<intent summary>" --msn MSN-NNNN --skill-key <key> \
74
94
  --gate-command "<deterministic gate shell command>" \
75
95
  --gate-success-substring "<optional substring>"
76
96
  ```
77
97
 
78
- - Quote `--gate-command` when it contains spaces.
98
+ - Quote `--gate-command` when it contains spaces (e.g. `"npm run test:ui -- --watchAll=false"`).
79
99
  - Omit `--gate-success-substring` when exit code 0 alone is sufficient.
100
+ - `legislate` writes `.gitagent/missions/MSN-NNNN.<slug>.yaml` with `status: PENDING` stub trace rows.
80
101
 
81
102
  **Stop after handoff.** Do not write application code until the Planner commits and pins the mission.
82
103
 
@@ -84,10 +105,10 @@ gantry legislate "<intent summary>" --msn MSN-NNNN --skill-key <key> \
84
105
 
85
106
  1. Approve draft (MCP) or paste and run `gantry legislate` (CLI).
86
107
  2. Optionally review/edit the generated YAML.
87
- 3. `git commit -m "[MSN-NNNN] legislate …"` including the mission file (Planner email in `GANTRY_TEACHER_EMAILS`).
88
- 4. Pin mission (`gxt_pin_mission` MCP tool or `scripts/gxt-pin-mission.sh`).
108
+ 3. `git commit -m "[MSN-NNNN] legislate …"` including the mission file (Planner email in `GANTRY_PLANNER_EMAILS`; silent legacy fallback: `GAPMAN_PLANNER_EMAILS`).
109
+ 4. `scripts/gxt-pin-mission.sh .gitagent/missions/MSN-NNNN.<slug>.yaml` (or `gxt_pin_mission` MCP tool).
89
110
  5. Executor phase begins.
90
111
 
91
112
  ## Executor phase (after pin)
92
113
 
93
- Edit within TMVC → append PASS quotes to `EXECUTOR_LOG.md` → `gantry verify --mission …` (or `gxt_verify`) → pin stays until mission complete.
114
+ Edit within TMVC → append PASS quotes to `EXECUTOR_LOG.md` → `gantry verify --mission …` (or `gxt_verify` MCP tool) → pin stays until mission complete.
@@ -20,7 +20,59 @@ allOf:
20
20
  required: [interrogation]
21
21
  then:
22
22
  required: [interrogation_sha256]
23
+ - if:
24
+ required: [contract]
25
+ then:
26
+ required: [contract_sha256]
23
27
  properties:
28
+ contract:
29
+ type: object
30
+ additionalProperties: false
31
+ description: >-
32
+ Planner-sealed mission cage (ADR-0045). Tighten-only: tmvc_roots must be
33
+ a subset of the skill's manifest roots; forbidden_zones and banned_imports
34
+ are unioned with skill and org-policy sets. Allowed/banned lists match
35
+ bare specifiers (exact or prefix); relative and tsconfig-alias imports are
36
+ resolved to repo paths and checked against forbidden zones. gantry verify
37
+ re-reads this block from the Planner stamp commit and fails
38
+ GXT_CONTRACT_TAMPERED on drift.
39
+ properties:
40
+ tmvc_roots:
41
+ type: array
42
+ items:
43
+ type: string
44
+ minLength: 1
45
+ forbidden_zones:
46
+ type: array
47
+ items:
48
+ type: string
49
+ minLength: 1
50
+ allowed_imports:
51
+ type: array
52
+ items:
53
+ type: string
54
+ minLength: 1
55
+ banned_imports:
56
+ type: array
57
+ items:
58
+ type: string
59
+ minLength: 1
60
+ allow_dynamic_specifiers:
61
+ type: boolean
62
+ default: false
63
+ description: >-
64
+ When false, import(expr) / require(expr) with a non-literal argument
65
+ under effective TMVC roots fails GXT_CONTRACT_IMPORT_DYNAMIC.
66
+ strict_relative_imports:
67
+ type: boolean
68
+ default: false
69
+ description: >-
70
+ When true, relative or alias imports resolving outside effective TMVC
71
+ roots fail GXT_CONTRACT_SCOPE_ESCAPE (forbidden zones always fail).
72
+ contract_sha256:
73
+ type: string
74
+ pattern: "^[0-9a-f]{64}$"
75
+ description: SHA-256 of the canonical (normalized, sorted) contract block.
24
76
  msn_id:
25
77
  type: string
26
78
  pattern: "^MSN-[0-9]{4}$"
@@ -1,70 +1,89 @@
1
- # OpenGantry Rules (template)
1
+ # OpenGantry Rules (v0.6.2 — Forensic Truth)
2
2
 
3
3
  Normative keywords **MUST**, **MUST NOT**, and **SHOULD** follow RFC 2119.
4
4
 
5
- ## 1. Governance and risk tiers
5
+ ## 1. Governance & risk tiers
6
6
 
7
- - **Tier 1 (SAFE)**: deterministic gate required; single-provider verifier is acceptable.
8
- - **Tier 2 (LOGIC)**: deterministic gate required; single-provider verifier output is advisory and a human audit is required before merge.
9
- - **Tier 3 (SUBSTRATE)**: strictest review path; human audit of trace-mapped evidence is mandatory.
7
+ - **Tier 1 (SAFE)**: Routine work; deterministic gate required; single-provider automated verifier permitted when trace mapping is satisfied.
8
+ - **Tier 2 (LOGIC)**: Deterministic gate required; single-provider verifier output is **ADVISORY_ONLY**; a human MUST audit trace references before merge.
9
+ - **Tier 3 (SUBSTRATE)**: Multi-provider verification **SHOULD** be used when available; if only one provider exists, a **mandatory full human audit** of trace-mapped evidence and gate logs is required before merge.
10
10
 
11
- ## 2. Segregation of duties
11
+ ## 2. Segregation of duties (SOD)
12
12
 
13
- - The agent executing the gate MUST NOT be the same actor declaring PASS.
14
- - Mission law is Planner-owned; executors MUST NOT silently rewrite mission law.
13
+ - The agent that executes the gate command (Executor) MUST NOT be the same agent that declares the gate **PASS** (Verifier).
14
+ - Mission law (work order) is Planner-owned; executors MUST NOT modify mission law during execution without Planner re-legislation.
15
15
 
16
- ## 3. Trace-mapped verification
16
+ ## 3. Trace-mapped verification (anti-lie)
17
17
 
18
- - PASS claims MUST quote `EXECUTOR_LOG.md` with a valid anchor (line or timestamp).
19
- - Missing quotes/anchors for claimed PASS is evidence tampering and MUST fail verification.
18
+ - For every claimed verifier **PASS**, the Verifier MUST provide a **Trace Reference**: a verbatim substring copied from `EXECUTOR_LOG.md` and an anchor (**line number** or **timestamp**) that ties the quote to the execution trace.
19
+ - Verifiers MUST NOT use source-code quotations as the sole or primary evidence for PASS; code may supplement only after a valid trace reference exists.
20
+ - If the quoted substring does **not** appear in `EXECUTOR_LOG.md`, or no valid trace reference is provided for a claimed PASS → **Evidence Tampering** → the mission MUST auto-fail (no merge).
21
+ - **`gantry verify` stale-evidence (v1.1+):** for committed PASS quote lines, verify binds the line's attestation commit (`git blame` on `EXECUTOR_LOG.md`) to the mission skill's full `tmvc_roots` via `git diff --name-only`; TMVC drift after attestation → **STALE** (`GXT_TRACE_STALE`). Uncommitted quote lines skip stale check until committed.
20
22
 
21
- ## 4. Dynamic TMVC
23
+ ## 4. Dynamic TMVC (roots + context requests)
22
24
 
23
- - Work is bounded to manifest roots unless explicit mission expansion is approved.
24
- - Access outside effective TMVC requires a context request recorded in `EXECUTOR_LOG.md`.
25
- - Access into forbidden zones MUST fail closed unless Planner policy explicitly allows it.
25
+ - TMVC is anchored by **tmvc_roots** from [`.gitagent/foreman/MANIFEST.json`](.gitagent/foreman/MANIFEST.json) unless the Planner narrows scope further in the mission **`contract.tmvc_roots`** ([ADR-0045](../out-of-scope/ADR-0045-mission-contracts.md)).
26
+ - The mission `contract` block is **Planner law** under §2. Executors MUST NOT edit `contract` or `contract_sha256`. Drift versus the Planner stamp commit is **Evidence Tampering** under §3 (`GXT_CONTRACT_TAMPERED`).
27
+ - Effective TMVC = `contract.tmvc_roots` when present, else the skill roots. Effective forbidden zones and banned imports are the **union** of skill, contract, and org policy (tighten-only; §8). `contract.tmvc_roots` MUST be a subset of skill roots (empty skill roots accept Planner-declared roots).
28
+ - Executors MAY discover and edit files only under the **effective** TMVC roots (recursive within each root) unless the mission explicitly allows expansion steps.
29
+ - Any access **outside** the effective TMVC boundary MUST be preceded by a **Context Request** recorded in `EXECUTOR_LOG.md` (path, reason, proposed files). The Verifier MUST accept or reject before such access proceeds.
30
+ - Expansion into any **effective forbidden_zones** path MUST NOT proceed; escalate to Planner or fail closed per mission.
26
31
 
27
32
  ## 4.5 Interrogation record (legislation gate)
28
33
 
29
- - Computed interrogation findings MUST have an `operator_answer` before legislation.
30
- - Placeholder or fabricated answers are evidence tampering under §3.
34
+ - Before legislation, **`gantry interrogate`** / **`gxt_interrogate`** MUST compute gap findings from manifest, `TARGET_ARCHITECTURE.yaml`, and ADR hints. A Planner MUST NOT legislate while any computed finding lacks a documented `operator_answer` in the mission `interrogation` block.
35
+ - The `interrogation` block in mission YAML is the authoritative operator rationale for computed gaps. Placeholder or fabricated answers are **Evidence Tampering** under §3.
36
+ - `interrogation_sha256` is a checksum for schema consistency, not a cryptographic seal; the Planner stamp commit is the seal on mission bytes (§6.1).
37
+ - Tier-3 gap findings SHOULD reference ADRs (`adr_refs`) rather than inline prose alone.
31
38
 
32
39
  ## 5. Rule 4.4 — Planner-driven manifest sync
33
40
 
34
- - Adding, removing, or renaming a skill MUST update `MANIFEST.json` in the same commit set.
41
+ - Any change that adds, removes, or renames a skill entry or materially edits per-skill fields in `MANIFEST.json` MUST include those manifest edits in the **same commit set** as the skill definition change.
42
+ - The Verifier MUST fail the mission if manifest state does not match the repository’s skill reality.
35
43
 
36
44
  ## 6. Git-native mission index
37
45
 
38
- - Mission-related commits MUST begin with `[MSN-XXXX]` in the subject line.
39
- - Keep mission files for `gantry verify` under `.gitagent/missions/`.
46
+ - Every mission-related commit message MUST start with **`[MSN-XXXX]`** (four digits, e.g. `MSN-0007`) so history is greppable: `git log --grep='MSN-0007'`.
47
+ - No tracked synthetic mission-history index file is required in the repository; git history is the index.
40
48
 
41
- ## 6.1 Planner legislation proof
49
+ ## 6.1 Planner legislation proof (`gantry verify` v0.6.2)
42
50
 
43
- - `gantry verify` requires a Planner stamp: a `[MSN-XXXX]` commit by an allowlisted author that modifies the mission file.
51
+ - Missions verified by **`gantry verify`** MUST live under **`.gitagent/missions/`** (repo-relative).
52
+ - Before the deterministic gate runs, **`gantry verify`** requires **native Git evidence** that the Planner legislated this mission for its MSN:
53
+ - Among the last **200** commits (configurable later), the **newest** commit whose subject begins with **`[MSN-XXXX]`** (matching the mission’s MSN) and whose **author email** is listed in **`GANTRY_PLANNER_EMAILS`** (comma-separated allowlist; silent legacy fallback: `GAPMAN_PLANNER_EMAILS`) is the **Planner stamp**.
54
+ - That stamp commit MUST **modify** the mission file passed to `--mission`.
55
+ - Architectural ADRs under [`.gitagent/out-of-scope/`](../out-of-scope/) are the record of prior decisions. **Planner** MUST review relevant ADRs when authoring or amending missions. **`gantry triage`** MAY emit non-binding `adr_hints` when ADR `match_terms` overlap intent; those hints do **not** change Foreman routing (still manifest-only binary).
44
56
 
45
- ## 6.2 Break-glass (v0.8.0)
57
+ ## 6.2 Break-glass (`gantry verify` v0.8.0)
46
58
 
47
- - Set `GXT_BYPASS_SECRET` to match `.gitagent/foreman/BYPASS.sha256` (SHA-256 hex of the team secret).
48
- - Use `gantry verify --break-glass --reason "..."` only in emergencies; push `refs/notes/gxt-bypass` with the branch.
49
- - Forbidden-zone runtime policy is never bypassed.
50
- - A bypass MUST also append a `break_glass` ledger entry when `ledger.mode` is `local`.
59
+ - Emergency bypass MUST NOT rely on forgeable commit-subject strings alone. Authorization requires **`GXT_BYPASS_SECRET`** matching the SHA-256 anchor in [`.gitagent/foreman/BYPASS.sha256`](../foreman/BYPASS.sha256) (never commit the plaintext secret).
60
+ - **`gantry verify --break-glass --reason "<text>"`** skips git-proof, gate, and trace when authorized; it MUST write a forensic record as a **`refs/notes/gxt-bypass`** git note (or `--audit-commit` when notes cannot be pushed).
61
+ - PR CI accepts GXT-touched commits that either have a normal **`[MSN-XXXX]`** subject or a valid **gxt-bypass** note on that commit. Push notes with the branch: `git push origin refs/notes/gxt-bypass`.
62
+ - Break-glass does **not** disable **`gantry runtime exec`** forbidden-zone enforcement. Planner MUST review bypass usage post-incident.
51
63
 
52
64
  ## 7. Local history (no bloat)
53
65
 
54
- - Bulky traces live under `.gitagent/history/` (git-ignored). Do not commit large trace dumps.
66
+ - Bulky traces live under `.gitagent/history/` (git-ignored). Optional local `MISSION_LOG.md` may be generated from `git log` when needed; it MUST NOT be required in-repo for v0.6.2.
55
67
 
56
68
  ## 8. Organization policy floor (v3.3.0)
57
69
 
58
- - A present `POLICY.pointer.json` is a tighten-only floor: policy MUST NOT loosen local law.
59
- - `gantry policy pull` is the only network path; doctor and verify read disk/cache only.
70
+ - When `.gitagent/foreman/POLICY.pointer.json` is present, Executors and Verifiers MUST treat the cached org policy bundle as a **tighten-only floor** ([ADR-0042](../out-of-scope/ADR-0042-org-policy-bundle.md)): sets are unioned, risk tiers take the maximum, signature and telemetry tiers take the stricter value. Policy MUST NOT loosen local law.
71
+ - **`gantry policy pull`** is the only network path for policy. **`gantry doctor`** and **`gantry verify`** MUST read the pointer plus `.gitagent/history/policy/` cache only — no sockets.
72
+ - A present pointer with missing cache, sha mismatch, or invalid signer is fail-closed (`GXT_POLICY_*`). A missing pointer is opt-in (no failure).
73
+ - `kpi_thresholds[].metric` MUST name a key in the bundle `producers` map.
74
+ - Receipt schema stays **0.2.0**; policy digests belong in ledger entries ([ADR-0043](../out-of-scope/ADR-0043-compliance-ledger-git-ref.md)), not receipts.
60
75
 
61
76
  ## 9. Compliance ledger (v3.3.0)
62
77
 
63
- - `refs/gxt/ledger` is an orphan signed (optional) commit chain of digest-only entries.
64
- - Append uses CAS `git update-ref` with bounded retries; unsigned entries are checksums, not proofs.
78
+ - When `.gitagent/config.json` `ledger.mode` is `local`, verify, attest, break-glass, and policy-pull MUST append a digest-only entry to **`refs/gxt/ledger`** ([ADR-0043](../out-of-scope/ADR-0043-compliance-ledger-git-ref.md)).
79
+ - Append MUST use compare-and-swap `git update-ref` with bounded retries and jitter. Exhaustion MUST fail closed (`GXT_LEDGER_CAS_EXHAUSTED`) so parallel CI jobs never fork the chain.
80
+ - Unsigned ledger entries are checksums, not proofs. `ledger.signature` `require` demands `git commit -S`.
81
+ - A break-glass bypass with no `break_glass` ledger row is a failed control ([ADR-0021](../out-of-scope/ADR-0021-break-glass-protocol.md)).
82
+ - Ledger payloads MUST NOT contain source bodies or gate stdout.
65
83
 
66
- ## 10. Cross-repository dependencies (v3.3.0)
84
+ ## 10. Cross-repository mission dependencies (v3.3.0)
67
85
 
68
- - Optional mission `depends_on[]` is resolved from fetched `refs/gxt/deps/<slug>`.
69
- - Same-org proof uses `repository_hash` + the consumer's `GANTRY_ORG_PEPPER`.
70
- - `gantry deps fetch` is the only network path.
86
+ - Optional mission `depends_on[]` is resolved **offline** from fetched `refs/gxt/deps/<slug>` ([ADR-0044](../out-of-scope/ADR-0044-cross-repo-mission-dependencies.md)).
87
+ - **`gantry deps fetch`** is the only network path. Verify's `dependencies` phase, `gantry deps check`, and doctor MUST NOT fetch.
88
+ - Same-org proof: recompute `repository_hash` for `depends_on.repo` with the consumer's `GANTRY_ORG_PEPPER` and require equality with the entry. Mismatch → `GXT_DEPENDENCY_ORG_MISMATCH`.
89
+ - Unfetched, unsatisfied, unsigned (when required), or stale entries MUST fail closed (`GXT_DEPENDENCY_*`). Cross-repo *trigger* (workflow dispatch) is advisory glue, not enforcement.
@@ -23,4 +23,16 @@ fi
23
23
 
24
24
  echo "pre-commit: gantry tmvc guard --mission ${mission} (advisory default)" >&2
25
25
  "${GANTRY_CLI[@]}" tmvc guard --mission "$mission"
26
+
27
+ # Advisory contract import scan over staged source files (mission contract cage, ADR-0045).
28
+ staged_sources=()
29
+ while IFS= read -r f; do
30
+ case "$f" in
31
+ *.ts|*.tsx|*.mts|*.cts|*.js|*.jsx|*.mjs|*.cjs) staged_sources+=("$f") ;;
32
+ esac
33
+ done < <(git diff --cached --name-only --diff-filter=ACMR)
34
+ if [[ ${#staged_sources[@]} -gt 0 ]]; then
35
+ echo "pre-commit: gantry contract check --mission ${mission} (advisory, ${#staged_sources[@]} staged source file(s))" >&2
36
+ "${GANTRY_CLI[@]}" contract check --mission "$mission" --file "${staged_sources[@]}" >&2 || true
37
+ fi
26
38
  exit 0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema_version": "1",
3
- "opengantry_version": "3.3.0",
3
+ "opengantry_version": "3.4.0",
4
4
  "asset_catalog": "integrations/asset-catalog.json",
5
5
  "integrations": {
6
6
  "cursor": {