opencode-wait-a-minute 0.0.0-stage → 1.1.0-rc.10

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 (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +318 -2
  3. package/index.js +1836 -0
  4. package/package.json +70 -4
  5. package/skills/codebase-design/SKILL.md +114 -0
  6. package/skills/design-contract/SKILL.md +27 -0
  7. package/skills/design-critique/SKILL.md +19 -0
  8. package/skills/design-system/SKILL.md +17 -0
  9. package/skills/design-system/references/image-analysis.md +14 -0
  10. package/skills/design-system/references/tokens.md +32 -0
  11. package/skills/design-system/references/ui-rules.md +14 -0
  12. package/skills/diagnosing-bugs/SKILL.md +138 -0
  13. package/skills/frontend-design/SKILL.md +36 -0
  14. package/skills/handoff/SKILL.md +16 -0
  15. package/skills/improve-codebase-architecture/SKILL.md +71 -0
  16. package/skills/linter-negative/SKILL.md +74 -0
  17. package/skills/no-slop-ui/SKILL.md +26 -0
  18. package/skills/prototype/SKILL.md +26 -0
  19. package/skills/registry.json +44087 -0
  20. package/skills/tastemaker/SKILL.md +8 -0
  21. package/skills/tastemaker/references/tastemaker.md +14 -0
  22. package/skills/tdd/SKILL.md +38 -0
  23. package/skills/visual-review/SKILL.md +103 -0
  24. package/skills/visual-review/references/review-gates.md +42 -0
  25. package/skills/visual-review/references/surface-archetypes.md +37 -0
  26. package/skills/wizard/SKILL.md +44 -0
  27. package/skills/writing-for-agents/SKILL.md +81 -0
  28. package/src/cognition/cognition-store.js +251 -0
  29. package/src/cognition/cognitive-state.js +126 -0
  30. package/src/cognition/hypothesis-manager.js +113 -0
  31. package/src/cognition/observation-engine.js +112 -0
  32. package/src/cognition/observation-provenance.js +268 -0
  33. package/src/context/active-context-boundary.js +68 -0
  34. package/src/context/assembly.js +494 -0
  35. package/src/context/assessment-rules.js +55 -0
  36. package/src/context/capsule-staleness.js +267 -0
  37. package/src/context/capsules.js +2 -0
  38. package/src/context/compare-array.js +98 -0
  39. package/src/context/compare-object.js +89 -0
  40. package/src/context/compare-values.js +42 -0
  41. package/src/context/context-assembly-contract.js +71 -0
  42. package/src/context/context-budget-manager.js +232 -0
  43. package/src/context/context-builder.js +49 -0
  44. package/src/context/context-cache.js +55 -0
  45. package/src/context/context-capture.js +243 -0
  46. package/src/context/context-classification.js +199 -0
  47. package/src/context/context-compaction.js +179 -0
  48. package/src/context/context-decision-audit.js +267 -0
  49. package/src/context/context-demotion.js +173 -0
  50. package/src/context/context-dictionary.js +106 -0
  51. package/src/context/context-drift-detection.js +225 -0
  52. package/src/context/context-evaluation.js +374 -0
  53. package/src/context/context-event-ingress.js +100 -0
  54. package/src/context/context-event-normalization.js +224 -0
  55. package/src/context/context-feedback-loop.js +216 -0
  56. package/src/context/context-freshness.js +21 -0
  57. package/src/context/context-graph-builder.js +71 -0
  58. package/src/context/context-graph.js +451 -0
  59. package/src/context/context-history-relevance.js +321 -0
  60. package/src/context/context-interception.js +145 -0
  61. package/src/context/context-invalidation-events.js +154 -0
  62. package/src/context/context-lifecycle.js +170 -0
  63. package/src/context/context-loop-prevention.js +347 -0
  64. package/src/context/context-manager.js +340 -0
  65. package/src/context/context-memory-layers.js +265 -0
  66. package/src/context/context-minimality.js +166 -0
  67. package/src/context/context-normalization.js +130 -0
  68. package/src/context/context-optimization-metrics.js +434 -0
  69. package/src/context/context-output-policy.js +135 -0
  70. package/src/context/context-pack-authority.js +157 -0
  71. package/src/context/context-promotion.js +172 -0
  72. package/src/context/context-query-contract.js +101 -0
  73. package/src/context/context-ranking.js +164 -0
  74. package/src/context/context-rate-distortion.js +261 -0
  75. package/src/context/context-recovery.js +209 -0
  76. package/src/context/context-retrieval-integration.js +60 -0
  77. package/src/context/context-retrieval.js +93 -0
  78. package/src/context/context-router.js +457 -0
  79. package/src/context/context-routing-evaluation.js +331 -0
  80. package/src/context/context-routing-observability.js +296 -0
  81. package/src/context/context-routing-shadow.js +237 -0
  82. package/src/context/context-scope.js +181 -0
  83. package/src/context/context-snapshot.js +226 -0
  84. package/src/context/context-source-registry.js +95 -0
  85. package/src/context/context-sufficiency-gate.js +120 -0
  86. package/src/context/context-sufficiency-oracle.js +167 -0
  87. package/src/context/context-telemetry.js +176 -0
  88. package/src/context/context.js +633 -0
  89. package/src/context/dependency-closure.js +246 -0
  90. package/src/context/page-fault-tracker.js +275 -0
  91. package/src/context/prompt-engine.js +74 -0
  92. package/src/context/runtime-context-graph.js +260 -0
  93. package/src/context/selection.js +2 -0
  94. package/src/context/session.js +2 -0
  95. package/src/context/sufficiency-contract.js +300 -0
  96. package/src/context/tokenizer.js +17 -0
  97. package/src/context-benchmark-router.mjs +125 -0
  98. package/src/evidence/evidence-engine.js +161 -0
  99. package/src/evidence/evidence-factory.js +3 -0
  100. package/src/evidence/evidence-freshness.js +463 -0
  101. package/src/evidence/evidence-gap.js +76 -0
  102. package/src/evidence/evidence-lineage.js +525 -0
  103. package/src/evidence/evidence.js +136 -0
  104. package/src/evidence/freshness-validation.js +187 -0
  105. package/src/evidence/lineage.js +4 -0
  106. package/src/execution/action-evaluation.js +179 -0
  107. package/src/execution/circuit-breaker.js +70 -0
  108. package/src/execution/claim-interception.js +63 -0
  109. package/src/execution/execution-engine.js +258 -0
  110. package/src/execution/execution-intent.js +69 -0
  111. package/src/execution/execution-state.js +89 -0
  112. package/src/execution/formatting.js +60 -0
  113. package/src/execution/l1-sanitize.js +16 -0
  114. package/src/execution/l2-resource-guards.js +19 -0
  115. package/src/execution/l3-invariant-checker.js +5 -0
  116. package/src/execution/l4-containment.js +6 -0
  117. package/src/execution/runtime-guards.js +106 -0
  118. package/src/execution/strategy-identity.js +162 -0
  119. package/src/execution/tool-interceptor.js +7 -0
  120. package/src/execution/tool-result-classifier.js +63 -0
  121. package/src/integration/canary-deploy.js +143 -0
  122. package/src/integration/collector.js +59 -0
  123. package/src/integration/error-recovery.js +6 -0
  124. package/src/integration/event-bus.js +66 -0
  125. package/src/integration/health-checker.js +57 -0
  126. package/src/integration/logger.js +39 -0
  127. package/src/integration/message-handler.js +611 -0
  128. package/src/integration/opencode-db.js +153 -0
  129. package/src/integration/orchestration.js +419 -0
  130. package/src/integration/part-provenance.js +65 -0
  131. package/src/integration/rate-limiter.js +55 -0
  132. package/src/integration/release-gate.js +336 -0
  133. package/src/integration/rollback-manager.js +164 -0
  134. package/src/integration/router-adapter.js +269 -0
  135. package/src/integration/telemetry.js +45 -0
  136. package/src/integration/update-checker.js +10 -0
  137. package/src/persistence/event-sourcing.js +75 -0
  138. package/src/persistence/memory.js +501 -0
  139. package/src/persistence/migration-runner.js +16 -0
  140. package/src/persistence/persistence-manager.js +39 -0
  141. package/src/persistence/transaction-log.js +157 -0
  142. package/src/policy/action-capabilities.js +116 -0
  143. package/src/policy/action-policy.js +4 -0
  144. package/src/policy/assessment-engine.js +104 -0
  145. package/src/policy/assumption-tracking.js +66 -0
  146. package/src/policy/budget-enforcer.js +7 -0
  147. package/src/policy/config-validator.js +102 -0
  148. package/src/policy/execution-assessment.js +142 -0
  149. package/src/policy/failure-classification.js +5 -0
  150. package/src/policy/feature-flags.js +65 -0
  151. package/src/policy/governance-enforcement.js +118 -0
  152. package/src/policy/locale.js +15 -0
  153. package/src/policy/multi-signer.js +151 -0
  154. package/src/policy/policy-state-machine.js +97 -0
  155. package/src/policy/ponytail-constraint.js +38 -0
  156. package/src/policy/project-inspector.js +93 -0
  157. package/src/policy/query-builder.js +14 -0
  158. package/src/policy/request-classifier.js +79 -0
  159. package/src/policy/risk-engine.js +266 -0
  160. package/src/policy/scope-enforcement.js +140 -0
  161. package/src/policy/secret-scanner.js +68 -0
  162. package/src/policy/skill-routing.js +104 -0
  163. package/src/policy/strategy-capabilities.js +211 -0
  164. package/src/policy/strategy.js +6 -0
  165. package/src/policy/uncertainty.js +117 -0
  166. package/src/shared/container.js +44 -0
  167. package/src/shared/decision-types.js +24 -0
  168. package/src/shared/simple-test.js +160 -0
  169. package/src/shared/wam-events.js +52 -0
  170. package/src/skills/engine.js +1705 -0
  171. package/src/skills/skill-registry.js +19 -0
  172. package/src/skills/skill-routing.js +340 -0
  173. package/src/state/lifecycle-manager.js +113 -0
  174. package/src/state/operational-state.js +198 -0
  175. package/src/state/projections.js +47 -0
  176. package/src/state/replay-engine.js +5 -0
  177. package/src/state/requirement-ownership.js +20 -0
  178. package/src/state/requirement-state.js +152 -0
  179. package/src/state/run-event-identity.js +172 -0
  180. package/src/state/state-engine.js +19 -0
  181. package/src/state/state-machine.js +119 -0
  182. package/src/state/state-schema.js +318 -0
  183. package/src/state/state-store.js +335 -0
  184. package/src/state/state-transition.js +84 -0
  185. package/src/state/task-dependencies.js +287 -0
  186. package/src/state/task-execution.js +217 -0
  187. package/src/state/task-lifecycle.js +59 -0
  188. package/src/state/task-runs.js +361 -0
  189. package/src/state/task-state-file.js +86 -0
  190. package/src/state/task-state.js +41 -0
  191. package/src/state/task-status.js +54 -0
  192. package/src/state/task-store.js +48 -0
  193. package/src/state/wam-state.js +148 -0
  194. package/src/verification/completion-gate-simple.js +8 -0
  195. package/src/verification/completion-gate.js +183 -0
  196. package/src/verification/contract.js +9 -0
  197. package/src/verification/contradiction-resolution.js +255 -0
  198. package/src/verification/diagnostic-engine.js +659 -0
  199. package/src/verification/false-completion-prevention.js +100 -0
  200. package/src/verification/hook-validator.js +6 -0
  201. package/src/verification/requirements.js +6 -0
  202. package/src/verification/verification-context.js +162 -0
  203. package/src/verification/verification-lifecycle.js +66 -0
  204. package/src/verification/verification-model.js +89 -0
  205. package/src/verification/verification-persistence.js +129 -0
  206. package/src/verification/verification-policy.js +127 -0
  207. package/src/verification/verification.js +415 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 khnker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,319 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
4
+ <img src="assets/logo.svg" alt="Wait a Minute" width="200">
5
+ </picture>
6
+ </p>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <div align="center">
9
+
10
+ [![npm](https://img.shields.io/badge/npm-local-1.1.0-007acc)](https://nodejs.org/)
11
+ [![node](https://img.shields.io/badge/node->=20-339933)](https://nodejs.org/)
12
+ [![license](https://img.shields.io/badge/license-MIT-007acc)](./LICENSE)
13
+
14
+ </div>
15
+
16
+ # Wait a Minute
17
+
18
+ > ### WAM keeps more state than it sends.
19
+
20
+ WAM adds deterministic control, task-state management, context enrichment, and
21
+ token optimization to OpenCode agents by correlating tasks, skills, context,
22
+ evidence, and verified state to determine what should happen next.
23
+
24
+ ---
25
+
26
+ ## Quick start
27
+
28
+ Install the plugin and enable it in OpenCode. No further configuration is required.
29
+
30
+ ```bash
31
+ npm install wait-a-minute
32
+ ```
33
+
34
+ ```jsonc
35
+ // opencode.jsonc
36
+ {
37
+ "plugins": ["wait-a-minute"]
38
+ }
39
+ ```
40
+
41
+ WAM intercepts prompts before skill resolution and agent execution. Once
42
+ installed, its control and state-management flow applies automatically.
43
+
44
+ **Requirements:** Node `>=20` · OpenCode `>=1.18.0` — tested on Ubuntu 24.04,
45
+ Node 24.16.0, OpenCode 1.18.33 ([docs/RC1_VALIDATION.md](docs/RC1_VALIDATION.md)).
46
+
47
+ ---
48
+
49
+ ## The core idea
50
+
51
+ WAM separates **persistent task state** from **transient model context**.
52
+
53
+ | | Persistent | Transient |
54
+ |---|---|---|
55
+ | **Where it lives** | WAM state store | Model context window |
56
+ | **Lives across** | Model turns; recoverable across sessions/resumes | Single decision |
57
+ | **What it holds** | Task state, requirements, evidence, decisions and recovery information | Only what's relevant *now* |
58
+
59
+ > **Context is derived from task state, not accumulated from conversation
60
+ > history.**
61
+
62
+ ```mermaid
63
+ flowchart TD
64
+ A[Persistent WAM State]
65
+ B[Current Task State]
66
+ C[Context Selection]
67
+ D[Relevant Skills]
68
+ E[Selected Model Context]
69
+ F[OpenCode Agent]
70
+ G[Action / Observation]
71
+ H[Evidence]
72
+
73
+ A --> B
74
+ B --> C
75
+ B --> D
76
+ C --> E
77
+ D --> E
78
+ E --> F
79
+ F --> G
80
+ G --> H
81
+ H --> A
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Why this matters
87
+
88
+ An agent can accumulate a large amount of conversational and repository context
89
+ while only a small part of that information is relevant to its next decision.
90
+
91
+ WAM maintains the broader task state and reconstructs the context needed for the
92
+ current state. That allows the system to preserve knowledge without continuously
93
+ sending all of that knowledge back to the model.
94
+
95
+ WAM can reduce task-relevant model input by reconstructing only the context
96
+ required for the current decision. Quantitative results and methodology live in
97
+ [docs/benchmarks](docs/benchmarks).
98
+
99
+ ---
100
+
101
+ ## What WAM actually changes
102
+
103
+ | Without WAM | With WAM |
104
+ |-------------|----------|
105
+ | Conversation is the main continuity mechanism | Task state is persisted explicitly |
106
+ | Context tends to accumulate | Context is reconstructed |
107
+ | Skills may be broadly available | Skills are routed to the task |
108
+ | Completion can rely on model judgment | Completion is tied to verification state |
109
+ | Next action comes from conversation | Next action is derived from task state + evidence |
110
+ | Context boundaries are implicit | Tasks have explicit state boundaries |
111
+
112
+ ---
113
+
114
+ ## How WAM works
115
+
116
+ On each prompt, WAM classifies the request, persists task state, reconstructs
117
+ context, and gates completion on verification. Policy, uncertainty, and risk
118
+ gate the decision; execution guards gate actions; completion follows from
119
+ verified state rather than model judgment.
120
+
121
+ ```mermaid
122
+ flowchart TD
123
+ R[User Request] --> T[Task / State]
124
+ T --> P[Policy + Uncertainty + Risk]
125
+ P --> C[Context + Skills]
126
+ C --> M[Model Decision]
127
+ M --> G[Execution Guard]
128
+ G --> O[Observation]
129
+ O --> E[Evidence]
130
+ E --> V[Verified State]
131
+ V --> N[Next Action]
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Tasks are isolated
137
+
138
+ Tasks have their own identity and state.
139
+
140
+ ```text
141
+ Task A
142
+ Fix payment timeout
143
+ ```
144
+
145
+ Its relevant state may include:
146
+
147
+ - Stripe API
148
+ - payment-service.ts
149
+ - retry configuration
150
+ - timeout logs
151
+ - verification evidence
152
+
153
+ After Task A finishes:
154
+
155
+ ```text
156
+ Task B
157
+ Update README
158
+ ```
159
+
160
+ Task A's state remains associated with Task A. It does not automatically become
161
+ Task B's model context.
162
+
163
+ Task B can instead reconstruct context around:
164
+
165
+ - README.md
166
+ - repository documentation
167
+ - documentation structure
168
+ - relevant skills
169
+ - current documentation state
170
+
171
+ This is the basis of task isolation and context separation. See
172
+ [Task Isolation](docs/claims/task-isolation.md) and
173
+ [Context Separation](docs/concepts/context-separation.md).
174
+
175
+ ---
176
+
177
+ ## Context enrichment
178
+
179
+ Context is not only selected from files. WAM enriches the task with relevant
180
+ skills and other task-specific information before the agent makes its next
181
+ decision.
182
+
183
+ ```text
184
+ Task
185
+ Add a PostgreSQL migration
186
+ ```
187
+
188
+ Relevant capabilities may include:
189
+
190
+ - PostgreSQL
191
+ - database migration
192
+ - testing
193
+
194
+ while unrelated capabilities such as Angular UI or CSS should not become part of
195
+ the task context merely because they exist in the repository.
196
+
197
+ The exact selection mechanism is documented in
198
+ [Context Selection](docs/architecture/context-selection.md).
199
+
200
+ ---
201
+
202
+ ## Evidence changes what happens next
203
+
204
+ WAM treats evidence as part of task state.
205
+
206
+ ```mermaid
207
+ flowchart LR
208
+ A[Implementation] --> B[Verification]
209
+ B -->|Failure| C[Investigate / Correct]
210
+ C --> B
211
+ B -->|Success| D[Verified State]
212
+ D --> E[Next Action]
213
+ ```
214
+
215
+ Without evidence, the agent cannot distinguish "done" from "assumed done".
216
+ With evidence, the next action follows from verified state, not from guessing.
217
+
218
+ ---
219
+
220
+ ## Validation
221
+
222
+ WAM's claims are independently documented and validated through:
223
+
224
+ - deterministic behavioral fixtures;
225
+ - state reconstruction tests;
226
+ - task-isolation tests;
227
+ - context-selection tests;
228
+ - skill-routing tests;
229
+ - verification/completion tests;
230
+ - paired baseline/WAM benchmark runs.
231
+
232
+ See [docs/validation/premise.md](docs/validation/premise.md),
233
+ [docs/RC1_VALIDATION.md](docs/RC1_VALIDATION.md), and
234
+ [docs/claims](docs/claims).
235
+
236
+ ---
237
+
238
+ ## Benchmarks & evidence
239
+
240
+ WAM reports **three evidence classes separately** — they are never merged into a
241
+ single number. Reproduce the committed bundle with `npm run report:rc1` (writes
242
+ `benchmarks/reports/rc1/`).
243
+
244
+ ### A. Internal deterministic (no network)
245
+
246
+ Source: `benchmarks/run-validation.mjs`
247
+
248
+ | Metric | Result |
249
+ |--------|--------|
250
+ | Snapshot correctness | 10 / 10 passed |
251
+ | Fast-path count | 34 |
252
+ | Context rebuilds | 8 (5 full · 3 partial) |
253
+ | Deterministic accounting | 8 scenarios · 42 turns · **69.6% total reduction** |
254
+
255
+ ### B. Empirical real (dry-run · mock provider · no network)
256
+
257
+ Source: `benchmarks/run-real.mjs` (`runDryRun`)
258
+
259
+ | Metric | Result |
260
+ |--------|--------|
261
+ | Input tokens — baseline | 195 |
262
+ | Input tokens — WAM | 420 |
263
+ | Rebuilds | 30 |
264
+ | State equivalent | true |
265
+ | Net input savings | **-225** |
266
+
267
+ > The two sections measure different things on different harnesses: the internal
268
+ > deterministic suite shows a **69.6%** reduction, while the dry-run mock
269
+ > provider shows WAM overhead exceeding baseline (**net savings -225**). They do
270
+ > not contradict each other, and **no single net-savings number is claimed**.
271
+ > `outcomeMatch` (0 / 30) compares stochastic text and is not a correctness
272
+ > signal.
273
+
274
+ ### C. External evidence
275
+
276
+ Source: `benchmarks/evidence/sources.json` — 6 sources (2 provider · 2 academic ·
277
+ 2 open-source). Provider-side cache savings are reported separately from WAM's
278
+ internal metrics.
279
+
280
+ Full methodology: [docs/benchmarks/RC1.md](docs/benchmarks/RC1.md) · bundle: [benchmarks/reports/rc1](benchmarks/reports/rc1).
281
+
282
+ ---
283
+
284
+ ## Documentation
285
+
286
+ | Area | Read |
287
+ |------|------|
288
+ | Architecture | [docs/architecture](docs/architecture) |
289
+ | Concepts | [docs/concepts](docs/concepts) |
290
+ | Claims | [docs/claims](docs/claims) |
291
+ | Validation | [docs/validation](docs/validation) |
292
+ | Benchmarks | [docs/benchmarks](docs/benchmarks) |
293
+ | Development | [docs/development](docs/development) |
294
+
295
+ ---
296
+
297
+ ## Development & testing
298
+
299
+ ```bash
300
+ npm test # full suite (scripts/run-tests.mjs)
301
+ npm run test:validation # validation tests (benchmarks/validation)
302
+ npm run test:isolation # task-isolation tests
303
+ npm run test:e2e:opencode # OpenCode end-to-end smoke
304
+ npm run benchmark # dry-run benchmark
305
+ npm run benchmark:real # real provider run
306
+ npm run report:rc1 # RC1 evidence report
307
+ npm run gate # release gate
308
+ ```
309
+
310
+ See [docs/development/testing.md](docs/development/testing.md) and
311
+ [docs/development/contributing.md](docs/development/contributing.md).
312
+
313
+ ---
314
+
315
+ ## License
316
+
317
+ | License | Copyright |
318
+ |---------|-----------|
319
+ | [MIT](./LICENSE) | © 2026 khnker |