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