How the Pre-Send Check Algorithm Works in i-have-adhd: A Complete Breakdown

TLDR: The pre-send check algorithm in the ayghri/i-have-adhd repository is a sanitisation routine that strips opening announcements, closing recaps, "by the way" sidebars, hedging adverbs, and idioms from assistant responses, then verifies that the first line tells the user what to do next and the last line explains what was accomplished.

The pre-send check algorithm is the core quality gate inside the i-have-adhd skill. It runs at the final moment — right before the assistant's response is delivered to the user — and guarantees the output is action-oriented, concise, and free of filler. This is essential for an ADHD-focused assistant, where every extra sentence creates cognitive load.

As implemented in ayghri/i-have-adhd, the algorithm is defined in the skill file skills/i-have-adhd/SKILL.md and enforces the strict communication style required by "ADHD mode" across Claude, Codex, OpenCode, and Cursor runtimes.

What Is the Pre-Send Check Algorithm?

The pre-send check algorithm is a five-step sanitisation routine plus a final verification step. It scans a generated response, removes any elements that add noise rather than action, and then validates that the remaining text is self-contained and immediately useful.

The algorithm lives in the skill definition file at skills/i-have-adhd/SKILL.md (lines 28–41), with an identical copy at .cursor/skills/i-have-adhd/SKILL.md for Cursor compatibility.

Step 1: Identify and Remove Removable Fragments

The algorithm scans the generated response and removes specific categories of content that are considered harmful to ADHD-friendly communication.

Opening Announcements

The first sentence that says "I'm going to ..." or "I will ..." is deleted. This removes meta-talk that doesn't tell the reader what to do. The reader wants the action, not a description of what the assistant is about to do.

Closing Question or Recap

The last sentence that asks "Anything else?" or repeats what just happened is removed. The reader can already see the next action; repeating it wastes attention.

Any content introduced with the phrase "by the way" is stripped. These tangential remarks break focus and should never appear in the final output.

Hedging Adverbs

Words like perhaps, might, and could possibly are eliminated. They add no real information — they only weaken the action-oriented tone the skill demands.

Idioms and Figurative Phrases

Expressions like circle back, get the ball rolling, and on the same page are replaced with literal alternatives ("return later", "start now", "agree"). The reader must be able to act immediately, not decode a metaphor.

Step 2: The Verification Step

After all deletions are complete, the algorithm runs a readability sanity check. The question it asks is:

If a reader only reads the first line (the next action) and the last line (what just happened), must they be able to:

  • (a) know what to do next, and
  • (b) understand what has just been accomplished?

If both conditions are satisfied, the response is considered ready. If either condition fails, the pre-send check raises an error and the response is not sent — the harness must regenerate or adjust it.

Step 3: The Final Output Structure

Once the algorithm completes, the response must have a strict shape:

  • Opening line: a clear, actionable next step.
  • Closing line: a succinct description of completed work.
  • Middle content: no frills, no hedges, no idioms.

This structure ensures maximum scannability for a user with ADHD, who will likely read only the first and last lines.

Code Examples: Implementing the Pre-Send Check

The actual implementation lives inside the skill definition and is interpreted by the runtime harness. The snippets below illustrate how a runtime would apply the rules.

Python Pseudocode

Here is the algorithm expressed as runnable Python:

import re

def pre_send_check(response: str) -> str:
    # 1. Delete the opening announcement sentence

    response = delete_if_startswith(
        response, r'^[^.]*\b(I\'m|I will|I\'m|I\'ll)\b.*\.'
    )

    # 2. Delete the closing question/recap

    response = delete_if_endswith(
        response, r'\b(anything else\?|recap|what just happened)\b.*$'
    )

    # 3. Remove "by the way" sidebars

    response = re.sub(
        r'\bby the way\b.*?(?=\n|$)', '', response, flags=re.I
    )

    # 4. Strip hedging adverbs

    response = re.sub(
        r'\b(might|could possibly|perhaps)\b', '', response, flags=re.I
    )

    # 5. Replace idioms with literal equivalents

    idioms = {
        r'circle back': 'return later',
        r'get the ball rolling': 'start now',
        r'on the same page': 'agree'
    }
    for pattern, repl in idioms.items():
        response = re.sub(pattern, repl, response, flags=re.I)

    # 6. Verify first-line / last-line coverage

    lines = [ln.strip() for ln in response.splitlines() if ln.strip()]
    if not (line_has_action(lines[0]) and line_confirms_status(lines[-1])):
        raise ValueError(
            'Pre-send check failed - response not self-contained'
        )
    return '\n'.join(lines)

