AI that assists. You that writes.
Inline code completion powered by Claude, GPT-4o, and Gemini—for developers who want LLM intelligence without giving up the keyboard.
Quick Start • Features • Configuration • How It Works • Privacy & Cost
AI coding tools have a philosophy problem.
Most assume you want to write less code. They optimize for delegation—agents that scaffold entire features, chat interfaces that generate files wholesale, autonomous systems that treat your codebase as a problem to be solved without you.
That's useful sometimes. But it's not the only way to work.
Ghostwrite is for developers who still want to write code.
If you find value in staying close to your logic. If you think better when your hands are on the keyboard. If you've noticed that "just let the AI do it" often means "now debug what the AI did"—Ghostwrite was built for how you work.
Inline only. No chat panels. No autonomous agents. No context-switching. Completions appear where you're typing, when you're ready for them.
Bidirectional context. Most tools only see what's above your cursor. Ghostwrite analyzes code before and after—so completions fit the shape of what you're building, not just what you've built.
function processUser(user: User) {
// Ghostwrite sees this context above ↑
| // ← Your cursor is here
// AND this context below ↓
return enrichedUser;
}Smart boundaries. Completions stop at logical endpoints. No runaway generation that overshoots your intent and leaves you cleaning up.
Your choice of model. Claude, GPT-4o, or Gemini. Use what works for your context and budget. Switch anytime.
Full control. Configure token limits, context windows, trigger delays, and debounce timing. The tool adapts to you, not the reverse.
- Engineers who want assistance, not automation
- Developers who've felt alienated by "vibe coding" culture
- Teams that value code comprehension alongside velocity
- Anyone who's tired of tools that assume they want to write less code
- If you want AI to write entire features autonomously
- If you prefer chat-based code generation
- If you're optimizing purely for lines-of-code-per-hour
We'd rather be honest: those workflows are valid, but they're not what Ghostwrite is designed for.
| Capability | Ghostwrite | Agentic Tools |
|---|---|---|
| Philosophy | You write the code | AI writes for you |
| Interface | Inline completions | Chat panels, autonomous agents |
| Context Analysis | Bidirectional (before + after cursor) | Varies |
| Completion Boundaries | Smart (stops at logical endpoints) | Often overshoots |
| Model | Your choice (Claude, GPT-4o, Gemini) | Usually locked |
| Configuration | Full control (tokens, context, timing) | Limited |
| Secret Detection | Built-in (blocks credentials in context) | Rarely included |
Ghostwrite supports three AI providers. Pick one and get an API key:
| Provider | Sign Up | Environment Variable |
|---|---|---|
| Anthropic (default) | console.anthropic.com | ANTHROPIC_AUTH_TOKEN |
| OpenAI | platform.openai.com | OPENAI_API_KEY |
| Google Gemini | aistudio.google.com | GEMINI_API_KEY |
# Add to your shell profile (~/.zshrc, ~/.bashrc, etc.)
# Option A: Anthropic (default)
export ANTHROPIC_AUTH_TOKEN="sk-ant-..."
# Option B: OpenAI
export GHOSTWRITE_PROVIDER="openai"
export OPENAI_API_KEY="sk-..."
# Option C: Gemini
export GHOSTWRITE_PROVIDER="gemini"
export GEMINI_API_KEY="..."Restart your terminal or run source ~/.zshrc.
Clone and install locally:
git clone https://github.com/ghostwrite-ai/ghostwrite.git
cd ghostwrite
npm install
npm run packageThen install the generated .vsix file: Extensions > ... > Install from VSIX
Open any file and start typing. Completions appear automatically after a brief pause.
That's it. Press Tab to accept, Escape to dismiss.
Ghostwrite analyzes code before and after your cursor position. This means suggestions understand:
- The function you're implementing
- The return type you need to satisfy
- Variables already declared below
- Patterns used throughout the file
Completions stop at natural code boundaries:
- End of statements (
;,,) - Closing braces (
},),]) - Logical break points
No more accepting a suggestion only to delete half of it.
See suggestions as they generate. Accept early if the first part is what you need, or wait for the complete suggestion.
Ghostwrite automatically blocks completions when it detects potential secrets in your context:
- API keys (AWS, GitHub, Stripe, Anthropic, OpenAI)
- Passwords and auth tokens
- Private keys
- Database connection strings
The status bar shows a shield icon when secrets are detected.
- Debouncing: Waits for you to pause typing before requesting
- Caching: Reuses valid completions as you type forward
- Cancellation: Aborts in-flight requests when you keep typing
- Retry Logic: Automatically retries on transient failures
Access settings via Preferences > Settings > Ghostwrite or add to settings.json:
{
"ghostwrite.enabled": true,
"ghostwrite.maxTokens": 256,
"ghostwrite.debounceMs": 300,
"ghostwrite.contextLines": 100,
"ghostwrite.secretDetection": true,
"ghostwrite.timeoutMs": 30000
}| Setting | Default | Range | Description |
|---|---|---|---|
enabled |
true |
— | Enable/disable completions globally |
maxTokens |
256 |
32–1024 | Maximum tokens per completion |
debounceMs |
300 |
50–2000 | Delay before triggering (ms) |
contextLines |
100 |
10–500 | Lines of context in each direction |
secretDetection |
true |
— | Block when secrets detected |
timeoutMs |
30000 |
5000–120000 | Request timeout (ms) |
For faster suggestions: Lower debounceMs to 150-200 (increases API calls)
For longer completions: Increase maxTokens to 512 (increases cost)
For large files: Increase contextLines to 200 (increases cost, improves context)
For cost control: Lower maxTokens to 128 and contextLines to 50
| Command | Description | Default Keybinding |
|---|---|---|
Ghostwrite: Toggle On/Off |
Enable/disable completions | — |
Access via Command Palette (Cmd/Ctrl+Shift+P).
The status bar indicator shows Ghostwrite's current state:
| Icon | State | Meaning |
|---|---|---|
| 👻 | Ready | Waiting for input |
| ⏳ | Loading | Generating completion |
| ⊘ | Disabled | Extension is off |
| Error | Auth, quota, or network issue | |
| 🛡️ | Blocked | Secrets detected in context |
Click the status bar to toggle Ghostwrite on/off.
┌─────────────────────────────────────────────────────────────────┐
│ Your Editor │
├─────────────────────────────────────────────────────────────────┤
│ ... code above cursor (up to 100 lines) ... │
│ │
│ function example() { │
│ const data = | ← cursor position │
│ return processed; │
│ } │
│ │
│ ... code below cursor (up to 100 lines) ... │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Ghostwrite Extension │
├─────────────────────────────────────────────────────────────────┤
│ 1. Extract bidirectional context │
│ 2. Scan for secrets (block if found) │
│ 3. Build prompt with language + filename │
│ 4. Stream completion from your chosen provider │
│ 5. Stop at logical boundary │
│ 6. Present as inline suggestion │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ AI Provider (your choice) │
├─────────────────────────────────────────────────────────────────┤
│ • Claude Opus 4.5 (Anthropic) │
│ • GPT-4o (OpenAI) │
│ • Gemini 1.5 Pro (Google) │
└─────────────────────────────────────────────────────────────────┘
When generating completions, Ghostwrite sends to your chosen provider's API:
- Code before your cursor (configurable, default 100 lines)
- Code after your cursor (configurable, default 100 lines)
- File language and name
- Your system username (for rate limiting, Anthropic only)
No code is stored locally beyond the current session. See your provider's privacy policy for server-side handling:
Enabled by default, Ghostwrite scans context for:
- AWS access keys and secrets
- GitHub tokens (PAT, OAuth)
- Stripe API keys
- Private keys (RSA, DSA, EC)
- Database connection strings
- Generic API keys and passwords
When detected, completions are blocked and the status bar shows 🛡️.
All providers charge based on token usage. Costs vary by provider:
| Provider | Model | Approx. Cost per 1K tokens |
|---|---|---|
| Anthropic | Claude Opus 4.5 | ~$0.015 input, ~$0.075 output |
| OpenAI | GPT-4o | ~$0.005 input, ~$0.015 output |
| Gemini 1.5 Pro | ~$0.00125 input, ~$0.005 output |
Monitor usage: Check your provider's dashboard.
Control costs: Reduce maxTokens and contextLines settings.
| Variable | Default | Description |
|---|---|---|
GHOSTWRITE_PROVIDER |
anthropic |
Provider to use: anthropic, openai, or gemini |
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_AUTH_TOKEN |
Yes* | Anthropic API key |
ANTHROPIC_BASE_URL |
No | Custom API endpoint (proxies, enterprise) |
ANTHROPIC_MODEL |
No | Model override (default: claude-opus-4-5-20251101) |
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
Yes* | OpenAI API key |
OPENAI_BASE_URL |
No | Custom API endpoint (Azure, proxies) |
OPENAI_ORGANIZATION |
No | Organization ID for multi-org accounts |
OPENAI_MODEL |
No | Model override (default: gpt-4o) |
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY |
Yes* | Google AI API key |
GEMINI_MODEL |
No | Model override (default: gemini-1.5-pro) |
*Required only when using that provider.
- Verify your API key is set for your provider:
- Anthropic:
echo $ANTHROPIC_AUTH_TOKEN - OpenAI:
echo $OPENAI_API_KEY - Gemini:
echo $GEMINI_API_KEY
- Anthropic:
- Check the key is valid at your provider's dashboard
- Restart VS Code after setting the variable
Ensure GHOSTWRITE_PROVIDER is set to one of: anthropic, openai, or gemini (case-insensitive).
- Check status bar — is Ghostwrite enabled?
- Type some code and pause (completions need a trigger delay)
- Check Output panel (
View > Output > Ghostwrite) for errors
- Reduce
contextLinesto50 - Reduce
maxTokensto128 - Check your network connection
If you're working with test credentials or examples:
- Disable temporarily:
"ghostwrite.secretDetection": false - Move secrets to environment variables
- Use
.env.examplewith placeholder values
src/
├── extension.ts # VS Code extension entry point
├── completionProvider.ts # Inline completion logic
├── contextBuilder.ts # Bidirectional context extraction
├── secretDetector.ts # Credential scanning
├── errorHandler.ts # Error classification & retry logic
├── requestManager.ts # Debouncing & request lifecycle
├── statusBar.ts # Status indicator management
├── types.ts # TypeScript interfaces
└── providers/
├── types.ts # Provider interfaces & config types
├── anthropicAdapter.ts # Anthropic SDK adapter
├── openaiAdapter.ts # OpenAI SDK adapter
├── geminiAdapter.ts # Gemini SDK adapter
├── configParser.ts # Environment config parsing
└── providerFactory.ts # Provider instantiation
Built with:
- TypeScript — Full type safety, zero
any, no type assertions - neverthrow — Type-safe error handling with
Result<T, E> - Adapter pattern — Provider-agnostic streaming interface
- Functional patterns — Immutable data, pure functions, discriminated unions
# Clone the repository
git clone https://github.com/ghostwrite-ai/ghostwrite.git
cd ghostwrite
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode for development
npm run watch
# Package for distribution
npm run package- Open the project in VS Code
- Press
F5to launch Extension Development Host - Test completions in the new VS Code window
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run
npm run compileto verify - Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
MIT — Use freely, attribution appreciated.
Built for developers who still want to write code.
Report Bug •
Request Feature