repopact 2.0.0__tar.gz → 2.0.2__tar.gz

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 (48) hide show
  1. repopact-2.0.2/PKG-INFO +165 -0
  2. repopact-2.0.2/README.md +152 -0
  3. repopact-2.0.2/VERSION +1 -0
  4. {repopact-2.0.0 → repopact-2.0.2}/pyproject.toml +7 -6
  5. repopact-2.0.2/schemas/conformance-manifest.schema.json +34 -0
  6. {repopact-2.0.0 → repopact-2.0.2}/scripts/doctor.py +22 -0
  7. {repopact-2.0.0 → repopact-2.0.2}/scripts/init_repo.py +11 -7
  8. repopact-2.0.2/scripts/repopact.egg-info/PKG-INFO +165 -0
  9. {repopact-2.0.0 → repopact-2.0.2}/scripts/repopact.egg-info/SOURCES.txt +2 -0
  10. {repopact-2.0.0 → repopact-2.0.2}/scripts/repopact.egg-info/top_level.txt +1 -0
  11. repopact-2.0.2/scripts/run_conformance.py +112 -0
  12. {repopact-2.0.0 → repopact-2.0.2}/tests/test_conformance.py +27 -6
  13. {repopact-2.0.0 → repopact-2.0.2}/tests/test_validate_repo.py +20 -0
  14. repopact-2.0.0/PKG-INFO +0 -125
  15. repopact-2.0.0/README.md +0 -112
  16. repopact-2.0.0/VERSION +0 -1
  17. repopact-2.0.0/scripts/repopact.egg-info/PKG-INFO +0 -125
  18. {repopact-2.0.0 → repopact-2.0.2}/LICENSE +0 -0
  19. {repopact-2.0.0 → repopact-2.0.2}/schemas/audit-finding.schema.json +0 -0
  20. {repopact-2.0.0 → repopact-2.0.2}/schemas/evidence-run.schema.json +0 -0
  21. {repopact-2.0.0 → repopact-2.0.2}/schemas/frozen-surface.schema.json +0 -0
  22. {repopact-2.0.0 → repopact-2.0.2}/schemas/invariants.schema.json +0 -0
  23. {repopact-2.0.0 → repopact-2.0.2}/schemas/record-frontmatter.schema.json +0 -0
  24. {repopact-2.0.0 → repopact-2.0.2}/schemas/work-item.schema.json +0 -0
  25. {repopact-2.0.0 → repopact-2.0.2}/scripts/adopt_repo.py +0 -0
  26. {repopact-2.0.0 → repopact-2.0.2}/scripts/check_frozen_surface.py +0 -0
  27. {repopact-2.0.0 → repopact-2.0.2}/scripts/frontmatter.py +0 -0
  28. {repopact-2.0.0 → repopact-2.0.2}/scripts/generate_dashboard.py +0 -0
  29. {repopact-2.0.0 → repopact-2.0.2}/scripts/generate_spec.py +0 -0
  30. {repopact-2.0.0 → repopact-2.0.2}/scripts/new.py +0 -0
  31. {repopact-2.0.0 → repopact-2.0.2}/scripts/plan_import.py +0 -0
  32. {repopact-2.0.0 → repopact-2.0.2}/scripts/repo_model.py +0 -0
  33. {repopact-2.0.0 → repopact-2.0.2}/scripts/repopact.egg-info/dependency_links.txt +0 -0
  34. {repopact-2.0.0 → repopact-2.0.2}/scripts/repopact.egg-info/entry_points.txt +0 -0
  35. {repopact-2.0.0 → repopact-2.0.2}/scripts/repopact.egg-info/requires.txt +0 -0
  36. {repopact-2.0.0 → repopact-2.0.2}/scripts/repopact_cli.py +0 -0
  37. {repopact-2.0.0 → repopact-2.0.2}/scripts/takeover.py +0 -0
  38. {repopact-2.0.0 → repopact-2.0.2}/scripts/track_import.py +0 -0
  39. {repopact-2.0.0 → repopact-2.0.2}/scripts/validate_repo.py +0 -0
  40. {repopact-2.0.0 → repopact-2.0.2}/setup.cfg +0 -0
  41. {repopact-2.0.0 → repopact-2.0.2}/templates/README.md +0 -0
  42. {repopact-2.0.0 → repopact-2.0.2}/templates/decision.md +0 -0
  43. {repopact-2.0.0 → repopact-2.0.2}/templates/evidence-run.json +0 -0
  44. {repopact-2.0.0 → repopact-2.0.2}/templates/policy.md +0 -0
  45. {repopact-2.0.0 → repopact-2.0.2}/templates/work-item.README.md +0 -0
  46. {repopact-2.0.0 → repopact-2.0.2}/templates/work-item.json +0 -0
  47. {repopact-2.0.0 → repopact-2.0.2}/tests/test_plan_import_links.py +0 -0
  48. {repopact-2.0.0 → repopact-2.0.2}/tests/test_takeover_refs.py +0 -0
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: repopact
3
+ Version: 2.0.2
4
+ Summary: A repository-native standard for durable agent work: binding invariants, evidence-gated work items, and drift audits.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/ForgeWireLabs/repopact
7
+ Project-URL: Repository, https://github.com/ForgeWireLabs/repopact
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: jsonschema>=4.20
12
+ Dynamic: license-file
13
+
14
+ # RepoPact
15
+
16
+ RepoPact is a **repository-native governance kernel for durable agent work**. It keeps the
17
+ load-bearing state of a project — intent, authority, evidence, decisions, and drift — as
18
+ typed, version-controlled records in the filesystem, so a new contributor or agent can
19
+ recover where things stand *without* a prior conversation, and so the guarantees that matter
20
+ cannot be silently weakened.
21
+
22
+ > The repository is the pact: authority, intent, evidence, and history that survive every
23
+ > session.
24
+
25
+ `pip install repopact` · Apache-2.0 · current release **2.0.2**
26
+ ([changelog](decisions/0022-release-2.0.2-installed-seed-lookup.md)).
27
+
28
+ ## How it relates to `AGENTS.md`
29
+
30
+ `AGENTS.md` (and `CLAUDE.md`, editor rules) tell an agent *what to do* — they're
31
+ instructions, plain Markdown, with no enforcement. RepoPact is the layer **above** them:
32
+
33
+ > `AGENTS.md` tells an agent how to behave. RepoPact enforces and records whether the work respected the contract.
34
+
35
+ RepoPact's distinguishing primitive is the **binding invariant** — a declared guarantee with
36
+ a rationale, an escalation path, and (where its logical type permits) a machine enforcer.
37
+ That, plus evidence-gated completion and a filesystem state machine, is what turns a folder
38
+ convention into a contract. `repopact adopt` ingests an existing `AGENTS.md` rather than
39
+ replacing it (decision [`0020`](decisions/0020-launch-positioning-layer-above-agents-md.md)).
40
+
41
+ ## Core loop
42
+
43
+ ```text
44
+ intent -> scoped authority -> work item -> implementation -> evidence -> audit -> history
45
+ ```
46
+
47
+ ![RepoPact core loop over a filesystem state machine](docs/assets/repopact-flow.svg)
48
+
49
+ ## Primitives
50
+
51
+ 1. **Charter & invariants** — principles (judgment) and binding invariants
52
+ (escalation-gated) in `governance/`.
53
+ 2. **Frozen surface** — paths and symbols that require operator approval (`--ack`) to change.
54
+ 3. **Scopes & roles** — layered `AGENTS.md` contracts plus a role/scope map in
55
+ `governance/owners.json`.
56
+ 4. **Work items** — narrative `README.md` + machine-readable `work-item.json` with
57
+ evidence-linked acceptance criteria. **Mandatory preflight** (2.0): a work item must be
58
+ recorded *before* implementation begins (`repopact new` stamps the marker).
59
+ 5. **Evidence** — immutable run manifests under `evidence/runs/`.
60
+ 6. **Decisions & policies** — durable choices (`decisions/`) and operating rules
61
+ (`governance/policies/`) whose rationale outlives any single work item.
62
+ 7. **Provenance** (2.0) — every record is `concrete`, `provisional`, or `inferred`.
63
+ `adopt` emits provisional/inferred records (honest, not fabricated); `doctor` ratchets
64
+ them to `concrete` as real evidence arrives. See *2.0 changes* below.
65
+ 8. **Reconciliation** — audits and a *generated* dashboard surface drift and review
66
+ staleness rather than hand-maintaining it.
67
+
68
+ ## Install & quick start
69
+
70
+ ```powershell
71
+ pip install repopact # the CLI + reference validator, from PyPI
72
+ repopact init --target ../your-repo # seed a valid RepoPact in a new repo
73
+ cd ../your-repo
74
+ repopact new work-item "Title of the work" # stamps records (incl. the preflight marker)
75
+ repopact validate
76
+ repopact dashboard
77
+ ```
78
+
79
+ `repopact` dispatches `init`, `adopt`, `validate`, `new`, `dashboard`, `spec`,
80
+ `check-frozen`, `import-plan`, and `doctor`. Records are validated against `schemas/*.json`
81
+ (structure) and by the validator (cross-record semantics; decision
82
+ [`0003`](decisions/0003-validate-records-against-json-schemas.md)). Begin with
83
+ [`AGENTS.md`](AGENTS.md), then [`governance/charter.md`](governance/charter.md) and
84
+ [`governance/workflow.md`](governance/workflow.md).
85
+
86
+ Alternative implementations can run the published conformance suite:
87
+
88
+ ```powershell
89
+ python scripts/run_conformance.py --command "your-validator --root {repo}"
90
+ ```
91
+
92
+ See [`CONFORMANCE.md`](CONFORMANCE.md) and [`conformance/`](conformance/).
93
+
94
+ ## Adopt an *existing* repository
95
+
96
+ For a project that already has CODEOWNERS, CI workflows, and nested `AGENTS.md` contracts,
97
+ `adopt` maps those existing signals into RepoPact records without overwriting anything:
98
+
99
+ ```powershell
100
+ repopact adopt --target ../existing-repo --dry-run # preview the plan, write nothing
101
+ repopact adopt --target ../existing-repo # create records, then validate
102
+ repopact doctor # diagnose + repair drift; migrate on upgrade
103
+ ```
104
+
105
+ CODEOWNERS becomes scopes and roles; each `.github/workflows/*` becomes a binding-gate policy
106
+ (plus invariant `INV-2` and a frozen-surface entry); every nested `AGENTS.md` is registered as
107
+ a contract; git history seeds a first **inferred** evidence run, and the adoption record is
108
+ recorded as **provisional** — honestly typed, not a fabricated "completed" claim. Adoption is
109
+ idempotent.
110
+
111
+ ## 2.0: mandatory preflight + provenance-typed records
112
+
113
+ Decision [`0021`](decisions/0022-release-2.0.2-installed-seed-lookup.md) (supersedes 0018):
114
+
115
+ - **Mandatory preflight (default on).** No work begins until a work item exists and
116
+ propagates through the pact; `repopact new` stamps the marker. Existing repos grandfather
117
+ their pre-2.0 items automatically — `adopt`/`init` set a preflight epoch and `doctor`
118
+ migrates on upgrade. *This is a breaking change*: run `repopact doctor` after upgrading.
119
+ - **Provenance typing** (`concrete` / `provisional` / `inferred`, default `concrete`). This
120
+ is the principled escape from the *adoption trilemma*: `adopt` emits provisional/inferred
121
+ records so the result is both **valid** and **faithful** (reconstruction is labelled, not
122
+ faked). Completion still requires `concrete` evidence; `doctor` ratchets when it arrives.
123
+
124
+ ## Status is a filesystem transition
125
+
126
+ Work moves between `work/active`, `work/blocked`, `work/deferred`, and `work/completed`; its
127
+ `work-item.json` status must match its directory. Moving a work item never deletes its
128
+ reasoning, decisions, or evidence links.
129
+
130
+ ## Derive over declare
131
+
132
+ Anything computable from source records is generated, not authored by hand (the dashboard,
133
+ audit-freshness views, and the derived blocks of `SPEC.md`). Only genuine sources are
134
+ hand-maintained. See policy `001`.
135
+
136
+ ## Evaluation, formal model & the Proving Ground
137
+
138
+ RepoPact is developed against its own evidence, not assertion. The `research/` lab notebook
139
+ holds a [formal model](research/formal-model.md) (the L0–L5 kernel, the typed invariant
140
+ lattice, the adoption trilemma), the pre-registered [experiment protocol](research/protocol.md)
141
+ and [benchmark protocol](research/benchmark-protocol.md) (hypotheses H1–H13, falsification
142
+ criteria, [threats to validity](research/threats-to-validity.md)), a [findings
143
+ register](research/findings.md), and the current [paper](research/paper.md).
144
+
145
+ **PactBench** — the runnable benchmark suite (pre-registered tasks measuring whether RepoPact
146
+ enforcement reduces silent guarantee drift, with a model-agnostic harness and an S5 drift
147
+ harness) — lives in the **[RepoPact Proving
148
+ Ground](https://github.com/ForgeWireLabs/repopact-proving-ground)**, a throwaway-but-real
149
+ project that consumes RepoPact from PyPI and is driven across every primitive, including cases
150
+ designed to break it. RepoPact defines the *protocol* (`research/`); the Proving Ground hosts
151
+ the runnable suite. *RepoPact defines the pact; the Proving Ground tests whether the pact
152
+ holds under agent pressure.*
153
+
154
+ ## Ecosystem
155
+
156
+ RepoPact is the work-governance layer of [ForgeWire Labs](https://github.com/ForgeWireLabs) —
157
+ inspectable agentic infrastructure (*inspect the work, bound the authority, preserve the
158
+ evidence*). It composes with Fabric (execution governance) and ForgeLink (human-agent
159
+ communication governance), but is independently useful on its own.
160
+
161
+ ## License & version
162
+
163
+ Apache-2.0 ([`LICENSE`](LICENSE), decision [`0002`](decisions/0002-license-apache-2.0.md)).
164
+ The spec version is in [`VERSION`](VERSION); templates for every record type live in
165
+ [`templates/`](templates/).
@@ -0,0 +1,152 @@
1
+ # RepoPact
2
+
3
+ RepoPact is a **repository-native governance kernel for durable agent work**. It keeps the
4
+ load-bearing state of a project — intent, authority, evidence, decisions, and drift — as
5
+ typed, version-controlled records in the filesystem, so a new contributor or agent can
6
+ recover where things stand *without* a prior conversation, and so the guarantees that matter
7
+ cannot be silently weakened.
8
+
9
+ > The repository is the pact: authority, intent, evidence, and history that survive every
10
+ > session.
11
+
12
+ `pip install repopact` · Apache-2.0 · current release **2.0.2**
13
+ ([changelog](decisions/0022-release-2.0.2-installed-seed-lookup.md)).
14
+
15
+ ## How it relates to `AGENTS.md`
16
+
17
+ `AGENTS.md` (and `CLAUDE.md`, editor rules) tell an agent *what to do* — they're
18
+ instructions, plain Markdown, with no enforcement. RepoPact is the layer **above** them:
19
+
20
+ > `AGENTS.md` tells an agent how to behave. RepoPact enforces and records whether the work respected the contract.
21
+
22
+ RepoPact's distinguishing primitive is the **binding invariant** — a declared guarantee with
23
+ a rationale, an escalation path, and (where its logical type permits) a machine enforcer.
24
+ That, plus evidence-gated completion and a filesystem state machine, is what turns a folder
25
+ convention into a contract. `repopact adopt` ingests an existing `AGENTS.md` rather than
26
+ replacing it (decision [`0020`](decisions/0020-launch-positioning-layer-above-agents-md.md)).
27
+
28
+ ## Core loop
29
+
30
+ ```text
31
+ intent -> scoped authority -> work item -> implementation -> evidence -> audit -> history
32
+ ```
33
+
34
+ ![RepoPact core loop over a filesystem state machine](docs/assets/repopact-flow.svg)
35
+
36
+ ## Primitives
37
+
38
+ 1. **Charter & invariants** — principles (judgment) and binding invariants
39
+ (escalation-gated) in `governance/`.
40
+ 2. **Frozen surface** — paths and symbols that require operator approval (`--ack`) to change.
41
+ 3. **Scopes & roles** — layered `AGENTS.md` contracts plus a role/scope map in
42
+ `governance/owners.json`.
43
+ 4. **Work items** — narrative `README.md` + machine-readable `work-item.json` with
44
+ evidence-linked acceptance criteria. **Mandatory preflight** (2.0): a work item must be
45
+ recorded *before* implementation begins (`repopact new` stamps the marker).
46
+ 5. **Evidence** — immutable run manifests under `evidence/runs/`.
47
+ 6. **Decisions & policies** — durable choices (`decisions/`) and operating rules
48
+ (`governance/policies/`) whose rationale outlives any single work item.
49
+ 7. **Provenance** (2.0) — every record is `concrete`, `provisional`, or `inferred`.
50
+ `adopt` emits provisional/inferred records (honest, not fabricated); `doctor` ratchets
51
+ them to `concrete` as real evidence arrives. See *2.0 changes* below.
52
+ 8. **Reconciliation** — audits and a *generated* dashboard surface drift and review
53
+ staleness rather than hand-maintaining it.
54
+
55
+ ## Install & quick start
56
+
57
+ ```powershell
58
+ pip install repopact # the CLI + reference validator, from PyPI
59
+ repopact init --target ../your-repo # seed a valid RepoPact in a new repo
60
+ cd ../your-repo
61
+ repopact new work-item "Title of the work" # stamps records (incl. the preflight marker)
62
+ repopact validate
63
+ repopact dashboard
64
+ ```
65
+
66
+ `repopact` dispatches `init`, `adopt`, `validate`, `new`, `dashboard`, `spec`,
67
+ `check-frozen`, `import-plan`, and `doctor`. Records are validated against `schemas/*.json`
68
+ (structure) and by the validator (cross-record semantics; decision
69
+ [`0003`](decisions/0003-validate-records-against-json-schemas.md)). Begin with
70
+ [`AGENTS.md`](AGENTS.md), then [`governance/charter.md`](governance/charter.md) and
71
+ [`governance/workflow.md`](governance/workflow.md).
72
+
73
+ Alternative implementations can run the published conformance suite:
74
+
75
+ ```powershell
76
+ python scripts/run_conformance.py --command "your-validator --root {repo}"
77
+ ```
78
+
79
+ See [`CONFORMANCE.md`](CONFORMANCE.md) and [`conformance/`](conformance/).
80
+
81
+ ## Adopt an *existing* repository
82
+
83
+ For a project that already has CODEOWNERS, CI workflows, and nested `AGENTS.md` contracts,
84
+ `adopt` maps those existing signals into RepoPact records without overwriting anything:
85
+
86
+ ```powershell
87
+ repopact adopt --target ../existing-repo --dry-run # preview the plan, write nothing
88
+ repopact adopt --target ../existing-repo # create records, then validate
89
+ repopact doctor # diagnose + repair drift; migrate on upgrade
90
+ ```
91
+
92
+ CODEOWNERS becomes scopes and roles; each `.github/workflows/*` becomes a binding-gate policy
93
+ (plus invariant `INV-2` and a frozen-surface entry); every nested `AGENTS.md` is registered as
94
+ a contract; git history seeds a first **inferred** evidence run, and the adoption record is
95
+ recorded as **provisional** — honestly typed, not a fabricated "completed" claim. Adoption is
96
+ idempotent.
97
+
98
+ ## 2.0: mandatory preflight + provenance-typed records
99
+
100
+ Decision [`0021`](decisions/0022-release-2.0.2-installed-seed-lookup.md) (supersedes 0018):
101
+
102
+ - **Mandatory preflight (default on).** No work begins until a work item exists and
103
+ propagates through the pact; `repopact new` stamps the marker. Existing repos grandfather
104
+ their pre-2.0 items automatically — `adopt`/`init` set a preflight epoch and `doctor`
105
+ migrates on upgrade. *This is a breaking change*: run `repopact doctor` after upgrading.
106
+ - **Provenance typing** (`concrete` / `provisional` / `inferred`, default `concrete`). This
107
+ is the principled escape from the *adoption trilemma*: `adopt` emits provisional/inferred
108
+ records so the result is both **valid** and **faithful** (reconstruction is labelled, not
109
+ faked). Completion still requires `concrete` evidence; `doctor` ratchets when it arrives.
110
+
111
+ ## Status is a filesystem transition
112
+
113
+ Work moves between `work/active`, `work/blocked`, `work/deferred`, and `work/completed`; its
114
+ `work-item.json` status must match its directory. Moving a work item never deletes its
115
+ reasoning, decisions, or evidence links.
116
+
117
+ ## Derive over declare
118
+
119
+ Anything computable from source records is generated, not authored by hand (the dashboard,
120
+ audit-freshness views, and the derived blocks of `SPEC.md`). Only genuine sources are
121
+ hand-maintained. See policy `001`.
122
+
123
+ ## Evaluation, formal model & the Proving Ground
124
+
125
+ RepoPact is developed against its own evidence, not assertion. The `research/` lab notebook
126
+ holds a [formal model](research/formal-model.md) (the L0–L5 kernel, the typed invariant
127
+ lattice, the adoption trilemma), the pre-registered [experiment protocol](research/protocol.md)
128
+ and [benchmark protocol](research/benchmark-protocol.md) (hypotheses H1–H13, falsification
129
+ criteria, [threats to validity](research/threats-to-validity.md)), a [findings
130
+ register](research/findings.md), and the current [paper](research/paper.md).
131
+
132
+ **PactBench** — the runnable benchmark suite (pre-registered tasks measuring whether RepoPact
133
+ enforcement reduces silent guarantee drift, with a model-agnostic harness and an S5 drift
134
+ harness) — lives in the **[RepoPact Proving
135
+ Ground](https://github.com/ForgeWireLabs/repopact-proving-ground)**, a throwaway-but-real
136
+ project that consumes RepoPact from PyPI and is driven across every primitive, including cases
137
+ designed to break it. RepoPact defines the *protocol* (`research/`); the Proving Ground hosts
138
+ the runnable suite. *RepoPact defines the pact; the Proving Ground tests whether the pact
139
+ holds under agent pressure.*
140
+
141
+ ## Ecosystem
142
+
143
+ RepoPact is the work-governance layer of [ForgeWire Labs](https://github.com/ForgeWireLabs) —
144
+ inspectable agentic infrastructure (*inspect the work, bound the authority, preserve the
145
+ evidence*). It composes with Fabric (execution governance) and ForgeLink (human-agent
146
+ communication governance), but is independently useful on its own.
147
+
148
+ ## License & version
149
+
150
+ Apache-2.0 ([`LICENSE`](LICENSE), decision [`0002`](decisions/0002-license-apache-2.0.md)).
151
+ The spec version is in [`VERSION`](VERSION); templates for every record type live in
152
+ [`templates/`](templates/).
repopact-2.0.2/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.2
@@ -31,10 +31,11 @@ py-modules = [
31
31
  "track_import",
32
32
  "takeover",
33
33
  "doctor",
34
- "new",
35
- "check_frozen_surface",
36
- "frontmatter",
37
- ]
34
+ "new",
35
+ "check_frozen_surface",
36
+ "frontmatter",
37
+ "run_conformance",
38
+ ]
38
39
 
39
40
  [tool.setuptools.package-dir]
40
41
  "" = "scripts"
@@ -45,5 +46,5 @@ version = { file = "VERSION" }
45
46
  # Seed content shipped so `repopact init` works from an installed wheel. These
46
47
  # reference the canonical top-level files (one source of truth — no duplication).
47
48
  [tool.setuptools.data-files]
48
- "share/repopact/schemas" = ["schemas/*.json"]
49
- "share/repopact/templates" = ["templates/*"]
49
+ "share/repopact/schemas" = ["schemas/*.json"]
50
+ "share/repopact/templates" = ["templates/*"]
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "conformance-manifest.schema.json",
4
+ "type": "object",
5
+ "required": ["suite_version", "fixtures_root", "cases"],
6
+ "properties": {
7
+ "suite_version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
8
+ "spec_version_file": {"type": "string"},
9
+ "fixtures_root": {"type": "string", "minLength": 1},
10
+ "cases": {
11
+ "type": "array",
12
+ "minItems": 1,
13
+ "items": {
14
+ "type": "object",
15
+ "required": ["id", "path", "expect", "rules", "description"],
16
+ "properties": {
17
+ "id": {"type": "string", "minLength": 1},
18
+ "path": {"type": "string", "minLength": 1},
19
+ "overlay_on": {"type": "string", "minLength": 1},
20
+ "expect": {"enum": ["accept", "reject"]},
21
+ "expected_message": {"type": "string"},
22
+ "rules": {"type": "array", "items": {"type": "string"}, "minItems": 1},
23
+ "description": {"type": "string", "minLength": 1}
24
+ },
25
+ "allOf": [
26
+ {
27
+ "if": {"properties": {"expect": {"const": "reject"}}},
28
+ "then": {"required": ["expected_message", "overlay_on"]}
29
+ }
30
+ ]
31
+ }
32
+ }
33
+ }
34
+ }
@@ -170,6 +170,25 @@ def diagnose(root: Path) -> list[Finding]:
170
170
  return findings
171
171
 
172
172
 
173
+ def _migrate_preflight(root: Path, today: date) -> list[str]:
174
+ """On upgrade to 2.0, grandfather pre-2.0 work items (decision 0021). If owners.json
175
+ declares no preflight config at all, set an epoch (required_from_date = today) so
176
+ existing items are exempt and only work created after the upgrade needs a marker. A repo
177
+ that already declares preflight (on or off) is left untouched."""
178
+ owners = root / "governance" / "owners.json"
179
+ if not owners.is_file():
180
+ return []
181
+ try:
182
+ data = json.loads(owners.read_text(encoding="utf-8"))
183
+ except (OSError, ValueError):
184
+ return []
185
+ if "preflight" in data:
186
+ return []
187
+ data["preflight"] = {"enabled": True, "required_from_date": today.isoformat()}
188
+ owners.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8")
189
+ return [f"set preflight epoch (required_from_date={today.isoformat()}) to grandfather pre-2.0 work items"]
190
+
191
+
173
192
  def _ratchet_provisional(root: Path) -> list[str]:
174
193
  """Ratchet provisional work items to concrete once every satisfied criterion rests on
175
194
  concrete evidence (decision 0021). Conservative and monotone: only upgrades."""
@@ -277,6 +296,9 @@ def fix(root: Path, today: date | None = None) -> list[str]:
277
296
  # 6. ratchet provisional records whose evidence is now concrete (decision 0021)
278
297
  actions.extend(_ratchet_provisional(root))
279
298
 
299
+ # 7. migrate preflight on upgrade: grandfather pre-2.0 work items (decision 0021)
300
+ actions.extend(_migrate_preflight(root, today))
301
+
280
302
  return actions
281
303
 
282
304
 
@@ -11,6 +11,7 @@ from __future__ import annotations
11
11
  import argparse
12
12
  import json
13
13
  import shutil
14
+ import site
14
15
  import sys
15
16
  from datetime import date, timedelta
16
17
  from pathlib import Path
@@ -26,13 +27,16 @@ MODULES = (
26
27
 
27
28
  def _seed_dir(name: str) -> Path:
28
29
  """Locate seed content (schemas/templates) in a checkout or an installed wheel."""
29
- checkout = CHECKOUT / name
30
- if checkout.is_dir():
31
- return checkout
32
- installed = Path(sys.prefix) / "share" / "repopact" / name
33
- if installed.is_dir():
34
- return installed
35
- raise FileNotFoundError(f"cannot locate seed '{name}' (looked in {checkout} and {installed})")
30
+ candidates = [
31
+ CHECKOUT / name,
32
+ Path(sys.prefix) / "share" / "repopact" / name,
33
+ Path(site.USER_BASE) / "share" / "repopact" / name,
34
+ ]
35
+ for candidate in candidates:
36
+ if candidate.is_dir():
37
+ return candidate
38
+ looked = ", ".join(str(candidate) for candidate in candidates)
39
+ raise FileNotFoundError(f"cannot locate seed '{name}' (looked in {looked})")
36
40
 
37
41
 
38
42
  def _write(path: Path, text: str) -> None:
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: repopact
3
+ Version: 2.0.2
4
+ Summary: A repository-native standard for durable agent work: binding invariants, evidence-gated work items, and drift audits.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/ForgeWireLabs/repopact
7
+ Project-URL: Repository, https://github.com/ForgeWireLabs/repopact
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: jsonschema>=4.20
12
+ Dynamic: license-file
13
+
14
+ # RepoPact
15
+
16
+ RepoPact is a **repository-native governance kernel for durable agent work**. It keeps the
17
+ load-bearing state of a project — intent, authority, evidence, decisions, and drift — as
18
+ typed, version-controlled records in the filesystem, so a new contributor or agent can
19
+ recover where things stand *without* a prior conversation, and so the guarantees that matter
20
+ cannot be silently weakened.
21
+
22
+ > The repository is the pact: authority, intent, evidence, and history that survive every
23
+ > session.
24
+
25
+ `pip install repopact` · Apache-2.0 · current release **2.0.2**
26
+ ([changelog](decisions/0022-release-2.0.2-installed-seed-lookup.md)).
27
+
28
+ ## How it relates to `AGENTS.md`
29
+
30
+ `AGENTS.md` (and `CLAUDE.md`, editor rules) tell an agent *what to do* — they're
31
+ instructions, plain Markdown, with no enforcement. RepoPact is the layer **above** them:
32
+
33
+ > `AGENTS.md` tells an agent how to behave. RepoPact enforces and records whether the work respected the contract.
34
+
35
+ RepoPact's distinguishing primitive is the **binding invariant** — a declared guarantee with
36
+ a rationale, an escalation path, and (where its logical type permits) a machine enforcer.
37
+ That, plus evidence-gated completion and a filesystem state machine, is what turns a folder
38
+ convention into a contract. `repopact adopt` ingests an existing `AGENTS.md` rather than
39
+ replacing it (decision [`0020`](decisions/0020-launch-positioning-layer-above-agents-md.md)).
40
+
41
+ ## Core loop
42
+
43
+ ```text
44
+ intent -> scoped authority -> work item -> implementation -> evidence -> audit -> history
45
+ ```
46
+
47
+ ![RepoPact core loop over a filesystem state machine](docs/assets/repopact-flow.svg)
48
+
49
+ ## Primitives
50
+
51
+ 1. **Charter & invariants** — principles (judgment) and binding invariants
52
+ (escalation-gated) in `governance/`.
53
+ 2. **Frozen surface** — paths and symbols that require operator approval (`--ack`) to change.
54
+ 3. **Scopes & roles** — layered `AGENTS.md` contracts plus a role/scope map in
55
+ `governance/owners.json`.
56
+ 4. **Work items** — narrative `README.md` + machine-readable `work-item.json` with
57
+ evidence-linked acceptance criteria. **Mandatory preflight** (2.0): a work item must be
58
+ recorded *before* implementation begins (`repopact new` stamps the marker).
59
+ 5. **Evidence** — immutable run manifests under `evidence/runs/`.
60
+ 6. **Decisions & policies** — durable choices (`decisions/`) and operating rules
61
+ (`governance/policies/`) whose rationale outlives any single work item.
62
+ 7. **Provenance** (2.0) — every record is `concrete`, `provisional`, or `inferred`.
63
+ `adopt` emits provisional/inferred records (honest, not fabricated); `doctor` ratchets
64
+ them to `concrete` as real evidence arrives. See *2.0 changes* below.
65
+ 8. **Reconciliation** — audits and a *generated* dashboard surface drift and review
66
+ staleness rather than hand-maintaining it.
67
+
68
+ ## Install & quick start
69
+
70
+ ```powershell
71
+ pip install repopact # the CLI + reference validator, from PyPI
72
+ repopact init --target ../your-repo # seed a valid RepoPact in a new repo
73
+ cd ../your-repo
74
+ repopact new work-item "Title of the work" # stamps records (incl. the preflight marker)
75
+ repopact validate
76
+ repopact dashboard
77
+ ```
78
+
79
+ `repopact` dispatches `init`, `adopt`, `validate`, `new`, `dashboard`, `spec`,
80
+ `check-frozen`, `import-plan`, and `doctor`. Records are validated against `schemas/*.json`
81
+ (structure) and by the validator (cross-record semantics; decision
82
+ [`0003`](decisions/0003-validate-records-against-json-schemas.md)). Begin with
83
+ [`AGENTS.md`](AGENTS.md), then [`governance/charter.md`](governance/charter.md) and
84
+ [`governance/workflow.md`](governance/workflow.md).
85
+
86
+ Alternative implementations can run the published conformance suite:
87
+
88
+ ```powershell
89
+ python scripts/run_conformance.py --command "your-validator --root {repo}"
90
+ ```
91
+
92
+ See [`CONFORMANCE.md`](CONFORMANCE.md) and [`conformance/`](conformance/).
93
+
94
+ ## Adopt an *existing* repository
95
+
96
+ For a project that already has CODEOWNERS, CI workflows, and nested `AGENTS.md` contracts,
97
+ `adopt` maps those existing signals into RepoPact records without overwriting anything:
98
+
99
+ ```powershell
100
+ repopact adopt --target ../existing-repo --dry-run # preview the plan, write nothing
101
+ repopact adopt --target ../existing-repo # create records, then validate
102
+ repopact doctor # diagnose + repair drift; migrate on upgrade
103
+ ```
104
+
105
+ CODEOWNERS becomes scopes and roles; each `.github/workflows/*` becomes a binding-gate policy
106
+ (plus invariant `INV-2` and a frozen-surface entry); every nested `AGENTS.md` is registered as
107
+ a contract; git history seeds a first **inferred** evidence run, and the adoption record is
108
+ recorded as **provisional** — honestly typed, not a fabricated "completed" claim. Adoption is
109
+ idempotent.
110
+
111
+ ## 2.0: mandatory preflight + provenance-typed records
112
+
113
+ Decision [`0021`](decisions/0022-release-2.0.2-installed-seed-lookup.md) (supersedes 0018):
114
+
115
+ - **Mandatory preflight (default on).** No work begins until a work item exists and
116
+ propagates through the pact; `repopact new` stamps the marker. Existing repos grandfather
117
+ their pre-2.0 items automatically — `adopt`/`init` set a preflight epoch and `doctor`
118
+ migrates on upgrade. *This is a breaking change*: run `repopact doctor` after upgrading.
119
+ - **Provenance typing** (`concrete` / `provisional` / `inferred`, default `concrete`). This
120
+ is the principled escape from the *adoption trilemma*: `adopt` emits provisional/inferred
121
+ records so the result is both **valid** and **faithful** (reconstruction is labelled, not
122
+ faked). Completion still requires `concrete` evidence; `doctor` ratchets when it arrives.
123
+
124
+ ## Status is a filesystem transition
125
+
126
+ Work moves between `work/active`, `work/blocked`, `work/deferred`, and `work/completed`; its
127
+ `work-item.json` status must match its directory. Moving a work item never deletes its
128
+ reasoning, decisions, or evidence links.
129
+
130
+ ## Derive over declare
131
+
132
+ Anything computable from source records is generated, not authored by hand (the dashboard,
133
+ audit-freshness views, and the derived blocks of `SPEC.md`). Only genuine sources are
134
+ hand-maintained. See policy `001`.
135
+
136
+ ## Evaluation, formal model & the Proving Ground
137
+
138
+ RepoPact is developed against its own evidence, not assertion. The `research/` lab notebook
139
+ holds a [formal model](research/formal-model.md) (the L0–L5 kernel, the typed invariant
140
+ lattice, the adoption trilemma), the pre-registered [experiment protocol](research/protocol.md)
141
+ and [benchmark protocol](research/benchmark-protocol.md) (hypotheses H1–H13, falsification
142
+ criteria, [threats to validity](research/threats-to-validity.md)), a [findings
143
+ register](research/findings.md), and the current [paper](research/paper.md).
144
+
145
+ **PactBench** — the runnable benchmark suite (pre-registered tasks measuring whether RepoPact
146
+ enforcement reduces silent guarantee drift, with a model-agnostic harness and an S5 drift
147
+ harness) — lives in the **[RepoPact Proving
148
+ Ground](https://github.com/ForgeWireLabs/repopact-proving-ground)**, a throwaway-but-real
149
+ project that consumes RepoPact from PyPI and is driven across every primitive, including cases
150
+ designed to break it. RepoPact defines the *protocol* (`research/`); the Proving Ground hosts
151
+ the runnable suite. *RepoPact defines the pact; the Proving Ground tests whether the pact
152
+ holds under agent pressure.*
153
+
154
+ ## Ecosystem
155
+
156
+ RepoPact is the work-governance layer of [ForgeWire Labs](https://github.com/ForgeWireLabs) —
157
+ inspectable agentic infrastructure (*inspect the work, bound the authority, preserve the
158
+ evidence*). It composes with Fabric (execution governance) and ForgeLink (human-agent
159
+ communication governance), but is independently useful on its own.
160
+
161
+ ## License & version
162
+
163
+ Apache-2.0 ([`LICENSE`](LICENSE), decision [`0002`](decisions/0002-license-apache-2.0.md)).
164
+ The spec version is in [`VERSION`](VERSION); templates for every record type live in
165
+ [`templates/`](templates/).
@@ -3,6 +3,7 @@ README.md
3
3
  VERSION
4
4
  pyproject.toml
5
5
  schemas/audit-finding.schema.json
6
+ schemas/conformance-manifest.schema.json
6
7
  schemas/evidence-run.schema.json
7
8
  schemas/frozen-surface.schema.json
8
9
  schemas/invariants.schema.json
@@ -19,6 +20,7 @@ scripts/new.py
19
20
  scripts/plan_import.py
20
21
  scripts/repo_model.py
21
22
  scripts/repopact_cli.py
23
+ scripts/run_conformance.py
22
24
  scripts/takeover.py
23
25
  scripts/track_import.py
24
26
  scripts/validate_repo.py
@@ -9,6 +9,7 @@ new
9
9
  plan_import
10
10
  repo_model
11
11
  repopact_cli
12
+ run_conformance
12
13
  takeover
13
14
  track_import
14
15
  validate_repo