ClipFit for VS Code
Surgical, protocol-driven AI code editing for VS Code.
ClipFit turns structured AI code suggestions into reviewable VS Code changes.
Brainstorm with ChatGPT, Claude, Gemini, or another LLM, copy the generated ClipFit
protocol, and inspect the proposed result in VS Code's native Diff view before you
accept or reject it.
Created by Frank Fu and published by AgentFoundry, this extension is the original
ClipFit implementation and the source of the structured editing protocol used by
ClipFit Go.
Install ClipFit from the Visual Studio Marketplace.
⚡ Quick Start (Get it running in 30 seconds)
- Install: Install
ClipFit from the VS Code Marketplace.
- Set up your LLM: Run ClipFit: Copy AI System Prompt, then paste the
prompt into your preferred web AI.
- Ask for a change: The LLM returns a structured ClipFit protocol block.
- Open the review: Copy the response back to VS Code and run
ClipFit: Process AI Output & Show Diff, or press
Ctrl+K P on Windows/Linux
and Cmd+K P on macOS.
- Accept or reject: Inspect the native side-by-side Diff view, then use the
review controls or press
Ctrl+K A / Cmd+K A to accept.
Companion project: ClipFit Go / MCP for Windows Codex + WSL
ClipFit Go brings the same structured
editing protocol to a standalone Go CLI and local MCP server. It is designed for
Windows Codex desktop users whose repositories live inside WSL:
Codex desktop (Windows) -> wsl.exe -> ClipFit Go MCP -> WSL project files
The Windows app launches ClipFit inside WSL, so matching, backups, and atomic
writes operate on native Linux paths instead of editing through \\wsl$. ClipFit
Go provides exact-match validation, optional anchors, a reviewable
preview -> apply transaction, direct mode for permitted low-risk changes,
create-only file creation, rollback backups, and a mandatory filesystem root.
Set up ClipFit Go for Windows Codex
Build and install the server inside WSL:
cd ~/clipfit-go
go test ./...
go build -buildvcs=false -trimpath -o ~/.local/bin/clipfit .
Add the server to the Windows user-level Codex config, normally
C:\Users\<user>\.codex\config.toml:
[mcp_servers.clipfit]
command = "wsl.exe"
args = ["-d", "Ubuntu-24.04", "--", "/home/user/.local/bin/clipfit", "mcp", "--root", "/home/user"]
startup_timeout_sec = 15
tool_timeout_sec = 60
In Codex desktop, open Settings -> MCP servers, restart ClipFit, and start a
new task if the existing task does not refresh its tool list.
Confirm that clipfit_preview, clipfit_apply, clipfit_edit,
clipfit_create, and clipfit_rollback are available.
The final --root argument is the writable security boundary. Change it to a
single repository path when you want a narrower scope. See the
ClipFit Go repository for mode-selection
policies, full MCP semantics, build instructions, and tests.
🧩 Protocol Example (What it looks like)
This is what your clipboard should look like when copying from the AI:
===REPLACE_BLOCK===
===TARGET===
function oldCode() {
return "buggy";
}
===WITH===
===REMARKNCOLOR=== ===YELLOW=== ===Refactored logic for optimization===
function oldCode() {
return "optimized";
}
===REMARK_END===
===END_REP===
When the same block appears more than once, pin the location with an ===ANCHOR===
(one or more verbatim lines copied from above the target) placed before ===TARGET===:
===REPLACE_BLOCK===
===ANCHOR===
class PaymentService {
===TARGET===
function process() {
return false;
}
===WITH===
function process() {
return true;
}
===END_REP===
Protocol tags are recognized only when they begin a line. Avoid placing exact
ClipFit control tags at the beginning of source lines unless they are part of a
ClipFit response.
Requirements
- Visual Studio Code 1.80 or newer.
- Access to an LLM that can follow the ClipFit protocol. The extension does not
require its own model API key.
Development
npm ci
npm run compile
npm run lint
License
Copyright (c) 2026 Frank Fu (AgentFoundry).
ClipFit for VS Code is licensed under the MIT License.