You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: expose the running OpenCode version, provider and model in the agent env block #51909
I have verified this feature I'm about to request hasn't been suggested before.
Note
After creation, a related prior request surfaced (#9065 — model identity only, partially implemented in 88bcd04, stale-closed with an invitation to re-open). It is fully disclosed in Related below; this request completes it (version never implemented + structured env block).
Problem
The agent's model context does not include the running opencode version, and the model identity is only injected in the main system prompt — not in the structured <env> block. The model cannot reliably know its own harness version without running opencode --version — and it doesn't know that it doesn't know.
Many projects' agent conventions (AGENTS.md files) require PR descriptions to declare which AI engine and version produced the changes, including the underlying model, for traceability. Faced with that requirement, the model has three options: run opencode --version (only if it thinks to — it usually doesn't), ask the user (rare), or guess.
Option 3 is an observed failure mode: LLMs confidently fill in missing facts, especially when a plausible-looking value sits nearby. Real case today: an agent running opencode 1.18.30 wrote opencode 0.11.x in a PR description, anchored on a stale opencode 0.x.y example in the project's AGENTS.md. The declared version was silently wrong, defeating the traceability rule — and no CI check can catch it, since the checker doesn't know the true version either.
Proposal
Inject the running version, the provider and the model identity into the existing <env> block:
<env>
Working directory: /Users/x/project
Platform: darwin
Today's date: Mon Sep 28 2026
OpenCode version: 1.18.30 ← proposed
Provider: openrouter ← proposed (providerID, the canonical form used in opencode.json provider/model references)
Model: GLM 5.3 (z-ai/glm-5.3) ← proposed (models.dev display name + exact API id)
</env>
Cheap: a few tokens, always accurate.
Removes an entire class of hallucinated-version errors for projects with "state your engine and version" conventions (the same convention exists for Copilot CLI / Claude Code).
The model identity is currently injected as prose only ("You are powered by the model named ${model.api.id}") in the main system prompt — which misuses the API id as a name — and subagents / custom agents may not receive that prompt template at all. Including version, provider and model in the structured env block makes agent self-knowledge uniform and guaranteed for every agent mode — which is exactly what these conventions assume (their "when known" hedges exist because this self-knowledge is not guaranteed today).
Alternatives considered
A tool the agent can call to get the version: strictly worse — requires the agent to remember to verify, which is exactly what failed in the observed case.
Documentation telling agents to run opencode --version: unreliable for the same reason (the model doesn't know that it doesn't know).
Related
[FEATURE]: add model identity info to system prompt #9065 requested the same (model identity + provider + version in the system prompt). The model part was implemented in 88bcd04 as the prose line You are powered by the model named...; the version was never added. [FEATURE]: add model identity info to system prompt #9065 was auto-closed by the stale bot after 60 days of inactivity, with an explicit "If the issue is still relevant please open a new one" — this issue is that re-open, completing the unfinished version part and extending the model id to the structured env block (uniform across the main prompt, subagents and custom agents, which may not receive the prose line).
Feature hasn't been suggested before.
Note
After creation, a related prior request surfaced (#9065 — model identity only, partially implemented in 88bcd04, stale-closed with an invitation to re-open). It is fully disclosed in Related below; this request completes it (version never implemented + structured env block).
Problem
The agent's model context does not include the running opencode version, and the model identity is only injected in the main system prompt — not in the structured
<env>block. The model cannot reliably know its own harness version without runningopencode --version— and it doesn't know that it doesn't know.Many projects' agent conventions (AGENTS.md files) require PR descriptions to declare which AI engine and version produced the changes, including the underlying model, for traceability. Faced with that requirement, the model has three options: run
opencode --version(only if it thinks to — it usually doesn't), ask the user (rare), or guess.Option 3 is an observed failure mode: LLMs confidently fill in missing facts, especially when a plausible-looking value sits nearby. Real case today: an agent running opencode 1.18.30 wrote
opencode 0.11.xin a PR description, anchored on a staleopencode 0.x.yexample in the project's AGENTS.md. The declared version was silently wrong, defeating the traceability rule — and no CI check can catch it, since the checker doesn't know the true version either.Proposal
Inject the running version, the provider and the model identity into the existing
<env>block:Alternatives considered
opencode --version: unreliable for the same reason (the model doesn't know that it doesn't know).Related
You are powered by the model named...; the version was never added. [FEATURE]: add model identity info to system prompt #9065 was auto-closed by the stale bot after 60 days of inactivity, with an explicit "If the issue is still relevant please open a new one" — this issue is that re-open, completing the unfinished version part and extending the model id to the structured env block (uniform across the main prompt, subagents and custom agents, which may not receive the prose line).