---
title: Use Ysra in VS Code and Cursor
description: Install the Ysra extension for VS Code or Cursor, sign in, hand Ysra a task in the open folder, and keep or undo each change in the editor's own diff view.
---

The **Ysra extension** brings Code threads into VS Code and Cursor. Ysra
works on the folder you have open: it reads the code, edits files, runs your
tests in the **Ysra** terminal, and shows every file it changes in the
editor's diff view, where you keep or undo it. This page is for developers
who'd rather stay in their editor than switch to the desktop app.

**Before you start:** a Ysra account, and VS Code 1.106 or later (or a
current Cursor). The extension is free; the work uses your account's
[credits](../workspace/credits.md).

## Install and sign in

<div class="steps" markdown>

### Install the extension

In the Extensions view (++cmd+shift+x++ on macOS, ++ctrl+shift+x++ on
Windows and Linux), search for **Ysra — AI developer** and choose
**Install**.

### Open a project folder

Open the folder you want Ysra to work on, and trust it when the editor asks.
Ysra works only in a trusted folder, because it edits files and runs
commands there.

### Open Ysra

Ysra has its own icon in the side bar (the activity bar), in VS Code and in
Cursor. Click it, or run **Ysra: Open Ysra** (++cmd+alt+shift+y++ on macOS,
++ctrl+alt+shift+y++ on Windows and Linux).

!!! tip "Keep Ysra beside your files"
    In VS Code, drag the Ysra icon into the secondary side bar to keep it on
    the right. In Cursor, the side bar's icons sit in a row at its top; open
    Ysra from there or with the shortcut, and right-click the row to pin it.

### Sign in

Choose **Sign in to Ysra**. The editor shows a short code and opens Ysra's
sign-in page in your browser: enter the code there. Your sign-in is kept in
your system keychain, never in a file.

</div>

## Hand Ysra a task

Type what you want in the message box, the same way as in the desktop app:

```text
Fix the failing test in tests/test_dates.py and tell me what caused it.
```

Ysra shows each step as it goes: the files it read and edited, and the
commands it ran. **Show Commands Ysra Ran** lists them again; their output is
in the **Ysra** terminal.

## Choose how much Ysra may do

The access chip under the message box sets what Ysra may do in the thread.
You can change it at any time.

| Access | What Ysra does |
|---|---|
| **Asks first** (default) | Asks once per thread before running commands that reach outside the folder or change git. |
| **Auto** | Works through the task without asking, commits included; still asks before the few things that [always ask](../concepts/access-modes.md#what-always-asks). |
| **Read only** | Reads, explains and plans. Changes nothing. |

When Ysra needs your OK, a card in the thread shows exactly what it wants to
do and waits. See [Access modes](../concepts/access-modes.md).

## Keep or undo changes

Every file Ysra changes is listed under **Ysra changes** in the Ysra side
bar.

1. Click a file to open the diff.
2. Choose **Keep** to accept the change, or **Undo** to put the file back as
   it was.
3. To decide for every file at once, use **Keep All Changes** or **Undo All
   Changes**.

Commits and pushes follow the thread's access mode: in **Auto**, Ysra may
commit on its own branch or on your current branch when it isn't the default
branch, and asks before committing on `main`. See
[git on your computer](../concepts/access-modes.md#git-on-your-computer).

## Work from the editor

| Command | Where | What it does |
|---|---|---|
| **Ask Ysra About This** | Select code, then ++cmd+alt+y++ (++ctrl+alt+y++), or right-click | Asks about the selection in the thread. Only the code you selected is attached; with nothing selected, or a very long selection, Ysra gets a reference to the file instead |
| **Explain This** | Right-click a selection | Explains the selected code |
| **Write a Test for This** | Right-click a selection | Writes a test for the selected code |
| **Fix This Problem with Ysra** | The quick fix (light bulb) on an error or warning | Hands the problem to Ysra |
| **New Thread for This Folder** | Command Palette | Starts a fresh thread |
| **Stop Ysra** | Command Palette | Stops the running work; what's done so far is kept |
| **Open Ysra in an Editor Tab** | Command Palette | Opens the thread as a tab instead of in the side bar |
| **Review Ysra's Changes** | Command Palette | Opens the list of changed files |

## Settings

Open the editor's Settings and search for **Ysra**.

| Setting | Default | What it does |
|---|---|---|
| **Approval Mode** (`ysra.approvalMode`) | Asks first | The access new threads start with: Asks first, Auto or Read only |
| **Work Mode** (`ysra.workMode`) | `agent` | `plan`: Ysra proposes a plan first and waits for your OK |
| **Code Lens** (`ysra.codeLens`) | Off | Shows **Ask Ysra · Explain · Write a test** above functions |
| **Sign In With** (`ysra.signInWith`) | `account` | How the editor signs in; both bill your Ysra account |
| **Model** (`ysra.model`) | Your workspace's default | The model new threads use |

## What's different from the desktop app

The extension is focused on Code threads in the open folder. Ask, Learn,
Workers, cloud threads and your account settings are in the
[web app](https://app.ysra.ai) and the [desktop app](desktop.md).

## Related

- [Access modes](../concepts/access-modes.md) — what each access lets Ysra do.
- [Security](../security.md) — what Ysra reads and runs on your computer.
- [Install the CLI](cli.md) — Ysra in your terminal and in scripts.
