opencode-agent-orchestration-kit 1.0.33 → 1.0.37

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 (63) hide show
  1. package/README.md +41 -3
  2. package/docs/cli.md +31 -3
  3. package/docs/releases/v1.0.34.md +59 -0
  4. package/docs/releases/v1.0.35.md +62 -0
  5. package/docs/releases/v1.0.36.md +58 -0
  6. package/docs/releases/v1.0.37.md +53 -0
  7. package/docs/supply-chain.md +2 -2
  8. package/opencode/agents/lead.md +11 -2
  9. package/opencode/agents/review_api.md +26 -9
  10. package/opencode/agents/review_coordinator.md +60 -68
  11. package/opencode/agents/review_quality.md +27 -11
  12. package/opencode/agents/review_security.md +26 -10
  13. package/opencode/agents/review_tests.md +26 -9
  14. package/opencode/agents/reviewer.md +95 -80
  15. package/opencode/commands/autonomous.md +75 -0
  16. package/opencode/commands/evolve.md +3 -1
  17. package/opencode/commands/feature.md +6 -2
  18. package/opencode/commands/loop.md +12 -8
  19. package/opencode/commands/review-orchestrated.md +26 -24
  20. package/opencode/commands/review-preflight.md +8 -7
  21. package/opencode/commands/review.md +27 -10
  22. package/opencode/docs/ai/harness/README.md +3 -0
  23. package/opencode/docs/ai/harness/agents.md +20 -3
  24. package/opencode/docs/ai/harness/checks.md +9 -0
  25. package/opencode/docs/ai/harness/commands.md +36 -0
  26. package/opencode/docs/ai/harness/orchestrated-review.md +8 -1
  27. package/opencode/docs/ai/harness/orchestration-contracts.json +34 -1
  28. package/opencode/package-lock.json +3 -3
  29. package/opencode/package.json +1 -1
  30. package/opencode/plugins/shell-export-guard.ts +23 -0
  31. package/opencode/scripts/adversarial-harness.test.mjs +5 -2
  32. package/opencode/scripts/check-harness.mjs +241 -10
  33. package/opencode/scripts/check-harness.test.mjs +190 -8
  34. package/opencode/scripts/loop-state.mjs +88 -14
  35. package/opencode/scripts/loop-state.test.mjs +82 -5
  36. package/opencode/scripts/review-orchestrated-prepare.mjs +18 -1
  37. package/opencode/scripts/review-orchestrated-prepare.test.mjs +49 -0
  38. package/opencode/scripts/shell-export-policy.d.mts +4 -0
  39. package/opencode/scripts/shell-export-policy.mjs +272 -0
  40. package/opencode/scripts/shell-export-policy.test.mjs +96 -0
  41. package/opencode/skills/code-review-and-quality/SKILL.md +63 -321
  42. package/opencode/skills/code-review-and-quality/references/profiles/backend-clean-ddd-cqrs.md +60 -0
  43. package/opencode/skills/code-review-and-quality/references/profiles/backend.md +54 -0
  44. package/opencode/skills/code-review-and-quality/references/profiles/frontend-clean-layered.md +60 -0
  45. package/opencode/skills/code-review-and-quality/references/profiles/frontend.md +62 -0
  46. package/opencode/skills/code-review-and-quality/references/review-policy.md +258 -0
  47. package/package.json +2 -2
  48. package/scripts/check-supply-chain.mjs +5 -1
  49. package/scripts/check-supply-chain.test.mjs +10 -6
  50. package/scripts/check.sh +6 -2
  51. package/scripts/oak.mjs +47 -1
  52. package/scripts/oak.test.mjs +53 -1
  53. package/scripts/package-smoke.test.mjs +2 -2
  54. package/scripts/version.test.mjs +2 -2
  55. package/supply-chain.json +1 -1
  56. package/docker/open-design/data/app.sqlite +0 -0
  57. package/docker/open-design/data/app.sqlite-shm +0 -0
  58. package/docker/open-design/data/app.sqlite-wal +0 -0
  59. package/docker/open-design/opencode-auth/log/2026-05-02T105802.log +0 -17
  60. package/docker/open-design/opencode-auth/log/2026-05-04T102127.log +0 -16
  61. package/docker/open-design/opencode-auth/opencode.db +0 -0
  62. package/docker/open-design/opencode-auth/opencode.db-shm +0 -0
  63. package/docker/open-design/opencode-auth/opencode.db-wal +0 -0
@@ -1,18 +1,35 @@
1
1
  ---
2
- description: Review the current diff against the active task or spec.
2
+ description: Run the final read-only review of the current task or diff.
3
3
  agent: reviewer
4
- subtask: true
4
+ subtask: false
5
5
  ---
6
6
 
7
+ Review the current diff and task against original evidence. Use `git diff` as
8
+ primary change evidence.
7
9
 
8
- Review the current diff against the active task or spec.
10
+ User arguments:
9
11
 
10
- Use:
12
+ $ARGUMENTS
11
13
 
12
- - `git status`
13
- - `git diff`
14
- - repository docs if present
15
- - specs or tasks if present
16
- - AHE evidence only if the diff changes agents, commands, skills, tools, or workflows
14
+ ```text
15
+ canonical_policy: required
16
+ review_stage: final
17
+ final_verdict_authority: reviewer
18
+ ```
17
19
 
18
- Return verdict, issues by severity, acceptance criteria coverage, validation reviewed, AHE state if applicable, and final recommendation. If changes are required, provide a concrete handoff for lead/developer.
20
+ Load `code-review-and-quality` and apply its canonical policy. Core review is
21
+ always required. Select generic backend/frontend profiles from the changed
22
+ surface. Apply strict Clean Architecture, DDD, hexagonal, CQRS, or layered
23
+ profiles only when explicitly declared by the task or repository.
24
+
25
+ Inspect `git status`, the diff, applicable instructions, task/specification,
26
+ and original validation evidence. The developer summary is context, not
27
+ evidence. Do not modify files.
28
+
29
+ Only introduced or worsened problems may block. Report relevant pre-existing
30
+ debt separately as non-blocking observations.
31
+
32
+ Return the canonical final envelope with `review_stage: final`, a verdict,
33
+ profile resolution, findings with causality, acceptance-criteria coverage,
34
+ validation rerun or `not_run`, residual risks, and a bounded correction
35
+ handoff when required.
@@ -22,6 +22,9 @@ here.
22
22
  - A repeated or fragile rule should become a mechanical check.
23
23
  - Harness changes need evidence proportional to risk.
24
24
  - Sidecars add observability, not mandatory bureaucracy.
25
+ - Shell hooks are defense in depth: `shell-export-guard` blocks only
26
+ high-signal secret enumeration and propagation, keeps ordinary setup allowed,
27
+ and never substitutes for a sandbox.
25
28
 
26
29
  ## Done Criteria
27
30
 
@@ -16,8 +16,8 @@ generate or modify frontmatter.
16
16
  | `designer` | UX/UI, brand, layout, interaction, or Open Design matters | Technical change has no visual impact | Visual handoff with observable criteria |
17
17
  | `researcher` | Technical/product uncertainty, APIs, libraries, risks | Fact is already clear in repo | Sources reviewed and unknowns remaining |
18
18
  | `specifier` | There is enough context to turn goal into tasks | Critical research/design is pending | Acceptance criteria and validation plan |
19
- | `reviewer` | A diff, implementation, or `/plan` artifact exists | There is no reviewable change or planning artifact | Findings by severity or explicit approval |
20
- | `review_coordinator` | `/review-orchestrated` is invoked; runs as a primary session | The regular inexpensive `/review` is wanted | Manifest, reviewer states, and deduplicated final review |
19
+ | `reviewer` | A diff, implementation, or `/plan` artifact exists | There is no reviewable change or planning artifact | Final canonical verdict with causal findings and evidence |
20
+ | `review_coordinator` | `/review-orchestrated` is invoked; runs as a primary session | A final integral verdict is required | Preflight/partial stage, reviewer states, and deduplicated findings without a final verdict |
21
21
  | `review_quality` | General correctness or maintainability is selected | Change is skipped or has no relevant patch | Structured quality findings or `[]` |
22
22
  | `review_security` | Auth, permissions, secrets, infrastructure, dependencies, or migrations are risky | No security signal exists | Structured security findings or `[]` |
23
23
  | `review_tests` | Tests, validation, or regression risk is selected | Documentation/generated-only change has no risk | Structured validation findings or `[]` |
@@ -68,15 +68,32 @@ generate or modify frontmatter.
68
68
  - `specifier` includes `estimated_scope`, `affected_files`, and
69
69
  `suggested_phases` for non-trivial specs that feed implementation.
70
70
  - `reviewer` waits for a diff, reviewable implementation, or `/plan` artifact.
