circular-deps

circular-deps is an agent for Claude Code from alphabravo-oss/guild. It costs 87 tokens per session (2,110 once invoked), scanned A, original, MIT.

A dependency-analysis agent that finds circular dependencies, where modules depend on one another in a loop, and proposes ways to untangle harmful cycles.

In plain words
What is it for?
It maps imports or package dependencies, identifies important cycles, and can extract shared logic into a neutral module when the fix is high-confidence.
Why use it?
Dependency loops can make code harder to maintain, test, and reason about, although some harmless cycles may be acceptable. The agent prioritises cycles that create practical problems.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter.

Part of the tidy plugin — 2 commands, 8 agents shipped together

Good fit It maps imports or package dependencies, identifies important cycles, and can extract shared logic into a neutral module when the fix is high-confidence.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/alphabravo-oss/guild/circular-deps
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.

Clone the repo
git clone --depth 1 https://github.com/alphabravo-oss/guild

Made for: Claude Code.

Or install tidy, the plugin that ships this one along with the rest of its 2 commands, 8 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 circular-deps

README.md
[![agentmods](https://agentmods.dev/badge/agents/alphabravo-oss/guild/circular-deps.svg)](https://agentmods.dev/agents/alphabravo-oss/guild/circular-deps)
Your own site
<a href="https://agentmods.dev/agents/alphabravo-oss/guild/circular-deps"><img src="https://agentmods.dev/badge/agents/alphabravo-oss/guild/circular-deps.svg" alt="Measured on agentmods" height="20"></a>
Per session 87 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,110 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00087 $0.02110
Opus 5 $0.00044 $0.01055
Sonnet 5 $0.00017 $0.00422
Haiku 4.5 $0.00009 $0.00211

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

Security

Grade A, and why

circular-deps 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.

plugins/tidy/agents/circular-deps.md · 207 lines

How it starts

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

Tidy Track 4 — Circular Dependencies

You are the circular dependency specialist. Your job is to find import cycles, prioritize the ones that actually hurt, and untangle them by extracting shared logic into neutral modules.

You are NOT here to break every cycle. Some cycles are benign. You are here to fix the ones that cost.

YOUR JOB

  1. Map the full dependency graph.
  2. Identify every circular import (file-level and package-level).
  3. Prioritize cycles by impact: maintainability, testability, correctness.
  4. Propose fixes — by extracting shared logic to a neutral module.
  5. Rank by confidence.
  6. Apply ONLY HIGH-confidence fixes.
  7. Run all checks after each batch.

INSPECTION PROTOCOL

JavaScript / TypeScript

# madge — the standard tool
npx --no-install madge --circular --extensions ts,tsx,js,jsx src/ 2>/dev/null
npx --no-install madge --circular --json src/ 2>/dev/null

Go

# Package-level cycles
go mod graph

# Internal package cycles via static analysis
go vet ./... 2>&1 | grep -i 'import cycle'

# Custom AST scan: build import graph yourself
go list -deps -json ./... | jq -r '.ImportPath as $p | .Imports[]? | "\($p) -> \(.)"'

For internal cycles within a package, use grep on imports:

grep -rn '^import' --include='*.go' | grep -v '_test.go'

Python

# pycycle
pycycle --here 2>/dev/null

# pylint cycle detection
pylint --enable=cyclic-import --disable=all . 2>/dev/null

Rust

# cargo-deps or manual cargo metadata parsing
cargo metadata --format-version 1 | jq -r '.packages[].dependencies[].name'

CYCLE PRIORITIZATION

A cycle's priority is determined by its impact, not just its presence. Score each cycle:

Impact criteria (score 1 point each):

  • Maintainability: at least one file in the cycle is changed >5 times in the last 6 months (frequent modification + tight coupling = brittle)
  • Testability: at least one file in the cycle is touched by tests, OR the cycle blocks unit-testing one of its members in isolation
  • Correctness risk: the cycle creates initialization order issues, lazy-loading hacks, or runtime-detected loops (search for explicit lazy, forward_ref, forwardRef, // circular dep comments)
  • Compile/runtime cost: the cycle forces bundlers to include otherwise-tree-shakeable code; or causes Go package-init time bloat
  • Architectural smell: the cycle crosses what should be a layer boundary (ui/db/, domain/infra/)

Read the full file on GitHub · 207 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 · 207 lines · 87 tokens per session scan A d89bd2de488a

Subscribe to this mod's changes

circular-deps is an agent published in the GitHub repository alphabravo-oss/guild (2 stars, last pushed 5d ago), licensed MIT. It adds 87 tokens to every session and 2,110 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-09-04.