opencode-agent-orchestration-kit 1.0.32 → 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 (88) hide show
  1. package/README.md +73 -4
  2. package/SECURITY.md +7 -0
  3. package/docs/cli.md +100 -0
  4. package/docs/installation.md +25 -5
  5. package/docs/quickstart.md +1 -1
  6. package/docs/releases/v1.0.33.md +72 -0
  7. package/docs/releases/v1.0.34.md +59 -0
  8. package/docs/releases/v1.0.35.md +62 -0
  9. package/docs/releases/v1.0.36.md +58 -0
  10. package/docs/releases/v1.0.37.md +53 -0
  11. package/docs/security.md +4 -0
  12. package/docs/supply-chain.md +9 -5
  13. package/docs/threat-model.md +244 -0
  14. package/docs/use-cases/README.md +31 -0
  15. package/docs/use-cases/direct-label-change/README.md +76 -0
  16. package/docs/use-cases/direct-label-change/before/package.json +8 -0
  17. package/docs/use-cases/direct-label-change/before/src/settings-label.mjs +1 -0
  18. package/docs/use-cases/direct-label-change/before/test/settings-label.test.mjs +8 -0
  19. package/docs/use-cases/direct-label-change/case.json +118 -0
  20. package/docs/use-cases/direct-label-change/expected/package.json +8 -0
  21. package/docs/use-cases/direct-label-change/expected/src/settings-label.mjs +1 -0
  22. package/docs/use-cases/direct-label-change/expected/test/settings-label.test.mjs +8 -0
  23. package/docs/use-cases/feature-tag-normalizer/README.md +78 -0
  24. package/docs/use-cases/feature-tag-normalizer/before/package.json +8 -0
  25. package/docs/use-cases/feature-tag-normalizer/before/src/normalize-tags.mjs +3 -0
  26. package/docs/use-cases/feature-tag-normalizer/before/test/normalize-tags.test.mjs +13 -0
  27. package/docs/use-cases/feature-tag-normalizer/case.json +119 -0
  28. package/docs/use-cases/feature-tag-normalizer/expected/package.json +8 -0
  29. package/docs/use-cases/feature-tag-normalizer/expected/src/normalize-tags.mjs +14 -0
  30. package/docs/use-cases/feature-tag-normalizer/expected/test/normalize-tags.test.mjs +18 -0
  31. package/docs/workflows.md +6 -0
  32. package/opencode/agents/lead.md +11 -2
  33. package/opencode/agents/review_api.md +26 -9
  34. package/opencode/agents/review_coordinator.md +60 -68
  35. package/opencode/agents/review_quality.md +27 -11
  36. package/opencode/agents/review_security.md +26 -10
  37. package/opencode/agents/review_tests.md +26 -9
  38. package/opencode/agents/reviewer.md +95 -80
  39. package/opencode/commands/autonomous.md +75 -0
  40. package/opencode/commands/evolve.md +3 -1
  41. package/opencode/commands/feature.md +6 -2
  42. package/opencode/commands/loop.md +12 -8
  43. package/opencode/commands/review-orchestrated.md +26 -24
  44. package/opencode/commands/review-preflight.md +8 -7
  45. package/opencode/commands/review.md +27 -10
  46. package/opencode/docs/ai/harness/README.md +5 -0
  47. package/opencode/docs/ai/harness/agents.md +27 -3
  48. package/opencode/docs/ai/harness/checks.md +18 -0
  49. package/opencode/docs/ai/harness/commands.md +44 -0
  50. package/opencode/docs/ai/harness/orchestrated-review.md +8 -1
  51. package/opencode/docs/ai/harness/orchestration-contracts.json +924 -0
  52. package/opencode/package-lock.json +14 -8
  53. package/opencode/package.json +1 -0
  54. package/opencode/plugins/shell-export-guard.ts +23 -0
  55. package/opencode/scripts/adversarial-harness.test.mjs +5 -2
  56. package/opencode/scripts/check-harness.mjs +873 -18
  57. package/opencode/scripts/check-harness.test.mjs +562 -0
  58. package/opencode/scripts/loop-state.mjs +88 -14
  59. package/opencode/scripts/loop-state.test.mjs +82 -5
  60. package/opencode/scripts/review-orchestrated-prepare.mjs +18 -1
  61. package/opencode/scripts/review-orchestrated-prepare.test.mjs +49 -0
  62. package/opencode/scripts/shell-export-policy.d.mts +4 -0
  63. package/opencode/scripts/shell-export-policy.mjs +272 -0
  64. package/opencode/scripts/shell-export-policy.test.mjs +96 -0
  65. package/opencode/skills/code-review-and-quality/SKILL.md +63 -321
  66. package/opencode/skills/code-review-and-quality/references/profiles/backend-clean-ddd-cqrs.md +60 -0
  67. package/opencode/skills/code-review-and-quality/references/profiles/backend.md +54 -0
  68. package/opencode/skills/code-review-and-quality/references/profiles/frontend-clean-layered.md +60 -0
  69. package/opencode/skills/code-review-and-quality/references/profiles/frontend.md +62 -0
  70. package/opencode/skills/code-review-and-quality/references/review-policy.md +258 -0
  71. package/package.json +5 -2
  72. package/scripts/check-supply-chain.mjs +16 -2
  73. package/scripts/check-supply-chain.test.mjs +52 -1
  74. package/scripts/check-threat-model.mjs +421 -0
  75. package/scripts/check-threat-model.test.mjs +304 -0
  76. package/scripts/check-use-cases.mjs +501 -0
  77. package/scripts/check-use-cases.test.mjs +225 -0
  78. package/scripts/check.sh +55 -1
  79. package/scripts/install-smoke.sh +24 -1
  80. package/scripts/manage-installation.mjs +567 -25
  81. package/scripts/manage-installation.test.mjs +418 -0
  82. package/scripts/oak.mjs +246 -0
  83. package/scripts/oak.test.mjs +329 -0
  84. package/scripts/package-smoke.mjs +57 -0
  85. package/scripts/package-smoke.test.mjs +75 -2
  86. package/scripts/version.mjs +1 -0
  87. package/scripts/version.test.mjs +3 -2
  88. package/supply-chain.json +1 -0
