Skip to content

bbmullen72/ghostkode

Repository files navigation

GhostKode

Forensic code intelligence. We don't fix code — we explain the human tragedy behind it.

GhostKode connects to your GitHub repositories and identifies the most troubled lines in your codebase using git blame analysis, semantic embeddings, and AST-aware parsing. Click any haunted line to get a streaming AI forensics briefing — who touched it, why it keeps breaking, and what a clean fix would look like.


How It Works

1. Git Blame + Commit Forensics

For any file, GhostKode fetches the full blame graph via GitHub's GraphQL API and commit history via REST. Every line is mapped to the commit that last touched it — author, date, and message.

2. RAG-Based Haunt Scoring

Commit messages are embedded using OpenAI's text-embedding-3-small model and compared against a curated retrieval corpus of archetypal bad-commit patterns — things like hotfixes, reverts, emergency patches, and workarounds. Cosine similarity against this reference corpus produces a semantic churn score per line, surfacing code that has a history of instability even when the commit messages don't use obvious keywords. This is combined with keyword signal and file-level churn frequency for a final weighted score.

3. AST-Aware Filtering

File content is parsed using AST analysis to distinguish executable code from comments, docstrings, and blank lines. This ensures only semantically meaningful lines are candidates for haunting — comment blocks and non-code constructs are excluded regardless of their commit history.

4. Streaming AI Analysis

Haunted lines are sent to GPT-4o with full git context. The model responds as a forensics narrator — naming authors, quoting commit messages, and tracing the pattern of changes. Responses stream in real time via SSE. A second pass automatically generates a concrete fix suggestion for the line.

5. Conversational Follow-Up

Each haunted line opens a conversation thread. Follow-up questions send the full history back to the model, maintaining context across turns.


Stack

  • Next.js 16 (App Router) — full-stack framework
  • Auth0 — authentication with GitHub OAuth
  • GitHub GraphQL + REST APIs — blame, commits, file content, repo tree
  • OpenAItext-embedding-3-small for RAG corpus similarity, gpt-4o for streaming analysis
  • Tailwind v4 — styling

Getting Started

npm install
npm run dev

Required environment variables:

AUTH0_DOMAIN=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_SECRET=
APP_BASE_URL=
OPENAI_API_KEY=
GEMINI_API_KEY=
GITHUB_PAT=

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages