[PR #5092] feat: {env:MY_VAR} support in the frontmatter of agent/command markdown files (resolves #5054, #5082) #11241

Open
opened 2026-02-16 18:16:02 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5092

State: open
Merged: No


Resolves #5054. Resolves #5082.

feat: add {env:VAR} interpolation support to markdown frontmatter

  • Add {env:VAR} interpolation to ConfigMarkdown.parse() for frontmatter fields only
  • Enables dynamic model selection via environment variables in markdown agents, amongst other possibilities
  • Gracefully handles missing environment variables with empty string fallback
  • Add comprehensive test coverage for interpolation functionality
  • Resolves GitHub issue #5054

Example usage:

description: "My agent"
model: "{env:MODEL}"
mode: primary

I am an agent using a model specified by an environment variable.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5092 **State:** open **Merged:** No --- Resolves #5054. Resolves #5082. feat: add {env:VAR} interpolation support to markdown frontmatter - Add {env:VAR} interpolation to ConfigMarkdown.parse() for frontmatter fields only - Enables dynamic model selection via environment variables in markdown agents, amongst other possibilities - Gracefully handles missing environment variables with empty string fallback - Add comprehensive test coverage for interpolation functionality - Resolves GitHub issue #5054 Example usage: --- description: "My agent" model: "{env:MODEL}" mode: primary --- I am an agent using a model specified by an environment variable.
yindo added the pull-request label 2026-02-16 18:16:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11241