Skip to content

[FEATURE]: Add /init --global or opencode rules init to create global AGENTS.md interactively #27819

@zico00

Description

@zico00

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:

  1. mkdir -p ~/.config/opencode/ if it doesn't exist
  2. Create AGENTS.md with a helpful template
  3. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions