Skip to content

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

Add OpenCode support (server plugin + command + always-on)

Rimon Hannaa6ad3a258cf3
diff --git a/.opencode/command/i-have-adhd.md b/.opencode/command/i-have-adhd.md
new file mode 100644
index 0000000..4ff88df
--- /dev/null
+++ b/.opencode/command/i-have-adhd.md
@@ -0,0 +1,8 @@
+---
+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".
diff --git a/.opencode/plugins/i-have-adhd.mjs b/.opencode/plugins/i-have-adhd.mjs
new file mode 100644
index 0000000..28a0287
--- /dev/null
+++ b/.opencode/plugins/i-have-adhd.mjs
@@ -0,0 +1,76 @@
+// i-have-adhd — OpenCode plugin.
+//
+// Mirrors the Claude Code / Codex behaviour for OpenCode: the skill in
+// `skills/i-have-adhd/SKILL.md` is the single source of truth for the ruleset.
+//
+// • On demand — registers the skills directory and a `/i-have-adhd`
+// command so the ruleset applies for the rest of the session.
+// • Always-on — when the opt-in flag file exists, the full ruleset is
+// appended to the system prompt every turn (the OpenCode
+// equivalent of the SessionStart hook in hooks/always-on.sh).
+//
+// Opt in to always-on: touch ~/.config/opencode/.i-have-adhd-always
+// Opt back out: rm ~/.config/opencode/.i-have-adhd-always
+//
+// Install — add to opencode.json:
+// { "plugin": ["./.opencode/plugins/i-have-adhd.mjs"] }
+
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+import { fileURLToPath } from 'url';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const skillsDir = path.resolve(__dirname, '../../skills');
+const skillPath = path.join(skillsDir, 'i-have-adhd', 'SKILL.md');
+
+// Always-on opt-in flag, mirroring Claude Code's ~/.claude/.i-have-adhd-always
+// but under OpenCode's config dir so the two tools stay independent.
+const flagPath = path.join(
+ process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'),
+ 'opencode',
+ '.i-have-adhd-always',
+);
+
+// Read SKILL.md and strip a leading YAML frontmatter block (--- ... ---).
+function rulesetBody() {
+ const raw = fs.readFileSync(skillPath, 'utf8');
+ return raw.replace(/^?---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim();
+}
+
+export default async () => {
+ return {
+ // Make the skill discoverable (so the `skill` tool and the /i-have-adhd
+ // command can load it).
+ config: async (config) => {
+ config.skills = config.skills || {};
+ config.skills.paths = config.skills.paths || [];
+ if (!config.skills.paths.includes(skillsDir)) config.skills.paths.push(skillsDir);
+ },
+
+ // Always-on: append the ruleset to the system prompt every turn while the
+ // flag file exists. "stop adhd mode" turns it off for the session (the
+ // model honours the skill's own Persistence rules); deleting the flag
+ // turns always-on off for good.
+ 'experimental.chat.system.transform': async (_input, output) => {
+ let on = false;
+ try { on = fs.existsSync(flagPath); } catch (e) {}
+ if (!on) return;
+
+ let body;
+ try { body = rulesetBody(); } catch (e) { return; }
+
+ 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.';
+ const injected = header + '\n\n' + body;
+
+ if (output.system.length > 0) {
+ output.system[output.system.length - 1] += '\n\n' + injected;
+ } else {
+ output.system.push(injected);
+ }
+ },
+ };
+};
diff --git a/INSTALL.md b/INSTALL.md
index 23ad92b..cbd5e1d 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -378,6 +378,64 @@ Use slash command `/skill:i-have-adhd` to invoke the skill explicitly.
</details>
+<details>
+<summary><strong>OpenCode</strong></summary>
+
+OpenCode loads this repository as a server plugin: `.opencode/plugins/i-have-adhd.mjs` registers the `skills/` entry point and the `/i-have-adhd` command, and injects the ruleset when always-on is enabled. OpenCode also reads `skills/` natively, so the skill still works even without the plugin — the plugin adds the `/i-have-adhd` command and the always-on flag.
+
+### Install
+
+Clone the repo and point OpenCode at the plugin. An absolute path shares one checkout across every project:
+
+```bash
+git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd
+```
+
+Add to your `opencode.json` (global: `~/.config/opencode/opencode.json`):
+
+```json
+{ "plugin": ["/absolute/path/to/i-have-adhd/.opencode/plugins/i-have-adhd.mjs"] }
+```
+
+Or run OpenCode from the checkout — it ships a root `opencode.json` with the plugin already wired up.
+
+Start a new session and turn on ADHD-friendly output for the session:
+
+```text
+/i-have-adhd
+```
+
+Rules stay on until `stop adhd mode`.
+
+### Verify
+
+Start OpenCode, type `/`, and confirm `i-have-adhd` appears in the command list.
+
+### Update
+
+```bash
+git -C ~/.config/opencode/vendor/i-have-adhd pull
+```
+
+### Uninstall
+
+Remove the `plugin` entry from `opencode.json`.
+
+### Always-on (optional)
+
+```bash
+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:
+
+```bash
+rm ~/.config/opencode/.i-have-adhd-always
+```
+
+</details>
+
+
<details>
<summary><strong>Pi</strong></summary>
@@ -563,7 +621,7 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti
</details>
<details>
-<summary><strong>Cursor, OpenCode, Amp, and any other agent-skills harness</strong></summary>
+<summary><strong>Cursor, Amp, and any other agent-skills harness</strong></summary>
Works with any harness that reads agent skills. Swap `-a <agent>` for yours.
diff --git a/opencode.json b/opencode.json
new file mode 100644
index 0000000..cf7824a
--- /dev/null
+++ b/opencode.json
@@ -0,0 +1,4 @@
+{
+ "$schema": "https://opencode.ai/config.json",
+ "plugin": ["./.opencode/plugins/i-have-adhd.mjs"]
+}