Where Are the Runtime Adapters for i-have-adhd Located? Complete File Structure Guide
The runtime adapters for i-have-adhd are located in platform-specific directories and configuration files—including .claude-plugin/, .codex-plugin/, opencode.json, and manifests like qwen-extension.json and kimi.plugin.json—all importing the core logic from extensions/i-have-adhd.ts.
The ayghri/i-have-adhd repository implements a modular architecture that separates core ADHD-friendly functionality from runtime-specific integration layers. This design allows the extension to operate seamlessly across Claude Code, Codex, Pi, OpenCode, and other AI agent platforms while maintaining a single source of truth for business logic.
Core Extension Architecture
The project follows a two-tier structure consisting of a centralized core extension and lightweight runtime adapters that bridge to each platform's hook system.
The core implementation resides in extensions/i-have-adhd.ts. According to the source code, this file implements the ADHD-friendly behavior, loads skill rules, and registers commands and flags for the Pi-coding-agent API. Supporting utilities live in extensions/context-compat.ts, which provides helpers to detect whether injected rules remain present in the conversation context.
Every runtime adapter ultimately imports from extensions/i-have-adhd.ts, ensuring that business logic remains single-sourced across all platforms.
Claude Code Adapter Location
For Claude Code integration, the adapter files reside in the .claude-plugin/ directory.
.claude-plugin/plugin.jsondeclares the plugin metadata and entry point..claude-plugin/hooks/hooks.jsonregisters the "always-on" hook configuration..claude-plugin/hooks/always-on.mjsloads the core extension into Claude Code's lifecycle.
These files wire the ADHD functionality into Claude Code's plugin system, allowing the extension to initialize when the runtime starts.
Codex Adapter Location
The Codex runtime adapter follows a similar directory-based pattern in .codex-plugin/.
.codex-plugin/plugin.jsonserves as the plugin manifest for the Codex runtime..codex-plugin/hooks/hooks.jsoncontains the hook declarations required by Codex.
This structure mirrors the Claude Code implementation but targets OpenAI's Codex CLI environment.
Pi and OMP Adapter Locations
Both Pi and OMP runtimes use package.json entries to locate the adapter rather than separate directories.
- The
pifield inpackage.jsonpoints directly toextensions/i-have-adhd.ts, which the Pi runtime loads automatically. - The
ompentry references the same core file for the OMP (Open Model Platform) runtime.
These configurations treat the core extension file itself as the adapter entry point, eliminating the need for intermediate wrapper scripts.
OpenCode Adapter Location
OpenCode integration uses a dedicated configuration file and plugin directory.
opencode.jsondefines the OpenCode plugin manifest at the repository root..opencode/plugins/i-have-adhd.mjsimports the core extension and handles the runtime-specific wiring.
This JavaScript module acts as the bridge between OpenCode's extension API and the core TypeScript logic in extensions/i-have-adhd.ts.
Qwen, Kimi, and Gemini Adapter Locations
Additional AI runtimes use JSON manifest files in the repository root to define their adapters.
qwen-extension.jsonpoints to the core extension for Alibaba's Qwen runtime.kimi.plugin.jsonserves as the manifest for the Moonshot Kimi runtime.gemini-extension.jsonandGEMINI.mdprovide the adapter configuration and documentation for Google's Gemini platform.
Each manifest specifies the entry point to extensions/i-have-adhd.ts, maintaining consistency with the adapter pattern used across other runtimes.
How Adapters Wire Into the Core
Despite varying locations and formats, all runtime adapters follow the same import pattern. They load the core extension and register it with the runtime's Extension API.
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import iHaveAdhdExtension from "./extensions/i-have-adhd";
export default function register(pi: ExtensionAPI) {
// Register the core extension as the adapter for the current runtime
iHaveAdhdExtension(pi);
}
This pattern ensures that updates to extensions/i-have-adhd.ts propagate to Claude Code, Codex, Pi, and other supported platforms without modifying individual adapter files.
Using Runtime Adapters in Practice
Once the appropriate adapter is installed for your target runtime, you can toggle ADHD-friendly features using platform-specific commands.
In Pi-based sessions:
// Enable ADHD-friendly output
await pi.runCommand("i-have-adhd on");
// Disable the mode
await pi.runCommand("i-have-adhd off");
In Claude Code, use the slash command:
/skill:i-have-adhd
These commands invoke the same core logic loaded by the respective runtime adapters, regardless of which platform you are using.
Summary
- Core Logic: Centralized in
extensions/i-have-adhd.tswith context helpers inextensions/context-compat.ts. - Claude Code: Adapter located in
.claude-plugin/usingplugin.jsonandhooks/always-on.mjs. - Codex: Adapter located in
.codex-plugin/withplugin.jsonandhooks/hooks.json. - Pi/OMP: Adapters referenced via
package.jsonentries pointing directly to the core extension. - OpenCode: Adapter uses
opencode.jsonand.opencode/plugins/i-have-adhd.mjs. - Qwen/Kimi/Gemini: Each uses root-level JSON manifests (
qwen-extension.json,kimi.plugin.json,gemini-extension.json) to point to the core file.
Frequently Asked Questions
Where is the main logic for i-have-adhd stored?
The main logic resides in extensions/i-have-adhd.ts as implemented in ayghri/i-have-adhd. This file handles ADHD-friendly behavior, loads skill rules, and registers commands for all supported runtimes. Runtime adapters in platform-specific directories act as thin wrappers that import and initialize this core file.
Do I need to modify adapter files to update extension behavior?
No. Because all runtime adapters import from extensions/i-have-adhd.ts, you only need to modify the core extension file. Changes propagate automatically to Claude Code, Codex, Pi, OpenCode, Qwen, Kimi, and Gemini since they all reference the same source file.
What is the purpose of context-compat.ts?
The extensions/context-compat.ts file contains helper utilities that detect whether injected ADHD rules remain present in the conversation context. The core extension uses these helpers to maintain state awareness across different runtime environments.
How does the Claude Code adapter differ from the Pi adapter?
The Claude Code adapter uses a directory-based structure (.claude-plugin/) with separate JSON manifests and JavaScript hook files, while the Pi adapter uses a direct entry point in package.json that references extensions/i-have-adhd.ts without intermediate wrapper files. Both ultimately load the same core 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 →