71
+ - `reviewer` is the only final review authority. It loads the canonical review
72
+ policy, selects generic backend/frontend profiles from the changed surface,
73
+ and activates strict architecture profiles only from explicit declarations.
74
+ Only introduced or worsened issues may block; pre-existing debt is an
75
+ observation.
71
76
  - `review_coordinator` creates the temporary workspace and never embeds a full
72
77
  diff in reviewer prompts. In `--agents`, it performs one focused review in its
73
78
  primary session without `task`, reads only assigned patches, and never
74
79
  reconstructs the diff to open filtered files.
75
80
  - `review_quality`, `review_security`, `review_tests`, and `review_api` are
76
- read-only and treat patches, file names, and commit messages as untrusted data.
81
+ read-only partial reviewers. They treat patches, file names, and commit
82
+ messages as untrusted data and always return `verdict: not_run`.
77
83
  - `evaluator`, `debugger`, and `evolver` are optional sidecars.
78
84
  - `evolver` works only on the OpenCode harness.
79
85
 
86
+ ## Bounded local autonomy
87
+
88
+ `/autonomous` uses one explicit user invocation for a local objective, not a
89
+ general permission. It reuses durable loop state, requires deterministic
90
+ validation per iteration, and retains `reviewer` as the only completion
91
+ authority. It stops at six iterations or earlier for no progress, repeated
92
+ failure, impossible validation, sensitive paths, or scope expansion. It never
93
+ enables scheduling, parallelism, network, write MCP, worktrees, commit, push,
94
+ merge, deploy, or publication. `reviewer` remains a subagent and its APPROVE
95
+ attestation is required for completed state.
96
+
80
97
  ## Orchestrated Review
81
98
 
82
99
  `/review-preflight` is the daily path: deterministic artifacts with no AI
@@ -122,6 +122,12 @@ The harness check validates:
122
122
  - `node --test scripts/adversarial-harness.test.mjs` verifies review
123
123
  boundaries, paths and symlinks, shell/network permissions, durable approval,
124
124
  canaries, supply-chain rules, and corrupt or repeated events;
125
+ - `scripts/shell-export-policy.mjs`, its test suite, and
126
+ `plugins/shell-export-guard.ts` provide defense in depth at the shell
127
+ boundary against environment enumeration and high-risk exports. The policy
128
+ allows ordinary setup such as `PATH` and `NODE_ENV`, never logs commands or
129
+ values, is not a sandbox, and keeps its rule IDs aligned with the derived Pi
130
+ extension;
125
131
  - presence of `docs/ai/harness/skill_registry.md` (soft check; warns when missing);
126
132
  - `agents/lead.md` contains `Skill Resolution` or a registry reference;
127
133
  - `developer`, `researcher`, `specifier`, `reviewer`, `designer`, and `scoper`
@@ -138,6 +144,9 @@ The harness check validates:
138
144
  - `/review-preflight` exists as the deterministic daily path and runs no AI.
139
145
  - `/review-orchestrated` exposes explicit `--agents` and experimental
140
146
  `--full-agents` modes without changing `/review`.
147
+ - The canonical review policy and backend/frontend profiles are present;
148
+ strict architecture profiles require explicit declaration, partial reviews
149
+ cannot pass, and only introduced or worsened findings may block.
141
150
  - The orchestrated-review contract covers the temporary workspace,
142
151
  anti-injection boundary, classification, budgets, filtered lockfiles and
143
152
  generated files, timeout, partial failure, cleanup/retention, and deferred
@@ -174,6 +174,27 @@ Criteria:
174
174
  - No auto-merge, scheduling, write-enabled MCP connectors, parallel execution,
175
175
  or implicit worktree creation.
176
176
 
177
+ ## `/autonomous`
178
+
179
+ Contract: explicit invocation -> `developer -> reviewer -> developer (state sync)`.
180
+
181
+ `/autonomous <objective>` authorizes one local task without another human gate
182
+ per iteration. It requires durable state, deterministic validation, new evidence
183
+ for retries, and reviewer-only closure. Before starting, `lead` sets a
184
+ task-specific planned iteration budget from 1 to 6; six remains the hard safety
185
+ ceiling rather than a target. Final reviewer approval stops the cycle
186
+ immediately. An explicit schema migration requires renewed human approval
187
+ before `oak state resume`; earlier approval cannot be reused. It permits at
188
+ most the planned iteration budget and stops on success, no progress, repeated failure, impossible validation, budget,
189
+ protected changes, scope expansion, or sensitive paths. It forbids scheduling,
190
+ parallelism, worktrees, network, write MCP, commit, push, merge, deploy, and
191
+ publication; `/loop` retains its human gate and three-iteration bound.
192
+
193
+ Use installed `oak state --root .` so consumer repositories do not need to
194
+ contain the runtime. `lead` invokes `reviewer` only as a `task` subagent. A
195
+ durable reviewer session-id/identity/`APPROVE` attestation is required before
196
+ the loop can record `completed`; `opencode run --agent reviewer` is not valid.
197
+
177
198
  ## `/mvp-spec`
