@consiliency/contract 0.3.0 → 0.6.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 (39) hide show
  1. package/README.md +41 -1
  2. package/conformance/vectors/authority-algorithm-confusion.json +62 -0
  3. package/conformance/vectors/authority-bad-signature.json +62 -0
  4. package/conformance/vectors/authority-cert-digest-mismatch.json +62 -0
  5. package/conformance/vectors/authority-chain-appended-still-verifies.json +72 -0
  6. package/conformance/vectors/authority-core-validity-expired.json +62 -0
  7. package/conformance/vectors/authority-forged-self-minted.json +62 -0
  8. package/conformance/vectors/authority-key-expired.json +62 -0
  9. package/conformance/vectors/authority-key-revoked.json +62 -0
  10. package/conformance/vectors/authority-missing-signature.json +57 -0
  11. package/conformance/vectors/authority-signer-approver-mismatch.json +62 -0
  12. package/conformance/vectors/authority-unknown-key-id.json +62 -0
  13. package/conformance/vectors/authority-valid.json +62 -0
  14. package/conformance/vectors/authority-wrong-key-valid-id.json +62 -0
  15. package/conformance/vectors/git-discipline-never-delete-human-refs.json +38 -0
  16. package/conformance/vectors/manifest-invalid-absolute-path.json +1 -1
  17. package/conformance/vectors/manifest-invalid-certified-maturity.json +2 -2
  18. package/conformance/vectors/manifest-invalid-path-and-ref.json +1 -1
  19. package/conformance/vectors/manifest-invalid-unknown-archetype.json +1 -1
  20. package/conformance/vectors/manifest-valid-baseline-only.json +1 -1
  21. package/conformance/vectors/manifest-valid-product.json +1 -1
  22. package/conformance/vectors/projections-index-pure-merge-deterministic.json +167 -0
  23. package/conformance/vectors/version-skew-compatible.json +3 -3
  24. package/conformance/vectors/version-skew-incompatible-warns.json +1 -1
  25. package/core/authority-canon/provenance.json +23 -0
  26. package/core/contract.json +14 -4
  27. package/core/registries/authority-key-registry.json +58 -0
  28. package/core/registries/maturity-labels.json +15 -3
  29. package/core/registries/pipeline-ref-classes.json +57 -0
  30. package/core/schemas/authority-event-protocol.schema.json +142 -0
  31. package/core/schemas/contract-version-status.schema.json +2 -2
  32. package/core/schemas/git-discipline-protocol.schema.json +150 -0
  33. package/core/schemas/manifest.schema.json +2 -2
  34. package/core/schemas/projections-index-v1.schema.json +226 -0
  35. package/core/schemas/version-skew-protocol.schema.json +3 -3
  36. package/package.json +1 -1
  37. package/src/authority.js +192 -0
  38. package/src/index.d.ts +15 -1
  39. package/src/index.js +9 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contract_id": "consiliency.contract.v1",
3
- "contract_version": "0.3.0",
3
+ "contract_version": "0.6.0",
4
4
  "package_names": {
5
5
  "npm": "@consiliency/contract",
6
6
  "pypi": "consiliency-contract"
@@ -29,25 +29,35 @@
29
29
  "lease_event": "core/schemas/lease-event.schema.json",
30
30
  "lease_store_protocol": "core/schemas/lease-store-protocol.schema.json",
31
31
  "coordination_channel_protocol": "core/schemas/coordination-channel-protocol.schema.json",
32
- "coordination_scenario": "core/schemas/coordination-scenario.schema.json"
32
+ "coordination_scenario": "core/schemas/coordination-scenario.schema.json",
33
+ "projections_index_v1": "core/schemas/projections-index-v1.schema.json",
34
+ "git_discipline_protocol": "core/schemas/git-discipline-protocol.schema.json",
35
+ "authority_event_protocol": "core/schemas/authority-event-protocol.schema.json"
33
36
  },
