adhd README

The project's README from github.com/UditAkhourii/adhd. As one markdown file: README.md.

ADHD for Claude Code

ADHD — a skill for agents

CI npm Docs license Node Paper Featured: The New Stack Discord

UditAkhourii%2Fadhd | Trendshift

🎮 Join the Discord → for frame design, eval problems, and trap-hunting in real time · 👉 Join the community → as a contributor, maintainer, or early adopter (one short form).

An architectural fix for premature convergence in autoregressive reasoning.

Linear Chain-of-Thought anchors on whatever it says first. Tree-of-Thought widens the search but still walks a single shared context, so the anchoring persists across branches. ADHD treats this as an architectural problem, not a prompting one — it spawns N isolated reasoning processes under deliberately distorted cognitive frames, with zero shared context during divergence, then runs a separate critic pass to score, cluster, prune traps, and deepen the survivors.

Reach for it on design decisions, fuzzy debugging, naming, API surface design, strategy, and any prompt of the shape "give me a few ways to…".

📚 Official docs: adhd.mintlify.site · 📄 Preprint: ADHD: Parallel Divergent Ideation for Coding Agents · 👤 Author: Udit Akhouri — @akhouriudit · LinkedIn


Side-by-side: baseline vs ADHD

One eval problem, same model, two strategies. Full transcripts in bench/results.json.

Problem. "We have a CLI that calls an LLM and it sometimes hangs for 90 seconds. Design the right retry/timeout/UX strategy."

Baseline gives the sensible textbook hybrid (staged timeouts + one auto-retry) — the answer a senior engineer gives in 30 seconds, with no traps named. ADHD spawns 6 isolated frames, surfaces 30+ ideas, flags 20 traps with reasons, and lands the non-obvious pick baseline never considers: the slow model might just be the wrong model for this prompt — instant abort + branch to a cheaper/faster one.

Expand the full side-by-side
🟦 Baseline (single-shot) 🟧 ADHD

Walks through four textbook patterns:

  1. Progressive timeout with staged UI (10s / 30s / 60s)
  2. Fast-fail + exponential backoff retry
  3. Hedged parallel requests
  4. Streaming with keepalive

Lands on a hybrid recommendation — 15s first-token timeout, 30s between-token timeout, 90s absolute, one auto-retry. Sensible. Google SRE Book ch. 22. The answer a senior engineer gives in 30 seconds.

What's missing: no traps named, no acknowledgement that the user might want to bail out of a slow request, no questioning of the "wait then retry the same model" frame.

Spawns 6 isolated frames, surfaces a wide set of 30+ ideas across economic-incentive, async-control-surface, gamification, perceptual-distortion, collective-intelligence, redundancy-race clusters, then:

  • ★ Non-obvious pick: "rage-quit = instant abort + branch to cheaper/faster model" — a button that pulses hotter the longer you wait. One click cancels and re-submits to Haiku-class. The thing baseline never considers: the slow model might just be the wrong model for this prompt.
  • Plus shortlist: scout-fork to alternate endpoints at 30s; daemonize the CLI with ticket IDs; race 3 LLM replicas, cache the winner.
  • 20 traps flagged with one-line reasons — including the cute "stream tokens in reverse" and "patience-token billing" ideas before they cost engineering time.

Independent LLM judge on this problem: breadth 9 vs 6, novelty 8 vs 3, trap detection ~8 vs ~2. Methodology in documentation/evals.md.



Early adopters

17+ projects ship or integrate ADHD — including repowire, mstack, zk-flow-oss, han, wtfismyrepo, and awesome-prompts. The full table of who shipped what lives in ADOPTERS.md.

Shipping ADHD in your project? Open a PR adding yourself to ADOPTERS.md, or open an issue and we'll add you.


Install

One command, auto-detects your agent (Claude Code, Cursor, Antigravity, Codex, Cline, Gemini CLI, Windsurf, and ~50 more):

npx skills add UditAkhourii/adhd

Then invoke explicitly with /adhd "your problem", or let it auto-trigger on ideation intents.

npm install -g adhd-agent     # CLI
npm install adhd-agent        # library

CLI and library installs, the Codex quick path, manual curl for other agents, and per-platform paths are in documentation/install.md.


Quickstart

adhd "design a rate limiter that survives a leader election"
adhd "name this function" --frames 3 --ideas 8 --top 2
import { run, renderText } from "adhd-agent";

const result = await run({ problem: "How should we shard this queue under bursty load?", framesPerRun: 5, topK: 3 });
console.log(renderText(result));
// result.shortlist · result.nonObviousPick · result.traps · result.deepened · result.clusters

Full reference: documentation/api.md.


How it works

A two-phase loop with a hard wall between the phases.

  1. Diverge. Pick N cognitive frames. Spawn N parallel, isolated Agent calls — each sees the problem plus one frame's vantage prompt, and a system prompt that forbids evaluation. Branches never see each other, so no anchoring.
  2. Focus. A separate critic call scores every idea (novelty / viability / fit), flags traps with reasons, clusters by underlying angle, and deepens the top-K survivors into sketches with risks and first steps.

The generator-critic split is mechanical — separate LLM calls with opposite system prompts — not promised in one prompt. Deep dive: documentation/how-it-works.md. How it differs from CoT and ToT: documentation/vs-cot-and-tot.md.


Results

Mean scores across 6 open-ended engineering problems (0–10), ADHD vs a single-shot baseline at the same model, judged by an independent LLM with a skeptical-staff-engineer prompt, A/B order randomized.

Dimension ADHD Baseline Δ Ratio
breadth 9.00 4.83 +4.17 1.9×
novelty 7.83 2.67 +5.17 2.9×
trap detection 9.50 1.83 +7.67 5.2×
actionability 9.50 6.50 +3.00 1.5×
builder usefulness 7.67 6.83 +0.83 1.1×

ADHD wins 5 of 6 problems. Biggest gap is trap detection — baselines rarely name the seductive-but-broken ideas. Methodology, limitations, and how to reproduce: documentation/evals.md.


Documentation

📚 Official docs: adhd.mintlify.site — the full, browsable documentation site.

In-repo pages:

Page What's in it
Quickstart First skill, CLI, and TypeScript runs with practical commands
Install Every install path — skill, CLI, library, Agent SDK, per-platform
How it works The two-phase loop + architecture (context, pruning, orchestration)
vs CoT & ToT Structural comparison, the three load-bearing differences, frames vs personas
Frames The 15 cognitive frames, how selection works, how to author your own
When to use Use / don't use, why it shines on creative work, cost & speed
CLI & API CLI flags, library types, using ADHD inside your own agent
Evals Methodology, headline numbers, limitations, roadmap

Also: SKILL.md (the runnable skill) · SOURCE-SPEC.md (original spec) · CONTRIBUTING.md · the preprint.


Star History

Star History Chart

External reviews


License

MIT License.

ADHD operationalizes the Divergent Ideation source spec (SOURCE-SPEC.md). The runnable skill is at skills/adhd/SKILL.md.


Contact

Udit Akhouri — author of the preprint and maintainer.

adhdstack.github.io · @akhouriudit · LinkedIn · [email protected] · @UditAkhourii

Open to collaboration with research labs and applied-AI teams working on reasoning, planning, and agentic systems.

adhd (UditAkhourii/adhd)

Searching Database…

4.4K ·GitHub
这是什么?ADHD 是一个面向编程智能体的技能,它并行派生多个相互隔离、视角各异的推理分支,然后运行一个单独的评判环节,对幸存分支打分、剪枝和深化,而不是走单一的共享思维链。
这是独立应用,还是接进我的编程智能体的技能?它是一个技能/插件,会自动检测并安装到现有的编程智能体(Claude Code、Cursor、Codex、Cline、Gemini CLI、Windsurf 等)里,也提供 CLI 和 TypeScript 库的安装途径,基于 Claude & Codex Agent SDK 构建。
怎么安装和调用 ADHD?一条命令就会自动检测你的智能体并装好该技能;之后你可以用 '/adhd “你的问题”' 显式调用它,也可以让它在构思类的提示上自动触发。
跑它需要什么——特定的编程智能体?Node 版本?它需要 Node.js 18 或更新版本,以及一个受支持的编程智能体(Claude Code、Cursor、Antigravity、Codex、Cline、Gemini CLI、Windsurf 或大约 50 种其他工具);底层依赖 @anthropic-ai/claude-agent-sdk。
有什么代价——它总是值得用吗?它的开销更大:一项独立盲评基准测试发现,ADHD 耗时约为单次提示的 2.3 倍、产出约为 1.9 倍,所以它适合模糊/创造性的问题,而不是常规任务。
什么时候才真正该用它,而不是正常提示?把它用于设计决策、模糊的调试、命名、API 表面设计、策略,以及任何“给我几种……的方法”式的提示——不要用于直截了当、定义明确的任务。
ADHD 用来发散的“认知框架”是什么?ADHD 从 15 个预定义的认知框架(记录在 Frames 指南里)中挑选,每个框架都给推理分支提供一个不同的、经过扭曲的看问题视角,你也可以自己编写。
它和普通的思维树(Tree-of-Thought)到底有何不同?标准的 ToT 仍然在分支间共享同一个上下文,所以早期的锚定会一直延续;ADHD 在发散阶段把每个分支作为完全隔离的智能体调用来跑、零共享上下文,然后用一个单独的评判调用打分和剪枝,这是机制化的流程,而不是单一的共享提示。
结果比普通的单条提示好多少?在 ADHD 自己的 6 题基准上由独立 LLM 评判,ADHD 赢下 6 题中的 5 题,陷阱检测得分约 9.5 对 1.83,新颖性约 7.83 对 2.67(单次提示基线)。
作者为什么要做这个?作者 Udit Akhouri 把 ADHD 打造成针对自回归推理中过早收敛的一种架构级修复,把锚定当作结构性问题,而不是单靠提示词就能解决的东西,并在发表预印本的同时发布了它。
Size
1.9 MB
Stars
4.4K
Age
4mo
Commits · 90 Days