CodeLoop AI
A Salesforce-focused multi-LLM coding agent for VS Code. Three seats — a planner that thinks, a worker that types, a reviewer that judges — and you decide which model sits in each: GitHub Copilot models, Claude, GPT‑5.x, NVIDIA NIM, or a free local model under Ollama / LM Studio. Deterministic tools do everything that never needed an LLM, and every risky action passes through your explicit approval.

You ──► Chat / ⚡Hybrid ──► Agent loop ──► Planner / Worker / Reviewer seats
│ (any provider in any seat)
▼
Typed tools (risk-classified)
│
Approval gate (you)
│
Files / sf CLI / Salesforce orgs
Highlights
- Provider topologies (0.3.x) — one setting decides how many models orchestrated runs use.
mono: one model fills every seat (a local server or a cloud API). hybrid (default): planner plans and reviews, worker implements. multi: an independent reviewer — a genuinely different model grading the work, not the planner marking its own homework. Seats are configuration, not code: Copilot Sonnet planning while Copilot Haiku types, or NVIDIA planning while local Ollama types, are both just settings.
- Self-healing runs (0.3.6) — the seats cover for each other. If the worker (and its
roleFallbacks) fails a step or produces nothing, the planner implements that step itself (labeled ESCALATED in the monitor) so a run never ends with holes. If the reviewer returns NOT APPROVED, the worker receives the blocking findings and repairs the applied files — replying NO_CHANGES for unaffected ones, every repair passing the same diff approval — then the reviewer re-reviews (codeLoopAI.agent.revisionRounds, default 1, max 2, 0 disables). The reviewer never implements, so it never grades its own code.
- Run Monitor — the sidebar shows three live panels: Provider consumption (per provider/model calls, errors, and tokens for the whole session — where your credits actually went), Run history (every chat and ⚡ run with outcome, calls, tokens, duration), and the orchestration timeline (color-coded PLANNER / WORKER / REVIEWER / TOOLS / YOU rows with per-stage durations and a "% worker" cost bar).
- Salesforce-native tooling — project discovery, org discovery with environment classification (anything not a sandbox/scratch org is treated as production = write-protected), read-only SOQL, sObject describes, Apex test execution, check-only deployment validation, Apex/LWC static analyzers with severity-ranked findings, change-impact tracing across 17 artifact types, debug-log analysis (governor limits, repeated queries, slow methods), and a full data-migration toolkit (RFC-4180 CSV engine, validation, mapping generation from live describes, external-ID analysis, load-plan topological sort with Mermaid, comparison and reconciliation).
- Safety model — every tool declares
read / local-write / org-write / destructive risk; org-writes and destructive actions are never auto-approved in any mode; production targets demand a second explicit confirmation; file writes show a side-by-side diff before applying, are verified after writing, journaled, and revertible; sf CLI output is stripped of credentials before any model, log, or UI sees it.
- Built for imperfect models and imperfect networks — the tool-call parser accepts seven call shapes (each one earned from a real field trace); malformed calls bounce back with corrective instructions; repetition collapse (a model retyping the same block to the token cap) is cut mid-stream; transient
429/502/503/504 responses from cloud endpoints are retried with backoff before a run is allowed to fail; timeouts are reported as timeouts, not as "server unreachable"; per-role fallback chains (codeLoopAI.roleFallbacks) reseat a role on another model when its provider errors; and every run — chat and hybrid — writes a JSONL execution trace to .codeloop/logs/ for post-mortem diagnosis.
Quick start
# 1. Optional local model (recommended: fast + protocol-reliable, fits modest GPUs)
ollama pull qwen2.5-coder:7b
# 2. Install the extension
code --install-extension codeloop-ai-<version>.vsix
Then pick a topology recipe below, paste it into your User settings (Ctrl+, → search "codeLoopAI"), and verify with CodeLoop AI: Select Provider Topology — the quick-pick previews exactly which provider/model fills each seat before you commit.
Recipe 1 — mono: one model does everything
Simplest setup; also how you point the whole agent at an OpenAI-compatible cloud like NVIDIA NIM:
{
"codeLoopAI.topology": "mono",
"codeLoopAI.provider": "openai-compatible",
"codeLoopAI.model": "qwen/qwen3-next-80b-a3b-instruct",
"codeLoopAI.requestTimeoutMs": 600000,
"codeLoopAI.providerSettings": {
"openai-compatible": { "apiKey": "nvapi-…", "baseUrl": "https://integrate.api.nvidia.com/v1" }
},
"codeLoopAI.salesforce.environments": { "dev": "yourDevAlias" }
}
(For a fully-local mono, set provider: "ollama", model: "qwen2.5-coder:7b" and drop providerSettings.)
Recipe 2 — hybrid: same provider, two tiers (e.g. Copilot)
The higher version plans + reviews, the lower version types. Works with any Copilot subscription via the VS Code Language Model API:
{
"codeLoopAI.topology": "hybrid",
"codeLoopAI.primary.provider": "vscode-lm",
"codeLoopAI.primary.model": "claude-sonnet-5",
"codeLoopAI.local.provider": "vscode-lm",
"codeLoopAI.local.model": "claude-haiku-4.5",
"codeLoopAI.provider": "vscode-lm",
"codeLoopAI.model": "claude-haiku-4.5",
"codeLoopAI.salesforce.environments": { "dev": "yourDevAlias" }
}
For vscode-lm the model is a family hint — run CodeLoop AI: Switch LLM Provider → vscode-lm once to list the exact copilot/<family> names your subscription serves (a wrong hint silently falls back to any available Copilot model).
Recipe 3 — multi: cloud brains + free local hands
Copilot only plans and reviews (~2 premium calls per run); your local model does all the typing; a different, stronger model judges the result:
{
"codeLoopAI.topology": "multi",
"codeLoopAI.primary.provider": "vscode-lm",
"codeLoopAI.primary.model": "claude-sonnet-5",
"codeLoopAI.local.provider": "ollama",
"codeLoopAI.local.model": "qwen2.5-coder:7b",
"codeLoopAI.reviewer.provider": "vscode-lm",
"codeLoopAI.reviewer.model": "claude-opus-4.8",
"codeLoopAI.roleFallbacks": { "local": ["vscode-lm/claude-haiku-4.5"] },
"codeLoopAI.salesforce.environments": { "dev": "yourDevAlias" }
}
Open the CodeLoop AI icon in the activity bar. Then either chat normally, or tick ⚡ Hybrid and describe one focused change — the ⚡ toggle launches the orchestrated flow under whatever topology is set: plan → implement (escalating failed steps to the planner) → validate → review → repair-and-re-review if not approved.
Full walkthrough: docs/GETTING-STARTED.md · Something broken? docs/TROUBLESHOOTING.md
| Element |
Meaning |
| ● dot |
Chat provider connectivity (hover = provider · model; red shows an OFFLINE tag) |
| ↑12.3k ↓4.5k |
Live session tokens: prompt sent ↑ / generated ↓ (resets on + new session; estimated when the provider reports no usage — Copilot and NVIDIA don't) |
| Mode dropdown |
Specialist prompt: Developer, Data Migration, Env Comparison, Code Review, Architecture, Log Analysis |
| ⚡ Hybrid |
Off = single-model chat loop (base provider) · On = planner → worker → reviewer flow (topology seats) |
| Model chip on messages |
The actual model that produced each response (color = seat: green worker, blue planner) |
| Run Monitor section |
Provider consumption (session) · Run history (chat + hybrid) · live orchestration timeline |
Commands (Ctrl+Shift+P)
Core: Open Chat · Start/Stop Agent · New Session · Check LLM Provider Connection · Switch LLM Provider · Revert Last Agent Change
Orchestration: Run Hybrid Task · Hybrid Run Monitor · Select Provider Topology
Salesforce: Analyze Salesforce Project · List Salesforce Orgs · Review Current File · Analyze Change Impact · Analyze Apex Log
Migration: Validate Migration CSV · Generate Migration Load Plan · Migration Dashboard
Diagnostics: Open Last Run Trace · Show Command History · Reconnect MCP Servers
Settings reference
| Setting |
Default |
Purpose |
codeLoopAI.topology |
hybrid |
mono (one model) · hybrid (planner + worker) · multi (+ independent reviewer) |
codeLoopAI.provider |
ollama |
Plain-chat provider (ollama · lmstudio · openai-compatible · claude · vscode-lm · openai) |
codeLoopAI.model |
qwen3-coder |
Plain-chat model (recommended: qwen2.5-coder:7b) |
codeLoopAI.baseUrl |
http://localhost:11434 |
Local server URL (localhost→127.0.0.1 fallback is automatic) |
codeLoopAI.primary.provider / .model |
claude / claude-sonnet-4-5 |
Planner seat (any provider; family hint for vscode-lm) |
codeLoopAI.primary.reasoningEffort |
"" |
gpt-5.x reasoning effort (minimal…high); omits temperature when set |
codeLoopAI.local.provider / .model |
inherit chat |
Worker seat (may be a second cloud provider — no local server required) |
codeLoopAI.reviewer.provider / .model |
inherit planner |
Reviewer seat, used by multi topology |
codeLoopAI.providerSettings |
{} |
Per-provider { apiKey, baseUrl } (USER settings) — mixed credentials; baseUrl override wins even for fixed endpoints (Azure OpenAI, OpenRouter, NVIDIA NIM) |
codeLoopAI.roleFallbacks |
{} |
Per-seat provider/model fallback chains, tried in order on error (each attempt labeled in the monitor) |
codeLoopAI.apiKey |
"" |
Global fallback key (prefer per-provider keys in providerSettings; never logged) |
codeLoopAI.mode |
developer |
Default specialist mode |
codeLoopAI.maxContextTokens |
32000 |
Local context budget (num_ctx) |
codeLoopAI.requestTimeoutMs |
300000 |
Idle timeout for streams / total timeout for non-streaming calls. Raise to 600000 for queued free tiers |
codeLoopAI.agent.maxIterations |
8 |
Loop cap per task (every iteration is one LLM call — budget accordingly on paid providers) |
codeLoopAI.agent.revisionRounds |
1 |
NOT APPROVED verdicts trigger up to N worker repair rounds + re-review (0 disables) |
codeLoopAI.agent.approvalMode |
balanced |
manual / balanced / autonomous (org-write + destructive always ask) |
codeLoopAI.agent.requireApprovalForWrites |
true |
Gate local file writes even in autonomous |
codeLoopAI.salesforce.environments |
{} |
Env→alias map (e.g. {"dev": "myDevOrg"}); required for deploy/test steps, injected into prompts so models never guess aliases |
codeLoopAI.mcp.servers |
{} |
MCP stdio servers; discovered tools always require approval |
Model recommendations (field-tested)
- Worker (local):
qwen2.5-coder:7b — fast, protocol-reliable, fits modest GPUs. Larger local models (30B-class MoE) can be slower and less reliable for tool calling under Ollama, or simply not fit in VRAM (CUDA out-of-memory); if you see garbage tokens or repetition loops, check the trace (Open Last Run Trace) and see TROUBLESHOOTING.
- Planner / reviewer (cloud): Copilot
claude-sonnet-5 (+ claude-opus-4.8 as an independent reviewer, claude-haiku-4.5 as a cheap cloud worker), gpt-5.4 at medium effort, or claude-sonnet-4-5 via API key. Plans and reviews are short, dense calls — typically well under 10% of a run's generated tokens.
- NVIDIA NIM free tier (
integrate.api.nvidia.com/v1 via openai-compatible + providerSettings): qwen/qwen3-next-80b-a3b-instruct writes strong Apex but drifts across call syntaxes (the parser absorbs all observed shapes); meta/llama-3.3-70b-instruct is more format-stable. Avoid thinking/reasoning models (e.g. deepseek-v4-pro) for agent work — their thinking mode can't be disabled through the API surface and free-tier gateways time out on them. Expect queuing; keep requestTimeoutMs at 600000 and let the built-in 5xx retry do its job.
Documentation
| Doc |
Contents |
| docs/GETTING-STARTED.md |
Install → configure → first runs, with sample prompts |
| docs/HOW-IT-WORKS.md |
Internals: loop, parser, approvals, guards, tracer, per-subsystem tour |
| docs/HYBRID-ORCHESTRATION.md |
The multi-LLM design: topologies, seats, routing, compression, monitor |
| docs/TROUBLESHOOTING.md |
Symptom → cause → fix, from real field debugging |
| docs/flow-diagrams.html |
Rendered flow diagrams (open in a browser) |
| CHANGELOG.md |
Full version history |
Build from source
npm install
npm run typecheck # strict TS
npm run compile # esbuild bundle
npx @vscode/vsce package # build the .vsix
Smoke suites (pure modules, no VS Code host) — run before every package:
npx tsx smoke/smoke.ts # Apex/LWC analyzers
npx tsx smoke/smokeMigration.ts # CSV/migration engine
npx tsx smoke/smokeLog.ts # log analyzer + all 7 tool-call parser shapes + repetition guard
npx tsx smoke/smokeTopology.ts # topology resolution + consumption tracker + seat labels
node smoke/smokeWebview.mjs # chat webview script integrity
MIT © Varnamala LLC