opencode-goal-plugin 0.6.8 → 0.7.0
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.
- package/CHANGELOG.md +8 -0
- package/README.md +22 -4
- package/index.d.ts +17 -0
- package/package.json +1 -1
- package/scripts/verify.mjs +9 -1
- package/src/goal-plugin.js +790 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.7.0 — 2026-08-02
|
|
6
|
+
|
|
7
|
+
- Make `/goal status` add explicit `State:` and `Completion audit:` lines without changing its existing `Active goal:` header; make `/goal list` report `active`, `paused`, or `blocked` and preserve the reason for stopped focused goals. Completion audit reporting distinguishes the evidence gate, built-in independent verifier, and custom completion auditor.
|
|
8
|
+
- Add bounded, transition-only lifecycle notices through OpenCode's structured log and TUI toast, with independent `lifecycleMessages` and `lifecycleMessenger` controls. Delivery is advisory, does not create model turns, and does not announce routine idle/checkpoint activity. Completion/block uses the audit-result message when `auditMessages` is enabled and one lifecycle fallback only when it is disabled.
|
|
9
|
+
- Harden lifecycle persistence around the new feedback path: failed completion writes cannot resurrect an older goal over newer session state, blocked ledger events repair a lagging snapshot with their concrete reason, and clear operations disclose when neither snapshot nor ledger recorded the deletion durably.
|
|
10
|
+
|
|
3
11
|
## 0.6.8 — 2026-08-02
|
|
4
12
|
|
|
5
13
|
- Serialize fresh-namespace migration-marker publication across concurrent processes so Windows does not reject competing first-start renames with `EPERM`.
|
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Compatibility: this plugin relies on experimental OpenCode hooks. Re-test agains
|
|
|
18
18
|
- Guarded auto-continuation with turn, duration, token, no-progress, and no-tool-call limits.
|
|
19
19
|
- Project-local restart recovery backed by persisted state and a bounded lifecycle ledger.
|
|
20
20
|
- Evidence-gated completion with an optional independent, fail-closed verifier.
|
|
21
|
+
- Explicit `active`, `paused`, and `blocked` status plus transition-only lifecycle notices.
|
|
21
22
|
- Canonical agent tools, collision-safe goal/verifier agents, multiple goals, and ordered goal sequences.
|
|
22
23
|
|
|
23
24
|
This project is independently implemented for OpenCode. Product names used elsewhere identify their respective owners; no feature-parity or endorsement claim is implied.
|
|
@@ -38,7 +39,7 @@ surface and versioning expectations.
|
|
|
38
39
|
|
|
39
40
|
Tested against real OpenCode 1.17.15 processes with live provider credentials and no mocked plugin hooks. State, ledger entries, and workspace files were checked independently of terminal or model prose:
|
|
40
41
|
|
|
41
|
-
| OpenCode Version | Provider Tested | `/goal status` | Auto-continue | Evidence-gated completion | v0.6.6
|
|
42
|
+
| OpenCode Version | Provider Tested | `/goal status` | Auto-continue | Evidence-gated completion | Historical custom-command presentation (v0.6.6) |
|
|
42
43
|
|---|---|---|---|---|---|
|
|
43
44
|
| 1.17.15 | opencode (`deepseek-v4-flash-free`) | ✅ Canonical tool | ✅ Checkpoint + idle continuation | ✅ Structured `goal_complete` claim | ⚠️ Command text routed to model; mutation guard verified |
|
|
44
45
|
| 1.17.15 | opencode-go (`qwen3.7-plus`) | ✅ | ✅ | ✅ Self-corrected after one rejection (bare `[goal:complete]` with no evidence), then completed cleanly | ⚠️ Not displayed |
|
|
@@ -49,6 +50,8 @@ Tested against real OpenCode 1.17.15 processes with live provider credentials an
|
|
|
49
50
|
|
|
50
51
|
**Note:** The table records the v0.6.6 live-provider matrix. In that release, OpenCode 1.17.15 retained the original command-parts array, so assigning a new `output.parts` array did not replace the raw command argument sent to the model. The current implementation mutates that retained array in place, making the plugin-generated command result the prompt for the turn. OpenCode custom commands still run through the model rather than rendering hook output directly, so the visible response may summarize or paraphrase the result (see [Limitations](#limitations)). Re-test against the exact OpenCode build and provider/backend stack you rely on for unattended work, and see [`docs/providers.md`](docs/providers.md) for the full historical model matrix.
|
|
51
52
|
|
|
53
|
+
Separately, the lifecycle-feedback implementation included in v0.7.0 passed a real OpenCode 1.18.11 host canary covering create, status, pause, resume, edit, and default lifecycle logging with a deterministic localhost provider. That canary validates host integration, not another live-provider compatibility row.
|
|
54
|
+
|
|
52
55
|
## Install
|
|
53
56
|
|
|
54
57
|
```sh
|
|
@@ -100,6 +103,8 @@ Check status:
|
|
|
100
103
|
/goal status
|
|
101
104
|
```
|
|
102
105
|
|
|
106
|
+
`/goal status` keeps its existing `Active goal:` heading and adds an explicit `State:` line: `active` while the goal can continue, `blocked` when the assistant recorded a concrete blocker, and `paused` for other retained stops such as user intervention, a safety limit, or an audit rejection. A `Completion audit:` line distinguishes the always-on evidence gate from an optional built-in independent verifier or custom completion auditor.
|
|
107
|
+
|
|
103
108
|
View lifecycle history and the latest checkpoint:
|
|
104
109
|
|
|
105
110
|
```
|
|
@@ -156,7 +161,7 @@ A session can hold more than one goal. `/goal <condition>` replaces the focused
|
|
|
156
161
|
/goal focus 1
|
|
157
162
|
```
|
|
158
163
|
|
|
159
|
-
`/goal list` shows numbered live goals (focused and backgrounded) plus achieved goals retained in the per-session archive. `/goal clear` intentionally removes live goals and saved status from these views; its terminal ledger entries remain available for crash-safe recovery decisions. `/goal focus <number>` switches the active goal, backgrounding the previous one. Focus is tracked per session and survives a restart.
|
|
164
|
+
`/goal list` shows numbered live goals (focused and backgrounded) plus achieved goals retained in the per-session archive. Each live entry includes its explicit `active`, `paused`, or `blocked` state; a stopped focused goal keeps its bounded stop or blocker reason visible. `/goal clear` intentionally removes live goals and saved status from these views; its terminal ledger entries remain available for crash-safe recovery decisions. `/goal focus <number>` switches the active goal, backgrounding the previous one. Focus is tracked per session and survives a restart.
|
|
160
165
|
|
|
161
166
|
#### Ordered sequences
|
|
162
167
|
|
|
@@ -336,6 +341,8 @@ Additional plugin-level options:
|
|
|
336
341
|
- `ledgerMaxBytes` / `ledgerRetentionFiles` — bound the lifecycle ledger to 2 MiB per generation and three rotated generations by default. Set retention to `0` to discard the active ledger when it reaches the size ceiling.
|
|
337
342
|
- `resultRetentionMs` — how long a completed goal summary remains available through `/goal status` after the goal leaves active memory.
|
|
338
343
|
- `maxStoredResults` — maximum number of completed-goal summaries retained in process memory before the oldest ones are evicted.
|
|
344
|
+
- `lifecycleMessages` — announce applied goal-state transitions (default `true`). Set to `false` to disable lifecycle notices without disabling audit messages or persistence.
|
|
345
|
+
- `lifecycleMessenger(sessionID, text)` — route lifecycle notices to a custom sink instead of the default structured-log/TUI-toast path.
|
|
339
346
|
|
|
340
347
|
## Agent tools
|
|
341
348
|
|
|
@@ -352,12 +359,23 @@ These operate on the same per-session multi-goal state as the command path: a to
|
|
|
352
359
|
|
|
353
360
|
> Integration note: the tool execute-context shape (`ctx.sessionID`) and Zod argument definitions follow the OpenCode plugin docs. The tool **logic** is unit-tested independently, but live registration should still be confirmed against the exact OpenCode host used in production (see the smoke-test checklist).
|
|
354
361
|
|
|
362
|
+
## Lifecycle messages
|
|
363
|
+
|
|
364
|
+
The plugin announces meaningful, applied state transitions such as goal creation, focus changes, pause/resume, recovery, ordered-goal promotion, and clearing. It does not emit a notice for every idle event, checkpoint, or continuation attempt. Messages are bounded and avoid dumping the full objective, evidence, or filesystem paths.
|
|
365
|
+
|
|
366
|
+
By default, lifecycle notices go to OpenCode's structured log and to a TUI toast when that host capability is available. Provide a `lifecycleMessenger(sessionID, text)` plugin option to route them elsewhere, or set `lifecycleMessages: false` to disable them. Delivery is advisory: notices do not start an assistant turn or make any extra model call, and a log, toast, or custom-messenger failure does not undo the recorded state transition.
|
|
367
|
+
|
|
368
|
+
Lifecycle notices and audit messages are separate controls. Lifecycle notices describe applied goal state; audit messages describe completion/block validation. When `auditMessages` is `true`, its audit-result message is the sole completion/block announcement. When `auditMessages` is `false` and `lifecycleMessages` is `true`, the lifecycle channel emits one terminal fallback instead. Other transitions follow `lifecycleMessages`; disabling one control does not disable the other.
|
|
369
|
+
|
|
355
370
|
## Audit messages
|
|
356
371
|
|
|
357
|
-
When the assistant marks a goal complete or blocked, the plugin announces the audit instead of doing it silently: an audit-start message ("Auditing goal completion…") and an audit-result message ("completion accepted — goal archived" / "paused as blocked — …"). By default these are written to OpenCode's structured log and shown as a TUI toast when that client capability is available. Provide an `auditMessenger(sessionID, text)` plugin option to route them elsewhere, or set `auditMessages: false` to disable them.
|
|
372
|
+
When the assistant marks a goal complete or blocked, the plugin announces the audit instead of doing it silently: an audit-start message ("Auditing goal completion…") and an audit-result message ("completion accepted — goal archived" / "paused as blocked — …"). By default these are written to OpenCode's structured log and shown as a TUI toast when that client capability is available. Provide an `auditMessenger(sessionID, text)` plugin option to route them elsewhere, or set `auditMessages: false` to disable them. The audit-result message owns the terminal completion/block announcement while `auditMessages` is enabled, so the lifecycle channel does not duplicate it.
|
|
373
|
+
|
|
374
|
+
Audit messages are visibility only; enabling them does not turn on the independent completion auditor. The evidence gate always applies. Independent verification is enabled only with `completionAudit: true` or a custom `auditor`.
|
|
375
|
+
|
|
358
376
|
## Completion auditor (optional)
|
|
359
377
|
|
|
360
|
-
|
|
378
|
+
Every `[goal:complete]` claim must first pass the local evidence gate described above. By default, that evidence gate is the only verifier. You can additionally require an independent audit before a goal is archived:
|
|
361
379
|
|
|
362
380
|
- `completionAudit: true` — the plugin spawns an independent OpenCode child session to verify the completion against the goal and workspace. The auditor replies with `[audit:approved]` or `[audit:rejected]` (with a reason).
|
|
363
381
|
- `auditor: async ({ goal, sessionID, latestText }) => ({ approved, reason })` — supply your own auditor function (takes precedence over `completionAudit`).
|
package/index.d.ts
CHANGED
|
@@ -324,6 +324,23 @@ export interface GoalPluginOptions {
|
|
|
324
324
|
*/
|
|
325
325
|
auditorOptions?: CompletionAuditorOptions
|
|
326
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Whether the plugin announces applied goal-state transitions such as
|
|
329
|
+
* creation, pause/resume, recovery, promotion, and clearing. Routine
|
|
330
|
+
* idle/checkpoint activity is not announced. Completion/block uses the
|
|
331
|
+
* audit-result channel when enabled and this lifecycle channel only as its
|
|
332
|
+
* disabled fallback.
|
|
333
|
+
* @default true
|
|
334
|
+
*/
|
|
335
|
+
lifecycleMessages?: boolean
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Custom sink for bounded lifecycle notices. Defaults to routing through
|
|
339
|
+
* OpenCode's structured log (`client.app.log`) and TUI toast when those host
|
|
340
|
+
* APIs are available. Delivery is advisory and does not make model calls.
|
|
341
|
+
*/
|
|
342
|
+
lifecycleMessenger?: (sessionID: string, text: string) => Promise<void> | void
|
|
343
|
+
|
|
327
344
|
/**
|
|
328
345
|
* Whether the plugin announces completion/blocked audits (an
|
|
329
346
|
* audit-start and an audit-result message) instead of running silently.
|
package/package.json
CHANGED
package/scripts/verify.mjs
CHANGED
|
@@ -146,7 +146,8 @@ await check("/goal set works", async () => {
|
|
|
146
146
|
assert.match(text, /New active goal: verify the installation/)
|
|
147
147
|
const statusText = await runGoalCommand("status")
|
|
148
148
|
assert.match(statusText, /Active goal: verify the installation/)
|
|
149
|
-
assert.
|
|
149
|
+
assert.match(statusText, /State: active/)
|
|
150
|
+
assert.match(statusText, /Completion audit: evidence gate only \(independent verifier off\)/)
|
|
150
151
|
})
|
|
151
152
|
|
|
152
153
|
await check("no model calls were made during verification", () => {
|
|
@@ -156,6 +157,13 @@ await check("no model calls were made during verification", () => {
|
|
|
156
157
|
// Clean up the goal created above so this script has no side effects.
|
|
157
158
|
await runGoalCommand("clear")
|
|
158
159
|
|
|
160
|
+
await check("lifecycle transitions are visible without leaking objective text", () => {
|
|
161
|
+
assert.deepEqual(logCalls.map((entry) => entry.body.extra.kind), ["goal-lifecycle", "goal-lifecycle"])
|
|
162
|
+
assert.match(logCalls[0].body.message, /Goal (?:active|started)/i)
|
|
163
|
+
assert.match(logCalls[1].body.message, /Goal cleared/i)
|
|
164
|
+
assert.ok(logCalls.every((entry) => !entry.body.message.includes("verify the installation")))
|
|
165
|
+
})
|
|
166
|
+
|
|
159
167
|
console.log()
|
|
160
168
|
|
|
161
169
|
const failed = results.filter((r) => !r.ok)
|