# How the i‑have‑adhd Skill Modifies LLM Output: A Technical Deep Dive

> Discover how the i-have-adhd skill transforms LLM output. It injects hidden prompts for immediate actionable responses, eliminating post-processing. Learn the technical details.

- Repository: [Ayoub Ghriss/i-have-adhd](https://github.com/ayghri/i-have-adhd)
- Tags: deep-dive
- Published: 2026-08-25

---

**The i‑have‑adhd skill modifies LLM output by injecting a hidden system prompt containing ten behavioral constraints directly into the model's context window, forcing immediate actionable responses without post‑processing.**

The `i‑have‑adhd` repository provides a Pi‑coding‑agent extension that fundamentally alters how large language models structure their responses. Rather than filtering or reformatting text after generation, this skill modifies the LLM's prompt context in real‑time to enforce ADHD‑friendly communication patterns. Understanding how the i‑have‑adhd skill modifies LLM output requires examining its three‑layer architecture: rule definition, state persistence, and context injection.

## Architecture Overview: Prompt Injection vs. Post‑Processing

Most text formatting tools manipulate output after the LLM finishes generating. The i‑have‑adhd skill takes a fundamentally different approach by prepending behavioral instructions to the active context.

According to the source code in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts), the extension implements a **context injection pattern**. It embeds a custom message with `display: false` (hidden from the user interface) but visible to the model. This message contains the full rule set from [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md), ensuring every subsequent token generation follows the constraints.

## Rule Definition and Storage

### The Constraint Catalog in SKILL.md

The ten specific behavioral rules live in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md). This markdown file defines concrete constraints such as "lead with the next action", "number multi‑step tasks", and "no preambles or closings". These rules are written in natural language that the LLM can interpret as instruction.

### Loading Mechanism

When the extension initializes, the `loadRules()` function reads [`SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/SKILL.md), strips YAML front‑matter, and stores the plain text in a `rules` constant. This occurs in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) during the extension's setup phase, ensuring the rule text is available for immediate injection.

## State Persistence Across Sessions

The skill tracks whether ADHD mode is active using a custom session entry defined by `STATE_ENTRY_TYPE = "i-have-adhd-state"`.

Two core functions manage this:

- `getSavedState()` – Retrieves the current boolean flag from the session storage
- `setEnabled()` – Persists the mode state so it survives session restarts

This persistence layer ensures users don't need to re‑enable the skill every time they start a new conversation.

## Context Synchronization and Injection

### Detecting Rule Presence

Before injecting rules, the extension checks if they're already present to avoid duplication. The `rulesAreInContext()` function calls `latestMarkerIsActive()` from [`extensions/context-compat.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/context-compat.ts), which scans the current context messages for custom markers of type `i-have-adhd-rules` (active) or `i-have-adhd-disabled` (inactive).

### Dynamic Injection Logic

The `syncContext()` function orchestrates the actual modification:

- If ADHD mode is **enabled** and rules are missing, it sends a hidden custom message with `customType: RULES_MESSAGE_TYPE` (equal to `"i-have-adhd-rules"`) containing the header and rule text
- If the mode is **disabled**, it sends `DISABLED_MESSAGE_TYPE` (`"i-have-adhd-disabled"`) to neutralize previous rule injections

These messages use `display: false`, making them invisible in the chat UI while remaining fully visible to the LLM's attention mechanism.

## User Interaction Layer

### Explicit Commands

Users control the skill through slash commands registered via `registerCommand`. The primary interface is `/i‑have‑adhd [on|off]`, which toggles the mode state and triggers `syncContext()` immediately.

Additionally, the built‑in alias `/skill:i-have‑adhd` enables the mode directly without arguments.

### Natural Language Triggers

The extension intercepts input events (`pi.on("input")`) to detect phrases like "stop adhd mode" or "normal mode". When detected, the extension:

1. Disables the mode via `setEnabled(false)`
2. Either returns a UI notification or transforms the reply to the plain text: `ADHD mode disabled.`

## Resulting Modifications to LLM Output

When active, the i‑have‑adhd skill modifies LLM output in four specific ways:

1. **Immediate actionability** – The model leads with the next concrete step rather than introductory explanations
2. **Structured numbering** – Multi‑step tasks appear as numbered lists (1., 2., 3.)
3. **Time estimates** – Responses include concise duration predictions
4. **Removal of social padding** – Elimination of "Sure, I'd be happy to help" preambles and "Let me know if you need anything else" closings

Crucially, the skill does **not** post‑process the model's text. It steers generation by supplying the rules as part of the system context, allowing the LLM to internalize the constraints during token prediction.

## Implementation Examples

Enable ADHD‑friendly output programmatically:

```typescript
// Toggle mode via command
await pi.sendMessage({ text: "/i-have-adhd on" }, { triggerTurn: true });

// Disable later
await pi.sendMessage({ text: "/i-have-adhd off" }, { triggerTurn: true });

```

Auto‑enable at session start using flags:

```typescript
pi.registerFlag("adhd", {
  description: "Start with ADHD‑friendly output enabled",
  type: "boolean",
  default: true,
});

```

Manual rule injection (advanced usage):

```typescript
pi.sendMessage(
  {
    customType: "i-have-adhd-rules",
    content: `ADHD MODE ACTIVE.\n\n${loadRules()}`,
    display: false,
  },
  { triggerTurn: false },
);

```

## Key Source Files

| Purpose | File Path |
|---------|-----------|
| Rule definition (10 constraints) | [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) |
| Main extension logic | [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts) |
| Context inspection utilities | [`extensions/context-compat.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/context-compat.ts) |
| Validation scripts | [`scripts/check_context_compat.ts`](https://github.com/ayghri/i-have-adhd/blob/main/scripts/check_context_compat.ts) |

## Summary

- The i‑have‑adhd skill modifies LLM output through **context injection**, not post‑processing
- Rules are defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) and loaded by `loadRules()` into the `rules` constant
- State persistence uses `STATE_ENTRY_TYPE = "i-have‑adhd‑state"` with `getSavedState()` and `setEnabled()` functions
- `syncContext()` injects hidden messages (`RULES_MESSAGE_TYPE` or `DISABLED_MESSAGE_TYPE`) with `display: false` to steer generation
- Users control the skill via `/i‑have‑adhd on/off` commands or natural language triggers like "stop adhd mode"
- Resulting output features immediate actionable steps, numbered lists, time estimates, and zero social padding

## Frequently Asked Questions

### Does the i‑have‑adhd skill filter or edit text after the LLM generates it?

No. The skill modifies the LLM's prompt context before generation occurs. It injects a hidden system message containing behavioral rules, causing the model to generate ADHD‑friendly text natively rather than filtering it after the fact.

### Where are the behavioral rules stored in the repository?

The ten constraints live in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md). The extension reads this file during initialization via `loadRules()` in [`extensions/i-have-adhd.ts`](https://github.com/ayghri/i-have-adhd/blob/main/extensions/i-have-adhd.ts), strips the front‑matter, and stores the markdown content for injection.

### How does the extension remember if ADHD mode was enabled?

The extension uses `STATE_ENTRY_TYPE = "i-have-adhd-state"` to persist a boolean flag in the session storage. The `getSavedState()` and `setEnabled()` functions read and write this entry, ensuring the mode survives across session restarts without requiring re‑activation.

### Can users disable the skill using natural language?

Yes. The extension listens to input events (`pi.on("input")`) and detects phrases like "stop adhd mode" or "normal mode". When recognized, the extension automatically disables the mode, removes the rules from context by sending a `DISABLED_MESSAGE_TYPE` message, and confirms with "ADHD mode disabled."