34
37
  "registries": {
35
38
  "document_classes": "core/registries/document-classes.json",
36
39
  "archetypes": "core/registries/archetypes.json",
37
40
  "required_documents": "core/registries/required-documents.json",
38
41
  "maturity_labels": "core/registries/maturity-labels.json",
39
- "default_ignore_set": "core/registries/default-ignore-set.json"
42
+ "default_ignore_set": "core/registries/default-ignore-set.json",
43
+ "pipeline_ref_classes": "core/registries/pipeline-ref-classes.json",
44
+ "authority_key_registry": "core/registries/authority-key-registry.json"
40
45
  },
41
46
  "protocols": {
42
47
  "loop_gate": "core/schemas/loop-gate-protocol.schema.json",
43
48
  "version_skew": "core/schemas/version-skew-protocol.schema.json",
44
49
  "lease_store": "core/schemas/lease-store-protocol.schema.json",
45
- "coordination_channel": "core/schemas/coordination-channel-protocol.schema.json"
50
+ "coordination_channel": "core/schemas/coordination-channel-protocol.schema.json",
51
+ "git_discipline": "core/schemas/git-discipline-protocol.schema.json",
52
+ "authority_event": "core/schemas/authority-event-protocol.schema.json"
46
53
  },
47
54
  "canonical_html": {
48
55
  "contract": "core/canonical-html/contract-v1.json",
49
56
  "provenance": "core/canonical-html/provenance.json"
50
57
  },
58
+ "authority_canon": {
59
+ "provenance": "core/authority-canon/provenance.json"
60
+ },
51
61
  "conformance": {
52
62
  "vector_root": "conformance/vectors",
53
63
  "decision_schema": "core/schemas/decision.schema.json"
@@ -0,0 +1,58 @@
1
+ {
2
+ "schema": "consiliency.authority_key_registry.v1",
3
+ "$comment": "The vendored, digest-pinned root of trust. This registry living IN the contract repo — gated by the repo's merge gate — IS the physical root of trust; there is deliberately no live-fetch/Portal-served option (panel amendment #2). Verification selects a key by the SIGNED core's key_id and takes scheme + public_key + approver + validity + revoked FROM HERE, never from the event. Only PUBLIC keys live here; the Portal holds the private key.",
4
+ "rotation": {
5
+ "policy": "Add a new key_id with its own validity window; overlap windows to roll signers. Never reuse a retired key_id.",
6
+ "identity_binding": "A key_id is bound to exactly one approver identity; a signature verifies only if core.approver == the key's registered approver."
7
+ },
8
+ "revocation": {
9
+ "policy": "Set revoked:true (or let validity lapse) to retire a key_id. A revoked or out-of-window key fails verification regardless of an otherwise-valid signature.",
10
+ "irreversible": true
11
+ },
12
+ "keys": [
13
+ {
14
+ "key_id": "portal-authority-ed25519-v1",
15
+ "scheme": "ed25519",
16
+ "public_key": "119836c4adf9da9ad3049d42da2dc126f82a43d8a0c6da9189c536e8fa7f40d3",
17
+ "approver": "consiliency:portal:governance",
18
+ "validity": {
19
+ "not_before": "2026-01-01T00:00:00Z",
20
+ "not_after": "2027-01-01T00:00:00Z"
21
+ },
22
+ "revoked": false
23
+ },
24
+ {
25
+ "key_id": "portal-authority-ed25519-rotated-out",
26
+ "scheme": "ed25519",
27
+ "public_key": "525ca9174d568e5ac9f1209de27e0483dcf3eb766dc9ce3ba123ff538508a17d",
28
+ "approver": "consiliency:portal:governance",
29
+ "validity": {
30
+ "not_before": "2026-01-01T00:00:00Z",
31
+ "not_after": "2027-01-01T00:00:00Z"
32
+ },
33
+ "revoked": true
34
+ },
35
+ {
36
+ "key_id": "portal-authority-ed25519-expired",
37
+ "scheme": "ed25519",
38
+ "public_key": "6db198ca668218d6c0782ba4baccfed834b4c7805bd6e205d4b0747ef0327e9a",
39
+ "approver": "consiliency:portal:governance",
40
+ "validity": {
41
+ "not_before": "2025-01-01T00:00:00Z",
42
+ "not_after": "2025-06-01T00:00:00Z"
43
+ },
44
+ "revoked": false
45
+ },
46
+ {
47
+ "key_id": "portal-authority-ed25519-prod-v1",
48
+ "scheme": "ed25519",
49
+ "public_key": "27499adc83381305359e7950b6ea9f1f7fa93480c9fe647b9fc8d4a64d6a467a",
50
+ "approver": "consiliency:portal:governance",
51
+ "validity": {
52
+ "not_before": "2026-07-04T00:00:00Z",
53
+ "not_after": "2027-07-04T00:00:00Z"
54
+ },
55
+ "revoked": false
56
+ }
57
+ ]
58
+ }
@@ -16,10 +16,22 @@
16
16
  "kind": "evidence",
17
17
  "description": "The edge was observed from a declared pin, package coordinate, copied literal, or repo-relative source reference."
18
18
  },
