anomalyco / anomalyco/opencode

defer_loading / tool-search support is absent, though #23298 was closed as completed

Open
#45,527 1 comment 1 reaction 1 assignee View on GitHub

@neriousy is already working on this.

Since Aug 27, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

#23298 ("Support Anthropic defer_loading passthrough in tool definitions") is closed as COMPLETED, but no part of the feature exists on dev.

grep, whole repo, origin/dev hits
defer_loading 0
deferLoading 0
toolSearch / tool_search 0
tool-search-tool 0
tool_reference 5, all in packages/core/test/provider-mistral.test.ts

No closing PR is linked, the issue carries no labels, and its last comment predates the close by five weeks. Two commenters there describe opencode as already auto-deferring tools behind ToolSearch — that behaviour is Claude Code's, not opencode's.

The capability is not missing downstream. @ai-sdk/anthropic already accepts both halves:

  • providerOptions: { anthropic: { deferLoading: true } } per tool — 3.0.114 dist/index.mjs:1509,1525, emitted as defer_loading
  • anthropic.tools.toolSearchBm25_20251119() to declare the search tool

What is missing is a seam in opencode to reach them: no config field, no tool.definition hook output field, and no way to declare a provider-defined tool at all — the registry wraps every tool with a local executor.

Consequence for anyone who wants deferral today: inject tool_search_tool_bm25_20251119 and defer_loading onto the wire below opencode. The model then calls a tool opencode never declared, the provider emits it without dynamic: true, and repairToolCall rewrites it (#45261) — mutating the assistant message and 400-ing the rest of the session against Anthropic's signed-block validation.

Happy to provide a patch: Option A from #23298 (deferLoading on the tool.definition hook output) plus a declaration path for the search tool.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.