nested-subagents-for-layered-analysis

nested-subagents-for-layered-analysis is an agent for coding agents from runnithan/claudex-setup. It costs 0 tokens per session (314 once invoked), scanned A, original, MIT.

A guidance pattern for using subagents in two or three layers to analyze effects that unfold in stages. For example, one agent finds affected API callers, and another finds tests or consumers affected by those callers.

In plain words
What is it for?
Use it for cascading changes such as API edits, contract changes, or policy updates. It helps produce a consolidated impact report, though each additional layer increases token use.
Why use it?
It keeps each level of research focused and prevents one context from becoming overloaded with a long chain of consequences.

Agent

Part of the claudex-setup plugin — 3 skills, 21 commands, 22 agents shipped together

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/runnithan/claudex-setup/nested-subagents-for-layered-analysis
Clone the repo
git clone --depth 1 https://github.com/runnithan/claudex-setup

Or install claudex-setup, the plugin that ships this one along with the rest of its 3 skills, 21 commands, 22 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for nested-subagents-for-layered-analysis

README.md
[![agentmods](https://agentmods.dev/badge/agents/runnithan/claudex-setup/nested-subagents-for-layered-analysis.svg)](https://agentmods.dev/agents/runnithan/claudex-setup/nested-subagents-for-layered-analysis)
Your own site
<a href="https://agentmods.dev/agents/runnithan/claudex-setup/nested-subagents-for-layered-analysis"><img src="https://agentmods.dev/badge/agents/runnithan/claudex-setup/nested-subagents-for-layered-analysis.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 314 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.00000 $0.00314
Opus 5 $0.00000 $0.00157
Sonnet 5 $0.00000 $0.00063
Haiku 4.5 $0.00000 $0.00031

Measured 4d ago against content hash 1d9e6d24fbcb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

nested-subagents-for-layered-analysis 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 4d ago.

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.

lessons/agents/nested-subagents-for-layered-analysis.md · 24 lines

What it actually says

Use Nested Subagents (2-3 Layers) for Multi-Order Effect Analysis

TL;DR

For questions with second- and third-order consequences (a change → its implications → the blast radius of each implication), have layer-1 subagents each spawn layer-2 subagents, so every level of analysis runs in its own isolated context and only clean conclusions roll back up.

Why it matters

A single agent (or one flat layer of subagents) tends to stop at first-order effects, and stuffing the whole cascade into one context drowns the signal. Nesting keeps each layer's noisy searching and verification isolated, while the main context receives only the collapsed, high-signal result.

How to apply

Structure the prompt as explicit layers: "For each of these 10 contracts, spawn an agent to determine what breaks if we change term X (layer 1). Each of those agents should spawn agents to find what else must change as a result (layer 2). Report a consolidated impact table." Works for code too: API signature change → affected callers → affected tests/consumers of those callers. Reserve it for genuinely cascading questions, it multiplies token cost like any fan-out.

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. 4d ago First seen · 24 lines · 0 tokens per session scan A 1d9e6d24fbcb

Subscribe to this mod's changes

nested-subagents-for-layered-analysis is an agent published in the GitHub repository runnithan/claudex-setup (1 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 314 tokens. 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-31.