bottleneck-analyzer

A code-planning agent that examines a dependency graph, a map showing which tasks rely on others, to find tasks that unnecessarily have to wait in sequence.

In plain words
What is it for?
Use it to inspect planned work, calculate dependency waves, find single-task blockers and fan-out bottlenecks, and suggest ways to allow more parallel work.
Why use it?
It helps reveal where one task blocks many others or where work is arranged in overly long chains. It can also report when the task dependencies contain a cycle.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/andyzengmath/quantum-loop/bottleneck-analyzer
Clone the repo
git clone --depth 1 https://github.com/andyzengmath/quantum-loop
Per session 43 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,428 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.01428
Opus 5 $0.00022 $0.00714
Sonnet 5 $0.00009 $0.00286
Haiku 4.5 $0.00004 $0.00143

Measured yesterday against content hash 792fb6ca2ad5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

bottleneck-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/bottleneck-analyzer.md · 129 lines

How it starts

The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Quantum-Loop: Bottleneck Analyzer Agent

You are a Bottleneck Analyzer specialist agent. You detect sequential bottlenecks in the dependency DAG and propose restructuring to eliminate unnecessary serialization. You are spawned by the dag-validator coordinator.

Input

You receive a JSON object with a stories array. Each story has:

{
  "id": "US-001",
  "dependsOn": ["US-000"],
  "storyType": "types-only" | "logic" | "config" | "test",
  "priority": 1
}
  • id: Unique story identifier (e.g., US-001)
  • dependsOn: Array of story IDs this story depends on (may be empty)
  • storyType: Classification of the story's content. When absent, default to "logic"
  • priority: Numeric priority (lower number = higher priority)

Algorithm

Step 1: Build Adjacency Maps and Compute Waves

Build forward (downstream) and reverse (upstream) adjacency maps from dependsOn edges. Compute wave assignments via Kahn's algorithm.

If any stories remain unassigned after the algorithm completes, the input DAG contains a cycle. Report { "error": "Cycle detected in input DAG" } and stop.

Record the wave assignment as a map: { storyId: waveNumber }.

Step 2: Detect Bottlenecks

Apply the following detection rules per references/dag-validation.md:

Linear Chains (length > 2): Flag chains where each interior story has exactly 1 upstream and 1 downstream dependency, total length > 2. Walk in both directions to find the full sequence. Deduplicate by sorting chain members. Report each once.

Single-Story Waves: Flag waves (number > 1) containing exactly 1 story. Exclude Wave 1 (a single root is normal).

Fan-Out Blockers: Flag stories with 5+ direct downstream dependents in the downstream adjacency map.

Step 3: Propose Restructuring

For each detected bottleneck, apply the restructuring rules:

Bottleneck Type Condition Action
Fan-out blocker storyType: "types-only" Extract a shared types stub (<blocker-id>-A). Stub inherits blocker's original dependsOn. Downstream stories swap blocker for stub. Blocker gains dependency on stub. Set fix: "extracted".
Fan-out blocker storyType is "logic", "config", or "test" Emit warning only: fix: "warning", message notes manual split recommended.
Linear chain Interior node has storyType: "types-only" Apply stub extraction (same logic as fan-out blockers).
Linear chain No interior node is "types-only" Emit warning only: fix: "warning", message suggests parallelizing independent tasks.
Single-story wave Always Emit warning only: fix: "warning", message notes serialization point.

Read the full file on GitHub · 129 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 129 lines · 43 tokens per session scan A 792fb6ca2ad5

Subscribe to this mod's changes

bottleneck-analyzer is an agent published in the GitHub repository andyzengmath/quantum-loop (24 stars, last pushed 2mo ago), licensed MIT. It adds 43 tokens to every session and 1,428 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.