open-research-protocol 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/AGENT_INTEGRATION.md +94 -0
  2. package/INSTALL.md +159 -0
  3. package/LICENSE +22 -0
  4. package/PROTOCOL.md +140 -0
  5. package/README.md +312 -0
  6. package/bin/orp.js +38 -0
  7. package/cli/orp.py +3595 -0
  8. package/cone/CONTEXT_LOG.md +33 -0
  9. package/docs/AGENT_LOOP.md +63 -0
  10. package/docs/CHOOSING_OR_IGNORING_INSTRUMENTS.md +128 -0
  11. package/docs/CODA_ORP_CONTRACT.md +222 -0
  12. package/docs/CORE_ABILITY_REFOCUS_CHECKLIST.md +62 -0
  13. package/docs/DISCOVER.md +69 -0
  14. package/docs/EXTERNAL_CONTRIBUTION_GOVERNANCE.md +275 -0
  15. package/docs/MATHLIB_COLLABORATION_FLOW_PROMPT.md +112 -0
  16. package/docs/NPM_RELEASE_CHECKLIST.md +55 -0
  17. package/docs/ORP_V1_ATOMIC_DISCOVERY_EVOLUTION.md +186 -0
  18. package/docs/OSS_CONTRIBUTION_AGENT_LOOP.md +69 -0
  19. package/docs/PRESENTATION_BOW.md +100 -0
  20. package/docs/PROFILE_PACKS.md +227 -0
  21. package/docs/SUNFLOWER_CODA_PR_GOVERNANCE_MAPPING.md +77 -0
  22. package/docs/WHY_INSTRUMENTS.md +118 -0
  23. package/examples/README.md +21 -0
  24. package/examples/example_claim.md +33 -0
  25. package/examples/example_failed.md +24 -0
  26. package/examples/example_verification.md +36 -0
  27. package/examples/orp.erdos-problems.catalog.yml +88 -0
  28. package/examples/orp.external-pr-governance.yml +223 -0
  29. package/examples/orp.sunflower-coda.atomic.yml +144 -0
  30. package/examples/orp.sunflower-coda.live-compare.yml +181 -0
  31. package/examples/orp.sunflower-coda.pr-governance.yml +253 -0
  32. package/examples/packet.problem_scope.example.json +123 -0
  33. package/examples/reports/README.md +16 -0
  34. package/examples/reports/sunflower_live_compare_20.RUN_SUMMARY.md +37 -0
  35. package/examples/reports/sunflower_live_compare_367.RUN_SUMMARY.md +37 -0
  36. package/examples/reports/sunflower_live_compare_857.RUN_SUMMARY.md +37 -0
  37. package/llms.txt +58 -0
  38. package/modules/instruments/ADVERSARIAL/README.md +109 -0
  39. package/modules/instruments/ADVERSARIAL/TEMPLATE.md +27 -0
  40. package/modules/instruments/COMPRESSION/README.md +112 -0
  41. package/modules/instruments/COMPRESSION/TEMPLATE.md +27 -0
  42. package/modules/instruments/INSTRUMENT_TEMPLATE.md +30 -0
  43. package/modules/instruments/ORBIT/README.md +124 -0
  44. package/modules/instruments/ORBIT/TEMPLATE.md +28 -0
  45. package/modules/instruments/README.md +179 -0
  46. package/package.json +54 -0
  47. package/packs/README.md +16 -0
  48. package/packs/erdos-open-problems/README.md +287 -0
  49. package/packs/erdos-open-problems/data/README.md +43 -0
  50. package/packs/erdos-open-problems/data/erdos_open_problems.md +697 -0
  51. package/packs/erdos-open-problems/data/erdos_problems.active.json +15561 -0
  52. package/packs/erdos-open-problems/data/erdos_problems.all.json +26289 -0
  53. package/packs/erdos-open-problems/data/erdos_problems.closed.json +10760 -0
  54. package/packs/erdos-open-problems/data/erdos_problems.open.json +15561 -0
  55. package/packs/erdos-open-problems/docs/SUNFLOWER_ADAPTER_DEPENDENCIES.md +63 -0
  56. package/packs/erdos-open-problems/pack.yml +131 -0
  57. package/packs/erdos-open-problems/profiles/erdos-problems-catalog-sync.yml.tmpl +99 -0
  58. package/packs/erdos-open-problems/profiles/sunflower-live-compare.yml.tmpl +188 -0
  59. package/packs/erdos-open-problems/profiles/sunflower-mathlib-pr-governance.yml.tmpl +253 -0
  60. package/packs/erdos-open-problems/profiles/sunflower-problem857-discovery-public-repo.yml.tmpl +152 -0
  61. package/packs/erdos-open-problems/profiles/sunflower-problem857-discovery.yml.tmpl +154 -0
  62. package/packs/external-pr-governance/README.md +116 -0
  63. package/packs/external-pr-governance/adapters/formal-conjectures/README.md +35 -0
  64. package/packs/external-pr-governance/adapters/mathlib/README.md +37 -0
  65. package/packs/external-pr-governance/pack.yml +146 -0
  66. package/packs/external-pr-governance/profiles/oss-feedback-hardening.yml.tmpl +92 -0
  67. package/packs/external-pr-governance/profiles/oss-pr-governance.yml.tmpl +233 -0
  68. package/packs/issue-smashers/README.md +92 -0
  69. package/packs/issue-smashers/adapters/formal-conjectures/README.md +17 -0
  70. package/packs/issue-smashers/adapters/generic-github/README.md +16 -0
  71. package/packs/issue-smashers/adapters/mathlib/README.md +32 -0
  72. package/packs/issue-smashers/bootstrap/README.md +19 -0
  73. package/packs/issue-smashers/bootstrap/setup-issue-smashers.sh +18 -0
  74. package/packs/issue-smashers/examples/issue-smashers.workspace.yml +24 -0
  75. package/packs/issue-smashers/pack.yml +178 -0
  76. package/packs/issue-smashers/profiles/issue-smashers-feedback-hardening.yml.tmpl +102 -0
  77. package/packs/issue-smashers/profiles/issue-smashers.yml.tmpl +258 -0
  78. package/scripts/npm-postinstall-check.js +31 -0
  79. package/scripts/orp +11 -0
  80. package/scripts/orp-agent-integrate.sh +197 -0
  81. package/scripts/orp-checkpoint.sh +184 -0
  82. package/scripts/orp-erdos-problems-sync.py +580 -0
  83. package/scripts/orp-init.sh +50 -0
  84. package/scripts/orp-pack-fetch.py +155 -0
  85. package/scripts/orp-pack-install.py +2273 -0
  86. package/scripts/orp-pack-render.py +188 -0
  87. package/spec/v1/LIFECYCLE_MAPPING.md +40 -0
  88. package/spec/v1/orp.config.schema.json +385 -0
  89. package/spec/v1/packet.schema.json +552 -0
  90. package/spec/v1/profile-pack.schema.json +95 -0
  91. package/templates/CLAIM.md +33 -0
  92. package/templates/FAILED_TOPIC.md +19 -0
  93. package/templates/ISSUE_TEMPLATE.md +22 -0
  94. package/templates/VERIFICATION_RECORD.md +34 -0
