opencode-plugin-goal
v0.1.0
Published
Persistent /goal workflows for OpenCode.
Maintainers
Readme
opencode-plugin-goal
Persistent /goal workflows for OpenCode.
opencode-plugin-goal emulates Codex-style persistent goals in OpenCode. It registers a /goal slash command through OpenCode's plugin config hook, persists per-session goal state, exposes goal tools to the model, and queues conservative continuation turns while a goal remains active.
Install
After publishing to npm, add the package to your OpenCode config:
{
"plugin": ["opencode-plugin-goal"]
}For local development from this repository, use:
{
"plugin": ["./src/index.ts"]
}Restart OpenCode after changing plugin config.
Usage
/goal fix the failing tests and keep working until they pass
/goal --budget 100k migrate auth to JWT and update tests
/goal status
/goal pause
/goal resume
/goal clearBehavior
/goal <objective>creates or replaces the session goal and starts work./goal --budget 100k <objective>creates a goal with an approximate token budget./goal statusshows the current goal./goal pausestops automatic continuation./goal resumereactivates a paused or blocked goal./goal clearclears the session goal.get_goallets the model inspect the goal.update_goallets the model mark the goalcompletedorblocked.
Goal state is stored under .opencode/goals/state.json in the active project directory.
How it works
- The plugin adds
command.goalduring OpenCode startup, before the command registry is initialized. - The
command.execute.beforehook rewrites/goalinvocations into goal-management prompts. - The
experimental.chat.system.transformhook injects active-goal instructions into model turns. - The
experimental.session.compactinghook preserves active goal context through compaction. - The
eventhook watches session idle/status and message events to account usage and queue continuation turns.
Continuation is intentionally conservative. If a continuation turn produces no tool calls, the plugin does not keep auto-continuing, which avoids runaway self-chat loops.
Development
bun run check
npm pack --dry-runManual npm release
npm login
npm pack --dry-run
npm publishLimitations
- This is a plugin-level emulation, not native OpenCode runtime support.
- Token accounting is approximate and based on OpenCode message events.
- Management commands still produce a concise assistant acknowledgement turn.
