# What Is the Pre-Send Check in i-have-adhd and How to Verify Compliance

> Discover the i-have-adhd pre-send check a validation hook ensuring ADHD-friendly formatting. Learn how this feature automatically enforces 10 rules for better assistant responses.

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

---

**The pre-send check is a built-in validation hook in the ayghri/i-have-adhd repository that intercepts assistant responses before delivery to enforce 10 ADHD-friendly formatting rules, automatically regenerating output that violates constraints like "action-first" instructions or "no closing remarks."**

The ayghri/i-have-adhd project is an open-source skill designed to make AI interactions more accessible for users with ADHD. At its core lies the **pre-send check**, a critical gatekeeping mechanism implemented in `hooks/always-on.mjs` that ensures every response adheres to strict formatting guidelines defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md) before reaching the user.

## What Is the Pre-Send Check in i-have-adhd?

The **pre-send check** is a hook that executes immediately before the assistant's response is transmitted to the user. According to the source code in `hooks/always-on.mjs`, this hook parses generated text against the 10 ADHD-friendly rules specified in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md). Its primary function is to eliminate cognitive friction by enforcing **action-first communication**, **numbered step sequences**, and **zero superfluous content** that might distract or overwhelm ADHD users.

When the language model generates a response, the hook evaluates the text structure against five strict validation criteria. If the output fails any check, the hook discards the response entirely and prompts the model to regenerate compliant content.

## How the Pre-Send Validation Logic Works

The validation logic in `hooks/always-on.mjs` inspects every generated response for the following criteria:

- **Action-First Requirement:** The first sentence must be an actionable instruction that tells the user exactly what to do.
- **Mandatory Numbering:** All multi-step instructions must use numbered formatting (`1.`, `2.`, etc.) to provide clear sequential structure.
- **Preamble Prohibition:** The response must not contain opening filler phrases such as "Sure, here's..." or "Let me think about that..."
- **No Closing Remarks:** The output must end with a single concrete next step and cannot include closing fluff like "Hope this helps!" or "Thanks!"
- **List Length Cap:** Any list within the response must contain **no more than five items** to prevent cognitive overload.

If any rule violation is detected, the hook prevents the non-compliant output from reaching the user and triggers a regeneration cycle with the model.

## How to Verify Compliance with Unit Tests

The repository includes comprehensive test suites that exercise the pre-send check logic to ensure consistent enforcement:

- **[`tests/test_always_on_hooks.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_always_on_hooks.py)** – Loads example outputs and asserts that only texts satisfying all five validation criteria pass through the hook.
- **[`tests/test_opencode_plugin.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_opencode_plugin.py)** – Runs the complete OpenCode plugin flow, verifying that the plugin aborts when the pre-send hook flags a formatting violation.

To verify that your local implementation correctly enforces these rules, run the test suite from the repository root:

```bash
python3 -m unittest discover -s tests -v

```

A passing test suite confirms that the pre-send validation logic in `hooks/always-on.mjs` is active and correctly implementing the requirements from [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md).

## Code Examples: Compliant vs Non-Compliant Output

The following examples illustrate the strict formatting requirements enforced by the pre-send check.

**Compliant response (passes validation):**

```text
1. Open the `settings.json` file in your project.
2. Add `"editor.tabSize": 2` under the `editor` section.
3. Save the file and reload the editor.
Next step: Verify that indentation now uses two spaces.

```

This example passes because it starts immediately with a numbered action, contains no preamble, and ends with a concrete next step without closing remarks.

**Non-compliant response (fails validation):**

```text
Sure! Let me think about that…

1. First, open the file.
2. Then, edit the value.
Hope this helps!

```

Running this through `hooks/always-on.mjs` triggers a regeneration request because it violates three rules: it contains an opening preamble ("Sure! Let me think..."), uses non-direct language ("First," "Then,"), and includes a prohibited closing remark ("Hope this helps!").

## Key Implementation Files

Understanding the pre-send check requires familiarity with these specific source files:

- **`hooks/always-on.mjs`** – Implements the core validation logic that inspects each generated response before transmission.
- **[`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md)** – Defines the 10 ADHD-friendly formatting rules that serve as the validation schema for the hook.
- **[`tests/test_always_on_hooks.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_always_on_hooks.py)** – Unit tests confirming that the hook correctly accepts compliant output and rejects violations.
- **[`tests/test_opencode_plugin.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_opencode_plugin.py)** – Integration tests ensuring the entire plugin stack respects the pre-send check during normal operation.

## Summary

- The **pre-send check** is a hook in `hooks/always-on.mjs` that validates responses against ADHD-friendly formatting rules before user delivery.
- It enforces **action-first sentences**, **numbered steps**, **no preambles**, **no closing remarks**, and **maximum five items per list**.
- Violations trigger automatic response regeneration to ensure only compliant content reaches users.
- Compliance is verified through **[`tests/test_always_on_hooks.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_always_on_hooks.py)** and **[`tests/test_opencode_plugin.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_opencode_plugin.py)** using `python3 -m unittest discover -s tests -v`.
- The 10 formatting 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)**.

## Frequently Asked Questions

### Where is the pre-send check implemented in the i-have-adhd repository?

The pre-send check is implemented in **`hooks/always-on.mjs`**. This file contains the validation logic that intercepts generated responses and parses them against the formatting rules defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md).

### What happens when a response fails the pre-send check?

When a response violates any of the five validation criteria—such as containing a preamble or closing remark—the hook discards the output entirely. The system then prompts the language model to regenerate the response, repeating this cycle until the output passes all compliance checks.

### How do I run the compliance tests for the pre-send check locally?

Execute the unit test suite from the repository root using:

```bash
python3 -m unittest discover -s tests -v

```

This command runs **[`tests/test_always_on_hooks.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_always_on_hooks.py)** and **[`tests/test_opencode_plugin.py`](https://github.com/ayghri/i-have-adhd/blob/main/tests/test_opencode_plugin.py)**, which verify that the pre-send hook correctly accepts compliant text and rejects violations according to the rules in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md).

### Which specific ADHD-friendly rules does the pre-send hook enforce?

The hook enforces 10 rules defined in [`skills/i-have-adhd/SKILL.md`](https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md), with the pre-send validation specifically checking for: action-first instruction openings, mandatory numbered formatting for steps, absence of conversational preambles, prohibition of closing remarks, and a strict limit of five items per list to maintain cognitive accessibility.