LearnCen Docs
Guides 2 min read

9. OpenCode Fundamentals

9.1 What is OpenCode?

OpenCode is an open-source AI coding agent designed for software development workflows.

A useful mental model:

OpenCode
|
+-- Models
+-- Agents
+-- Project instructions
+-- Skills
+-- Tools
+-- Permissions
+-- Providers

9.2 Start a project

From a project directory:

cd /path/to/project
opencode

OpenCode's official documentation also describes /init as the project initialization flow.


9.3 Initialize project instructions

Inside OpenCode:

/init

The official documentation describes /init as analyzing the project and creating AGENTS.md.

Commit project-level AGENTS.md to Git so the development team shares the same guidance.


9.4 First task

Try:

Explain this project architecture.

Do not modify files.

Identify:
1. Entry point
2. Major modules
3. Test framework
4. Build commands
5. Important configuration

Then ask:

Find the implementation of user authentication.

Do not edit anything.

Explain the request flow.

9.5 Explore before editing

For unfamiliar repositories:

Explore
  |
  v
Understand
  |
  v
Plan
  |
  v
Implement
  |
  v
Test

This is generally safer than immediately asking an agent to rewrite large parts of the project.


9.6 Useful CLI

The official CLI documentation includes commands for managing agents, including:

opencode agent create

Use:

opencode agent --help

to inspect the commands available in your installed version.


Exercise

Open a real project and ask OpenCode to:

  1. Explain architecture.
  2. Find the test framework.
  3. Find the main entry point.
  4. Find the build/test commands.
  5. Identify important project instructions.