OpenCode Goal Plugin

A session-scoped /goal command for OpenCode that keeps an agent working until it proves the goal is done.

Stars
★ 290
Last updated
25d ago
FARS reviewed
Nov 27, 2026
License
MIT
Primary language
JavaScript

At a glance

How it runs
Agent plugin / skill
Works with
Platform-specific
Cost
Free software; you pay for model usage
Setup effort
Low · running in minutes
You'll need
OpenCode 1.17+ or OpenCode 2 (tested 2.0.16–2.2.2)Node.js >=18 (CI covers 18, 20, 22, 24)npm package [email protected]Shell / CLINetwork accessLocal filesystem
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.

  1. A developer who wants OpenCode to fix failing tests unattended and verify the suite, starting from the failing suite in demo/.
  2. 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.
  3. Teams that want completion claims backed by checkable evidence, enabling completionAudit: true so a read-only child session independently reviews the structured claim.
  4. Users queueing several objectives in one session, such as building a parser, then writing tests, then shipping, via /goal sequence auto-promotion.
  5. 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.
  6. 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] --global

Restart 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-plugin

How do you use this agent?

Set a goal and let the loop run:

/goal fix the failing tests and verify the suite passes

Override 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 5

Inspect state and lifecycle history:

/goal status
/goal history

Pause, resume or revise the objective in place:

/goal pause
/goal resume
/goal edit fix the failing tests and also update the docs

Work 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 release

Discard every live goal in the session:

/goal clear

To 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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Verified present in source (3/3)
  • data-flow disclosure

What are this agent's strengths and limitations?

Pros
  • 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.
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Some gaps
70/ 100 5-point scale 3.5 / 5
Trust 21/29
Reliability 9/14
Adaptability 15/18
Convention 14/18
Effectiveness 6/13
Verifiability 5/8
Why each dimension lost points
Trust21 / 29 · 3.6/5

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.

Reliability9 / 14 · 3.2/5

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.

Adaptability15 / 18 · 4.2/5

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.

Convention14 / 18 · 3.9/5

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.

Effectiveness6 / 13 · 2.3/5

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.

Verifiability5 / 8 · 3.1/5

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.

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Nov 27, 2026 Reviewed revision 1ae8144a503d
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/william-ricchiuti-opencode-goal-plugin.svg)](https://followagents.com/en/agents/william-ricchiuti-opencode-goal-plugin)
<a href="https://followagents.com/en/agents/william-ricchiuti-opencode-goal-plugin"><img src="https://followagents.com/badge/william-ricchiuti-opencode-goal-plugin.svg" alt="FARS review"></a>

FAQ

Does it add model cost on top of OpenCode?
The plugin is MIT-licensed and free, but every auto-continued turn calls your configured OpenCode provider and is billed normally. Use maxCostUsd or a per-goal --max-cost cap; enforcement depends on the provider reporting cost, and a single response may overshoot the cap.
Where is goal state stored, and what if I open the same session twice?
By default it lives in per-session shards under <cwd>/.opencode/goals/state.json, with a .ledger.jsonl and a .lock lease beside each shard. A second process on the same session enters passive goal mode: ordinary chat keeps working, but /goal commands and tools report session_owned_elsewhere and nothing is read, written or auto-continued.
How does the independent completion audit decide?
With completionAudit: true the plugin spawns a default-deny child session allowed only read, glob and grep to review a structured completion claim; only [audit:approved] archives the goal. A rejection pauses the goal with stop reason audit rejected and the reason in /goal status, so you can fix the gap and /goal resume. Timeouts and provider errors follow failurePolicy, which defaults to reject.
Do goals resume automatically after a restart or upgrade?
No. Active goals rebuilt from the ledger load in the paused recovery state and need an explicit /goal resume. When moving from OpenCode 1 to 2, remove the legacy command.goal entry, and upgrade every process sharing the same goal state before resuming work.
Can I use it inside a Plan-mode workflow?
Yes. restrictedAgents defaults to plan: a goal set while Plan is active is recorded but held with stopReason plan agent active and zero auto-continues, and /goal resume starts it after you switch back. The single routed command turn can still be acted on by a non-compliant model, because OpenCode does not fully intercept command text.
Was this page helpful?
View on GitHub ↗ Install ↓

Host ecosystems

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts