> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Edge Studio for VS Code

> Install Ditto Edge Studio for Visual Studio Code to connect to Ditto databases, run DQL, encrypt local storage, inspect sync and metrics, and collect diagnostic logs and support bundles.

**Ditto Edge Studio** is a Visual Studio Code extension for debugging and inspecting Ditto databases. Register a database, connect from inside the editor, manage sync subscriptions and indexes, watch peers in real time, run ad-hoc DQL queries, and let AI agents work with your data through MCP — all without leaving VS Code. It also runs in Grok Build (Cursor) and Google Antigravity, which share VS Code's extension format.

## Requirements

* Desktop VS Code **1.106 or later**, or a compatible editor such as Grok Build (Cursor) or Antigravity with a native extension host and filesystem access
* A Ditto database ID and token. Ditto Cloud users can find these in the [Ditto Portal](https://portal.ditto.live).
* macOS on Apple silicon, Linux on x64 or arm64, or Windows on x64

## Install the extension

Once the extension is available in Visual Studio Marketplace, open **Extensions** in VS Code, search for `DittoLive.ditto-vsce`, and select **Install**. You can also install it from a terminal.

```bash theme={null}
code --install-extension DittoLive.ditto-vsce
```

Use a platform-specific `.vsix` to install in Grok Build (Cursor) or Antigravity, or if the extension is unavailable in your marketplace. You can download it from the [latest GitHub Release](https://github.com/getditto/vsc-es/releases/latest) if you have access to the repository.

| Platform | Asset filename |
| - | - |
| macOS (Apple silicon) | `ditto-vsce-darwin-arm64-<ver>.vsix` |
| Linux (x86\_64) | `ditto-vsce-linux-x64-<ver>.vsix` |
| Linux (ARM64) | `ditto-vsce-linux-arm64-<ver>.vsix` |
| Windows (x86\_64) | `ditto-vsce-win32-x64-<ver>.vsix` |

Then install it with your editor's UI or CLI:

* **VS Code** — Extensions sidebar → `…` (More Actions) → **Install from VSIX…**, or run `code --install-extension /path/to/ditto-vsce-<target>-<ver>.vsix`
* **Grok Build (Cursor)** — same UI flow, or `cursor --install-extension /path/to/ditto-vsce-<target>-<ver>.vsix`
* **Antigravity** — same UI flow, or `agy --install-extension /path/to/ditto-vsce-<target>-<ver>.vsix`

If the Ditto icon doesn't appear in the activity bar after installation, open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and run **Developer: Reload Window**.

> [!WARNING]
>
> Intel Mac (`darwin-x64`) and Windows on ARM (`win32-arm64`) are not supported — the Ditto SDK does not ship binaries for those targets.

> [!NOTE]
>
> If you installed an earlier build as `ditto.ditto-vsce`, register your connections again in `DittoLive.ditto-vsce`. The earlier build keeps its own saved connections and local database files.

## Open the extension

Click the **Ditto** icon in the VS Code Activity Bar to open the Ditto sidebar. It contains three views:

* **Connections** — register and open databases. After you connect, a database's rows provide access to subscriptions, collections, observers, Presence, the Query Editor, metrics, the Log Analyzer, and data import.
* **Logging** — log levels, the Output channel, log export, and the log pattern editor. See [Logging and bug reports](#logging-and-bug-reports).
* **Help** — the Welcome guide, **Get Quickstarts**, links to What's New, the Ditto documentation, the Ditto Portal, and the quickstart repos, plus **Suggest a Feature**, **Report a Bug**, and **Reset Warnings**.

If the Ditto icon is not visible, right-click the Activity Bar and enable **Ditto**, or open the Activity Bar's **…** menu and select Ditto.

**Command Palette:** run **Ditto: Welcome** to open the guided welcome screen.

## Use the Command Palette

The Command Palette gives you a keyboard-driven way to run Ditto actions. Open it with `Cmd+Shift+P` on macOS or `Ctrl+Shift+P` on Windows/Linux, then type `Ditto:` to filter the extension's commands. Each section of this page lists the commands that apply to that feature.

| Area | Commands |
| - | - |
| Setup | **Ditto: Register Connection…**, **Ditto: Welcome**, **Ditto: Get Quickstarts…** |
| Data and sync | **Ditto: New Subscription…**, **Ditto: Import Subscriptions from Server…**, **Ditto: New Observer…** |
| Inspector | **Ditto: Toggle Inspector** (`Cmd+Alt+I` / `Ctrl+Alt+I`) |
| Diagnostics | **Ditto: Open Debug Console**, **Ditto: Open Log Analyzer**, **Ditto: Manage Log Patterns**, **Ditto: Collect Support Bundle (dial9)…** |
| Logging | **Ditto: Set Application Log Level**, **Ditto: Set Ditto SDK Log Level**, **Ditto: Open Output Channel**, **Ditto: Export Logs for Bug Report…**, **Ditto: Export SDK Logs (gzip)…**, **Ditto: Show Log File in Finder**, **Ditto: Clear Application Log…**, **Ditto: Reset Warnings** |
| MCP | **Ditto: Start MCP Server**, **Ditto: Stop MCP Server**, **Ditto: MCP Server Status**, **Ditto: Copy MCP Client Config** |

Commands that create something — such as **Ditto: New Subscription…** and **Ditto: New Observer…** — act on the **active connection**. Connect a database first; otherwise the command asks you to open a connection.

Actions that operate on a specific tree item are hidden from the Command Palette because they need a selected row. These include **Connect**, **Disconnect**, **Edit Configuration**, **Delete**, **Open Presence**, **Open Query Editor**, the metrics panels, **Import Data…**, **Add Index…**, **Delete Index**, and subscription and observer edit/delete. Use the row in the **Connections** tree, its inline buttons, or its right-click context menu.

## Register a connection

> [tab] Sidebar
>
> **1. Open the Ditto view**
>
> Click the Ditto icon in the activity bar.
>
> **2. Add a connection**
>
> Click the **+** button in the **Connections** view title bar. When you have no connections yet, you can also click **Register Connection…** in the empty view. Fill in the registration form and click **Save**.
>
> **3. Connect**
>
> Right-click the new row and choose **Connect**. The status dot turns green when sync is active, and the row expands to show subscriptions, collections, observers, and feature rows such as **Presence** and **Query Editor**.

> [tab] Command Palette
>
> **1. Open the registration form**
>
> Open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and run **Ditto: Register Connection…**.
>
> **2. Save the connection**
>
> Fill in the registration form and click **Save**. The connection appears in the **Connections** view.
>
> **3. Connect**
>
> Right-click the new row in the **Connections** view and choose **Connect**. Connecting requires a selected connection, so it is not available from the Command Palette.

The registration form supports two authorization modes:

| Field | Server mode | Small Peers Only mode |
| - | - | - |
| **Name** | A label for the connection in the tree | Same |
| **Database ID** | The ID of your Ditto database | Same |
| **Token** | Development token from the Ditto Portal | Offline token |
| **URL** | Copy the **URL** field under **Connect via SDK** in the Portal (`REPLACE_ME_WITH_YOUR_URL`), including its scheme. For a self-managed Ditto Server, use the server's URL. | — |
| **HTTP API URL** and **HTTP API Key** | Optional. Use the host and port from **Cloud URL Endpoint** (`{YOUR_CLOUD_URL_ENDPOINT}`) under **Connect via HTTP** and enter the API key in its own field. These fields enable HTTP queries and **Import from Server…** for subscriptions. | — |
| **Shared Secret Key** | — | Optional shared-secret key for peer-to-peer-only meshes |
| **Enable DQL Strict Mode** | Optional [DQL strict mode](https://docs.ditto.live/dql/strict-mode.md) enforcement | Same |

For a self-managed Ditto Server that serves plain HTTP, include `http://` in **URL**. Sync and HTTP queries use the corresponding unencrypted transports. Use HTTPS for connections that carry credentials over a network.

The extension keeps credentials in VS Code Secret Storage and connection settings in VS Code's global state.

### Encrypt a local database

1. While registering a new connection, expand **Advanced Configuration** and select **Encrypt local database**.
2. In **Encryption key (optional)**, enter a Base64-encoded 32-byte key or leave the field blank to generate a key.
3. Select **Save** and connect. VS Code Secret Storage keeps the key for subsequent connections.

Encryption protects the database files stored by this connection on your machine. Enabling encryption or changing the key for an existing connection requires a new local store. To check an encrypted connection, open **Edit Configuration → Advanced Configuration** and look for its encryption status.

### Configure sync scopes and startup settings

Under **Advanced Configuration**, use **Collection Sync Scopes** to choose [where a collection can sync](https://docs.ditto.live/sdk/latest/sync/sync-scopes.md). Use **Startup System Settings** to set [Ditto system parameters](https://docs.ditto.live/sdk/latest/sync/using-alter-system.md) before sync and subscriptions start. Save any changes, then disconnect and reconnect to apply them to an active connection.

### Manage connections

Right-click a connection row to **Connect**, **Disconnect**, **Edit Configuration**, or **Delete** it. Only one connection is active at a time; connecting to a different database asks for confirmation, closes the previous database's panels, and rolls back to the previous connection if the new one fails. Deleting a connection also removes its subscriptions, observers, query history, favorites, and local data directory.

## Open the Ditto Inspector

The **Ditto Inspector** is a contextual documentation and data panel in VS Code's **Secondary Side Bar** on the right side of the window. It follows the feature you are currently using, so its contents change when you move between the Query Editor, Presence Graph, subscriptions, observers, metrics, and Log Analyzer.

**1. Open a database feature**

Connect a database, then open a feature such as **Query Editor** or **Presence** from the Connections tree. The Inspector may open automatically the first time you open a feature panel.

**2. Choose Ditto Inspector**

If the Secondary Side Bar shows Chat or another agent view, click its **…** overflow button and select **Ditto Inspector**. If the bar is hidden, enable it from **View → Appearance → Secondary Side Bar** first.

**3. Read contextual help**

Select the **Help** tab in the Inspector. The help changes with the focused screen and explains the controls and Ditto concepts for that feature.

The Query Editor, Presence, and subscription editor panels also show an Inspector button in the editor title bar.

**Command Palette:** run **Ditto: Toggle Inspector**, or press `Cmd+Alt+I` on macOS and `Ctrl+Alt+I` on Windows/Linux.

## Subscriptions

Subscriptions tell Ditto which documents to keep in sync — a saved DQL `SELECT` query whose matching documents replicate from any reachable peer. See [Syncing Data](https://docs.ditto.live/key-concepts/syncing-data.md) for the concepts.

* **Create** — hover the **Subscriptions** row under a connected database and click **+**. When the connection has an HTTP API URL and key, you choose between **New Subscription…** and **Import from Server…**, which bulk-imports the subscriptions your Ditto Server already knows about.
* **Edit** — click the subscription's row, or right-click it → **Edit Subscription**. The saved query is re-registered with the SDK immediately.
* **Delete** — right-click the row → **Delete Subscription**.

**Command Palette:**

* **Ditto: New Subscription…** — creates a subscription on the active connection. When HTTP API credentials are configured, it offers the same choice between writing a subscription and importing one from the server.
* **Ditto: Import Subscriptions from Server…** — opens the import flow directly for the active connection. It requires the HTTP API URL and key on that connection.

Subscriptions persist per-database across reconnects; deleting the connection wipes them.

Once a subscription is registered, matching documents stream into the local store as peers with matching data become reachable. The collection then appears in the tree — a collection only shows up once at least one of its documents lives locally — and its document count increments live as data arrives.

## Collections and Indexes

Collections appear in the Connections tree as documents land locally (see [Subscriptions](#subscriptions)). Expand a collection to see its documents and indexes. Right-click a collection → **SELECT \* FROM …** to open the Query Editor pre-filled with a query for that collection.

Indexes accelerate frequently-filtered ad-hoc queries — note that subscription queries do **not** use indexes, only ad-hoc queries do.

```sql theme={null}
-- View existing indexes
SELECT * FROM system:indexes

-- Create an index
CREATE INDEX IF NOT EXISTS idx_tasks_status ON tasks (status)

-- Drop an index
DROP INDEX IF EXISTS idx_tasks_status ON tasks
```

To add an index, right-click a collection → **Add Index…**, or hover its **Indexes** row and click **+**. To remove one, right-click an index row → **Delete Index**, or click its inline trash icon. Both flows confirm before mutating. Index actions need a selected collection or index, so they are not available from the Command Palette. See [Indexing](https://docs.ditto.live/dql/indexing.md) for the full rules.

### Import data

To bulk-load documents, click the **Import Data** row under a connected database, or right-click a collection → **Import Data…** to preselect that collection. Import requires an active connection to the database and is available only from the tree.

## Query Editor

The Query Editor reads, writes, and inspects data using **Ditto Query Language (DQL)**. Open it from the **Query Editor** row under a connected database, then press `Cmd+Enter` / `Ctrl+Enter` to run the query under the cursor. For the full language reference, see the [DQL documentation](https://docs.ditto.live/dql/dql.md).

Run [`ADVISE`](https://docs.ditto.live/dql/advise) before a `SELECT` to see the planner's index recommendations. The editor shows each recommendation with its reason and a ready-to-run `CREATE INDEX` statement; creating the index asks for confirmation and refreshes the Connections tree.

### Execution modes

The **Run on** dropdown picks where a query executes. It only appears when more than one mode is available for the connection.

| Mode | Where it runs | Requires |
| - | - | - |
| **Local** | The active SDK store on this device | Active connection |
| **HTTP** | The Ditto Server's REST API (`/api/v5/store/execute`) | HTTP API URL **and** HTTP API key set on the connection |

The Metrics tab shows **Location: Local Database** or **Location: HTTP** above each result, so a slow query reads as "different transport" rather than "same query got slower."

### Result views

Results appear in one of three views:

* **JSON** — full documents, syntax-highlighted, with fold gutters and word-wrap. Click inside a top-level document to select that row.
* **Table** — a flat projection with one column per top-level field, unioned across heterogeneous documents. Large result sets are paged client-side, so multi-thousand-row queries don't freeze the editor.
* **Profile** — visualizes Ditto's [`PROFILE`](https://docs.ditto.live/dql/profile) execution plan as nested cards or a top-down tree for local `SELECT` queries. It highlights CPU bottlenecks and shows time spent waiting on the store, scheduler yields, skipped documents, and inner plans for joins when the SDK reports them.

The settings cog in the toolbar toggles **Capture profiling data** and **Capture query metrics**. When off, the matching tabs disappear and the per-query SDK overhead is skipped. Both are user-scope settings (`dittoVsce.collectProfiling`, `dittoVsce.collectMetrics`), so the choice travels across workspaces.

### Working with rows

* **Single-click** a row to mirror its full JSON into the Inspector's JSON tab.
* **Double-click** to select the row *and* switch the Inspector to the JSON tab.
* **Right-click** a row to add or remove [attachments](https://docs.ditto.live/sdk/latest/crud/working-with-attachments.md) on that document. Attachment flows require an active local connection and a string `_id`; files over 20 MB are refused.

## Inspector contents

The Inspector tracks the focused panel. Its **Help** tab is available for the Query Editor, subscriptions, Presence, Query Metrics, Database Metrics, System Metrics, observers, Log Analyzer, and Manage Log Patterns. The documentation is built into the extension, so it remains available while you investigate a database.

When the Query Editor has focus it exposes five tabs:

| Tab | What it shows |
| - | - |
| **History** | Every query run on this connection. Click to reload, right-click to favorite or delete. |
| **Favorites** | Queries starred with the Favorite button. |
| **JSON** | Full JSON of the selected row, with attachment detection and fetch. |
| **Metrics** | Last query's execution time, row count, run location, and [`EXPLAIN`](https://docs.ditto.live/dql/explain) plan. Hidden when metrics collection is off. |
| **Help** | Contextual help for the focused panel. |

History and Favorites persist per-database and survive disconnect/reconnect. The JSON viewer scans selected documents for attachment tokens. You can preview images inline or save an attachment to disk. To replace a file, select the existing file in the save dialog and confirm the replacement. See [Open the Ditto Inspector](#open-the-ditto-inspector) if the Inspector is not visible.

## Observers

An observer registers a live DQL `SELECT` query against the local store and fires an event whenever matching documents are inserted, updated, deleted, or reordered — whether the change came from a local write or a sync from a remote peer.

* **Create** — hover the **Observers** row under a connected database and click **+**, or right-click it → **Ditto: New Observer…**.
* **Open** — click the observer's row, then click **Activate** in the panel toolbar.
* **Edit** — right-click the row → **Edit Observer**.
* **Delete** — right-click the row → **Delete Observer**, or click its inline trash icon.

**Command Palette:** run **Ditto: New Observer…** to create an observer on the active connection. Opening, editing, and deleting an observer require its row in the tree.

The events table records each firing with its match count and inserted/updated/deleted/moved diffs; selecting an event shows the documents in a JSON or Table view, filterable to just the inserted or updated items.

> [!WARNING]
>
> Observers are expensive: each active observer keeps result data materialized and runs a diff calculation on every change. Observers are intentionally **inactive** when their panel opens — activate them explicitly, and stop them when you're done. Closing the panel stops the observer automatically.

## Presence and peer listing

The Presence panel surfaces the live mesh — every device the app is currently aware of, the transports each connection is using, and how data is flowing. See [Mesh Networking](https://docs.ditto.live/key-concepts/mesh-networking.md) and [Using Mesh Presence](https://docs.ditto.live/sdk/latest/sync/using-mesh-presence.md) for the underlying concepts.

Open it by clicking the **Presence** row under a connected database. The panel is tied to a specific database, so it is not available from the Command Palette.

### Connected Peers

The **Connected Peers** tab shows a live card for the local peer and each directly connected remote peer. Cards include the device name, OS, SDK version, sync status, active connection types, synced commit, and last update. Ditto Cloud Server appears as a WebSocket peer when cloud sync is active. The **Local Network** section shows the interfaces and addresses available on your machine; use its refresh button to rescan them.

### Presence Graph (Presence Viewer)

The **Presence Graph** tab draws peers as nodes and transports as color-coded edges. Use it to spot topology problems, such as one device acting as a hub for all the others or a connection silently downgrading from LAN to Bluetooth LE.

The **Direct** toggle in the top-right of the graph controls which peers appear:

* **On (default)** — shows only peers with a direct connection to the local device, and only the connections from the local device. This is the most readable view.
* **Off** — shows the full mesh, including multi-hop peers and connections between remote devices. The rings spread wider to give connection lines room.

#### Search for a peer

Type a device name or peer ID in the search box (case-insensitive). Matching peers and their connections stay highlighted while unrelated peers dim, and matches are listed below the box. Select a result, or press **Enter** for the first result, to focus the graph on that peer; **Direct** turns off automatically if needed. The search text is kept so you can move between results. Press **Escape** or clear the box to restore the normal graph.

#### View peer details

The peer detail card shows everything the presence graph reports about a peer: its peer key, OS, Ditto SDK version, cloud link, compatibility, and metadata key counts, plus sync progress when available.

* **With Direct on** — click a remote peer. That peer, the local device, and the connections between them stay highlighted, and its detail card opens. Click another peer to swap the card. Click the selected peer again, or click empty canvas, to close the card and clear the selection.
* **With Direct off** — click a peer in the full mesh to open a focused view of its neighborhood. Then click any peer in the focused view, including the focused peer itself or **Me**, to open its detail card. Click **Focus this peer** on a card to move the focus to that peer.

The full peer key wraps below its label. Click the copy icon next to it to copy the complete key to your clipboard; **Copied** confirms the copy.

Commit and last-update rows come from the local sync table, so they exist only for directly connected peers. Indirect peers show that they have no direct sync session, and **Me** shows **This device**.

To close a card, click the same peer again, press **Escape**, or click empty canvas. In the focused view, clicking empty canvas closes an open card and keeps the focus; clicking it again with no card open exits the focused view. The **✕** in the focus banner exits the focused view and closes any card. A card closes automatically when its peer leaves the mesh or when you change the **Direct** mode.

When a card and a search are both active, the first **Escape** closes the card and a second **Escape** clears the search.

#### Navigate the graph

Drag nodes to reposition them, drag empty space to pan, use **+** and **−** or the mouse wheel to zoom, and use the reset control to recenter the view at 100% zoom. Exiting a focused view restores the full mesh's earlier pan and zoom. You can hide the graph controls or background effects when you need a less busy view.

> [!NOTE]
>
> A fully connected mesh of more than a handful of peers produces crossing lines no matter how it's laid out. The full-mesh view is meant for topology debugging — confirming a path exists between two devices or diagnosing a partition — so use search and focused neighborhoods to isolate a peer or connection path.

### Transports and sync

* **Transport configuration** — the cog opens switches for the transports supported by the current platform: LAN, Bluetooth LE, and AWDL. Applying a change temporarily stops sync, updates the live configuration, and restarts sync; you remain connected to the same database. Use it to reproduce failover behavior or validate firewall rules.
* **Start / Stop Sync** — take the local peer out of the mesh without disconnecting the database.

## Query Metrics

The Query Metrics panel keeps a running history — up to 200 records, in memory, per connection — of every DQL query you've executed alongside its `EXPLAIN` plan. Each row shows a timestamp, a **Local/HTTP** location pill, a color-coded latency pill, and an index dot indicating whether the plan mentions an index. Use it to compare two versions of a query side by side or to spot why a query that used to be fast got slow.

Open it from the **Query Metrics** row under a connected database. The row is hidden when `dittoVsce.collectMetrics` is off.

## Database Metrics

The Database Metrics panel breaks down how much disk space a connection is using and where. It computes on demand — open the panel from the **Database Metrics** row for a snapshot, then click **Refresh** for fresh numbers.

On-disk usage is bucketed into **Store** (the SQLite document store), **Replication** (sync state), **Attachments**, **Auth**, **WAL/SHM** (write-ahead log), **Logs**, and **Other**. A second table lists every user collection by document count and total CBOR payload size — the wire format, and therefore a good approximation of what a fresh peer would have to pull down to replicate that collection.

Each connection's data lives at `<VS Code globalStorage>/dittoData/<connectionId>/`.

## System Metrics

The **System Metrics** panel displays every metric series the SDK reports through the `system:metrics` virtual collection. Open it from the **System Metrics** row, which sits between **Database Metrics** and **Log Analyzer** under a connected database.

Each row shows the metric name, its labels, and the change since the last poll. Counters show the total since connection. Gauges show the current value, and timestamps such as last peer activity appear as elapsed time. When the SDK reports an aggregate for a metric, it appears as one row. Metrics poll every 5 seconds while the panel is visible. Select **Refresh** for an immediate update.

* **Filter by topic** — select **All**, **Discovery**, **Network**, **Sync**, **Transport**, **Store**, **Query**, or **Peer**. **Query** includes `ditto.query.*` and the legacy `dql.*` series.
* **Search** — type in the filter box to narrow the list by metric name or label, case-insensitively. For example, `ble` finds every `transport=ble` series. Search combines with the namespace filter.
* **Show details** — click a row's **ⓘ** icon to expand its description, kind, unit, and full metric name. Histograms also show the average and absolute maximum since connect.
* **Pin series** — click the pin icon on a row to add it to the **Pinned** section above the segment control. Pinned series appear regardless of the namespace filter or search, persist per connection across restarts, and can be reordered by dragging. Click **Clear** to remove all pins.

> [!NOTE]
>
> System metrics collection is controlled by `dittoVsce.collectSystemMetrics` and is applied when the SDK opens. After changing the setting, disconnect and reconnect the database for the change to take effect.

## Log Analyzer

The Log Analyzer is a live triage tool for a connected database. It watches every log line the SDK and the extension emit for the connection, scans them against a catalog of known problem patterns, and surfaces severity-ranked counts, histograms, and a searchable virtualized log table. Each connection gets its own panel, which closes automatically on disconnect.

Open it by clicking the **Log Analyzer** row under a connected database. The **Ditto: Open Log Analyzer** command appears in the Command Palette, but because the analyzer is scoped to a database, running it from the palette only reminds you to open it from the database row.

On open, the panel backfills from the on-disk log file (`ditto-edge-studio.log` plus rotated files), filtered to lines after the database's most-recent connect time, then streams new lines live.

* **Summary** — counts of critical matches, errors, warnings, problems, and total lines, plus detected SDK version and time range.
* **Histograms** — log volume by level, problems over time (colored by max severity), and connection durations (`0–1s` through `5m+`; a healthy mesh concentrates in `5m+`).
* **Sources** — switch between **Logs**, **Transport Conditions**, and **Connection Requests** to investigate transport changes and incoming connection decisions.
* **Filter tabs and search** — All / Critical / Errors / Warnings / Problems tabs with live count badges, plus a debounced free-text search over message, tag, and user tags.
* **Toolbar** — Pause/Resume the live stream, Clear the in-memory view (the on-disk log is untouched), or open the pattern editor.

The bundled pattern catalog flags known issues — deadlocks, expired certificates, OOM kills, query size limits, auth failures, replication recovery events, and MCP server start failures — and surfaces an actionable recommendation per match. The Log Analyzer is a diagnostic aid; the on-disk log file remains the canonical record.

### Manage Log Patterns

The **Manage Log Patterns** editor manages the regex catalog the analyzer scans against. Open it from the Log Analyzer toolbar or the **Manage Log Patterns** row in the **Logging** view.

**Command Palette:** run **Ditto: Manage Log Patterns**.

Bundled patterns are read-only; user patterns get full create/edit/delete with live regex validation and a **Test line** field.

Each pattern carries a unique key, a regex (matched case-insensitively against the line's message body), a severity from 1–5, an actionable recommendation, and optional level filter, tag filter, and user tag. User tags label matching lines in the log table and become searchable terms — for example, tag every query-engine line with `query`, then type `query` in the analyzer's search box to see only those lines.

User patterns are stored in `<globalStorage>/log-analyzer/user_patterns.json`. Point the `dittoVsce.logAnalyzer.customPatternsFile` setting at a different path — such as `${workspaceFolder}/.ditto/log-patterns.json` — to share a catalog with your team via version control.

## Logging and bug reports

The **Logging** view in the Ditto sidebar controls the extension's own logs. Each row has a matching Command Palette command:

| Logging view row | Command Palette | What it does |
| - | - | - |
| **Application Log Level** | **Ditto: Set Application Log Level** | Sets the level for extension log output. The current level appears next to the row. |
| **Ditto SDK Log Level** | **Ditto: Set Ditto SDK Log Level** | Sets the minimum log level for the Ditto SDK. |
| **Open Output Channel** | **Ditto: Open Output Channel** | Opens the **Ditto Edge Studio** Output channel. |
| **Export Logs for Bug Report…** | **Ditto: Export Logs for Bug Report…** | Saves a ZIP with the application log, an SDK support bundle when available, and a `README.txt` that lists the contents and versions. |
| **Show Log File in Finder** | **Ditto: Show Log File in Finder** | Reveals `ditto-edge-studio.log` in your operating system's file manager. |
| **Clear Application Log…** | **Ditto: Clear Application Log…** | Deletes the current application log and its rotated backups after confirmation. |
| **Manage Log Patterns** | **Ditto: Manage Log Patterns** | Opens the [log pattern editor](#manage-log-patterns). |

### Collect SDK diagnostics

* **Ditto: Collect Support Bundle (dial9)…** saves a `.tar.gz` with SDK logs, store diagnostics, and dial9 runtime traces from the active connection. To investigate a slow query, run it first, then collect the bundle. If the SDK reports a rate limit, wait and retry. See [Capturing support bundles](https://docs.ditto.live/sdk/latest/deployment/support-bundles.md).
* **Ditto: Export SDK Logs (gzip)…** saves the active connection's internal SDK logs as a `.jsonl.gz` file. Connect to a database before running the command.

If you export a bug report while disconnected, or if SDK bundle collection fails, the ZIP still contains the application log. Its `README.txt` explains why the bundle is missing.

> [!WARNING]
>
> Logs and support bundles can contain document data from your databases. Review the export before sharing it.

Use the [log retention settings](#settings-reference) to control application log rotation and how long the extension keeps backups.

To re-enable tips and warnings you dismissed, click **Reset Warnings** in the **Help** view or run **Ditto: Reset Warnings**.

## Debug Console

The **Debug Console** runs DQL directly against a **running app** that uses Ditto SDK 5.1 or later, through the app's debug socket. It doesn't use the extension's own connection, so you don't need to register or connect a database first.

**Command Palette:** run **Ditto: Open Debug Console**. The Debug Console is available only from the Command Palette.

**1. Enable the debug socket in your app**

In your app, after opening Ditto, run a DQL statement that opens a debug socket at an absolute file path, then run the app:

```sql theme={null}
ALTER SYSTEM SET debug_socket = '/tmp/my-app-ditto-debug.sock'
```

**2. Connect**

Enter the socket's absolute path, such as `/tmp/my-app-ditto-debug.sock`, and click **Connect**. The status changes to **Connected**. On macOS, the path must be 104 bytes or shorter.

**3. Run statements**

Type a DQL statement, such as `SELECT * FROM system:data_sync_info`, and press **Enter**. Each result appears as a card showing the statement, item count, duration, and results or the SDK's error message. **Shift+Enter** doesn't run the statement.

> [!WARNING]
>
> Statements run live against the app's database — the Debug Console is not a sandbox. `INSERT`, `UPDATE`, and other mutations change the app's data. The Debug Console is available on macOS and Linux only, because it uses Unix-domain sockets.

## MCP server for AI agents

Edge Studio includes an embedded [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server. It lets AI assistants such as GitHub Copilot agent mode, Claude Code, Grok Build (Cursor), and Codex work with the same active database that the extension panels use: run DQL, inspect peers and schema, manage indexes and subscriptions, watch live query changes, read metrics and logs, and download attachments to disk.

The server is **off by default** and is enabled separately for each connection. It runs only while a connection with MCP enabled is active.

### Enable MCP

> [tab] Connection settings
>
> **1. Edit the connection**
>
> In the Connections tree, right-click a database and choose **Edit Configuration**. Expand **Advanced Configuration**.
>
> **2. Enable AI access**
>
> Under **MCP Server (AI Access)**, select **Start MCP server while this connection is active**, then click **Save**.
>
> **3. Connect the database**
>
> Connect the database. The server starts while this connection is active and stops when you disconnect or switch to a connection without MCP enabled.

> [tab] Command Palette
>
> **1. Connect the database**
>
> In the Connections tree, right-click a database and choose **Connect**.
>
> **2. Start the server**
>
> Open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and run **Ditto: Start MCP Server**. This turns on **Start MCP server while this connection is active** for the active connection, saves the setting, and starts the server. A notification shows the server URL.
>
> If no connection is active, the command asks you to connect a database first.

While the server runs, the status bar shows **Ditto MCP :65270**. Click it to open the server status.

To turn the server off, run **Ditto: Stop MCP Server**, or clear the checkbox in **Edit Configuration → Advanced Configuration**. Either way, the setting is cleared for the active connection, so the server stays off the next time you connect.

**Command Palette:**

| Command | What it does |
| - | - |
| **Ditto: Start MCP Server** | Enables MCP on the active connection and starts the server. |
| **Ditto: Stop MCP Server** | Disables MCP on the active connection and stops the server. |
| **Ditto: MCP Server Status** | Shows whether the server is running, its URL and port, the number of client sessions, whether the active connection has MCP enabled, and the last start error. |
| **Ditto: Copy MCP Client Config** | Copies a JSON client configuration for the configured port to your clipboard. It works even while the server is stopped. |

### Connect an AI client

The server listens at `http://127.0.0.1:65270/mcp` using the Streamable HTTP transport. Older clients that use the legacy HTTP+SSE transport can connect with `GET /sse` and `POST /messages`.

> [tab] Copilot agent mode
>
> No setup is required. While the server runs, VS Code discovers it automatically and its tools appear in the Copilot agent mode tool picker.

> [tab] Claude Code
>
> Run this command in your project:
>
> ```bash theme={null}
> claude mcp add ditto-edge-studio-vscode --transport http http://127.0.0.1:65270/mcp
> ```
>
> Or run **Ditto: Copy MCP Client Config** and paste the result into your project's `.mcp.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "ditto-edge-studio-vscode": {
>       "type": "http",
>       "url": "http://127.0.0.1:65270/mcp"
>     }
>   }
> }
> ```

> [tab] Codex
>
> Add the server to `.codex/config.toml`:
>
> ```toml theme={null}
> [mcp_servers.ditto-edge-studio-vscode]
> url = "http://127.0.0.1:65270/mcp"
> enabled = true
> ```

> [tab] Other clients
>
> Run **Ditto: Copy MCP Client Config** and add the copied entry to your client's MCP configuration, or use this Streamable HTTP entry:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "ditto-edge-studio-vscode": {
>       "type": "http",
>       "url": "http://127.0.0.1:65270/mcp"
>     }
>   }
> }
> ```

To confirm the server is reachable without a client, run:

```bash theme={null}
curl http://127.0.0.1:65270/health
```

A running server responds with `OK`.

The extension's repository includes an [agent skill bundle](https://github.com/getditto/vsc-es/tree/main/plugins/ditto-edge-studio-vscode) that describes every tool, the resources, and safety rules. Share it with your agent to help it use the server effectively.

### Change the port

The server uses port `65270` by default. The standalone Edge Studio app uses `65269`, so both can run at the same time. To use a different port, change the `dittoVsce.mcpServer.port` setting. If the server is running, it restarts on the new port immediately. Run **Ditto: Copy MCP Client Config** again to copy a configuration with the new port.

### Available tools

All tools act on the active connection. Tools that need a connection return an error that tells the agent to connect a database first.

| Area | Tools |
| - | - |
| Connections | `list_databases`, `get_active_database`, `connect_database`, `disconnect_database` |
| Queries and data | `execute_dql`, `insert_documents_from_file`, `explain_query`, `profile_query`, `debug_socket_query` |
| Collections and indexes | `list_collections`, `list_indexes`, `create_index`, `drop_index` |
| Sync, peers, and transports | `get_sync_status`, `set_sync`, `configure_transport`, `get_peers` |
| Subscriptions and observers | `list_subscriptions`, `add_subscription`, `remove_subscription`, `list_observers`, `add_observer`, `remove_observer`, `watch_query` |
| Metrics, logs, and attachments | `get_query_metrics`, `get_system_metrics`, `get_database_metrics`, `get_app_logs`, `get_ditto_logs`, `query_log_analyzer`, `fetch_attachment` |

Key behaviors:

* `connect_database` switches connections without the UI. If the new connection fails, it rolls back to the previously active connection.
* `execute_dql` runs any DQL statement, including mutations, against the local store, or against the HTTP API when you pass `transport: "http"`. `SELECT` results are capped at 10,000 rows.
* `watch_query` captures live changes for up to 30 seconds and 100 events, then stops automatically.
* `debug_socket_query` runs one statement against a running app's debug socket and doesn't need an extension connection.
* `add_observer` saves observer definitions only; activate observers from the observer panel.
* `fetch_attachment` saves attachments directly to disk, within an open workspace folder, the extension's storage directory, or the OS temp directory. Set `overwrite: true` to replace an existing file.

The server also provides read-only snapshots as MCP resources: `ditto://schema`, `ditto://peers`, `ditto://sync-status`, `ditto://subscriptions`, `ditto://observers`, and `ditto://system-metrics`.

### Troubleshoot MCP

If your agent can't connect:

1. Run **Ditto: MCP Server Status**. Confirm the server is running and the active connection has MCP enabled, and check the last start error.
2. Open the **Log Analyzer** for the active database and search for `mcp`. Server starts, stops, client sessions, and start failures are logged with the `[mcp]` tag, and start failures are flagged with a recommendation.
3. Run **Ditto: Open Output Channel** and look for lines containing `mcp`.
4. Check whether another process — such as a second VS Code window — already uses the port. If so, change `dittoVsce.mcpServer.port`.

> [!WARNING]
>
> MCP is loopback-only but has no authentication. While the server is running, any process on your machine can read and write the connected database. Enable it only for connections where local AI automation is acceptable.
>
> The server rejects requests whose `Host` header isn't a loopback address and caps requests at 4 MiB. Tool output never includes credentials, and peer metadata is returned as key counts rather than raw metadata bodies.

## Get Quickstarts

The **Get Quickstarts** action clones the official [Ditto quickstart repo](https://github.com/getditto/quickstart) into a folder you choose. It pre-fills `.env` files for every quickstart project, plus the Edge Server configuration, using the Database ID, Development Token, and URLs from your currently active connection. If no connection is active, it offers a code-only download. Requires `git` on your `PATH`.

Start it from the **Get Quickstarts** row in the **Help** view, or the **Get Quickstarts** card on the Welcome screen.

**Command Palette:** run **Ditto: Get Quickstarts…**.

> [!WARNING]
>
> The generated `.env` and configuration files contain your token in plaintext. Keep the quickstart folder out of version control.

## Settings reference

| Setting | Default | Description |
| - | - | - |
| `dittoVsce.collectProfiling` | `true` | Capture [`PROFILE`](https://docs.ditto.live/dql/profile) data on local SELECT queries and show the Profile tab |
| `dittoVsce.collectMetrics` | `true` | Capture per-query metrics (`EXPLAIN` side-trip) and show Metrics surfaces, including the Query Metrics row |
| `dittoVsce.collectSystemMetrics` | `true` | Collect system metrics for the System Metrics panel. Applies at the next connect. |
| `dittoVsce.logMaxMegabytes` | `5` | Rotate the application log when it reaches this size in MB. |
| `dittoVsce.logRetainFiles` | `5` | Number of rotated application log backups to keep. |
| `dittoVsce.logMaxAgeDays` | `14` | Delete rotated application log backups older than this many days on startup. Set to `0` to disable age-based cleanup. |
| `dittoVsce.mcpServer.port` | `65270` | Loopback port for the MCP server. Machine-scoped; applies immediately. |
| `dittoVsce.logAnalyzer.customPatternsFile` | *(empty)* | Custom path for the Log Analyzer user-pattern catalog. Machine-scoped. |

## Related documentation

* [DQL reference](https://docs.ditto.live/dql/dql.md) — the full query language
* [ADVISE](https://docs.ditto.live/dql/advise.md) — index recommendations in the Query Editor
* [Syncing Data](https://docs.ditto.live/key-concepts/syncing-data.md) — subscriptions and sync concepts
* [Using Mesh Presence](https://docs.ditto.live/sdk/latest/sync/using-mesh-presence.md) — the Presence API behind the Presence panel
* [SDK Logging](https://docs.ditto.live/sdk/latest/deployment/logging.md) — SDK-side log configuration
* [Troubleshooting](https://docs.ditto.live/sdk/latest/deployment/troubleshooting.md) — common SDK issues
* [Ditto CLI](https://docs.ditto.live/sdk/latest/tools/ditto-cli.md) — run DQL against a local store from a terminal


## Related topics

- [Flutter Install Guide](https://docs.ditto.live/sdk/latest/install-guides/flutter.md)
- [React Native Quickstart](https://docs.ditto.live/sdk/v4/quickstarts/react-native.md)
- [Flutter Quickstart](https://docs.ditto.live/sdk/latest/quickstarts/flutter.md)
