# What Is the .i-have-adhd-always Flag File and How Does It Configure Always-On Mode?

> Discover the .i-have-adhd-always flag file and how it enables automatic ADHD-friendly AI interactions. Configure always-on mode effortlessly.

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

---

**The `.i-have-adhd-always` flag file acts as a sentinel that automatically injects ADHD-friendly interaction rules into every AI session, eliminating the need to manually trigger the `/i-have-adhd` command each time.**

The `ayghri/i-have-adhd` repository provides an opt-in framework for ADHD-friendly AI interactions across Claude Code, Opencode, and Pi. The `.i-have-adhd-always` file serves as a persistence mechanism that activates "always-on" mode by its mere presence in a runtime-specific configuration directory.

## How the .i-have-adhd-always Flag File Works

The flag file operates as a simple existence check. When present, it triggers automatic ruleset injection; when absent, it forces manual activation.

### Presence Enables Always-On Mode

When the runtime detects the file, its **SessionStart** hook automatically inserts the full i-have-adhd ruleset into the conversation once at startup. In [`hooks/always-on.sh`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/always-on.sh), the Claude Code implementation resolves the configuration directory using `${CLAUDE_CONFIG_DIR:-$HOME/.claude}`, constructs the `flag_path`, and conditionally executes based on the `[ -f "$flag_path" ]` test.

### Absence Restores Manual Control

Deleting the flag file immediately reverts to default behavior. Without the sentinel, the ADHD ruleset remains dormant until explicitly activated via the `/i-have-adhd` command for that specific session.

## Configuration Interaction and Precedence

The Pi extension in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) evaluates three independent sources to determine the initial state using logical OR logic:

```ts
const alwaysOnFlag = join(getAgentDir(), ".i-have-adhd-always");
const enabledByDefault =
    pi.getFlag("adhd") === true ||
    config.alwaysOn === true ||
    existsSync(alwaysOnFlag);

```

**The three configuration sources are:**

- **`pi.getFlag("adhd")`** – A user-set boolean toggled via runtime commands.
- **`config.alwaysOn`** – A programmatic setting defined in the repository's configuration or [`INSTALL.md`](https://github.com/ayghri/i-have-adhd/blob/main/INSTALL.md).
- **`existsSync(alwaysOnFlag)`** – The filesystem check for the `.i-have-adhd-always` sentinel in the agent directory.

Any single source resolving to `true` enables the always-on behavior. The resulting `enabledByDefault` boolean drives the `restoreState` function to inject rules at session initialization.

## Implementation Across Runtimes

Each supported AI runtime implements the flag check in its native environment:

- **[`hooks/always-on.sh`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/always-on.sh)** – Bash implementation for Claude Code supporting macOS and Linux.
- **`hooks/always-on.mjs`** – Node.js equivalent for JavaScript-based Claude Code environments.
- **`hooks/always-on.ps1`** – PowerShell variant for Windows users.
- **[`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts)** – TypeScript logic for the Pi runtime that mirrors the shell behavior.
- **[`INSTALL.md`](https://github.com/ayghri/i-have-adhd/blob/main/INSTALL.md)** – Documentation specifying flag locations for Opencode at `~/.config/opencode/`.

## Why the Flag File Exists

The sentinel file architecture addresses three specific design requirements:

**Convenience** – Eliminates repetitive typing of the `/i-have-adhd` command for users who require ADHD-friendly formatting on every interaction.

**Idempotence** – File creation and deletion are atomic, portable operations that function identically across all supported operating systems and runtimes.

**Explicit Opt-In** – The physical presence of `.i-have-adhd-always` in the user's config directory makes the "always-on" state visible and intentionally set, preventing accidental activation while remaining trivial to disable.

## Enabling and Disabling Always-On Mode

Create the flag file in the appropriate directory for your runtime to enable automatic injection.

Enable for Claude Code:

```bash
touch ~/.claude/.i-have-adhd-always

```

Enable for Opencode:

```bash
touch ~/.config/opencode/.i-have-adhd-always

```

Enable for Pi:

```bash
touch ~/.pi/agent/.i-have-adhd-always

```

Disable by removing the corresponding file:

```bash
rm ~/.claude/.i-have-adhd-always

```

## Summary

- The `.i-have-adhd-always` file acts as a sentinel enabling automatic ruleset injection at session start without manual commands.
- Location varies by runtime: `~/.claude/`, `~/.config/opencode/`, or `~/.pi/agent/` (or `$PI_CODING_AGENT_DIR` if set).
- Configuration uses OR logic between the flag file, `config.alwaysOn`, and runtime-specific flags like `pi.getFlag("adhd")`.
- Deleting the file immediately restores manual activation mode for subsequent sessions.
- Implementation spans shell scripts ([`hooks/always-on.sh`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/always-on.sh)), Node.js hooks (`hooks/always-on.mjs`), PowerShell (`hooks/always-on.ps1`), and TypeScript extensions ([`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts)).

## Frequently Asked Questions

### Where do I create the .i-have-adhd-always file for Claude Code?

Create the file at `~/.claude/.i-have-adhd-always`. If you have set a custom `CLAUDE_CONFIG_DIR` environment variable, place the file in that directory instead. The shell hook at [`hooks/always-on.sh`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/always-on.sh) checks this specific path during every session initialization and exits silently if the file is absent.

### What takes precedence: the flag file or the config.alwaysOn setting?

Neither takes precedence; the system uses logical OR evaluation as implemented in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts). If the flag file exists **or** `config.alwaysOn` equals `true`, or if the user flag is set, the always-on mode activates. Multiple sources can simultaneously be true without conflict.

### Can I use the always-on mode with Opencode and Pi?

Yes. The repository supports Opencode via `~/.config/opencode/.i-have-adhd-always` and Pi via `~/.pi/agent/.i-have-adhd-always`. The TypeScript logic in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) handles the Pi implementation by checking `existsSync(alwaysOnFlag)`, while shell hooks handle Claude Code and Opencode integration.

### Is the flag file safe to delete if I want to disable the feature?

Yes. The `.i-have-adhd-always` file is purely a sentinel marker containing no data. Deleting it with `rm` immediately disables automatic injection for new sessions. This action is non-destructive and leaves all other configuration intact; you can recreate the file at any time using `touch` to re-enable the feature.