@@ -0,0 +1,275 @@
1
+ # External Contribution Governance
2
+
3
+ Date: 2026-03-07
4
+
5
+ This document explains how ORP should represent external OSS contribution work such as:
6
+
7
+ - contributing from a local research repo into `leanprover-community/mathlib4`
8
+ - contributing into `google-deepmind/formal-conjectures`
9
+ - contributing into any other upstream repo where etiquette, coordination, and review discipline matter
10
+
11
+ It is the ORP-side entry point for PR-governance workflow design.
12
+
13
+ ## What This Document Is
14
+
15
+ This is not a mathlib document, a formal-conjectures document, or a repo-specific checklist.
16
+
17
+ It is the ORP contract for external contribution workflow:
18
+
19
+ - what ORP should standardize
20
+ - what should stay adapter-specific
21
+ - what lifecycle an agent or operator should preserve
22
+ - how to keep governance artifacts process-only while real evidence stays in the working repo
23
+
24
+ If someone asks, "How should ORP model external PR work without hardcoding one ecosystem's rules?",
25
+ this is the document they should read first.
26
+
27
+ ## What ORP Is Standardizing
28
+
29
+ ORP should standardize:
30
+
31
+ - lifecycle states for external contribution work
32
+ - machine-readable gate outcomes
33
+ - packet and summary structure for governance runs
34
+ - the boundary between process metadata and evidence
35
+ - the adapter model for ecosystem-specific commands and etiquette
36
+
37
+ ORP should not hardwire:
38
+
39
+ - one project's PR-body wording
40
+ - one project's branch naming rules
41
+ - one project's build commands
42
+ - one project's disclosure or queue policy
43
+ - one project's social norms as if they were universal protocol semantics
44
+
45
+ Those belong in adapters, rendered configs, or host-repo docs.
46
+
47
+ ## Boundary
48
+
49
+ ORP remains process-only.
50
+
51
+ - ORP docs, packets, summaries, and governance reports are not evidence.
52
+ - Evidence remains in canonical artifact paths of the working repo.
53
+ - Governance profiles track workflow quality, review discipline, and readiness state.
54
+ - They do not prove mathematical truth or replace host-repo verification artifacts.
55
+
56
+ This matters because external contribution work often mixes:
57
+
58
+ - real repo evidence such as test logs, proof artifacts, CI results, and source diffs
59
+ - process coordination such as overlap checks, PR readiness, draft CI watch, and review-thread handling
60
+
61
+ ORP is responsible for the second category and should point clearly at the first.
62
+
63
+ ## When To Use This
64
+
65
+ Use this governance layer when the primary task is:
66
+
67
+ - selecting upstream work
68
+ - coordinating with an existing contributor
69
+ - validating whether a PR is appropriate to open
70
+ - moving from local branch to draft PR
71
+ - deciding whether a draft is truly ready for review
72
+ - responding to maintainer feedback in a disciplined loop
73
+
74
+ Do not use this document as the main guide for:
75
+
76
+ - pure research-claim verification
77
+ - theorem/proof evidence review
78
+ - repo-internal task orchestration that does not involve upstream etiquette
79
+
80
+ ## First Read
81
+
82
+ Read these in order:
83
+
84
+ 1. `docs/EXTERNAL_CONTRIBUTION_GOVERNANCE.md`
85
+ 2. `PROTOCOL.md`
86
+ 3. `AGENT_INTEGRATION.md`
87
+ 4. `docs/AGENT_LOOP.md`
88
+ 5. `docs/OSS_CONTRIBUTION_AGENT_LOOP.md`
89
+ 6. `docs/SUNFLOWER_CODA_PR_GOVERNANCE_MAPPING.md`
90
+ 7. the current host-repo handoff or contribution-governance notes
91
+
92
+ Use the current `sunflower-coda` workflow as the reference implementation, but do not copy its
93
+ repo-specific details into ORP core semantics.
94
+
95
+ ## Standard Lifecycle
96
+
97
+ This is the portable lifecycle ORP should represent.
98
+
99
+ 1. `watch_and_select`
100
+ Identify a contribution target and confirm it is worth pursuing.
101
+ 2. `viability_gate`
102
+ Check whether the issue or idea is actually appropriate for contribution.
103
+ 3. `overlap_and_coordination`
104
+ Avoid duplicating active work and coordinate before competing.
105
+ 4. `isolated_local_work`
106
+ Work in an isolated branch or worktree.
107
+ 5. `local_first_verification`
108
+ Prefer local validation before spending CI or reviewer attention.
109
+ 6. `ready_to_draft_freeze`
110
+ Pause, tighten, and confirm the branch is genuinely ready to be shown.
111
+ 7. `draft_pr_open_or_update`
112
+ Open or update the PR in draft state first.
113
+ 8. `draft_ci_watch`
114
+ Watch draft CI and fix issues before promotion.
115
+ 9. `ready_for_review_decision`
116
+ Promote only when the full gate chain is satisfied.
117
+ 10. `feedback_hardening_loop`
118
+ Convert maintainer feedback into concrete fixes and new guards when possible.
119
+
120
+ This lifecycle is the heart of the ORP representation.
121
+
122
+ ## Generic Rules To Preserve
123
+
124
+ These are the portable norms the ORP side should preserve across ecosystems.
125
+
126
+ 1. Coordinate before competing with an active contributor.
127
+ 2. Prefer local verification over CI churn.
128
+ 3. Open or update PRs as draft first.
129
+ 4. Keep public PR text portable and concise.
130
+ 5. Only mark ready for review when the full gate chain is satisfied.
131
+ 6. Resolve review threads only after the corresponding fixes are pushed and rechecked.
132
+ 7. Thank reviewers directly and specifically after fixes land.
133
+ 8. When maintainer feedback reveals a missed check, convert it into a guard if machine-checkable.
134
+
135
+ ## Where This Lives In ORP
136
+
137
+ The intended ORP layout is:
138
+
139
+ - canonical governance doc:
140
+ - `docs/EXTERNAL_CONTRIBUTION_GOVERNANCE.md`
141
+ - operator-facing loop:
142
+ - `docs/OSS_CONTRIBUTION_AGENT_LOOP.md`
143
+ - generic pack root:
144
+ - `packs/external-pr-governance/`
145
+ - adapters:
146
+ - `packs/external-pr-governance/adapters/mathlib/`
147
+ - `packs/external-pr-governance/adapters/formal-conjectures/`
148
+ - generic profile templates:
149
+ - `packs/external-pr-governance/profiles/oss-pr-governance.yml.tmpl`
150
+ - `packs/external-pr-governance/profiles/oss-feedback-hardening.yml.tmpl`
151
+ - illustrative example:
152
+ - `examples/orp.external-pr-governance.yml`
153
+
154
+ ## Reference Implementation
155
+
156
+ Right now, the strongest live reference implementation is in `sunflower-coda`.
157
+
158
+ Treat these as the model for behavior, not as ORP-core files to copy directly:
159
+
160
+ - host-repo docs for submission checklist, viability gate, PR template, feedback loop, and upstream lane
161
+ - host-repo analysis artifacts for issue watchlists and watch status
162
+ - host-repo scripts for viability, overlap, local gate, tighten, ready-to-draft, PR opening, and PR-body preflight
163
+
164
+ ORP's job is to extract the generic shape from that implementation without freezing `sunflower-coda`
165
+ details into core semantics.
166
+
167
+ ## What Belongs Where
168
+
169
+ Use this split when porting an external contribution workflow into ORP.
170
+
171
+ ### ORP core
172
+
173
+ Belongs here:
174
+
175
+ - generic lifecycle semantics
176
+ - packet/report schema
177
+ - machine-readable run outcomes
178
+ - process/evidence boundary
179
+
180
+ Does not belong here:
181
+
182
+ - mathlib-specific branch naming
183
+ - formal-conjectures-specific build commands
184
+ - repo-specific PR templates
185
+ - repo-specific queue policy text
186
+
187
+ ### Generic governance pack
188
+
189
+ Belongs here:
190
+
191
+ - generic pre-open, local-readiness, draft-lifecycle, and feedback-hardening profiles
192
+ - generic variable names
193
+ - generic gate naming
194
+ - generic lifecycle ordering
195
+
196
+ ### Adapters
197
+
198
+ Belongs here:
199
+
200
+ - exact commands
201
+ - exact pass tokens
202
+ - exact host-repo file paths
203
+ - exact etiquette overlays that are specific to one ecosystem
204
+
205
+ ### Host repo
206
+
207
+ Belongs here:
208
+
209
+ - actual source changes
210
+ - actual test and verification artifacts
211
+ - actual PR text and issue references
212
+ - actual evidence and reviewer-visible outputs
213
+
214
+ ## Definition Of Done
215
+
216
+ Use this checklist to decide whether the ORP-side port is actually complete.
217
+
218
+ ### Coverage
219
+
220
+ - `PASS` if the ORP workflow covers:
221
+ - watch
222
+ - viability
223
+ - overlap
224
+ - local gate
225
+ - ready-to-draft
226
+ - draft PR
227
+ - draft CI
228
+ - ready-for-review
229
+ - feedback hardening
230
+
231
+ ### Separation
232
+
233
+ - `PASS` if ORP core remains generic.
234
+ - `FAIL` if ecosystem-specific rules leak into ORP core semantics.
235
+
236
+ ### Contracts
237
+
238
+ - `PASS` if decisions and gate outcomes are machine-readable.
239
+ - `PASS` if lifecycle states map cleanly into ORP `workflow_state`.
240
+
241
+ ### Etiquette
242
+
243
+ - `PASS` if the ORP representation preserves:
244
+ - coordination-first behavior
245
+ - draft-first behavior
246
+ - no-ready-before-green
247
+ - concise public replies
248
+ - review-thread discipline
249
+
250
+ ### Validation
251
+
252
+ - `PASS` if the ORP side includes at least:
253
+ - one mathlib example run
254
+ - one formal-conjectures example run
255
+ - one blocked or coordinate-first example
256
+ - one full green local-to-ready chain
257
+
258
+ ### Hardening
259
+
260
+ - `PASS` if the ORP port explicitly requires:
261
+ - missed check -> new guard when machine-checkable
262
+ - docs/template/instruction update in the same pass
263
+ - PASS + FAIL evidence for the new guard behavior
264
+
265
+ ## Recommended Next Move
266
+
267
+ Treat mathlib as the reference implementation and formal-conjectures as the first non-mathlib
268
+ adapter.
269
+
270
+ The next ORP implementation step should be:
271
+
272
+ 1. define the generic external-contribution pack contract
273
+ 2. keep the existing mathlib implementation as the reference adapter
274
+ 3. add a formal-conjectures adapter with the same lifecycle shape
275
+ 4. only then tighten prompts and operator instructions around it
@@ -0,0 +1,112 @@
1
+ # ORP Agent Prompt, Mathlib Collaboration Flow
2
+
3
+ You are onboarding into ORP with no prior chat context.
4
+
5
+ Goal:
6
+ Encode a proven, local-first mathlib collaboration workflow into ORP in a way that is reusable, auditable, and maintainer-friendly.
7
+
8
+ ## Primary source of truth to ingest first
9
+
10
+ Read these files from this path:
11
+ `/path/to/sunflower-coda/repo`
12
+
13
+ - `docs/MATHLIB_SUBMISSION_CHECKLIST.md`
14
+ - `docs/MATHLIB_ISSUE_VIABILITY_GATE.md`
15
+ - `docs/MATHLIB_DRAFT_PR_TEMPLATE.md`
16
+ - `docs/MATHLIB_NATURALITY_SNIPPET.md`
17
+ - `docs/WORKTREE_LANES.md`
18
+ - `scripts/mathlib-issue-local-gate.sh`
19
+ - `scripts/mathlib-issue-viability-gate.py`
20
+ - `scripts/mathlib-overlap-precheck.sh`
21
+ - `scripts/mathlib-pr-body-preflight.py`
22
+ - `scripts/install-mathlib-local-hook.sh`
23
+ - `scripts/issue-watch.py`
24
+ - `analysis/OSS_ISSUE_WATCHLIST.json`
25
+ - `analysis/OSS_ISSUE_WATCH_STATUS.md`
26
+
27
+ ## Non-negotiable constraints
28
+
29
+ 1. ORP docs/templates are process, not evidence.
30
+ 2. Evidence remains in canonical artifact paths, packets only reference those paths.
31
+ 3. Local-first gateing comes before draft CI.
32
+ 4. Coordination-first etiquette applies for assigned or already-active issues.
33
+ 5. Public PR text must be concise and portable, never machine-local.
34
+ 6. No auto-merge behavior, ORP standardizes evidence and reviewability.
35
+
36
+ ## Required mathlib flow to represent in ORP
37
+
38
+ ### A. Pre-work viability and overlap gates
39
+
40
+ - Viability decisions must include:
41
+ - `PASS`
42
+ - `COORDINATE`
43
+ - `CLOSE_CANDIDATE`
44
+ - `BLOCKED_NOT_OPEN`
45
+ - Include overlap precheck against open PRs before drafting.
46
+ - Require a natural-generality check before implementation.
47
+
48
+ ### B. Local implementation gates
49
+
50
+ - Branch naming includes issue number.
51
+ - Targeted build and targeted linter run.
52
+ - Local gate runner is canonical pass/fail decision.
53
+ - Support local-hold mode where work remains local with no draft PR.
54
+
55
+ ### C. Draft and review lifecycle
56
+
57
+ Use this lifecycle exactly:
58
+ `local_green -> draft_open -> draft_ci_green -> ready_for_review`
59
+
60
+ Track at least:
61
+ - action owner
62
+ - last checked timestamp
63
+ - last reviewed timestamp
64
+ - work stage
65
+ - whether review is needed
66
+
67
+ ### D. PR body hygiene gate
68
+
69
+ Require:
70
+ - concise summary
71
+ - portable validation wording
72
+ - no absolute local paths
73
+ - no machine-only helper commands in public PR text
74
+
75
+ ## What to produce in ORP
76
+
77
+ 1. A proposal to update ORP positioning language to:
78
+ `spec-first core, optional runtime, optional profiles`
79
+ while preserving current protocol guarantees.
80
+ 2. ORP schema mapping for collaborator states and gate outcomes.
81
+ 3. A mathlib profile config with command mappings for the gates above.
82
+ 4. A minimal runtime plan that wraps existing scripts first.
83
+ 5. Migration notes from current scripts to ORP profile adapters.
84
+ 6. A short risk register with mitigations.
85
+
86
+ ## Delivery format
87
+
88
+ Return all of the following:
89
+
90
+ 1. Proposed repo tree changes.
91
+ 2. Profile schema snippet.
92
+ 3. State machine table.
93
+ 4. Sample packet JSON that references canonical evidence paths.
94
+ 5. Phased rollout plan:
95
+ - Phase 1: spec + profile
96
+ - Phase 2: runtime wrappers
97
+ - Phase 3: reviewer/collaborator UX modules
98
+
99
+ ## Decision defaults
100
+
101
+ Unless blocked, default to:
102
+ - Language: TypeScript/Node for v1 CLI speed
103
+ - Config: `orp.yml` with explicit gate command contracts
104
+
105
+ If you propose a different default, include a concrete tradeoff table.
106
+
107
+ ## Scope discipline
108
+
109
+ - Do not redesign ORP from scratch.
110
+ - Preserve ORP epistemic boundaries from `PROTOCOL.md`.
111
+ - Keep MVP small, local-first, deterministic.
112
+ - Optimize for maintainers adopting the least-scary slice first.
@@ -0,0 +1,55 @@
1
+ # npm Release Checklist (`open-research-protocol`)
2
+
3
+ Use this checklist to publish professional, versioned ORP CLI releases.
4
+
5
+ ## One-time setup
6
+
7
+ 1. Confirm npm package ownership for `open-research-protocol`.
8
+ 2. Add repository secret `NPM_TOKEN` in GitHub Actions:
9
+ - token should have permission to publish this package.
10
+ 3. Confirm package metadata in `package.json`:
11
+ - `name`, `version`, `repository`, `bin`.
12
+
13
+ ## Per-release flow
14
+
15
+ 1. Ensure `main` is green and local tests pass:
16
+ - `python3 -m unittest discover -s tests -v`
17
+ - `npm pack --dry-run --cache /tmp/orp-npm-cache`
18
+ 2. Bump version in `package.json` (for example `0.1.1`).
19
+ 3. Commit and push the version bump to `main`.
20
+ 4. Create and push a matching tag:
21
+ - `git tag v0.1.1`
22
+ - `git push origin v0.1.1`
23
+ 5. Watch workflow:
24
+ - `.github/workflows/npm-publish.yml`
25
+ - tag push is the normal publish trigger
26
+ 6. Verify npm install:
27
+ - `npm i -g open-research-protocol`
28
+ - `orp -h`
29
+
30
+ ## Important guardrail
31
+
32
+ Tag version must match `package.json` exactly.
33
+
34
+ - Example:
35
+ - tag: `v0.1.1`
36
+ - package version: `0.1.1`
37
+
38
+ The publish workflow hard-fails if these differ.
39
+
40
+ Manual workflow dispatch is available as a recovery path, but it still requires the same exact version string.
41
+
42
+ ## Manual publish fallback
43
+
44
+ If automation is temporarily unavailable:
45
+
46
+ 1. Checkout intended commit locally.
47
+ 2. Run release validations above.
48
+ 3. Publish:
49
+ - `npm publish --access public`
50
+ 4. Create and push the matching tag:
51
+ - `git tag v0.1.1`
52
+ - `git push origin v0.1.1`
53
+ 5. Add release notes.
54
+
55
+ The tag-triggered workflow will still validate the version and will skip `npm publish` if that exact npm version already exists.
@@ -0,0 +1,186 @@
1
+ # ORP v1 Evolution: Atomic Discovery + Team Collaboration
2
+
3
+ This document extends ORP from a docs-first protocol into a local-first runtime model that still preserves ORP core boundaries.
4
+
5
+ ## Why this evolution
6
+
7
+ ORP cannot be only a GitHub/PR collaboration wrapper. In sunflower-coda style workflows, truth advances through:
8
+
9
+ - atomic board states (`tickets -> gates -> atoms`),
10
+ - scope-lock and spec-faithfulness checks,
11
+ - deterministic theorem-cycle gates,
12
+ - route-progress verification (strict and loose).
13
+
14
+ So ORP v1 must model discovery loops and collaboration loops as first-class peers.
15
+
16
+ ## Core model
17
+
18
+ 1. ORP Spec (stable core)
19
+ - Protocol rules, claim levels, downgrade rules.
20
+ - Versioned schemas for packets/config.
21
+ - Lifecycle mapping for claim and atomic states.
22
+
23
+ 2. ORP Runtime (optional executor)
24
+ - Runs configured gates.
25
+ - Captures stdout/stderr/timings/evidence pointers.
26
+ - Emits packet JSON + packet markdown + artifact logs.
27
+
28
+ 3. ORP Profiles (optional apps)
29
+ - `discovery` profile for atomic problem-scope loops.
30
+ - `collaboration` profile for PR prep and handoff.
31
+ - `review` profile for triage and verification.
32
+
33
+ ## Proposed repo tree
34
+
35
+ ```text
36
+ orp/
37
+ PROTOCOL.md
38
+ templates/
39
+ spec/
40
+ v1/
41
+ packet.schema.json
42
+ orp.config.schema.json
43
+ LIFECYCLE_MAPPING.md
44
+ examples/
45
+ orp.sunflower-coda.atomic.yml
46
+ packet.problem_scope.example.json
47
+ docs/
48
+ ORP_V1_ATOMIC_DISCOVERY_EVOLUTION.md
49
+ scripts/
50
+ orp-init.sh
51
+ orp-checkpoint.sh
52
+ orp-agent-integrate.sh
53
+ cli/ # planned runtime package
54
+ src/
55
+ commands/
56
+ init.ts
57
+ gate-run.ts
58
+ packet-emit.ts
59
+ profiles/
60
+ discovery.ts
61
+ collaboration.ts
62
+ review.ts
63
+ packet/
64
+ writer-json.ts
65
+ writer-markdown.ts
66
+ gates/
67
+ runner.ts
68
+ evaluator.ts
69
+ ```
70
+
71
+ ## Lifecycle compatibility contract
72
+
73
+ Claim workflow stays compatible with existing templates:
74
+
75
+ - `Draft -> draft`
76
+ - `In review -> ready`
77
+ - `Verified -> reviewed`
78
+ - `Blocked -> blocked`
79
+ - `Retracted -> retracted`
80
+
81
+ Atomic discovery workflow adds board-native mappings:
82
+
83
+ - `todo -> draft`
84
+ - `in_progress -> ready`
85
+ - `blocked -> blocked`
86
+ - `done -> reviewed`
87
+
88
+ `accepted` remains explicit; do not auto-promote without recorded acceptance criteria.
89
+
90
+ ## Packet kinds and minimum outputs
91
+
92
+ ORP v1 packet kinds:
93
+
94
+ - `pr`
95
+ - `claim`
96
+ - `verification`
97
+ - `problem_scope`
98
+ - `atom_pass`
99
+
100
+ Minimum outputs per run:
101
+
102
+ - `orp/packets/<id>.json`
103
+ - `orp/packets/<id>.md`
104
+ - `orp/artifacts/<run_id>/...`
105
+
106
+ For discovery packets, include board context:
107
+
108
+ - `board_id`, `problem_id`, `ticket_id`, `gate_id`, `atom_id`
109
+ - atom dependencies and ready-queue size
110
+ - route status snapshot
111
+ - board JSON snapshot path
112
+
113
+ ## Sunflower-coda profile mapping
114
+
115
+ The example profile (`examples/orp.sunflower-coda.atomic.yml`) treats existing board operations as canonical gates:
116
+
117
+ - board refresh gate (`problem857_ops_board.py refresh`)
118
+ - ready-queue gate (`problem857_ops_board.py ready`)
119
+ - spec-faithfulness gate (`orchestrator/problem857_public_spec_check.py`)
120
+ - Lean build gate (`lake build SunflowerLean.Balance`)
121
+ - frontier/route gate (`scripts/frontier_status.py --problem 857`)
122
+
123
+ This means ORP wraps your proven local gates instead of replacing them.
124
+
125
+ ## Migration path for this repo
126
+
127
+ 1. Keep `PROTOCOL.md` and templates as the constitution.
128
+ 2. Keep current shell scripts as stable compatibility layer.
129
+ 3. Add runtime CLI as optional (not mandatory for adoption).
130
+ 4. Ship discovery profile first for atomic board users.
131
+ 5. Keep reviewer/collaborator profiles optional modules.
132
+
133
+ This keeps ORP core stable while letting high-rigor workflows (like sunflower-coda) adopt runtime enforcement immediately.
134
+
135
+ ## Pack Distribution Model
136
+
137
+ To keep ORP core repo-agnostic and still support specialized domains:
138
+
139
+ - publish domain workflows as profile packs under `packs/` (or external repos),
140
+ - define pack metadata in `pack.yml` (schema: `spec/v1/profile-pack.schema.json`),
141
+ - ship templates with placeholders (for example `{{TARGET_REPO_ROOT}}`),
142
+ - render to concrete config via `scripts/orp-pack-render.py`.
143
+
144
+ This makes profiles portable and installable without hardcoding one team's repo paths into ORP core.
145
+
146
+ Collaboration governance example is now captured as a separate pack template:
147
+
148
+ - `packs/erdos-open-problems/profiles/sunflower-mathlib-pr-governance.yml.tmpl`
149
+
150
+ It models pre-open viability/policy checks and draft-readiness gates as optional collaboration profiles, parallel to discovery profiles.
151
+
152
+ ## Minimal CLI Now Available
153
+
154
+ A minimal runtime skeleton now exists at:
155
+
156
+ - `cli/orp.py`
157
+ - `scripts/orp` (launcher)
158
+
159
+ Supported commands:
160
+
161
+ ```bash
162
+ ./scripts/orp init
163
+ ./scripts/orp gate run --profile default
164
+ ./scripts/orp packet emit --profile default
165
+ ./scripts/orp report summary --run-id <run_id>
166
+ ./scripts/orp pack install --pack-id erdos-open-problems --target-repo-root /path/to/repo
167
+ ./scripts/orp erdos sync
168
+ ```
169
+
170
+ For sunflower-style discovery profiles:
171
+
172
+ ```bash
173
+ ./scripts/orp --repo-root /path/to/repo --config examples/orp.sunflower-coda.atomic.yml \
174
+ gate run --profile sunflower_problem857_discovery
175
+
176
+ ./scripts/orp --repo-root /path/to/repo --config examples/orp.sunflower-coda.atomic.yml \
177
+ packet emit --profile sunflower_problem857_discovery --kind problem_scope
178
+ ```
179
+
180
+ Current scope of this runtime:
181
+
182
+ - sequential gate execution with pass/fail rule checks,
183
+ - captured stdout/stderr logs in `orp/artifacts/<run_id>/`,
184
+ - one-page run summaries (`orp/artifacts/<run_id>/RUN_SUMMARY.md`) via `orp report summary`,
185
+ - run state in `orp/state.json`,
186
+ - packet JSON + markdown emission to `orp/packets/`.
@@ -0,0 +1,69 @@
1
+ # OSS Contribution Agent Loop
2
+
3
+ Use this loop when the task is external OSS contribution workflow rather than a research claim.
4
+
5
+ ## 1. Orient
6
+
7
+ - Read `docs/EXTERNAL_CONTRIBUTION_GOVERNANCE.md`.
8
+ - Read `PROTOCOL.md`.
9
+ - Keep the ORP boundary in force: governance artifacts are process-only, not evidence.
10
+
11
+ ## 2. Choose The Adapter
12
+
13
+ - If the target is mathlib, inspect:
14
+ - `packs/external-pr-governance/adapters/mathlib/README.md`
15
+ - If the target is formal-conjectures, inspect:
16
+ - `packs/external-pr-governance/adapters/formal-conjectures/README.md`
17
+
18
+ If the target repo is new, model its adapter on those two.
19
+
20
+ ## 3. Render Or Draft A Governance Config
21
+
22
+ - Start from:
23
+ - `packs/external-pr-governance/pack.yml`
24
+ - Render or adapt:
25
+ - `packs/external-pr-governance/profiles/oss-pr-governance.yml.tmpl`
26
+ - `packs/external-pr-governance/profiles/oss-feedback-hardening.yml.tmpl`
27
+
28
+ Fastest path:
29
+
30
+ ```bash
31
+ orp pack install --pack-id external-pr-governance
32
+ ```
33
+
34
+ That gives you install-and-adapt configs with explicit placeholder commands. Replace those adapter hooks before running meaningful governance passes.
35
+
36
+ If a host repo already has a stronger adapter, prefer that adapter over the generic template.
37
+
38
+ ## 4. Run The Lifecycle In Order
39
+
40
+ 1. `external_watch_select`
41
+ 2. `external_pre_open`
42
+ 3. `external_local_readiness`
43
+ 4. `external_draft_transition`
44
+ 5. `external_draft_lifecycle`
45
+ 6. `external_feedback_hardening` when maintainer feedback reveals a missed check
46
+
47
+ Do not skip directly from local work to ready-for-review.
48
+
49
+ ## 5. Preserve Etiquette
50
+
51
+ - Coordinate before competing with active contributors.
52
+ - Keep PR text portable and concise.
53
+ - Open or update as draft first.
54
+ - Only mark ready when local checks, freeze/readiness checks, and draft CI are all green.
55
+ - Resolve review threads only after the corresponding fix is pushed and rechecked.
56
+
57
+ ## 6. Checkpoint
58
+
59
+ Before handoff, compaction, `git commit`, or `git push`:
60
+
61
+ ```sh
62
+ scripts/orp-checkpoint.sh --sync --agent-file /path/to/agent/instructions.md "oss contribution governance checkpoint"
63
+ ```
64
+
65
+ ## 7. Respect The Boundary
66
+
67
+ - Governance profiles and packets describe workflow quality.
68
+ - The underlying repo artifacts remain the evidence source.
69
+ - If a guard fails, downgrade workflow confidence immediately and preserve the failure state.