Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>SBAINew to Visual Studio Code? Get it now.
SBAI

SBAI

Preview

Sixten Björling

|
1 install
| (0) | Free
Chat and agent assistance powered by SBAI running locally on your Android device over WiFi.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SBAI

Chat, plan and agent assistance in VS Code — powered by a model running on your own phone.

VS Code License Status Device

SBAI

This extension connects VS Code to the SBAI server, an AI model running on an Android device over your local WiFi. The device holds the model and does the inference; VS Code is the client — a chat panel in the activity bar with streaming answers, editor-context commands and an agent mode that can read and edit files.

Nothing leaves your network. There is no cloud account, no API key and no usage bill: your hardware is the compute, and your repository is the only place your code goes.

Preview (v0.1.0). The wire contract is frozen at SBAI Wire Protocol v1, and the server side is still being aligned with it. Expect rough edges.


Features

  • Chat as an activity-bar view — the SBAI icon opens the conversation. It is a sidebar view, not an editor tab, so there is one chat per window instead of one per column.
  • Real-time token streaming — answers appear as they are generated. Stop cancels mid-stream.
  • Chat / Plan / Agent modes, applied as a system turn on every request, so switching takes effect on the next answer without clearing the chat.
  • Vision — paste or attach images; they travel as inline data URIs and the marker tells the device where each picture belongs.
  • Agent-mode tools — read, list, create files and folders, edit them and delete them, each behind its own approval: a diff before an edit, the contents before a delete.
  • Code commands over the current selection — ask, explain, refactor, generate tests.
  • Model management from the panel: choose which of the phone's models is resident, or open the full list to send and delete models. Models too large for the phone's free RAM are listed separately rather than offered, and one click reveals them with their RAM need shown.
  • Project knowledges — a workspace index built from .gitmodules, the READMEs and the files that pin a toolchain version.
  • Progressive controls — nothing looks ready before it can do anything; unusable controls are dimmed and refuse the click.
  • A status-bar item showing the connection state; clicking it reveals the chat.
  • Configurable endpoint, mode, RAM budget and network settings.

Requirements

VS Code 1.85 or newer
Device An Android device running the SBAI server, with the app running and its server started
Network Both machines on the same WiFi network, with the phone's firewall allowing inbound connections on the SBAI port
Server The SBAI Android server, listening on port 8080 by default

Getting started

1. Start the server on the device

Install the SBAI server APK on your Android device, launch it and start the server. Note the device's IP address under Settings → About phone → Status → IP address.

There is no prebuilt APK yet — build it from source with the step-by-step guide in SBAI → Android App.

# once the APK has been built in the SBAI repository
adb devices
adb install -r <SBAI>/android/app/build/outputs/apk/debug/app-debug.apk

2. Install this extension

Install SBAI from the Visual Studio Marketplace, or from the command line:

code --install-extension sibjor.sbai-vscode

3. Point it at the phone

Set the endpoint to your phone:

{
  "sbai.endpoint": "http://192.168.1.50:8080/completions"
}

4. Pair, connect, chat

Run SBAI: Pair with Device... and enter the code the phone shows. Pairing exchanges the code for a bearer token, stored in VS Code's secret storage. Connect then turns green once the device answers a probe, and the conversation becomes available.

Controls come alive in that order on purpose: Pair devices is the only live control to begin with, Connect and Manage… need a stored token, and the chat itself needs a reachable device.


The chat panel

Modes

Mode Behaviour
ask Answers the question. Proposes no edits.
plan Produces a numbered plan naming the files it touches. Writes no code.
agent May ask to run a tool. Reads (readFile, listFiles) and createDirectory are approved on the path, writes (writeFile, replaceInFile) show a diff first, and deleteFile shows the contents it is about to remove.

Switch with SBAI: Select Mode.... The mode is applied at send time rather than stored in the history, so changing it affects the next answer without clearing the chat.

Tabs

