opencode-shell-strategy
OpenCode instructions for running shell commands safely in a non-interactive environment.
OpenCode's shell is non-interactive: it has no TTY/PTY, so commands that wait for input, launch a pager, or open an editor will hang until timeout. These instructions teach an agent to use command-specific non-interactive forms, fail fast when authorization is missing, and avoid unsafe patterns that bypass security controls.
The rules are written for OpenCode and apply to any comparable headless agent host.
Installation
Add the remote instruction file to your OpenCode configuration:
{
"instructions": [
"https://raw.githubusercontent.com/JRedeker/opencode-shell-strategy/trunk/shell_strategy.md"
]
}
Restart OpenCode. The rules load automatically at the start of each session.
A local clone is optional. If you want to edit or contribute, clone the repository and point your config at the local shell_strategy.md path instead.
What it covers
Safe non-interactive forms
| Tool | Avoid | Use |
|------|-------|-----|
| npm init | npm init | npm init -y |
| apt install | apt-get install pkg | apt-get install -y pkg |
| pip install | pip install pkg | pip install --no-input pkg |
| git commit | git commit | git commit -m "msg" |
| git merge | git merge branch | git merge --no-edit branch |
| git pull | git pull | git pull --no-edit |
| rm | rm -i file | rm file (no -i) |
| ssh first contact | ssh host | ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=10 user@host |
Always-banned commands
These hang or break autonomy in a non-interactive shell:
vim,nano,vi,emacs(editors)