owlrunkit 0.18.2 → 0.18.3

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 (26) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +41 -7
  3. package/docs/architecture/OWLCODA_RUNKIT_018_PROJECT_DRIVER_PRODUCT_DEFINITION.md +16 -5
  4. package/docs/architecture/OWLCODA_RUNKIT_USAGE_MODE_SELECTION_PRODUCT_DECISION_20260811.md +53 -3
  5. package/docs/architecture/OWLCODA_RUN_KIT_CONTRACT_V0_2.md +7 -0
  6. package/integrations/codex/skills/owlcoda-runkit/SKILL.md +28 -9
  7. package/integrations/codex/skills/owlcoda-runkit/assets/templates/config.json +3 -3
  8. package/integrations/codex/skills/owlcoda-runkit/references/contract-v0.1.md +160 -0
  9. package/integrations/codex/skills/owlcoda-runkit/references/contract-v0.2.md +545 -0
  10. package/package.json +1 -1
  11. package/packages/attest/README.md +4 -3
  12. package/packages/attest/consumer-surface-v1.json +1 -0
  13. package/packages/attest/distribution-manifest-v1.json +7 -1
  14. package/packages/attest/schemas/quick-verification-receipt-v2.schema.json +232 -0
  15. package/packages/attest/src/index.mjs +4 -1
  16. package/packages/attest/src/quick-receipt-contract.mjs +13 -3
  17. package/packages/attest/src/quick.mjs +16 -2
  18. package/registry-release-policy-v1.json +5 -5
  19. package/sbom.spdx.json +5 -5
  20. package/scripts/runkit-contract/core-contract.mjs +2 -1
  21. package/scripts/runkit-contract/quick-metrics.mjs +3 -3
  22. package/scripts/runkit-contract/quick-receipt.mjs +79 -12
  23. package/scripts/runkit-contract/quick-verify.mjs +88 -11
  24. package/scripts/runkit-contract/runkit-cli.mjs +91 -9
  25. package/scripts/runkit-contract/schemas/team-project-event-v2.schema.json +128 -0
  26. package/scripts/runkit-contract/team-project.mjs +310 -45
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.18.3
4
+
5
+ - Adds `quick-verify --stdin-file <file>` so a local or remote verification
6
+ script can be copied into the receipt store, hash-bound, and supplied as
7
+ exact stdin without embedding its bytes in argv.
8
+ - Returns bounded opening and closing Quick output lines while preserving the
9
+ complete stdout/stderr artifacts for later inspection.
10
+ - Stops emitting the fixed `quick_ignored_artifact_unbound` noise on new Quick
11
+ receipts and omits it from attestation issue output for historical receipts.
12
+ - Adds `quick-verify --attest` as one high-level command while preserving the
13
+ Quick receipt and attestation as separate evidence objects.
14
+ - Adds action-specific `quick-metrics --help`; aggregate counts are now the
15
+ default output and receipt paths require `--verbose`.
16
+ - Adds atomic `project reject-and-return` for a current failed checkpoint. It
17
+ preserves the failed attempt, records reviewer evidence, opens an assigned
18
+ rework attempt, and keeps every authority flag false.
19
+ - Introduces `OwlCodaRunKitTeamProjectEventV2` for the new rework event instead
20
+ of changing the existing Event V1 contract in place.
21
+ - Packages the Contract v0.1 and v0.2 references beside the bundled Codex Skill
22
+ so its relative links work before and after managed Skill installation.
23
+
3
24
  ## 0.18.2
4
25
 
5
26
  - Makes `project checkpoint --help` action-specific and returns a complete,
package/README.md CHANGED
@@ -15,6 +15,12 @@ RunKit 0.18.2 is a focused dogfood patch for clearer CLI help, actionable
15
15
  checkpoint and canonical-path errors, bounded Quick output summaries, typed
16
16
  registry diagnostics, and explicit profile normalization previews.
17
17
 
18
+ RunKit 0.18.3 turns the next Sierac recovery dogfood findings into a smaller
19
+ Quick surface: hash-bound stdin scripts, bounded opening and closing summaries,
20
+ actionable-only receipt issues, optional one-command attestation, and concise
21
+ metrics by default. It also adds one atomic failed-work return path and makes
22
+ the bundled Skill's contract references self-contained.
23
+
18
24
  The 0.18 Project Driver is a bounded surface for new projects and controlled
19
25
  dogfood. Its product name does not claim to be a general long-running,
