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

LocationScope
.opencode/AGENTS.mdProject-specific
~/.config/opencode/AGENTS.mdGlobal (all projects)

Forkline-Specific Tips

  1. Keep it concise — OpenCode reads AGENTS.md each session
  2. Use setup scripts — Load shared config via .forkline/setup.sh
  3. Point to external docs — Don’t duplicate, reference existing docs