oh-my-goal
v1.0.0
Published
Codex-style /goal autonomous loop plugin for OpenCode.
Maintainers
Readme
oh-my-goal
Codex-style /goal autonomy for OpenCode.
Set one objective. Let the agent keep going until the work is done, blocked, paused, or out of budget.
Install · Usage · How It Works · Contributing
If this makes your OpenCode workflow better, please consider giving the repo a star.
Why
OpenCode already has powerful automation plugins. Many of them are built for advanced orchestration: multiple agents, metrics, scopes, model maps, verification plans.
oh-my-goal is intentionally smaller.
/goal fix the flaky login testThat is the interface. The plugin stores the goal, injects a continuation prompt whenever the session goes idle, and keeps the agent moving until there is a concrete stop condition.
Features
- One-line autonomy: start with
/goal <objective>. - Project-local state: stores goal state in
.opencode/goal.json. - Continuation loop: uses
session.idleto push the agent into the next concrete action. - Completion detection: watches for
GOAL_ACHIEVED:andGOAL_BLOCKED:markers. - Budget guardrails: tracks token usage and warns near the configured budget.
- Compaction-safe context: preserves goal state through OpenCode session compaction.
- No model orchestration: plays nicely beside other OpenCode tools because it only manages goal continuation.
Install
npm i -g oh-my-goalAdd it to opencode.json:
{
"plugin": ["oh-my-goal"]
}For local use before publishing, build the repo and run OpenCode from this project. The repository includes:
.opencode/plugins/oh-my-goal.jsto load the built plugin locally.opencode/commands/goal.mdso the TUI registers/goal
Usage
Start a goal:
/goal fix the login redirect bugCheck or control the active goal:
/goal status
/goal pause
/goal resume
/goal clearOverride the default token budget:
/goal raise payment module test coverage to 80% --token-budget 100000Commands
| Command | Behavior |
| ------------------- | ----------------------------------------------------- |
| /goal <objective> | Create a new goal and start the loop |
| /goal status | Show current objective, status, budget, and iteration |
| /goal pause | Pause the loop without deleting goal state |
| /goal resume | Resume a paused goal |
| /goal clear | Delete .opencode/goal.json and stop the loop |
How It Works
The plugin is deliberately simple:
/goal <objective>
-> write .opencode/goal.json
-> on session.idle, inject continuation prompt
-> on message.updated, scan for stop markers and token usage
-> preserve goal context during compactionWhen a goal is pursuing, each idle event injects an active-goal check into the session. The agent must concretely decide whether the original objective is complete. If not, it continues immediately.
The loop stops when:
- The assistant emits
GOAL_ACHIEVED: <summary> - The assistant emits
GOAL_BLOCKED: <reason> /goal pauseor/goal clearis used- The token budget or iteration limit is reached
State File
.opencode/goal.json follows this shape:
{
"objective": "fix the login redirect bug",
"status": "pursuing",
"created_at": "2026-05-05T10:00:00.000Z",
"updated_at": "2026-05-05T10:02:00.000Z",
"token_budget": 50000,
"tokens_used": 12400,
"iteration": 3,
"max_iterations": 100,
"budget_warning_sent": false,
"history": [
{
"iteration": 1,
"summary": "Injected continuation prompt.",
"status": "in_progress",
"created_at": "2026-05-05T10:01:00.000Z"
}
]
}Development
npm ci
npm run check
npm run buildQuality gates:
npm run typechecknpm run lintnpm run format:checknpm audit --omit=dev
Contributing
Issues and pull requests are welcome. See CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.
License
Apache-2.0. See LICENSE.
