dag — Claude Code command: subagent DAG edges per session
dag prints the parent-to-child subagent edges for one session, pulled from the local dashboard at http://localhost:4820.
MIT ★ 1,198 updated 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-workflows@claude-code-agent-monitor-pluginsWhat dag does
Hand the command a session id and it asks the local dashboard at http://localhost:4820 for the orchestration dataset under /api/workflows/<session-id>. With no argument it fetches the most recent session itself and tells you which id it took. The dataset carries nodes with agent id, type, model, status and depth, plus parent-to-child edges.
Three plain blocks come back: a topology line like root → depth <N>, fan-out <max>, <agent count> agents, then edges ordered by depth as depth d: parent[model] → child[type, status], then the leaves on one line. No tables, no preamble. Everything printed came from the API, so no agent appears that did not run.
The dashboard has to be up; without it there is nothing to read. When it does not answer, the command tells you to start it with npm start from the repo root. A rendered tree with depth and fan-out breakdown lives in the dag-map skill. Sessions with no subagents come back as single-agent session, depth 0.
What it helps with
- See which subagents actually ran in a session
- List parent-to-child edges grouped by depth
- Find the leaf agents that spawned nothing
- Check how deep the orchestration went and its widest fan-out
- Tell a single-agent run from a multi-agent one
Example prompts for the agent
/dag— walk the most recent session and print its subagent edges/dag 7f3a91— show the topology line and the leaves for this session/dagand tell me which session id you picked
How to install dag
1Plugin marketplace
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor/plugin install ccam-workflows@claude-code-agent-monitor-plugins2Manually: put the files in place
.claude/commands/dag.mdCall it with /dag. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/dag.mdCall it with /prompts:dag. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/dag.prompt.mdManually: put the files in place
.gemini/commands/dag.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about dag
How do I install dag in Claude Code?
From the marketplace: /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, then /plugin install ccam-workflows@claude-code-agent-monitor-plugins. The command file itself is .claude/commands/dag.md.
What does dag do?
It prints the orchestration view of one session: a topology line with depth and fan-out, parent-to-child edges ordered by depth, and the leaf agents.
Does dag need the dashboard running?
Yes, it reads http://localhost:4820. If that does not answer, start the dashboard with npm start from the repo root.
Source text
dag.md · MIT
--- description: Print the orchestration DAG edges (parent→child subagents) for a session. argument-hint: "[session-id]" --- Print the multi-agent orchestration DAG for a session from `http://localhost:4820`. The session id is **$ARGUMENTS**. If empty, fetch `curl -s 'http://localhost:4820/api/sessions?limit=1'` and use the most recent session, stating which id you picked. If the dashboard is unreachable, tell the user to start it with `npm start` from the repo root. Fetch the workflow intelligence and read its `orchestration` dataset: ``` curl -s http://localhost:4820/api/workflows/$ARGUMENTS ``` `orchestration` contains the DAG nodes (agent id, type, model, status, depth) and parent→child edges. Print, concisely: 1. **One-line topology** — `root → depth <N>, fan-out <max>, <agent count> agents`. 2. **Edge list** — one line per edge, grouped/ordered by depth: `depth d: parent[model] → child[type, status]` 3. **Leaves** — list the leaf agents (no children) on one line. No tables, no preamble — just the topology line and the edges. Cite only nodes and edges returned by the API; never invent agents. If the session has no subagents, say so (single-agent session, depth 0). For a rendered tree and depth/fan-out breakdown, point the user at the `dag-map` skill.
© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor