How to Enable Always-On Mode for the OpenCode i-have-ADHD Plugin

Create the flag file at ~/.config/opencode/.i-have-adhd-always to opt into persistent ADHD ruleset injection on every model response.

The OpenCode i-have-ADHD plugin provides two operating modes: on-demand activation through chat commands, and "always-on" mode that prepends the full ADHD ruleset to every system prompt. This guide explains the flag-file mechanism that controls persistent activation, based on the implementation in ayghri/i-have-adhd.

How Always-On Mode Works

The plugin logic resides in .opencode/plugins/i-have-adhd.mjs. When OpenCode loads the plugin, it performs three operations:

  1. Resolves the path to skills/i-have-adhd/SKILL.md — the canonical ruleset source.
  2. Checks for the existence of .i-have-adhd-always in the OpenCode configuration directory ($XDG_CONFIG_HOME/opencode/ or ~/.config/opencode/).
  3. If the flag file exists, the plugin reads SKILL.md, strips YAML front-matter, and registers a transform via experimental.chat.system.transform to prepend the ruleset header to every response.

The flag file requires no content — its mere presence enables the behavior. No environment variables or command-line flags are needed.

Prerequisites: Verify Plugin Installation

Before enabling always-on mode, confirm the plugin is registered in your repository's OpenCode configuration.

Check opencode.json for the plugin entry:

{
  "plugins": [
    ".opencode/plugins/i-have-adhd.mjs"
  ]
}

The plugin file must exist at that relative path. If missing, clone or copy the repository's .opencode/plugins/ directory into your project.

Enable Always-On Mode

Run these commands to create the opt-in flag:


# Create the config directory if it doesn't exist

mkdir -p ~/.config/opencode

# Create the flag file (empty file is sufficient)

touch ~/.config/opencode/.i-have-adhd-always

Verification: Start any OpenCode chat session. The first line of every model response will display:


ADHD MODE ACTIVE (always-on). The ruleset below applies to every response...

Disable Always-On Mode

Temporary Deactivation (Current Session)

Type the command in chat:


stop adhd mode

The model honors the skill's persistence override rule and disables ruleset injection for that conversation.

Permanent Deactivation

Remove the flag file:

rm ~/.config/opencode/.i-have-adhd-always

All future OpenCode sessions will revert to on-demand mode only.

Key Implementation Files

File Purpose
.opencode/plugins/i-have-adhd.mjs Core plugin implementing flag detection and prompt transformation
skills/i-have-adhd/SKILL.md Canonical ADHD ruleset loaded when always-on is active
opencode.json Repository configuration listing enabled plugins
hooks/always-on.mjs Reference implementation for Claude Code/Codex environments

The plugin's experimental.chat.system.transform handler strips YAML front-matter from SKILL.md using regex /^---[\s\S]*?---\n?/ before injection, ensuring clean markdown formatting in the system prompt.

Summary

  • Always-on mode is controlled by a single flag file at ~/.config/opencode/.i-have-adhd-always
  • No configuration changes to opencode.json or environment variables are required after initial plugin setup
  • Toggle instantly by creating or deleting the flag file — changes take effect on the next OpenCode session
  • Session overrides remain available via "stop adhd mode" chat command

Frequently Asked Questions

What happens if the flag file exists but SKILL.md is missing?

The plugin resolves skills/i-have-adhd/SKILL.md relative to the repository root. If the file is absent, the transform silently fails and no ruleset is injected — though the "ADHD MODE ACTIVE" header may still appear depending on error handling in your OpenCode version. Ensure the skills/ directory is present in your working repository.

Can I relocate the flag file to a different directory?

No. The plugin hardcodes the path resolution to $XDG_CONFIG_HOME/opencode/.i-have-adhd-always with fallback to ~/.config/opencode/. This path is not configurable through opencode.json or environment variables in the current implementation.

Does always-on mode affect OpenCode's performance or token usage?

Yes. The full SKILL.md ruleset — approximately 50-100 lines of structured guidance — is prepended to every system prompt. This increases token consumption per request. For cost-sensitive workflows, use on-demand mode instead and activate via chat commands only when needed.

How does this differ from the Claude Code/Codex always-on implementation?

The OpenCode plugin uses file-based flag detection and experimental.chat.system.transform. The hooks/always-on.mjs reference implementation for Claude Code/Codex uses a different hook mechanism (hooks/) but achieves identical behavior. Core logic is mirrored; only the platform-specific integration differs.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →