This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
I built Phantom Troupe, a command-line tool that treats every failed terminal command like a corpse that deserves an autopsy. When you mistype a command, fat-finger a flag, or hit a permission denied error, Phantom Troupe captures it, files it in a local morgue, and dispatches a small team of AI agents to figure out what killed it and how to bring it back.
The theme — Ghost in the Machine — is literal here. Your shell is haunted by every command that died mid-execution. Phantom Troupe makes those ghosts visible: the Coroner writes cause-of-death reports, the Interpreter explains what a command does and when it's dangerous, the Exorcist guards against destructive commands, the Medium inventories dead scripts, and the Understudy proposes resurrections. It's a séance for your terminal, running entirely on your machine with open-weight models.
It works offline. There's no cloud round-trip for every typo, no account to create, and nothing phones home unless you opt into crash telemetry. You can run it with Gemma 3 through Ollama locally, or point it at the Gemma API if you'd rather not run anything locally. It hooks into zsh, bash, and PowerShell so it catches failures the moment they happen, then keeps a graveyard of dead scripts, aliases, and scheduled tasks you can resurrect or retire later.
The idea came from watching how many commands fail and vanish without a trace. We mistype, we forget, we repeat the same mistake an hour later. Phantom Troupe makes those failures stick around long enough to learn from them.
Demo
The live site is at https://phantom-troupe.onrender.com/. It's a static landing page with a creepy horror theme — dark forests, roaming spirits, bats diving toward the viewer, a pockmarked moon, and a zombie hand clawing out of its grave. It walks through what the tool does, shows the architecture, and lets you try a browser-based simulation of the séance table.
The real tool runs locally on your machine. Install it with one command, and phantom graveyard opens a local UI at http://127.0.0.1:7313 where you can execute real commands and watch the troupe autopsy failures in real time. Failed commands trigger the Coroner automatically; dangerous commands are stopped by the Exorcist before they run; idle brains are released by the Reaper with a spirit ascending from the side of the screen.
Code
https://github.com/N-Garai/Phantom-Troupe
How I Built It
The backbone is a small fleet of specialist agents built with the Mastra framework. Each failure routes to the right agent: the Coroner writes cause-of-death reports, the Interpreter explains what a command does and when it's dangerous, the Exorcist guards against destructive commands, the Medium inventories dead scripts, and the Understudy proposes resurrections. Every response passes through an evaluator that scores it for confidence and safety before it reaches your screen.
For memory, it uses LibSQL to store long-term context about your graveyard, so the troupe remembers what died last week and what cured it. The shell hooks are native — zsh preexec/precmd, bash DEBUG traps, and PowerShell prompt hooks — so capture happens without you thinking about it. Nightly sweeps run through systemd on Linux, launchd on macOS, and schtasks on Windows.
Everything is local-first. If you use Ollama, the model never leaves your machine. If you prefer the Gemma API, you provide your own key and it's stored in your config file, not ours. Sentry telemetry is opt-in only — without a DSN, nothing is sent anywhere. When you do configure a DSN, agent invocations are traced with spans so latency, token cost, failures, and fallback routing are visible in Sentry's trace view.
This is grounded in research on how developers actually use the command line and where they stumble. Work like Fischer et al. on UNIX command use, Potdar and Shihab on developer debt patterns, and Luo et al. on failure recovery informed how we capture and categorize what goes wrong.
Why Does Open Innovation Matter?
Closed APIs turn every failed git push into a data point for someone else's model. Open weights and local inference flip that: your typos stay yours, your command history stays on your disk, and nobody builds a product from your mistakes without asking.
Open innovation made this possible because we could build on open frameworks, open models, and open standards without asking permission. It also means anyone can fork Phantom Troupe, add their own agents, or rewire the hooks for a shell we haven't touched yet. The graveyard format is plain text — you own the bones. And because it runs offline, it works with the lights — and the internet — off.
My Agent Session
The Spirit of It
Día de los Muertos is about the line between past and present feeling a little thinner — about remembering what's gone and keeping it close. That's the spirit of Phantom Troupe. Every failed command, every dead script, every alias that stopped working — they're not just errors. They're moments where something didn't go as expected, and they deserve to be remembered.
I built this because I was tired of watching my own mistakes vanish without a trace. You type the same wrong command three times and realize you've forgotten why it broke the first time. That frustration is a ghost haunting your shell. Phantom Troupe makes those ghosts visible, files them in a morgue, and lets you decide which ones to resurrect and which ones to lay to rest.
The loading screen plays like a rite — a dark forest, smoke everywhere, bats diving toward the screen, the name materializing from mist before dissolving back into it. Then the séance begins. It gives me chills every time, because it turns something ordinary — a typo at the command line — into something worth keeping.
Prize Categories
- Best Use of Render — the landing page and demo are hosted as a static site on Render
- Best Use of Mastra — the agent network, structured outputs, LibSQL memory, and séance workflow are built on Mastra
- Best Use of Sentry Agent Tracing — agent invocations are traced with spans in Sentry (opt-in), showing latency, token cost, failures, and fallback routing
- Best Use of Gemma — Gemma 3 runs locally through Ollama, with a Gemma API option for remote inference
Top comments (0)