@@ -0,0 +1,244 @@
1
+ # Threat Model
2
+
3
+ This is the canonical threat model for the public OpenCode Agent Orchestration
4
+ Kit. It inventories the assets and boundaries that the kit can affect, the
5
+ capabilities it declares, representative abuse cases, the controls that exist
6
+ today, and the risk that remains.
7
+
8
+ The model describes observed public contracts. OpenCode permission frontmatter
9
+ is a policy layer enforced by the OpenCode runtime; it is not an
10
+ operating-system sandbox. A test proves only the behavior and scope named by
11
+ that test.
12
+
13
+ Markdown is the sole source of truth. The tables below use stable IDs so
14
+ `scripts/check-threat-model.mjs` can detect structural drift without generating
15
+ or rewriting this document.
16
+
17
+ ## Scope and security objectives
18
+
19
+ The modeled system includes the published package, its lifecycle scripts, the
20
+ portable OpenCode harness under `opencode/`, its agents and commands, durable
21
+ loop and handoff contracts, review preparation, AHE evidence handling, optional
22
+ plugins, Open Design, package checks, and the boundary used to prepare public
23
+ releases.
24
+
25
+ The principal objectives are:
26
+
27
+ - preserve human authorization for sensitive effects;
28
+ - protect workspace, configuration, state, evidence, and package integrity;
29
+ - keep private material out of public or network-facing surfaces;
30
+ - contain filesystem and tool effects to their declared scope;
31
+ - make important controls traceable to a test, check, or explicit limitation;
32
+ - keep managed mutations recoverable and resource use bounded where supported.
33
+
34
+ OpenCode, Node.js, Git, the operating system, and the authentic sources used to
35
+ verify pins, checksums, and signatures are part of the trusted computing base.
36
+ Their internal security is outside this kit's guarantees. Repository content,
37
+ external services, tool output, models, memory, and plugins are untrusted
38
+ inputs.
39
+
40
+ ## Actors
41
+
42
+ | ID | Actor | Trust | Capabilities |
43
+ |---|---|---|---|
44
+ | AC-001 | Authorized operator or maintainer | Trusted only within the authority explicitly granted | Starts commands, approves gates, selects targets, accepts residual risk, and authorizes publication |
45
+ | AC-002 | Repository contributor or repository-controlled content | Untrusted | Controls source, diffs, documentation, filenames, links, and patches read by agents |
46
+ | AC-003 | Dependency, action, executable reference, or plugin | Untrusted until pinned and reviewed | Can execute code during installation, checks, CI, or agent runtime |
47
+ | AC-004 | Registry, Git host, MCP, model, tool, or remote service | External and untrusted | Returns artifacts, data, instructions, or failures across a network or tool boundary |
48
+ | AC-005 | Untrusted local process | Untrusted | Can race filesystem operations, replace paths, create symlinks, or contend for locks |
49
+ | AC-006 | Accidental operator | Partially trusted | Can select the wrong target, approve the wrong scope, omit checks, or publish the wrong artifact |
50
+
51
+ ## Assets
52
+
53
+ | ID | Asset | Protection |
54
+ |---|---|---|
55
+ | A-001 | Operator intent and approval | Integrity, authenticity, and durable attribution |
56
+ | A-002 | User workspace and source files | Integrity, availability, and path containment |
57
+ | A-003 | Private configuration, secrets, credentials, and provider data | Confidentiality and integrity |
58
+ | A-004 | Agent permissions, routing, delegation, and workflow contracts | Integrity and traceability |
59
+ | A-005 | Handoffs, approvals, loop snapshots, histories, and locks | Integrity, authenticity, and recoverability |
60
+ | A-006 | Installation manifest, journal, backups, ownership, and rollback state | Integrity, confidentiality, and recoverability |
61
+ | A-007 | Review, evaluation, and AHE evidence | Integrity, confidentiality, and provenance |
62
+ | A-008 | Package contents, pins, checksums, tags, and release artifacts | Integrity, authenticity, and reproducibility |
63
+ | A-009 | Sessions, logs, plugin state, and runtime state | Confidentiality, integrity, and availability |
64
+ | A-010 | Boundary between private preparation and public publication | Confidentiality and data minimization |
65
+
66
+ ## Trust boundaries
67
+
68
+ | ID | Boundary | Flow |
69
+ |---|---|---|
70
+ | TB-001 | Human to agent and HITL state | Requests, approvals, rejections, and authority enter the agent workflow |
71
+ | TB-002 | Repository content to instruction context | Diffs, documents, source, filenames, and patches enter prompts and reviews |
72
+ | TB-003 | Agent to tool, filesystem, shell, network, and delegated task | A model decision can become a local or external effect |
73
+ | TB-004 | Public package to installed target | Versioned package files can mutate a local installation |
74
+ | TB-005 | Managed source to user-owned target files | Lifecycle ownership rules decide whether existing files are preserved or replaced |
75
+ | TB-006 | Local runtime to registry, Git, plugin, MCP, model, web, or Open Design | Data and executable material cross an external-service boundary |
76
+ | TB-007 | Raw session or evidence to sanitized artifact | Potentially private data is reduced for checks, reports, or publication |
77
+ | TB-008 | Private preparation to public sync and release | Only portable reviewed material may enter the public repository or package |
78
+ | TB-009 | Temporary workspace or process state to persistent filesystem | Reviews, journals, locks, backups, histories, sessions, and caches can survive a process |
79
+
80
+ ## Agent capabilities
81
+
82
+ The executable source for each row is the corresponding frontmatter file. Shell
83
+ summaries name the default and important exceptions rather than duplicating
84
+ every glob. Network combines `webfetch` and `websearch`.
85
+
86
+ | Agent | Edit | Shell | Network | External directory | Delegation | Role | Source |
87
+ |---|---|---|---|---|---|---|---|
88
+ | debugger | Deny except `docs/ai/evolution/**` | Ask by default; Git status, diff, and log allowed | Allow | Deny | None | Optional trace and root-cause sidecar | opencode/agents/debugger.md |
89
+ | designer | Ask | Ask by default; navigation allowed | Allow | Deny | None | UX, visual design, and Open Design handoff | opencode/agents/designer.md |
90
+ | developer | Allow | Ask by default; declared test, lint, typecheck, and Git inspection commands allowed | Ask | Deny | None | Approved implementation and validation | opencode/agents/developer.md |
91
+ | evaluator | Deny except `docs/ai/evolution/**` | Ask by default; declared evaluation and validation commands allowed | Ask | Deny | None | Optional benchmark and smoke sidecar | opencode/agents/evaluator.md |
92
+ | evolver | Deny except `docs/ai/evolution/**` | Ask by default; Git inspection allowed | Ask | Deny | None | Evidence-based harness evolution sidecar | opencode/agents/evolver.md |
93
+ | lead | Deny | Ask by default; read-only Git, navigation, search, and evidence collection exceptions | Allow | Deny | designer, researcher, specifier, developer, reviewer, evaluator, debugger, evolver | Primary product-development orchestrator | opencode/agents/lead.md |
94
+ | researcher | Ask | Ask by default; Git inspection allowed | Allow | Deny | None | Technical and product research | opencode/agents/researcher.md |
95
+ | review_api | Deny | Ask by default; Git inspection allowed and RTK remains gated | Deny | Deny | None | Focused API and compatibility review | opencode/agents/review_api.md |
96
+ | review_coordinator | Deny | Ask by default; deterministic review preparation allowed | Deny | Deny | review_quality, review_security, review_tests, review_api | Primary review coordinator | opencode/agents/review_coordinator.md |
97
+ | review_quality | Deny | Ask by default; Git inspection allowed and RTK remains gated | Deny | Deny | None | Focused correctness and maintainability review | opencode/agents/review_quality.md |
98
+ | review_security | Deny | Ask by default; Git inspection allowed and RTK remains gated | Deny | Deny | None | Focused security and supply-chain review | opencode/agents/review_security.md |
99
+ | review_tests | Deny | Ask by default; Git inspection and declared test commands allowed | Deny | Deny | None | Focused test and regression review | opencode/agents/review_tests.md |
100
+ | reviewer | Deny | Ask by default; declared validation and Git inspection commands allowed | Ask | Deny | None | Senior diff and specification review | opencode/agents/reviewer.md |
101
+ | scoper | Deny except ask under `docs/ai/**` | Ask by default; Git inspection allowed | Allow | Deny | researcher, specifier | Primary research-to-spec orchestrator | opencode/agents/scoper.md |
102
+ | specifier | Ask | Ask by default; Git status and diff allowed | Allow | Deny | None | Specifications, tasks, acceptance criteria, and validation plans | opencode/agents/specifier.md |
103
+
104
+ These declarations limit the behavior OpenCode should permit. They do not stop a
105
+ compromised runtime, dependency, operating-system process, or already-authorized
106
+ shell command from acting with the privileges of the user account.
107
+
108
+ ## External surfaces
109
+
110
+ | Surface | Boundary | Controls or limitations |
111
+ |---|---|---|
112
+ | npm registry and package metadata | TB-006 | Exact dependency versions, lockfile integrity, dependency audit, signature audit, and package smoke reduce drift; registry compromise remains possible |
113
+ | Git repositories and external references | TB-006 | Immutable commit pins and supply-chain checks reject unsupported mutable references |
114
+ | GitHub Actions | TB-006 | Third-party actions are pinned and checked; the CI host and pinned upstream remain trusted dependencies |
115
+ | OpenCode plugin runtime | TB-003<br>TB-006 | Plugin dependencies are scoped and pinned; optional plugin behavior remains partly experimental |
116
+ | Superpowers upstream plugin | TB-006 | The installation contract uses a reviewed immutable Git reference and explicit approval for changes |
117
+ | Open Design service and container | TB-003<br>TB-006 | Documentation recommends local or authenticated network exposure; the service can execute agents and write workspace files |
118
+ | Agent web access | TB-003<br>TB-006 | Frontmatter asks, allows, or denies web tools per role; fetched content remains untrusted |
119
+ | MCP, memory, models, and tool output | TB-003<br>TB-006 | Persistent memory is a hint rather than truth; no general content-isolation guarantee exists |
120
+ | Package, tag, and release publication | TB-008 | Version checks, exact tarball smoke, canonical checksum, and separate human authorization reduce artifact mismatch |
121
+
122
+ ## Persistence surfaces
123
+
124
+ | Surface | Owner | Sensitivity | Lifecycle | Controls or limitations |
125
+ |---|---|---|---|---|
126
+ | `.oak` manifest, journal, backups, rollback, and lock | Lifecycle manager and operator | May contain ownership metadata and copies of replaced private bytes | Created and updated transactionally; backups support rollback; uninstall follows ownership | No-follow checks, target containment, restrictive backup modes, journal recovery, and exclusive lock; retention is operator-managed |
127
+ | `.opencode/loops` snapshots, histories, and locks | Loop state tool and operator | Approved contract, progress, hashes, and execution history | Initialized, resumed, appended, repaired, migrated, and released through the loop-state tool | Contract hashes, append-only validation, idempotent action IDs, locks, and symlink containment |
128
+ | `.opencode/handoffs` | Harness workflow and operator | Durable human approval and task context | Written at approval boundaries and read when work resumes | Approval status is explicit; filesystem access by other local processes remains possible |
129
+ | AHE raw and session evidence | Evaluator, debugger, and operator | Potentially contains prompts, paths, code, tool output, or secrets | Collected privately, analyzed, and reduced into publishable artifacts | Sanitization and private/raw boundary are policy controls; retention and deletion depend on the operator |
130
+ | Review temporary workspace | Review preparation scripts | Patch content, filenames, findings, and metadata | Created for deterministic review preparation and cleaned after use | Safe path handling, patch delimiters, size budgets, timeouts, and network-restricted review roles |
131
+ | OpenCode sessions, logs, and credentials | OpenCode runtime and operator | Highly sensitive | Managed by OpenCode outside this kit's lifecycle | Must stay out of Git and public artifacts; OpenCode storage guarantees are outside scope |
132
+ | Optional plugin caches and runtime state | Plugin runtime and operator | Usage metadata and runtime-derived values | Created and retained according to the plugin and OpenCode runtime | Optional and partly experimental; not all plugin state is covered by core package smoke |
133
+
134
+ ## Data flows
135
+
136
+ 1. **Request to effect.** Operator intent crosses TB-001 into routing, then an
137
+ agent decision crosses TB-003 into a tool, filesystem, shell, network call,
138
+ or delegated task.
139
+ 2. **Durable approval.** A human decision crosses TB-001 into a handoff or loop
140
+ contract that can survive a restarted process through TB-009.
141
+ 3. **Installation.** Public package material crosses TB-004 and TB-005 into a
142
+ target, with ownership, journal, backup, conflict, and rollback decisions.
143
+ 4. **Review.** Repository-controlled diff and filenames cross TB-002 into a
144
+ temporary review workspace, then findings cross TB-007 into sanitized output.
145
+ 5. **Evidence reduction.** Private raw sessions and evidence cross TB-007 only
146
+ after minimization into a publishable contract or aggregate.
147
+ 6. **Public sync and release.** Portable selected files cross TB-008 into the
148
+ public repository, package, tag, and release after leak and artifact checks.
149
+ 7. **External interaction.** A local agent, tool, or plugin crosses TB-006 to a
150
+ registry, Git host, web page, model, MCP, or Open Design and receives an
151
+ untrusted response.
152
+
153
+ ## Risk register
154
+
155
+ Severity describes operational priority within this system, not a calculated
156
+ CVSS score. `partially-mitigated` means that useful controls exist but do not
157
+ eliminate the documented abuse. No row is accepted on behalf of the maintainer.
158
+
159
+ | ID | Title | Actor or input | Assets | Boundaries | Abuse | Severity | Controls | Evidence | Status | Residual | Authority | Review trigger |
160
+ |---|---|---|---|---|---|---|---|---|---|---|---|---|
161
+ | TM-001 | Prompt injection from a diff or patch | AC-002 | A-001<br>A-002<br>A-007 | TB-002<br>TB-003 | Patch text is treated as an instruction and causes an unauthorized tool or review action | high | Review prompts delimit patch data, repository content is declared untrusted, and focused roles restrict edits and network | test:opencode/scripts/adversarial-harness.test.mjs diff-injection-is-data<br>check:opencode/AGENTS.md untrusted repository rule | partially-mitigated | Models can still follow hostile content within an otherwise allowed action | maintainer | Prompt, review preparation, model, or permission change |
162
+ | TM-002 | Hostile instructions in repository documentation | AC-002 | A-001<br>A-002<br>A-004 | TB-002<br>TB-003 | A repository document attempts to override active instructions or expand authority | high | Loaded instruction files remain authoritative while ordinary repository documents are treated as data | test:opencode/scripts/adversarial-harness.test.mjs repo-doc-is-data<br>check:opencode/AGENTS.md instruction precedence | partially-mitigated | Natural-language separation depends on model and runtime behavior | maintainer | Instruction-loading or prompt hierarchy change |
163
+ | TM-003 | Hostile web, tool, MCP, model, or memory content | AC-004 | A-001<br>A-002<br>A-003<br>A-004 | TB-003<br>TB-006 | External output injects instructions, false facts, or malicious payloads into an agent decision | high | Network access is role-scoped and memory is explicitly a hint rather than truth | check:opencode/scripts/check-harness.mjs permission contracts<br>limitation:no general isolation of external content | partially-mitigated | Allowed external content can influence agents and tools | maintainer | New MCP, model, tool, plugin, or web-enabled role |
164
+ | TM-004 | Unauthorized write, delegation, or confused deputy | AC-002<br>AC-004 | A-001<br>A-002<br>A-004 | TB-001<br>TB-003 | A less-authorized input induces a more-authorized agent or delegated task to perform an effect | high | Closed orchestration contracts, task allowlists, edit permissions, workflow barriers, and completion authority are checked | check:opencode/scripts/check-harness.mjs orchestration contracts<br>limitation:delegated authority is enforced as policy, not capability tokens | partially-mitigated | Authority context can be misunderstood across natural-language handoffs | maintainer | Agent, delegation, routing, or approval contract change |
165
+ | TM-005 | Shell allowlist or wrapper bypass | AC-002<br>AC-003 | A-002<br>A-003<br>A-004 | TB-003 | An allowed wrapper or command pattern carries arguments that produce an unreviewed effect | high | Shell defaults to ask and wrapper arguments remain gated by declared patterns | test:opencode/scripts/adversarial-harness.test.mjs rtk-wrapper-needs-approval<br>check:opencode/scripts/check-harness.mjs shell permission contracts | partially-mitigated | Correctness depends on OpenCode matcher and shell semantics | maintainer | Shell matcher, wrapper, or allowlist change |
166
+ | TM-006 | Network exfiltration during agent or review work | AC-002<br>AC-004 | A-002<br>A-003<br>A-007 | TB-003<br>TB-006 | Readable workspace or evidence data is sent through an allowed network tool | high | Focused reviewers deny network and other roles ask or allow it explicitly; review policy treats secret-like data as sensitive | test:opencode/scripts/adversarial-harness.test.mjs review-network-not-allowed<br>check:opencode/scripts/check-harness.mjs reviewer network permissions | partially-mitigated | Network-enabled agents can expose data they are already authorized to read | maintainer | Network permission, review role, or tool change |
167
+ | TM-007 | Filesystem escape by symlink, traversal, or race | AC-002<br>AC-005 | A-002<br>A-003<br>A-006 | TB-004<br>TB-005<br>TB-009 | A managed path resolves outside the intended root or changes between validation and use | high | Lifecycle and state tools reject external symlinks, unsafe relative paths, and uncontained targets; locks reduce races | test:opencode/scripts/adversarial-harness.test.mjs external-symlink-rejected<br>test:opencode/scripts/adversarial-harness.test.mjs path-traversal-rejected<br>test:scripts/manage-installation.test.mjs containment cases | partially-mitigated | OS-level races and compromised local processes cannot be eliminated by path checks alone | maintainer | Filesystem, archive, target-resolution, or temporary-file change |
168
+ | TM-008 | Hostile filenames, control characters, or archive paths | AC-002<br>AC-003 | A-002<br>A-007<br>A-008 | TB-002<br>TB-004<br>TB-009 | A filename corrupts a review payload, escapes an archive root, or changes command interpretation | high | Review path validation rejects control characters and package smoke rejects unsafe archive names and entry types | test:opencode/scripts/adversarial-harness.test.mjs control-filename-rejected<br>test:scripts/package-smoke.test.mjs archive validation | partially-mitigated | Filesystem and tool-specific filename semantics vary by platform | maintainer | Review path, archive, tar, or platform-support change |
169
+ | TM-009 | Approval or durable-state tampering, corruption, or replay | AC-002<br>AC-005 | A-001<br>A-005 | TB-001<br>TB-009 | Stored approval is altered, an event is repeated, or a stale contract resumes as current authority | high | Approved-contract hashes, append-only validation, idempotent action IDs, journals, locks, and explicit approval status detect key mutations | test:opencode/scripts/adversarial-harness.test.mjs approval-hash-is-immutable<br>test:opencode/scripts/adversarial-harness.test.mjs repeated-event-rejected<br>test:opencode/scripts/loop-state.test.mjs durable-state cases | partially-mitigated | A process with the user's filesystem privileges can alter or delete state and force recovery | maintainer | Handoff, loop schema, hash, journal, lock, or resume change |
170
+ | TM-010 | Secret leakage in patches, reviews, or sanitization | AC-002<br>AC-006 | A-003<br>A-007<br>A-010 | TB-002<br>TB-007<br>TB-008 | Secret-like content reaches a review payload, evidence artifact, commit, or public package | high | Secret-risk classification, evidence sanitization rules, public leak scan, and package forbidden-state checks reduce exposure | test:opencode/scripts/adversarial-harness.test.mjs credential-canary-stays-local<br>check:scripts/check.sh public leak scan<br>test:scripts/package-smoke.test.mjs forbidden state | partially-mitigated | Pattern checks cannot identify every secret or semantic disclosure | maintainer | Evidence, review, leak-pattern, package-content, or publication change |
171
+ | TM-011 | Raw session or evidence disclosure | AC-004<br>AC-006 | A-003<br>A-007<br>A-009<br>A-010 | TB-007<br>TB-008 | Raw prompts, tool output, logs, or transcripts are copied into a public artifact | high | Raw evidence is private by contract and public artifacts must be sanitized and minimized | check:opencode/docs/ai/harness/evidence.md evidence boundary<br>limitation:sanitization retains human review and cannot prove all semantic data is removed | partially-mitigated | Accidental copying or incomplete redaction remains possible | maintainer | Evidence collector, sanitizer, report, or sync workflow change |
172
+ | TM-012 | Sensitive bytes retained in backups or persistent state | AC-005<br>AC-006 | A-003<br>A-006<br>A-009 | TB-005<br>TB-009 | Replaced private files survive in backups, histories, logs, or plugin caches longer than expected | medium | Lifecycle backups use restrictive modes and managed cleanup follows explicit ownership | test:scripts/manage-installation.test.mjs backup and rollback cases<br>limitation:operator controls host access and retention | partially-mitigated | Restrictive permissions do not erase data or protect against the same user account | maintainer | Backup, retention, uninstall, logging, or cache change |
173
+ | TM-013 | Malicious or mutable dependency, action, plugin, or external reference | AC-003<br>AC-004 | A-002<br>A-003<br>A-008 | TB-004<br>TB-006 | A changed upstream reference or compromised package executes with developer privileges | high | Exact pins, immutable Git references, lock integrity, checksums, audits, and explicit approval are checked | test:opencode/scripts/adversarial-harness.test.mjs unpinned-ref-needs-approval<br>test:scripts/check-supply-chain.test.mjs pin mutations<br>check:scripts/check-supply-chain.mjs | partially-mitigated | An authentic pinned upstream or registry account can still be compromised | maintainer | Dependency, action, plugin, registry, pin, or override change |
174
+ | TM-014 | Experimental plugin behavior outside core smoke | AC-003<br>AC-004 | A-002<br>A-009 | TB-003<br>TB-006 | An optional plugin reads runtime state, fails unexpectedly, or gains behavior not exercised by installation smoke | medium | Plugin dependencies are scoped and typechecked; optional status is documented | check:package.json typecheck contract<br>limitation:plugin runtime is not covered by every core smoke | partially-mitigated | Runtime integration and OpenCode plugin APIs can change independently | maintainer | Plugin code, SDK version, or OpenCode compatibility change |
175
+ | TM-015 | Unsafe Open Design exposure or agent execution | AC-004<br>AC-006 | A-002<br>A-003<br>A-009 | TB-003<br>TB-006 | A reachable Open Design service accepts work that executes an agent against a sensitive workspace | high | Security docs require local, trusted, VPN, or authenticated exposure and warn that agents can write files | check:SECURITY.md supported use<br>check:docs/security.md Open Design guidance<br>limitation:network authentication is operator-provided | partially-mitigated | Public exposure, weak authentication, or a wrongly selected workspace can still lead to compromise | maintainer | Open Design service, container, networking, or tool-registration change |
176
+ | TM-016 | Installation ownership conflict or incomplete rollback | AC-005<br>AC-006 | A-002<br>A-006 | TB-004<br>TB-005<br>TB-009 | Installation overwrites user-owned content, loses ownership provenance, or cannot restore an interrupted mutation | high | Manifest ownership, preserved files, backups, transaction journal, lock, conflict detection, and rollback checks constrain mutation | test:scripts/manage-installation.test.mjs ownership and rollback cases<br>check:scripts/oak.mjs check command | partially-mitigated | Disk failure, manual state editing, or missing backups can prevent complete recovery | maintainer | Lifecycle schema, ownership, transaction, install, upgrade, uninstall, or rollback change |
177
+ | TM-017 | Version, tag, package, checksum, and release mismatch | AC-006 | A-008<br>A-010 | TB-004<br>TB-008 | A different commit or tarball is tagged, checksummed, uploaded, or published than the artifact that passed checks | high | Version contract, package snapshot, canonical checksum, exact tarball smoke, and separate publication authorization reduce mismatch | test:scripts/package-smoke.test.mjs captured tarball and checksum cases<br>check:scripts/version.mjs<br>check:docs/supply-chain.md release procedure | partially-mitigated | Skipping the documented release sequence or uploading manually can still diverge | maintainer | Version, package, tag, checksum, release, or publication workflow change |
178
+ | TM-018 | Resource exhaustion from patches, loops, tools, or subprocesses | AC-002<br>AC-004 | A-002<br>A-005<br>A-007<br>A-009 | TB-002<br>TB-003<br>TB-009 | Oversized input, repeated iteration, or a hanging process consumes time, memory, disk, or model budget | medium | Review preparation uses budgets and timeouts; loop invocation has an iteration cap | test:scripts/review-orchestrated-prepare.test.mjs budget and timeout cases<br>check:opencode/scripts/check-harness.mjs loop iteration contract<br>limitation:no system-wide resource quota | partially-mitigated | Allowed processes and external services can still exhaust host resources | maintainer | Budget, timeout, loop, subprocess, or input-size change |
179
+ | TM-019 | Poisoned memory, MCP data, or reused evidence | AC-004 | A-001<br>A-004<br>A-007<br>A-009 | TB-003<br>TB-006<br>TB-007 | Stale or malicious remembered content is treated as current truth and changes a decision | high | Persistent memory is documented as a hint and important decisions require verification against current repository state | check:opencode/AGENTS.md memory-as-hint rule<br>limitation:no provenance enforcement for every external memory or MCP response | partially-mitigated | Plausible poisoned context can still bias reasoning before verification | maintainer | Memory, MCP, evidence-reuse, retrieval, or provenance change |
180
+ | TM-020 | Private material crosses public sync or release boundary | AC-006 | A-003<br>A-007<br>A-010 | TB-007<br>TB-008 | Private configuration, service wiring, paths, raw evidence, or credentials enter a public diff or package | high | Deliberate file selection, public translation, leak scans, package file allow/deny checks, diff review, and separate commit/release gates constrain the boundary | check:scripts/check.sh public leak scan<br>test:scripts/package-smoke.test.mjs forbidden package state<br>limitation:semantic privacy review remains human | partially-mitigated | Novel identifiers or sensitive prose can evade mechanical patterns | maintainer | Sync skill, leak scan, package files, documentation, commit, or release change |
181
+
182
+ ## Adversarial traceability
183
+
184
+ The public adversarial corpus remains unchanged. Each scenario maps exactly once
185
+ to its primary risk and to the existing executable defense suite.
186
+
187
+ | Scenario ID | Risk ID | Evidence |
188
+ |---|---|---|
189
+ | diff-injection-is-data | TM-001 | test:opencode/scripts/adversarial-harness.test.mjs |
190
+ | repo-doc-is-data | TM-002 | test:opencode/scripts/adversarial-harness.test.mjs |
191
+ | external-symlink-rejected | TM-007 | test:opencode/scripts/adversarial-harness.test.mjs |
192
+ | path-traversal-rejected | TM-007 | test:opencode/scripts/adversarial-harness.test.mjs |
193
+ | control-filename-rejected | TM-008 | test:opencode/scripts/adversarial-harness.test.mjs |
194
+ | rtk-wrapper-needs-approval | TM-005 | test:opencode/scripts/adversarial-harness.test.mjs |
195
+ | review-network-not-allowed | TM-006 | test:opencode/scripts/adversarial-harness.test.mjs |
196
+ | approval-hash-is-immutable | TM-009 | test:opencode/scripts/adversarial-harness.test.mjs |
197
+ | credential-canary-stays-local | TM-010 | test:opencode/scripts/adversarial-harness.test.mjs |
198
+ | unpinned-ref-needs-approval | TM-013 | test:opencode/scripts/adversarial-harness.test.mjs |
199
+ | repeated-event-rejected | TM-009 | test:opencode/scripts/adversarial-harness.test.mjs |
200
+
201
+ ## Residual risks and assumptions
202
+
203
+ - Permission frontmatter is not process, filesystem, container, or
204
+ operating-system isolation.
205
+ - A network-enabled agent can ingest hostile content and can expose data it is
206
+ already able to read.
207
+ - Tool, MCP, plugin, model, web, registry, and memory output remains untrusted.
208
+ - Delegation can create confused-deputy behavior because authority is conveyed
209
+ through policy and natural-language context rather than capability tokens.
210
+ - Shell safety depends on the real OpenCode matcher, wrapper, and shell
211
+ semantics.
212
+ - Experimental plugins are outside some core installation and runtime
213
+ guarantees.
214
+ - Open Design can execute agent CLIs and write workspace files; authentication
215
+ and network exposure remain operator responsibilities.
216
+ - Raw evidence, sessions, logs, backups, histories, and caches can contain
217
+ sensitive material.
218
+ - Timeouts, budgets, locks, and iteration caps reduce but do not eliminate
219
+ denial of service or resource exhaustion.
220
+ - Pins, checksums, signatures, and audits cannot eliminate compromise of an
221
+ authentic upstream source.
222
+ - Private-to-public preparation still needs human semantic review.
223
+ - Archive, checksum, version, tag, release upload, and registry publication can
224
+ diverge if release checks and authorization gates are skipped.
225
+
226
+ Any new agent, external service, plugin, persistent surface, publication path,
227
+ permission expansion, lifecycle mutation, or evidence pipeline change requires
228
+ review of the affected rows. Accepted risk requires an explicit maintainer
229
+ decision and a concrete review trigger.
230
+
231
+ ## Private and public boundary
232
+
233
+ Public artifacts may contain portable agent and workflow contracts, public
234
+ package paths, generic threat taxonomy, public controls and tests, documented
235
+ services, and honest limitations.
236
+
237
+ Public artifacts must not contain active private configuration, provider or MCP
238
+ wiring, credentials, tokens, secrets, sessions, transcripts, logs, raw
239
+ evidence, private service inventory, machine-local absolute paths, durable local
240
+ approval state, or private product documents.
241
+
242
+ The checker catches structural omissions and a small set of known markers. It
243
+ does not replace public-diff review, package inspection, or a human judgment
244
+ about whether otherwise ordinary prose reveals private information.
@@ -0,0 +1,31 @@
1
+ # Reproducible use cases
2
+
3
+ These two synthetic case packs compare the public harness with a reduced
4
+ `developer`-only invocation while holding the prompt, fixture, OpenCode version,
5
+ model selection, and validation constant.
6
+
7
+ - [Direct label change](direct-label-change/README.md) exercises the smallest
8
+ direct-development path.
9
+ - [Feature tag normalizer](feature-tag-normalizer/README.md) exercises the
10
+ explicit feature workflow.
11
+
12
+ Fixture checks prove that the four stored repositories are internally valid.
13
+ They are not live orchestration evidence. Live runs are manual, opt-in, excluded
14
+ from CI, and recorded only after their separate approval gate.
15
+
16
+ Each variant records `pass`, `fail`, or `inconclusive`. Token evidence is marked
17
+ `unavailable` when a reliable aggregate cannot be extracted. One run per
18
+ variant is an observation, not a benchmark or statistical claim.
19
+
20
+ Portable reports must not contain raw output, session IDs, reasoning,
21
+ model/provider identity, credentials, environment values, private URLs, or
22
+ local absolute paths.
23
+
24
+ Run the fixture checks without network access:
25
+
26
+ ```bash
27
+ npm --prefix docs/use-cases/direct-label-change/before test
28
+ npm --prefix docs/use-cases/direct-label-change/expected test
29
+ npm --prefix docs/use-cases/feature-tag-normalizer/before test
30
+ npm --prefix docs/use-cases/feature-tag-normalizer/expected test
31
+ ```
@@ -0,0 +1,76 @@
1
+ # Direct label change
2
+
3
+ ## Objective
4
+
5
+ Change the exported `Settings` label to `Account settings` and update its test.
6
+
7
+ ## Why this workflow
8
+
9
+ The task is clear, local, low risk, and requires no research or design. The
10
+ public direct path should route from `lead` to `developer`.
11
+
12
+ ## Initial tree
13
+
14
+ The `before/` repository contains one module, one test, and a dependency-free
15
+ package manifest.
16
+
17
+ ## Expected change
18
+
19
+ The exported label and its assertion match the contents of `expected/`.
20
+
21
+ ## Isolated preparation
22
+
23
+ Copy `before/` into a fresh temporary directory, initialize a temporary Git
24
+ repository, and verify its tests before each invocation.
25
+
26
+ ## Harness command
27
+
28
+ `opencode run --format json --thinking --dir <case-dir> "Change the Settings label to Account settings and run the smallest relevant validation."`
29
+
30
+ ## Reduced command
31
+
32
+ `opencode run --agent developer --format json --thinking --dir <case-dir> "Change the Settings label to Account settings and run the smallest relevant validation."`
33
+
34
+ ## Expected and observed agents
35
+
36
+ Harness expects `lead`, then `developer`; reduced expects `developer`.
37
+ The harness transcript exposed `developer`; the reduced transcript exposed no
38
+ portable agent identity. Primary-agent identity was not reliably emitted.
39
+
40
+ ## Validation
41
+
42
+ Both variants passed `npm test` and `git diff --check`. Both failed exact
43
+ repository comparison with `expected/` because the test title was unchanged.
44
+
45
+ ## Human intervention
46
+
47
+ Neither variant required human intervention.
48
+
49
+ ## Invocations and correction cycles
50
+
51
+ Each variant used one top-level invocation and zero correction cycles.
52
+
53
+ ## Tokens and cost
54
+
55
+ Reliable aggregate token evidence was unavailable. No cost is inferred.
56
+
57
+ ## Result
58
+
59
+ Both variants are `fail` under the exact repository-equivalence contract,
60
+ despite their passing functional validation.
61
+
62
+ ## Comparison
63
+
64
+ Observed in these runs, both variants made the same functional change and left
65
+ the same test title unchanged. Only the harness exposed a developer delegation.
66
+
67
+ ## Limitations
68
+
69
+ One run per variant is an observation, not a benchmark. Primary-agent identity
70
+ and reliable aggregate tokens were unavailable. The harness wrapper did not
71
+ retain the OpenCode process exit status after that completed invocation.
72
+
73
+ ## Cleanup
74
+
75
+ Delete only the dedicated temporary run directory after extracting the
76
+ sanitized result; never retain raw output in this repository.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "oak-use-case-direct-label-change",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "test": "node --test"
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ export const settingsLabel = "Settings";
@@ -0,0 +1,8 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import { settingsLabel } from "../src/settings-label.mjs";
5
+
6
+ test("exports the settings label", () => {
7
+ assert.equal(settingsLabel, "Settings");
8
+ });
@@ -0,0 +1,118 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "direct-label-change",
4
+ "objective": "Change the exported Settings label to Account settings and update its test.",
5
+ "prompt": "Change the Settings label to Account settings and run the smallest relevant validation.",
6
+ "workflow": "direct-development",
7
+ "observation": {
8
+ "date": "2026-07-25",
9
+ "opencode_version": "1.18.4",
10
+ "same_model_selection": true,
11
+ "model_provider_identity": "omitted"
12
+ },
13
+ "fixture": {
14
+ "before": "before",
15
+ "expected": "expected",
16
+ "validation": [
17
+ "npm test",
18
+ "git diff --check"
19
+ ]
20
+ },
21
+ "variants": [
22
+ {
23
+ "id": "harness",
24
+ "command": [
25
+ "opencode",
26
+ "run",
27
+ "--format",
28
+ "json",
29
+ "--thinking",
30
+ "--dir",
31
+ "<case-dir>",
32
+ "Change the Settings label to Account settings and run the smallest relevant validation."
33
+ ],
34
+ "expected_agents": [
35
+ "lead",
36
+ "developer"
37
+ ],
38
+ "observed_agents": [
39
+ "developer"
40
+ ],
41
+ "human_interventions": [],
42
+ "top_level_invocations": 1,
43
+ "correction_cycles": 0,
44
+ "validation_results": [
45
+ {
46
+ "command": "npm test",
47
+ "status": "pass"
48
+ },
49
+ {
50
+ "command": "git diff --check",
51
+ "status": "pass"
52
+ }
53
+ ],
54
+ "tokens": {
55
+ "status": "unavailable",
56
+ "value": null,
57
+ "reason": "No reliable aggregate token evidence in the sanitized report."
58
+ },
59
+ "result": "fail",
60
+ "limitations": [
61
+ "Developer delegation was observable, but the primary agent identity was not emitted in portable evidence.",
62
+ "The wrapper did not retain the OpenCode process exit status after the completed invocation.",
63
+ "The repository passed validation but differed from expected because the test title was unchanged."
64
+ ]
65
+ },
66
+ {
67
+ "id": "reduced",
68
+ "command": [
69
+ "opencode",
70
+ "run",
71
+ "--agent",
72
+ "developer",
73
+ "--format",
74
+ "json",
75
+ "--thinking",
76
+ "--dir",
77
+ "<case-dir>",
78
+ "Change the Settings label to Account settings and run the smallest relevant validation."
79
+ ],
80
+ "expected_agents": [
81
+ "developer"
82
+ ],
83
+ "observed_agents": [],
84
+ "human_interventions": [],
85
+ "top_level_invocations": 1,
86
+ "correction_cycles": 0,
87
+ "validation_results": [
88
+ {
89
+ "command": "npm test",
90
+ "status": "pass"
91
+ },
92
+ {
93
+ "command": "git diff --check",
94
+ "status": "pass"
95
+ }
96
+ ],
97
+ "tokens": {
98
+ "status": "unavailable",
99
+ "value": null,
100
+ "reason": "No reliable aggregate token evidence in the sanitized report."
101
+ },
102
+ "result": "fail",
103
+ "limitations": [
104
+ "The selected primary agent identity was not emitted in portable evidence.",
105
+ "The repository passed validation but differed from expected because the test title was unchanged."
106
+ ]
107
+ }
108
+ ],
109
+ "comparison": {
110
+ "outcome": "Observed in these runs, both variants changed the label and assertion and passed validation, but both failed exact repository equivalence because the test title was unchanged.",
111
+ "orchestration": "Observed in these runs, the harness exposed one developer delegation while the reduced variant exposed no portable agent identity; both produced the same repository outcome with no correction cycle or human intervention.",
112
+ "evidence": "live_smoke",
113
+ "limitations": [
114
+ "One run per variant is observational evidence, not a benchmark.",
115
+ "Reliable aggregate token totals and complete primary-agent identity were unavailable."
116
+ ]
117
+ }
118
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "oak-use-case-direct-label-change",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "test": "node --test"
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ export const settingsLabel = "Account settings";
@@ -0,0 +1,8 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import { settingsLabel } from "../src/settings-label.mjs";
5
+
6
+ test("exports the account settings label", () => {
7
+ assert.equal(settingsLabel, "Account settings");
8
+ });
@@ -0,0 +1,78 @@
1
+ # Feature tag normalizer
2
+
3
+ ## Objective
4
+
5
+ Add `normalizeTags(values)` with its complete public contract and tests.
6
+
7
+ ## Why this workflow
8
+
9
+ The task has multiple acceptance criteria and needs implementation, tests, and
10
+ review. The feature workflow is appropriate without mandatory research or
11
+ design.
12
+
13
+ ## Initial tree
14
+
15
+ The `before/` repository contains a pass-through implementation, its initial
16
+ test, and a dependency-free package manifest.
17
+
18
+ ## Expected change
19
+
20
+ The function trims and lowercases values, removes empty values and duplicates,
21
+ preserves first occurrence order, and does not mutate the input, matching
22
+ `expected/`.
23
+
24
+ ## Isolated preparation
25
+
26
+ Copy `before/` into a fresh temporary directory, initialize a temporary Git
27
+ repository, and verify its tests before each invocation.
28
+
29
+ ## Harness command
30
+
31
+ `opencode run --command feature --format json --thinking --dir <case-dir> "Add normalizeTags(values): trim and lowercase values, remove empty entries and duplicates, preserve first occurrence order, do not mutate the input, add tests, and keep the public API minimal."`
32
+
33
+ ## Reduced command
34
+
35
+ `opencode run --agent developer --format json --thinking --dir <case-dir> "Add normalizeTags(values): trim and lowercase values, remove empty entries and duplicates, preserve first occurrence order, do not mutate the input, add tests, and keep the public API minimal."`
36
+
37
+ ## Expected and observed agents
38
+
39
+ Harness expects `lead`, `specifier`, `developer`, and `reviewer`; `researcher`
40
+ is conditional on a real doubt. Reduced expects `developer`. Observed agents are
41
+ empty because neither transcript emitted a portable agent identity.
42
+
43
+ ## Validation
44
+
45
+ Both unchanged repositories passed `npm test` and `git diff --check`, but both
46
+ failed repository comparison with `expected/`.
47
+
48
+ ## Human intervention
49
+
50
+ Neither variant received human intervention.
51
+
52
+ ## Invocations and correction cycles
53
+
54
+ Each variant used one top-level invocation and zero correction cycles.
55
+
56
+ ## Tokens and cost
57
+
58
+ Reliable aggregate token evidence was unavailable. No cost is inferred.
59
+
60
+ ## Result
61
+
62
+ Both variants are `fail` because neither implemented the expected repository.
63
+
64
+ ## Comparison
65
+
66
+ Observed in these runs, the harness encountered two permission-rejected shell
67
+ actions and the reduced variant encountered one. Both left the fixture
68
+ unchanged.
69
+
70
+ ## Limitations
71
+
72
+ One run per variant is an observation, not a benchmark. Agent identity and
73
+ reliable aggregate tokens were unavailable.
74
+
75
+ ## Cleanup
76
+
77
+ Delete only the dedicated temporary run directory after extracting the
78
+ sanitized result; never retain raw output in this repository.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "oak-use-case-feature-tag-normalizer",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "test": "node --test"
7
+ }
8
+ }
@@ -0,0 +1,3 @@
1
+ export function normalizeTags(values) {
2
+ return [...values];
3
+ }
@@ -0,0 +1,13 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import { normalizeTags } from "../src/normalize-tags.mjs";
5
+
6
+ test("returns a new array without mutating the input", () => {
7
+ const input = ["Alpha", " Beta "];
8
+ const result = normalizeTags(input);
9
+
10
+ assert.deepEqual(result, input);
11
+ assert.notEqual(result, input);
12
+ assert.deepEqual(input, ["Alpha", " Beta "]);
13
+ });