This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
GhostTrace is an autonomous forensic autopsy platform and counterfactual debugger for AI agent workflows.
The Problem: The "Ghost in the Machine"
In modern multi-agent systems, agents don't simply crash with neat stack traces. They fail silently:
- Hallucinating non-existent database columns or invalid tool arguments.
- Trapped in recursive API reasoning loops while burning through millions of tokens.
- Suffering subtle state drift and context overflow.
When an agent fails, developers are left sifting through megabytes of noisy, unformatted JSON telemetry logs at 2 AM. These elusive, silent failures are the true "Ghosts in the Machine".
GhostTrace solves this by ingesting raw agent telemetry, building deterministic causal dependency graphs, performing grounded counterfactual root-cause deduction with Google Gemma 2, and automatically synthesizing runnable Vitest regression suites with circuit-breaker assertions to guarantee that the phantom bug never returns to production.
Demo
- 🌐 Live Cloud Application (Render): https://ghosttrace-s26u.onrender.com/
- 🎥 Video Walkthrough:
Watch on YouTube: GhostTrace — Forensic Autopsy & Counterfactual Debugger for AI Agents
Key Live Features
- Interactive Trace Waterfall: Millisecond-precision timeline detailing token usage, tool latency, and exact error offsets.
- Causal Anomaly Engine: Real-time detection of infinite loops, unhandled tool errors, and context window saturation.
- Google Gemma 2 Hypothesis Card: Deterministic root-cause analysis with strict Event-ID grounding (
[evt_104],[evt_108]), completely eliminating hallucinated diagnoses. - Anti-Regression Vitest Synthesizer: One-click copy-pasteable TypeScript test suite verifying circuit breakers and schema resilience.
Code
diusazzad / ghosttrace
Evidence-backed forensic debugger and root cause analyzer for AI agents (Hacktoberfest 2026)
GhostTrace 🔍👻
Evidence-backed, deterministic forensic debugger and root cause analyzer for AI agents.
Built for the official DEV Challenge: Hacktoberfest 2026 Week 4 — "Ghost in the Machine".
🌐 Live Production Deployment: https://ghosttrace-s26u.onrender.com/
📸 Dashboard Overview
Figure: Interactive forensic dashboard featuring deterministic timeline reconstruction, causal anomaly detection, evidence-grounded Google Gemma 2 hypotheses, automated Vitest regression test generation, multi-tenant Auth0 login, and incident history persistence.
⚡ What is GhostTrace?
Modern AI agents are complex non-deterministic state machines. When agents fail—spinning in infinite tool loops, hallucinating invalid tool schema arguments, exceeding context windows, or corrupting session state—developers are left sifting through gigabytes of unstructured JSON telemetry.
GhostTrace is a developer-first forensic debugger that exorcises the "ghost in the machine". It ingests raw trace logs from any LLM agent framework (Mastra, LangChain, CrewAI, AutoGen, or custom runtimes), deterministically reconstructs a millisecond-precision waterfall timeline, detects causal anomalies, uses Google Gemma 2…
- GitHub Repository: https://github.com/diusazzad/ghosttrace
- Open-Source License: MIT
- Test Suite: 18 test files, 162 passing tests (100% pass rate) with zero TypeScript errors.
How I Built It
GhostTrace is engineered strictly around open-source AI and transparent agent architecture:
flowchart TD A[Raw Agent Telemetry / Sentry OTEL / JSON] --> B[Mastra Core Workflow Ingestion] B --> C[Stage 1: Deterministic Causal Graph & Loop Anomaly Detector] C --> D[Stage 2: Google Gemma 2 9B Counterfactual Inference Engine] D --> E[Stage 3: Evidence Grounding & Anti-Hallucination Guard] E --> F[Stage 4: Automated Vitest Regression Test Synthesis] F --> G[Interactive Next.js 16 Dark-Mode Forensic Dashboard] G --> H[Auth0 Tenant Isolation & MongoDB Atlas Persistence] - Workflow Orchestration (Mastra Core v1.80.0): A resilient 4-stage pipeline orchestrating telemetry parsing, structural failure detection, graph topology construction, and automated test synthesis.
- Open-Weight Counterfactual AI (Google Gemma 2 9B): Runs inference with strict prompt constraints requiring Event-ID citations, performing grounded counterfactual deduction without proprietary vendor lock-in.
- Observability & Agent Tracing (Sentry Agent Tracing): Live OpenTelemetry GenAI spans capturing latency, tokens, error breadcrumbs, and step-level agent actions.
- Data Isolation & Persistence (MongoDB Atlas): Enterprise multi-tenant database tier enforcing compound unique constraints (
ownerId_1_traceId_1) and owner isolation. - Zero-Trust Agent Auth (Auth0 v4): Server-side identity verification ensuring anonymous users can never access or leak sensitive agent execution history.
Why Does Open Innovation Matter?
- Privacy & Proprietary Trace Protection: Agent traces frequently contain API keys, confidential customer data, internal system prompts, and proprietary database schemas. Closed commercial APIs require sending raw traces to third-party cloud servers. GhostTrace allows entire organizations to run forensic investigations completely on-premises with open-weight models.
- Deterministic Reproducibility: Closed APIs change weights and prompt behaviors behind the scenes. Open-weight models like Gemma and open frameworks like Mastra and Temporal ensure that a forensic finding diagnosed today will yield the exact same deterministic autopsy results tomorrow.
- No Per-Investigation Toll: Large agent teams execute thousands of trace autopsies daily; open innovation eliminates crippling token billing for debugging infrastructure.
Prize Categories
We are entering the following categories:
Featured Categories ($200)
- Best Use of Gemma: Running
google/gemma-2-9b-itfor counterfactual hypothesis deduction and rule-based grounding defense. - Best Use of TabPFN: Tabular foundation model integration for anomaly prediction and trace metric classification.
Partner Categories ($100)
- Best Use of Auth0 for AI Agents: Enforcing multi-tenant session verification and owner-isolated data access.
- Best Use of MongoDB Atlas: Verified live Atlas cluster with compound indexing, unique collision detection, and owner scoping.
- Best Use of Sentry Agent Tracing: Live OpenTelemetry GenAI spans, agent action breadcrumbs, and real-time cloud event delivery.
- Best Use of Mastra: 4-step Mastra Core resilient agent workflow orchestration.
- Best Use of Entire: Entire CLI session capture, Git checkpoint refs, and immutable commit audit trails.
- Best Use of Ultramarine: Ultramarine-1-flash provider integration with token cost calculation and structured Zod output.
- Best Use of Backboard: Backboard Studio provider integration with offline deterministic grounding defense.
- Best Use of Browserbase: Headless browser session replay and DOM state capture for web agent failures.
- Best Use of Temporal: Temporal durable execution engine with automatic activity retries and fault recovery.
- Best Use of Tiger Data: Forensic knowledge graph and vector similarity search for historical failure patterns.
