# VS Code extension (no mount)

The Swarmfile VS Code extension opens a repository without mounting a drive.
It hydrates the branch into a normal folder through the bundled sandbox-sync
client, checkpoints your edits, and shows the agent token spend available to
you beside the code.

Use it when you want a repository in VS Code without installing the desktop
engine, or when a remote/SSH window cannot mount a drive. For a drive-backed
workspace with native file locks, use the [desktop app](https://swarmfile.com/docs/guides/getting-started)
and the [coding-agent workspace guide](https://swarmfile.com/docs/guides/coding-agents) instead.

## Install and connect

The 0.0.2 release is being prepared for the VS Code Marketplace and the direct
downloads page. The Marketplace listing is the recommended path and handles
Marketplace signing/publisher verification; the direct page will offer the
same VSIX for manual installation and a signed Windows MSI that installs it
through your VS Code CLI. The direct VSIX is a ZIP and is not itself
Authenticode-signed; only the Windows MSI is. The links go live with the
release. After installing, run **Swarmfile: Get Started**.

The wizard offers **Sign in with browser** (the site's app-link handoff; no
token to copy) or a personal access token for a self-hosted server. Browser
sign-in is supported in VS Code, VS Code Insiders and VSCodium, whose callback
schemes the site accepts. Other editor builds the site does not recognize, and
remote/SSH setups where the callback cannot reach a window, need a personal
access token instead. It then lists your organizations, repositories and
branches and asks for an empty folder to hydrate. The browser session is
stored in the VS Code secret store and refreshed automatically; changing hubs
requires signing in again.

The repository is addressed by its UUID; the picker fills that in for you.
The hub, organization, capture consent and scan roots are application-scoped,
so a workspace cannot redirect your token or turn on employer-visible
telemetry. The token is bound to the hub it was saved for; changing hubs
requires entering the token again.

## Daily use

- **Sync & Checkpoint** hydrates remote changes and commits local changes in
  one batch. The Source Control view also exposes a **Checkpoint** input.
- **Switch Branch (New Folder)** hydrates another branch into a fresh folder;
  it does not rewrite the current working tree.
- **Open Mounted Repository** opens the installed drive root (`~/Swarmfile`,
  a namespaced `~/Swarmfile-<namespace>`, or `S:\`; set
  `swarmfile.mountRoot` for a non-default location). **Checkpoint Mounted
  Repository** delegates to an absolute, trusted installed CLI path.
  **Repair or Install Desktop App** opens the signed downloads page; the
  extension never runs a system installer, a PATH-resolved tool, or driver
  installation itself.
- **Show Agent Spend** reads the agent-spend summary available to you:
  estimated cost, uncached input, cache reads and writes, output,
  landed/in-review/exploration state, plugin and session tables, budgets, a
  custom window and CSV export. A plain member sees their own attribution; an
  owner or admin sees the organization-wide summary.

## Agent usage and attribution

Capture is **off by default**. Enabling **Swarmfile: Capture Agent Usage Now**
asks for consent, then reads local Claude Code transcripts and Cline/Kilo/Roo task stores
for the hydrated workspace. It posts model, session id, harness, plugin, repository,
branch, timestamps, message/token counts and the workspace folder name to the
organization ledger. Prompts, tool arguments, file content and paths are never
posted. A workspace can opt itself out, and the folder label can be omitted.

The extension skips sessions the desktop engine already records. That check
reads the engine's default cache directory (`~/.cache/swarmfile`, or
`%LOCALAPPDATA%\Swarmfile` on Windows) and a live namespaced directory beside
it. If the engine's data directory is elsewhere or is not detected (for example
it was started with its own `SWARMFILE_CACHE_DIR`), set the same
`SWARMFILE_CACHE_DIR` for the VS Code extension host or point
`swarmfile.agentUsage.engineCacheDir` at the engine's cache directory, or the
same session can be counted twice. A server whose capability profile declares
`agentUsage: false` is shown as unavailable.

Checkpoints can carry `Agent:` and `Swarmfile-Agent-Session` trailers. An
explicit association (or the opt-in auto-association setting) claims the
hub-verified commit. `Install Agent Commit Hook` adds a `prepare-commit-msg`
hook for raw Git commits in a Git repository; the hub claim still needs a
Swarmfile changeset, so the hook adds the display trailers only.

## Limitations

- **Copilot Chat and Cursor** do not expose token usage through the public
  VS Code API, so their sessions remain `unreported`. Codex usage stays on the
  desktop engine path until a plugin adapter ships.
- **Other agent plugins** can call the extension's accounting-only
  `swarmfile.reportAgentUsage` command only after the user enables capture,
  the application-scoped `swarmfile.agentUsage.allowPluginReports` setting,
  stores an adapter token with **Swarmfile: Set Plugin Report Token**, supplies
  it as `bridgeToken` (per-adapter tokens are supported; blank sets the default), and approves the per-report confirmation. The bridge
  refuses the Cline/Kilo/Roo/Claude ids that are read natively; Continue and
  other adapters are not bundled.
- **No auto-install:** the extension does not download or run a system
  installer. Use the signed desktop installer for the drive.
- **The extension has a focused SCM surface:** staged/conflict groups with VS Code
  diffs and quick diff, file history, file-level selective commit, branch/MR
  actions and conflict resolution. Line-hunk partial commit is provided through
  the engine's commit-plan barrier for one regular UTF-8 text file up to
  8 MiB, including a result that empties the file (the command saves the buffer
  first and never writes a partial version to disk); a native merge editor is
  not provided.
- **Authentication:** browser sign-in uses the site's app-link handoff and is
  supported in VS Code, VS Code Insiders and VSCodium; other editor builds the
  site does not recognize, and remote/SSH setups whose callback cannot reach a
  window, need a personal access token. The first-party IdP does not offer an
  authorization-code/PKCE grant, so a self-hosted or automation setup also uses
  a token.

## Related

- [Coding agents](https://swarmfile.com/docs/guides/coding-agents) for mounted, headless workspaces.
- [Git-LFS](https://swarmfile.com/docs/guides/git-lfs) for source in git and assets in Swarmfile.
- [Known limitations](https://swarmfile.com/docs/reference/known-limitations).
