# How to Enable or Disable Specific Features in the i-have-adhd Plugin

> Learn how to enable or disable features in the i-have-adhd plugin. Control ADHD mode and individual sub-features using slash commands or the pi appendEntry API.

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

---

**The i-have-adhd plugin manages feature flags through a persistent runtime state entry (`STATE_ENTRY_TYPE`), allowing you to toggle the main ADHD mode via the `/i-have-adhd` slash command or programmatically control individual sub-features using the `pi.appendEntry` API.**

The ayghri/i-have-adhd repository provides a Claude Code plugin that reformats AI responses to follow ADHD-friendly cognitive rules. Understanding how to enable or disable specific features in the i-have-adhd plugin gives you granular control over which behavioral modifications—such as numbered steps, stop-phrases, or action-first formatting—are active during your sessions.

## How the Plugin Stores Feature State

The plugin initializes its operational state by reading a persisted boolean from the host environment. In [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts), the startup logic determines whether ADHD-friendly mode should be active by checking a saved state against a default value:

```typescript
// extensions/i-have-adhd.ts
const enabledByDefault = …;
enabled = savedState ?? enabledByDefault;

```

This state is stored under a specific runtime entry type (`STATE_ENTRY_TYPE`) that persists across sessions. When the plugin loads, it retrieves this entry to restore your previous configuration, ensuring that features remain enabled or disabled exactly as you left them.

## Toggling the Main ADHD Mode with Slash Commands

The primary user interface for feature control is the `/i-have-adhd` slash command registered in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts). The command description indicates that the feature starts enabled by default, and when invoked, the handler flips the current boolean state:

```typescript
setEnabled(!enabled, ctx);   // toggles the mode [source line 175]

```

Upon execution, the plugin immediately provides UI feedback through a notification:

```typescript
ctx.ui.notify(`ADHD mode ${enabled ? "enabled" : "disabled"}`, "info");

```

To toggle the entire plugin from the command line:

```text
/i-have-adhd            # flips the current state (enabled ⇆ disabled)

```

## Controlling Individual Sub-Features

Beyond the global toggle, the plugin supports granular control over specific ADHD-friendly formatting rules. Each sub-feature—such as **numbered steps**, **stop-phrases**, or **action-first** formatting—maintains its own boolean flag within the state object.

The source code checks these individual flags in conditional blocks (around lines 121-133 in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts)):

```typescript
if (enabled && config.numberedSteps) {
  // Apply numbered step formatting
}
if (enabled && config.stopPhrases) {
  // Insert stop-phrase markers
}

```

To enable a specific sub-feature programmatically without affecting the global state:

```typescript
import { pi } from "pi";               // host API
import { STATE_ENTRY_TYPE } from "./extensions/i-have-adhd";

const current = await pi.getEntry(STATE_ENTRY_TYPE);
await pi.appendEntry(STATE_ENTRY_TYPE, {
  ...current,
  numberedSteps: true,                 // enable only this specific feature
  stopPhrases: false,                  // explicitly disable others
});

```

## Persisting State Across Sessions

The plugin ensures your preferences survive between restarts through the `pi.appendEntry` method. When you modify any feature flag—whether through the slash command or direct API calls—the updated state object is appended to the persistent storage:

```typescript
await pi.appendEntry(STATE_ENTRY_TYPE, newState);

```

On the next initialization, the plugin retrieves this entry via `pi.getEntry(STATE_ENTRY_TYPE)` and restores your custom configuration. This persistence mechanism allows you to permanently disable features you do not need or keep specific optimizations always enabled.

## Practical Implementation Examples

### Check Current Plugin Status

To verify whether ADHD mode is active and inspect individual feature states:

```typescript
const state = await pi.getEntry(STATE_ENTRY_TYPE);
console.log(`ADHD mode is ${state.enabled ? "ON" : "OFF"}`);
console.log(`Numbered steps: ${state.numberedSteps}`);

```

### Disable All Features Temporarily

To turn off all ADHD-friendly formatting without losing your configuration:

```typescript
const current = await pi.getEntry(STATE_ENTRY_TYPE);
await pi.appendEntry(STATE_ENTRY_TYPE, {
  ...current,
  enabled: false,
});

```

### Enable Only Action-First Formatting

To activate a single specific feature while keeping others disabled:

```typescript
await pi.appendEntry(STATE_ENTRY_TYPE, {
  enabled: true,
  actionFirst: true,
  numberedSteps: false,
  stopPhrases: false,
});

```

## Summary

- The i-have-adhd plugin stores all feature flags in `STATE_ENTRY_TYPE`, retrieved on load via `pi.getEntry`.
- Use the `/i-have-adhd` slash command to toggle the global mode, which calls `setEnabled(!enabled, ctx)` and persists immediately.
- Individual sub-features (numbered steps, stop-phrases, action-first) are controlled by separate booleans in the state object, checked in `if (enabled && ...)` blocks throughout [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts).
- All changes persist across sessions through `pi.appendEntry`, ensuring your preferences are restored on the next plugin initialization.
- Programmatic control is available through the host API (`pi.getEntry` and `pi.appendEntry`) for custom scripts and advanced configurations.

## Frequently Asked Questions

### How do I check if ADHD mode is currently enabled?

Query the persistent state entry directly using the host API. The current status is stored in the `enabled` property of the `STATE_ENTRY_TYPE` object:

```typescript
const state = await pi.getEntry(STATE_ENTRY_TYPE);
const isActive = state.enabled;  // true or false

```

### Can I enable specific features without turning on the main ADHD mode?

No, individual sub-features are only processed when the global `enabled` flag is true. The plugin logic wraps feature-specific code in `if (enabled && featureFlag)` conditions. You must set `enabled: true` in the state object for any sub-feature formatting to apply.

### Where is the plugin state stored?

The state is stored in the host environment's persistent entry system under the `STATE_ENTRY_TYPE` identifier. This is not a local file but rather a runtime entry managed by the Claude Code host through the `pi` API, accessed via `pi.getEntry` and updated via `pi.appendEntry` in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts).

### How do I reset the plugin to default settings?

Reset the state by appending a new entry with undefined or default values. The plugin will fall back to `enabledByDefault` when `savedState` is null:

```typescript
await pi.appendEntry(STATE_ENTRY_TYPE, {
  enabled: undefined,  // triggers fallback to enabledByDefault
  numberedSteps: undefined,
  stopPhrases: undefined,
});

```