👻 Ghost
Plan code with Claude, then type it yourself over faint ghost text in VS Code.
It looks like an AI autocomplete suggestion, but Tab won't accept the code. You type every line of code yourself (Tab only fills in comments), so you actually read and learn the code: the OpenCV calls, the array shapes, the maths. Built for learning computer vision and robotics by building real projects.
How it works
- Learn by doing. Tell the tutor what you want to build. It agrees a short plan of small steps, then works in quick loops: one idea explained briefly (the intuition, just enough maths), then straight away a few lines of code that use it, run it, one quick question, next idea. Every design choice is explained the moment it shows up in the code (what happens if you add more filters, go deeper, or change the learning rate). New files are created and opened for you. Lessons can be saved as notes you keep (see below). Prefer all the theory first? Set
ghostTutor.teachingStyle to understandFirst; or buildFirst to build with less explaining.
- Ghost. For each step, Claude puts the code into your editor as ghost text (about 20–80 lines at a time).
- Type. You type over it. Mistakes go red with a hint like
← expected: imread(path). Backspace and carry on.
- Ask. Not sure why a line is there? Put the cursor on it and press
Ctrl+Alt+E (⌘⌥E on a Mac). Claude explains the line you're about to type.
- Review. When the file matches, a window opens beside your code explaining it, written by your chat model: what the code does, how it fits the project, a block-by-block walkthrough (click a line number to jump to it), and check-yourself questions. It's saved in your project as
notes/reviews/<file>.md (for example notes/reviews/src/model.py.md), so it goes into your repo with the code.
- Changing a file later (adding a feature, fixing something) doesn't make a new file: when you finish typing the changes, a new dated entry is added to the bottom of that file's review saying what changed, why, and how the new code works.
- Buttons for Quiz me in chat, What's next?, Rewrite (replaces that entry) and Open the review file. Reopen past reviews with Ghost: Open a Past Review.
When Claude changes a file you've already typed, only the new parts appear as ghost text, and the cursor jumps between the places that need changes.
Install
- In VS Code, open Extensions, search for Ghost — Learn to Code by Typing (or
benasvaiciulis.ghost-tutor) and click Install.
- Open your project folder.
- Pick one way to connect Claude (below).
Option A: chat panel (Anthropic API key)
Click Ghost in the status bar (bottom right), or press Ctrl+Alt+G (⌘⌥G on Mac), then Set API key and paste a key from platform.claude.com. The key is kept in VS Code's secret storage. This uses API credits, which are separate from a Claude subscription. If you have Claude Max, link your Console organization under claude.ai → Settings → Billing → API credits, and the monthly credits included with Max pay for it.
The chat opens as an editor tab beside your code, so the Explorer, Search and everything else in the side bar stay open. Drag the tab anywhere like a file: split it, move it below your code, or right-click → Move into New Window to put it on a second screen. It comes back where you left it after a restart. Prefer the side bar? Set ghostTutor.chatLocation to sidebar, or click the 👻 icon in the activity bar; both show the same chat.
Chat as normal. Claude reads your files when it needs to and puts code into the editor with its show_ghost_code tool. It never pastes whole files into the chat.
Thinking: the ✦ button under the chat box sets how hard Claude thinks before replying, like the Claude app: Low, Medium, High (the default), Extra high or Max. Higher is slower and costs more; Extra high is worth it for tricky maths or debugging. Local models don't have this setting.
Reading while it writes: scroll up at any time and the reply keeps writing below without pulling you down. Click ↓ Jump to latest to go back.
Chat length: the bar next to the cost shows how full the chat is. Every reply re-reads the whole chat, so long chats cost more per reply and the tutor gets more likely to mix up or forget details. Green is fine, yellow is getting long, and at red Ghost suggests starting a new chat: a summary of where you are is saved to your notes and the new chat carries on from it. Hover over the bar for the numbers. Claude can hold 1M tokens, but the suggestion comes at 120K (change it with ghostTutor.newChatSuggestAt); local models get it at 80% of their own context length, because past that they silently forget the start of the chat.
Cost: chats use prompt caching, so each reply re-reads the chat from Claude's cache at a small fraction of the normal price (about 5% on Sonnet and Opus 5.5) instead of paying full price for it again. The cache lasts an hour, long enough to type a file between messages. The chat shows what it has cost since it started (including its side questions, term explanations and reviews) next to the model name; hover over it to see how much caching saved.
Side questions
Not sure about one part of a long reply? Highlight it and click 💬 Ask about this. A side chat opens beside your code with that part quoted; ask as many questions as you like there without derailing the main chat. Close it (or click Done ↩) and it folds back into the main chat as a collapsed note you can reopen, and the tutor is told what you asked, so it carries on where you left off.
Screenshots and images
Paste a screenshot into the chat box (⌘V / Ctrl+V), drag an image in, or click 📎. Up to five per message, shrunk automatically so they're cheap to send. Claude reads them (an error message, a plot, a whiteboard sketch, a camera frame); local models need to be vision models for this.
Speaking instead of typing
Click 🎤 for how to dictate: on a Mac press Fn (🌐) twice, on Windows press Win + H (the first time, Windows may ask you to allow online speech recognition), and talk. Your computer's dictation types straight into the chat box (VS Code doesn't let extensions use the microphone directly). The tutor expects dictated messages, so misheard words like "see V2" for cv2 or "numb pie" for NumPy are understood.
Technical terms
Technical words in the tutor's replies (like ReLU, receptive field or homography) are underlined. Hover over one for a short explanation; move away and it closes. Click Open full explanation ↗ for the whole thing beside your code: the intuition, how it works with the maths typeset, a tiny example, why it matters for what you're building, and common mistakes. It's saved to notes/concepts/<term>.md, so reopening it is instant and free, and the tab stays until you close it. You can also run Ghost: Explain a concept… for any term.
The course
Open Course under the chat (click its title to expand it). It's a step-by-step computer vision course, 32 lessons in 8 modules, from pixels and filters through camera geometry and the classic ArUco pipeline to neural networks, CNNs and a capstone: your own fast, robust neural ArUco detector.
Each lesson runs in its own chat:
- Understand. The tutor teaches the ideas one at a time, with the maths, and asks a quick question after each one.
- Build. You type a small project with the ghost. Lesson files go in
course/<lesson>/.
- Check. A couple of questions that need the ideas to answer, and lesson notes if you want them.
When you've got it, the tutor ticks the lesson off and notes what you found hard, so later lessons can build on it. Start with ▶ Continue the course (top of the Course list, or the button in an empty chat), or click any lesson to jump to it. Right-click a lesson to mark it done or not done. Your progress follows you to your other computer if VS Code Settings Sync is on.
Choosing a model
Click the model name under the chat box (or run Ghost: Choose Model). You can pick:
- Claude: Sonnet 5.5 (default, best value), Opus 5.5, Haiku 5.5 (cheapest) or Fable 5.2 (most capable). These need an API key.
- A local model from Ollama. It runs on your own GPU, is free, and works offline.
- A local model from LM Studio, or any OpenAI-compatible server (llama.cpp, vLLM, OpenRouter, OpenAI…).
You can switch models in the middle of a chat.
Local models with Ollama
- Install Ollama from ollama.com and open it.
- In a terminal, download a model, for example:
ollama pull gemma4:12b
- In Ghost, click the model name → Add a local model from Ollama… and pick it.
Ghost asks Ollama for a 16K-token context window, because Ollama's own default is much smaller on most GPUs. To change it, edit contextLength under ghostTutor.customModels in settings.json.
Local models are weaker tutors than Claude, and some can't use tools. If a model can't put code in the editor itself, Ghost switches it to writing code in the chat. Each code block then gets a 👻 Type this button that loads it as ghost text.
Chat history
Chats are saved across all your folders, so moving or renaming a project doesn't lose them. + starts a new chat and keeps the old one. The 🕘 History button at the top of the panel lists past chats (search by title, folder or message). Pick one to carry on, or click the bin icon to delete it.
Notes that stay
- Lesson notes: when the tutor explains a topic in depth, it saves a lesson to
notes/lessons/<topic>.md: intuition, maths (rendered in VS Code's Markdown preview), a worked example, trade-offs and check questions. It updates the same file as you go further.
- Session notes: click End session (📓 at the top of the panel), or start a new chat with +. The tutor writes a summary to
notes/sessions/<date>-<topic>.md covering what you did, the files, decisions, concepts, your typing, open questions and the next step. The chat is then removed (only after the notes are saved). New chats read your latest session notes, so the tutor picks up where you left off.
Option B: Claude Code (no API key)
Run Ghost: Set Up Claude Code for Ghost Mode from the Command Palette. This adds a section to your CLAUDE.md telling Claude Code to discuss the design first, and to write code to .ghost/<path> instead of editing your files. It also adds .ghost/ to .gitignore.
When Claude Code writes .ghost/src/detector.py, Ghost opens src/detector.py and shows the code as a ghost. It works with Claude Code in the terminal or in its VS Code extension.
You can also paste code from anywhere with Ghost: Ghost Code from Clipboard (markdown code fences are stripped).
Keys
| Key |
What it does |
| type |
Fill in the ghost |
Tab |
Fills in the comment at the cursor (so you only type code); otherwise indents. Never fills in code |
Alt+\ (⌥\ on Mac) |
Hint: types the next word for you (counted) |
Ctrl+Alt+E (⌘⌥E on Mac) |
Ask Claude to explain this line or selection |
Ctrl+Alt+G (⌘⌥G on Mac) |
Open the Ghost chat |
() [] {} "" '' |
Type both brackets (or let VS Code auto-close them) and go back inside: the ghost shows what goes in there, and the cursor hops out once it's filled |
| click 👻 in the status bar |
Jump to where the ghost continues, or to a mistake |
Right-click in the editor for Peek Full Ghost Code (opens it side by side).
Settings
| Setting |
Default |
|
ghostTutor.effort |
high |
How hard Claude thinks: low, medium, high, xhigh or max |
ghostTutor.chatLocation |
tab |
Where the chat opens: tab (an editor tab beside your code) or sidebar |
ghostTutor.model |
claude-sonnet-5-5 |
Model for the chat panel (use the model picker) |
ghostTutor.newChatSuggestAt |
120000 |
Claude: chat length (tokens) at which a new chat is suggested |
ghostTutor.promptCaching |
1h |
Claude prompt caching: 1h, 5m or off |
ghostTutor.customModels |
[] |
Local and other models you've added |
ghostTutor.ghostMode |
block |
How far ahead to show: block (until the next blank line), line or all |
ghostTutor.maxGhostLines |
15 |
Upper limit on lines shown ahead |
ghostTutor.allowTabAccept |
false |
Let Tab accept like normal autocomplete |
ghostTutor.tabFillsComments |
true |
Tab fills in comments and docstrings |
ghostTutor.autoStart |
true |
Open files as soon as ghosts appear in .ghost/ |
ghostTutor.deleteGhostWhenDone |
true |
Remove the .ghost/ copy once typed |
ghostTutor.reviewOnFinish |
true |
Explain the code and save the review when you finish a file (off = small pop-up) |
ghostTutor.reviewNotes.folder |
notes/reviews |
Where code reviews are saved in your project |
ghostTutor.teachingStyle |
learnByDoing |
learnByDoing: small loops of one idea + a few lines of code. understandFirst: ideas, maths and reasoning before code. buildFirst: a short plan, then build |
ghostTutor.conceptNotes.folder |
notes/concepts |
Where full explanations of technical terms are saved |
ghostTutor.sessionNotes.summarizeOnNewChat |
true |
Save a summary before starting a new chat |
ghostTutor.sessionNotes.deleteChatAfterSummary |
true |
Remove the chat once its summary is saved |
ghostTutor.sessionNotes.folder / lessonNotes.folder |
notes/sessions, notes/lessons |
Where notes go |
ghostTutor.extraInstructions |
|
Notes for Claude, e.g. "Robotics student. Python, OpenCV, PyTorch. Explain the maths." |
Tips
- On first use it offers to turn off IntelliSense pop-ups and Copilot for this workspace only. Say yes: they fight with the ghost. Auto-closing brackets are fine either way. You can also run Ghost: Apply Typing-Friendly Editor Settings at any time.
- Python files should use spaces, not tabs (VS Code's default).
- Ghosts in
.ghost/ survive restarts: reopen VS Code and carry on.
Updates
New versions are published to the Marketplace automatically from GitHub once their tests pass. Ghost checks for them every few hours and asks before installing: Update, What's new or Later (Later waits a day). You can run Ghost: Check for Updates any time, or set ghostTutor.updates to off. To make sure VS Code doesn't update it silently first, turn off Auto Update for Ghost (Extensions view → Ghost → gear icon).
Development
npm install
npm run compile
npm run build-tests && npm test # engine + stream parser unit tests
npm run test:integration # end-to-end in a real VS Code (on Linux, wrap with xvfb-run -a)
npm run package # builds the .vsix (upload it at marketplace.visualstudio.com/manage)
src/engine.ts holds the matching logic (line diff plus character prefix/suffix per hunk) and has no VS Code dependency. src/ghostManager.ts handles the inline ghost, decorations and the .ghost/ watcher. src/chat.ts is the chat panel and the streaming Claude client.