19
+ {
20
+ "id": "parity-certified",
21
+ "kind": "evidence",
22
+ "description": "Attested by a byte-reproducible parity certificate: the artifact's rendered bytes fail-closed re-verify against a digest bind to the certified desired-state graph S (C1-C5 cert bind passed). Proves BYTE PARITY with certified truth. Does NOT prove a human or authority ratified it — no authority event is required or checked for this tier. This is exactly what CS proj-S certification (spec #74, portal #165) ships today. Supersedes the bare 'certified' id (CS-1.4 label rescope, docs/design/CS-1.4-certified-label-rescope.md)."
23
+ },
24
+ {
25
+ "id": "authority-certified",
26
+ "kind": "evidence",
27
+ "description": "Everything parity-certified proves, PLUS a valid, signature-verified authority event (authority_event_protocol.v1 core/chain split, Ed25519) bound to the same cert_digest, ratified by a human through the XG-1 authority path. Proves BYTE PARITY *and* AUTHORITY RATIFICATION. Reserved: no artifact earns this label until the XG-1 authority loop (contract Slices 1-4; DESIGN-xg1-completion.md §4) lands end-to-end and delivers a verified authority-event.json alongside the cert. The higher of the two certified tiers (CS-1.4 label rescope)."
28
+ },
19
29
  {
20
30
  "id": "certified",
21
31
  "kind": "evidence",
22
- "description": "Reserved for post-XG-1 evidence attested by the certificate path; invalid for CS-0.2 Phase 0 vectors."
32
+ "deprecated": true,
33
+ "deprecated_alias_of": "parity-certified",
34
+ "description": "DEPRECATED (CS-1.4 label rescope). The bare 'certified' id was ambiguous about whether it meant byte-parity or authority ratification; in practice every artifact that has ever carried it had parity only, never a verified authority event. Alias of parity-certified — NEVER authority-certified, since aliasing an unratified artifact upward would manufacture the exact false-green this rescope exists to close. Retained so producers/consumers already emitting the bare 'certified' id keep validating; new artifacts MUST emit parity-certified or authority-certified. Do not use in new manifests."
23
35
  },
24
36
  {
25
37
  "id": "present-nonconforming",
@@ -41,8 +53,8 @@
41
53
  }
42
54
  ],
43
55
  "label_kinds": {
44
- "evidence": "Evidence-strength axis: how strongly the artifact/edge is attested (presence -> hash -> realized -> certified).",
56
+ "evidence": "Evidence-strength axis: how strongly the artifact/edge is attested (presence -> hash -> realized -> parity-certified -> authority-certified). CS-1.4 splits the former single 'certified' rung into two honest tiers: parity-certified (byte parity, no authority event) and authority-certified (parity PLUS a verified, human-ratified authority event) — see each entry's description. The bare 'certified' id is kept only as a deprecated alias of parity-certified; it is never an alias of authority-certified.",
45
57
  "governance": "Governance-status axis: whether and how an artifact/edge is governed. Orthogonal to evidence strength."
46
58
  },
