OpenCode Goal Plugin
A session-scoped /goal command for OpenCode that keeps an agent working until it proves the goal is done.
- Source repo
- william-ricchiuti/OpenCode-goal-plugin
- Stars
- ★ 290
- Last updated
- 25d ago
- FARS reviewed
- Nov 27, 2026
- License
- MIT
- Primary language
- JavaScript
- FA score
- 70/100 · Some gaps
At a glance
- How it runs
- Works with
- Platform-specific
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- A developer who wants OpenCode to fix failing tests unattended and verify the suite, starting from the failing suite in demo/.
- Not a fit if
- Users on OpenCode 2.2.1+ who only need the built-in /goal
- Teams needing goal state synced across machines — state is local only
- Production teams unwilling to run experimental-hook plugins on a pinned version
- Maintenance
- Commits in the last 30 dayslast commit 2026-11-02
- Source review
- 70/100 · Some gaps
What does this agent do, and when should you use it?
opencode-goal-plugin is an OpenCode plugin that adds a session-scoped /goal workflow to both OpenCode 1 and OpenCode 2. You state an objective, and on every idle the plugin sends a continuation prompt carrying the remaining budget until the assistant ends with an evidence-backed [goal:complete], a concrete [goal:blocked], or a limit on turns, duration, context tokens or API cost. Persistence is fail-closed: atomic state writes, an append-only lifecycle ledger, and a per-session lease built on immutable claim files, with corrupt or unknown layouts quarantined instead of rewritten. An optional independent auditor spawns a read-only child session (read, glob, grep) that must answer [audit:approved] before a goal is archived. The plugin also registers agent-facing goal tools, supports multiple goals and ordered sequences, and holds goals while a planning-only agent such as Plan is active. The project is in maintenance mode because OpenCode ships its own /goal from v2.2.1.
After a user types /goal <objective> (optionally with --max-turns, --max-minutes, --max-tokens, --max-cost, --success, --constraints, --mode), the plugin takes over the turn through command.execute.before on OpenCode 1 or its own registered command via ctx.command.transform on OpenCode 2, replacing the raw argument with a generated work instruction. State lands in <cwd>/.opencode/goals/state.json.sessions/<sha256(sessionID)>/state.json beside a state.json.ledger.jsonl ledger and a state.json.lock.claims-v2/ lease directory. On each idle it re-verifies the session is still idle and not superseded by a human message, newer assistant turn, Plan-agent switch or provider error, then sends a continuation prompt with the remaining budget. When the assistant ends with [goal:complete], the plugin requires a non-empty adjacent [goal:evidence] line, optionally runs the built-in child-session auditor (reject by default, including on timeout), then archives or pauses the goal as audit rejected. Reporting commands like status, history, list, pause and clear are rewritten into escaped read-only control turns whose tool calls are rejected by tool.execute.before.
- A developer who wants OpenCode to fix failing tests unattended and verify the suite, starting from the failing suite in demo/.
- A team that must cap spend on long runs: --max-cost 5 or maxCostUsd pauses the goal when cumulative OpenCode-reported API cost reaches the cap.
- Teams that want completion claims backed by checkable evidence, enabling completionAudit: true so a read-only child session independently reviews the structured claim.
- Users queueing several objectives in one session, such as building a parser, then writing tests, then shipping, via /goal sequence auto-promotion.
- Anyone working under a planning-only agent: goals set in Plan mode are recorded but held (stopReason plan agent active) until /goal resume after switching back.
- Long unattended runs where you want the session title to show ▶/⏸/⛔ status with turn count, elapsed time and token usage via sessionTitleStatus.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
npx opencode-goal-plugin
- Config files
~/.config/opencode/opencode.json
How do you install or deploy this agent?
OpenCode installs npm plugins from config itself, so there is no npm install step. Add the plugin with a pinned version to opencode.json (the user config at ~/.config/opencode/opencode.json or a project-local file).
For OpenCode 2 the plugin registers its own command:
{
"plugins": ["[email protected]"]
}For OpenCode 1 you also declare the goal command:
{
"plugin": ["[email protected]"],
"command": {
"goal": {
"description": "Set a session-scoped goal and auto-continue until complete.",
"template": "$ARGUMENTS",
"agent": "build"
}
}
}Or let the CLI add the plugin entry:
opencode plugin [email protected] --globalRestart OpenCode after editing the config. Pinning matters: OpenCode resolves an unpinned latest entry once and keeps that cached copy indefinitely. The bundled verification script warns when the cache lags the package:
npx opencode-goal-pluginHow do you use this agent?
Set a goal and let the loop run:
/goal fix the failing tests and verify the suite passesOverride limits for one goal and add criteria and constraints:
/goal ship the release --success "tests pass and changelog updated" --constraints "do not touch the public API" --max-turns 20 --max-cost 5Inspect state and lifecycle history:
/goal status
/goal historyPause, resume or revise the objective in place:
/goal pause
/goal resume
/goal edit fix the failing tests and also update the docsWork with several goals or an ordered queue:
/goal add write the migration guide
/goal list
/goal focus 1
/goal sequence build the parser; write the tests; ship the releaseDiscard every live goal in the session:
/goal clearTo finish, the assistant must put a non-empty evidence line immediately before the marker:
[goal:evidence] ran npm test (83 passing), verified the build output
[goal:complete]To keep the plugin alongside the built-in /goal on OpenCode 2.2.1+, set commandName (for example "objective") and drive it with /objective.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- data-flow disclosure
What are this agent's strengths and limitations?
- Fail-closed persistence: atomic writes, an append-only ledger and immutable claim-file leases mean a second process on the same session goes passive instead of writing divergent state.
- Completion requires an adjacent evidence line, and an optional independent read-only child session (read/glob/grep only) must answer [audit:approved]; verifier failures reject by default.
- A mutation contract runs 94 named regressions one at a time and fails the release unless a test catches each one, covering fail-open audits, lost leases and resurrected goals.
- Per-goal budgets for turns, minutes, context tokens, USD cost, cooldown, no-progress and no-tool-call windows, plus multiple goals, ordered sequences and Plan-mode holds.
- One entrypoint serves both OpenCode 1 and OpenCode 2 through src/v2-bridge.js, with CI on Node 18–24 plus macOS and Windows for filesystem-sensitive tests.
- Compatibility was checked on real hosts (OpenCode 1.17.15, 1.18.25, 1.18.29) against several providers with persisted-state grading, and there are local smoke scripts that need no paid model.
- Maintenance mode only: OpenCode ships a built-in /goal from v2.2.1, and this project takes bug and security fixes only, no new features.
- It relies on experimental OpenCode hooks, and the README explicitly asks you to re-test against your exact OpenCode build and provider/backend stack.
- Goal state is local (default inside the project at .opencode/goals/) and never synced across machines; every process sharing a session must run the current release for lease handoff.
- Marker quality is still model-dependent when auditing is off, and the built-in verifier can only inspect statically with read/glob/grep, never run commands.
- Setup has version-specific traps: pin the version, remove the legacy command.goal entry on OpenCode 2, and use a filesystem that supports hard links and preserves timestamps.
- Default limits (10 turns, 15 minutes, 200,000 context tokens) are tight for long work, and the documented live-provider matrix covers only a handful of models.
How does this agent compare with similar options?
OpenCode's own /goal (v2.2.1 and later) is the direct alternative named in the source: if the built-in command is enough, you do not need this plugin. This plugin adds evidence-gated completion, an independent read-only verifier, multiple goals and ordered sequences, configurable turn/time/token/cost limits, agent tools and Plan-mode holds. Setting commandName lets both run per session.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| OpenCode Goal Plugin This agent | 70 · Some gaps | Agent plugin / skillFree + model costs | ★ 290 | 25d ago | JavaScript | — |
| EOC — Everything OpenAI Codex Workflow OS | 64 · Some gaps | Agent plugin / skillFree + model costs | ★ 77 | 6mo ago | JavaScript | Codex |
| MonoCode | 71 · Some gaps | Desktop appFree | ★ 4.2k | 15d ago | Rust | Codex · Claude Code |
| LiteLLM Agent Control Plane | 50 · Major gaps | Self-hosted serviceFree + model costs | ★ 1.3k | 5mo ago | Rust | — |
How does FollowAgents rate this agent?
Why each dimension lost points
SECURITY.md explicitly lists trust boundaries, untrusted inputs, persisted data and residual risk, and README states state is written to .opencode/goals/state.json project-locally by default, so data-flow transparency is strong (3). On least privilege, the independent auditor defaults to read/glob/grep only, but the plugin itself sends continuation prompts via the SDK and can trigger already-authorized tools; it is an orchestration layer, not a sandbox, so 2. On user confirmation, a goal starts only from an explicit /goal command and human messages pause auto-continue, but unattended auto-continuation repeatedly runs tools, so 2. On sensitive data, files use owner-only permissions and logs rotate, but the docs state there is no encryption at rest and retained generations still contain sensitive task text, so 2. On dependency security, there is a single production dependency (zod 4.6.7) and CI runs npm audit --omit=dev --audit-level=high, but no lockfile content or scan results are shown, so 2. On external effects, auto-continuation multiplies opportunities for already-authorized tools to run, which SECURITY.md warns about, but there is no built-in rollback or revocation, so 2. On rollback, /goal pause, /goal clear and /goal resume plus a lifecycle ledger exist, but clear discards live goals and saved status and recovery depends on the ledger, so 2. On source attribution, LICENSE and package.json name William Ricchiuti and README states independent implementation with no parity or endorsement claim, but publisher identity is unverified by FollowAgents, so 2.
On self-consistency, README install, commands and limits table broadly match package.json scripts and CI workflows, but the README is truncated and sections such as Plugin-level defaults and Limitations are not fully present in the packet, so 2. On dependency availability, Node >=18 and OpenCode >=1.17.15 are declared and CI covers Node 18/20/22/24 plus three-OS filesystem tests, but experimental OpenCode hooks and provider/backend quirks are explicitly flagged for re-testing, so 2. On failure messages, README says unknown, missing or invalid flags are rejected with a helpful error and audit failures reject by default, but no concrete error text samples are shown, so 2.
On audience and scenarios, README covers multiple goals, ordered sequences, budgets, Plan mode, a demo and a multi-provider matrix for ordinary and unattended use, so 3. On capability boundaries, it clearly states the plugin is an orchestration layer not a sandbox, grants no new tool permissions, auditing is not cryptographic attestation, and the project is maintenance-only, so 3. On trigger precision, /goal commands and [goal:complete]/[goal:blocked] markers require strictly adjacent evidence, but correctness depends on model-emitted markers and OpenCode 2.2.1+ built-in /goal conflicts unless commandName is changed, so 2. On environment fit, cross-platform and multi-Node support is declared, but it relies on experimental hooks, provider cost reporting is uncertain, and strict-template backends need system-message merging, so 2.
On information architecture, README has install, usage, how-it-works, limitations and compatibility sections, but the file is truncated and linked targets (docs/compatibility.md, CHANGELOG.md) are not present in the packet, so 2. On install notes, separate OpenCode 1 and 2 configs, version pinning, upgrade and cache caveats are given thoroughly, so 3. On naming stability, the /goal command name collides with the built-in command and requires commandName to avoid, and historical command presentation behavior changed, so 2. On examples and FAQ, copy-pasteable examples and a demo exist but there is no dedicated FAQ section, so 2. On known limitations, README and SECURITY.md clearly list maintenance mode, experimental hooks, auditing not being proof, and cost-reporting dependence, so 3. On license, the MIT LICENSE is complete and matches package.json, so 3. On versioning and changelog, package.json is 0.11.4 and README references a changelog and 0.11.x fixes, but CHANGELOG.md content is not in the packet, so 2. On maintenance responsibility, SECURITY.md states maintenance mode, latest-version-only fixes and no response-time commitment, and the author is named, but publisher identity is unverified, so 2.
On output usability, /goal status, history and list provide structured state and evidence display, but README notes custom-command output may be summarized or paraphrased by the model, so 2. On marginal value, OpenCode 2.2.1+ ships a built-in /goal and this plugin is in maintenance mode, retaining only evidence-gated completion, independent auditing, multiple goals and budgets as increments, so marginal value is limited for most users, so 1. On cost-benefit, auto-continuation consumes tokens and API cost with defaults of 10 turns/15 minutes/200k tokens and cost cap off by default, requiring user configuration, so 1.
On claim traceability, README cites specific versions, PRs, CI workflows and test scripts, but some linked targets are not present in the packet, so 2. On cross-source corroboration, README, SECURITY.md, package.json, CI workflows and test files mutually support testing and security claims, but no actual run results are provided, so 2. On fact/inference separation, README distinguishes tested from needs-retest and SECURITY.md separates controls from residual risk, though parts of the compatibility matrix are historical version records, so 2.
- OpenCode 2.2.1+ ships a built-in /goal and this plugin takes over that command name by default; set commandName to run both, otherwise the built-in command will not run.
- The project is in maintenance mode with bug and security fixes only and no new features; long-term reliance should consider alternatives.
- The plugin relies on experimental OpenCode hooks and SDK; README explicitly requires re-testing against the exact OpenCode build and provider/backend stack, and static review cannot confirm runtime behavior.
- Auto-continuation multiplies opportunities for already-authorized tools to run; SECURITY.md advises against unattended goals in untrusted repositories or sessions and recommends enabling the independent auditor with its default fail-closed policy.
- The cost cap is off by default, so auto-continuation can incur unexpected API charges; set maxCostUsd or --max-cost explicitly.
- Persisted state has no encryption at rest and rotated ledger generations still contain sensitive task text; scrub secrets and paths before sharing logs or state files.
- Publisher identity is not verified by FollowAgents; verify the npm package and repository provenance before installing.
FAQ
Does it add model cost on top of OpenCode?
Where is goal state stored, and what if I open the same session twice?
How does the independent completion audit decide?
Do goals resume automatically after a restart or upgrade?
Can I use it inside a Plan-mode workflow?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.