# Wt-radar: Real-time Git worktree collision radar (Rust, Tree-sitter, MCP)

> Source: <https://github.com/rxxusp/wt-radar>
> Published: 2026-11-28 21:01:00+00:00

**Key takeaway:** wt-radar's MCP server exposes a check_collision tool that returns an action of "block" with critical_rule_id "builtin:migration:dir" when two worktrees touch the same migration file, letting coding agents halt before committing.

**Stop parallel AI coding agents and teammates in Git worktrees from silently colliding on the same functions, hunks, lockfiles, and database migrations—before anyone hits `git commit`.**

`wt-radar` is a lightweight, open-source Rust daemon, CLI, TUI, Native MCP Server, and optional zero-code coordination Hub (`wt-radar-hub`) that monitors all linked Git worktrees locally and across your engineering team in real time.

Rendered with [VHS](https://github.com/charmbracelet/vhs) from [`docs/vhs/mcp-collision-demo.tape`](https://github.com/rxxusp/wt-radar/blob/main/docs/vhs/mcp-collision-demo.tape) against the real `wt-radar` binary and its stdio MCP server (demo repo seeded by [`docs/vhs/setup-demo-repo.sh`](https://github.com/rxxusp/wt-radar/blob/main/docs/vhs/setup-demo-repo.sh)).

``` bash
acme-billing (cursor) $ wt-radar status
wt-radar status | repo: c9abac72d811 | worktrees: 3 | collisions: 3 | scan: 38ms | rss: 15.0 MB

COLLISIONS
+----------+-------------+-----------------+----------------------------+---------------------------------+
| SEVERITY | TIER        | WORKTREES       | FILE                       | LINES / SYMBOLS                 |
+----------+-------------+-----------------+----------------------------+---------------------------------+
| BLOCK    | T4:Critical | cursor ↔ claude | db/migrations/001_init.sql | L5 | rule:builtin:migration:dir |
| WARN     | T3:AST      | cursor ↔ claude | src/billing.ts             | L12-13 | 2 sym(s)               |
| WARN     | T2:Hunk     | cursor ↔ claude | config/routes.txt          | L4-5                            |
+----------+-------------+-----------------+----------------------------+---------------------------------+

acme-billing (cursor) $ mcp-call check_collision '{"file_path":"db/migrations/001_init.sql"}' | jq '{action, critical_rule_id}'
{
  "action": "block",
  "critical_rule_id": "builtin:migration:dir"
}
```

Rendered from [`docs/vhs/tui-demo.tape`](https://github.com/rxxusp/wt-radar/blob/main/docs/vhs/tui-demo.tape).

Pick your preferred one-line installer (ships both `wt-radar` and `wt-radar-hub`):

```
# macOS / Linux (Homebrew)
brew install rxxusp/tap/wt-radar

# macOS / Linux (Shell installer via cargo-dist)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rxxusp/wt-radar/releases/latest/download/wt-radar-cli-installer.sh | sh

# Cargo (Rust 1.96+)
cargo install wt-radar-cli wt-radar-hub

# Windows (PowerShell / Winget)
winget install wt-radar.wt-radar
# or: irm https://github.com/rxxusp/wt-radar/releases/latest/download/wt-radar-cli-installer.ps1 | iex

# Container Images (multi-arch linux/amd64 & linux/arm64, distroless nonroot)
docker pull ghcr.io/rxxusp/wt-radar-hub:1.0.0
docker pull ghcr.io/rxxusp/wt-radar:1.0.0
```

Initialize Policy-as-Code and inspect your repository in seconds:

```
wt-radar init              # creates .wtradar.toml
wt-radar status            # 4-tier collision scan across all linked worktrees
wt-radar watch             # start background daemon + local IPC socket
wt-radar tui               # open live interactive dashboard
```

`wt-radar` enforces hard local resource budgets (`< 30 MB` RSS, `< 1%` CPU, `< 50 ms` incremental check) using pure-Rust `gix` (no `git` CLI subprocesses), native OS filesystem watchers (`notify`) with adaptive burst shedding, and embedded Tree-sitter parsers.

| Benchmark Metric (100,000-File Monorepo, 20 Active Worktrees) | Engineering Budget | Measured ( `wt-radar-core/FourTierDetector` , macOS/aarch64) | Status | 
|---|---|---|---|
| Incremental collision detection latency (p50 / p95 / p99) | `< 50.0 ms` | `0.025 ms` /`0.026 ms` /`0.026 ms` | PASS | 
| Live process memory footprint (100k index + 20 worktrees RSS) | `< 30.0 MB` | `12.28 MB` (`3.81 MB` compact index heap) | PASS | 
| 100k-file monorepo index build time | — | `29.44 ms` | INFO | 
| 100k-path salted BLAKE3 hashing throughput (hex / raw) | `> 250k paths/sec` | `3,452,780 paths/s` (`28.96 ms` ) /`3,396,282 paths/s` | PASS | 

Reproduce locally at any time:

```
cargo run --release -p wt-radar-bench -- --files 100000 --assert-budgets
```

Spin up a zero-code `wt-radar-hub` coordination server with live Prometheus metrics and a pre-provisioned Grafana dashboard in under a minute—no external database required:

```
docker compose -f deploy/docker-compose.yml up -d
```

Services exposed locally:

| Service | Endpoint | Purpose | 
|---|---|---|
| **`wt-radar-hub` gRPC** | `localhost:50051` | Bidirectional `HubSyncService` (`StreamSync` ,`Heartbeat` ,`GetClusterState` ,`CheckHealth` ) | 
| **`wt-radar-hub` HTTP** | `http://localhost:9090/metrics` | Prometheus metrics, `/healthz` ,`/readyz` , and`/api/v1/cluster` | 
| **Prometheus** | `http://localhost:9091` | Scrapes `wt-radar-hub:9090/metrics` | 
| **Grafana** | `http://localhost:3000` | Prebuilt **wt-radar Hub** dashboard (active worktrees, collisions by tier, sync latency, leases) | 

Point any local daemon at the hub with your shared team salt:

```
export WT_RADAR_SALT="replace-with-team-256bit-secret"
wt-radar watch --hub http://localhost:50051
```

Stop and clean up with `docker compose -f deploy/docker-compose.yml down -v`.

Every edit across local linked worktrees—or synced remote worktrees—is evaluated through four progressively deeper tiers:

| Tier | Name | Default Severity | What It Catches | 
|---|---|---|---|
| **Tier 1** | `tier1_path` | `info` | Same normalized file path ( `path_hash` ) modified, renamed, or deleted across two worktrees. | 
| **Tier 2** | `tier2_hunk` | `warn` | Overlapping or nearby diff line hunks ( `hunk_proximity_lines = 5` by default) computed against merge-base. | 
| **Tier 3** | `tier3_ast_semantic` | `warn` | Tree-sitter AST collisions across TypeScript, JavaScript, Python, Rust, Go, Java, and C++—detecting when Worktree A alters a function/class/struct/interface signature or export that Worktree B is editing or calling. | 
| **Tier 4** | `tier4_critical_asset` | `block` | Concurrent mutations to high-blast-radius assets: 26 built-in rules for lockfiles ( `Cargo.lock` ,`package-lock.json` ,`pnpm-lock.yaml` ,`uv.lock` ,`go.sum` , etc.), DB migrations (`**/migrations/**` , Prisma, Alembic), IaC (`*.tf` , Helm, K8s, Dockerfiles), wire schemas (`*.proto` , OpenAPI, GraphQL), plus custom`[[critical_assets.protected_globs]]` . | 

`wt-radar-hub` **never receives, inspects, or stores your source code, file paths, branch names, or symbol names**.

- Before leaving your machine, `SaltedHasher` derives a 256-bit keyed BLAKE3 key from your organization salt (`WT_RADAR_SALT` , KDF context`"wt-radar v1 salted-hash key derivation"` ) and computes domain-separated 64-char hex digests for`repo_hash` ,`path_hash` ,`branch_hash` ,`symbol_hash` , and`signature_hash` .
- Protobuf conversion (`wt-radar-proto` ) physically strips all plaintext local fields (`local_path` ,`local_branch` ,`local_root` ,`local_name` ) at the type boundary.
- Ephemeral worktree leases expire automatically after `60s` (`lease_ttl_secs` ) without a`Heartbeat` , ensuring closed laptops and crashed containers never leave ghost conflicts.
- Supports **mTLS** (`ca_cert_path` ,`client_cert_path` ,`client_key_path` ),**OIDC/JWT** Bearer authentication, and**Air-Gapped** single-VPC deployments.

See [`docs/privacy-and-security.md`](https://github.com/rxxusp/wt-radar/blob/main/docs/privacy-and-security.md) for the full threat model and wire audit.

`wt-radar` ships a native Model Context Protocol server built on the official Rust `rmcp` SDK, supporting both **stdio** and **Streamable HTTP** (`--transport stdio|http --bind 127.0.0.1:3849`).

Exposed MCP tools:

- `check_collision(file_path, line_start?, line_end?, worktree_id?)` — returns`allow | warn | block` with colliding worktrees and actionable agent guidance.
- `list_worktrees()` — lists all active local and synced peer worktrees.
- `list_collisions(min_severity?)` — queries active collisions filtered by severity.
- `get_policy()` — inspects`.wtradar.toml` rules and critical asset globs.

```
{
  "mcpServers": {
    "wt-radar": {
      "command": "wt-radar",
      "args": ["mcp", "--transport", "stdio"]
    }
  }
}
```

Or run Streamable HTTP for shared container/remote agent sandboxes:

```
wt-radar mcp --transport http --bind 127.0.0.1:3849
```

Full agent setup guides and system-prompt guardrails live in [`docs/mcp-integration.md`](https://github.com/rxxusp/wt-radar/blob/main/docs/mcp-integration.md).

| Profile | Scale | Storage & Pub/Sub | Auth & Network | Deployment Artifact | 
|---|---|---|---|---|
| **Solo / Local** | 1 dev, N agents | Local in-memory + Unix socket / Named pipe | Local OS permissions ( `0600` ) | [`docs/systemd/wt-radar.service`](https://github.com/rxxusp/wt-radar/blob/main/docs/systemd/wt-radar.service) ,[`docs/launchd/dev.wtradar.daemon.plist`](https://github.com/rxxusp/wt-radar/blob/main/docs/launchd/dev.wtradar.daemon.plist) | 
| **Team Box** | 1–50 devs | Embedded SQLite (WAL) or in-memory | Optional mTLS / OIDC | [`deploy/docker-compose.yml`](https://github.com/rxxusp/wt-radar/blob/main/deploy/docker-compose.yml) | 
| **Enterprise Fleet** | 50–5,000+ devs | PostgreSQL + Valkey/Redis or NATS | mTLS + OIDC/JWKS + Multi-AZ HPA | [`deploy/helm/wt-radar-hub/`](https://github.com/rxxusp/wt-radar/blob/main/deploy/helm/wt-radar-hub) &[` deploy/docker-compose.fleet.yml`](https://github.com/rxxusp/wt-radar/blob/main/deploy/docker-compose.fleet.yml) | 
| **Air-Gapped / Regulated** | Any | Private registry + internal Postgres/Valkey | Mandatory internal PKI mTLS + deny-all egress `NetworkPolicy` | [`deploy/helm/wt-radar-hub/values-airgapped.yaml`](https://github.com/rxxusp/wt-radar/blob/main/deploy/helm/wt-radar-hub/values-airgapped.yaml) | 

See [`docs/deployment.md`](https://github.com/rxxusp/wt-radar/blob/main/docs/deployment.md) for production runbooks, webhooks (Slack, Discord, Mattermost), and OpenTelemetry/Prometheus observability.

Commit `.wtradar.toml` to your repository root to standardize severity thresholds, protected globs, watcher burst protection, AST languages, and Hub sync settings across humans, CI, and MCP agents:

```
version = 1

[severity]
tier1_path = "info"
tier2_hunk = "warn"
tier3_ast_semantic = "warn"
tier4_critical_asset = "block"
hunk_proximity_lines = 5

[critical_assets]
enable_builtins = true

[[critical_assets.protected_globs]]
id = "billing-migrations"
pattern = "db/migrations/**/*.sql"
severity = "block"
reason = "Database migrations must be sequenced by one worktree at a time."

[resources]
max_rss_mb = 30
max_cpu_percent = 1.0

[hub]
enabled = false
# endpoint = "https://wt-radar-hub.internal:50051"
lease_ttl_secs = 60
heartbeat_interval_secs = 20
salt_env_var = "WT_RADAR_SALT"
```

Complete schema documentation: [`docs/policy-reference.md`](https://github.com/rxxusp/wt-radar/blob/main/docs/policy-reference.md).

```
[custom.wt_radar]
command = "wt-radar prompt --format starship --quiet-clean"
when = "git rev-parse --is-inside-work-tree >/dev/null 2>&1"
format = "[$output]($style) "
style = "bold yellow"
set -g status-right '#(wt-radar prompt --format tmux) | %H:%M '
```

Displays `wt:3 ⚡1` when collisions are active (or `wt:3 ✓` when clean).

Both extensions connect directly to the local `wt-radar watch` daemon over NDJSON Unix domain sockets (`$XDG_RUNTIME_DIR/wt-radar.sock` / `$TMPDIR/wt-radar-<user>.sock`) or Windows named pipes (`\\.\pipe\wt-radar`) with zero heavy gRPC dependencies:

- **VS Code & Cursor** ([`extensions/vscode/`](https://github.com/rxxusp/wt-radar/blob/main/extensions/vscode) ): inline gutter badges (`info` /`warn` /`block` ), hover tooltips with colliding worktree/agent/lines, Problems panel diagnostics, and clickable`wt:N ⚡C` status bar QuickPick.
- **JetBrains IDEs** ([`extensions/jetbrains/`](https://github.com/rxxusp/wt-radar/blob/main/extensions/jetbrains) ): IntelliJ IDEA, RustRover, WebStorm, GoLand, and PyCharm (2024.2+) Kotlin plugin with line markers, status bar widget, and settings configurable.

Gate pull requests and upload SARIF 2.1.0 collision alerts directly to GitHub Code Scanning using the bundled composite action (`action.yml`):

```
- name: Check active worktree collision risk
  uses: rxxusp/wt-radar@v1
  with:
    fail-on-severity: block
    upload-sarif: true
```

Dual-licensed under either of:

- **Apache License, Version 2.0** ([`LICENSE-APACHE`](https://github.com/rxxusp/wt-radar/blob/main/LICENSE-APACHE) )
- **MIT License** ([`LICENSE-MIT`](https://github.com/rxxusp/wt-radar/blob/main/LICENSE-MIT) )

at your option.
