How to Enable Always-On Mode for i-have-adhd in OpenCode: Complete Setup Guide

Always-on mode for i-have-adhd in OpenCode automatically activates when you create a hidden flag file at ~/.config/opencode/.i-have-adhd-always, causing the system to prepend ADHD-friendly response rules to every prompt without requiring the /i-have-adhd command.

The ayghri/i-have-adhd repository provides an OpenCode plugin that enhances AI responses with ADHD-friendly formatting. When you enable always-on mode, the extension continuously injects its ruleset into every conversation turn, eliminating the need to manually trigger commands. This configuration leverages a file-based flag system and hook injection mechanism built into OpenCode's plugin architecture.

How Always-On Mode Works

The always-on mechanism in i-have-adhd relies on three integrated components that check for the presence of a specific flag file in your OpenCode configuration directory.

The Flag File Mechanism

OpenCode looks for a hidden file named .i-have-adhd-always under the user's configuration directory (~/.config/opencode/). Creating this empty file toggles the always-on behavior, while deleting it disables the feature permanently.

Hook Injection Process

When the flag exists, OpenCode loads the always-on hook from hooks/always-on.mjs. This hook reads the flag, builds a banner, and prepends the full skill ruleset to the system prompt for every turn. The hook logic mirrors the SessionStart hook used by Claude Code, ensuring consistent behavior across sessions.

Plugin Registration

The OpenCode plugin located at .opencode/plugins/i-have-adhd.mjs registers the skill entry point and the /i-have-adhd command. This file also checks the same flag file to decide whether to inject the ruleset automatically at startup.

Step-by-Step Setup Guide

Enabling always-on mode requires only creating the flag file. No additional configuration is necessary.

Create the Flag File

Run the following command in your terminal to enable always-on mode:

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

This creates the hidden flag file that signals OpenCode to activate the continuous injection of ADHD-friendly formatting rules.

Verify the Configuration (Optional)

To inspect the injected banner and verify the hook is functioning correctly, you can run the hook directly:

node -e "(async()=>{const root=process.env.PLUGIN_ROOT; if(root) await import(require('node:url').pathToFileURL(require('node:path').join(root,'hooks','always-on.mjs')).href)})().catch(()=>{})"

Managing Always-On Mode

Once enabled, you can temporarily or permanently disable the feature depending on your workflow needs.

Disable Temporarily for Current Session

To turn off always-on mode for the current chat session without deleting the flag file, issue the following command within your OpenCode session:

stop adhd mode

This stops the injection for the current session but preserves the flag file for future launches.

Disable Permanently

To completely disable always-on mode across all future sessions, remove the flag file:

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

After deletion, the hooks/always-on.mjs hook will no longer trigger automatic rule injection, and you will need to use the /i-have-adhd command manually when needed.

Technical Implementation Details

The always-on functionality is implemented across several key files in the ayghri/i-have-adhd repository:

  • .opencode/plugins/i-have-adhd.mjs – Registers the skill, the /i-have-adhd command, and checks the always-on flag to prepend the ruleset.
  • hooks/always-on.mjs – Implements the always-on hook that injects the banner and ruleset into each prompt when the flag is present.
  • hooks/always-on.sh – Shell version of the always-on hook for non-Node runtimes.
  • hooks/always-on.ps1 – PowerShell version of the always-on hook for Windows environments.
  • hooks/hooks.json – Declares the hook command that OpenCode runs at startup; points to always-on.mjs.
  • .opencode/command/i-have-adhd.md – Provides the /i-have-adhd command documentation and remains functional even when always-on is enabled.

Summary

  • Always-on mode activates by creating ~/.config/opencode/.i-have-adhd-always.
  • The hooks/always-on.mjs file handles the automatic injection of ADHD-friendly rules into every prompt.
  • Use stop adhd mode to disable the feature temporarily for the current session.
  • Delete the flag file to disable permanently and revert to manual command usage.
  • The plugin at .opencode/plugins/i-have-adhd.mjs coordinates between the flag check and command registration.

Frequently Asked Questions

What happens if I enable always-on mode but still type the /i-have-adhd command?

The /i-have-adhd command remains functional even when always-on mode is enabled. According to the source code in .opencode/command/i-have-adhd.md, the command documentation persists regardless of the always-on flag status, allowing you to manually trigger the ruleset if needed.

Does always-on mode work on Windows, Linux, and macOS?

Yes. The implementation includes cross-platform support through hooks/always-on.mjs for Node.js environments, hooks/always-on.sh for Unix-like systems (Linux/macOS), and hooks/always-on.ps1 for Windows PowerShell environments. All versions check for the same flag file location within ~/.config/opencode/.

Will creating the flag file affect existing OpenCode sessions already running?

Always-on mode typically activates on the next session initialization or prompt cycle when OpenCode checks for the presence of .i-have-adhd-always. The hooks/hooks.json declaration ensures the hook runs at startup, so existing sessions may need a restart to pick up the new flag, though the specific timing depends on OpenCode's hook execution cycle.

How do I know if the ADHD rules are actually being injected into my prompts?

You can verify injection by running the optional Node.js verification command provided in the setup section, which executes hooks/always-on.mjs directly and displays the banner. Additionally, responses should consistently exhibit ADHD-friendly formatting characteristics such as structured bullet points and concise paragraphs once the flag is active.

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 →