Sample output
A real run of validate_graph.py against a 4-node graph — three research branches dispatched in parallel, converging on a synthesis node. The graph is valid and dispatchable, and the validator still catches something worth fixing: all three branches declare the same input document, which is exactly the “false parallelism” pattern this check exists for.
[plan] Parallel batch 1: ['research-pgvector', 'research-pinecone', 'research-weaviate']
[warn] FALSE PARALLELISM: nodes ['research-pgvector', 'research-pinecone', 'research-weaviate'] both consume input 'requirements-doc'. They each pay to load it and neither sees the other's slice. Consider merging them or extracting a shared upstream node.
OK: graph is a valid DAG. 1 warning(s) to consider.
Full example graph and output in the repo.
The problem
Large, multi-part tasks handed to a single agent run serially by default — even when large chunks of the work don’t actually depend on each other. That serial-by-default behavior leaves real speed on the table for any task that decomposes into independent streams.
What I built
A skill that takes an incoming prompt, decomposes it into a directed acyclic graph of sub-agents with explicit dependencies, and validates that graph before anything runs. Independent branches of the graph dispatch in parallel; dependent steps wait on their inputs. The result is a task plan that only runs serially where the work genuinely requires it.
How it works
- Decomposition: the incoming task is broken into discrete sub-agent nodes with declared inputs and outputs.
- Validation: the graph is checked for cycles using Kahn’s algorithm before execution, so a malformed dependency chain fails fast instead of deadlocking mid-run.
- Capability detection: each node is checked against one of three execution modes depending on what tools and context it actually needs.
- Backward contract design: each node’s expected output is defined before its implementation, so downstream nodes can be built against a stable interface.
- Cost ledger: projected token and time cost is tracked per node, giving a running estimate of the full graph’s cost before and during execution.
A finding worth noting
Sub-agent dispatch doesn’t run in degraded mode on claude.ai — parallel dispatch requires the Task tool, which isn’t available there. Cost-ledger figures produced without a dispatched Task tool are projections, not measured values, which matters when comparing estimated versus actual run cost.
Stack
Claude Code, Python, graph validation via Kahn’s algorithm.