Skip to main content

BlastRadius

Static call-graph and blast-radius analysis for Python and TypeScript/TSX coding agents, packaged as an installable agent skill (SKILL.md) backed by a local MCP server.

Before an agent modifies a shared function, class, or method, BlastRadius identifies downstream call sites, transitive dependents, and affected test files so the change and its callers can be updated in a single pass.

BlastRadius answers one question: if this code changes, what else must change and which tests verify it? It is not a code explanation tool and does not replace a type checker or test suite.

What's New in v1.1.0 / v1.1.1

  • ORM & Database Table Contracts (db_contract): Tracks SQLAlchemy models (including __table_args__ = {"schema": ...}), Alembic migrations (including bulk_insert, create_foreign_key, drop_constraint, create_unique_constraint, op.execute), schema.prisma models (.prisma), Drizzle tables, legacy Model.query, and explicit SQL execution sinks (text, execute, $queryRaw, query) via canonical TABLE:<name> hubs.
  • Dataclass, TypedDict & NamedTuple Precision (v1.1.1 inheritance & test-recall fix): Models field-level schema slots (including inherited @dataclass and TypedDict subclasses), base-class/inherited-field breaking checks, and additive-compatible pruning that preserves mapped test_files (namedtuple(...) / typing.NamedTuple treated as positional-breaking).
  • Next.js App Router Server Actions ("use server"): Extracts module-level and inline "use server" actions (including export { impl as alias } re-exports), binds <form action={...}>, <button formAction={...}>, useActionState / useFormState, and direct await action(...) calls as server_action edges (rpc contracts), and stops "use client" boundary checks cleanly at valid "use server" modules while still flagging server-only imports.

Known Limitations

BlastRadius lists everything statically visible in the repo. It cannot see dynamic calls, string-based lookups, or reflection.

Specifically, static AST analysis cannot resolve:

  • Dynamic dispatch: getattr(obj, name)(), globals()[name](), or dynamic imports.
  • String-based lookups: Django URL string routes or unittest.mock.patch("pkg.mod.fn") (dotted string references are surfaced as name-match-only candidates, not confirmed calls).
  • Reflection and metaprogramming: Methods generated by metaclasses or __getattr__.
  • Signature-mutating decorators: Wrappers that alter parameter lists at runtime.
  • Monkeypatching: Runtime attribute or module replacement.
  • Pytest fixture injection: Fixtures bound by parameter name rather than import/call.
  • Dynamic TS/JS imports & reflection: import(expr), computed property calls (obj[key]()), or runtime Proxy handlers.
  • Minified or unmapped stack traces: trace_error skips external frames and requires source-mapped repository paths (webpack://, Vite /src/..., or repo paths).
  • External packages: Callers or definitions outside the target repository (site-packages, node_modules).

Results tagged name-match-only are unverified candidates to inspect, not proof of a dependency. See references/limitations.md for details.

How It Differs from Graphify

Graphify builds a repository-wide graph aimed at architecture navigation and explaining how a system fits together. BlastRadius is built specifically for edit-time impact: mapping planned line changes to enclosing definitions, walking reverse call/import edges with explicit confidence labels, and identifying affected test files before an edit is written.

Quickstart

1. Run the MCP server

Run directly from PyPI with uvx:

uvx blastradius-skill

Or install from PyPI into an environment with pip:

pip install blastradius-skill

Or install from GitHub source:

uvx --from git+https://github.com/amitkumar-ak-55/blast-radius.git blastradius-skill
pip install git+https://github.com/amitkumar-ak-55/blast-radius.git

For local development from a clone:

git clone https://github.com/amitkumar-ak-55/blast-radius.git
cd blast-radius
pip install -e .

2. One-command onboarding & MCP client setup

Initialize .mcp.json, Claude Code hooks/CLAUDE.md, or Cursor rules idempotently:

# Configure Claude Code and Cursor in the target repository (writes portable command: "blastradius")
blastradius init --client all --repo .

# Optional local-only override when launching without PATH (do not commit generated MCP configs)
blastradius init --client all --repo . --absolute-path

# Inspect environment dependencies, external typecheckers, and cache state
blastradius doctor --repo .

# Run the MCP stdio server (same as `blastradius` with no arguments)
blastradius serve

By default, blastradius init writes the portable "command": "blastradius" into .mcp.json and .cursor/mcp.json so configs stay shareable across machines and CI. If blastradius is not currently on PATH, init still writes the portable config and prints a stderr reminder to run pipx ensurepath (and restart your shell) or pass --absolute-path for a local machine-specific path. For .claude/settings.json, init selects a portable Python interpreter name (python3 then python on POSIX; python then py on Windows; falling back to python3/python with a stderr warning if none is on PATH), and only writes an absolute interpreter path when --absolute-path is passed.

The pre_edit_guard.py hook installed by init is stdlib-only and always fails open (exit 0) once Python launches it. Note that if the configured interpreter name cannot be found on PATH (exit 127 / Windows 9009), that failure occurs before the script starts and cannot be caught inside pre_edit_guard.py (Claude Code reports non-2 exits as non-blocking hook errors so edits still proceed). End-to-end latency per hook trigger is dominated by Python interpreter startup rather than the guard evaluation itself.

Or use .mcp.json (included in this repository):

{
  "mcpServers": {
    "blastradius": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/amitkumar-ak-55/blast-radius.git",
        "blastradius",
        "serve"
      ]
    }
  }
}

