# How the i-have-adhd Skill Detects When to Break Its ADHD Rules

> Learn how the i-have-adhd skill detects when to break its ADHD rules. Discover the trigger patterns that override formatting for safety and clarity.

- Repository: [Ayoub Ghriss/i-have-adhd](https://github.com/ayghri/i-have-adhd)
- Tags: internals
- Published: 2026-09-13

---

**The i-have-adhd skill uses a deterministic, rule-based detection mechanism that scans every incoming message for six specific trigger patterns—ranging from destructive commands to debug spirals—to determine exactly when its strict ADHD formatting rules must be temporarily overridden for safety or clarity.**

The `ayghri/i-have-adhd` repository implements a specialized AI skill designed to maintain concise, ADHD-friendly communication throughout a session. However, the system includes a sophisticated mechanism for detecting when ADHD rules should be broken, ensuring that safety, accuracy, and task requirements always take precedence over brevity. This override logic is fully defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) and operates deterministically on a per-turn basis.

## The Six Detection Triggers

The detection mechanism defined in the skill specification monitors for six distinct situational cues. When any pattern matches, the skill immediately suspends its standard ADHD constraints for that turn.

### 1. Explanation and Walkthrough Requests

When the user explicitly asks for an explanation or detailed walkthrough, the skill switches to **full-explanation mode**. While it maintains the no-preamble/no-closing style, it allows longer content with rich headers to properly educate the user.

For example, if the user sends *"Explain how the rule-engine works"*, the system detects the trigger via regex pattern `\bexplain|walk\s+me\s+through\b` and permits a comprehensive response that would otherwise violate brevity rules.

### 2. Destructive Actions Requiring Confirmation

Safety overrides brevity when the user requests destructive operations. The system scans for patterns matching `\brm\s+-rf\b|force\s+push|drop\s+table\b` to identify dangerous commands like `rm -rf` or `DROP TABLE`.

Instead of providing a brief confirmation, the skill **asks for explicit confirmation** before proceeding. For instance, a request to *"Drop the entire `users` table"* triggers the override, forcing the agent to respond: *"Are you sure you want to drop the `users` table? This action cannot be undone."*

### 3. Debug Spiral Detection

The skill tracks recent conversation history to detect **debug spirals**—repetitive failure loops where the last three turns contain reports that something is *"still broken"*.

If `len([t for t in recent_turns[-3:] if "still broken" in t.lower()]) == 3` evaluates to true, the skill stops iterating on fixes. It surfaces the most likely faulty assumption and asks a single diagnostic question, such as: *"I suspect the mock data isn't being loaded. Should I verify the mock configuration?"*

### 4. Real Ambiguity in User Requests

When the system detects genuine ambiguity using patterns like `\bwhat\s+should\s+i\s+do\b|\bunsure\b`, it **asks clarifying questions** rather than guessing. This ensures the next action is well-defined and prevents wasted effort on incorrect assumptions.

An ambiguous request like *"Do you want me to refactor the auth logic or the UI?"* triggers this override, prioritizing accuracy over the default rule to provide immediate answers.

### 5. Rule-Task Conflicts

Sometimes the ADHD rules themselves would prevent completing the task. For example, the *"no-list-over-5-items"* rule conflicts with a user request to *"list all"* options. In these cases, **task requirements win**; the skill relaxes the conflicting rule while maintaining the overall ADHD-friendly shape of the response.

### 6. Rule-Harness Conflicts

When the system prompt or tool-call requirements conflict with the skill's brevity rules, the harness requirements take precedence. If the message starts with `/tool ` or requires a specific tool invocation, the skill **performs the required work directly**, overriding its own formatting constraints to satisfy the runtime environment.

## Implementation in the Source Code

The detection logic is implemented as a deterministic scanning function. According to the source code in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md), the system evaluates each incoming message against the trigger patterns before applying any ADHD formatting rules.

```python
def should_break_rules(message: str, recent_turns: list[str]) -> bool:
    # 1️⃣ Explanation request

    if re.search(r'\bexplain|walk\s+me\s+through\b', message, re.I):
        return True

    # 2️⃣ Destructive command detection

    if re.search(r'\brm\s+-rf\b|force\s+push|drop\s+table\b', message, re.I):
        return True

    # 3️⃣ Debug spiral (three recent "still broken")

    if len([t for t in recent_turns[-3:] if "still broken" in t.lower()]) == 3:
        return True

    # 4️⃣ Ambiguous request

    if re.search(r'\bwhat\s+should\s+i\s+do\b|\bunsure\b', message, re.I):
        return True

    # 5️⃣ Rule-task conflict (e.g., request for a long list)

    if re.search(r'\blist\s+all\b', message, re.I):
        return True

    # 6️⃣ Harness conflict (tool call needed)

    if message.startswith('/tool '):
        return True

    return False

```

This logic ensures that overrides are applied consistently across both the canonical skill definition and the Cursor-compatible copy located at [`.cursor/skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/.cursor/skills/i-have-adhd/SKILL.md).

## How the Override Mechanism Works

When `should_break_rules` returns `True`, the skill enters an **override state** for the current turn only. During this state, the specific conflicting ADHD rule is suspended while the core stylistic principles (no excessive preamble, no verbose closing) remain intact where possible.

After processing the override turn, the skill **immediately reverts** to its standard ADHD rules for subsequent interactions. This temporary suspension ensures that safety confirmations, necessary explanations, or tool invocations can occur without permanently compromising the concise communication style optimized for ADHD users.

## Summary

- The `ayghri/i-have-adhd` repository defines its override logic in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md), with a Cursor-compatible mirror at [`.cursor/skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/.cursor/skills/i-have-adhd/SKILL.md).
- **Six deterministic triggers** determine when to break ADHD rules: explanation requests, destructive actions, debug spirals, ambiguous input, rule-task conflicts, and rule-harness conflicts.
- The `should_break_rules` function implements regex-based pattern matching against the current message and recent conversation history to detect these states.
- Overrides are **temporary and turn-specific**, automatically reverting to standard ADHD formatting after the critical interaction completes.
- Safety and task completion always take precedence over brevity, particularly for destructive commands like `rm -rf` or database schema modifications.

## Frequently Asked Questions

### How does the i-have-adhd skill detect a debug spiral?

The skill maintains a sliding window of the three most recent turns and counts occurrences of the phrase *"still broken"*. If all three contain this indicator of repeated failure, the system triggers the debug spiral override, stops attempting iterative fixes, and instead proposes a diagnostic hypothesis with a single clarifying question.

### What happens when ADHD rules conflict with tool requirements?

When the system harness requires a tool call (indicated by messages starting with `/tool ` or similar system-level directives), the skill immediately overrides its brevity rules to execute the required action. The task requirements and system integrity take precedence over the skill's standard formatting constraints.

### Are the rule overrides permanent once triggered?

No, the overrides are **strictly temporary**. The detection mechanism in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) specifies that the skill applies the override only for the current turn where the trigger was detected. Once that interaction completes, the system automatically reverts to enforcing the standard ADHD-focused rules for all subsequent messages.

### Where is the detection mechanism documented?

The complete detection logic and override conditions are documented in the master specification file [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) within the `ayghri/i-have-adhd` repository. A synchronized copy optimized for Cursor IDE integration is maintained at [`.cursor/skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/.cursor/skills/i-have-adhd/SKILL.md), ensuring consistent behavior across different runtime environments.