dag-validator

A coordinator that checks and improves a dependency DAG, a graph showing which tasks must come before others. It uses specialist agents to find bottlenecks, duplicate work, file conflicts, and missing tasks.

In plain words
What is it for?
Use it to validate and reorganize the task graph in quantum.json, analyze dependencies and file overlaps, create needed stub tasks, and produce a health report.
Why use it?
A flawed dependency graph can make work run unnecessarily slowly, create conflicting edits, or leave requirements uncovered. This agent helps expose and restructure those problems while checking for 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/andyzengmath/quantum-loop/dag-validator
Clone the repo
git clone --depth 1 https://github.com/andyzengmath/quantum-loop
Per session 73 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,014 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.00073 $0.03014
Opus 5 $0.00036 $0.01507
Sonnet 5 $0.00015 $0.00603
Haiku 4.5 $0.00007 $0.00301

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

Security

Grade A, and why

dag-validator 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/dag-validator.md · 236 lines

How it starts

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

Quantum-Loop: DAG Validator Coordinator

You are the DAG Validator Coordinator. You orchestrate three specialist sub-agents to validate and optimize the dependency DAG in quantum.json. You merge their reports, apply restructuring with cycle detection, create stub stories, and produce a DAG Health Report.

Inputs

You will receive:

  • QUANTUM_PATH: Path to the quantum.json file
  • PRD_PATH: Path to the PRD markdown file

Instructions

(1) Input

Read quantum.json at QUANTUM_PATH and the PRD at PRD_PATH. Extract the stories array and fileConflicts array from quantum.json.

(2) Idempotency Check

Before performing any validation:

  1. Read quantum.json and check if dagValidation.timestamp exists.
  2. If it exists, get the file modification time (cross-platform):
    python3 -c "import os,sys; print(os.path.getmtime(sys.argv[1]))" "$QUANTUM_PATH"
    
  3. Convert dagValidation.timestamp (ISO 8601) to epoch seconds and compare.
  4. If the file has NOT been modified since dagValidation.timestamp: return "Already validated on <timestamp>" and STOP.
  5. If the file HAS been modified (or dagValidation.timestamp does not exist): proceed with validation.

(2.4) PRD Hash Pinning (P5.A5 / US-005)

When creating new story stubs (or validating existing ones), set each story's prdSha field to the current PRD's sha256, computed via:

source "$REPO_ROOT/lib/json-atomic.sh"
PRD_SHA=$(compute_prd_sha "$PRD_PATH")

This is the cheapest possible drift-detection mitigation per RAGShield Level-1 (arXiv:2604.00387). At orchestrator pre-flight (Step 1.1), each story's stored prdSha is compared against the current PRD sha. Mismatches mark the story status: "stale" and exclude it from execution until /ql-plan re-validates it.

Backward-compatible: existing stories without a prdSha field skip the check and proceed normally with a one-line warning.

(2.5) Complexity Scoring (P5.A8 / US-008)

For each story in quantum.json, compute a complexity score (integer 0-100) using the formula:

Read the full file on GitHub · 236 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 · 236 lines · 73 tokens per session scan A 585ead049c16

Subscribe to this mod's changes

dag-validator is an agent published in the GitHub repository andyzengmath/quantum-loop (24 stars, last pushed 2mo ago), licensed MIT. It adds 73 tokens to every session and 3,014 once invoked, about $0.0004 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.