178
199
 
179
200
  Contract: `scoper -> researcher -> scoper synthesis -> specifier`.
@@ -343,6 +364,15 @@ Criteria:
343
364
 
344
365
  Contract: `reviewer`.
345
366
 
367
+ - Runs read-only as a direct command and returns `review_stage: final`.
368
+ - Uses the canonical core policy plus generic backend/frontend profiles that
369
+ match the changed surface.
370
+ - Strict Clean/DDD/hexagonal/CQRS or layered profiles require an explicit task
371
+ or repository declaration; directory layout is not sufficient evidence.
372
+ - Only introduced or worsened defects can block. Pre-existing debt is reported
373
+ as a non-blocking observation.
374
+ - The real diff and original evidence are primary; a developer summary is not.
375
+
346
376
  Criteria:
347
377
 
348
378
  - Review `git diff`, active spec, and available evidence.
@@ -358,6 +388,7 @@ Criteria:
358
388
  - Creates `manifest.json`, `shared-review-context.md`, `patches/`, and
359
389
  `findings/` with `scripts/review-orchestrated-prepare.mjs`.
360
390
  - Runs no AI reviewer or subagent and never claims that AI review occurred.
391
+ - Returns `review_stage: preflight` and `verdict: not_run`.
361
392
  - Reports level, risk flags, considered and filtered files, recommended
362
393
  reviewers, budgets, and workspace state.
363
394
  - `--retain` preserves artifacts; otherwise the workspace is cleaned.
@@ -367,6 +398,11 @@ Criteria:
367
398
  Contract: opt-in `review_coordinator`. It does not replace or make `/review`
368
399
  more expensive.
369
400
 
401
+ This flow is evidence preparation and partial analysis only. Preflight returns
402
+ `review_stage: preflight`; AI modes return `review_stage: partial`; every mode
403
+ returns `verdict: not_run`. Only the general `reviewer` may issue a final
404
+ verdict.
405
+
370
406
  Criteria:
371
407
 
372
408
  - Default and `--dry-run` behavior is preflight only.
@@ -2,7 +2,14 @@
2
2
 
3
3
  `/review-preflight` and `/review-orchestrated` provide a local, opt-in,
4
4
  versionable flow for deterministic diff preparation and optional AI review.
5
- They do not replace `/review` or change its inexpensive existing contract.
5
+ They do not replace `/review` or its final-review authority.
6
+
7
+ The canonical stage contract is explicit: deterministic preparation emits
8
+ `review_stage: preflight`; optional focused analysis emits
9
+ `review_stage: partial`; both emit `verdict: not_run`. Only the general
10
+ `reviewer` can consolidate the real diff and original evidence into a final
11
+ verdict. Specialist findings follow the same causality policy: only introduced
12
+ or worsened problems may block, while pre-existing debt is observational.
6
13
 
7
14
  The recommended daily path is `/review-preflight`: it creates inspectable
8
15
  artifacts and summarizes risk without running AI reviewers. Here,
@@ -162,6 +162,12 @@
162
162
  }
163
163
  ],
