Rust-core + JS-shim opencode plugin for Codex-style goal mode, /goal commands, persistence, and TUI — unbounded, always-visible Goal, clean single-source via git rev, real strict-schema validation, full TDD, DDD/Hex.
Replaces prevalentware/opencode-goal-plugin 0.1.39 (which had hard 25 wall, hidden Goal when tool output missed, sibling path, placeholder wire_is_valid()).
- Rust is the brain (
crates/goal-corecrates/goal-storecrates/napi-bridge— DDDGoalSnapshotmaxAutoTurns: None= ∞,GoalService::should_continueadvisory not wall,FileStorefile+KV atomic withgoals.jsondirect-edit fallback,Health3 checks) - Tiny JS just hands off (
src/server.tssrc/tui.tsx—/** @jsxImportSource @opentui/solid */,jsx: preserve) —src/server.tsis a normalPlugin(@opencode-ai/plugin) that imports Rust vianapi-rsand delegates all 8 tools (get_goal/create_goaletc.) to Rust;src/tui.tsxis@opentui/solid<box>/<text>that calls Rust forgoalStateFromSession+cachedGoalfallback.
Opencode plugins are JS/TS modules (~/.config/opencode/plugins/ or npm), so the JS shim is what opencode loads (exports: {"./server": "./dist/server.js", "./tui": "./src/tui.tsx"} same as prevalentware package.json:31).
- No 25 wall —
maxAutoTurns: null= ∞ (enterprise),budgetLimited/usageLimited→needsAttentionnotblocked— auto-continues whiletask.detail51bbyZ72jNVqFCzoJchpJCisrunning/waitingonlegatus_checkAllow (evidence-based, not counter-based), not justnoProgressTurns - Never hidden
Goal—GoalSidebarneverreturn null(fixesprevalentwaresrc/tui.ts:407if (!goal) return nullthat hidGoalwhengoals.jsonhadses_fa24...activebuttooloutput missed) — alwaysboxwith placeholder “No goal for this session. Run /goal here.” +Manus: 51bbyZ72jNVqFCzoJchpJC • PR #18 f85e4c8 • 33 hooks - No sibling
path—manus-hooks-enginef85e4c8→0d1c119viagit revpinned (rev = "0d1c1194f43...") +Cargo.lock+net.git-fetch-with-cli = true, notpath = "../manus-hooks-engine"(Manus blockedPR #7938939b8on this) - No placeholder
wire_is_valid()— realjsonschema::JSONSchema::compileforcontracts/governance-decision-v1.schema.jsonwithWireVerdictprojection (Ask->Observe,Deny->Escalate) soPR #180d1c119GovernanceDecisionV1Wirestrictly validates (was placeholder atsrc/wire.rs:60)
# from local (workspace needs absolute path in tui.json)
opencode plugin add /Users/gary.somerhalder/Documents/GitHub/opencode-goal-plugin-rust
# or npm (when published)
opencode plugin add opencode-goal-plugin-rustWorkspace tui.json must be absolute: {"tui": "/Users/gary.somerhalder/Documents/GitHub/opencode-goal-plugin-rust/src/tui.tsx"} (opencode resolves tui.json relative to ~/.config/opencode/).
cargo test --jobs 1 -- --test-threads=1 # 3 tests: unbounded, file_store direct edit, health 3 checks
bun install
bun run build # bun build ./src/server.ts --outdir ./dist --target bun --external @opencode-ai/plugin --external effect --external zod
cargo fmt --all && bunx prettier --write "src/**/*.{ts,tsx}"order: 100(beforeTodo125soGoalis top),sidebar_contentthat always returns abox(nevernull), showsStatus: activeTime: liveTokens: 41/∞Auto-continues: 80/∞Manus: runningPR #18 f85e4c8PR #79 38939b8- Uses
registerSlotV2arity branch (slot.length <= 1 ? slot({append,render}) : slot(name,render)) andthemeColorV2(text/defaultvs flattext) same asprevalentwaresrc/tui.ts:128but never hides
- Unbounded:
maxAutoTurns: null= ∞ — nousageLimitedwall at 25/80/120, onlyneedsAttentiontoast - DDD/Hex:
goal-corepure domain,goal-storefile+KV,napi-bridgeports,adaptersTUI/server - TDD:
cargo testforgoal-core/goal-store(unbounded, file direct edit, health 3 checks, wire real schema, 43 tests inmanus-hooks-engine0d1c119),bun testforsrc/tui.tsx - Manus:
legatus-ai/manus-hooks-enginePR #180d1c119+76943 tests +legatus-ai/manus-mcp-rustPR #7938939b8git+ single-sourcecargo test 52are first consumers (replacesprevalentwareimport)
MIT