feat(plugin): add goal-loop example plugin - #46328
Open
charleneleong-ai wants to merge 4 commits into
Open
Conversation
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #27167
Type of change
What does this PR do?
Example plugin showing how to build /goal and /loop using the plugin SDK. No core changes, no SQLite, no auto-continuation. Just tools + slash commands.
Turn control
The goal tool supports optional turn limits:
maxTurns- agent stops after N turns and reports progressoneTaskPerTurn- agent does exactly one step per turn, then waitsThese are enforced by the slash command prompt, not hard-coded in the plugin. The agent checks
goal({ action: "status" })after each turn and stops when limits are reached.How it is different from other PRs
#45379 (thdxr) - core implementation with auto-continuation via event worker. Ours is a pure plugin SDK example, no core changes. Different scope.
#28610 (closed) - auto-continuation via idle events + client.prompt. Ours does not do that. User drives with slash commands.
#32743 (draft) - SQLite + core runtime changes. Ours is just file-based state in
.opencode/harness/.@bojackduy/opencode-loopd - full production plugin with subagents, TUI dashboard, scheduled goals, workspace serialization. Way more complex (1000+ lines vs our ~90). Ours is a minimal example for learning the plugin SDK. Theirs is a production goal engine.
Free models work because the slash command injects a prompt telling the agent to call the tool. No tool-calling needed from the model side.
How did you verify your code works?
Tests
Added
packages/plugin/src/examples/goal-loop.test.ts(bun:test, 10 tests):Checklist