About
Architectural sensor for Python codebases.
At a glance
- Runs
- On your computer, from the PyPI package archy, which we verified belongs to this listing.
- Works with
- Claude Desktop, Claude Code, Grok Build (formerly Cursor), Windsurf, VS Code, Codex, Antigravity CLI, Gemini CLI, ChatGPT.
- Can access
- Connects to services on the internet
- Reads files on your computer
- Writes or changes files on your computer
Security report
How we scoreSerious: Uses an outdated component (mcp) with a known security hole
archy is a Python import-graph architecture checker exposed as a CLI and MCP server; the visible code (CLI entry point, MCP tool descriptions, and run_* helpers) shows no exfiltration, shell execution, or hardcoded credentials, and its permissions (file reads of the project, git history, optional file watcher, and writing to .archy/ and install configs) match its stated purpose. Only the truncated excerpts were available, so the review is limited to what was shown and a few low-severity notes about the install command writing into user config directories and the broad git-reading surface. Supply chain analysis found 6 known vulnerabilities in dependencies (0 critical, 1 high severity). Package verification found 1 issue.
5 files analyzed · 10 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Permissions Required
This plugin requests these system permissions. Most are normal for its category.
How to Install
Add this to your MCP configuration file:
{
"mcpServers": {
"archy": {
"command": "uvx",
"args": [
"archy==0.62.0"
]
}
}
}Some servers take additional arguments. See the repository for details.
Documentation
View on GitHubFrom the project's GitHub README.
Your folders show your architecture. Your imports decide it. archy turns a Python import graph into something an agent can use: blast radius before an edit, the tests that edit affects, the modules most at risk. And it fails when the graph disagrees with the layers you declared. Same graph either way, as a CLI and an MCP server, every session and in CI.
[!IMPORTANT] Status, 2026-09-10: active, and pointed at the loop rather than the surface area.
What archy does. One graph, two front ends. It parses a Python project's imports and calls once, keeps the parse cached, and answers the questions a file tree cannot: what does this change reach, which tests does that affect, where are the cycles, and does the graph still agree with the layers you declared. It runs as a CLI in CI and as an MCP server inside an agent session, off the same graph either way, and it fails when the declared architecture and the real one disagree.
Where it is going: deeper into that loop, not wider. The local-model question that reopened this project on 2026-09-02 is closed, as six interventions, none positive, two of them measured as costing MORE than their control. The write-up is Study 8 in
docs/WHAT_DIDNT_WORK.md, and it is the fifth pre-registered null published here. The feature that line produced,conventions --emit-headers, is kept, because it is derived rather than hand-authored, cheap, and--checkstops it rotting. Only the claim attached to it is retired.What those six nulls did establish is where the failure lives: delivery and retrieval, not capability. Across 132 agent transcripts on a pinned tree,
readfired in 132 of 132 runs with a median of 9.5 calls before the first edit; archy fired in 84 of 132, with a median of zero calls before it. Every archy surface is pull. The model reaches for it after it has already decided, or not at all. Two payloads pushed through the one channel archy owns, the file itself, both came out more expensive than their control, which is evidence about the channel and not the content.So the working design rule is: put the answer in the default output of a command that is already being run, rather than adding a surface that has to be discovered first. The live threads follow from it. One is the vacuity family: a check that could not have failed must not report like one that was evaluated and held, which is now explicit on the contracts result and is being finished across the remaining surfaces. The other is two structural refactors of archy's own code: the module its own tools rate as central and fragile, and the two files that have grown large enough to hide things. New tools and new output formats stay gated behind a usage signal.
The discipline does not relax because the project is active. Thresholds are pre-registered before a run, and any result, including another null, gets published in
docs/WHAT_DIDNT_WORK.mdlike the five before it. Nothing archy ships today claims a local-model benefit;archy brief(v0.46) shipped explicitly on judgment ahead of that measurement rather than on one, and the measurement did not later rescue it.What is not changing. The original use case is still supported and still works: layer governance in CI, blast radius and affected-tests for a frontier agent, the MCP server. Nothing is being removed or renamed. Bugs still get fixed, pull requests still get reviewed, and the
good first issuetickets are still deliberately left open.
Read this first: I measured the premise, and it was wrong
I built archy after watching coding agents produce changes that passed review and rotted the import graph underneath. Then I measured whether that happens, and it barely does.
| measurement | subject | rate |
|---|---|---|
| 25 live agent runs on the riskiest SWE-bench tasks | cycles or declared-layer violations | 0% (95% upper bound 12%) |
| 1,072 human commits, 11 repos | cycles introduced | 0.5% per commit |
| 151 commit pairs in projects that declare an architecture | contract violations | 0.66% per commit |
| 107 samples of those same projects over time | rules going stale, coverage eroding | null on all four pre-registered signals |
| 25 agents each building a backend to a specified architecture | wrong dependency direction | 12%, and a checker in the loop took it to 0% |
So: the problem is real (I have watched a developer's own architecture rule get broken in the wild), and it is rare, for agents and humans alike. "Agents will rot your import graph" is a claim I made and have retracted. Nobody has measured what one occurrence costs, so I cannot argue "rare but expensive" either.
The last row is the one that says what archy is for. All 25 unaided agents produced the four layer directories correctly. Every failure was an import going the wrong way: entities reaching down into data access. They got the layout right and the direction wrong, and a directional rule caught all three cases at no cost to the API's behaviour.
That is the shape of the whole thing. Layout is visible in a file tree. Direction, transitive reach and cycles are visible nowhere, at any zoom level, in any single file. And a separate study found that once one of these lands it is never repaired: zero violations were resolved across the sampled corpus, and 2 of 14 repositories sat on broken contracts indefinitely. Rare and permanent, not rare and self-healing.
What that means for what gets built. Feature work premised on "agents will wreck your architecture" went off the table when that premise was retracted, and nothing since has put it back. What survives is narrower and has a number behind it: directional rules, transitive contracts and cycle detection, checked every session. That is a real job and archy does it. What the studies argue against is more of it: five of them produced no evidence that another feature is the missing piece, and the honest reading of headroom-limited results is that the next one will not be either.
So the roadmap that was closed in July stays closed, and being active again did not reopen it. Work here goes into the loop that survived rather than into the list that did not: making what archy already computes arrive where an agent will actually read it, and saying honestly what each answer does and does not cover. Bugs get fixed and contributions are welcome, as before.
The full write-up, including the six measurement artifacts that nearly turned a failed study into a success story, is in docs/WHAT_DIDNT_WORK.md. If you only read one thing here, read that.
The failure it catches

The picture is simplified to four layers to show the idea; archy's own archy.yaml declares seven (metrics, parser, graph, policy, analysis, cli, install), and the edge it marks as forbidden is forbidden there too. Nothing in that picture is derived. Which layer a module belongs to, and which direction is forbidden, are facts you write down in archy.yaml; archy only checks that the source still agrees with them.
Here is the failure it was built for, compressed into one line. This is archy's own source, under archy's own layer rules, with a single import of the kind an agent adds when it needs a helper and the nearest one is upward:
# src/archy/graph.py
from archy.cli import main # convenience import. The diff looks harmless.
$ uvx archy check .
# 1 layer violation(s) (config: /path/to/archy/archy.yaml)
graph -> cli (forbidden):
src/archy/graph.py:17: archy.graph -> archy.cli (line: 17)
# layer coverage: 98 of 99 modules (99%), 332 of 335 internal edges (99%); 1 module(s) match no layer (`archy check --show-unlayered`)
# 245 scanned module(s) sit outside every declared root package and are not counted above
$ echo $?
1
$ uvx archy cycles .
# 1 cycle(s) found
Cycle of 44 module(s):
- archy.affected
- archy.cli
... (42 more modules)
Edges:
src/archy/affected.py:30: archy.affected -> archy.graph (line: 30)
...
src/archy/cli.py:13: archy.cli -> archy.cli_graph (line: 13)
...
src/archy/cli_graph.py:16: archy.cli_graph -> archy.affected (line: 16)
...
src/archy/graph.py:17: archy.graph -> archy.cli (line: 17)
...
$ uvx archy score .
# archy score: 0.629 (0.604 before the edit)
modularity: 0.683 (97 communities, raw Q=0.524)
call-weighted Q=0.759 (calls amplify community structure)
acyclicity: 0.872 (1 cycles, tangle=0.128)
depth: 0.471 (max depth 9)
equality: 0.445 (Gini=0.555)
complexity: 0.791 (4683 functions, cc_mean=2.67, cc_max=42)
# graph: 344 modules, 789 edges (788 before the edit)
# propagation_cost: 0.1335 (diagnostic, not in score; MacCormack reverse-reach fraction)
# calls: 3712 resolved across 582 edge(s), 6.38/edge (diagnostic, not in score)
One import, one edge. A forbidden layer edge, a 44-module cycle, and a score that went up by 0.025. Nothing in the diff itself says any of that, and no amount of reading the file reveals it, because the rule that makes it a violation is not in the source. You supplied it.
Do not read the composite as the verdict here. Acyclicity fell (1.000 to 0.872), but depth is measured after each cycle is collapsed into one node, so the longest chain shrank from 16 to 9 and that gain was larger (#1057). The cycle count going 0 to 1 and check exiting 1 are the signals that matter. Read docs/SCORING.md before treating the composite as a quality gate.
That example is a direct forbidden import, which is the easy case: an agent that reads archy.yaml first can catch it without archy. The harder and more honest case is a transitive violation, where the edit adds no forbidden import at all and reading the config tells you nothing. docs/WALKTHROUGH.md is a one-command reproduction of that, and it states plainly which archy surfaces catch it (one) and which miss it (three).
The output above is from archy 0.56.0 on commit dde901e6, with ... marking lines left out; the line numbers and counts move as the tree grows. Reproduce the example above on a checkout: add that import to src/archy/graph.py, then run the three commands with the uvx prefix. It has to be a separate archy, because that one import is a genuine runtime import cycle, and an editable-installed archy can no longer start to report on itself. archy check exits 1, which is what it does in CI and what the MCP server reports to an agent before it commits.

What archy is not: a code-navigation tool. It will not help an agent find and read code faster; that job belongs to symbol-level, multi-language graph tools like codegraph, and they are better at it. archy answers the other question: you declared this codebase should have these layers, no cycles, and this score; is the agent's edit about to break that, and has the trend been sliding for six weeks? Navigation graphs such as colbymchenry/codegraph carry no such intent, because intent is not in the source, you supply it. Some graph tools do carry declared boundaries (optave/codegraph, tach, agent-arch); what archy adds is narrower, see the analysis below.
The sharp version, about colbymchenry/codegraph (not optave/codegraph, which shares the name and does ship boundary rules), re-checked on 2026-11-09 at v1.6.2: it ships no cycle detection, no config in which to declare layers or forbidden edges, and no command that exits non-zero on a violation. It will happily show you that models imports repositories if you ask the right question. It cannot tell you that is wrong, because wrongness needs a declaration and there is nowhere to put one. Descriptive tools answer questions; archy makes an assertion that breaks the build. The two are both local MCP servers and compose fine; run them together. See docs/research/CODEGRAPH_COMPETITIVE_ANALYSIS.md for the full comparison, including where archy loses and why this distinction is a choice they made rather than a wall they hit.
Start in one command
uvx archy install # detects Claude Code, Cursor, Codex, opencode, Continue, Copilot CLI, Gemini CLI and wires each one up
Nothing lands on your PATH: the config it writes runs uvx archy mcp on demand. Prefer a real install? pip install archy, uv tool install archy, or pipx install archy. Either way, try it on a project without installing anything:
uvx archy score . # one-shot architectural health number
uvx archy cycles . # import cycles, Tarjan SCCs plus self-loops
uvx archy check . # layer rules from archy.yaml; exits 1 on violation
Free, MIT licensed, no commercial version planned. One maintainer, Python only. Built by Alex Lee.
Status: v0.62.0, working, installed and maintained. Usable today via:
| Mode | Command |
|---|---|
| Inspection | archy graph, archy cycles |
| CI governance | archy check (reads archy.yaml; --contracts nests the transitive import-linter verdict in the same output, reported, never gated) |
| Transitive contracts | archy contracts (reads .importlinter (canonical) or falls back to archy.yaml; requires archy[contracts]) |
| One-shot score | archy score |
| Trended score | archy score --record + archy trend |
| Refactor priority | archy hotspots (CC x git churn; --functions FILE ranks the functions inside one file by complexity x commits behind their lines, via git blame), archy what-to-refactor-next (--lens fused|behavioral|structural, default fused hotspots + edit-risk) |
| Per-function smells | archy health (excess parameters, large methods, deep nesting, complex conditionals, each with the measured value and threshold; --file, --since REF, --include-tests, --churn for findings per commit; # archy: disable=<smell> above a function lists its finding under suppressed instead of dropping it; advisory, not a score axis) |
| Duplicate detection | archy duplicates (two-tier: likely duplicates vs demoted variants - same-class/boilerplate/test/vendored; advisory, not a score axis) |
| House style | archy conventions (naming families by home module, kind families by transitive base, NAME = Ctor(...) registries, mirrored surfaces, a gate inventory kept separate from user-error exits, model census, and the members a project's own __all__ or docs leave out - derived from the source, so an agent stops guessing conventions; advisory, exits 0 on a successful report, and --module NAME switches to a complete, unranked lookup on one module - what it imports, what imports it, and whether it was set aside - which answers a negative the ranked report cannot; --emit-headers derives a per-module block (what it owns, what mirrors it, whether a finding here gates) from that same report and prints it, --write puts it in the module docstring (exiting 1 and naming any module whose docstring cannot hold it), and --check exits 1 when one is stale) |
| Change coupling | archy coupling (module pairs that co-change in git history but share no import/call edge - hidden dependencies; source-only, advisory) |
| CI impact lookup | archy affected (git diff -> impacted modules + tests) |
| Human-facing export | archy render --view dsm|trend (one self-contained HTML file: no JS, no CDN, offline, byte-stable) |
| Pre-task briefing | archy brief (one screen composing conventions, layer coverage and the gate inventory for an agent to read BEFORE it starts, plus optional --contracts; advisory on content, exits 1 for an oversized scan) |
| MCP server | archy mcp (cached: warm graph builds in seconds even on 10k+ module repos) |
| Parse cache | archy index sync / archy index clear (persistent .archy/index.db; transparent under the MCP server) |
| Agent install | archy install / archy uninstall (auto-detect Claude Code, Cursor, Codex, opencode, Continue, Copilot CLI, Gemini CLI; wire in or cleanly remove the MCP server) |
How the score is computed and how to read it: docs/SCORING.md. Benchmarks against pydantic, fastapi, flask, pytest, and archy-on-archy: docs/CASE_STUDIES.md. Design rationale and comparison with sentrux: docs/LEARNINGS.md.
In the wild
ADOPTERS.md is empty and no issue has yet been filed by anyone but me. Outside pull requests are a different story and recent: three landed on 2026-07-25, two merged. Good-first tickets are labelled and deliberately left for others.
If you are running archy on a real codebase I would like to hear what it found, especially if the answer is "nothing useful" - that answer is now supported by measurement rather than merely possible.
Why
The failure at the top of this page is the whole reason archy exists: I wanted a single number per commit that would have caught it.
AI agents generate code at machine speed, and the reasoning went: without a feedback loop on structural health (module coupling, import cycles, layer violations), codebases drift architecturally even when every individual change looks fine in review.
That reasoning is the part I tested and could not support. Twenty-five agent runs produced zero structural regressions, and human commits break their own declared rules on 0.66% of commits. The drift may still be real over long horizons, which is not what a per-edit measurement can see, but I have no evidence for it and I am not going to assert it. The rest of this section is the case as I originally made it, kept because the citations are accurate even where my inference from them was not.
Where a feedback loop did pay is narrower, and it is the moment code is written rather than the patrol afterwards. Building a new backend to a specified architecture, 3 of 25 unaided agents got the dependency direction wrong; with a checker in the loop, none did, and the API behaved just as well. That is one model, one framework, and the mildest of the Constraint Decay paper's conditions, so it is not a general claim. It does say the loop is worth having at generation time, where the mistake is cheap to prevent and, per the decay study, never repaired afterwards.

What that buys you is placement: it runs in CI, in pre-commit, and as an MCP server (archy mcp), so a coding agent can read its own architectural impact before it commits rather than after review.
The agent-feedback framing is empirically supported by 2025-2026 research: the Navigation Paradox paper shows large LLM context windows do not eliminate the need for structural graph navigation, LocAgent's ablation finds graph edges materially improve code-localization accuracy, the Constraint Decay paper (arxiv:2605.06445) finds agents lose ~30 points in pass rate as architectural constraints accumulate (Clean Architecture layering alone costs -9.1 points, on the open and mid-tier models tested) and that its ground-truth layer/dependency-direction verifier is essentially archy check, and the coding-agent failure-mode literature names the specific patterns (scope drift, cross-file reasoning failure) that an architectural feedback loop is built to catch. Citations, a failure-mode-to-archy-capability mapping, and the resulting roadmap priorities are in docs/research/RESEARCH_METRICS.md §14c.
The underlying mechanism
Beneath the empirical case is a structural one. Anthony Hobday, writing about software quality, names it precisely: "as the number of things goes up, the number of relationships goes up even faster. Eventually it's impossible for people to properly consider all of those relationships." Coherence is the state where those relationships still hold together; entropy is its steady loss as a system grows. A single author keeps a codebase coherent by remembering every edge. An agent generating code at machine speed cannot, and neither can a team past a certain size.
That relationship load is exactly what archy reads. Coupling, the DSM, import cycles, and change-coupling are all measures of how far the graph has drifted from "one person can hold it in their head." archy externalizes that memory into a number and a trend, so the growth in relationships stays visible instead of being discovered during a refactor that blows up.
Scope
- Python only. The cross-language story belongs to sentrux; that division is settled. archy goes deep on Python (transitive contracts, SDP, NCCD,
if TYPE_CHECKING:handling inarchy cycles) rather than broad across languages; seedocs/LEARNINGS.md§"Competitive landscape". - Tree-sitter powered. Robust to in-flight edits and partial files; survives syntax errors that would crash
ast. - Score that trends over time. A single number per commit, persisted, plotted. Trend matters more than the absolute value.
- Rules as YAML. "Layer X cannot import Y." No DSL, no plugins (yet).
Non-goals
- Multi-language analysis
- Replacing linters, type checkers, or test runners
- Generating code or auto-fixing violations
Quick start
Covered above in Start in one command; this section is the detail behind it.
Requires Python 3.10+ (archy depends on mcp>=1.28.1 which is 3.10-only). If you only have system Python 3.9 or older, install a newer Python first or use uv, which manages versions for you and is what uvx comes from.
pip install archy
# or: uv tool install archy
# or: pipx install archy
# or nothing at all: prefix any command with `uvx`, e.g. `uvx archy score .`
Using archy as an MCP server inside an AI coding agent? Skip the manual config and run uvx archy install, which wires it into Claude Code, Cursor, Codex, opencode, Continue, Copilot CLI, or Gemini CLI automatically and writes a config that invokes uvx archy mcp, so archy never needs to be on your PATH. See docs/INSTALL.md.
All examples below use the installed archy command. If you're working from a checkout, prefix them with uv run (e.g. uv run archy graph .).
See docs/SIXTY_SECOND_TOUR.md for the copy-paste path from zero to first score.
Inspect the graph
archy graph path/to/project --internal-only
archy graph path/to/project --format json > graph.json
archy graph path/to/project --format dot | dot -Tsvg > graph.svg
A reader that closes early, such as archy graph ... | head -1, makes archy exit 141 (as if by SIGPIPE) with nothing on stderr. That is deliberately not exit 1: check, cycles --strict and diff --strict use 1 for a finding, so a truncated pipeline must not read as a failed gate. archy mcp keeps its stdio transport and is unaffected.
Find import cycles

Ranking the modules is what makes a cycle visible: every ordinary import points down a rank, so the one edge pointing back up is the entire finding.
Tarjan SCCs of size >= 2, plus self-loops (a module importing itself). Use --strict in CI to fail on any cycle.
archy cycles path/to/project
archy cycles path/to/project --format json
archy cycles path/to/project --strict
archy cycles path/to/project --strict --exclude-type-checking
The usual way to break an import cycle is to move the back-import under if TYPE_CHECKING:, where it never runs. By default archy still counts that edge, and a cycle that has such edges says so (type_checking_edges in JSON). --exclude-type-checking (or exclude_type_checking_imports: true in archy.yaml; the flag overrides it either way, --include-type-checking turns it back off) leaves them out. It is opt-in so exit codes do not change. With it on, the output reports how many edges it excluded, and --format json becomes {"cycles": [...], "excluded_type_checking_edges": N} so an exclusion that empties the list still shows. Only the body of a bare if TYPE_CHECKING: or if typing.TYPE_CHECKING: counts; an else: branch, a function-local import, and an edge that any unguarded import or call also supports stay in. archy check layer rules and the score's acyclicity axis are unchanged.
Enforce layer rules
Reads archy.yaml from the repo root. Exits 1 on any violation. See Layer rules below.
archy check path/to/project
archy check path/to/project --format json
archy check path/to/project --config custom.yaml
archy check path/to/project --format github # in CI: annotate each violation on the PR diff
--format github (also on archy diff) prints one GitHub workflow command per finding before the usual text report, so a PR shows each new violation, cycle and required-reach failure at its import line from a read-only job. Paths are made relative to the working directory, which is the repository in a workflow. GitHub shows 10 annotations per level per step; past that the last annotation says how many were not shown and the rest are printed as plain lines. On archy diff the annotations are errors under --strict and warnings otherwise. The Action's check and diff commands use it.
Transitive contracts (archy contracts)
archy check only sees direct edges. archy contracts wraps import-linter so the same layer story is enforced transitively (A → B → C still counts as A reaching C). It is the strictness upgrade for projects whose layers leak through indirect paths.
pip install 'archy[contracts]'
archy contracts path/to/project
archy contracts path/to/project --format json
archy check --contracts runs this same transitive verdict inline, nested under the check output. It never changes check's own exit code: a flag that can turn a passing check into a failing one because an optional dependency is absent would be unsafe to leave on in CI. Use the standalone archy contracts when the transitive result should itself gate the build.
A kept contract is not automatically protection. A contract whose module expressions match nothing in the graph holds no matter what the code does, so all_kept calls it kept while nothing was ever checked. archy contracts exits non-zero on verified (evaluated and held), not on all_kept, and archy check --contracts reports transitive_checked: false for the same reason: a rule that could not have failed was not evaluated. The text output marks such a contract ?? rather than OK and names the expressions that matched no module; --format json adds top-level verified and unverifiable alongside kept/broken, and per-contract matched_nothing and unmatched_expressions. A config that is present but defines no contract (an .importlinter with no contract sections, an archy.yaml with no forbid: rules) is not verified either: verified is false, unverified_reason names the config, and archy contracts exits non-zero. A .importlinter type = layers contract needs no such flag: import-linter itself refuses to run when a required layer's module is absent, which archy reports as a config error, and an optional layer (written (name)) is absent by design.
Directories the engine does not read. import-linter's engine (grimp) skips a directory with no __init__.py once it is inside a regular package, so a path through it is invisible and the contract is reported as kept. archy contracts and check --contracts list those directories (unscanned_dirs in JSON and the MCP payload; one # N directory not visible to the contracts engine line in text). It is a note on the verdict and does not change verified or the exit code, since a stray scripts or fixtures directory would otherwise fail every existing gate. Add the __init__.py to bring the modules under the contract.
Config resolution. archy contracts reads, in order:
- The
--configargument if passed. .importlinterin the project root: the canonical contracts config.archy.yaml: best-effort fallback. It refuses when import-linter would load a root package from somewhere other than the scanned tree (an install, another checkout), since that verdict would be about other code.archy contractsreads the one in the project root;check --contracts,brief --contractsand the MCP tools derive from the config they checked against (--config/config_path, or the one discovered above PATH). Eachforbid:rule becomes one Forbidden contract checked transitively. Emits aUserWarningbecause this path cannot expressignore_imports, so any legitimate transitive edge (e.g., a service layer reachingpsycopgthrough a sanctionedapp.libs.db.*module) will be reported as a violation with no way to whitelist it.
Two configs, one concern each:
archy.yamlowns layer definitions, direct-edge gating (archy check), required-reach rules (required:),sdp:,exclude:, androots:..importlinterowns transitive contracts: all five contract types (Forbidden, Layers, Independence, Protected, AcyclicSiblings) andignore_importswhitelists.
Reach for .importlinter as soon as you need transitive enforcement at all; the archy.yaml fallback is a zero-config onramp, not a feature target. See the Flask .importlinter example, and the import-linter contract types reference for the full grammar.
Common case: forbid services from reaching psycopg but allow the sanctioned db library to do so:
[importlinter]
root_package = app
[importlinter:contract:services-must-not-reach-psycopg]
name = services must not reach psycopg
type = forbidden
source_modules =
app.services
forbidden_modules =
psycopg
ignore_imports =
app.libs.db.engine -> psycopg
Compute a quality score
Composite of modularity, acyclicity, depth, equality, and complexity (geometric mean of five axes). See docs/SCORING.md for formulas and how to interpret the breakdown. These five axes were chosen after surveying ~15 alternatives from the package-metrics literature (Martin's I/A/D, Lakos's NCCD, MacCormack propagation cost, Structure101 fat/tangle, reflexion models, cognitive complexity, hotspots, logical coupling, dead/duplicate-code detection); Martin's I and the Stable Dependencies Principle check are also shipped as a per-module diagnostic and an archy check rule. See docs/research/RESEARCH_METRICS.md for the full validation, what was shipped, and what was deferred and why.
archy score path/to/project
archy score path/to/project --format json
Track score over time
Persist per-commit scores to .archy/history.jsonl and chart the trend.
archy score path/to/project --record
archy trend path/to/project
archy trend path/to/project --last 30 --format json
Regression gate
Fail if the current score drops more than --strict-tolerance (default 0.02) below the most recent recorded run of the same scope (--internal-only or --all).
Known matching rows take precedence over legacy rows, regardless of order. If no match exists, the newest legacy row is used with a scope unknown reason. History containing only the other scope fails with recording advice, or passes and seeds the scope with --record; empty history passes without a comparison. New rows store internal_only; old rows read as null. Trend text, JSON, MCP history and HTML label each row's scope, and a window holding both scopes omits sparklines and charts.
archy score path/to/project --strict
archy score path/to/project --strict --record # check then record
archy score path/to/project --strict --strict-tolerance 0.0
Blast radius
List internal modules that transitively depend on a given file. Useful before refactoring or removing a module.
archy impact path/to/project --file app/libs/db.py
archy impact path/to/project --file app/libs/db.py --file app/services/auth.py --format json
Both impact and affected follow implicit package-initialization edges, so
changes to __init__.py or its dependencies reach tests importing submodules.
Each implicit edge counts as one hop against affected --depth, when you pass it. Impact chains
label these hops implicit: package_init instead of citing a source line.
Affected tests (CI gating)
archy affected is the CI-shaped cousin of archy impact: given changed files, it returns the impacted modules pre-classified into tests and other downstream code. It follows the full reverse closure. -d N / --depth N is an opt-in bound, and the output then says how many tests and modules lie beyond it (a # line in text and on stderr with --quiet; tests_beyond_depth and modules_beyond_depth in --json and MCP). Up to v0.62.0 the default was --depth 5. Pipes naturally from git diff:
git diff --name-only HEAD | archy affected . --stdin
archy affected . src/foo.py --filter "tests/integration/**" --json
# Run pytest on the selection (bash or zsh).
(
set -o pipefail
tests=$(git diff --name-only HEAD | archy affected . --stdin --quiet) || exit $?
if [ -n "$tests" ]; then printf '%s\n' "$tests" | xargs pytest; fi
)
Do not pipe --quiet straight into xargs pytest. On an empty selection GNU xargs (Linux) runs pytest with no arguments, which is the whole suite, and BSD xargs (macOS) runs nothing and exits 0. On an empty selection the block runs no test and exits 0, which is not a passing test run. --quiet may write nothing to stderr there (a changed module that no test imports), so run without --quiet to see why. With no changed files at all, archy affected exits 2 and so does the block.
Relative changed paths are tried under PATH first. If missing there and PATH
is inside a git work tree, archy retries at the git root and uses the file if it
exists there and lies inside PATH. This accepts git-root-relative paths such as services/api/pkg/a.py
with archy affected services/api --stdin. Without git or outside a work tree,
paths stay relative to PATH. Alternatively, run git diff --relative --name-only HEAD from PATH to produce project-relative paths. archy impact and MCP
archy_impact resolve their changed files the same way.
The tests to run include a changed test file itself, and a changed conftest.py selects the test files in its directory and below. A conftest.py archy does not scan (for example a root one in a src/ layout) is reported as unresolved and selects nothing. When a changed conftest.py applies to every test file, the output says so (whole_suite_reason in --json and MCP, a # line on stderr with --quiet). A selection holding only changed files not named test_*.py or *_test.py (a helper under tests/) carries the same empty_caveat as an empty one.
Files that select the whole suite. A lockfile, pyproject.toml, a shared data file or a settings file read by string can break any test and has no import edge. List them in archy.yaml:
affected:
run_all_when_changed:
- pyproject.toml
- uv.lock
- "tests/data/**"
There is no default list: without this key such a file stays in unresolved and selects nothing. When a changed file matches (deleted files included), every test file archy found is selected, --depth notwithstanding, and --filter still decides what a test file is. The text output and --quiet (on stderr) name each file and pattern; --json and MCP carry run_all, run_all_matches and whole_suite_reason. A matched file is not also listed as unresolved or deleted. Patterns are relative to the directory holding archy.yaml (for a project below it, a path missing under the project is also read from the git work-tree root, so a root lockfile still matches; a relative path that exists under the project means that file), match whole files, and use * (within one directory), ** (any number of directories, as a whole segment) and ?; a directory is written dir/**. Syntax that could never match ([, {, !, a leading or trailing /, ..) is refused. A pattern that matches no file on disk and no changed file is reported (run_all_unmatched_patterns), since a misspelled one otherwise looks like a change that needed no run. A match is always the whole suite, never only the tests beside the file. An older archy refuses the affected key as unknown.
Test classification defaults to pytest conventions (test_*.py, *_test.py, anything under a tests/ directory); override with --filter <glob>. A filter that matches no file in the graph is an error (exit 1) rather than an empty selection, and it ends with a did you mean when a directory is close. A tests/ with no __init__.py beside a src/ layout is scanned (test files outside a package are named from the scan root, as in a flat layout), so affected selects them; other .py files outside every package (docs/conf.py, noxfile.py, examples/) are still not in the graph, and a filter that names only those is refused. Internal modules only; vendored or third-party code is not traced.
Documentation truncated — see the full README on GitHub.
Reviews
No reviews yet
Be the first to review this server!
More Developer Tools MCP Servers
Ipybox
Freeby Martin Krasser · Developer Tools
Unified execution environment for Python code, shell commands, and programmatic MCP tool calls
Codeclone
Freeby Orenlab · Developer Tools
A structural review layer for Python — baseline-aware, deterministic, built for CI and AI agents
Ohm
Freeby Murugarajr · Developer Tools
AST-based Python refactoring MCP server with safe automated refactorings and rollback
Synaptic
Freeby ColinVaughn · Developer Tools
Code intelligence for repository graphs, change impact, test selection, and engineering memory.
Pyscn
Freeby Ludo Technologies · Developer Tools
Python code analysis for AI agents: complexity, dead code, clones, coupling, and a health score.
Architecture Intelligence Platform
Freeby Michaelegner · Developer Tools
Evidence-qualified architecture context for coding agents.