20
26
  multi-phase, or enterprise control plane. Version 0.18 adds one bounded
@@ -29,7 +35,7 @@ separate authority boundaries.
29
35
  ## Install
30
36
 
31
37
  ```bash
32
- npm install --save-exact owlrunkit@0.18.2
38
+ npm install --save-exact owlrunkit@0.18.3
33
39
  ```
34
40
 
35
41
  The `owlrunkit` bootstrap uses the project's exact locally bound CLI for
@@ -58,8 +64,8 @@ grant Git, release, deployment, production, or business authority.
58
64
 
59
65
  RunKit 0.18 keeps the project alive independently of any one Agent or chat.
60
66
  Initialize a definition, then use typed direct commands for the normal
61
- assignment, checkpoint, handoff, decision, integration, status, and takeover
62
- flow:
67
+ assignment, checkpoint, handoff, failed-work return, decision, integration,
68
+ status, and takeover flow:
63
69
 
64
70
  ```bash
65
71
  cp node_modules/owlrunkit/scripts/runkit-contract/templates/team-project-definition.json ./project-definition.json
@@ -77,6 +83,14 @@ owlrunkit project handoff --workspace . --handoff-id handoff-1 \
77
83
  --from-agent agent-runtime --to-agent agent-successor \
78
84
  --summary 'Source work is ready for continuation' --next 'Run verification' \
79
85
  --evidence evidence/source.txt
86
+ # If review instead rejects a failed checkpoint, preserve it and open rework
87
+ # without first mutating the WorkItem back to active:
88
+ owlrunkit project reject-and-return --workspace . --rework-id review-1 \
89
+ --at 2026-08-09T00:10:30.000Z --work-item work-item-1 \
90
+ --reviewer-agent agent-control --to-agent agent-runtime \
91
+ --reason 'The candidate violates its versioned contract' \
92
+ --next 'Repair the contract and rerun the focused check' \
93
+ --evidence evidence/rejected-review.txt
80
94
  owlrunkit project assign --workspace . --assignment-id assign-2 \
81
95
  --at 2026-08-09T00:11:00.000Z --work-item work-item-1 \
82
96
  --agent agent-successor --supersedes assign-1
@@ -121,6 +135,12 @@ by itself. The assurance lane follows actual writer and authority count,
121
135
  rollback certainty, permissions, security, funds, irreversibility, schema/data
122
136
  migration, and explicit acceptance contracts—not environment labels alone.
123
137
 
138
+ `project reject-and-return` applies only to the current explicit failed
139
+ checkpoint. One Event V2 atomically binds that failure, its prior assignment,
140
+ the reviewer, evidence, target Agent, and new assignment. The failed checkpoint
141
+ remains immutable; status and takeover expose the rework relation and attempt.
142
+ The command is not a Git rejection, merge action, or release authorization.
143
+
124
144
  `project verification --defer` is a small deferred-verification ledger, not a
125
145
  test scheduler. It records stable check IDs, why they were intentionally not
126
146
  run yet, the responsible Agent, and the integration gate before which they
@@ -226,12 +246,26 @@ Run Quick with:
226
246
 
227
247
  ```bash
228
248
  owlrunkit quick-verify --workspace . -- npm test
