How the OpenCode Plugin Integrates with I-Have-ADHD: A Technical Breakdown

The OpenCode plugin integrates with I-Have-ADHD through a self-contained three-file architecture—opencode.json for permissions, .opencode/plugins/i-have-adhd.mjs for command registration, and skills/i-have-adhd/SKILL.md for the ADHD-friendly rule definitions—enabling the OpenCode runtime to execute specialized focus-enhancing responses.

The I-Have-ADHD repository provides a specialized skill designed to format responses according to ADHD-friendly cognitive principles. Its integration with the OpenCode runtime creates a unified execution environment where the plugin architecture handles permission management, command routing, and skill invocation without external dependencies or additional binaries.

Core Integration Components

Global Configuration via opencode.json

The integration begins with opencode.json at the repository root. This file declares the permission map that allows the runtime to read the repository structure and execute the plugin. It specifies the entry point path pointing to .opencode/plugins/i-have-adhd.mjs and configures the model settings for processing requests. According to the repository source, this JSON object defines the permission model that enables the runtime to access the /cache/repos/ directory structure.

Plugin Entry Point at .opencode/plugins/i-have-adhd.mjs

The JavaScript module serves as the bridge between the OpenCode SDK and the skill logic. It imports registerCommand from @opencode-ai/sdk and loads the canonical skill definition from skills/i-have-adhd/SKILL.md. The handler function wraps the skill's 10 ADHD-friendly rules around incoming prompts, applying formatting logic before returning responses to the OpenCode client.

Command Interface in .opencode/command/i-have-adhd.md

This markdown file provides the user-facing documentation displayed when running opencode help i-have-adhd. It defines usage examples and help text, ensuring the CLI interface remains consistent with the skill's cognitive accessibility goals. The file lives alongside the plugin code to keep documentation versioned with implementation.

Execution Flow and Runtime Architecture

The integration follows a five-stage pipeline implemented in the OpenCode runtime:

  1. Runtime Startup – OpenCode reads opencode.json to establish permissions and locate the plugin entry point.
  2. Command Registration – The runtime executes .opencode/plugins/i-have-adhd.mjs, which calls registerCommand('i-have-adhd', handler) to expose the command to the CLI.
  3. User Invocation – When a user runs opencode run i-have-adhd "prompt", the engine routes the request to the registered handler function.
  4. Skill Processing – The handler reads skills/i-have-adhd/SKILL.md and applies the 10 ADHD-friendly formatting rules to the input prompt.
  5. Response Delivery – The formatted result returns through the OpenCode client to the terminal or UI, completing the integration cycle.

Implementation Examples

Command Line Interface


# Display help documentation

opencode help i-have-adhd

# Execute with a custom prompt

opencode run i-have-adhd "Explain how to maintain focus during long meetings"

Programmatic Usage with Node.js

import { OpenCode } from '@opencode-ai/sdk';

// Initialise the OpenCode client using configuration from opencode.json
const client = new OpenCode();

// Call the i-have-adhd command directly
const response = await client.runCommand('i-have-adhd', {
  prompt: 'Give me a quick tip for managing distractions.'
});

console.log(response);

Plugin Entry Point Structure

import { registerCommand } from '@opencode-ai/sdk';
import { readFileSync } from 'fs';
import path from 'path';

// Load the canonical skill definition from the skills directory
const skillPath = path.resolve(import.meta.dirname, '../../skills/i-have-adhd/SKILL.md');
const skillContent = readFileSync(skillPath, 'utf-8');

// Register the command that OpenCode will expose
registerCommand('i-have-adhd', async ({ prompt }) => {
  // Applies ADHD-friendly formatting rules from SKILL.md
  return `🧠 ${skillContent}\n\n🔎 Prompt: ${prompt}`;
});

Summary

  • The integration relies on three core files: opencode.json, .opencode/plugins/i-have-adhd.mjs, and .opencode/command/i-have-adhd.md.
  • The plugin loads ADHD-specific rules from skills/i-have-adhd/SKILL.md at runtime using Node.js filesystem APIs.
  • Command registration uses the @opencode-ai/sdk** registerCommand function to bind the skill to the i-have-adhd CLI command.
  • The architecture is self-contained within the repository and requires no external services beyond the OpenCode runtime.
  • Users interact via standard OpenCode CLI commands or programmatic SDK calls, with help text defined in the command markdown file.

Frequently Asked Questions

What files comprise the OpenCode plugin integration?

The integration requires four critical files: the global configuration at opencode.json, the JavaScript entry point at .opencode/plugins/i-have-adhd.mjs, the command documentation at .opencode/command/i-have-adhd.md, and the skill definition at skills/i-have-adhd/SKILL.md. Additionally, AGENTS.md provides high-level guidance for agent implementations.

How does the plugin access the ADHD skill rules?

The plugin uses Node.js fs module functions to synchronously read skills/i-have-adhd/SKILL.md using a relative path resolved from import.meta.dirname. This ensures the canonical 10 ADHD-friendly rules are available during command execution without requiring external API calls.

Is external configuration required beyond the repository?

No. The OpenCode plugin is self-contained. All necessary configuration resides in opencode.json, and the skill logic lives within the repository. The OpenCode runtime handles permission management and execution context without additional binaries or external services.

Can the skill function outside the OpenCode ecosystem?

The I-Have-ADHD skill is designed specifically for the OpenCode runtime environment. While the SKILL.md file contains portable rules, the command registration, permission handling via opencode.json, and execution context depend on the @opencode-ai/sdk and the OpenCode plugin architecture.

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 →