{"slug": "wt-radar-real-time-git-worktree-collision-radar-rust-tree-sitter-mcp", "title": "Wt-radar: Real-time Git worktree collision radar (Rust, Tree-sitter, MCP)", "summary": "An open-source Rust tool called wt-radar, released by developer rxxusp, detects collisions between parallel AI coding agents and teammates working in linked Git worktrees before a commit lands, flagging overlapping functions, hunks, lockfiles and database migrations across four severity tiers. In a benchmark on a 100,000-file monorepo with 20 active worktrees, wt-radar measured 0.025 ms p50 incremental collision detection latency against a 50 ms budget and 12.28 MB resident memory against a 30 MB budget, using pure-Rust gix, native filesystem watchers and embedded Tree-sitter parsers. The tool ships as a CLI, TUI, daemon and native MCP server, plus an optional coordination hub (wt-radar-hub), and is installable via Homebrew, Cargo, Winget or container images tagged 1.0.0.", "body_md": "**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`.**\n\n`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.\n\nRendered 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)).\n\n``` bash\nacme-billing (cursor) $ wt-radar status\nwt-radar status | repo: c9abac72d811 | worktrees: 3 | collisions: 3 | scan: 38ms | rss: 15.0 MB\n\nCOLLISIONS\n+----------+-------------+-----------------+----------------------------+---------------------------------+\n| SEVERITY | TIER        | WORKTREES       | FILE                       | LINES / SYMBOLS                 |\n+----------+-------------+-----------------+----------------------------+---------------------------------+\n| BLOCK    | T4:Critical | cursor ↔ claude | db/migrations/001_init.sql | L5 | rule:builtin:migration:dir |\n| WARN     | T3:AST      | cursor ↔ claude | src/billing.ts             | L12-13 | 2 sym(s)               |\n| WARN     | T2:Hunk     | cursor ↔ claude | config/routes.txt          | L4-5                            |\n+----------+-------------+-----------------+----------------------------+---------------------------------+\n\nacme-billing (cursor) $ mcp-call check_collision '{\"file_path\":\"db/migrations/001_init.sql\"}' | jq '{action, critical_rule_id}'\n{\n  \"action\": \"block\",\n  \"critical_rule_id\": \"builtin:migration:dir\"\n}\n```\n\nRendered from [`docs/vhs/tui-demo.tape`](https://github.com/rxxusp/wt-radar/blob/main/docs/vhs/tui-demo.tape).\n\nPick your preferred one-line installer (ships both `wt-radar` and `wt-radar-hub`):\n\n```\n# macOS / Linux (Homebrew)\nbrew install rxxusp/tap/wt-radar\n\n# macOS / Linux (Shell installer via cargo-dist)\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/rxxusp/wt-radar/releases/latest/download/wt-radar-cli-installer.sh | sh\n\n# Cargo (Rust 1.96+)\ncargo install wt-radar-cli wt-radar-hub\n\n# Windows (PowerShell / Winget)\nwinget install wt-radar.wt-radar\n# or: irm https://github.com/rxxusp/wt-radar/releases/latest/download/wt-radar-cli-installer.ps1 | iex\n\n# Container Images (multi-arch linux/amd64 & linux/arm64, distroless nonroot)\ndocker pull ghcr.io/rxxusp/wt-radar-hub:1.0.0\ndocker pull ghcr.io/rxxusp/wt-radar:1.0.0\n```\n\nInitialize Policy-as-Code and inspect your repository in seconds:\n\n```\nwt-radar init              # creates .wtradar.toml\nwt-radar status            # 4-tier collision scan across all linked worktrees\nwt-radar watch             # start background daemon + local IPC socket\nwt-radar tui               # open live interactive dashboard\n```\n\n`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.\n\n| Benchmark Metric (100,000-File Monorepo, 20 Active Worktrees) | Engineering Budget | Measured ( `wt-radar-core/FourTierDetector` , macOS/aarch64) | Status | \n|---|---|---|---|\n| Incremental collision detection latency (p50 / p95 / p99) | `< 50.0 ms` | `0.025 ms` /`0.026 ms` /`0.026 ms` | PASS | \n| Live process memory footprint (100k index + 20 worktrees RSS) | `< 30.0 MB` | `12.28 MB` (`3.81 MB` compact index heap) | PASS | \n| 100k-file monorepo index build time | — | `29.44 ms` | INFO | \n| 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 | \n\nReproduce locally at any time:\n\n```\ncargo run --release -p wt-radar-bench -- --files 100000 --assert-budgets\n```\n\nSpin 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:\n\n```\ndocker compose -f deploy/docker-compose.yml up -d\n```\n\nServices exposed locally:\n\n| Service | Endpoint | Purpose | \n|---|---|---|\n| **`wt-radar-hub` gRPC** | `localhost:50051` | Bidirectional `HubSyncService` (`StreamSync` ,`Heartbeat` ,`GetClusterState` ,`CheckHealth` ) | \n| **`wt-radar-hub` HTTP** | `http://localhost:9090/metrics` | Prometheus metrics, `/healthz` ,`/readyz` , and`/api/v1/cluster` | \n| **Prometheus** | `http://localhost:9091` | Scrapes `wt-radar-hub:9090/metrics` | \n| **Grafana** | `http://localhost:3000` | Prebuilt **wt-radar Hub** dashboard (active worktrees, collisions by tier, sync latency, leases) | \n\nPoint any local daemon at the hub with your shared team salt:\n\n```\nexport WT_RADAR_SALT=\"replace-with-team-256bit-secret\"\nwt-radar watch --hub http://localhost:50051\n```\n\nStop and clean up with `docker compose -f deploy/docker-compose.yml down -v`.\n\nEvery edit across local linked worktrees—or synced remote worktrees—is evaluated through four progressively deeper tiers:\n\n| Tier | Name | Default Severity | What It Catches | \n|---|---|---|---|\n| **Tier 1** | `tier1_path` | `info` | Same normalized file path ( `path_hash` ) modified, renamed, or deleted across two worktrees. | \n| **Tier 2** | `tier2_hunk` | `warn` | Overlapping or nearby diff line hunks ( `hunk_proximity_lines = 5` by default) computed against merge-base. | \n| **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. | \n| **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]]` . | \n\n`wt-radar-hub` **never receives, inspects, or stores your source code, file paths, branch names, or symbol names**.\n\n- 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` .\n- Protobuf conversion (`wt-radar-proto` ) physically strips all plaintext local fields (`local_path` ,`local_branch` ,`local_root` ,`local_name` ) at the type boundary.\n- Ephemeral worktree leases expire automatically after `60s` (`lease_ttl_secs` ) without a`Heartbeat` , ensuring closed laptops and crashed containers never leave ghost conflicts.\n- Supports **mTLS** (`ca_cert_path` ,`client_cert_path` ,`client_key_path` ),**OIDC/JWT** Bearer authentication, and**Air-Gapped** single-VPC deployments.\n\nSee [`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.\n\n`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`).\n\nExposed MCP tools:\n\n- `check_collision(file_path, line_start?, line_end?, worktree_id?)` — returns`allow | warn | block` with colliding worktrees and actionable agent guidance.\n- `list_worktrees()` — lists all active local and synced peer worktrees.\n- `list_collisions(min_severity?)` — queries active collisions filtered by severity.\n- `get_policy()` — inspects`.wtradar.toml` rules and critical asset globs.\n\n```\n{\n  \"mcpServers\": {\n    \"wt-radar\": {\n      \"command\": \"wt-radar\",\n      \"args\": [\"mcp\", \"--transport\", \"stdio\"]\n    }\n  }\n}\n```\n\nOr run Streamable HTTP for shared container/remote agent sandboxes:\n\n```\nwt-radar mcp --transport http --bind 127.0.0.1:3849\n```\n\nFull 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).\n\n| Profile | Scale | Storage & Pub/Sub | Auth & Network | Deployment Artifact | \n|---|---|---|---|---|\n| **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) | \n| **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) | \n| **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) | \n| **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) | \n\nSee [`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.\n\nCommit `.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:\n\n```\nversion = 1\n\n[severity]\ntier1_path = \"info\"\ntier2_hunk = \"warn\"\ntier3_ast_semantic = \"warn\"\ntier4_critical_asset = \"block\"\nhunk_proximity_lines = 5\n\n[critical_assets]\nenable_builtins = true\n\n[[critical_assets.protected_globs]]\nid = \"billing-migrations\"\npattern = \"db/migrations/**/*.sql\"\nseverity = \"block\"\nreason = \"Database migrations must be sequenced by one worktree at a time.\"\n\n[resources]\nmax_rss_mb = 30\nmax_cpu_percent = 1.0\n\n[hub]\nenabled = false\n# endpoint = \"https://wt-radar-hub.internal:50051\"\nlease_ttl_secs = 60\nheartbeat_interval_secs = 20\nsalt_env_var = \"WT_RADAR_SALT\"\n```\n\nComplete schema documentation: [`docs/policy-reference.md`](https://github.com/rxxusp/wt-radar/blob/main/docs/policy-reference.md).\n\n```\n[custom.wt_radar]\ncommand = \"wt-radar prompt --format starship --quiet-clean\"\nwhen = \"git rev-parse --is-inside-work-tree >/dev/null 2>&1\"\nformat = \"[$output]($style) \"\nstyle = \"bold yellow\"\nset -g status-right '#(wt-radar prompt --format tmux) | %H:%M '\n```\n\nDisplays `wt:3 ⚡1` when collisions are active (or `wt:3 ✓` when clean).\n\nBoth 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:\n\n- **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.\n- **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.\n\nGate pull requests and upload SARIF 2.1.0 collision alerts directly to GitHub Code Scanning using the bundled composite action (`action.yml`):\n\n```\n- name: Check active worktree collision risk\n  uses: rxxusp/wt-radar@v1\n  with:\n    fail-on-severity: block\n    upload-sarif: true\n```\n\nDual-licensed under either of:\n\n- **Apache License, Version 2.0** ([`LICENSE-APACHE`](https://github.com/rxxusp/wt-radar/blob/main/LICENSE-APACHE) )\n- **MIT License** ([`LICENSE-MIT`](https://github.com/rxxusp/wt-radar/blob/main/LICENSE-MIT) )\n\nat your option.", "url": "https://wpnews.pro/news/wt-radar-real-time-git-worktree-collision-radar-rust-tree-sitter-mcp", "canonical_source": "https://github.com/rxxusp/wt-radar", "published_at": "2026-11-28 21:01:00+00:00", "updated_at": "2026-11-28 21:13:47.726079+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools", "agent-protocols"], "entities": ["wt-radar", "wt-radar-hub", "rxxusp", "Rust", "Tree-sitter", "gix", "Homebrew", "GitHub"], "also_reported_by": [], "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.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/wt-radar-real-time-git-worktree-collision-radar-rust-tree-sitter-mcp", "markdown": "https://wpnews.pro/news/wt-radar-real-time-git-worktree-collision-radar-rust-tree-sitter-mcp.md", "text": "https://wpnews.pro/news/wt-radar-real-time-git-worktree-collision-radar-rust-tree-sitter-mcp.txt", "jsonld": "https://wpnews.pro/news/wt-radar-real-time-git-worktree-collision-radar-rust-tree-sitter-mcp.jsonld"}}