Skip to content

feat(opencode): add compact connected ruv gateway - #152

Merged
pacphi merged 3 commits into
pacphi:mainfrom
robertelee78:feat/opencode-awesome
Aug 16, 2026
Merged

feat(opencode): add compact connected ruv gateway#152
pacphi merged 3 commits into
pacphi:mainfrom
robertelee78:feat/opencode-awesome

Conversation

@robertelee78

@robertelee78 robertelee78 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Make stock OpenCode a first-class Agentic Kit host for the rUv stack without placing the full Ruflo, Agentic QE, skills, and specialist catalogues into every initial model request.

This keeps the managed MCP servers connected while replacing their eager model-facing schemas with a compact, lazy discovery surface:

  • ak_ruflo_search / ak_ruflo_call
  • ak_aqe_search / ak_aqe_call
  • ak_skill_search / ak_skill_load
  • ak_agent_search / ak_agent_load
  • one receipt-owned ak-specialist dispatcher for the converted specialist catalogue
  • direct RuvNet Brain access for source-grounded research

Why

Stock OpenCode eagerly projects MCP schemas, skills, and subagent descriptions into the request. With the full Agentic Kit stack this creates a large initial-prefill tax before useful work begins.

Measured on the acceptance fixture:

Projection Tools Tool-schema bytes Request bytes
Eager stack 429 335,442 413,542
Compact stack 21 27,458 37,501

That is about a 91% reduction in the initial serialized request while preserving on-demand access to the managed capabilities.

Product boundaries

  • OpenCode-only host integration.
  • Provider- and model-neutral: no hf2q, Qwen, DeepSeek, Gemma, endpoint, or model identifiers.
  • No Claude or Codex production behavior changes.
  • Ruflo and Agentic QE remain connected MCPs; their direct schemas are blacklisted only from the model-facing eager projection.
  • RuvNet Brain remains directly available.
  • This does not add a general web-search layer or patch OpenCode itself.

Safety and lifecycle

  • Exact receipt ownership for generated plugins, dispatcher, and managed artifacts.
  • User-owned or edited files are preserved.
  • MCP/config collisions and post-sync drift fail closed.
  • Existing permission ask / deny behavior is enforced for both gateway calls and underlying operations.
  • Explicit direct-tool policy remains an operator opt-out from lazy capture.
  • JSONC/effective-config conflicts are reported rather than overwritten.
  • Setup, sync, status, host selection, teardown, and uninstall share the same lifecycle contract.
  • MCP timeout/abort forwards cancellation and reaps child processes.

Validation

  • pnpm check — PASS
  • Typecheck, ESLint, Markdown lint, syntax/build/package checks — PASS
  • Full test suite — PASS
  • Focused OpenCode gateway/lifecycle suite — PASS
  • Packed-package test — PASS
  • Stock OpenCode 1.18.18 fixture/E2E — PASS
  • Exact branch is one commit on current upstream main
  • Real stock-OpenCode + Agentic Kit + local OpenAI-compatible inference path exercised Ruflo search and memory_search continuation successfully with prefix-cache reuse

Review notes

The implementation deliberately keeps user agents native and limits lazy specialist projection to Agentic Kit-owned profiles. The specialist catalogue is embedded into the receipt-owned gateway bytes so user-scannable directories are not treated as trusted catalog input.

The per-request timer starts before the spawned MCP child finishes booting,
so the 80ms budget also had to absorb a node process cold start — routinely
exceeded on Windows CI runners (observed on windows-latest/node 22: the
recovery search timed out and JSON.parse hit 'RUFLO_SEARCH_FAILED...').
A 2000ms budget keeps every phase deterministic: the hang phase still times
out (the fake server never answers the first initialize) and the recovery
phase now has spawn headroom.
@robertelee78
robertelee78 force-pushed the feat/opencode-awesome branch from bfe15c8 to cad636e Compare August 16, 2026 20:27
… with the ADR-0031 lifecycle generalization

main's graduation work (ADR-0031 P3) replaced the opencode-shaped setup/sync
lifecycle loops with a shape-agnostic renderer (hostsWithLifecycle() +
renderApplyReport/printReportLine); this PR added a new opencode apply surface,
the compact lazy gateway (stack.gateway). Reconciled by keeping the generalized
loop + renderer and teaching lifecycle-render.mjs's renderOpencodeApply to emit
the gateway line, so pacphi#152's feature survives inside main's infrastructure.
Standardized the fatal skip-line on plugin/gateway/agents/skill/guidance across
both sides' tests. Full check green.
@pacphi
pacphi merged commit bbf2a81 into pacphi:main Aug 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants