Phantom.js

FinOps ยท Dead-Code Exorcist

Phantom.js โ€” The Ghost Hunter

Paste a GitHub repo. The Hunter flags zombie code and vampire dependencies, the Skeptic tries to disprove every flag, a sandbox verifies the build still compiles, and Phantom opens a PR with projected cloud savings.

Try ./sample-repo (when on localhost) or any public repo URL. Read-only by default.

HAUNTED CALL GRAPH โ€” previewโ— aliveโ— uncertainโ— zombie
main()render()legacyUtil()formatCurrency()

Capabilities

๐ŸงŸ

AST Zombie Detection

Whole-repo, comment-aware AST reachability. The Hunter flags functions with zero static references โ€” not grep, so comments and substrings don't trigger false positives.

๐Ÿง›

Vampire Dependency FinOps

Dead code and bloated deps map to bundle size, cold starts, and build minutes โ€” turned into a projected $/mo cloud-savings line item on every PR.

๐Ÿ•ต๏ธ

Multi-Agent Skeptic Verification

A second agent tries to disprove every flag via dynamic imports, barrel re-exports, string reflection, and test usage โ€” eliminating false positives before they ship.

๐Ÿงช

Sandboxed Build Testing

Proposed removals are type-checked (tsc --noEmit) and test-run in an isolated sandbox (Docker/E2B) before approval. The agent self-corrects on compiler errors.

๐Ÿ”„

Continuous GitHub Haunting

A GitHub Action comments on every PR with AST evidence and bundle/compute impact before merge โ€” exorcisms run continuously, not just on demand.

๐Ÿ“Š

AI Cost Observability

Track LLM token spend vs. cloud savings against FOCUS billing exports. Every scan shows ROI: did the agent save more than it cost to run?

See every capability โ†’

How It Works

STAGE 1

The Summoning

Paste a repo URL or path. Phantom fetches the tree (GitHub tarball or local disk) into an in-memory RepoSource.

STAGE 2

The Hunt โ€” MCP + AST

An in-memory MCP server exposes read-only AST tools. The agent calls them to extract declarations and references โ€” never touching files directly.

STAGE 3

The Trial โ€” Skeptic + Sandbox

The Skeptic tries to disprove each flag; a sandbox type-checks proposed removals. No PR unless the build still compiles.

STAGE 4

The Exorcism โ€” Verified PR

Approved removals become a branch + PR with the FinOps delta and the full Chain-of-Thought, logged to Supabase for audit.

MCP decoupling

Reasoning and tool execution are separate. The model only sees a finite read-only tool surface.

Read-only by default

No write/exec tool exists. Mutation only via a human-approved PR โ€” fully reversible.

FOCUS billing

FinOps projections reconcile against FOCUS cost-and-usage exports, not guesses.

0% FP build guarantee

Sandbox + Skeptic mean no removal ships unless the build still compiles.

Phantom.js โ€” built for the Kiroween 2026 hackathon.