Skip to content

Inject OPENCODE_SESSION_ID into shell command environment #12158

Closed

Description

@jakvbs

Problem

There’s no consistent way for shell commands executed by OpenCode to know which session they belong to.

Proposed change

Inject OPENCODE_SESSION_ID into the environment of shell commands executed by OpenCode:

  • Bash tool execution
  • User-run command path in session prompt

Expected behavior

Commands can access the current session id via OPENCODE_SESSION_ID.

Why this is useful

This is especially important for skills. Skills often orchestrate shell tools and external scripts; having a session-scoped env var makes it possible to tag logs/artifacts and keep skill-side output correlated with the active OpenCode session.

Notes

This does not change PTY terminals or other spawned processes unless explicitly extended later.

Activity

  1. LandonSchropp commented on May 14, 2026

    @LandonSchropp

    @jakvbs This was closed as completed, but I don't see an equivalent to OPENCODE_SESSION_ID anywhere. Do you know if this landed in some other form?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions