Rules
Set custom instructions for OpenCode via AGENTS.md.
Official docs: opencode.ai/docs/rules
Quick Setup
Run /init in your repository to auto-generate AGENTS.md:
/init
This scans your codebase and creates project-specific guidance.
Tip: Commit AGENTS.md to Git so your team shares the same rules.
What is AGENTS.md?
AGENTS.md contains instructions OpenCode reads before working on your project. It helps:
- Follow your coding standards
- Understand your architecture
- Respect your preferences
Example
# Project Context
TypeScript monorepo using Next.js.
## Code Style
- Use TypeScript strict mode
- Follow existing patterns
## Architecture
- API routes in `app/api/`
- Components in `components/`
File Locations
| Location | Scope |
|---|---|
.opencode/AGENTS.md | Project-specific |
~/.config/opencode/AGENTS.md | Global (all projects) |
Forkline-Specific Tips
- Keep it concise — OpenCode reads AGENTS.md each session
- Use setup scripts — Load shared config via
.forkline/setup.sh - Point to external docs — Don’t duplicate, reference existing docs
Related
- Custom Agents — Specialized AI assistants
- Agent Skills — Reusable task workflows
- OpenCode Config — JSON configuration