# Does the i-have-adhd Hook in Claude Code Block Session Start?

> Discover if the i-have-adhd hook blocks Claude code block sessions. Learn how it conditionally injects rules without interruption for a smoother experience.

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

---

**No, the i-have-adhd hook does not block session start; it conditionally injects ADHD-friendly response rules only when a user-created flag file exists, otherwise allowing sessions to proceed normally.**

The **i-have-adhd** repository by ayghri provides Claude Code hooks designed to modify AI interactions for users with ADHD. According to the source code in `hooks/always-on.mjs`, the SessionStart hook operates as a non-blocking enrichment mechanism that checks for explicit user opt-in before modifying any session behavior.

## How the SessionStart Hook Works

The hook executes during Claude Code's initialization phase but follows a fail-safe pattern that ensures zero interruption to the startup flow. When Claude Code triggers the SessionStart event, the script located at `hooks/always-on.mjs` performs a sequential check to determine whether to inject the ADHD ruleset.

The architectural flow follows these steps:

1. **Hook Invocation**: Claude Code invokes `hooks/always-on.mjs` at lines 1-2 immediately upon session creation.

2. **Flag Detection**: The script constructs the path `$CLAUDE_CONFIG_DIR/.i-have-adhd-always` (defaulting to `~/.claude/.i-have-adhd-always`) and checks for file existence at lines 17-19.

3. **Conditional Injection**: If the flag file exists, the script reads [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) containing the 10 ADHD-friendly rules and injects them via `session.injectSkillFile` at lines 22-26.

4. **Early Return**: If the flag file is absent, the script executes `if (!existsSync(flagPath)) return;` and exits immediately without modifying the session.

5. **Session Continuation**: The session proceeds normally regardless of whether the rules were injected or not.

The same non-blocking logic is implemented in [`hooks/always-on.sh`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/always-on.sh) for Unix-like systems and `hooks/always-on.ps1` for Windows PowerShell environments, ensuring consistent behavior across platforms.

## Enabling and Disabling the Always-On Mode

The always-on mode requires explicit user action to create a flag file in the Claude configuration directory. Without this file, the hook remains dormant.

To enable always-on mode and automatically inject ADHD rules on every session start:

```bash

# Create the flag file in the default Claude config directory

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

```

To disable always-on mode and allow sessions to start without ADHD rule injection:

```bash

# Remove the flag file

rm -f ~/.claude/.i-have-adhd-always

```

## Manual Skill Injection Without the Flag File

Users who prefer not to use the always-on flag can manually inject the ADHD ruleset during active sessions. This approach provides on-demand access to the functionality without persistent session modifications.

```javascript
// In a Claude Code console or custom script
session.injectSkillFile('i-have-adhd', '/path/to/skills/i-have-adhd/SKILL.md');

```

## Key Source Files in the Repository

Understanding the hook architecture requires familiarity with these specific source files:

- `hooks/always-on.mjs`: The primary SessionStart hook that conditionally injects the ADHD ruleset based on flag file detection.

- [`hooks/always-on.sh`](https://github.com/ayghri/i-have-adhd/blob/main/hooks/always-on.sh): Bash implementation of the hook for Unix-like shells, maintaining identical logic to the Node.js version.

- `hooks/always-on.ps1`: PowerShell implementation for Windows environments, ensuring cross-platform consistency.

- [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md): Contains the 10 ADHD-friendly rules that get injected when always-on mode is active.

- [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts): Defines the runtime message types (`i-have-adhd-rules`, `i-have-adhd-disabled`, etc.) used by both the hook and the skill injection system.

## Summary

- The **i-have-adhd hook** is strictly non-blocking and never prevents Claude Code sessions from initializing.
- The hook checks for the existence of `~/.claude/.i-have-adhd-always` before taking any action.
- When the flag file exists, the hook injects the full ADHD ruleset from [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md) via `session.injectSkillFile`.
- When the flag file is absent, the hook returns immediately without modifying the session.
- Cross-platform implementations in `.sh` and `.ps1` ensure consistent behavior across operating systems.

## Frequently Asked Questions

### Does the i-have-adhd hook prevent Claude Code from starting if the flag file is corrupted?

No, the hook contains error-handling logic that prevents any session interruption. If the flag file exists but cannot be read, or if `session.injectSkillFile` fails, the error is caught and the session continues normally without the ADHD modifications. The hook's design prioritizes session availability over rule injection.

### How do I verify that the always-on mode is actually working?

After creating the flag file at `~/.claude/.i-have-adhd-always`, start a new Claude Code session and check for the presence of ADHD-friendly formatting in responses. You can also inspect the session logs or manually verify that `hooks/always-on.mjs` is executing by adding debug output to the script at lines 22-26 where `session.injectSkillFile` is called.

### What is the performance impact of the SessionStart hook?

The hook performs minimal I/O operations—specifically a single file existence check via `existsSync(flagPath)` and potentially one file read operation if the flag is present. These operations occur in milliseconds and do not measurably impact Claude Code's startup time, as confirmed by the synchronous but lightweight implementation in `hooks/always-on.mjs`.

### Can I use the i-have-adhd rules without installing the hook system?

Yes, you can manually invoke the skill injection using the `session.injectSkillFile` method in any active Claude Code session. This allows you to load the ADHD rules from [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) on a per-session basis without creating the persistent flag file required by the automatic hook system.