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 coding agent marker to shell commands #34065
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Shell commands launched by opencode should expose a generic environment marker so downstream CLIs can detect that they are running under a coding agent.
Set OPENCODE=1 for shell tool child processes. This mirrors the simple agent-marker convention used by other coding assistants and does not expose session-specific data.
This is narrower than #15739, which asks for session/tool correlation values like OPENCODE_SESSION_ID. This request is only for a boolean opencode agent marker.
Hi, I'd like to work on exposing the coding agent environment marker in the shell tool. I can add an OPENCODE_AGENT (or similar) environment variable that the shell tool sets when running inside an agent context, following the pattern used by other coding assistant tools. Could you assign me?
This appears to be a feature request but does not use the Feature Request template. The title should start with [FEATURE]: and the issue should include the required verification checkbox confirming the feature hasn't been suggested before, along with a structured description of the enhancement.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
changed the title [-]Shell tool should expose coding agent environment marker[/-][+][FEATURE]: expose coding agent marker to shell commands[/+]on Jun 26, 2026
Thanks for updating the issue — it now follows the feature request template and clearly explains the request. The needs:compliance label has been removed.
(I was about to post as a new Issue myself, but saw this was essentially the same request, just reposting what I was about to create to reiterate demand for this feature functionality if helps with visibility/priority for repo maintainers etc.)
Title:
[FEATURE]: Set OPENCODE_CODING_AGENT env var to mark OpenCode agent process
Description:
Similar to what was previously requested/implemented for Pi earendil-works/pi#2868 -> earendil-works/pi@6101583 set some environment variable to signify OpenCode agent process (suggestion OPENCODE_CODING_AGENT)
For OpenCode, the proposed value would be AI_AGENT=opencode on shell/tool subprocesses. A non-empty value supplied by a wrapper should be preserved so the outer agent can identify itself.
This complements any OpenCode-specific variables rather than replacing them. It should remain advisory only—not telemetry, authentication, authorization, sandboxing, or a trust boundary. I initially filed #40441 with this naming detail before finding this thread; I am closing that issue as a duplicate and consolidating the proposal here.
Implemented by #51975: shell-tool commands now receive OPENCODE=1 and AGENT=1, with AI_AGENT defaulting to opencode unless an outer agent supplied a marker. This is scoped to the shell tool, not human PTY terminals.
Activity
leocagli commentedon Jun 26, 2026
Hi, I'd like to work on exposing the coding agent environment marker in the shell tool. I can add an
OPENCODE_AGENT(or similar) environment variable that the shell tool sets when running inside an agent context, following the pattern used by other coding assistant tools. Could you assign me?github-actions commentedon Jun 26, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:and the issue should include the required verification checkbox confirming the feature hasn't been suggested before, along with a structured description of the enhancement.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
OPENCODE_SESSION_ID) to tool subprocesses via environment variables — very similar in scope to settingOPENCODE=1for shell tool child processes.If you believe this was flagged incorrectly, please let a maintainer know.
davidmokos commentedon Jun 26, 2026
Feel free to review this: #34062
[-]Shell tool should expose coding agent environment marker[/-][+][FEATURE]: expose coding agent marker to shell commands[/+]github-actions commentedon Jun 26, 2026
Thanks for updating the issue — it now follows the feature request template and clearly explains the request. The needs:compliance label has been removed.
dylbarne commentedon Jul 5, 2026
(I was about to post as a new Issue myself, but saw this was essentially the same request, just reposting what I was about to create to reiterate demand for this feature functionality if helps with visibility/priority for repo maintainers etc.)
Title:
[FEATURE]: Set OPENCODE_CODING_AGENT env var to mark OpenCode agent process
Description:
Similar to what was previously requested/implemented for Pi earendil-works/pi#2868 -> earendil-works/pi@6101583 set some environment variable to signify OpenCode agent process (suggestion
OPENCODE_CODING_AGENT)for my usecase specifically is related to https://github.com/Dicklesworthstone/destructive_command_guard/blob/main/docs/agents.md#supported-agents but I could see this being generally useful to other customizations/plugins etc.
complynx commentedon Aug 4, 2026
The cross-agent convention for this marker is now
AI_AGENT: https://github.com/vercel/vercel/tree/main/packages/detect-agent#the-ai_agent-standardFor OpenCode, the proposed value would be
AI_AGENT=opencodeon shell/tool subprocesses. A non-empty value supplied by a wrapper should be preserved so the outer agent can identify itself.This complements any OpenCode-specific variables rather than replacing them. It should remain advisory only—not telemetry, authentication, authorization, sandboxing, or a trust boundary. I initially filed #40441 with this naming detail before finding this thread; I am closing that issue as a duplicate and consolidating the proposal here.
rekram1-node commentedon Sep 29, 2026
Implemented by #51975: shell-tool commands now receive
OPENCODE=1andAGENT=1, withAI_AGENTdefaulting toopencodeunless an outer agent supplied a marker. This is scoped to the shell tool, not human PTY terminals.