Or register via Claude Code CLI:

claude mcp add blastradius -- uvx --from git+https://github.com/amitkumar-ak-55/blast-radius.git blastradius serve

3. Install the agent skill

Copy SKILL.md and references/ into your client's skill directory:

# Project-local cross-agent layout
mkdir -p .agents/skills/blastradius
cp SKILL.md .agents/skills/blastradius/
cp -r references .agents/skills/blastradius/

# Or Claude Code project skills
mkdir -p .claude/skills/blastradius
cp SKILL.md .claude/skills/blastradius/
cp -r references .claude/skills/blastradius/

4. Verify the installation

python scripts/install_check.py
python scripts/install_check.py --stdio

MCP Tools (5 Consolidated Tools)

All 5 consolidated tools operate locally over stdio, send no code off-machine, write diagnostics only to stderr, and resolve the repository root in order: repo_path argument, MCP client roots / BLASTRADIUS_REPO_ROOT, or nearest parent containing .git or pyproject.toml. Schema size is 3,663 chars (964 estimated tokens via ceil(chars / 3.8)), down -27.35% (-363 tokens) from v0.5.0's 9-tool schema (5,040 chars, 1,327 est. tokens).

get_blast_radius(filepath, modified_lines, change_type="signature", mutation_kind="breaking_change", max_tokens=3500, calibrated=false, repo_path=None)

Maps planned edits (42, [42, 43], or "42-50") to enclosing definitions, runs Pareto-optimal reverse dependency traversal across calls, imports, FastAPI Depends/closures/routers, Pydantic BaseModel schemas, Next.js App Router layouts/middleware, JSX props, and cross-stack HTTP API contracts (api_contract), and merges symbol-keyed runtime coverage (test_files[].source="runtime_coverage"), historical co_change_files, scoped blind_spots, "use client" -> server-only boundary_violations, edit_scope, 2-tier hub packing under max_tokens, stale_files (LKG syntax-error protection), and explainable risk factors.

get_symbol_context(symbol, scope="repo", include_body=false, repo_path=None)

Replaces get_symbol_callers and get_type_definition. Returns signature, Pydantic pydantic_fields/from_attributes, typed React jsx_props, optional function/class body (include_body=true), and all static/dynamic callers sorted by confidence.

verify_edit_impact(filepath=None, modified_lines=None, diff_text=None, test_output="", failed_tests=None, passed_tests=None, record_calibration=false, run_typecheck=true, repo_path=None)

Compares pre-edit BlastRadius predictions against unified diffs (diff_text or read-only git diff), verifies diff containment against edit_scope, reconciles AST-derived change_type against per-PID pre-edit snapshots (or HEAD), runs optional local basedpyright --outputjson / pyright --outputjson / tsc --noEmit diagnostics when installed, parses pytest / vitest / jest test outcomes, and optionally records calibration in .blastradius/calibration.json.

trace_error(traceback_text, repo_path=None)

Parses pasted browser, React, Node.js, or Python stack traces, safely maps in-repo frames inside repo_root (ignoring node_modules, stdlib, and external paths), resolves enclosing definitions (including <locals> closures), and returns their direct callers and affected test files.

get_architecture_view(view="summary", scope="repo", repo_path=None, layer_rules=None)

Returns read-only structural views ("summary", "entry_points", "core_modules", "shared_utilities", "critical_paths", "module_boundaries", "circular_dependencies", "layers") plus "calibration" (historical verification run stats and calibrated risk weights).

Confidence Tags & Output Contract

Every tool returns deterministic JSON containing truncated: bool and relative POSIX paths only (never absolute paths or timestamps). If repo_root resolution, path containment, or input validation fails, the response includes an error: str field with truncated: false. Matches are sorted deterministically before applying the default 50-item cap:

  1. direct — confirmed through static import, local type binding, or module-level definition.
  2. via-import — reachable transitively through downstream calls, inheritance, or __init__.py re-exports.
  3. name-match-only — matching symbol or dotted string reference without static type confirmation.

Full payload definitions are documented in references/output-schema.md.

Example

When planning a signature change on create_user (lines 5–11 of auth.py in tests/fixtures/mini_repo), calling get_blast_radius(filepath="auth.py", modified_lines="5-11") returns:

{
  "source_definitions": [
    {
      "name": "create_user",
      "qualified_name": "auth.create_user",
      "file": "auth.py",
      "line_start": 5,
      "line_end": 11
    }
  ],
  "affected": [
    {"file": "routes.py", "function": "handle_register", "line": 18, "confidence": "direct"},
    {"file": "tests/test_auth.py", "function": "test_create_user", "line": 4, "confidence": "direct"},
    {"file": "tests/test_auth.py", "function": "test_create_user_invalid_email", "line": 12, "confidence": "direct"},
    {"file": "workers.py", "function": "send_welcome_email", "line": 5, "confidence": "direct"},
    {"file": "cli.py", "function": "main", "line": 7, "confidence": "via-import"},
    {"file": "tests/test_routes.py", "function": "test_handle_register", "line": 11, "confidence": "via-import"}
  ],
  "test_files": [
    {"file": "tests/test_auth.py", "references": ["create_user"], "confidence": "direct"},
    {"file": "tests/test_routes.py", "references": ["handle_register"], "confidence": "via-import"}
  ],
  "total_affected": 6,
  "truncated": false
}

Caching & Repository Hygiene

Parsed per-file AST facts are cached atomically (temporary file + os.replace) under <repo_root>/.blastradius/cache.json keyed by SHA-256 content hash, with an auto-created .blastradius/.gitignore containing *. On subsequent queries, only changed files are re-parsed and cross-file edges are re-resolved. If the repository is read-only, BlastRadius falls back to in-memory indexing and includes a warning.

File discovery skips .git, .hg, .svn, .venv, venv, env, node_modules, __pycache__, .mypy_cache, .pytest_cache, .ruff_cache, .blastradius, dist, build, *.egg-info, directory symlinks, symlinks resolving outside repo_root, files with NUL bytes in the first 8 KB, and Python files larger than 1 MB. Files are decoded with utf-8-sig and normalized across CRLF and LF endings.

When the target is a git repository and git is installed, BlastRadius prefers git ls-files --cached --others --exclude-standard for .gitignore handling. Otherwise, it falls back to a subset of root .gitignore rules supporting:

  • Blank lines and # comments
  • Directory rules ending in /
  • Relative path globs containing / (fnmatchcase)
  • Filename or path-segment globs without / (fnmatchcase)
  • Negated patterns prefixed with !

(Nested .gitignore files, arbitrary-depth ** globs, and .git/info/exclude require git.)

Development & Testing

# Install editable package with dev tools
pip install -e ".[dev]"

# Run unit and fixture exact-match tests
python -m pytest -v

# Run linter and type checker
ruff check src tests scripts evals benchmarks
mypy src

# Run SKILL.md task eval graders and trigger checks
python evals/run_evals.py

# Run installation and stdio MCP smoke checks
python scripts/install_check.py --stdio

Continuous integration is configured in .github/workflows/ci.yml across Linux, macOS, and Windows.

Benchmarks

Raw benchmark data is committed in benchmarks/results/static_eval.json, benchmarks/results/static_eval_ts.json, benchmarks/results/fullstack_eval.json, and benchmarks/results/git_replay_eval.json, and is reproducible via benchmarks/run.py.

