How On-Demand Mode Works in the i-have-ADHD OpenCode Plugin

The on-demand mode in the i-have-ADHD OpenCode plugin activates ADHD-friendly rules only when you explicitly run the /i-have-adhd command, persisting for the current session until you stop it with "stop adhd mode" or "normal mode".

The i-have-ADHD OpenCode plugin, developed by ayghri, provides two activation modes for its ADHD-friendly ruleset: on-demand and always-on. On-demand mode is the default behavior, designed for users who want temporary, session-based access to the rules without permanent configuration changes. This article explains exactly how on-demand mode works based on the source code implementation in the ayghri/i-have-adhd repository.

How the Plugin Initializes On-Demand Mode

When the plugin loads via the entry point .opencode/plugins/i-have-adhd.mjs, its config hook executes immediately. This hook performs two critical operations that enable on-demand functionality.

Skill Directory Registration

The hook adds the repository's skills directory to the OpenCode configuration path:

config.skills = config.skills || {};
config.skills.paths = config.skills.paths || [];
if (!config.skills.paths.includes(skillsDir)) config.skills.paths.push(skillsDir);

This registration makes skills/i-have-adhd/SKILL.md discoverable by the OpenCode runtime. The SKILL.md file contains the authoritative ADHD-friendly ruleset that controls response formatting and behavior.

Command Registration

With the skill directory on the configuration path, the OpenCode skill tool automatically loads the command definition from .opencode/command/i-have-adhd.md. This exposes the /i-have-adhd slash command to the user.

Activating On-Demand Mode in Practice

On-demand mode requires no flag files or persistent state. The activation flow works as follows:

  1. Register the plugin once per project in opencode.json:
{
  "plugin": ["./.opencode/plugins/i-have-adhd.mjs"]
}
  1. Activate during any chat session by typing:
> /i-have-adhd
  1. ** The ruleset applies immediately** to all subsequent responses for that session.

  2. Deactivate when finished using either phrase:

> stop adhd mode
> normal mode

The session-based persistence meansno residual configuration remains after deactivation. This contrasts sharply with always-on mode, which requires creating ~/.config/opencode/.i-have-adhd-always to enable automatic ruleset application every turn.

Key Source Files for On-Demand Mode

File Purpose
.opencode/plugins/i-have-adhd.mjs Core plugin implementation; contains the config hook that registers skills and enables the /i-have-adhd command
.opencode/command/i-have-adhd.md Command definition file that maps the slash command to skill loading behavior
skills/i-have-adhd/SKILL.md Single source of truth for ADHD-friendly formatting rules
hooks/always-on.mjs Separate implementation for persistent mode (contrast reference)
opencode.json Project configuration where plugin registration occurs

The plugin architecture deliberately separates these concerns: the .mjs file handles OpenCode runtime integration, the .md command file defines the trigger interface, and the SKILL.md houses the actual behavioral rules.

Comparison: On-Demand vs. Always-On

Aspect On-Demand Mode Always-On Mode
Default state Yes No (requires flag file)
Activation trigger /i-have-adhd command ~/.config/opencode/.i-have-adhd-always file exists
Persistence Current session only Every session until flag removed
Deactivation method Text command ("stop adhd mode") Delete flag file
Use case Situational focus assistance Permanent accessibility need

Summary

  • On-demand mode is the default i-have-ADHD plugin behavior requiring explicit activation via /i-have-adhd
  • The config hook in .opencode/plugins/i-have-adhd.mjs registers the skill directory, making the command available dynamically
  • Rules persist only for the active session with no file-based state management
  • Deactivation requires simple natural language commands rather than configuration changes
  • This design prioritizes lightweight, temporary activation suitable for intermittent ADHD support needs

Frequently Asked Questions

How do I enable on-demand mode in the i-have-ADHD plugin?

On-demand mode requires no special enablement—it is the default behavior once the plugin is registered in opencode.json. Simply add "./.opencode/plugins/i-have-adhd.mjs" to your plugin array, and the /i-have-adhd command becomes available in every session.

What happens if I forget to stop on-demand mode?

The ruleset automatically deactivates when the session ends. Unlike always-on mode, on-demand activation does not persist across restarts, chat windows, or new conversations. You must run /i-have-adhd again in each new session where you want ADHD-friendly formatting.

Can I switch between on-demand and always-on modes?

Yes. These modes operate independently. The presence of ~/.config/opencode/.i-have-adhd-always enables always-on behavior for all sessions, while /i-have-adhd activates temporary rules even when always-on is disabled. If both are active, the rules apply with always-on taking precedence for persistence.

Where are the actual ADHD rules defined?

The ruleset lives in skills/i-have-adhd/SKILL.md as formatted markdown instructions. When you activate on-demand mode, the OpenCode runtime loads this file and injects its contents into the system prompt for response generation.

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 →