This document lists the instruction files loaded by OpenCode via the instructions config key in opencode.json.
OpenCode supports the instructions array, which takes paths (or globs) to markdown files. These files are injected into the agent's system prompt, giving them the highest priority over tool prompts and other instructions.
{
"instructions": ["rules/no-coauthor.md"]
}Paths are relative to the ~/.config/opencode/ directory.
Prevents the agent from adding Co-Authored-By or AI attribution lines to git commits.
- Blocks
Co-Authored-By: opencode <noreply@opencode.ai> - Blocks
🤖 Generated with [opencode](https://opencode.ai)footers - Commits are written as if by a human developer
Why: The bash tool prompt instructs the agent to append these lines by default. This rule overrides that behavior. See upstream issue #919 for a native config option.
-
Create a markdown file in
rules/:rules/my-rule.md -
Write clear, imperative instructions:
# My Rule When doing X, you MUST do Y. - Constraint A - Constraint B
-
Add the path to
instructionsinopencode.json:{ "instructions": [ "rules/no-coauthor.md", "rules/my-rule.md" ] }
Rule files are evaluated in order. Later rules can reference or override earlier ones if they address the same behavior.