Autonomy is a VS Code extension that intercepts every Claude Code API call in real time, letting you visualize the full context window as an interactive bar chart, delete or edit individual message sections, and optionally hold requests for your approval before they reach Anthropic.
Built for BearHacks 2026.
Claude Code → localhost:8080 (FastAPI proxy) → api.anthropic.com
↕ WebSocket
VS Code Extension (Autonomy panel)
The proxy sits between Claude Code and Anthropic. Every request is classified into typed sections (system prompt, tool definitions, conversation turns, tool calls/outputs, images, thinking blocks), token-counted, and streamed to the VS Code webview over WebSocket. You can delete or edit sections before they are forwarded. An optional local Gemma model (via Ollama) highlights redundant or low-value content.
| Requirement | Version |
|---|---|
| Node.js | 18+ (LTS recommended) |
| Python | 3.12 or 3.13 |
| VS Code | 1.85+ |
| Ollama (optional) | latest — for AI flagging |
git clone <repo-url>
cd Bearhacks26cd backend
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtCopy the example env file and fill in your values:
cp .env.example .envThe defaults work out of the box. If you have a Backboard.io account add those keys; everything else is optional.
ANTHROPIC_UPSTREAM_URL=https://api.anthropic.com
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=gemma4:e4b
PROXY_PORT=8080
ollama pull gemma4:e4bSkip this if you don't have Ollama — the extension works fine without it.
cd ../frontend
npm install
npm run buildThis produces frontend/dist/ which the extension serves as a webview.
cd ../extensions
npm install
npm run compileYou have two options — pick A for quick development or B to install Autonomy permanently in your main VS Code.
Best for hacking on the code: changes recompile and reload quickly.
- Open the
extensions/folder in VS Code:code extensions/
- Press F5 (or go to Run → Start Debugging).
This launches an Extension Development Host — a second VS Code window with Autonomy loaded. The extension only exists inside this dev window.
This packages the extension and installs it into your real VS Code so it's available in every window, every project, every time you launch VS Code.
-
Install the VS Code extension packager (one-time, global):
npm install -g @vscode/vsce
-
Build the
.vsixfrom theextensions/directory:cd extensions npm run compile vsce package --allow-missing-repositoryThis produces
autonomy-0.0.1.vsixin theextensions/folder.If
vscecomplains about"private": trueinpackage.json, open extensions/package.json and either remove that line or change it to"private": false, then re-run. -
Install the
.vsixinto VS Code — pick whichever you prefer:Via the CLI:
code --install-extension autonomy-0.0.1.vsix
Via the VS Code UI:
- Open the Extensions sidebar (
Cmd+Shift+X/Ctrl+Shift+X) - Click the
…menu in the top-right of the sidebar - Choose
Install from VSIX…and pickautonomy-0.0.1.vsix
- Open the Extensions sidebar (
-
Reload VS Code (
Cmd+Shift+P→Developer: Reload Window). Autonomy is now installed permanently.To upgrade later, rebuild the
.vsixand re-runcode --install-extension. To remove it, find Autonomy in the Extensions sidebar and click Uninstall.
In whichever VS Code window has Autonomy loaded (the Extension Development Host for Option A, or any window for Option B):
- Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Run
Autonomy: Open Panel
The panel opens beside your editor and the proxy starts automatically on port 8080.
Note for Option B: the extension still expects the
backend/andfrontend/dist/folders to live inside your currently open workspace. If you want Autonomy available across arbitrary projects, set absolute paths in your VS Code user settings — see Extension settings below.
In every terminal where you run Claude Code, set:
export ANTHROPIC_BASE_URL=http://localhost:8080
claudeOr add it to your shell profile (~/.zshrc / ~/.bashrc) so it's always active:
echo 'export ANTHROPIC_BASE_URL=http://localhost:8080' >> ~/.zshrc
source ~/.zshrcAll settings live under autonomy.* in VS Code settings (Cmd+,):
| Setting | Default | Description |
|---|---|---|
autonomy.proxyPort |
8080 |
Port the FastAPI proxy listens on |
autonomy.autoStartProxy |
true |
Auto-start the proxy when the panel opens |
autonomy.backendDir |
(auto) | Absolute path to backend/ — leave blank to auto-detect |
autonomy.pythonPath |
(auto) | Python interpreter path — defaults to backend/venv/bin/python |
autonomy.webviewDistDir |
(auto) | Path to built React app — defaults to frontend/dist |
If you prefer to run the proxy yourself rather than letting the extension manage it:
cd backend
source venv/bin/activate
uvicorn main:app --host 127.0.0.1 --port 8080 --reloadThen in the extension settings set autonomy.autoStartProxy to false.
cd frontend
npm run devOpen http://localhost:5173?mock=1 to use the mock harness without a live proxy.
cd extensions
npm run watch # auto-recompile on saveThen press Cmd+Shift+F5 in VS Code to reload the Extension Development Host.
Command Palette → Autonomy: Restart Backend Proxy
Bearhacks26/
├── backend/ FastAPI proxy — intercepts, classifies, gates requests
│ ├── main.py App entry point + WebSocket endpoint
│ ├── interceptor.py POST /v1/messages handler
│ ├── classifier.py Section classification
│ ├── gating.py Hold/approve/cancel state machine
│ ├── gemma/ Ollama integration for AI flagging
│ └── backboard/ Optional RAG memory system
├── frontend/ React + Vite webview
│ └── src/
│ ├── App.tsx Root component
│ ├── components/ BarChart, EditorPanel, StatusBar, …
│ └── hooks/ useWebSocket, useSelection, useUndo
└── extensions/ VS Code extension
└── src/
├── extension.ts Activation + commands
├── proxy-manager.ts Spawns/kills uvicorn
├── webview-provider.ts Serves frontend/dist in a panel
└── websocket-client.ts Bridges extension ↔ proxy
Backend — Python 3.12, FastAPI, uvicorn, httpx, tiktoken, websockets, pydantic, Ollama SDK
Frontend — React 19, TypeScript, Vite, Monaco Editor, Recharts, Motion
Extension — VS Code Extension API, TypeScript, ws
