SF Buddy — Salesforce AI Assistant for VS Code
Five specialist modes in your sidebar. Each one knows Salesforce deeply, reads your open file automatically, and hands off to the next when its job is done.
Powered by whatever AI model you already have — local Ollama, free OpenRouter, or your company's Copilot subscription. Your code stays where you put it.
What It Does
SF Buddy gives you five modes in a pipeline. Switch between them with one click — conversation history carries over so each mode sees what the previous one said and built:
💬 Advisor → 📋 Plan → ⚡ Build → 🔍 Review → 🧪 Test
↑_______________↓ (fixes loop)
| Mode |
What it does |
| 💬 Advisor |
Salesforce Q&A, Agentforce decisions, FSC guidance, architecture best practices |
| 📋 Plan |
Full solution design — Agentforce agent architecture, Data Cloud schema, components, failure modes, licence risks, build order — with links to the relevant Salesforce docs |
| ⚡ Build |
Writes Apex, LWC, Flow, and Agentforce invocable actions. Reads your open file first and modifies it in-place — no full rewrites |
| 🔍 Review |
Finds governor limit violations, security gaps, bulkification failures — listed by line number with the exact fix |
| 🧪 Test |
Generates complete Apex test classes: positive, negative, bulk, callout mocks, real assertions |
What Makes It Different
Agents that show their work
Every mode starts its response with a structured line proving it read your file and understood the task before answering — file name, what it classified the request as, and what could go wrong. This isn't decoration: it forces the model to reason before it responds, which matters especially on smaller local models that can silently skip context.
⚡ [file: AccountHandler.cls] [change: add bulkification to updateContacts()] [assumptions: Account.OwnerId, Contact.AccountId exist]
Plan mode links to the actual Salesforce docs
When Plan recommends Agentforce, Data Cloud, CRM Analytics, or a specific Apex pattern, it ends every response with a 📖 Further reading section linking to the relevant official Salesforce documentation — so you can verify the claims yourself, not just trust them.
Reads your open file without you asking
SF Buddy watches what file you have open. When it's a Salesforce file (.cls, .trigger, .js, .html, .xml), it's automatically in context. "Fix this", "review this", "add X" all mean that file — the same way GitHub Copilot Chat handles active file context.
Compare Changes — selective diff panel
Code suggestions open in a hunk-by-hunk diff panel inside the sidebar. Accept or skip each change independently — nothing is written to disk until you click Apply. Pure deletion hunks start rejected by default so you can't accidentally remove code.
Agentforce architecture knowledge baked in
Plan and Build both know the Agentforce design pattern end-to-end: agent definition → topics → standard vs custom actions → grounding (Data Cloud data graph or knowledge articles) → Einstein Trust Layer implications. Build generates @InvocableMethod / @InvocableVariable actions with the correct List<> signatures that Agent Builder expects.
AI Models — Free and Paid Options
🆓 Free Cloud — OpenRouter
200+ models (Llama 3, Gemini Flash, Mistral, Qwen, and more) — many completely free, no credit card required.
Get a key at openrouter.ai/keys.
🤖 Company Copilot — GitHub Copilot Extension
If your company provides a Copilot Business or Enterprise subscription, SF Buddy uses it automatically — no token, no extra cost. Install the GitHub Copilot extension and sign in.
For personal use, a free GitHub token gives access to GPT-4o, Claude Sonnet, and o3-mini via GitHub Models.
⚡ Local — Ollama / LM Studio
Runs entirely on your machine. Your code never leaves. Free. Works offline.
Ollama — ollama pull qwen2.5-coder:7b is enough to get started.
LM Studio — load any GGUF model, start the local server.
🔌 Custom Endpoints
Any OpenAI-compatible API: Azure OpenAI, vLLM, LMDeploy, llama.cpp, Kobold. Add it directly in the sidebar — no settings.json required.
Quick Start
Option A — Free, runs in 2 minutes
- Install Ollama
- Open a terminal:
ollama pull qwen2.5-coder:7b
- Open a Salesforce project in VS Code
- Click the SF Buddy icon in the Activity Bar
Option B — Free cloud via OpenRouter
- Get a free key at openrouter.ai/keys
- Click the model badge in the SF Buddy sidebar
- Select OpenRouter → paste your key → pick a free model
Option C — Company Copilot subscription
- Install the GitHub Copilot extension and sign in with your work GitHub account
- Click the model badge → GitHub Copilot → Use Copilot Subscription
- No token needed — SF Buddy uses your company's licence directly
Features
Five-Mode Pipeline with Auto-Handoff
When a mode finishes its job, a one-click banner appears to continue in the next mode — context carries over so each mode sees what the previous one said and built.
Compare Changes — Selective Diff Panel
When Build suggests code, click ↳ Compare Changes to open a side-by-side diff panel inside the sidebar:
- Changes broken into individual hunks — one logical change at a time
- Each hunk shows Before on the left and After on the right, with character-level highlighting
- ✓ Select or ✗ Skip each hunk independently
- ✓ All / ✗ None buttons to flip everything at once
- Nothing is written to disk until you click Apply
Active File Context Bar
When a supported Salesforce file is open, a bar appears above the input confirming the file is in context, showing the file type (e.g. AccountHandler.cls Apex class · in context). Click ✕ to exclude it if you're asking about something unrelated.
Multi-File Attachment
The paperclip button opens a file picker — select multiple files at once. Useful for attaching a trigger + its handler class + a related test at the same time.
Right-Click Review
Right-click any .cls or .trigger → SF Buddy → Review This File. Findings by severity: Critical → Security → Architecture → Reliability.
Command Palette
| Command |
Description |
SF Buddy: Review This File |
Full code review of the active file |
SF Buddy: Generate Apex Test |
Generate a test class for the active file |
SF Buddy: Explain This Code |
Walk through selected code in plain English |
SF Buddy: Switch Mode |
Change between the five modes |
SF Buddy: Switch Model / Provider |
Change AI backend |
Keyboard Shortcuts
| Shortcut |
Action |
Ctrl+Shift+R / Cmd+Shift+R |
Review active file |
Ctrl+Shift+E / Cmd+Shift+E |
Explain selected code |
Requirements
- VS Code 1.85 or later
- For local AI: Ollama or LM Studio installed and running
- For cloud AI: An OpenRouter key (free), a GitHub token (free), or a Copilot extension subscription
No Salesforce CLI required. No org connection required. Works on any Salesforce project folder.
Privacy
- Local mode: Your code never leaves your machine.
- Cloud mode: Code is sent to the provider you select — the same provider you chose and trust for that key.
- Copilot extension mode: Code is sent to GitHub/Microsoft via the Copilot extension, subject to your company's Copilot agreement.
- No telemetry by default. Anonymous usage stats are opt-in only and contain no code or prompts.
API keys are stored in VS Code SecretStorage — never in settings.json, never on disk in plain text.
Extension Settings
| Setting |
Default |
Description |
sfbuddy.mode |
advisor |
Active mode: advisor, review, test, plan, build |
sfbuddy.modelMode |
auto |
local, cloud, auto, or custom |
sfbuddy.localProvider |
ollama |
ollama or lmstudio |
sfbuddy.localModel |
(auto-detect) |
Local model name, e.g. qwen2.5-coder:7b |
sfbuddy.cloudProvider |
anthropic |
Active cloud provider |
sfbuddy.openrouterModel |
(pick in sidebar) |
OpenRouter model ID |
sfbuddy.copilotModel |
gpt-4o |
Copilot model family |
sfbuddy.maxTokens |
4096 |
Max tokens per response |
sfbuddy.requireApproval |
true |
Always show diff before writing any change |
sfbuddy.ollamaBaseUrl |
http://localhost:11434 |
Ollama server URL |
sfbuddy.lmstudioBaseUrl |
http://localhost:1234 |
LM Studio server URL |
Feedback & Issues
Found a bug or have a feature request? Open an issue — use the bug report or feature request template.
License
MIT — free to use, modify, and distribute.