47
- "phase0_disallowed": ["certified"]
59
+ "phase0_disallowed": ["certified", "parity-certified", "authority-certified"]
48
60
  }
@@ -0,0 +1,57 @@
1
+ {
2
+ "schema": "consiliency.pipeline_ref_classes.v1",
3
+ "description": "Falsifiable enumeration of git ref classes the git-discipline protocol (DESIGN §11.1) references. A ref name is classified by first-match against ref_classes in order; anything not matching a pipeline-owned pattern falls through to the human default (default_owner). Both runtimes (agent-harness phase-loop-runtime and gp pipeline-runtime) read this registry so they agree on which prefixes are pipeline-owned and which refs self-heal may reconcile.",
4
+ "default_owner": "human",
5
+ "ref_classes": [
6
+ {
7
+ "id": "pipeline-working-branch",
8
+ "pattern": "consiliency/pipeline/{roadmap_version}",
9
+ "owner": "pipeline",
10
+ "lease_required": true,
11
+ "deletable_by_self_heal": false,
12
+ "merge_policy": "required",
13
+ "description": "The pipeline-owned integration/working branch (one path segment version). Reconcile re-checks-out / rebases it; it is NEVER auto-deleted. Its tip is the projection pinned_commit for currency (§11.4)."
14
+ },
15
+ {
16
+ "id": "pipeline-working-branch-family",
17
+ "pattern": "consiliency/pipeline/*",
18
+ "owner": "pipeline",
19
+ "lease_required": true,
20
+ "deletable_by_self_heal": false,
21
+ "merge_policy": "required",
22
+ "description": "The consiliency/pipeline/* family glob. Pipeline-owned; not auto-deleted (retained for provenance / rollback)."
23
+ },
24
+ {
25
+ "id": "harness-phase-worktree",
26
+ "pattern": "phase-loop/sched/{target_branch}/{phase}",
27
+ "owner": "pipeline",
28
+ "lease_required": true,
29
+ "deletable_by_self_heal": true,
30
+ "merge_policy": "auto",
31
+ "description": "agent-harness per-phase isolated worktree branch, merged back --no-ff on disjoint ownership. An ALREADY-MERGED, leased instance may be pruned by self-heal (idempotent-safe)."
32
+ },
33
+ {
34
+ "id": "gp-phase-node",
35
+ "pattern": "pipeline/{phase}-{node}",
36
+ "owner": "pipeline",
37
+ "lease_required": true,
38
+ "deletable_by_self_heal": true,
39
+ "merge_policy": "auto",
40
+ "description": "gp pipeline-runtime per-phase worktree branch (buildWorktreeBranchRef). Record-only cleanup; an already-merged leased instance may be pruned by self-heal."
41
+ }
42
+ ],
43
+ "human_default": {
44
+ "id": "human",
45
+ "pattern": "*",
46
+ "owner": "human",
47
+ "lease_required": false,
48
+ "deletable_by_self_heal": false,
49
+ "merge_policy": null,
50
+ "description": "Everything not matching a pipeline-owned pattern (including the default branch and all human feature branches). NEVER auto-deleted or auto-moved by the pipeline; the NEVER-DELETE-HUMAN-REFS invariant governs."
51
+ },
52
+ "self_heal_deletion_rule": "A ref is eligible for self-heal deletion only if owner == 'pipeline' AND deletable_by_self_heal == true AND it is currently leased (and, for phase worktrees, already merged). All other refs — every human ref, every unleased pipeline ref, and every pipeline ref in a non-deletable class — are protected.",
53
+ "invariants": {
54
+ "never_delete_human_refs": true,
55
+ "self_heal_scope": "leased-pipeline-owned-refs-only"
56
+ }
57
+ }
@@ -0,0 +1,142 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/authority-event-protocol.schema.json",
4
+ "title": "Consiliency authority event protocol",
5
+ "$comment": "One single-sourced, cryptographically-authenticated authority event. SEPARATION OF POWERS: `core` is the Portal-signed, ledger-slot-INDEPENDENT payload the human decision attests; the Ed25519 signature covers EXACTLY the canonical bytes of `core` (see docs/design/authority-event-canonical-bytes.md) and nothing else. `chain` is ledger-appended metadata OUTSIDE the signature, so spec can append it without re-signing and thus never becomes an authority minter. Verification uses the PINNED authority-key-registry, keyed by core.key_id — never the event's self-declared signature fields.",
6
+ "type": "object",
7
+ "required": ["schema", "core", "signature"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "schema": {"const": "consiliency.authority_event_protocol.v1"},
11
+ "core": {
12
+ "$comment": "SIGNED. These are the only fields the Ed25519 signature covers. Chain-position-independent so Portal can sign before spec appends to the ledger.",
13
+ "type": "object",
14
+ "required": [
15
+ "authority_event_version",
16
+ "event_type",
17
+ "decision_id",
18
+ "audience",
19
+ "cert_digest",
20
+ "approver",
21
+ "key_id",
22
+ "validity",
23
+ "custody_binding",
24
+ "proposal_ref",
25
+ "ratify_ref"
26
+ ],
27
+ "additionalProperties": false,
28
+ "properties": {
29
+ "authority_event_version": {"const": "1"},
30
+ "event_type": {"enum": ["ratify", "revoke", "supersede"]},
31
+ "decision_id": {
32
+ "$ref": "#/$defs/metadataSafeString",
33
+ "$comment": "The Portal-minted DECISION UUID = the authority identity (amendment #1). NOT the phaseId; phase/subgraph are scoped audience fields below."
34
+ },
35
+ "audience": {
36
+ "$comment": "Scoped audience the decision applies to. phase/subgraph are SCOPED fields, not the identity (amendment #1).",
37
+ "type": "object",
38
+ "required": ["repo", "env", "lineage", "policy_epoch", "canon_version", "phase", "subgraph"],
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "repo": {"$ref": "#/$defs/metadataSafeString"},
42
+ "env": {"$ref": "#/$defs/metadataSafeString"},
43
+ "lineage": {"$ref": "#/$defs/metadataSafeString"},
44
+ "policy_epoch": {"$ref": "#/$defs/metadataSafeString"},
45
+ "canon_version": {"$ref": "#/$defs/metadataSafeString"},
46
+ "phase": {"$ref": "#/$defs/metadataSafeString"},
47
+ "subgraph": {"$ref": "#/$defs/metadataSafeString"}
48
+ }
49
+ },
50
+ "cert_digest": {
51
+ "$ref": "#/$defs/hexDigest",
52
+ "$comment": "MANDATORY (N4). Binds the event to the SPECIFIC cert the human saw — not merely its canon_version."
53
+ },
54
+ "approver": {
55
+ "$ref": "#/$defs/metadataSafeString",
56
+ "$comment": "The approver identity. Verification requires the signing key (core.key_id) to be registered to this approver (amendment #4)."
57
+ },
58
+ "key_id": {
59
+ "$ref": "#/$defs/metadataSafeString",
60
+ "$comment": "Identity of the signing key, IN the signed core so the signature commits to which key signed. Verification selects the pubkey+scheme from the pinned registry by this value."
61
+ },
62
+ "validity": {"$ref": "#/$defs/validityWindow"},
63
+ "custody_binding": {
64
+ "type": "object",
65
+ "required": ["phase_loop_driver_allowed"],
66
+ "additionalProperties": false,
67
+ "properties": {
68
+ "phase_loop_driver_allowed": {
69
+ "const": false,
70
+ "$comment": "MUST be false — authority is minted in the Portal, never by the phase-loop driver/leaf."
71
+ }
72
+ }
73
+ },
74
+ "proposal_ref": {"$ref": "#/$defs/metadataSafeString"},
75
+ "ratify_ref": {"$ref": "#/$defs/metadataSafeString"}
76
+ }
77
+ },
78
+ "chain": {
79
+ "$comment": "UNSIGNED, ledger-appended (spec). Appending or mutating this block does NOT invalidate the core signature — that independence is a conformance vector.",
80
+ "type": "object",
81
+ "required": ["entry_digest", "previous_entry_digest", "inclusion_proof", "root_digest"],
82
+ "additionalProperties": false,
83
+ "properties": {
84
+ "entry_digest": {"$ref": "#/$defs/hexDigest"},
85
+ "previous_entry_digest": {"$ref": "#/$defs/hexDigest"},
86
+ "root_digest": {"$ref": "#/$defs/hexDigest"},
87
+ "inclusion_proof": {
88
+ "type": "object",
89
+ "required": ["entry_digest", "previous_entry_digest", "root_digest"],
90
+ "additionalProperties": false,
91
+ "properties": {
92
+ "entry_digest": {"$ref": "#/$defs/hexDigest"},
93
+ "previous_entry_digest": {"$ref": "#/$defs/hexDigest"},
94
+ "root_digest": {"$ref": "#/$defs/hexDigest"}
95
+ }
96
+ }
97
+ }
98
+ },
99
+ "signature": {
100
+ "$comment": "The signature bytes plus self-declared scheme/key_id. Verification IGNORES scheme/key_id here in favor of core.key_id -> the pinned registry; these echoes exist only for transport legibility. A scheme that disagrees with the registry is an algorithm-confusion REJECT.",
101
+ "type": "object",
102
+ "required": ["scheme", "key_id", "signature"],
103
+ "additionalProperties": false,
104
+ "properties": {
105
+ "scheme": {"const": "ed25519"},
106
+ "key_id": {"$ref": "#/$defs/metadataSafeString"},
107
+ "signature": {
108
+ "type": "string",
109
+ "pattern": "^[0-9a-f]{128}$",
110
+ "$comment": "64-byte Ed25519 signature, lowercase hex."
111
+ }
112
+ }
113
+ }
114
+ },
115
+ "$defs": {
116
+ "metadataSafeString": {
117
+ "type": "string",
118
+ "minLength": 1,
119
+ "pattern": "^[\\u0021\\u0023-\\u005B\\u005D-\\u007E]+$",
120
+ "$comment": "Printable ASCII 0x21..0x7E excluding double-quote and backslash. The AUDIENCE_VALUE_RE metadata-safe set that makes the canonical bytes cross-language identical."
121
+ },
122
+ "hexDigest": {
123
+ "type": "string",
124
+ "pattern": "^[0-9a-f]{64}$",
125
+ "$comment": "Lowercase SHA-256 hex digest."
126
+ },
127
+ "timestamp": {
128
+ "type": "string",
129
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$",
130
+ "$comment": "RFC3339 UTC, fixed width, 'Z' only — sorts lexicographically == chronologically."
131
+ },
132
+ "validityWindow": {
133
+ "type": "object",
134
+ "required": ["not_before", "not_after"],
135
+ "additionalProperties": false,
136
+ "properties": {
137
+ "not_before": {"$ref": "#/$defs/timestamp"},
138
+ "not_after": {"$ref": "#/$defs/timestamp"}
139
+ }
140
+ }
141
+ }
142
+ }
@@ -13,10 +13,10 @@
13
13
  "additionalProperties": false,
