Files
paperclip-docs/docs/reference/adapters/opencode.md
T
2535f6c99c Release docs for paperclip v2026.1012.0 (#149)
## Summary

Release docs for Paperclip **v2026.1012.0** (parent tag commit
`bba6a45f`).

- **Window:** `v2026.1005.0` → `v2026.1012.0`. That is 132 commits and
1,242 files, with no compare truncation.
- **Branch:** cut from `nightly` (`fe556e1`). Nightly had drafted
against parent master up to `abbd8800`. The release was cut from master
at `22a3ea3` (Oct 6), so nightly's last 39 commits are post-tag.
- **Review:** every changed page was checked by hand against a checkout
of the tag. The tag-accuracy gate was then re-run on the result.

**Headline doc changes:**
- **New pages:**
- [Assistant connections
(MCP)](docs/experimental/assistant-connections.md), with the [Assistant
MCP API](docs/reference/api/assistant-mcp.md) and [`paperclipai
mcp`](docs/reference/cli/mcp.md) references
- [Saved connection
instructions](docs/connectors/connection-instructions.md)
  - [Check AI account usage](docs/connectors/ai-usage.md)
- [Task-pinned AI routing](docs/experimental/task-pinned-ai-routing.md)
  - [Neon](docs/connectors/neon.md)
- **Breaking changes documented:**
- Restore locks moved to SQLite (#14869). [Update
Paperclip](docs/how-to/update-paperclip.md) now has a "stop everything
first" upgrade and rollback flow.
- Stored tool grants are enforced as written (#14915). This is covered
in the [Tool Gateway API](docs/reference/api/tool-gateway.md) and the
[Access model](docs/connectors/access-model.md).
- **Other release coverage:**
- The connection-instructions contract for HTTP and process adapters
(`connectionInstructions`, `PAPERCLIP_CONNECTION_INSTRUCTIONS_FILE`).
- Much shorter default instructions, and default config grants for new
agents.
  - The `update_skill` tool.
  - Aggregator accounts gathered into one catalog.
  - Chat-first navigation and the combined inbox.
  - The rebuilt New task dialog.
  - "Model at capacity" and "Model unavailable".
  - Sonnet 5.5, GPT-6.1 Sol and new harness pins.
- The supported remote Codex range, and Codex resuming after a server
restart.
  - Watchdog thresholds of 5 and 15 minutes.
  - `tool_discovery_busy`.
  - The Docker provider pack.
- A changelog entry, and 75 pages stamped `paperclip_version:
v2026.1012.0`.

### ⚠ Post-tag leaks removed

These document parent `master` features that are **not in
v2026.1012.0**. They stay on `nightly` for the next release.

- **Pages removed (7):**
  - `administration/agent-commentary.md` (b508a05c)
  - `guides/org/agent-identity.md` (a590ab76)
  - `reference/cli/runtime.md` (a6306ba6)
  - `connectors/custom-model-providers.md` (9f7057e1)
  - `connectors/enterpret.md` (88ff98b8)
  - `connectors/superagent.md` (8cbd21b3)
  - `connectors/telem.md` (f77fcbf4)

Their nav entries and catalog rows are already removed, and no page
links to them.
- **Reverted to `main`:**
- `roles-and-permissions.md`, `administration/company.md` and
`add-a-human-teammate.md`. Operator's 14 default keys come from
582911ba.
- The costs guide and `api/costs.md`. Durable accounting, by-user costs
and per-account quota come from 799e4d55, eab93fd4 and 892b0b36.
  - `adapters/cursor-local.md` (a6306ba6)
- `deploy/database.md` and `deploy/environment-variables.md`, which
carried agent identity and complaints.
  - `browser-use-cloud.md`
  - `back-up-and-restore-a-company.md`
- **Sections trimmed:**
- The assistant MCP pages now match the tag:
`paperclip:read`/`paperclip:write`/`offline_access` only, 10 direct
tools, and no file transfer (2d0c1381, 99a9de99).
- Server-host sign-in for Anthropic, OpenAI and xAI is back to the
terminal-command flow (e38d6d16, 2ca0d26a).
  - OpenRouter is OpenCode-only again (9f7057e1).
  - Requested vs granted OAuth scopes are removed (ea8e6861).
  - PR review waits are removed (228f0e28).
- Historical-question reminders and "No project" in the composer are
removed (faa8e452, ee3c728b).
  - Plugin lifecycle hooks are removed (1cebdd4c).
  - Cursor on the Runner is removed (a6306ba6).
  - The aggregator "Waiting for sign-in" status is removed.
  - Source links pinned to post-tag commits now point at the tag commit.

### ⚠ Drift

Checked against the tag:
- **High:** the `operator` default grants were **real** drift. Fixed by
reverting the post-tag tables.
- **High:** the agent-identity paths and env vars were real at nightly
but are post-tag. They're removed (see above).
- **High:** `PAPERCLIP_WORKSPACE_GIT_SCAN_*`,
`PAPERCLIP_WORKSPACE_GIT_SNAPSHOT_TIMEOUT_MS`, `PAPERCLIP_RUNNER_API_*`
and `PAPERCLIP_CLOUD_CONNECTOR_*` are known false positives. They are
read through helpers the checker doesn't scan.
- **High:** `PAPERCLIP_ID_CONNECTOR_*` is documented as retired, which
is intentional.
- Verify: the `/accounting/*`, `costs/by-user` and
`agents/{id}/identity` routes are no longer documented, because they're
post-tag.
- Verify: `agent-avatars`, `companies/import/transfers*` and
`chats/{agentRef}` are known param/constant-registration false
positives.

### ⚠ Verification Failures / review notes

- **`reference/cli/mcp.md`:** the gate flags `--device` and `--url`.
This is a false positive: both are `requiredOption`s in
`cli/src/commands/mcp.ts` at the tag.
- **New pages the gate can't auto-confirm:** each was verified by hand
at the tag. They are assistant-connections, task-pinned-ai-routing,
ai-usage and connection-instructions.
- **`neon.md`:** says "open **Connectors**", following the Supabase
guide. The parent's notes call the screen "Apps → Browse".
- **`connection-intents.md`:** the AgentMail card details ("shares the
key with every person in the company", "resumes after reload") are only
partly confirmed.
- **`task-chat.md`:** the queued-message details came from an earlier
nightly and couldn't be traced to a specific commit.
- **Upstream inconsistency:** the Codex adapter's in-code doc string
(`codex-local/src/index.ts:181`) contradicts the code about the bypass
flag. Our docs follow the code.

### Screenshots

**126 of 350 screenshots are stale** across 26 routes (see
`SCREENSHOTS_PENDING.md`). None were recaptured in this PR.

### Other open PRs

- **#143** (Browser Use Cloud + Neon, targets `main`): both are now
covered here. Suggest closing it.
- **#140** (Enterpret, targets `main`): Enterpret is post-tag
(88ff98b8). Suggest retargeting it to `nightly` or closing it.

## Checks

- [x] `npm run docs:build`
- [x] `npm run docs:test` (all suites)
- [x] `sync:lint-links` and `sync:verify-nav`. The only orphans are the
7 pages above plus 4 intentional ones.
- [x] `check-tag-accuracy` re-run. The only remaining flags are the ones
explained above.
- [x] Removed the 7 post-tag pages listed above (`cbece5b`), plus fixes
from a second, independent verification pass
- [ ] After the squash-merge, run `node scripts/sync/realign-nightly.mjs
release/v2026.1012.0 --push`, then flip `nightly`'s `.sync-state.json`
back to `branch_mode: nightly`.
- [ ] Confirm the `docs/v2026.1012.0` tag and that docs.paperclip.ing
serves the new changelog entry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: DevRel Gemini <[email protected]>
Co-authored-by: Paperclip <[email protected]>
Co-authored-by: Dotta <[email protected]>
Co-authored-by: ClaudeCoder <[email protected]>
2026-10-13 13:45:13 +02:00

9.6 KiB

paperclip_version, seo_title, seo_description
paperclip_version seo_title seo_description
v2026.1012.0 OpenCode Adapter Run OpenCode on the Paperclip host when you want provider and model routing in OpenCode's own format, plus session resume across heartbeats.

OpenCode

opencode_local runs OpenCode on the same machine as Paperclip. Use it when you want provider/model routing in OpenCode's provider/model format and session resume across heartbeats.


When To Use

  • You already use OpenCode locally.
  • You want to use provider/model routing — for example anthropic/claude-sonnet-4-5 or openai/gpt-5.2-codex.
  • You want Paperclip to resume OpenCode sessions across heartbeats via --session.

When Not To Use

  • The runtime lives behind a webhook or API. Use OpenClaw Gateway or HTTP.
  • You only need a one-shot shell command or script. Use Process.
  • OpenCode CLI is not installed on the machine.

Common Fields

Field Required Notes
cwd no Absolute working directory. Recommended. Created when permissions allow; otherwise falls back to the process working directory.
model yes OpenCode model id in provider/model format (e.g. openai/gpt-5.2-codex, anthropic/claude-sonnet-4-5).
variant no Provider-specific reasoning/profile variant passed as --variant. Accepts minimal, low, medium, high, xhigh, max.
dangerouslySkipPermissions no Injects a temporary runtime config with permission=allow, so every tool and connection runs without approval prompts. Defaults to true for unattended Paperclip runs.
promptTemplate no Run prompt template.
instructionsFilePath no Absolute path to a Markdown instructions file prepended to the run prompt.
command no Defaults to opencode. Override only for a non-default executable path.
extraArgs no Extra CLI arguments appended to the OpenCode invocation.
env no Environment variables. Secret refs supported.
timeoutSec no Run timeout in seconds. 0 means no timeout.
graceSec no SIGTERM grace period before a forced stop.

Note: Paperclip requires an explicit model value for opencode_local agents. Use opencode models to list valid options in provider/model format.


Session Persistence

OpenCode sessions are resumed with --session when the stored session cwd matches the current cwd. If the directory moved, a fresh session starts.


Execution Details

  • Runs are invoked as opencode run --format json ....
  • Model selection is passed via the --model CLI flag.
  • OPENCODE_DISABLE_PROJECT_CONFIG=true is set automatically to prevent OpenCode from writing config into the project directory.
  • When dangerouslySkipPermissions is enabled (the default for unattended runs), Paperclip copies your existing opencode config into a temporary XDG_CONFIG_HOME, sets permission=allow in that copy's opencode.json, and points the run at it. That puts OpenCode in full-auto mode for all tools and connections, so unattended runs never stall on approval prompts, and your real config is never touched. Any permission rules from your own config are replaced in that temporary copy, so set dangerouslySkipPermissions to false if you need OpenCode to honour them. The env overrides below (PAPERCLIP_OPENCODE_PROVIDERS, PAPERCLIP_OPENCODE_SMALL_MODEL) are written into this same temporary file, so they apply only when dangerouslySkipPermissions is on and the target runs locally.

Custom Providers And Gateways

Set these environment variables on the Paperclip server (process env, or the agent's env) to route OpenCode through your own OpenAI-compatible provider or LLM gateway. Paperclip reads them server-side and writes them into the temporary opencode.json described above, so they take effect only when dangerouslySkipPermissions is enabled and the target runs locally.

PAPERCLIP_OPENCODE_PROVIDERS

A JSON object in OpenCode's provider shape — a map of provider id to provider definition. Paperclip merges these entries into the provider block of the temporary opencode.json (your existing providers are preserved; same-named keys are overwritten). Entries whose value is not an object are skipped, and invalid JSON is ignored — both cases surface as a run note rather than failing silently.

This lets you expose a custom or remote OpenAI-compatible provider (for example an EU LLM gateway that serves /v1) and then reference its models in model using the usual provider/model format. Because OpenCode only resolves a --model provider/model when that model exists in the provider's models map, give each provider an explicit models map listing the ids you intend to use.

You can keep secrets out of the JSON with OpenCode's {env:VAR} placeholders. Paperclip expands them server-side from the run env (then the process env) before writing the file; any placeholder it cannot resolve is left intact for OpenCode to resolve itself.

{
  "my-gateway": {
    "npm": "@ai-sdk/openai-compatible",
    "name": "My EU Gateway",
    "options": {
      "baseURL": "https://gateway.example.com/v1",
      "apiKey": "{env:MY_GATEWAY_KEY}"
    },
    "models": {
      "gpt-5.2-codex": {},
      "gpt-5.2-codex-small": {}
    }
  }
}

With the above set, an agent can use "model": "my-gateway/gpt-5.2-codex".

Tip: OpenCode validates configured models against opencode models by default. For gateway-routed models that never appear in that listing, set OPENCODE_ALLOW_ALL_MODELS=true so Paperclip skips the availability probe (the provider/model format is still enforced).

PAPERCLIP_OPENCODE_SMALL_MODEL

Pins OpenCode's auxiliary "small" model — used for helper tasks such as session-title generation — by writing small_model into the temporary opencode.json. OpenCode otherwise falls back to a built-in per-provider default; when you repoint a provider at a gateway that does not serve that exact default, the helper call fails and aborts the run. Set this to a model your gateway actually serves to keep every call on a supported model.

PAPERCLIP_OPENCODE_SMALL_MODEL=my-gateway/gpt-5.2-codex-small

Models

OpenCode supports multiple providers. Common ids:

Id Provider
openai/gpt-5.2-codex OpenAI (default)
openai/gpt-6-astra OpenAI
openai/gpt-6.1-sol OpenAI
openai/gpt-6-sol OpenAI
openai/gpt-6-luna OpenAI
openai/gpt-5.6-sol OpenAI
openai/gpt-5.6-terra OpenAI
openai/gpt-5.6-luna OpenAI
anthropic/claude-opus-5-5 Anthropic
anthropic/claude-opus-5 Anthropic
anthropic/claude-fable-5-1 Anthropic
anthropic/claude-sonnet-5-5 Anthropic
anthropic/claude-sonnet-5 Anthropic
google/gemini-3.8-flash Google
xai/grok-4.7 xAI
openai/gpt-5.5 OpenAI
openai/gpt-5.4 OpenAI
openai/gpt-5.4-mini OpenAI
openai/gpt-5.2 OpenAI
openai/gpt-5.1-codex-max OpenAI
openai/gpt-5.1-codex-mini OpenAI

Run opencode models for the authoritative list on your machine.

You are not limited to that list, though. OpenCode only resolves a --model provider/model when the model id exists in that provider's models map, so an id the bundled catalog does not carry — a model released after the catalog shipped, or a routing variant such as openai/gpt-oss-120b:nitro — would otherwise be rejected with Model not found even though the provider serves it.

To spare you that, Paperclip registers whatever you put in model into the temporary opencode.json described above, adding it to that provider's models map when it is not already there. Models the catalog already knows keep all of their metadata, and an explicit definition — from your own OpenCode config or from PAPERCLIP_OPENCODE_PROVIDERS — always wins, so Paperclip never overwrites one. When it does add an entry, you will see a run note saying it registered the model. Like the rest of the runtime config on this page, this applies when dangerouslySkipPermissions is enabled and the target runs locally.

Before a run, Paperclip pre-flights your configured model against opencode models. If the model is in the returned list, the run proceeds. If the list comes back non-empty but without your model, Paperclip refreshes OpenCode's on-disk catalog once (opencode models --refresh) and re-checks before giving up — long-lived hosts can otherwise report a stale catalog while the provider already serves the model. If it's still missing, the run is rejected with Configured OpenCode model is unavailable: <model>, listing a sample of the ids that are available so you can correct the model value.

The pre-flight is a best-effort guard, not a gate. If opencode models can't run — it times out or errors — or returns no models at all, Paperclip logs a warning and proceeds with your configured model rather than blocking the run, since the real invocation is authoritative. (OPENCODE_ALLOW_ALL_MODELS=true skips the probe entirely, as described above.)


Example

{
  "adapterType": "opencode_local",
  "adapterConfig": {
    "cwd": "/Users/me/projects/paperclip-workspace",
    "model": "anthropic/claude-sonnet-4-5",
    "variant": "high",
    "promptTemplate": "You are the engineering lead. Work carefully and report progress.",
    "env": {
      "ANTHROPIC_API_KEY": {
        "type": "secret_ref",
        "secretId": "anthropic-key",
        "version": "latest"
      }
    },
    "timeoutSec": 300,
    "graceSec": 15,
    "dangerouslySkipPermissions": true
  }
}

Next Steps