By default, AI agents in OpenCode may run git commands (add, commit, push, etc.) on your behalf. If you prefer to handle all git operations yourself, you can add a global rule to prevent this.
Create the file ~/.config/opencode/AGENTS.md with the following contents:
# Personal Workflow Preferences
## Git Operations
Do not run git commands (add, commit, push, pull, merge, rebase, etc.) unless I explicitly ask for help with git. I handle all git operations myself.This file is loaded into every OpenCode session across all projects. It is not committed to any repo — it's your personal config.
You can add additional personal preferences to this file at any time.
OpenCode supports rules via AGENTS.md files at two levels:
- Global —
~/.config/opencode/AGENTS.md— applies to all projects, personal to you - Project —
AGENTS.mdin a project root — applies to that project, shared with your team via git
Global rules are always loaded. See the OpenCode rules docs for more details.