How to Invoke 'i-have-adhd' Explicitly in Codex: Command Syntax and API Examples
To invoke 'i-have-adhd' explicitly in Codex, type /i-have-adhd in the chat interface, optionally followed by on or off to force a specific state, or use the /skill:i-have-adhd alias for one-shot activation.
The i-have-adhd plugin by ayghri extends Codex (and Claude Code) with ADHD-friendly output formatting. This article breaks down exactly how the command registration works, the available invocation syntaxes, and how to trigger it programmatically using the Codex API.
Command Registration in the Extension Source
The plugin registers its command in [extensions/i-have-adhd.ts](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts). The pi.registerCommand() call exposes the functionality to Codex's command system:
pi.registerCommand("i-have-adhd", {
description: "Toggle ADHD-friendly output for this session",
handler: async (args, ctx) => { … }
});
The command name "i-have-adhd" becomes the slash command identifier. The handler receives optional arguments and session context, then updates state via internal setEnabled logic.
The plugin manifest at [.codex-plugin/plugin.json](https://github.com/ayghri/i-have-adhd/blob/main/.codex-plugin/plugin.json) completes the registration, making the command discoverable by Codex's runtime.
Explicit Invocation Syntax
Codex users have three ways to invoke the command explicitly from the chat interface:
/i-have-adhd— Toggles the current state (on becomes off, off becomes on)/i-have-adhd on— Forces ADHD-friendly mode enabled/i-have-adhd off— Forces ADHD-friendly mode disabled
Each variant triggers the same handler with different args values. The empty string (toggle), "on", or "off" determine the state transition logic.
Alternative: Skill Shortcut Syntax
For one-shot activation without toggling behavior:
/skill:i-have-adhd
This alias always enables the mode regardless of current state. It injects the rules from [skills/i-have-adhd/SKILL.md](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) immediately.
Programmatic API Invocation
Beyond slash commands, you can invoke 'i-have-adhd' explicitly through the Codex JavaScript API:
// Enable ADHD-friendly mode via API
await codex.runCommand("i-have-adhd", { args: "on" });
// Disable the mode
await codex.runCommand("i-have-adhd", { args: "off" });
// Toggle current state
await codex.runCommand("i-have-adhd", { args: "" });
The args parameter maps directly to the slash command arguments. The command name string "i-have-adhd" must match exactly—this is the same identifier registered in the extension source.
What Happens When You Invoke the Command
When executed, the handler performs three operations:
- Parses the argument — Empty string triggers toggle logic;
"on"/"off"set explicit state - Updates session state — Calls
setEnabled(true|false)and persists to session storage - Injects or withdraws rules — Adds the 10 ADHD-friendly formatting rules from
SKILL.mdwhen enabled, or removes them when disabled
The internal message flow looks like this:
// Example: user types "/i-have-adhd on"
await pi.sendMessage({ content: "/i-have-adhd on" }, { triggerTurn: true });
// → Extension sets `enabled = true`, stores state, and injects the ruleset.
// Example: toggling off
await pi.sendMessage({ content: "/i-have-adhd off" }, { triggerTurn: true });
// → Extension sets `enabled = false` and injects the disabled notice.
The { triggerTurn: true } option ensures Codex processes the state change immediately in the conversation flow.
Key Files Controlling Command Behavior
| File | Purpose |
|---|---|
[extensions/i-have-adhd.ts](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) |
Command registration and toggle handler implementation |
[.codex-plugin/plugin.json](https://github.com/ayghri/i-have-adhd/blob/main/.codex-plugin/plugin.json) |
Plugin manifest exposing the command to Codex |
[skills/i-have-adhd/SKILL.md](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) |
10 ADHD-friendly formatting rules injected when enabled |
[hooks/hooks.json](https://github.com/ayghri/i-have-adhd/blob/main/hooks/hooks.json) |
Lifecycle hook points for session integration |
Summary
- Slash command:
/i-have-adhd [on|off]is the primary explicit invocation method - Skill alias:
/skill:i-have-adhdenables mode unconditionally - API method:
codex.runCommand("i-have-adhd", { args: "on|off" })for programmatic control - State management: Handler in
extensions/i-have-adhd.tstogglesenabledflag and managesSKILL.mdinjection - Plugin registration: Declared in
.codex-plugin/plugin.jsonfor Codex runtime discovery
Frequently Asked Questions
What is the exact command name to use in Codex?
The exact command name is i-have-adhd (with hyphens). This string is passed to pi.registerCommand() in extensions/i-have-adhd.ts and must match precisely when using the API form codex.runCommand("i-have-adhd", ...).
Can I use 'i-have-adhd' in Claude Code as well as Codex?
Yes. The plugin architecture is compatible with both Codex and Claude Code. The same slash command syntax /i-have-adhd works in both environments because the registration mechanism via .codex-plugin/plugin.json is shared across these Anthropic coding tools.
What arguments does the command handler accept?
The handler accepts three argument variations: empty string (toggles state), "on" (forces enabled), and "off" (forces disabled). Any other value falls back to toggle behavior. These are parsed in the handler defined in extensions/i-have-adhd.ts.
Where are the ADHD-friendly rules stored when not active?
The rules live in [skills/i-have-adhd/SKILL.md](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) as static markdown. When the command disables the mode, the extension withdraws this content from the session context rather than storing a separate disabled version. The rules are re-injected from the same file on next activation.
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 →