Skip to content

Commit ad3245c

Browse files
feat: publish portable mission runtime and sync boundary (#15)
Publishes the portable mission runtime, public synchronization boundary checks, package provenance and isolated installation/package smoke coverage. All required CI and release checks passed before merge.
1 parent 1f249f2 commit ad3245c

37 files changed

Lines changed: 1783 additions & 31 deletions

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,12 @@ An explicit `--target` wins over a non-empty `OPENCODE_CONFIG_DIR`, which wins o
407407

408408
The installer inventories the payload, computes a complete plan, and tracks ownership in `TARGET/.oak/manifest.json`. A dry run performs no writes. A real operation recomputes the plan under an exclusive lock and commits through a durable journal with one rollback generation.
409409

410+
Release packages also record a safe `release_provenance` block in that manifest:
411+
the source projection commit, public commit, canonical kit version, packaged
412+
payload digest, and a passed-checks marker. Existing manifests without that
413+
optional block remain readable; the release package smoke requires it for new
414+
release evidence and never stores paths, provider settings, or credentials.
415+
410416
The root `package.json` is the canonical kit-version source. Display the same
411417
identity through the manager or any lifecycle wrapper:
412418

@@ -724,7 +730,10 @@ This runs the fast contract checker and every bundled `node:test` suite. For a
724730
fast structural check while editing documentation or contracts, use
725731
`npm run check:quick`. Before a release, use `npm run check:release`; it performs
726732
a frozen dependency install and also runs typechecking, dependency integrity,
727-
audit/signature checks, installation smoke, and the exact package smoke.
733+
audit/signature checks, installation smoke, and the exact package smoke. The
734+
package smoke extracts the tarball, recomputes the packaged OpenCode payload
735+
digest, uses an isolated `OPENCODE_CONFIG_DIR`, preserves a user configuration,
736+
and exercises `doctor` plus rollback before reporting release provenance.
728737
Publication remains separately authorized; follow the reviewed artifact and
729738
checksum procedure in [the supply-chain policy](docs/supply-chain.md).
730739

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Native tool-path benchmark
2+
3+
This benchmark measures the current dependency-free Node path before deciding
4+
whether a native Rust helper is justified. It is evidence collection, not a
5+
Rust implementation or a release blocker.
6+
7+
Run it with at least two iterations per operation:
8+
9+
```bash
10+
node scripts/benchmark-tool-paths.mjs --iterations 5 > /tmp/oak-native-benchmark.json
11+
```
12+
13+
It exercises two synthetic fixtures and, by default, this repository. Each
14+
fixture measures file listing, text search, Node parse checking, capability
15+
snapshot generation, and installation through the same manager used by the
16+
package. The report contains p50/p95 elapsed time, p50 CPU, and p95 RSS for
17+
each path. RSS is the benchmark runner's process value; child-command memory is
18+
not isolated, so the result must not be presented as a process-level peak for
19+
`node --check`.
20+
21+
## Adoption threshold
22+
23+
Keep the Node implementation unless a Rust replacement demonstrates, on both
24+
fixtures and two consecutive runs:
25+
26+
- at least 2x lower p95 latency for one material hot path;
27+
- no regression above 10% in p95 RSS or installation time;
28+
- equivalent portable behavior and failure semantics;
29+
- a reviewable multi-platform distribution and checksum plan.
30+
31+
The current repository has no Rust candidate or cross-platform artifact to
32+
compare. Until that evidence exists, adding Rust would increase distribution
33+
and supply-chain surface without a measured product benefit.

docs/sync-boundary.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Public synchronization boundary
2+
3+
This repository publishes a reviewed public projection of a fuller private
4+
harness. The public payload contains portable agents, commands, skills,
5+
contracts, tests, and read-only runtime helpers under `opencode/`, plus the
6+
installation and release tooling required to distribute them.
7+
8+
The projection is deliberately not a private checkout mirror. Provider
9+
discovery, local model assignment, credentials, authentication files, MCP
10+
servers, private endpoints, sessions, transcripts, logs, and raw runtime
11+
evidence stay outside this repository. Public files must use portable relative
12+
paths and example service URLs only.
13+
14+
<!-- projection-source-commit: 1ca607adcbae12cd16de1772662d942852b32502 -->
15+
16+
The marker above identifies the reviewed source projection for release
17+
provenance. It is a commit identity only; it does not disclose the source
18+
checkout, its providers, or its runtime evidence.
19+
20+
The source-side manifest classifies changes as `copy`, `translate`,
21+
`transform`, `exclude`, or `generated`. The private comparator verifies that
22+
classification before a change reaches this repository. This repository's
23+
`check-public-boundary.mjs` then verifies the required projection surfaces and
24+
reuses the same private-marker scan as `check.sh`.
25+
26+
The boundary check is read-only. It does not install dependencies, publish a
27+
package, create a release, or synchronize a target checkout.

opencode/commands/loop-status.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: "Consulta el estado durable de una misión sin adquirir locks ni escribir archivos."
3+
agent: lead
4+
---
5+
6+
# Estado de misión
7+
8+
Usa esta consulta para inspeccionar un loop existente sin reanudarlo ni
9+
modificarlo.
10+
11+
```bash
12+
node scripts/mission-status.mjs --root /ruta/absoluta/al/repo --slug <slug>
13+
node scripts/mission-status.mjs --root /ruta/absoluta/al/repo --slug <slug> --json
14+
```
15+
16+
La salida proyecta el snapshot canónico y el último evento validado:
17+
`status`, `iteration/planned`, último paso, causa de bloqueo, sesión, timestamp
18+
y siguiente acción segura. `--root` debe ser una ruta absoluta y `--slug` un
19+
identificador kebab-case válido.
20+
21+
Si falta el estado, el snapshot está desfasado o el historial está corrupto,
22+
detente y reporta el código durable (`state_missing`, `snapshot_stale` o
23+
`history_corrupt`). No ejecutes `resume`, `repair` ni `release` como sustituto
24+
automático.

opencode/commands/loop.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ automation.
1616
```text
1717
approval_gate: explicit_before_writes
1818
max_iterations_per_invocation: 3
19+
planned_iteration_budget: task_specific_1_to_6
20+
hard_safety_ceiling: 6
1921
completion_authority: reviewer_only
2022
canonical_review_policy: code-review-and-quality/references/review-policy.md
2123
final_review_authority: reviewer
@@ -26,6 +28,12 @@ human_view_path: .opencode/loops/<slug>.md
2628
worktree_mode: explicit_opt_in
2729
```
2830

31+
The three-iteration value limits one invocation. The persisted
32+
`planned_iteration_budget` (`planned_iterations` in canonical state) is the total budget for the mission and may not
33+
exceed the hard ceiling of six; `current_iteration` may never exceed that
34+
budget. Once the total budget is exhausted, the loop must stop as `blocked` or
35+
`completed` rather than injecting another continuation.
36+
2937
The durable `handoff_packet` (`.opencode/handoffs/<slug>.md` with
3038
`approval_status`) persists human approval to survive session restarts. `/loop`
3139
keeps `.opencode/loops/<slug>.json` as canonical state,

opencode/docs/ai/harness/agents.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ generate or modify frontmatter.
8383
- `evaluator`, `debugger`, and `evolver` are optional sidecars.
8484
- `evolver` works only on the OpenCode harness.
8585

86+
## Mission runtime projection
87+
88+
`mission-status` is a read-only view over the durable loop snapshot and
89+
append-only history. It validates canonical state before displaying progress
90+
and never becomes a second authority. The runtime observer is ephemeral; it
91+
may report activity, but durable transitions still require the loop state
92+
runtime and its locks.
93+
8694
## Bounded local autonomy
8795

8896
`/autonomous` uses one explicit user invocation for a local objective, not a

opencode/docs/ai/harness/checks.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ Slice 2.4 adds durable structured state for `/loop`. Run its focused tests with:
6464
node --test scripts/loop-state.test.mjs
6565
```
6666

67+
The mission runtime projection is read-only: `mission-status.mjs` validates
68+
the canonical snapshot and history, while `mission-runtime` observes ephemeral
69+
events without writing an alternative state. The Open Design boundary requires
70+
`OPEN_DESIGN_URL` to be a base URL and rejects project or file URLs; the checker
71+
also rejects private endpoints and UUID-specific crypto dependencies.
72+
6773
The dependency-free runtime maintains a JSON snapshot, append-only JSONL
6874
history, and exclusive lock. Tests cover crash recovery, same-session
6975
contention, symlink boundaries, journal continuity, migration, and explicit

opencode/docs/ai/harness/commands.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ Criteria:
174174
- No auto-merge, scheduling, write-enabled MCP connectors, parallel execution,
175175
or implicit worktree creation.
176176

177+
## `/loop-status`
178+
179+
Contract: `lead` read-only projection.
180+
181+
`/loop-status --slug <slug>` inspects the canonical snapshot and append-only
182+
history without acquiring a write lock or changing files. Use
183+
`node scripts/mission-status.mjs --root /absolute/repository --slug <slug>`
184+
when an explicit repository root is needed. If state is missing, stale, or
185+
corrupt, report the durable error and do not repair or resume automatically.
186+
177187
## `/autonomous`
178188

179189
Contract: explicit invocation -> `developer -> reviewer -> developer (state sync)`.

opencode/docs/ai/harness/orchestration-contracts.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@
210210
"subtask": false,
211211
"workflow": "loop"
212212
},
213+
{
214+
"id": "loop-status",
215+
"root_agent": "lead",
216+
"subtask": false,
217+
"workflow": "loop"
218+
},
213219
{
214220
"id": "mvp-spec",
215221
"root_agent": "scoper",
@@ -643,7 +649,8 @@
643649
{
644650
"id": "loop",
645651
"entrypoints": [
646-
"loop"
652+
"loop",
653+
"loop-status"
647654
],
648655
"stages": [
649656
{
@@ -908,6 +915,7 @@
908915
"implement",
909916
"init",
910917
"loop",
918+
"loop-status",
911919
"mvp-spec",
912920
"plan",
913921
"research",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "Proyección runtime de misión"
3+
status: proposed
4+
date: 2026-08-21
5+
feature: mission-runtime
6+
---
7+
8+
# Runtime de misión
9+
10+
## Autoridad
11+
12+
`scripts/loop-state.mjs` es la única autoridad de ejecución. El snapshot
13+
`.opencode/loops/<slug>.json` y su historial append-only
14+
`.opencode/loops/<slug>.history.jsonl` se leen y validan; la proyección nunca
15+
los modifica ni mantiene un segundo estado durable.
16+
17+
## Proyección read-only
18+
19+
`mission-status.mjs` expone `slug`, `status`, `current_iteration`,
20+
`planned_iterations`, `last_completed_step`, `blocking_cause`, `session_id`,
21+
`updated_at` y `next_action`. `session_id` usa el lease activo cuando existe y
22+
el último session id canónico en caso contrario. `updated_at` procede del último
23+
evento validado del historial.
24+
25+
Los estados canónicos son `approved`, `running`, `paused`, `blocked` y
26+
`completed`. La proyección no inventa transiciones: si el snapshot está
27+
desfasado o el historial está corrupto, devuelve el error durable de
28+
`loop-state`.
29+
30+
## Observación de eventos
31+
32+
El observador opcional usa únicamente eventos que el SDK local expone:
33+
`session.created`, `session.status`, `tool.execute.before`,
34+
`tool.execute.after`, `session.compacted`, `session.error` y `session.idle`.
35+
La actividad derivada (`running`, `idle` o `blocked`) es efímera y nunca
36+
sustituye al `status` canónico.
37+
38+
Las sesiones con `parentID` distinto de la sesión raíz se ignoran. Los eventos
39+
duplicados se descartan por una clave efímera de sesión, tipo y payload; perder
40+
esa deduplicación al reiniciar no altera el snapshot ni el historial.
41+
42+
La compaction conserva el session id. Un error de notificación no bloquea el
43+
loop ni se convierte en una transición durable. Las transiciones reales siguen
44+
requiriendo `loop-state.mjs` y sus locks, hashes, `action_id` y presupuesto.

0 commit comments

Comments
 (0)