# Where Are the Runtime Adapters for i-have-adhd Located? Complete File Structure Guide

> Find runtime adapters for i-have-adhd within platform-specific directories. Explore configuration files like opencode.json and understand the complete file structure for this project.

- Repository: [Ayoub Ghriss/i-have-adhd](https://github.com/ayghri/i-have-adhd)
- Tags: how-to-guide
- Published: 2026-09-12

---

**The runtime adapters for i-have-adhd are located in platform-specific directories and configuration files—including `.claude-plugin/`, `.codex-plugin/`, [`opencode.json`](https://github.com/ayghri/i-have-adhd/blob/main/opencode.json), and manifests like [`qwen-extension.json`](https://github.com/ayghri/i-have-adhd/blob/main/qwen-extension.json) and [`kimi.plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/kimi.plugin.json)—all importing the core logic from [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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.json`](https://github.com/ayghri/i-have-adhd/blob/main/.claude-plugin/plugin.json) declares the plugin metadata and entry point.
- [`.claude-plugin/hooks/hooks.json`](https://github.com/ayghri/i-have-adhd/blob/main/.claude-plugin/hooks/hooks.json) registers the "always-on" hook configuration.
- `.claude-plugin/hooks/always-on.mjs` loads 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.json`](https://github.com/ayghri/i-have-adhd/blob/main/.codex-plugin/plugin.json) serves as the plugin manifest for the Codex runtime.
- [`.codex-plugin/hooks/hooks.json`](https://github.com/ayghri/i-have-adhd/blob/main/.codex-plugin/hooks/hooks.json) contains 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`](https://github.com/ayghri/i-have-adhd/blob/main/package.json) entries to locate the adapter rather than separate directories.

- The `pi` field in [`package.json`](https://github.com/ayghri/i-have-adhd/blob/main/package.json) points directly to [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts), which the Pi runtime loads automatically.
- The `omp` entry 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.json`](https://github.com/ayghri/i-have-adhd/blob/main/opencode.json) defines the OpenCode plugin manifest at the repository root.
- `.opencode/plugins/i-have-adhd.mjs` imports 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`](https://github.com/ayghri/i-have-adhd/blob/main/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.json`](https://github.com/ayghri/i-have-adhd/blob/main/qwen-extension.json) points to the core extension for Alibaba's Qwen runtime.
- [`kimi.plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/kimi.plugin.json) serves as the manifest for the Moonshot Kimi runtime.
- [`gemini-extension.json`](https://github.com/ayghri/i-have-adhd/blob/main/gemini-extension.json) and [`GEMINI.md`](https://github.com/ayghri/i-have-adhd/blob/main/GEMINI.md) provide the adapter configuration and documentation for Google's Gemini platform.

Each manifest specifies the entry point to [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/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.

```typescript
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`](https://github.com/ayghri/i-have-adhd/blob/main/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:

```typescript
// 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:

```text
/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.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) with context helpers in [`extensions/context-compat.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/context-compat.ts).
- **Claude Code**: Adapter located in `.claude-plugin/` using [`plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/plugin.json) and `hooks/always-on.mjs`.
- **Codex**: Adapter located in `.codex-plugin/` with [`plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/plugin.json) and [`hooks/hooks.json`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/hooks.json).
- **Pi/OMP**: Adapters referenced via [`package.json`](https://github.com/ayghri/i-have-adhd/blob/main/package.json) entries pointing directly to the core extension.
- **OpenCode**: Adapter uses [`opencode.json`](https://github.com/ayghri/i-have-adhd/blob/main/opencode.json) and `.opencode/plugins/i-have-adhd.mjs`.
- **Qwen/Kimi/Gemini**: Each uses root-level JSON manifests ([`qwen-extension.json`](https://github.com/ayghri/i-have-adhd/blob/main/qwen-extension.json), [`kimi.plugin.json`](https://github.com/ayghri/i-have-adhd/blob/main/kimi.plugin.json), [`gemini-extension.json`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/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`](https://github.com/ayghri/i-have-adhd/blob/main/package.json) that references [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) without intermediate wrapper files. Both ultimately load the same core logic.