Using the Hook in a Node-Based Runtime

Here is what an expressed hook looks like for a Node-based plugin:

// hooks/always-on.mjs - simplified illustration
import { readFileSync } from 'fs';
import { resolve } from 'path';

const skillPath = resolve(import.meta.dirname, '../skills/i-have-adhd/SKILL.md');
const body = readFileSync(skillPath, 'utf8')
  .replace(/^---[\s\S]*?---\n/, '')   // strip YAML front-matter
  .replace(/(?:\r?\n)+$/, '');

export default async (input, output) => {
  // ...runtime decides to send a response...
  const cleaned = preSendCheck(output.assistantMessage);
  output.assistantMessage = cleaned;
};

The real hooks — hooks/always-on.mjs, .sh, and .ps1 — inject the entire ruleset into the system prompt. The pre-send check is then applied by the harness when the model finishes its turn.

Where the Rules Live: Key Files

The full rule set is defined in the skill file, with mirror copies for various runtimes:

File Role
skills/i-have-adhd/SKILL.md Canonical skill definition, contains the pre-send check rules.
.cursor/skills/i-have-adhd/SKILL.md Cursor-compatible copy, kept in sync.
hooks/always-on.mjs / .sh / .ps1 Runtime hook that loads the skill every turn.
.opencode/plugins/i-have-adhd.mjs OpenCode plugin providing the same always-on behavior.
tests/test_always_on_hooks.py Unit tests confirming the pre-send logic works across runtimes.

When the Pre-Send Check Runs

The algorithm is part of the always-on hook behavior. When the user opts into "ADHD mode", the skill file is injected into the system prompt. Then, each time the model is about to send a response, the pre-send check is applied to the raw completion.

The optional flags --no-respect and --no-style (parsed by the hook) control whether certain segments of the skill text are included — this lets you adjust how strictly the pre-send check is applied.

Why It Matters for ADHD Users

The pre-send check algorithm is the enforcement mechanism for the repository's core principle: the assistant must communicate with respect for the reader's attention. The commit line is clear — every word that doesn't move the user toward action is noise.

By removing meta-talk, hedges, idioms, and unnecessary closures, the final response becomes something the user can process in under five seconds.

Summary

  • The pre-send check algorithm removes opening announcements, closing recaps, "by the way" sidebars, hedging adverbs, and idioms from assistant responses.
  • After cleanup, it verifies that the first line communicates the next action and the last line confirms progress, otherwise the response is rejected.
  • The algorithm is defined in skills/i-have-adhd/SKILL.md (lines 28–41) and mirrored in .cursor/skills/i-have-adhd/SKILL.md.
  • It runs via the always-on hook (hooks/always-on.mjs, .sh, .ps1) and the OpenCode plugin, injecting the rule set into the system prompt each turn.
  • The output is a concise, action-oriented response whose first and last lines form a self-contained update.

Frequently Asked Questions

Where exactly is the pre-send check defined in the repository?

The canonical definition lives in skills/i-have-adhd/SKILL.md at lines 28–41. An identical copy is maintained at .cursor/skills/i-have-adhd/SKILL.md for Cursor compatibility.

Note: The file is SKILL.md in the skills folder.

What happens if the pre-send check fails?

The algorithm raises a validation error, which means the response is not sent in its current form. The harness must adjust the output (typically by alerting the model to the violation) so that the first line clearly states the next action and the last line confirms what was accomplished.

Does the pre-send check remove every instance of "by the way"?

Yes. The algorithm uses a regular expression that matches any occurrence of "by the way" followed by anything up to the end of the line, and removes that segment. This eliminates all sidebars that could distract from the primary instruction.

Can I disable the pre-send check?

Yes. The always-on hook parses the flags --no-respect and --no-style, which disable respect for user preferences or style rules respectively. However, the actual canonical definition of the pre-send check is always present in the system prompt; you would need to override the skill's behavior to fully disable the checks.

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 →