Zero Cloud. Zero Cost. Zero Compromise.
Ghostwriter is a VS Code extension that gives you a fully local AI coding assistant — powered by LanceDB, Transformers.js, and Ollama. Your code never leaves your machine.
| Feature | Description |
|---|---|
| 🔍 Semantic Search | Ask questions in plain English, get relevant code snippets back |
| 🧠 RAG Pipeline | Retrieves top-K context chunks before prompting the LLM |
| ⚡ Incremental Indexing | Only re-indexes files that changed (mtime tracking) |
| 👻 Ghost Text Completions | AI-powered inline suggestions as you type |
| 🔒 100% Local | LanceDB + Transformers.js + Ollama — everything runs on your CPU |
| 🧵 Worker Threads | Embedding runs in a background thread — UI never freezes |
| 📁 .gitignore Aware | Respects your .gitignore, never indexes node_modules |
-
Ollama — Install from ollama.ai and pull a model:
ollama pull codellama # or: ollama pull llama3, mistral, deepseek-coder -
Node.js 18+ — Required for the extension host
# 1. Clone or open this folder in VS Code
cd ghostwriter
# 2. Install dependencies
npm install
# 3. Compile TypeScript
npm run compile
# 4. Press F5 in VS Code to launch the Extension Development Host- Click the 👻 Ghostwriter icon in the Activity Bar
- Click ⚡ Index Workspace to vectorize your codebase
- Ask a question: "How does the auth middleware work?"
Open VS Code Settings (Ctrl+,) and search for ghostwriter:
| Setting | Default | Description |
|---|---|---|
ghostwriter.ollamaUrl |
http://localhost:11434 |
Ollama server URL |
ghostwriter.ollamaModel |
codellama |
Model to use |
ghostwriter.chunkSize |
800 |
Characters per chunk |
ghostwriter.chunkOverlap |
80 |
Overlap between chunks |
ghostwriter.topK |
5 |
Context snippets per query |
ghostwriter.enableInlineCompletions |
true |
Ghost text completions |
Extension Host
├── extension.ts # Activation, commands, watcher
├── GhostwriterViewProvider.ts # Sidebar WebView bridge
└── src/services/
├── LocalIndex.ts # LanceDB — vector storage & search
├── Embedder.ts # Worker thread bridge singleton
├── Indexer.ts # Crawler + chunker (gitignore-aware)
├── OllamaClient.ts # Streaming HTTP client for Ollama
└── RagPipeline.ts # Query → embed → retrieve → prompt → stream
src/workers/
└── embedder.worker.ts # CPU-isolated Transformers.js worker
media/webview/
├── index.html # Sidebar panel HTML (injected by provider)
├── main.js # Webview JS — streaming token rendering
└── style.css # Terminal ghost aesthetic
User: "Where is the login logic?"
│
▼
[Embedder] → 384-dim vector
│
▼
[LanceDB] → top-5 nearest code chunks
│
▼
[Context Sandwich Prompt]
<<< SYSTEM >>> You are Ghostwriter. Use ONLY provided code.
<<< CONTEXT >>> File: src/auth.ts | Lines 10-25: [snippet]
<<< USER QUERY >>> Where is the login logic?
│
▼
[Ollama streaming] → tokens appear in real-time in sidebar
| Command | Description |
|---|---|
Ghostwriter: Index Workspace |
Crawl + vectorize the current project |
Ghostwriter: Clear Index |
Wipe the LanceDB index |
Ghostwriter: Show Status |
Show model, Ollama, and index stats |
MIT © Ghostwriter Contributors