# What Are the 15 Cognitive Frames in ADHD and How Does Frame Selection Work?

> Discover the 15 cognitive frames in ADHD and how the bias-aware algorithm selects them. Learn how these prompts re-pose problems from different angles.

- Repository: [Udit Akhouri/adhd](https://github.com/UditAkhourii/adhd)
- Tags: deep-dive
- Published: 2026-08-01

---

**The ADHD repository defines 15 built-in cognitive frames—deliberate "vantage-operator" prompts that re-pose problems from different conceptual angles—and selects them via a deterministic, bias-aware algorithm in [`src/frames.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/frames.ts) that always includes at least one "wild" perspective.**

The open-source **UditAkhourii/adhd** project implements a parallel reasoning engine that uses cognitive frames to force LLM generators into unconventional conceptual corners. These frames are small system-prompt payloads defined in the source code that deliberately shift perspective, from "Hardware Engineer" to "10-Year-Old," to maximize divergent thinking. Understanding the **15 cognitive frames in ADHD** and their selection mechanism is essential for customizing the engine's creative output.

## The 15 Built-In Cognitive Frames in ADHD

The ADHD project maintains a curated set of frames in [`src/frames.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/frames.ts), each designed to break fixation by imposing a foreign mental model. Every frame carries a unique ID, descriptive label, vantage prompt (≈5 lines), and categorization tags.

| Frame ID | Label | Vantage (Prompt Summary) | Tags |
|---|---|---|---|
| `hardware-eyes` | **Hardware engineer** | Think in latency, memory layout, physical constraints. | `code`, `wild` |
| `regulator` | **Regulator / auditor** | Audit for provable, traceable, refusable aspects. | `design`, `general` |
| `ten-year-old` | **10‑year‑old** | Naïve, unencumbered approach; ignore conventions. | `general`, `wild` |
| `adversary` | **Competitor trying to break it** | Generate adversarial exploits and then invert them. | `code`, `design` |
| `biology` | **Cross‑domain: biology** | Transplant mechanisms from immune systems, neural plasticity, etc. | `code`, `wild` |
| `logistics` | **Cross‑domain: logistics / supply chain** | Apply queues, batching, just‑in‑time, hub‑and‑spoke ideas. | `code`, `design` |
| `game-design` | **Cross‑domain: game design** | Identify loops, rewards, friction, speed‑run tricks. | `design`, `general` |
| `markets` | **Cross‑domain: markets** | Model the problem as an auction, futures contract, clearing house. | `design`, `wild` |
| `inversion` | **Inversion** | Ask the opposite question, then negate the answers. | `code`, `design`, `general` |
| `extreme-zero` | **Extreme: $0 budget, 1 hour** | Produce the crudest workable version under severe constraints. | `code`, `general` |
| `extreme-infinite` | **Extreme: infinite budget, 10 years** | Imagine a maximalist solution with unlimited resources. | `design`, `wild` |
| `remove-assumption` | **Remove the load‑bearing assumption** | Drop the assumed infrastructure (framework, DB, network) and redesign. | `code`, `design`, `wild` |
| `speedrunner` | **Speedrunner** | Find glitches, skips, frame‑perfect shortcuts. | `code`, `wild` |
| `ant-colony` | **Ant colony / swarm** | Use decentralized local rules and emergent behavior. | `code`, `wild` |
| `ops-3am` | **On‑call at 3 am** | Design to avoid paging; create a runbook‑friendly solution. | `code`, `design` |

Full descriptions and prompt payloads are documented in [`documentation/frames.md`](https://github.com/UditAkhourii/adhd/blob/main/documentation/frames.md) according to the repository source.

## How Frame Selection Works

The selection algorithm lives in the `selectFrames` function within [`src/frames.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/frames.ts). The process combines deterministic randomness with deliberate bias to ensure both reproducibility and creative divergence.

### Code-Mode Bias and Tag Filtering

When `codeMode` is `true` (the default), the algorithm restricts the primary candidate pool to frames carrying the **`code`** or **`design`** tags. This prioritizes engineering-centric perspectives. Disabling `codeMode` expands the pool to include all 15 frames regardless of tag.

### Wildcard Reservation for Divergent Thinking

Frames tagged with **`wild`** are always reserved in a separate pool. The algorithm guarantees that at least one wild frame appears in every selection to ensure "weird," non-engineered perspectives surface during generation.

### Deterministic Shuffling Algorithm

The `selectFrames` implementation follows these exact steps:

1. **Filter by mode** – Apply the `codeMode` tag filter to create the primary pool.
2. **Separate wildcards** – Isolate all `wild` tagged frames into a reserved pool.
3. **Fisher-Yates shuffle** – Shuffle the primary pool using a seedable random generator for reproducibility.
4. **Pick N‑1 frames** – Select the first `n‑1` frames from the shuffled primary pool (or at least one if `n` is 1).
5. **Insert wild frame** – Draw a random wild frame and append it if not already present.
6. **Trim to N** – Slice the combined list to exactly `n` items.

The function signature is:

```typescript
export function selectFrames(n: number, codeMode = true): Frame[] { … }

```

Key properties include **deterministic per-seed** output, guaranteeing identical frame sets across runs with the same seed, and the **mandatory wild frame** requirement, ensuring creative divergence even in code-heavy sessions.

## Implementation in src/frames.ts

The frame definitions and selection logic reside in [`src/frames.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/frames.ts), which exports both the `FRAMES` array and the `selectFrames` utility. The `Frame` type (implied by the implementation) includes `id`, `label`, `vantage` (the prompt text), and `tags` properties. The [`src/engine.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/engine.ts) file orchestrates parallel LLM calls using these selected frames, invoking `selectFrames` at runtime to populate the vantage prompts.

## Practical Usage Examples

Below are runnable TypeScript snippets demonstrating how to retrieve frames and invoke the selection logic.

Retrieve the full list of available frames:

```typescript
// Example 1 – Get the full list of frames
import { FRAMES } from "./src/frames";
console.log("All frames:", FRAMES.map(f => f.label));

```

Select 5 frames with the default code-mode bias:

```typescript
// Example 2 – Select 5 frames with the default code‑mode bias
import { selectFrames } from "./src/frames";

const chosen = selectFrames(5);          // deterministic per seed
console.log("Chosen frames:");
chosen.forEach(f => console.log(`- ${f.label} (${f.id})`));

```

Disable code-mode to expose every frame type:

```typescript
// Example 3 – Disable code‑mode to expose every frame
const allKinds = selectFrames(4, false);
console.log("All‑kind selection:", allKinds.map(f => f.id));

```

These snippets can be executed via the repository’s CLI using `npm run ts-node` or integrated into larger orchestration pipelines.

## Summary

- The **UditAkhourii/adhd** repository defines **15 cognitive frames** in [`src/frames.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/frames.ts), ranging from "Hardware Engineer" to "Ant Colony," each imposing a unique conceptual vantage.
- Frame selection occurs through the **`selectFrames`** function, which filters by tags, applies a Fisher-Yates shuffle, and guarantees at least one **`wild`** tagged frame.
- **Code-mode bias** (`codeMode = true`) restricts selection to engineering-relevant frames by default, while disabling it exposes the full spectrum.
- The algorithm is **deterministic per seed**, enabling reproducible experiments with identical frame sets across runs.
- Selected frames feed into **[`src/engine.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/engine.ts)** to drive parallel LLM reasoning with deliberately divergent perspectives.

## Frequently Asked Questions

### What is the purpose of cognitive frames in ADHD?

Cognitive frames serve as deliberate "vantage-operator" prompts that re-pose a problem from a different conceptual angle. Each frame is a small system-prompt payload (≈5 lines) that forces the generator into a corner it would not naturally explore, such as thinking like a hardware engineer or a speedrunner.

### How does the frame selection algorithm ensure diversity?

The algorithm ensures diversity by reserving slots for frames tagged with **`wild`**, which represent unconventional or cross-domain perspectives. It also uses a Fisher-Yates shuffle for randomization while maintaining deterministic output based on a seed, guaranteeing that every run includes at least one non-engineered, creative viewpoint.

### Can I add custom frames to the ADHD repository?

Yes, the modular structure of [`src/frames.ts`](https://github.com/UditAkhourii/adhd/blob/main/src/frames.ts) allows extending the exported `FRAMES` array with custom `Frame` objects. Each custom frame must include an `id`, `label`, `vantage` prompt string, and `tags` array following the existing type definitions used by the `selectFrames` function.

### What is the difference between code mode and general mode in frame selection?

**Code mode** (the default, `codeMode = true`) filters the candidate pool to frames tagged with **`code`** or **`design`**, prioritizing practical engineering and implementation perspectives. **General mode** (`codeMode = false`) removes this filter, exposing all 15 frames including those tagged only with `general` or `wild`, resulting in broader conceptual diversity.