โโโโโโโ โโโโโโโ โโโโโโโโโโโโโโโ โโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโ โโโ โโโโโโโโโโโโโโโโโ โโโ โโโ
โโโ โโโ โโโโโโโโโโโโโโโโโ โโโ
๐ Topological Blast Radius & Invariant Radar for AI-Generated Code
Know what the AI just broke across your entire repository before you commit.
The Problem โข Key Highlights โข Quick Start โข Terminal UI โข Visual DAG Diagrams โข CLI Commands โข Agent Loop Mode โข CI / CD Enforcement โข Architecture
๐ฅ The Problem
In the era of vibe coding and autonomous AI agents (Cursor, Claude Code, Copilot, Cline, Aider), AI writes code at 1,000 WPM.
However, LLMs suffer from severe tunnel vision:
- An AI refactors
authenticate_user(user_id, token, tenant_id=None)to requireorg_idas a second parameter. - Or an AI converts
fetch_user_profile()to anasync deffunction, forgetting to update 15 caller sites withawait. - The AI runs its isolated unit test in
test_auth.py, reports "Refactoring complete!", and stops. - Downstream in
billing/webhook.py,api/v1/sessions.py, andworkers/sync.ts, 12 callers are now silently broken with:TypeError: authenticate_user() missing 1 required positional argument: 'org_id' RuntimeWarning: coroutine 'fetch_user_profile' was never awaited
Traditional typecheckers (mypy, tsc) require strict types everywhere or take seconds to recompile your whole project. Unit tests only catch downstream breakage if you already wrote tests for every transitive caller.
prism is a zero-latency topological radar. It scans your uncommitted git diff (git diff HEAD) or branch diff, builds an in-memory dependency graph, traces the ripple shockwave up to N hops deep, audits contract invariants and async boundaries on callers, visualizes blast graphs, and auto-patches broken callsitesโall in <50ms.
โก Key Highlights
- ๐ Topological Ripple Shockwave: Computes the multi-hop transitive caller tree of every symbol touched in your git working tree.
- โก Async & Coroutine Invariant Radar: Flags unawaited coroutines (
CRITICAL) and awaiting synchronous functions (HIGH) across Python and TypeScript/JavaScript. - ๐ก๏ธ Advanced Contract Invariant Checking: Flags missing required arguments, excess positional parameters, unexpected keyword arguments, positional-only violations (
/), duplicate bindings, and dataclass signatures across Python 3.8โ3.12 and TypeScript/JavaScript. - ๐บ๏ธ Visual Blast Diagrams (Mermaid.js & Graphviz DOT): Generates interactive Mermaid.js flowcharts and DOT graphs of the blast radius with color-coded risk highlighting.
- ๐ฉน Automated Call-Site Auto-Patching (
prism fix): Synthesizes surgical unified diffs or directly applies fixes to callers (e.g. insertingawait) with zero manual effort. - ๐ Live Vibe-Coding Watcher (
prism watch): Sub-second filesystem daemon monitoring working tree changes in real time as AI edits your code. - ๐งช Intelligent Test Impact Radar: Pinpoints exact test files and test functions that directly or transitively cover modified code, flags untested modified symbols, and runs only affected tests with one command.
- ๐ค Agent Remediation Prompt Generator (
prism explain): Synthesizes high-density, zero-hallucination prompt context and exact code fixes for autonomous coding agents (Claude Code, Cursor, Copilot, Aider, Devin). - ๐ Multi-Format Enterprise Reporting: Emits Rich terminal UI, machine-readable JSON, GitHub Flavored Markdown (
$GITHUB_STEP_SUMMARY), Mermaid, DOT, or SARIF 2.1.0 for GitHub Code Scanning inline PR annotations. - ๐ Revision & CI Diffing: Analyze uncommitted changes, staged changes (
--staged), commits (--commit), or base branches (--base origin/main). - โก Sub-50ms Zero-Config Engine: Pure AST visitor with zero heavy daemon overhead. Runs instantaneously on commit hooks.
๐ป Terminal UI
When you run prism scan after an AI edits your code:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ____ ____ ___ ____ __ __ โ
โ | _ \| _ \|_ _/ ___|| \/ | โ
โ | |_) | |_) || |\___ \| |\/| | โ
โ | __/| _ < | | ___) | | | | โ
โ |_| |_| \_\___|____/|_| |_| โ
โ ๐ Topological Blast Radius & Invariant Radar โข Zero Bloat โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก Topological Ripple Shockwave:
๐ MODIFIED: calculate_tax (tax.py:12)
> def calculate_tax(amount, rate, jurisdiction)
โโโ โ ๏ธ BROKEN CONTRACT order_service.py::process_checkout (order_service.py:45)
โ > Missing 1 required argument(s): 'jurisdiction'.
โ โโโ [L2 Transitive] checkout_worker.py::run_job (checkout_worker.py:18)
โโโ [๐งช Test Caller] tests/test_orders.py::test_tax_calculation (tests/test_orders.py:22)
โโโ โ ๏ธ BROKEN CONTRACT api/v2/orders.py::handle_post (api/v2/orders.py:89)
> Missing 1 required argument(s): 'jurisdiction'.
๐จ Contract Violations & Signature Mismatches (2)
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Sev โ Caller Location โ Contract Violation Reason โ Suggested Fix โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ CRITICAL โ order_service.py:45 โ Missing 1 required arg... โ Pass 'jurisdiction' parameter โ
โ CRITICAL โ api/v2/orders.py:89 โ Missing 1 required arg... โ Pass 'jurisdiction' parameter โ
โโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐งช TEST IMPACT RADAR โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โข Impacted Test Files: 1 โ
โ โข Impacted Test Cases: 1 โ
โ โข Recommended Run: pytest tests/test_orders.py โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ ๐ TOPOLOGICAL BLAST RADAR TELEMETRY โโโโโโโโโโโโโโโโโโโโโ
โ Blast Impact Score: 85/100 [CRITICAL] โ
โ Assessment: ๐จ CRITICAL (Broken Contracts Detected) โ
โ โข Modified Symbols: 1 โข Direct Callers: 2 โข Transitive: 1 โ
โ โข Broken Contracts: 2 โข Impacted Tests: 1 โ
โ Analyzed 24 files in 0.038s. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐บ๏ธ Visual Blast Diagrams
Export topological DAG diagrams directly into Mermaid.js or Graphviz DOT format:
prism visual --format mermaid
graph TD
N0["MODIFIED: calculate_tax<br/>tax.py:12"]:::modified
N1["process_checkout<br/>order_service.py:45"]:::violation
N2["handle_post<br/>api/v2/orders.py:89"]:::violation
N3["test_tax_calculation<br/>tests/test_orders.py:22"]:::test
N0 --> N1
N0 --> N2
N0 --> N3
classDef modified fill:#ff4444,stroke:#333,stroke-width:2px,color:#fff;
classDef violation fill:#ffaa00,stroke:#333,stroke-width:2px,color:#000;
classDef test fill:#00cc88,stroke:#333,stroke-width:1px,color:#000;
๐ Quick Start
Installation
Install directly via pip:
pip install prism-radar
Or run via pipx / uv:
pipx install prism-radar
# or
uv tool install prism-radar
๐ ๏ธ CLI Commands
1. prism scan (Core Blast & Contract Radar)
Scan your current git working tree (unstaged + staged changes):
prism scan
Scan against a base branch (e.g. in PRs or feature branches):
prism scan --base origin/main
Scan staged changes only:
prism scan --staged
Run in strict mode (fails with exit code 1 if broken contracts or high risk are found):
prism scan --strict
Export results as Mermaid.js or Graphviz DOT:
prism scan --format mermaid
prism scan --format dot
Export results as SARIF 2.1.0 for GitHub Code Scanning:
prism scan --format sarif -o results.sarif
Export results as GitHub Flavored Markdown for PR comments:
prism scan --format markdown
2. prism visual (Interactive DAG Diagram Generator)
Generate visual diagrams of the blast shockwave:
# Print Mermaid diagram
prism visual --format mermaid
# Save Graphviz DOT diagram to file
prism visual --format dot -o blast-graph.dot
3. prism fix (Automated Call-site Auto-Patching)
Inspect proposed caller fixes for broken contracts (unawaited coroutines, missing arguments):
prism fix
Save unified diff patch to a file:
prism fix --patch fix.patch
Automatically apply fixes directly into caller source files:
prism fix --apply
4. prism watch (Real-Time Vibe-Coding Radar)
Run a continuous live watcher daemon that re-scans the repository as AI edits code:
prism watch
prism watch --interval 0.5
5. prism hook install (Git Pre-Commit Hook)
Install an instant native Git pre-commit hook into .git/hooks/pre-commit:
prism hook install
6. prism ci init (GitHub Actions CI Setup)
Bootstrap a ready-to-run GitHub Actions CI workflow at .github/workflows/prism-radar.yml:
prism ci init
7. prism test-impact (Smart Test Selection)
Identify exactly which tests are impacted by your current changes and find coverage gaps:
prism test-impact
Automatically execute only the impacted tests:
prism test-impact --run
8. prism explain (AI Agent Self-Healing Context)
Generate high-density diagnostic context and remediation instructions ready to pipe into an AI coding agent:
prism explain
9. prism init (Project Configuration)
Initialize a prism.toml file with sensible defaults:
prism init
๐ค Agent / LLM Loop Mode
If you run autonomous coding loops (Claude Code, Cursor Agent, Copilot Workspace, Aider, Devin), use prism as your invariant guardrail:
# Provide structured context to agent when contracts break
prism explain | your-agent-fixer
# Or auto-apply deterministic callsite fixes
prism fix --apply
Or pipe structured JSON:
prism scan --json | your-agent-fixer
Sample JSON output:
{
"impact_score": 85,
"risk_level": "CRITICAL",
"metrics": {
"modified_symbols": 1,
"direct_callers": 2,
"transitive_callers": 1,
"total_affected_files": 4,
"contract_violations": 2
},
"violations": [
{
"callee_name": "fetch_user",
"caller_file": "order_service.py",
"caller_line": 45,
"severity": "CRITICAL",
"reason": "Unawaited coroutine call: 'fetch_user' is an async function but called synchronously without await",
"snippet": "fetch_user(order.user_id)",
"suggested_fix": "Add 'await' prefix to coroutine invocation: await fetch_user(order.user_id)"
}
],
"test_impact": {
"impacted_test_files": ["tests/test_orders.py"],
"impacted_test_cases": ["tests/test_orders.py::test_user_fetch"],
"recommended_command": "pytest tests/test_orders.py"
}
}
๐ก๏ธ CI & GitHub Actions Enforcement
One-Command Setup
prism ci init
This generates .github/workflows/prism-radar.yml:
name: PRISM Blast Radius Radar
on:
pull_request:
branches: [main, master]
push:
branches: [main, master]
jobs:
prism-radar:
name: Blast Radius & Contract Radar
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install PRISM
run: |
pip install git+https://github.com/shenald-dev/prism.git
- name: Run PRISM Blast Radius Radar
run: |
prism scan --base origin/main --format sarif --output prism.sarif --format markdown > prism-summary.md
cat prism-summary.md >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: prism.sarif
category: prism-radar
โ๏ธ Configuration (prism.toml)
Customize PRISM's analysis behavior with an optional prism.toml or pyproject.toml:
[prism]
max_depth = 6
strict = false
fail_on = "CRITICAL" # "CRITICAL", "ELEVATED", "MODERATE", or "ANY"
ignore_symbols = ["__repr__", "__str__", "__init__"]
include_tests = true
default_format = "terminal" # "terminal", "json", "sarif", "markdown", "mermaid", "dot"
โ๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Git Diff Workspace โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ (modified line spans)
โผ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Python AST โโโโโถโ Symbol Extraction โโโโโโ JS / TS Lexer โ
โ Visitor Engine โ โ & Parameter Schema โ โ Parser Engine โ
โโโโโโโโโโฌโโโโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ Import Visitor โโโโโถโ Topological Graph โโโโโโ Test Impact Radarโ
โ Alias Resolver โ โ Transitive Callers โ โ Coverage Gaps โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Contract Invariant โ
โ & Async Auditor โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
[Rich Terminal Radar] [Visual Mermaid / DOT] [Auto-Patch Remediation]
- Diff Intersector:
git diffcomputes precise line ranges for uncommitted, staged, commit, or branch diffs. - AST Symbol Extractor: Full structural AST visitor captures functions, methods, async status, classes, dataclasses, positional-only, keyword-only, variadic, and default parameters.
- Import Resolver: Resolves imported modules and aliases to eliminate cross-module name collisions.
- Topological Graph: Computes the directed acyclic graph (DAG) of callers with cycle detection and centrality scoring.
- Contract Invariant & Async Auditor: Verifies parameter counts, keyword alignment, positional-only rules, unawaited coroutines, and invalid awaits.
- Visual & Auto-Patch Engines: Renders Mermaid/DOT DAGs and synthesizes surgical call-site fixes.
๐ค Contributing
Contributions are welcome! Please open an issue or PR on GitHub.
git clone https://github.com/shenald-dev/prism.git
cd prism
pip install -e ".[dev]"
pytest
ruff check .
๐ License
MIT License. Designed and built with โค๏ธ by shenald-dev.
Metadata
Release files for prism-radar 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prism_radar-2.0.0.tar.gz | 58.2 kB | Without provenance | Details for prism_radar-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prism_radar-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for prism_radar-2.0.0-py3-none-any.whl |
Total release size: 103.4 kB
Release files / prism_radar-2.0.0.tar.gz
| Download URL | prism_radar-2.0.0.tar.gz |
|---|---|
| Size | 58.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1526afb3e3411ae6dd4363800929f5f703c39c6b9adada15c1e83a2b9299839
|
|
BLAKE2b-256 checksum How to use checksums |
ab2ad3261e8a0b5343d6d2d556b910eee5f1f92ce78f1cac39971bad7761289e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / prism_radar-2.0.0-py3-none-any.whl
| Download URL | prism_radar-2.0.0-py3-none-any.whl |
|---|---|
| Size | 45.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ac416e3e3c020230c4ab85c7a842dcbc7d9096291e53aa21120d52850b7c11b
|
|
BLAKE2b-256 checksum How to use checksums |
bc6349aa5dba02be2f745474a529bfe76237c20d998ded3bc9579c5b23502718
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Security for prism-radar 2.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.