249
+ owlrunkit quick-verify --workspace . --stdin-file ./remote-check.sh --attest \
250
+ -- ssh test-host /bin/sh
251
+ owlrunkit quick-metrics --workspace . --local
252
+ owlrunkit quick-metrics --workspace . --local --verbose
229
253
  ```
230
254
 
231
- The top-level Quick result includes a bounded `outputSummary` with the last
232
- meaningful stdout/stderr lines, so common summaries such as `155 passed` are
233
- visible without opening `stdout.log`. The receipt still binds the complete
234
- stdout and stderr artifacts; the summary is presentation only.
255
+ `--stdin-file` accepts a regular non-symlink file up to 1 MiB, copies its exact
256
+ bytes into the receipt store, and binds its path, size, and SHA-256 in a V2
257
+ Quick receipt before supplying those stored bytes as stdin. This avoids putting
258
+ large scripts into SSH argv or receipt JSON. The top-level `outputSummary`
259
+ includes bounded opening and closing stdout/stderr lines, so both rollback and
260
+ restore phases remain visible while the complete artifacts stay receipt-bound.
261
+ `--attest` runs the existing attestation immediately and returns its independent
262
+ object alongside the Quick result; it does not promote Quick to Formal.
263
+
264
+ `quick-metrics --local` returns aggregate counts only. Add `--verbose` when the
265
+ individual receipt paths are needed. New successful receipts no longer carry
266
+ the fixed `quick_ignored_artifact_unbound` issue; historical receipts remain
267
+ strictly readable without surfacing that non-actionable code as an attestation
268
+ issue.
235
269
 
236
270
  ## Formal Delivery in three commands
237
271
 
@@ -34,11 +34,13 @@ The ordinary user-facing flow is a typed direct CLI surface:
34
34
  3. `project checkpoint` records meaningful state and evidence.
35
35
  4. `project handoff` transfers a responsibility without overwriting its
36
36
  history.
37
- 5. `project decision` opens or resolves a decision with rationale and evidence.
38
- 6. `project integrate` records an integration-gate result with evidence.
39
- 7. `project status` projects the current team state.
40
- 8. `project takeover` builds the next bounded action for a successor Agent.
41
- 9. After the project derives `overall=completed`, `project successor`
37
+ 5. `project reject-and-return` preserves a current failed checkpoint and opens
38
+ one evidence-linked rework assignment atomically.
39
+ 6. `project decision` opens or resolves a decision with rationale and evidence.
40
+ 7. `project integrate` records an integration-gate result with evidence.
41
+ 8. `project status` projects the current team state.
42
+ 9. `project takeover` builds the next bounded action for a successor Agent.
43
+ 10. After the project derives `overall=completed`, `project successor`
42
44
  archives it and installs one fresh project under explicit Owner invocation.
43
45
 
44
46
  Except for the one definition supplied to `init`, normal users provide typed
@@ -65,6 +67,11 @@ checkpoint.
65
67
  ## Continuity actions
66
68
 
67
69
  A handoff preserves the outgoing assignment and records the successor action.
70
+ A reject-and-return event binds the current failed checkpoint, failed
71
+ assignment, reviewer, evidence, target Agent, and new rework assignment in one
72
+ append-only write. The failed event stays terminal and immutable; the WorkItem
73
+ continues from a new derived active rework attempt. It cannot target completed,
74
+ active, implicit execution-only failure, or historical failure state.
68
75
  A decision separates the open question from its later resolution, rationale,
69
76
  and evidence. An integration event records that the project gate was reached;
70
77
  it is not a Git merge, release, deployment, or publication operation. Status and
@@ -132,6 +139,10 @@ untrusted control state. Normal project coordination retains
132
139
  `authorizationGranted=false` unless a separately authorized boundary says
133
140
  otherwise.
134
141
 
142
+ The new atomic rework record uses `OwlCodaRunKitTeamProjectEventV2`; existing
143
+ Event V1 bytes and meanings are unchanged and remain readable. This avoids
144
+ silently adding a new event meaning to the versioned V1 contract.
145
+
135
146
  ## Assurance boundary
136
147
 
137
148
  Multiple Agents coordinating a project do not make project coordination Formal
@@ -1,6 +1,6 @@
1
1
  # OwlCoda RunKit 使用模式选择:Sierac MES Dogfood 产品决议
2
2
 
3
- 状态:**0.18.1 已发布;本文主体保留发布前产品决议,文末追加 0.18.2 dogfood 补丁候选**
3
+ 状态:**0.18.2 已发布;本文主体保留既有产品决议,文末追加未发布的 0.18.3 dogfood 修复候选**
4
4
  日期:2026-08-11
5
5
 
6
6
  ## 已验证现场事实
@@ -162,5 +162,55 @@ RunKit contract/package gate、Core 身份同步、pack 内容检查和安装 sm
162
162
  - profile 纯格式规范化计划显式返回 `normalizationOnly: true`;
163
163
  - package README 与五模式、profile reconcile 的已实现真值一致。
164
164
 
165
- 当前这些内容只是本地 `owlrunkit@0.18.2` 候选。它不代表 commit、tag、npm 发布、
166
- 全局 Skill 更新、OwlChen/OwlFootball 迁移或任何业务授权已经发生。
165
+ 上述 0.18.2 内容已经发布;准确 Git/npm 身份以 `docs/PRODUCT-TRUTH.md` 和独立发布
166
+ 回执为准。发布本身没有更新全局 Skill、迁移外部项目或授予业务权限。
167
+
168
+ ## 0.18.3 Sierac recovery dogfood 修复候选
169
+
170
+ ### 新增现场事实
171
+
172
+ Sierac MES 三轮 0.18.2 实测继续支持“普通小任务少用、跨窗口使用 Project Driver、
173
+ 高价值状态转换使用 Quick”的模式决议。冷启动 takeover 约 0.4 秒恢复了当前 truth,
174
+ 并正确识别陈旧 handoff;一次 W1.8 回滚与 W1.9 恢复在串行读回后留下 GO Quick
175
+ attestation,且没有扩大到 Formal、生产、Git 或业务验收。
176
+
177
+ 同一轮暴露了五个可复现的 Quick 产品缺口:
178
+
179
+ - 为把远端脚本精确交给 SSH,操作者只能把 base64 放进 argv;单个参数达到
180
+ 14,469 bytes,整条 argv 约 14,539 bytes,receipt 为 79,591 bytes。
181
+ - 顶层摘要只保留最后三行,无法同时展示前半段 W1.8 回滚与后半段 W1.9 恢复。
182
+ - 项目现存 13/13 Quick 都携带固定 `quick_ignored_artifact_unbound`,没有可行动差异。
183
+ - 日常 Quick 仍需第二次调用 `quick-attest`。
184
+ - `quick-metrics --help` 返回通用 invalid-input,默认结果无条件展开全部 receipt 路径。
185
+
186
+ ### 本轮实现
187
+
188
+ - `quick-verify --stdin-file <file>` 将最多 1 MiB 的 regular non-symlink 输入复制到
189
+ receipt store,以路径、大小和 SHA-256 生成 `OwlCodaQuickVerificationReceiptV2`,
190
+ 再把已保存字节作为 exact stdin;脚本内容不进入 argv 或 receipt JSON。
191
+ - `outputSummary` 同时返回有界 head 与 tail,完整 stdout/stderr 仍是唯一证据材料。
192
+ - 新 Quick 不再生成固定 ignored-artifact issue;历史 receipt 仍严格可读,但 attest
193
+ 不再把该推测性代码作为问题输出。未声明 ignored output 仍不属于 Quick 证明范围。
194
+ - `quick-verify --attest` 在一个高层调用中返回独立 attestation 对象,不把 Quick
195
+ 提升为 Formal。
196
+ - `quick-metrics --local` 默认只返回聚合;`--verbose` 才返回 receipt 路径,并新增
197
+ action-specific help。
198
+ - 后续真实候选复核证明 RunKit 能保存“测试全绿但版本合同错误”的 rejection、Quick
199
+ receipt、源码未变事实和重新责任人。`project reject-and-return` 因此作为同一
200
+ 0.18.3 候选的原子 Project Driver 动作:只接受当前显式 failed checkpoint,保留
201
+ 失败事件,记录 reviewer/reason/evidence,并创建新的 rework assignment。新记录使用
202
+ Event V2,不改写 Event V1 合同。
203
+ - standalone npm 构建把 Contract v0.1/v0.2 的权威字节复制到 Skill 自身的
204
+ `references/`,使发布包内相对链接和之后的 managed Skill 安装保持一致。
205
+
206
+ ### 后续缺口
207
+
208
+ 本轮没有实现次优先级的 `project takeover` stale-handoff delta,也没有新增 recovery
209
+ evidence 的 `captured_before` / `restores_to` 语义字段。Project Driver 自动 ID、时间戳、
210
+ 单项完成与 integrate 合并,以及路径范围指纹仍保留在既有 backlog。
211
+
212
+ ### 不能声称
213
+
214
+ `0.18.3` 当前只是隔离 worktree 内的源码候选。它尚未 commit、合并、tag、publish、
215
+ 安装、全局 Skill 更新或外部项目 adoption;聚焦测试也不构成发布授权、生产授权或
216
+ 业务验收。
@@ -471,6 +471,13 @@ project-owned receipt store and performs no telemetry or network access. A
471
471
  Quick `GO` remains `captured_verification`; it cannot satisfy the Formal
472
472
  Contract v0.2 acceptance gate.
473
473
 
474
+ Core `0.18.3` adds `OwlCodaQuickVerificationReceiptV2` only when the caller
475
+ uses `quick-verify --stdin-file`. RunKit copies at most 1 MiB from a regular
476
+ non-symlink file into the receipt store before execution, supplies those stored
477
+ bytes as exact stdin, and binds their workspace-relative path, byte size, and
478
+ SHA-256. V1 remains the no-stdin receipt and stays readable. Neither schema
479
+ binds undeclared ignored outputs or grants any authority.
480
+
474
481
  Deterministic `repair` persists a reviewable plan before replay, reuses only
475
482
  fresh receipt-bound coverage, replays pending exact argv, and appends
476
483
  replacement lineage. Failed and orphaned attempts remain inspectable. Repair
@@ -1,16 +1,16 @@
1
1
  ---
2
2
  name: owlcoda-runkit
3
- description: Run receipt-backed, project-owned work with OwlCoda RunKit. Use when Codex needs to coordinate a large multi-Agent project, show per-Agent progress, manage dependencies or decisions, record intentionally deferred verification without repeating covered tests, hand work to another Agent, recover a blank-session next action, initialize or inspect `.owlcoda/runkit/`, plan bounded work with engine pins and leases, capture exact verification evidence, close an execution, produce a ready-for-commit receipt, or perform a read-only foreign-project shadow without widening Git or release authority.
3
+ description: Run receipt-backed, project-owned work with OwlCoda RunKit. Use when Codex needs to coordinate a large multi-Agent project, show per-Agent progress, manage dependencies or decisions, atomically return failed work for evidence-linked rework, record intentionally deferred verification without repeating covered tests, hand work to another Agent, recover a blank-session next action, initialize or inspect `.owlcoda/runkit/`, plan bounded work with engine pins and leases, capture exact verification evidence, close an execution, produce a ready-for-commit receipt, or perform a read-only foreign-project shadow without widening Git or release authority.
4
4
  ---
5
5
 
6
6
  # OwlCoda RunKit
7
7
 
8
8
  Use the bundled deterministic Core to coordinate work through project artifacts rather than chat memory. Require Node.js 20 or later.
9
9
 
10
- Bundled release: standalone `owlrunkit@0.18.2`, bundling Contract `0.2` and
11
- Core `0.18.2` with manifest
12
- `sha256:abe17ff794b4019d8d476f09eb5d4105bae1070b1df0aab53e6c94c7ec8b65a6`.
13
- The published `owlrunkit@0.18.1` package is the trusted prior for rollback;
10
+ Bundled release: standalone `owlrunkit@0.18.3`, bundling Contract `0.2` and
11
+ Core `0.18.3` with manifest
12
+ `sha256:cc7a923649592084150828f24f0d90f280af92514bafdbc4999f4015b3175d5c`.
13
+ The published `owlrunkit@0.18.2` package is the trusted prior for rollback;
14
14
  verify exact official npm registry provenance before adoption. The immutable
15
15
  rollback baseline for the prior release is `owlrunkit@0.16.1` with SHA-1
16
16
  `1bc119d24879bdd8959af16b364af55ca9d61ea9` and canonical npm tarball URL
@@ -24,8 +24,9 @@ The session is an execution interface. Project artifacts are the system of recor
24
24
  Translate ordinary user requests into durable typed project actions. Do not ask
25
25
  the user to operate the CLI when the request and authority are already clear.
26
26
 
27
- The normal mainline is `init`, `assign`, `checkpoint`, `handoff`, `decision`,
28
- `verification`, `integrate`, `status`, and `takeover`. After a project
27
+ The normal mainline is `init`, `assign`, `checkpoint`, `handoff`,
28
+ `reject-and-return`, `decision`, `verification`, `integrate`, `status`, and
29
+ `takeover`. After a project
29
30
  derives completed, `successor` is the bounded lifecycle step. `init` accepts one project definition
30
31
  JSON; subsequent actions use direct typed flags. Normal users do not author
31
32
  request, event, receipt, or hash JSON. The legacy `--request <event.json>` form
@@ -40,6 +41,9 @@ remains available for existing automation and compatibility.
40
41
  - "I decided ...": append a decision resolution with rationale and evidence.
41
42
  - "Hand this to another Agent": append the handoff, then a successor assignment;
42
43
  never overwrite the old assignment.
44
+ - "Reject this failed candidate and return it": use one `project
45
+ reject-and-return` event. Preserve the failed checkpoint, bind the review
46
+ evidence, create the rework assignment, and never rewrite failure as active.
43
47
  - "Continue/take over": build `project takeover` for the current Agent and use
44
48
  its bounded next action and evidence refs.
45
49
  - "Start the next project": only after status derives `overall=completed`,
@@ -76,6 +80,10 @@ owlrunkit project handoff --workspace "$PROJECT_ROOT" --handoff-id "$HANDOFF_ID"
76
80
  --at "$OCCURRED_AT" --assignment-id "$ASSIGNMENT_ID" --work-item "$WORK_ITEM_ID" \
77
81
  --from-agent "$AGENT_ID" --to-agent "$SUCCESSOR_AGENT_ID" \
78
82
  --summary "$SUMMARY" --next "$NEXT_ACTION" --evidence "$EVIDENCE_REF"
83
+ owlrunkit project reject-and-return --workspace "$PROJECT_ROOT" \
84
+ --rework-id "$REWORK_ID" --at "$OCCURRED_AT" --work-item "$WORK_ITEM_ID" \
85
+ --reviewer-agent "$REVIEWER_AGENT_ID" --to-agent "$AGENT_ID" \
86
+ --reason "$REJECTION_REASON" --next "$NEXT_ACTION" --evidence "$EVIDENCE_REF"
79
87
  owlrunkit project decision --workspace "$PROJECT_ROOT" --resolve \
80
88
  --decision-id "$DECISION_ID" --at "$OCCURRED_AT" --resolution "$RESOLUTION" \
81
89
  --rationale "$RATIONALE" --evidence "$EVIDENCE_REF"
@@ -199,15 +207,26 @@ For one low-risk exact command, use the Core v0.13 Quick path:
199
207
  owlrunkit quick-verify \
200
208
  --workspace "$PROJECT_ROOT" -- "$ABSOLUTE_EXECUTABLE" "arg-one"
201
209
 
210
+ owlrunkit quick-verify \
211
+ --workspace "$PROJECT_ROOT" --stdin-file "$SCRIPT_FILE" --attest \
212
+ -- ssh test-host /bin/sh
213
+
202
214
  owlrunkit quick-attest \
203
215
  --workspace "$PROJECT_ROOT" --receipt "$QUICK_RECEIPT"
204
216
 
205
217
  owlrunkit quick-metrics \
206
218
  --workspace "$PROJECT_ROOT" --local
219
+
220
+ owlrunkit quick-metrics \
221
+ --workspace "$PROJECT_ROOT" --local --verbose
207
222
  ```
