How i-have-adhd Suppresses Tangents in AI Responses: System Prompt Engineering

The i-have-adhd project suppresses tangents by injecting a specific rule into the AI's system prompt that commands the model to finish the current issue before offering secondary items as separate, optional follow-ups.

The ayghri/i-have-adhd repository provides a Claude-Code and OpenCode skill designed to keep AI-generated responses focused and actionable. By embedding concrete behavioral rules directly into the system prompt, the tool leverages the model's instruction-following capabilities to eliminate "by-the-way" digressions that derail task completion for users with ADHD.

The "Suppress Tangents" Rule Definition

The core instruction resides in skills/i-have-adhd/SKILL.md at lines 64-70. This file serves as the source of truth for all ADHD-style interaction rules. The specific rule states:

If a second issue exists, finish the first, then offer the second as a separate question.
Bad: “Here’s the fix. By the way, your dependency is also stale, …”
Good: “Here’s the fix. Separately: there is also a stale dependency. Want me to handle that next?”

When active, this directive functions as a hard constraint. The model treats it as a system-level instruction, meaning it applies to every turn of the conversation without requiring reinforcement in user prompts.

System Prompt Injection Mechanism

No runtime logic monitors the AI output. Instead, the rule achieves enforcement through prompt injection at initialization. The repository provides two implementations that strip YAML front-matter from SKILL.md and append the rule body to the system prompt.

Claude-Code Integration

The hooks/always-on.mjs file handles automatic injection for Claude-Code environments. Lines 27-34 read the SKILL.md file, remove its front-matter, and write the remaining content to stdout, effectively appending it to the model's context:

  • Reads the skill definition from disk
  • Parses and removes YAML front-matter
  • Streams the rule set body into the active system prompt

OpenCode Integration

The .opencode/plugins/i-have-adhd.mjs file mirrors this behavior for OpenCode. Its rulesetBody() function (lines 35-43) performs the identical transformation:

  • Locates SKILL.md within the plugin directory
  • Strips metadata headers programmatically
  • Returns the raw rule text for system prompt concatenation

Enabling Always-On Tangent Suppression

Users can activate the rule set either on-demand via the /i-have-adhd command or always-on by creating specific flag files in their home directory. The always-on mode ensures the "suppress tangents" instruction persists across sessions without manual activation.

For Claude-Code:

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

For OpenCode:

mkdir -p ~/.config/opencode
touch ~/.config/opencode/.i-have-adhd-always

Once these files exist, the hook scripts automatically inject the complete rule set—including the tangent suppression directive—into every new AI session.

Practical Impact on AI Output

With the rule active in the system prompt, the model restructures its responses to enforce sequential task completion. Instead of embedding secondary issues within the primary solution, the AI separates them distinctly.

Example of suppressed tangents:


✅ Fixed the broken import path.

Separately: the project's README still references the old module name. Want me to update it now?

This output demonstrates the "Good" pattern from the rule definition. The first issue receives full attention and closure. The secondary issue appears only after a clear break, framed as an optional follow-up question rather than a mid-sentence diversion. The model avoids "by-the-way" style asides that would otherwise fragment the user's cognitive focus.

Summary

  • i-have-adhd suppresses tangents by embedding a concrete behavioral rule in skills/i-have-adhd/SKILL.md (lines 64-70) that instructs the model to finish one issue before introducing another.
  • System prompt injection occurs via hooks/always-on.mjs (Claude-Code) and .opencode/plugins/i-have-adhd.mjs (OpenCode), which strip YAML front-matter and append the rule body to the AI context.
  • Always-on activation requires creating flag files at ~/.claude/.i-have-adhd-always or ~/.config/opencode/.i-have-adhd-always.
  • No runtime filtering is necessary; the model's inherent instruction-following capabilities enforce the rule once present in the system prompt.
  • Output structure changes from blended asides to sequential, opt-in follow-ups (e.g., "Separately: ...?").

Frequently Asked Questions

How does the "Suppress tangents" rule technically prevent digressions?

The rule does not rely on post-processing or output filtering. Instead, it operates at the prompt engineering layer. By including the instruction in the system prompt, the model internalizes it as a core behavioral constraint before generation begins. According to the source code in skills/i-have-adhd/SKILL.md, the rule explicitly defines the desired output structure, causing the model to self-correct during token generation to avoid "by-the-way" patterns.

What is the difference between on-demand and always-on activation?

On-demand activation requires manually invoking the /i-have-adhd command when you need focused responses. Always-on activation creates a persistent flag file (~/.claude/.i-have-adhd-always or ~/.config/opencode/.i-have-adhd-always) that triggers automatic injection via the hook scripts (always-on.mjs or i-have-adhd.mjs) every time a new AI session starts. The always-on mode suits users who require consistent tangent suppression across all interactions.

Where is the rule definition physically stored in the repository?

The canonical definition resides in skills/i-have-adhd/SKILL.md at lines 64-70. This file contains the complete rule set written in Markdown with YAML front-matter. Both the Claude-Code hook and the OpenCode plugin reference this specific file path when injecting rules into the system prompt, making it the single source of truth for the project's behavior.

Why does the injection code strip YAML front-matter from SKILL.md?

The front-matter contains metadata (such as skill name and version) intended for human readers or package managers, not for the AI model. The stripping logic in hooks/always-on.mjs (lines 27-34) and .opencode/plugins/i-have-adhd.mjs (lines 35-43) ensures that only the behavioral rules (the actual content) reach the system prompt. Including metadata would consume context window tokens without providing the model actionable instructions, potentially diluting the effectiveness of the "suppress tangents" directive.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →