hierarchies

hierarchies is an agent for coding agents from dsswift/ion. It costs 11 tokens per session (560 once invoked), scanned A, original, MIT.

A system for defining parent-and-child relationships between agents and building them into a directed graph. A directed graph represents named items connected by one-way links.

In plain words
What is it for?
Declaring an agent's parent, listing roots and children, building the agent hierarchy, sorting children consistently, and handling unknown parents.
Why use it?
It makes delegation structure explicit and validates relationships before agents run, while warning when a parent is missing and detecting cycles.

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/dsswift/ion/hierarchies
Clone the repo
git clone --depth 1 https://github.com/dsswift/ion

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 hierarchies

README.md
[![agentmods](https://agentmods.dev/badge/agents/dsswift/ion/hierarchies.svg)](https://agentmods.dev/agents/dsswift/ion/hierarchies)
Your own site
<a href="https://agentmods.dev/agents/dsswift/ion/hierarchies"><img src="https://agentmods.dev/badge/agents/dsswift/ion/hierarchies.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 560 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.00011 $0.00560
Opus 5 $0.00005 $0.00280
Sonnet 5 $0.00002 $0.00112
Haiku 4.5 $0.00001 $0.00056

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

Security

Grade A, and why

hierarchies 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 3d 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.

docs/agents/hierarchies.md · 83 lines

How it starts

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

Agent Hierarchies

Agents form a directed graph through the parent frontmatter field. The engine builds this graph during discovery and validates it before any agent runs.

Parent-child model

An agent declares its parent by name:

---
name: css-specialist
parent: frontend-reviewer
---

This creates an edge from frontend-reviewer to css-specialist. The parent can delegate tasks to its children, and the children inherit context about the parent's domain.

Graph structure

The AgentGraph holds all discovered agents and their relationships:

type AgentGraph struct {
    Agents   map[string]*AgentDef // name -> definition
    Children map[string][]string  // parent name -> child names
    Roots    []string             // agents with no parent
}
  • Roots are agents with no parent field (or an empty one). They appear at the top of any hierarchy listing.
  • Children are sorted alphabetically for deterministic output.

Unknown parents

If an agent references a parent that was not discovered, the engine treats it as a root agent and logs a warning:

agent "css-specialist" references parent "frontend-reviewer" which was not found

The agent still loads and functions normally. It just won't appear as a child in any hierarchy.

Cycle detection

The engine uses DFS coloring (white/gray/black) to detect cycles before the graph is finalized. If a cycle exists, discovery returns an error and no agents from that graph are loaded.

Example cycle:

agent-a (parent: agent-c)
agent-b (parent: agent-a)
agent-c (parent: agent-b)

This produces:

cycle detected: agent-a -> agent-b -> agent-c -> agent-a

The cycle path is included in the error message to help you identify which parent field to fix.

Runtime agent registry

During a session, spawned agents are tracked in an in-memory registry (agentRegistry). This is separate from the discovery graph. The registry tracks:

  • Agent name
  • Process ID
  • Parent agent name (for subprocess trees)
  • Stdin write function (for steering)

Read the full file on GitHub · 83 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. 3d ago First seen · 83 lines · 11 tokens per session scan A f9139bd663e7

Subscribe to this mod's changes

hierarchies is an agent published in the GitHub repository dsswift/ion (4 stars, last pushed 3d ago), licensed MIT. It adds 11 tokens to every session and 560 once invoked, about $0.0001 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-31.