14
14
  "properties": {
15
15
  "name": {"type": "string"},
16
- "version": {"type": "string", "pattern": "^0\\.3\\.\\d+$"}
16
+ "version": {"type": "string", "pattern": "^0\\.4\\.\\d+$"}
17
17
  }
18
18
  },
19
- "repo_contract_version": {"type": "string", "pattern": "^0\\.3\\.\\d+$"},
19
+ "repo_contract_version": {"type": "string", "pattern": "^0\\.4\\.\\d+$"},
20
20
  "consumer": {"type": "object"},
21
21
  "compatibility": {"enum": ["compatible", "negotiated", "incompatible", "unknown"]},
22
22
  "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
@@ -0,0 +1,150 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/git-discipline-protocol.schema.json",
4
+ "title": "Consiliency git-discipline protocol",
5
+ "description": "Normative machine-readable form of the pipeline-owned git-discipline contract (DESIGN §11.1). Post-ingestion the pipeline/harness OWNS ref classes, write-footprint, and merge policy for governed repos; humans do not drive branching. This is the neutral definition Portal, agent-harness (phase-loop-runtime), and the headless pipeline (gp) all read so they agree on which refs are pipeline-owned and how self-heal may reconcile them. The falsifiable ref-class enumeration lives in the pipeline-ref-classes registry, which this protocol references by name.",
6
+ "type": "object",
7
+ "required": [
8
+ "schema",
9
+ "contract_version",
10
+ "ref_class_registry",
11
+ "ownership",
12
+ "lease",
13
+ "write_footprint",
14
+ "merge_policies",
15
+ "self_heal",
16
+ "invariants"
17
+ ],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "schema": {"const": "consiliency.git_discipline_protocol.v1"},
21
+ "contract_version": {"const": "0.6.0"},
22
+ "ref_class_registry": {
23
+ "const": "pipeline-ref-classes",
24
+ "description": "loadRegistry('pipeline_ref_classes') enumerates the pipeline-owned ref families and the human default. Both runtimes (harness + gp) read it to agree on ownership."
25
+ },
26
+ "ownership": {
27
+ "type": "object",
28
+ "required": ["pipeline_owned_ref_patterns", "human_ref_default", "default_branch_commit"],
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "pipeline_owned_ref_patterns": {
32
+ "type": "array",
33
+ "const": [
34
+ "consiliency/pipeline/{roadmap_version}",
35
+ "consiliency/pipeline/*",
36
+ "phase-loop/sched/{target_branch}/{phase}",
37
+ "pipeline/{phase}-{node}"
38
+ ]
39
+ },
40
+ "human_ref_default": {"const": "everything-not-matching-a-pipeline-owned-pattern"},
41
+ "default_branch_commit": {
42
+ "const": "refused",
43
+ "description": "Under branch governance the loop hard-refuses any commit on the default branch (phase-loop-runtime refuse_default_branch_commit; gp branchgov)."
44
+ }
45
+ }
46
+ },
47
+ "lease": {
48
+ "type": "object",
49
+ "required": ["lease_required_on_pipeline_refs", "lease_schema", "leased_metadata"],
50
+ "additionalProperties": false,
51
+ "properties": {
52
+ "lease_required_on_pipeline_refs": {"const": true},
53
+ "lease_schema": {"const": "consiliency.lease.v1"},
54
+ "leased_metadata": {
55
+ "type": "array",
56
+ "const": ["holder", "lease_id", "acquired_at", "ttl_seconds", "heartbeat_at"]
57
+ }
58
+ }
59
+ },
60
+ "write_footprint": {
61
+ "type": "object",
62
+ "required": ["allowlist", "policy"],
63
+ "additionalProperties": false,
64
+ "properties": {
65
+ "allowlist": {
66
+ "type": "array",
67
+ "const": [
68
+ ".pipeline/artifacts/**",
69
+ ".pipeline/specs/**",
70
+ ".pipeline/state/**",
71
+ ".pipeline/events/**",
72
+ ".consiliency/**",
73
+ "pipeline.definition.json",
74
+ "portal_contracts/**"
75
+ ]
76
+ },
77
+ "policy": {
78
+ "const": "unauthorized-pipeline-write-refused",
79
+ "description": "The runtime's pipeline-write boundary fails (unauthorized_pipeline_write) on dirty writes outside the allowlist."
80
+ }
81
+ }
82
+ },
83
+ "merge_policies": {
84
+ "type": "object",
85
+ "required": ["values", "default"],
86
+ "additionalProperties": false,
87
+ "properties": {
88
+ "values": {"type": "array", "const": ["auto", "required", "never"]},
89
+ "default": {
90
+ "const": "required",
91
+ "description": "BRANCHGOV ratification carries merge_policy in {auto,required,never}; the pipeline working branch mergeback defaults to required review."
92
+ }
93
+ }
94
+ },
95
+ "self_heal": {
96
+ "type": "object",
97
+ "required": ["hook", "scope", "auto_fix", "default_severity", "finding_human_required"],
98
+ "additionalProperties": false,
99
+ "properties": {
100
+ "hook": {
101
+ "const": "top-of-loop-reconcile",
102
+ "description": "Rides the existing start-of-iteration reconcile + advisory scan; detection is always safe (pure reporting)."
103
+ },
104
+ "scope": {
105
+ "const": "leased-pipeline-owned-refs-only",
106
+ "description": "Self-heal may reconcile ONLY leased, pipeline-owned refs. It never touches human refs or unleased pipeline refs."
107
+ },
108
+ "auto_fix": {
109
+ "const": "idempotent-safe-only",
110
+ "description": "Auto-fix is limited to provably-safe idempotent cases (re-checkout/rebase the pipeline working branch; prune already-merged phase worktrees). Everything else surfaces as a blocker; no auto-delete, no auto-move of possibly-in-progress work."
111
+ },
112
+ "default_severity": {
113
+ "const": "warn",
114
+ "description": "Autonomy-first: soft/warn by default, opt-in to block. Never escalates to human-required."
115
+ },
116
+ "finding_human_required": {
117
+ "const": false,
118
+ "description": "Self-heal findings are surfaced as human_required=false blockers; the contract never sets human_required."
119
+ }
120
+ }
121
+ },
122
+ "invariants": {
123
+ "type": "object",
124
+ "required": [
125
+ "never_delete_human_refs",
126
+ "never_auto_move_in_progress_work",
127
+ "self_heal_scope",
128
+ "manifests_single_writer",
129
+ "index_pure_merge"
130
+ ],
131
+ "additionalProperties": false,
132
+ "properties": {
133
+ "never_delete_human_refs": {
134
+ "const": true,
135
+ "description": "The NEVER-DELETE-HUMAN-REFS invariant: self-heal / reconcile MUST NOT delete any human-owned ref under any circumstance. Data loss dressed as tidiness is forbidden."
136
+ },
137
+ "never_auto_move_in_progress_work": {"const": true},
138
+ "self_heal_scope": {"const": "leased-pipeline-owned-refs-only"},
139
+ "manifests_single_writer": {
140
+ "const": true,
141
+ "description": "Per-artifact manifests are immutable single-writer gate records; refresh state lives in a separate sidecar, never in the manifest."
142
+ },
143
+ "index_pure_merge": {
144
+ "const": true,
145
+ "description": "The projections index is a pure function of the manifests (+ envelopes + sidecars) with no generated_at, so --check is deterministic and byte-identical across drivers."
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
@@ -7,7 +7,7 @@
7
7
  "additionalProperties": false,
8
8
  "properties": {
9
9
  "schema": {"const": "consiliency.manifest.v1"},
10
- "contract_version": {"type": "string", "pattern": "^0\\.3\\.\\d+$"},
10
+ "contract_version": {"type": "string", "pattern": "^0\\.4\\.\\d+$"},
11
11
  "repo": {
12
12
  "type": "object",
13
13
  "required": ["id", "display_name", "default_branch"],
@@ -75,7 +75,7 @@
75
75
  "type": "boolean",
76
76
  "description": "true = the repo consents to be governed for the facets in adopted_scope (which must be non-empty). false = an explicit, recorded declaration of non-adoption: the repo is UNGOVERNED for every facet even though a profile is present. A repo with no adoption profile at all is likewise ungoverned; adopted:false is the explicit, auditable form of that state."
77
77
  },
78
- "contract_version": {"type": "string", "pattern": "^0\\.3\\.\\d+$"},
78
+ "contract_version": {"type": "string", "pattern": "^0\\.4\\.\\d+$"},
79
79
  "archetype": {"enum": ["product", "service", "library", "infra", "tooling-meta", "experiment", "document", "baseline-only"]},
80
80
  "adopted_scope": {
81
81
  "type": "array",