[FEATURE]: plugin API for side-effect-free LLM calls #9486

Open
opened 2026-02-16 18:12:33 -05:00 by yindo · 0 comments
Owner

Originally created by @wakamex on GitHub (Feb 16, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When implementing a memory plugin, I noticed there’s no first-class way to make a plugin-internal LLM call that is side-effect-free (doesn’t pollute session history).

Current plugin SDK exposes hooks + ctx.client, but no dedicated internal LLM primitive. Plugins currently either maintain provider adapter logic themselves, or route through session endpoints and add guard/cleanup logic.

In my WIP plugin (https://github.com/wakamex/opencode-observational-memory), I currently use worker-session orchestration (session.create + session.prompt) with recursion/cleanup guards. In supermemory (https://github.com/supermemoryai/opencode-supermemory), similar framework constraints show up in a different form (session.summarize, session.promptAsync, and compaction context injection).

Request: add a plugin API like ctx.llm.generate(...) for internal calls with:

  • no transcript persistence by default
  • no normal chat/event hook recursion by default
  • OpenCode-native provider/model routing
  • optional per-call model override (for example, Observer model != chat model)

Related plugin API discussion: #10868 (this request is narrower and focused on internal LLM execution).

If this direction is approved, I can open a small PR for ctx.llm.generate first (text-only + isolated by default), with tests for no message persistence, no chat/event hook recursion, per-call model override.

Originally created by @wakamex on GitHub (Feb 16, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request When implementing a memory plugin, I noticed there’s no first-class way to make a plugin-internal LLM call that is side-effect-free (doesn’t pollute session history). Current plugin SDK exposes hooks + `ctx.client`, but no dedicated internal LLM primitive. Plugins currently either maintain provider adapter logic themselves, or route through session endpoints and add guard/cleanup logic. In my WIP plugin (https://github.com/wakamex/opencode-observational-memory), I currently use worker-session orchestration (`session.create` + `session.prompt`) with recursion/cleanup guards. In supermemory (https://github.com/supermemoryai/opencode-supermemory), similar framework constraints show up in a different form (`session.summarize`, `session.promptAsync`, and compaction context injection). Request: add a plugin API like `ctx.llm.generate(...)` for internal calls with: - no transcript persistence by default - no normal chat/event hook recursion by default - OpenCode-native provider/model routing - optional per-call model override (for example, Observer model != chat model) Related plugin API discussion: #10868 (this request is narrower and focused on internal LLM execution). If this direction is approved, I can open a small PR for `ctx.llm.generate` first (text-only + isolated by default), with tests for no message persistence, no chat/event hook recursion, per-call model override.
yindo added the discussion label 2026-02-16 18:12:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9486