Timing (cold/warm latency) figures are environment-dependent: they were captured when the committed results were generated and vary by host, Python version, and disk speed, so absolute values differ from machine to machine. Re-run locally with benchmarks/run.py for your own numbers.

Python Static Analysis Evaluation (pinned v1.0.0 run, 18 tasks, 3 pinned repos, n = 3 runs per task)

Evaluated across pallets/itsdangerous (672971d, 15 files), pytest-dev/pluggy (baa68a2, 36 files), and pallets/click (08b803c, 91 files), running get_symbol_callers, get_blast_radius, and get_type_definition on 18 refactoring targets (6 per repository; cold index vs. cached warm query):

Metric Min Median Max Condition
Caller-file recall 1.000 1.000 1.000 Static graph (n = 3 runs/task)
Confirmed caller precision (direct / via-import) 1.000 1.000 1.000 Static graph (n = 3 runs/task)
Test-file recall 0.500 1.000 1.000 Static graph (n = 3 runs/task; 17/18 at 1.000)
Cold query latency (index + 3 tools) 238.0 ms 454.3 ms 1317.4 ms Cleared .blastradius/ per run (includes git ls-files)
Warm query latency (cached + 3 tools) 184.1 ms 238.8 ms 419.3 ms Cached .blastradius/ + in-memory graph
Tool payload / full caller files ratio 0.052 0.256 0.649 Bounded JSON vs. reading caller files in full

The one partial test-recall case (pluggy-06-raise-wrapfail) missed testing/test_invocations.py because that test invokes the target indirectly through pluggy's dynamic PluginManager.hook() dispatch rather than a direct static call.

TypeScript Static Analysis Evaluation (pinned v1.0.0 run, 8 tasks, 2 pinned repos, n = 3 runs per task)

Evaluated across sindresorhus/ky (3541888, 98 files) and immerjs/immer (b80ac34, 54 files), running get_symbol_callers, get_blast_radius, and get_type_definition on 8 refactoring targets (4 per repository; cold index vs. cached warm query):

Metric Min Median Max Condition
Caller-file recall 1.000 1.000 1.000 Static graph (n = 3 runs/task)
Confirmed caller precision (direct / via-import) 1.000 1.000 1.000 Static graph (n = 3 runs/task)
Test-file recall 1.000 1.000 1.000 Static graph (n = 3 runs/task)
Cold query latency (index + 3 tools) 748.0 ms 1204.0 ms 1889.0 ms Cleared .blastradius/ per run (includes git ls-files)
Warm query latency (cached + 3 tools) 302.2 ms 391.5 ms 624.4 ms Cached .blastradius/ + in-memory graph
Tool payload / full caller files ratio 0.071 0.207 0.600 Bounded JSON vs. reading caller files in full

Full-Stack FastAPI + Next.js Evaluation (8 tasks, fullstack_rbac_repo, n = 3 runs per task, Windows)

Evaluated on the 26-file cross-stack monorepo synthetic fixture built for this tool (tests/fixtures/fullstack_rbac_repo) covering nested FastAPI APIRouter prefixes, Depends closures (require_role), Pydantic DTOs, axios.create baseURL HTTP contracts (api_contract), and Next.js App Router / JSX props, comparing BlastRadius v1.1.1 against a naive identifier grep baseline:

Metric BlastRadius v1.1.1 (Median / Mean) Naive Lexical Grep Baseline (Median / Mean)
Caller-file recall 1.000 / 1.000 0.333 / 0.299
Caller-file precision 0.938 / 0.921 1.000 / 0.750
Caller F1 0.967 / 0.957 0.500 / 0.421
Test-file recall 1.000 / 1.000 —
Cold / Warm query latency 369.8 ms / 171.5 ms (median) · 373.1 ms / 169.5 ms (mean) —

MCP schema overhead measured live from mcp._tool_manager.list_tools() (ceil(chars / 3.8)): 3,663 chars (964 est. tokens across 5 tools) vs. v0.5.0 baseline 5,040 chars (1,327 est. tokens across 9 tools), saving 363 estimated tokens (-27.35%).

Local Git Commit Replay Evaluation (9 code-only multi-file commits from early blastradius history, n = 1 run/commit, Windows)