208
223
 
209
- Quick receipts are `captured_verification`, not Formal acceptance. Metrics are
210
- local-only and perform no telemetry or network request.
224
+ `--stdin-file` copies and SHA-256-binds at most 1 MiB of regular non-symlink
225
+ input before supplying the stored bytes as exact stdin. `--attest` returns the
226
+ separate attestation object in the same high-level invocation. Quick receipts
227
+ remain `captured_verification`, not Formal acceptance. Metrics are aggregate by
228
+ default; `--verbose` adds receipt paths. Both forms are local-only and perform
229
+ no telemetry or network request.
211
230
 
212
231
  Core v0.13 also adds deterministic repair and exact-byte offline transport:
213
232
 
@@ -2,9 +2,9 @@
2
2
  "schemaVersion": "OwlCodaRunKitConfigV2",
3
3
  "core": {
4
4
  "contractVersion": "0.2",
5
- "coreVersion": "0.18.2",
6
- "coreManifestSha256": "sha256:abe17ff794b4019d8d476f09eb5d4105bae1070b1df0aab53e6c94c7ec8b65a6",
7
- "coreSourceRef": "artifact:sha256:abe17ff794b4019d8d476f09eb5d4105bae1070b1df0aab53e6c94c7ec8b65a6"
5
+ "coreVersion": "0.18.3",
6
+ "coreManifestSha256": "sha256:cc7a923649592084150828f24f0d90f280af92514bafdbc4999f4015b3175d5c",
7
+ "coreSourceRef": "artifact:sha256:cc7a923649592084150828f24f0d90f280af92514bafdbc4999f4015b3175d5c"
8
8
  },