164
164
  "commands": [
165
+ {
166
+ "id": "autonomous",
167
+ "root_agent": "lead",
168
+ "subtask": false,
169
+ "workflow": "autonomous"
170
+ },
165
171
  {
166
172
  "id": "code-simplify",
167
173
  "root_agent": "developer",
@@ -225,7 +231,7 @@
225
231
  {
226
232
  "id": "review",
227
233
  "root_agent": "reviewer",
228
- "subtask": true,
234
+ "subtask": false,
229
235
  "workflow": "direct-review"
230
236
  },
231
237
  {
@@ -292,6 +298,13 @@
292
298
  }
293
299
  ],
294
300
  "retry_policies": [
301
+ {
302
+ "id": "autonomous-iterations",
303
+ "scope": "autonomous",
304
+ "max_attempts": 6,
305
+ "requires_new_evidence": true,
306
+ "on_exhaustion": "block"
307
+ },
295
308
  {
296
309
  "id": "developer-default",
297
310
  "scope": "developer",
@@ -315,6 +328,24 @@
315
328
  }
316
329
  ],
317
330
  "workflows": [
331
+ {
332
+ "id": "autonomous",
333
+ "entrypoints": ["autonomous"],
334
+ "stages": [
335
+ {"agent": "lead", "requirement": "required"},
336
+ {"agent": "developer", "requirement": "required"},
337
+ {"agent": "reviewer", "requirement": "required"},
338
+ {"agent": "developer", "requirement": "state-sync"}
339
+ ],
340
+ "barriers": [
341
+ {"id": "diff-before-review", "before_stage": 2, "authority": "developer", "condition": "diff-reviewable"},
342
+ {"id": "review-before-state-sync", "before_stage": 3, "authority": "reviewer", "condition": "review-approved"}
343
+ ],
344
+ "retry_policy": "autonomous-iterations",
345
+ "completion_authority": {"kind": "agent", "agent": "reviewer"},
346
+ "required_evidence": ["static_contract", "transcript_replay"],
347
+ "adaptive": false
348
+ },
318
349
  {
319
350
  "id": "design",
320
351
  "entrypoints": [
@@ -827,6 +858,7 @@
827
858
  "specifier"
828
859
  ],
829
860
  "command_ids": [
861
+ "autonomous",
830
862
  "code-simplify",
831
863
  "design",
832
864
  "evolve",
@@ -868,6 +900,7 @@
868
900
  "specifier"
869
901
  ],
870
902
  "command_ids": [
903
+ "autonomous",
871
904
  "code-simplify",
872
905
  "design",
873
906
  "evolve",
@@ -794,9 +794,9 @@
794
794
  }
795
795
  },
796
796
  "node_modules/brace-expansion": {
797
- "version": "5.0.8",
798
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
799
- "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
797
+ "version": "5.0.9",
798
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
799
+ "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
800
800
  "license": "MIT",
801
801
  "dependencies": {
802
802
  "balanced-match": "^4.0.2"
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "overrides": {
12
12
  "@babel/core": "7.29.7",
13
- "brace-expansion": "5.0.8",
13
+ "brace-expansion": "5.0.9",
14
14
  "uuid": "14.0.0"
15
15
  }
16
16
  }
@@ -0,0 +1,23 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ import { classifyShellExport } from "../scripts/shell-export-policy.mjs";
3
+
4
+ const BLOCK_MESSAGE =
5
+ "Sensitive shell export blocked by policy; use an explicit non-secret value or a scoped secret-aware tool.";
6
+
7
+ export const ShellExportGuardPlugin: Plugin = async () => ({
8
+ "tool.execute.before": async (input, output) => {
9
+ const tool = String(input?.tool ?? "").toLowerCase();
10
+ if (tool !== "bash" && tool !== "shell") return;
11
+
12
+ const args = output?.args;
13
+ if (!args || typeof args !== "object") return;
14
+
15
+ const command = (args as Record<string, unknown>).command;
16
+ if (typeof command !== "string") return;
17
+
18
+ const decision = classifyShellExport(command);
19
+ if (decision.blocked) {
20
+ throw new Error(`[shell-export-guard:${decision.rule}] ${BLOCK_MESSAGE}`);
21
+ }
22
+ },
23
+ });
@@ -79,6 +79,7 @@ function initializeLoop(rootDir) {
79
79
  gitBaseline: "abc123",
80
80
  sessionId: "session-1",
81
81
  actionId: "approve-1",
82
+ plannedIterations: 1,
82
83
  });
83
84
  return contractPath;
84
85
  }
@@ -141,6 +142,7 @@ const handlers = {
141
142
  gitBaseline: "abc123",
142
143
  sessionId: "session-1",
143
144
  actionId: "approve-1",
145
+ plannedIterations: 1,
144
146
  }),
145
147
  (error) => error instanceof LoopStateError && error.code === "unsafe_path",
146
148
  );
@@ -159,8 +161,9 @@ const handlers = {
159
161
  slug: "../escape",
160
162
  contractPath,
161
163
  gitBaseline: "abc123",
162
- sessionId: "session-1",
163
- actionId: "approve-1",
164
+ sessionId: "session-1",
165
+ actionId: "approve-1",
166
+ plannedIterations: 1,
164
167
  }),
165
168
  (error) => error instanceof LoopStateError && error.code === "invalid_argument",
166
169
  );