What Is the Pi/OMP Extension for i-have-adhd? Runtime-Agnostic ADHD Mode Explained

The Pi/OMP extension in extensions/i-have-adhd.ts implements runtime-agnostic logic that enables ADHD-friendly response mode for both Pi and Open-Model-Programming (OMP) agents through dynamic rule injection, session state tracking, and CLI/slash command controls.

The i-have-adhd repository by ayghri provides a modular system for making AI agent interactions more accessible to users with ADHD. The Pi/OMP extension serves as the bridge between the core ruleset and multiple runtime environments, allowing the same TypeScript code to power ADHD mode across different agent platforms.

What the Pi/OMP Extension Does

The extension located at extensions/i-have-adhd.ts performs seven core functions that coordinate ADHD mode activation, persistence, and context management.

Loads ADHD Rules from Canonical Source

The loadRules() function reads the ADHD response guidelines from skills/i-have-adhd/SKILL.md at relative path ../skills/i-have-adhd/SKILL.md. This ensures all runtimes use identical behavioral rules regardless of how the extension is invoked.

// From extensions/i-have-adhd.ts lines 61-78
// Loads rules from ../skills/i-have-adhd/SKILL.md

Reads Optional User Configuration

The extension checks for i-have-adhd.json in the agent's data directory to support persistent preferences. The alwaysOn flag forces ADHD mode for all sessions, while hideStatus suppresses the UI badge.

{
  "alwaysOn": true,
  "hideStatus": false
}

Configuration is read during extension initialization at lines 42-49 of extensions/i-have-adhd.ts.

Tracks Session State Persistence

ADHD mode state survives across conversation turns through a custom session manager entry named i-have-adhd-state. The helper getSavedState() scans the current session branch to retrieve the stored boolean.

// From extensions/i-have-adhd.ts lines 81-95
// getSavedState() retrieves persisted enabled/disabled status

This mechanism ensures users don't need to re-enable the mode after every model response.

Injects or Removes Rules Dynamically

The syncContext() function manages whether the ADHD ruleset appears in the model's context window. Rules are injected as a hidden custom message when enabled, or replaced with a disabled notice when turned off.

The companion function rulesAreInContext()—implemented in extensions/context-compat.ts—uses latestMarkerIsActive to check whether the most recent custom message represents active rules or a deactivation notice (lines 41-61).

Displays Visual Status Indicator

When ADHD mode is active and configuration permits, the extension renders a status badge reading "● ADHD ON". This visual confirmation appears unless hideStatus is set to true in the configuration file (lines 19-28).

Registers CLI Flag and Slash Commands

Users can activate ADHD mode through multiple interfaces:

Method Command Behavior
CLI flag --adhd Starts session with mode pre-enabled
Slash command /i-have-adhd on Explicitly enables during session
Toggle /i-have-adhd Flips current state (on↔off)
Natural language /skill:i-have-adhd Alias for enable

The flag registration and command handlers occupy lines 81-109 in extensions/i-have-adhd.ts.

Responds to Natural Language Input

The extension parses user messages for deactivation phrases like "stop adhd mode" or "normal mode". When matched without UI presence, it returns the exact confirmation string "ADHD mode disabled." (lines 11-34).

How to Use the Pi/OMP Extension

Enable via Slash Command

/i-have-adhd on

This stores enabled = true, injects the ruleset, and displays the status badge.

Quick Toggle Without Argument

/i-have-adhd

State flips from current value: off becomes on, on becomes off.

Disable with Natural Language

stop adhd mode

Mode deactivates immediately with confirmation response when UI is unavailable.

Start with CLI Flag

pi run --adhd

# or

omp run --adhd

Session initializes with ADHD mode already active, bypassing default disabled state.

Runtime Compatibility Architecture

The same extensions/i-have-adhd.ts file powers both Pi and OMP without modification. Runtime-specific wiring occurs in separate manifest files (.claude-plugin/plugin.json, .codex-plugin/plugin.json, etc.) that import and register this unified extension.

This design eliminates code duplication while supporting platform-specific packaging requirements.

Key Source Files

File Purpose
extensions/i-have-adhd.ts Core extension with state management, commands, and context sync
extensions/context-compat.ts Helper utilities for reading session context and marker detection
skills/i-have-adhd/SKILL.md Canonical ruleset injected when mode is active
i-have-adhd.json (user-created) Optional configuration for alwaysOn and hideStatus
Runtime manifest files Platform-specific wiring for Pi or OMP discovery

Summary

  • The Pi/OMP extension provides runtime-agnostic ADHD mode for Pi and Open-Model-Programming agents through a single TypeScript implementation.
  • State persistence uses custom session manager entries to survive across conversation turns.
  • Context injection dynamically adds or removes rules via hidden custom messages managed by syncContext() and tracked by rulesAreInContext().
  • Multiple activation methods include the --adhd CLI flag, /i-have-adhd slash commands, and natural language parsing.
  • Optional configuration via i-have-adhd.json supports always-on mode and UI customization.

Frequently Asked Questions

What is the difference between Pi and OMP in i-have-adhd?

Pi and OMP (Open-Model-Programming) are two distinct agent runtimes supported by the i-have-adhd repository. The Pi/OMP extension uses identical code for both—the only difference is which runtime manifest file imports the extension. Pi typically refers to the original Claude-based runtime, while OMP supports open-weight language models.

How does the extension remember if I enabled ADHD mode?

The extension persists state through a custom session manager entry named i-have-adhd-state. The getSavedState() function scans the current session branch to retrieve this value, ensuring your preference survives across multiple model responses without requiring reactivation.

Can I make ADHD mode the default for all my sessions?

Yes. Create i-have-adhd.json in your agent's data directory with {"alwaysOn": true}. When this configuration is present, the extension skips default disabled state and automatically enables ADHD mode for every new session, regardless of CLI flags or prior session history.

Why does the extension use a separate context-compat.ts file?

The extensions/context-compat.ts module isolates runtime-specific context operations—particularly latestMarkerIsActive used by rulesAreInContext(). This abstraction layer allows the main extension logic to remain portable across Pi and OMP runtimes while handling platform differences in how session contexts are inspected.

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 →