# Local Autocomplete for VS Code Inline code completion from a small fine-tuned model running **on your machine**. It's tuned for TypeScript, Vue and Node.js. ## Getting started 1. Install the VSIX from the [Releases](https://git.harvmaster.com/Harvmaster/autocomplete-model/releases) page: `code --install-extension local-autocomplete-.vsix`. 2. Open a TypeScript or Vue file. The first time, the model (~530 MB) and llama.cpp are downloaded and verified (a progress notification shows this), and a background daemon starts. 3. Type. **Tab** accepts the ghost text; **Ctrl/Cmd+→** accepts it word by word. Turn off other inline-completion providers (e.g. Copilot) so they don't compete. With **Remote-SSH**, install the extension in the remote window: the model and daemon then run on the remote machine, next to your code. ## The status bar `AC: simple · 38 ms`. Click it to: - **Switch context mode:** `symbols` (available symbols from the TypeScript language service), `simple` (repo + path only), or `raw`. Only modes the current model was trained for are offered. - **Switch model:** downloaded on first use. - **Turn completions on/off**, **restart the daemon**, or **open its log**. ## How the daemon runs (managed mode) - **One daemon for every window.** The extension bundles the daemon and runs it on VS Code's own Node runtime, so there's nothing to install. It exits after `daemon.idleShutdownMinutes` (default 30) once no window is using it. - **Downloads are verified.** They're SHA-256 checked, resume if interrupted, and are stored in the extension's global storage. - **Updates are automatic.** After an extension update, or a change to model/daemon settings, the daemon is replaced. - **Your own daemon is left alone.** If something you started yourself already listens on `daemon.port`, it's used as-is and never stopped. Custom setups: - `modelPath` (+ `modelProfile`): use a local `.gguf`. - `llamaServerPath`: use your own `llama-server`, e.g. Homebrew's. - `daemon.mode: "external"` + `serverUrl`: use a daemon you run yourself, possibly on another machine. See [daemon/](../../daemon). ## Edit recording (opt-in) `localAutocomplete.recordEdits: true` records your edits, cursor moves and file switches to local JSONL files, as training data for future next-edit prediction. It never records excluded files, and nothing leaves your machine. Every event is tagged with the editor app. - **Recording only:** `enableCompletions: false` + `recordingDir: "~/…"` records without showing completions and without a daemon. - **In Cursor:** Cursor's terms (§1.5) prohibit using its Tab suggestions to train a competing model, and accepted suggestions end up in the recording. Turn Cursor Tab off while recording. ## Privacy Files matching `excludeGlobs` (`.env*`, keys, `secrets/`, … by default) are never read or sent. Completions run locally. Telemetry and recording are off unless you enable them. ## Development From the repo root, `npm run setup && npm run build` produces `local-autocomplete-.vsix`. - `npm test` runs the logic unit tests. - `npm run test:managed` tests the download/daemon lifecycle against a local server. - `src/logic.ts` is the testable core, `src/managed-core.ts` handles downloads and the daemon lifecycle, and `src/extension.ts` is the VS Code glue. - `build-daemon.mjs` bundles `../../daemon` + `../../shared` into `dist/daemon`.