What Is Parallel Divergent Ideation in AI Coding Agents: A Deep Dive into the ADHD Method
Parallel divergent ideation is a two-phase algorithmic pattern that uses isolated, parallel Agent calls under distinct cognitive frames to generate a broad set of independent ideas before converging on the best solutions.
In the open-source ADHD skill for Claude-based AI coding agents, parallel divergent ideation serves as the core mechanism for creative problem-solving. Developed by UditAkhourii, this approach deliberately trades computational cost for solution quality on open-ended, high-stakes problems like architecture design, API exploration, and fuzzy debugging.
The Two-Phase Architecture
The ADHD implementation in src/engine.ts strictly separates ideation into diverge and focus phases. Each phase operates under different constraints and produces different outputs.
Phase 1: Diverge (Parallel Generation)
In the diverge phase, the system spawns multiple independent branches—each a fresh query() call via the Claude Agent SDK.
Each branch receives:
- The original problem statement
- User context (if provided)
- A unique cognitive frame (e.g., "hardware engineer", "speedrunner", "10-year-old")
- Instructions that forbid evaluation or ranking
The isolation invariant is critical: branches run in parallel with no shared KV-cache or message history. This prevents any single chain of thought from contaminating other perspectives. As specified in skills/adhd/SKILL.md, each branch must emit a JSON array of short, distinct ideas without hedging.
The default configuration uses 5 frames and requests 6 ideas per branch, though these are configurable via frames and ideasPerFrame parameters.
Phase 2: Focus (Convergent Refinement)
Once all branches complete, the focus phase transforms the generator into a critic:
- Score each idea on novelty, viability, and fit (0-10 scale)
- Cluster ideas by underlying angle rather than surface keywords
- Deepen the top-K ideas (default 3) with structured analysis including sketches, risks, first steps, and sub-ideas
The deepening calls run with a "FOCUS" system instruction, enabling evaluative reasoning that was explicitly forbidden in phase 1.
Cognitive Frames and Their Role
The cognitive frames defined in src/frames.ts are not mere stylistic variations. Each frame is a complete system prompt that shapes how the Agent interprets the problem space.
Common frame archetypes include domain experts (security engineer, UX researcher), constraint perspectives (minimalist, "move fast and break things"), and anthropomorphic lenses (curious child, skeptical auditor). By forcing the model to adopt these vantage points in isolated contexts, the system escapes the "awkward middle"—the predictable, median-quality solutions that single-prompt approaches tend to converge on.
Resource Management and Concurrency
Despite the parallel structure, ADHD controls costs through a semaphore-based concurrency limit. The concurrency parameter (default 4) in src/engine.ts caps simultaneous query() calls while preserving logical parallelism.
This makes the technique deliberately expensive—approximately 10 Agent calls per run—acceptable only when the cost of a wrong answer exceeds the compute cost of thorough ideation.
Usage Examples
CLI Usage
# Simple design brainstorming
adhd "design a rate limiter that survives a leader election"
# Tune breadth and depth parameters
adhd "name this feature-flag service" --frames 3 --ideas 8 --top 2
TypeScript Library
import { run, renderText } from "adhd-agent";
const result = await run({
problem: "How should we shard this queue under bursty load?",
topK: 3, // ideas to deepen
frames: 5, // cognitive frames
ideasPerFrame: 6, // ideas per branch
});
console.log(renderText(result));
Direct Agent SDK (Illustrating Parallel Structure)
import { query } from "@anthropic-ai/claude-agent-sdk";
async function divergentBranch(framePrompt: string, problem: string) {
return query({
system: framePrompt,
user: problem,
instructions: [
"You are in DIVERGENT mode. Generate 6 short distinct ideas.",
"The first three obvious answers are banned. Output JSON only."
],
});
}
Key Implementation Files
| File | Purpose |
|---|---|
skills/adhd/SKILL.md |
Human-readable skill definition with pre-flight checks and phase workflow |
src/engine.ts |
Orchestrates parallel calls, scoring, clustering, and deepening |
src/frames.ts |
Cognitive frame definitions and system-prompt payloads |
documentation/how-it-works.md |
Architectural deep-dive on the diverge-then-converge loop |
documentation/quickstart.md |
Usage guides for CLI, library, and agent-skill modes |
Summary
- Parallel divergent ideation uses isolated Agent calls under distinct frames to force cognitive diversity
- Strict phase separation (diverge → focus) prevents premature evaluation from narrowing the idea space
- Isolation invariants (no shared cache, no message history) guarantee independent idea generation
- Configurable parameters (
frames,ideasPerFrame,topK,concurrency) balance coverage against cost - Intended use is high-stakes, open-ended problems where single-shot answers risk architectural dead-ends
Frequently Asked Questions
How does parallel divergent ideation differ from standard chain-of-thought prompting?
Chain-of-thought generates a single reasoning trajectory that can get stuck in local optima. Parallel divergent ideation, as implemented in src/engine.ts, forces multiple completely independent trajectories by isolating each branch's context. The scoring and clustering steps then select across this broader space rather than refining one path.
When should I use ADHD instead of a direct Agent query?
According to documentation/how-it-works.md, use parallel divergent ideation when the problem is open-ended, architectural, or lacks a known root cause. For concrete lookups, precise bug fixes, or cases with clear success criteria, a direct query is more cost-effective. The ≈10x compute cost is justified only when exploration value exceeds execution overhead.
Can I add custom cognitive frames to the system?
Yes. The frame table in src/frames.ts is extensible. Each frame requires a unique identifier and a system prompt that defines the cognitive stance. The orchestration logic in src/engine.ts treats frames generically, so custom frames integrate automatically into the parallel divergence phase without code changes.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →