Flag Path for i-have-adhd in OpenCode: Where the Always-On Setting Is Stored
The OpenCode flag path for i-have-adhd is ${XDG_CONFIG_HOME:-$HOME/.config}/opencode/.i-have-adhd-always.
This single hidden file determines whether the ADHD skill ruleset gets injected into every system prompt automatically. When present, the plugin enables "always-on" mode; when absent, the skill only activates on explicit request.
How the Flag Path Is Determined
The i-have-adhd OpenCode plugin constructs the flag path dynamically based on standard XDG Base Directory conventions. In /.opencode/plugins/i-have-adhd.mjs at lines 29-33, the code resolves the configuration directory as follows:
- Check
XDG_CONFIG_HOME— If this environment variable is set, use it as the base directory - Fallback to
$HOME/.config— The standard default when XDG_CONFIG_HOME is undefined - Append
/opencode/.i-have-adhd-always— The fixed subdirectory and filename
This yields two possible final paths:
| Environment Variable Status | Full Flag Path |
|---|---|
XDG_CONFIG_HOME defined |
$XDG_CONFIG_HOME/opencode/.i-have-adhd-always |
XDG_CONFIG_HOME undefined |
$HOME/.config/opencode/.i-have-adhd-always |
Managing the Always-On Flag
Enable Always-On Mode Permanently
Create the flag file to persistently inject ADHD rules into every OpenCode session:
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/opencode"
touch "${XDG_CONFIG_HOME:-$HOME/.config}/opencode/.i-have-adhd-always"
Disable Always-On Mode Permanently
Remove the flag file to stop automatic injection across all future sessions:
rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/opencode/.i-have-adhd-always"
Disable for Current Session Only
For temporary deactivation without deleting the flag file, issue the command:
stop adhd mode
This removes the active flag for the ongoing session while preserving the file for future launches.
Source Implementation Details
The flag path logic resides in the core OpenCode plugin at /.opencode/plugins/i-have-adhd.mjs. According to the i-have-adhd source code, this module:
- Resolves the configuration directory using XDG standards
- Checks for file existence at startup
- Injects the full ruleset from
skills/i-have-adhd/SKILL.mdwhen the flag is detected
The equivalent implementation for Claude Code exists in hooks/always-on.mjs, demonstrating consistent cross-platform behavior. Test coverage in tests/test_always_on_hooks.py validates that file creation and removal correctly toggle the always-on state.
Cross-Platform Path Behavior
The ${XDG_CONFIG_HOME:-$HOME/.config} pattern ensures portability:
- Linux: Respects standard freedesktop.org conventions
- macOS: Falls back to
~/.configas most tools expect - Windows (WSL): Uses the Linux subsystem's XDG or home directory
No manual path configuration is required—the plugin automatically adapts to the host environment.
Summary
- Flag path for i-have-adhd in OpenCode:
${XDG_CONFIG_HOME:-$HOME/.config}/opencode/.i-have-adhd-always - File presence: Enables persistent always-on mode
- File absence: Requires explicit skill activation per session
- Implementation: Lines 29-33 of
.opencode/plugins/i-have-adhd.mjs - Session override: "stop adhd mode" temporarily disables without file deletion
Frequently Asked Questions
What happens if I delete the i-have-adhd flag file?
Deleting the flag file immediately stops the always-on behavior for all future OpenCode sessions. The ADHD skill becomes opt-in only, requiring explicit activation when needed. Previous sessions already in progress are unaffected.
Can I move the flag file to a different location?
No. The flag path for i-have-adhd in OpenCode is hardcoded in .opencode/plugins/i-have-adhd.mjs relative to the XDG configuration directory. The plugin does not support custom paths through environment variables or settings files.
Does the flag file store any content, or just exist?
The flag is an empty file. The plugin only checks for existence via standard filesystem operations, not file contents. Creating it with touch is sufficient; writing data to it has no effect on behavior.
Will always-on mode apply to other AI coding assistants?
No. The flag at this specific path only controls the OpenCode plugin. The i-have-adhd repository maintains separate implementations for Claude Code (hooks/always-on.mjs) and other platforms, each with their own flag locations and detection logic.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →