Feature hasn't been suggested before.
Describe the enhancement you want to request
opencode already supports global rules via ~/.config/opencode/AGENTS.md — this file is automatically loaded into every session's context. The feature is documented on the Rules page.
However, there is no interactive way to create this file. The only entry points users have are:
| Action |
Result |
/init |
Creates a project-level AGENTS.md only |
| Asking the LLM "help me create global rules" |
Depends on whether the model knows about ~/.config/opencode/AGENTS.md |
Manually creating ~/.config/opencode/AGENTS.md |
Requires the user to already know the exact path |
This creates a discoverability gap:
- First-time user says "help me create rules" →
/init creates project-level rules → user never learns about global rules
/init --help → No --global flag exists
- The docs mention global AGENTS.md, but there exists no command path from "I want global rules" to a file being created
Proposed solution
Add a --global flag to the existing /init command:
/init --global → Creates/updates ~/.config/opencode/AGENTS.md
/init → Creates/updates <project-root>/AGENTS.md (existing behavior, unchanged)
On first run, /init --global should:
mkdir -p ~/.config/opencode/ if it doesn't exist
- Create
AGENTS.md with a helpful template
- Explain that this file will apply to all projects
Alternative approaches
opencode rules init as a standalone CLI command
opencode agent create offering a "global rules" option
- An interactive prompt in
/init on first run: "Create rules for this project only, or for all projects?"
- Mention global rules in the first-run onboarding/welcome experience
Why this matters
For power users and teams, global rules are essential for setting personal preferences (language, tooling conventions, response style) without repeating them in every project. The mechanism exists — it just needs a discoverable front door.
Feature hasn't been suggested before.
Describe the enhancement you want to request
opencode already supports global rules via
~/.config/opencode/AGENTS.md— this file is automatically loaded into every session's context. The feature is documented on the Rules page.However, there is no interactive way to create this file. The only entry points users have are:
/initAGENTS.mdonly~/.config/opencode/AGENTS.md~/.config/opencode/AGENTS.mdThis creates a discoverability gap:
/initcreates project-level rules → user never learns about global rules/init --help→ No--globalflag existsProposed solution
Add a
--globalflag to the existing/initcommand:On first run,
/init --globalshould:mkdir -p ~/.config/opencode/if it doesn't existAGENTS.mdwith a helpful templateAlternative approaches
opencode rules initas a standalone CLI commandopencode agent createoffering a "global rules" option/initon first run: "Create rules for this project only, or for all projects?"Why this matters
For power users and teams, global rules are essential for setting personal preferences (language, tooling conventions, response style) without repeating them in every project. The mechanism exists — it just needs a discoverable front door.