Skip to content

A skill to stop your coding agent from burying the answer. ADHD-friendly output.

Address Copilot review: robust frontmatter strip + normal mode wording

Rimon Hannaa59741d9920f
diff --git a/.opencode/command/i-have-adhd.md b/.opencode/command/i-have-adhd.md
index 4ff88df..6016fae 100644
--- a/.opencode/command/i-have-adhd.md
+++ b/.opencode/command/i-have-adhd.md
@@ -5,4 +5,4 @@ description: Shape output for a reader with ADHD for the rest of this session
Use the `i-have-adhd` skill and apply its ruleset to every response for the
rest of this session: lead with the next action, number multi-step work,
restate state across turns, suppress tangents, give concrete time estimates,
-and make wins visible. These rules persist until I say "stop adhd mode".
+and make wins visible. These rules persist until I say "stop adhd mode" or "normal mode".
diff --git a/.opencode/plugins/i-have-adhd.mjs b/.opencode/plugins/i-have-adhd.mjs
index 28a0287..f0e9438 100644
--- a/.opencode/plugins/i-have-adhd.mjs
+++ b/.opencode/plugins/i-have-adhd.mjs
@@ -33,9 +33,13 @@ const flagPath = path.join(
);
// Read SKILL.md and strip a leading YAML frontmatter block (--- ... ---).
+// Regex and trailing-newline trim match hooks/always-on.mjs so always-on
+// injections behave identically across harnesses (see tests/test_always_on_hooks.py).
function rulesetBody() {
- const raw = fs.readFileSync(skillPath, 'utf8');
- return raw.replace(/^?---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim();
+ return fs
+ .readFileSync(skillPath, 'utf8')
+ .replace(/^---[^\S\r\n]*\r?\n[\s\S]*?\r?\n---[^\S\r\n]*(?:\r?\n|$)/, '')
+ .replace(/(?:\r?\n)+$/, '');
}
export default async () => {
@@ -62,8 +66,8 @@ export default async () => {
const header =
'ADHD MODE ACTIVE (always-on). The ruleset below applies to every ' +
- 'response. "stop adhd mode" turns it off for this session; delete ' +
- flagPath + ' to turn always-on off for good.';
+ 'response. "stop adhd mode" or "normal mode" turns it off for this ' +
+ 'session; delete ' + flagPath + ' to turn always-on off for good.';
const injected = header + '\n\n' + body;
if (output.system.length > 0) {
diff --git a/INSTALL.md b/INSTALL.md
index cbd5e1d..7598a83 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -405,7 +405,7 @@ Start a new session and turn on ADHD-friendly output for the session:
/i-have-adhd
```
-Rules stay on until `stop adhd mode`.
+Rules stay on until `stop adhd mode` or `normal mode`.
### Verify
@@ -427,7 +427,7 @@ Remove the `plugin` entry from `opencode.json`.
touch ~/.config/opencode/.i-have-adhd-always
```
-While the flag exists, the plugin appends the full ruleset to the system prompt every turn — the OpenCode equivalent of the Claude Code `SessionStart` hook. `stop adhd mode` disables it for the current session; delete the flag to turn always-on off for good:
+While the flag exists, the plugin appends the full ruleset to the system prompt every turn — the OpenCode equivalent of the Claude Code `SessionStart` hook. `stop adhd mode` or `normal mode` disables it for the current session; delete the flag to turn always-on off for good:
```bash
rm ~/.config/opencode/.i-have-adhd-always