Replayed across 9 pinned historical multi-file code commits from this repository's own early history (git_replay_commits.json; git archive read-only parent snapshots; highest parent-caller modified symbol targeted per commit):

Metric BlastRadius v1.1.1 v1_graph (Median / Mean) BlastRadius v1.1.1 ast_routed (Median / Mean) Naive Lexical Grep Baseline (Median / Mean)
Caller recall 0.444 / 0.462 0.286 / 0.415 0.000 / 0.101
Test-file recall 1.000 / 0.704 1.000 / 0.704 0.333 / 0.482
Caller precision 0.200 / 0.259 0.200 / 0.328 0.000 / 0.137
Caller F1 0.333 / 0.300 0.333 / 0.294 0.000 / 0.116

On commit 42bf481693 (@dataclass FileFacts additive field expansion, actual_change = "dataclass_schema_additive"), v1_graph scores Precision 0.3846 / Recall 0.7143 / F1 0.5000 / Test Recall 1.0000, whereas ast_routed (evaluating non-test code callers separately from preserved test_files) scores Precision 1.0000 / Recall 0.2857 / F1 0.4444 / Test Recall 1.0000. This illustrates the precision/recall trade-off of additive_compatible pruning on hub dataclasses: narrowing affected removes passive type-annotation false positives (0.3846 → 1.0000 code precision) while keeping mapped test_files intact (1.0000 test recall), at the cost of lower caller recall when downstream modules still adapt to the new optional fields. Milestone feature commits in a small library often create or update independent modules alongside a core change, capping single-symbol static F1 (0.333 median / 0.300 mean); historical co_change_files complements static traversal once multi-file commits accumulate. On git-replay, precision (0.200 median / 0.259 mean) is lower than recall (0.444 median / 0.462 mean) likely because static analysis is an over-approximation: it reports name-match-only candidates, transitive dependents, and cross-stack HTTP contracts that may not actually change in a given commit (false positives), while its transitive reach catches most truly-affected files (higher recall).

Live Agent A/B Harness

benchmarks/run.py also provides --mode agent to compare without_tools vs. with_tools end-to-end using codex exec. Full live A/B results are not yet published because local codex exec runs hit the machine's usage cap during Phase 4; no unmeasured turn or token savings are claimed here. Users with an available codex CLI quota can run the agent A/B harness against the synthetic full-stack fixture with --suite fullstack --mode agent.

Reproduce locally:

# Static evaluation across all 18 Python tasks
python benchmarks/run.py --mode static --runs 3

# Static evaluation across all 8 TypeScript tasks
python benchmarks/run.py --suite typescript --mode static --runs 3

# Static evaluation across the 8 full-stack RBAC tasks (zero network required)
python benchmarks/run.py --suite fullstack --mode static --runs 3

# Read-only historical commit replay on the local git repo
python benchmarks/run.py --mode git-replay --runs 1 --max-commits 15

License

MIT — see LICENSE.

Metadata

Release files for blastradius-skill 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blastradius-skill 1.1.1
File Size Uploaded Provenance Actions
blastradius_skill-1.1.1.tar.gz 271.7 kB With provenance Details for blastradius_skill-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blastradius-skill 1.1.1
File Interpreter ABI Platform Actions
blastradius_skill-1.1.1-py3-none-any.whl Python 3 none any Details for blastradius_skill-1.1.1-py3-none-any.whl

Total release size: 442.2 kB

Release files / blastradius_skill-1.1.1.tar.gz

Download URL blastradius_skill-1.1.1.tar.gz
Size 271.7 kB
Tags Source
SHA-256 checksum
How to use checksums
08ccebad5d342c483b1930fc31cc979fdbc9397431a72c178eb7b555a4436302
BLAKE2b-256 checksum
How to use checksums
232cee62173621419ef872be553674fe4b8f7395e172ff87ac862358219d1583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / blastradius_skill-1.1.1-py3-none-any.whl

Download URL blastradius_skill-1.1.1-py3-none-any.whl
Size 170.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a07d69213f14ef6eed454b19839431f28dfd9ce2e06af097b109d9f34fa74c2
BLAKE2b-256 checksum
How to use checksums
1cdb14daaf4e1e62c04fab255d2dddaa961b9b520f69dce530a04582b829a8d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for blastradius-skill 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for blastradius_skill-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page