GeezerVison is showing github.com — [FEATURE]: allow shell commands in the frontmatter · Issue #5082 · anomalyco/opencode
[FEATURE]: allow shell commands in the frontmatter #5082Labels discussionUsed for feature requests, proposals, ideas, etc. Open discussion DescriptionFeature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Why - to be able to customize commands, agents configuration to set different models by cost or using local models for testing.
shellcmd.md
---
description: !`echo "${PWD}"`
model: !`echo "${OPENCODE_MODEL_PREMIUM:-anthropic/claude-haiku-4-5}"`
---
Command prompt...
can be used like this:
OPENCODE_MODEL_CHEAP=anthropic/claude-haiku-4-5
OPENCODE_MODEL_DEFAULT=anthropic/claude-sonnet-4-5
OPENCODE_MODEL_PREMIUM=anthropic/claude-opus-4-5
bun run dev
I implemented this here:
rwese@2c9bf37 Reacted by Brian Sunter and Juan Abia Activitygithub-actions commented on Dec 4, 2025 This issue might be a duplicate of existing issues. Please check:
The core feature request appears to be dynamic configuration through shell command evaluation in frontmatter, which would enable:
- Setting different models based on environment variables
- Cost-based model selection
- Local vs. remote model switching for testing
Feel free to ignore if your specific case differs from these existing feature requests. rwese commented on Dec 4, 2025 ContributorAuthor More actions I could adapt it to be as #5054 my thought was to stick with the way the yaml files are currently using shell-commands.
#3439 would be too abstract for my liking ariane-emory commented on Dec 4, 2025 A potentially more efficient alternative might be to employ the same {env:SOME_VAR} / {file:some_file} syntax that is already supported in the opencode.json file.
Accessing an environment variable is such a trivial task, very many programs (including opencode itself in the JSON context used for the config) can just read environment variables directly without needing to start up a whole new shell in order to do it.
The code that opencode uses to do this in the configuration file can be found in packages/opencode/src/config/config.ts somewhere near line ~725 or so. Reacted by atkr, shuv, Brian Sunter and Juliusz Ćwiąkalski ariane-emory commented on Dec 4, 2025 Actually, we probably only want the f(env:SOME_VAR} syntax for MD frontmatter, the {file:some_file} syntax doesn't seem like it would be terribly useful in the context of frontmatter. Toady00 commented on Mar 1, 2026 Adding another use case: I’m looking for actual shell command execution in frontmatter, not just variable substitution.
I keep a small YAML config file per repo to inform the agent about repo-specific details (e.g. where my specs directory is, other project paths, etc). I use yq to pull values out of that YAML and inject them into command markdown so the agent knows where to go look for things. I use this pattern pretty broadly.
One specific thing I’d like to drive from that same repo config is model selection per project. The goal is to keep command files generic/portable and avoid editing them per repo, while still letting each repo say "use model X for this project".
I could do this with env vars, but that tends to add more setup and tooling (direnv, docs, onboarding steps). Especially when collaborating, it’s much simpler if the repo just carries a YAML config and commands can read it directly.
So this feature would unlock a clean repo-config-controls-behavior pattern, not just templating convenience. github-actions commented on May 1, 2026 To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
MetadataMetadatadiscussionUsed for feature requests, proposals, ideas, etc. Open discussion DevelopmentNo branches or pull requestsIssue actions
|