9
9
  "authorizationPolicy": "external_explicit_authority_required"
10
10
  }
@@ -0,0 +1,160 @@
1
+ # OwlCoda RunKit Contract v0.1
2
+
3
+ Status: **frozen for Codex-side project execution**
4
+ Frozen at: 2026-07-13
5
+ Runner prerequisite: Node.js 20+
6
+
7
+ ## Purpose
8
+
9
+ RunKit Contract v0.1 defines the smallest reusable execution contract proven while developing OwlCoda inside Codex. It coordinates project-owned truth, bounded workers, delivery evidence, stage verification, invalidation and replacement without relying on chat history or agent memory.
10
+
11
+ This is a control and evidence contract. It is not an OwlCoda product API, a workflow designer, a memory system or a release system.
12
+
13
+ ## Frozen principles
14
+
15
+ 1. **Project-owned truth** — goals, packets, profiles, receipts and decisions live as project artifacts. Agent memory may help locate them but is never authoritative.
16
+ 2. **One owner per write scope** — every work item has an explicit lease and owned paths. Parallelism is allowed only across non-overlapping scopes.
17
+ 3. **Complete a phase before stage verification** — implementation lanes may batch a coherent phase and stop at `ready_for_stage_verification`; the stage gate runs once after all dependencies are fresh.
18
+ 4. **Evidence travels with delivery** — a delivery packet records scoped whole-file hashes, canonical fingerprint, commands already run and repository actions. The controller verifies hashes instead of repeating covered commands.
19
+ 5. **Stale evidence fails before execution** — a scoped source mismatch returns `invalidated_by_concurrent_write`; verification commands must remain at zero until a fresh replacement packet is valid.
20
+ 6. **Uncovered change fails closed** — if no profile covers a changed path, the decision is `full_profile_required`, never an empty successful selection.
21
+ 7. **Lineage validity is not verification success** — a structurally valid receipt graph becomes accepted only when the active receipt binds the current source fingerprint, exact selected profiles and real command receipts.
22
+ 8. **Append-only replacement** — invalidated receipts remain immutable. A replacement references the parent receipt SHA-256 and becomes the only active leaf.
23
+ 9. **Foreign projects remain project-owned** — read-only shadow runs may read another repository but must write all runner artifacts and scratch outside that repository and prove its start/end state is unchanged.
24
+ 10. **Runtime truth beats transcript appearance** — gate decisions consume files, hashes, exit codes and receipts, not worker summaries.
25
+
26
+ ### Additive clarifications
27
+
28
+ These rules narrow unsafe or ambiguous inputs without changing the frozen v0.1 semantics:
29
+
30
+ 1. **Runtime state is never product source** — `.owlcoda/runkit` and every descendant are reserved. They are forbidden in delivery `changedFiles`, verification profile path rules and lease owned paths. A violation is `invalid_input` / exit `3`, never a source change or profile match.
31
+ 2. **One execution pins one engine** — execution creation records `contractVersion`, `coreVersion`, `coreManifestSha256` and an immutable or content-addressed `coreSourceRef`. Every later core invocation compares this pin before acting. A mismatch fails closed as `engine_changed_during_execution` / exit `2`; it cannot silently mix implementations inside one lineage.
32
+ 3. **Core and producer data are separate** — acceptance semantics consume the contract version, pinned core identity and core payload. Producer identity is provenance. Adapter-specific extensions are namespaced and cannot add authority or change acceptance.
33
+ 4. **Configuration is data, not authority** — project configuration, profiles and command declarations never authorize Git, publish, deploy, destructive actions, credential use or foreign-project writes.
34
+
35
+ ## Artifact chain
36
+
37
+ ```text
38
+ GoalContract
39
+ -> ExecutionPlan
40
+ -> WorkItem + WorkerLease
41
+ -> ExecutionDeliveryPacket
42
+ -> VerificationProfile selection
43
+ -> Stage VerificationReceipt
44
+ -> GateDecision
45
+ -> CloseoutReceipt
46
+ ```
47
+
48
+ `events.jsonl` is the append-only transition ledger. `execution-plan.json` is a derived mutable snapshot and must not override contradictory events or receipts.
49
+
50
+ ## Delivery source contract
51
+
52
+ An `ExecutionDeliveryPacket` contains exactly one source hash map:
53
+
54
+ - `changedFiles.files`, or
55
+ - `changedFiles.wholeFileSha256`.
56
+
57
+ Both shapes present is malformed. Paths must be safe repository-relative paths: no absolute path, Windows rooted or drive-relative path, backslash, NUL, empty segment, `.` or `..`. Selected sources must be regular files inside the physical workspace root; symlinks and root escapes are rejected. The reserved `.owlcoda/runkit` subtree is rejected even though it is otherwise repository-relative, preventing receipts from recursively changing the fingerprint they describe.
58
+
59
+ Canonical stream:
60
+
61
+ ```text
62
+ <path><TAB>sha256:<lowercase-whole-file-sha256><LF>
63
+ ```
64
+
65
+ Rows are ordered by ascending Unicode code units, independent of locale and ICU. The source fingerprint is SHA-256 of the UTF-8 bytes of the canonical stream.
66
+
67
+ Source gate results and process exit codes:
68
+
69
+ - `valid` — exit `0`
70
+ - `invalidated_by_concurrent_write` — exit `2`
71
+ - `malformed_packet` — exit `3`
72
+
73
+ ## Verification profile contract
74
+
75
+ A profile has a stable `id` and path rules. v0.1 supports only:
76
+
77
+ - exact safe repository-relative path;
78
+ - safe non-empty `directory/**` prefix.
79
+
80
+ For legal inputs the resolver returns deterministic, de-duplicated profile IDs. Any uncovered changed path returns:
81
+
82
+ ```json
83
+ {
84
+ "decision": "full_profile_required",
85
+ "profileIds": [],
86
+ "uncoveredPaths": ["..."]
87
+ }
88
+ ```
89
+
90
+ Unsafe input is `invalid_input` / exit `3`; it is not converted into a profile decision. Profiles may not name `.owlcoda/runkit`, `.owlcoda/runkit/**` or a descendant exact path.
91
+
92
+ ## Receipt lineage contract
93
+
94
+ Each lineage entry contains:
95
+
96
+ - a 64-hex `receiptSha256` matching canonical receipt content;
97
+ - a receipt object;
98
+ - optional 64-hex `parentReceiptSha256` referencing an earlier invalidated receipt.
99
+
100
+ Receipt SHA values are globally unique. The lineage rejects malformed entries, hash mismatch, missing or non-prior parent, parent with the wrong state, cycles, branches and multiple active leaves.
101
+
102
+ Lineage CLI exit codes:
103
+
104
+ - structurally valid — exit `0`
105
+ - well-formed but invalid — exit `2`
106
+ - malformed input — exit `3`
107
+
108
+ ## Joint verification gate
109
+
110
+ The active receipt must bind:
111
+
112
+ - a current source gate with `status=valid` and exit `0`;
113
+ - the exact recomputed source fingerprint;
114
+ - the exact targeted profile IDs;
115
+ - a valid single-leaf receipt lineage.
116
+
117
+ For `status=passed`, `commandRuns` must be greater than zero and equal the number of command receipts. Every command receipt requires a non-empty command, exit `0`, and SHA-256 for stdout and stderr.
118
+
119
+ A zero-command receipt may remain `shadow_validated` or `ready_for_verification`, but it cannot be accepted as passed.
120
+
121
+ ## Stage verification economy
122
+
123
+ - Implementation lanes complete a coherent phase before testing when the round contract selects stage verification.
124
+ - A stage owner consumes all fresh packets and runs one declared top-level profile.
125
+ - The controller validates the packet and receipt hashes and does not repeat covered commands.
126
+ - A failed stage is classified before repair. Only the affected stage is rerun after a replacement packet; unrelated profiles remain valid.
127
+ - Full regression belongs at an integration, merge or release boundary, not every feature delivery.
128
+
129
+ ## Foreign-project read-only mode
130
+
131
+ Before and after the stage, record at minimum:
132
+
133
+ - foreign HEAD;
134
+ - raw Git status bytes and SHA-256;
135
+ - a declared workspace manifest fingerprint appropriate to the project;
136
+ - selected file hashes.
137
+
138
+ All foreign build scratch and receipts must be redirected to the controller project's artifact directory. Any start/end mismatch is `foreign_workspace_changed_during_shadow`, even when the verifier itself passed.
139
+
140
+ ## Provenance
141
+
142
+ - Run001 proved leases, receipt-first handoff, targeted repair and controller economy.
143
+ - Run002 proved a packaged provider-backed synthetic coding loop and restart recovery.
144
+ - Run003 proved stale packet invalidation, minimal affected profile selection and append-only replacement.
145
+ - Run004 proved the contract against the foreign Swift/macOS OwlOps project with one stage command, one focused Swift verifier and zero foreign repository writes.
146
+
147
+ The exact evidence hashes are recorded in the Run004 manifest and closeout receipt.
148
+
149
+ ## Versioning rule
150
+
151
+ The semantics above are frozen as v0.1. New optional fields are allowed when they do not weaken these invariants. Any change to path grammar, canonicalization, exit meanings, invalidation timing, receipt parentage, acceptance evidence or foreign-write policy requires a new contract version.
152
+
153
+ ## Not yet included
154
+
155
+ - reusable npm package or global installation;
156
+ - Codex plugin or skill distribution;
157
+ - remote worker transport;
158
+ - UI/workflow designer;
159
+ - cloud/team memory;
160
+ - automatic commit, publish or deployment authority.