+ in the tab strip opens a new conversation and asks for a name, because a tab is only findable later if it was named when it was made. Double-click a tab to rename it, × to close it.

Each tab carries its own history, transcript, attached images, in-flight request and mode, so several can run at once — a tab behind another keeps streaming and shows a green dot until it is done. A tab is named after its mode (chat: …, plan: …, agent: …); switching the picker changes the tab on screen and the default for the next one. What is not per tab is anything belonging to the device: the model and the connection are shared, because there is one phone and it holds one model.

Closing every tab is allowed, and leaves a New session button rather than a tab that reappears. Sessions live in memory only: they survive the view being hidden, but not a window reload.

Images

Paste or attach an image into the composer. It is sent inline as a data URI with a marker telling the device where in the conversation the picture belongs.


Models

The panel shows the models on the phone, not a catalogue of everything that exists: an empty device means an empty list until you send it something.

  • Download & Send Model... (sbai.downloadModel) fetches a model from the built-in catalogue to a local cache and pushes it to the device.
  • Add Model from URL... (sbai.addModelFromUrl) accepts a direct Hugging Face .gguf URL (huggingface.co / hf.co, /resolve/ paths only). Unverified sources ask for an extra confirmation before anything is downloaded.
  • Models on Phone... (sbai.listModels) lists, activates and deletes what the device holds.
  • sbai.ramBudgetGb caps how much RAM a single model may use. 0 derives it from the device: the lower of 60 % of total RAM and free RAM minus 1 GB headroom.

Large transfers can be slow over WiFi; sending a model writes it to the phone's storage and is not resumable.


Workspace index and assets

Two folders under .sbai/, both plain files in the repository, so git is the history.

.sbai/knowledges.json

An index of pointers, not prose. SBAI: Knowledges... → Update rebuilds it from:

Field Read from
submodules .gitmodules — name, vendored path and URL
repositories those URLs, plus repository links found in any README.md / README.txt
wikis links containing /wiki in the same READMEs
toolchains the files that actually pin a version (NDK, SDK platform, Gradle, Node, the VS Code engine), each with the file it was read from

Entries added by hand are marked "source": "manual" and survive a rebuild.

.sbai/assets/

Media that belongs to the workspace: .svg .png .bmp .wav .flac .mp3 .mp4, kept next to the code that uses it and versioned with it. SBAI: Assets... creates one.

Reference text for the prompt

For material that should be pasted into the prompt rather than indexed, put a sbai/knowledge.json — or sbai/knowledge.txt — at the root of the open folder:

{
  "entries": [
    {
      "id": "build",
      "tags": ["build", "cmake", "ninja"],
      "text": "Android builds with gradlew.bat -p SBAI/android assembleDebug."
    }
  ]
}

The resident model runs a 4096-token context, so the file is selected from, not dumped: entries matching the question are included in score order until roughly 6000 characters are used, and if nothing matches the file is included only when it fits that budget anyway.


Settings

Setting Type Default Description
sbai.endpoint string http://192.168.1.50:8080/completions SBAI server completion endpoint
sbai.model string sbai-default Reserved — SBAI v1 keeps a single model resident
sbai.maxTokens number 2048 Maximum tokens to generate. v1 carries no finish reason, so a small cap truncates a long plan silently
sbai.temperature number 0.7 Sampling temperature
sbai.timeout number 60000 Request timeout (ms) — how long to wait for a response at all (connecting, pairing, transferring)
sbai.stallTimeout number 300000 Idle timeout (ms) during a generation, reset on every token — only a device that has stopped talking is cut off
sbai.toolStepLimit number 12 Tool round-trips one Agent-mode message may take
sbai.stream boolean true Enable raw token streaming
sbai.autoConnect boolean false Connect on startup
sbai.openOnStartup boolean true Reveal the SBAI chat when a window opens
sbai.modelsDirectory string "" Where GGUFs are cached before being pushed to the device; empty uses the extension's global storage
sbai.ramBudgetGb number 0 RAM one model may use, in GB. 0 derives it from the device
sbai.mode string ask Mode a new tab starts in. Each tab keeps its own

