Analyse git repos and produce FEARMAP.md — a plain-English map of dangerous files
Project description
fearmap
Analyse any git repository and produce FEARMAP.md — a plain-English map of which files are dangerous to change, what breaks if you touch them, and what the original developer intended.
fearmap does one thing: it turns git history into understanding.
Example output
## Load-bearing files — do not touch without a plan
| File | Heat | Coupling Partners | Confidence |
|------|------|-------------------|------------|
| `src/flask/app.py` | 90/100 | ctx.py, templating.py, sessions.py, ... | HIGH |
### `src/flask/app.py`
**Intent:** The Flask class — the WSGI application object every Flask app instantiates.
Extends sansio/app.py with the I/O layer: request context push/pop, full WSGI dispatch loop.
**Danger:** The __init_subclass__ hook silently wraps overridden methods to add or strip
the AppContext argument. A method that matches neither old nor new signature will get a
deprecation warning and may behave unexpectedly.
**Ripple:** Changes to wsgi_app or full_dispatch_request break every request the framework
handles. Changes to default_config break any app relying on implicit config defaults.
Use inside Claude Code (recommended)
No pip install. No API key. No Python. Just type /fearmap inside a Claude Code session.
# Install once per repo
mkdir -p .claude/commands
curl -o .claude/commands/fearmap.md https://raw.githubusercontent.com/LalwaniPalash/fearmap/main/slash-command/fearmap.md
# Or install globally (works in all your repos)
mkdir -p ~/.claude/agents
curl -o ~/.claude/agents/fearmap.md https://raw.githubusercontent.com/LalwaniPalash/fearmap/main/agent/fearmap.md
Then open Claude Code and type:
/fearmap # analyse entire repo
/fearmap src/ # scope to a directory (great for monorepos)
Claude Code mines your git history, reads your dangerous files, and writes FEARMAP.md directly. No external API calls — Claude Code is the reasoning engine.
See slash-command/README.md and agent/README.md for details.
Use as a CLI tool
For automation, CI, or when you prefer a terminal workflow:
pip install fearmap
⚠ fearmap sends file contents to the Claude API. Use
--localmode if your code cannot leave your machine.
Setup
export ANTHROPIC_API_KEY=your_key_here
Commands
# Analyse current repo (asks for confirmation before API calls)
fearmap run
# With options
fearmap run --scope ./src --budget 1.50 --output FEARMAP.md --yes
# Local mode — no Claude calls, metrics only (no API key needed)
fearmap run --local
# Preview — show what would be analysed and estimated cost, don't run
fearmap preview
# Deep-dive on a single file
fearmap explain path/to/file.py
# Show coupling partners for a file
fearmap couples path/to/file.py
# Validate your fearmap.toml
fearmap config check
What you get
FEARMAP.md contains:
- Onboarding path — the 7 best files to read if you're new to the codebase
- Load-bearing files — files that must not be touched without a plan, with intent/danger/ripple analysis
- Risky files — files that need careful handling
- Dead files — candidates for removal (with a warning to verify no external callers)
- Safe files — the ones you can change with confidence
- Coupling map — which files always change together and why
Classifications
| Classification | Meaning |
|---|---|
LOAD-BEARING |
Heat ≥ 70 AND 3+ coupling partners. If this breaks, a lot breaks. |
RISKY |
Heat ≥ 40 OR 2+ coupling partners. Change with care. |
DEAD |
No changes in 18+ months, no callers detected. Probably removable. |
SAFE |
Everything else. Change freely. |
Heat score formula
heat = churn × 0.40 + coupling × 0.35 + authors × 0.15 + size × 0.10
All components are min-max normalised across the repo, giving a 0–100 score.
Configuration
fearmap.toml
[fearmap]
months = 12 # git history window
budget = 2.00 # max API spend per run (CLI only)
model = "claude-sonnet-4-20250514"
output = "FEARMAP.md"
scope = "." # great for monorepos: set to "src/myservice"
[thresholds]
load_bearing_heat = 70
load_bearing_coupling = 3
risky_heat = 40
dead_months = 18
fearmap searches for fearmap.toml starting at the current directory and walking up to the git root. This lets monorepos have per-service configs.
.fearmapignore
**/generated/**
**/migrations/**
**/*.lock
Why fearmap, not [existing tool]?
| Tool | What it does | What it lacks |
|---|---|---|
| CodeScene | Churn metrics, coupling charts | Paid, cloud, no plain-English explanations |
| code-maat | Same methodology | Requires JVM, no explanations |
| wily | Python complexity trends | Python only, no coupling, no explanations |
| GitStats | Commit statistics | No per-file danger analysis |
fearmap is the only tool that reads your actual code and explains, in plain English, why a file is dangerous and what will break if you touch it.
Privacy
The CLI (fearmap run) sends file contents to the Anthropic API. Use --local mode if your code cannot leave your machine:
fearmap run --local
Local mode produces a metrics-only FEARMAP.md with classifications but no intent/danger explanations.
Mode 2 (Claude Code native) makes no external API calls beyond your normal Claude Code session.
Commit FEARMAP.md
FEARMAP.md is meant to be committed and versioned alongside your code. It's documentation, not a build artifact. It helps every engineer who clones your repo understand which files to fear.
Contributing
See docs/contributing.md.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fearmap-0.3.0.tar.gz.
File metadata
- Download URL: fearmap-0.3.0.tar.gz
- Upload date:
- Size: 69.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1a05659e2e698266894f919ab01e1f685a83e845c35e658fa60cb4fd97ee037
|
|
| MD5 |
e3fa091540cca1952f161888476d4c2e
|
|
| BLAKE2b-256 |
55262decb259fede9ab2cac519195662c0db223cdd6d1462b6a7f8087da1260a
|
File details
Details for the file fearmap-0.3.0-py3-none-any.whl.
File metadata
- Download URL: fearmap-0.3.0-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c0e6096b064dcbb72d618057238025bd964afb4a69bdd4c91c055def357afe7
|
|
| MD5 |
f5a717840a3e780e9156c9a7ed8bf6a4
|
|
| BLAKE2b-256 |
76326a35bbdac589d3e3f408ca85b64c870d69e750329fe1e1affd5977697276
|