Commands

Command ID
SBAI: Open Chat sbai.openChat
SBAI: Clear Chat sbai.clearChat
SBAI: Ask About Selection sbai.askSelection
SBAI: Explain Code sbai.explain
SBAI: Refactor Code sbai.refactor
SBAI: Generate Tests sbai.generateTests
SBAI: Select Mode... sbai.selectMode
SBAI: Connect sbai.connect
SBAI: Disconnect sbai.disconnect
SBAI: Find Device... sbai.findDevice
SBAI: Pair with Device... sbai.pairDevice
SBAI: Forget Device sbai.forgetDevice
SBAI: Re-check Device sbai.refreshDevice
SBAI: Download & Send Model... sbai.downloadModel
SBAI: Add Model from URL... sbai.addModelFromUrl
SBAI: Models on Phone... sbai.listModels
SBAI: Send Model to Device sbai.sendModel
SBAI: Activate Model sbai.activateModel
SBAI: Delete Model from Device sbai.deleteModel
SBAI: Set RAM Budget for Models sbai.setRamBudget
SBAI: Add Knowledge... sbai.addKnowledge
SBAI: Knowledges... sbai.knowledges
SBAI: Update Knowledges sbai.updateKnowledges
SBAI: Assets... sbai.assets
SBAI: Manage... sbai.manage

Staying in sync

HTTP has no connection to watch, so neither side can be told the other has gone. Both sides therefore rely on a beat defined in Protocol §12.4:

  • The extension sends one authenticated request every 5 seconds for as long as it holds a token. GET /models is the request, because it is the cheapest one that passes the auth gate and refreshes the model picker on the way.
  • The phone drops a token it has not seen for 60 seconds — twelve missed beats.
  • A 401 on a beat means the device has forgotten this client: the token is dropped, the panel dims back to "Not paired", and the offer to pair again appears once.

Troubleshooting

Symptom Likely cause Fix
ECONNREFUSED Server not running, or the wrong port Start SBAI on the phone and check the port
Request times out Different WiFi network, or a firewall in the way Put both devices on the same network
Empty stream Streaming disabled on the server Set sbai.stream to false, or update the server
"Pairing required" The device has no token for this client Run SBAI: Pair with Device...
Models list is empty Nothing has been sent to the phone yet Send a model with Download & Send Model...
SBAI icon missing The window has not loaded the extension Reload the window (Developer: Reload Window)
SecurityError / UnauthorizedAccess when building on Windows PowerShell blocks npm.ps1 Use npm.cmd (or Set-ExecutionPolicy -Scope CurrentUser RemoteSigned)

Verify the device is reachable

Any HTTP response — including a 400 — means the server is up:

curl -s -o /dev/null -w "%{http_code}\n" -X POST http://192.168.1.50:8080/completions \
  -H "Content-Type: application/json" -d '{"messages":[]}'

The API is documented in full in PROTOCOL.md, including the curl and PowerShell equivalents.


Develop from source

git clone https://github.com/sibjor/SBAI_VSCode
cd SBAI_VSCode
npm install
npm run build      # or: npm run watch
npm test
npm run lint

Press F5 to launch an Extension Development Host. To run without the phone, start the bundled mock server and point sbai.endpoint at it:

npm run mock                       # http://127.0.0.1:8080
npm run mock -- --delay 60 --port 9000

Connect should turn green (the reachability probe gets the expected 400) and a chat message should stream back token by token. The mock server is a test tool only (tools/mock-server.js); the real server lives in sibjor/SBAI.


Documentation

  • PROTOCOL.md — the frozen wire contract, shared byte-for-byte with the SBAI server repository.
  • ARCHITECTURE.md — system design and data flow.
  • ROADMAP.md — planned phases and milestones.
  • TODO.md — actionable task checklist.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft