# Using CodeAssist

Overview

This guide walks you through every step of using CodeAssist, from the moment you launch it to the point you begin training your own personalized coding model, covering **setup, coding behavior, rewards, training** and **best practices.**&#x20;

## Video Walkthrough

If you're more of a visual learner, watch the video tutorial below for an end-to-end walkthrough on setting up and using CodeAssist, training models, and learn about best practices for improving model training.&#x20;

***

{% embed url="<https://youtu.be/ahfmHdNwYbk>" fullWidth="false" %}

***

### How does CodeAssist Work?

Unlike typical code assistants, CodeAssist doesn’t offer suggestions you *accept* or *reject*.

It writes directly into your editor in real time, and your actions, such as when you **type**, **fix**, **delete**, or **leave** its output untouched, become training signals that shape how it learns from you.

### Understanding the Assistant

CodeAssist runs two coordinated models:

* A frozen language model (Qwen2.5) that proposes code edits, comments, or reasoning steps.
* A trainable action-selection model that learns *how* to assist *you* based on your interactions and feedback.

> You are not using an agent or an autocomplete system: rather, *you* are training an *assistant!*

#### What This Means

The assistant watches your typing and timing. When you pause, it may generate code, refactor what’s there, or insert a comment.

How you respond to those actions, such as **accepting, modifying,** or **deleting** determines how the model learns. This is the foundation of CodeAssist's **reward vs. punishment** system and are later interpreted as reinforcement signals.

{% hint style="info" %}
Think of it as an 'apprentice' of sorts. It observes how you work, makes attempts, and improves once the episode training has completed.
{% endhint %}

### Launch & Login

To install CodeAssist, visit the [Getting Started](https://docs.gensyn.ai/testnet/codeassist/getting-started) page or use the platform-specific buttons below for detailed instructions on managing dependencies and installing CodeAssist.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Windows (WSL 2)</strong></td><td><a href="getting-started/windows-wsl-2">windows-wsl-2</a></td></tr><tr><td><strong>Linux (Ubuntu 22.04+)</strong></td><td><a href="getting-started/linux">linux</a></td></tr><tr><td><strong>macOS (Intel &#x26; ARM)</strong></td><td><a href="getting-started/macos">macos</a></td></tr></tbody></table>

After installation, it's time to start CodeAssist from your terminal:

```bash
uv run run.py
```

This command spins up a local Docker environment and launches the web server at `localhost:3000` which automatically opens in your device's default browser.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FAO4yEX51A9Kaj6WjGa9T%2Fcodeassist_Terminal.png?alt=media&#x26;token=cd06594f-efda-42f6-a4c5-1bc6dc3139e2" alt=""><figcaption></figcaption></figure></div>

When the web UI loads, you'll see the **Login Modal.**&#x20;

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FadSCbc8JHlPqyy2rtemf%2Fcodeassist_login_modal.png?alt=media&#x26;token=692c7a03-7073-4b14-b37f-1ab8df45db3b" alt=""><figcaption></figcaption></figure></div>

Here, you can log in with email, or with Google. Logging in with email will send a one-time passcode (OTP) to your email.&#x20;

{% hint style="info" %}
Once you've logged in for the first time, a file called `persistent-data/auth/userKeyMap.json` will be generated, which stores your local credentials.&#x20;
{% endhint %}

#### Selecting a Problem

From the **Problems Sidebar** on the left-hand side, you can choose **Easy, Medium** or **Hard** problems.&#x20;

By default, you will have landed on a randomly-selected problem.&#x20;

If you want to change your problem, you can select the difficulty level from the dropdown to be assigned a new problem in that difficulty, or click the **Shuffle** button to get a *new* problem within your selected difficulty.&#x20;

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2F25VZML0KMXlfDuOUNWvO%2Fcodeassist_selecting_different_problems.gif?alt=media&#x26;token=8f2b8927-1278-48a0-8179-758957e02fbd" alt=""><figcaption></figcaption></figure></div>

### Recording an Episode

Every time you run the launch command and open up CodeAssist in your browser, CodeAssist begins **recording an episode.**&#x20;

Each click, keyboard stroke, edit, acceptance, or deletion is logged as training feedback.&#x20;

> This is how the model trains once recording is finished: it examines *every action you took,* then trains in an attempt to emulate *you.*&#x20;

In that light, it is extremely important to work with the assistant patiently. Finishing solutions to LeetCode problems too quickly, or deleting everything the assistant adds to the `.txt` file immediately post-generation can neutralizing effects on the efficacy of that episode's training.&#x20;

{% hint style="danger" %}
In other words, rushing the model and aggressively correcting won't give it the chance to learn.&#x20;
{% endhint %}

### Coding with CodeAssist

When you stop typing, CodeAssist may begin typing for you. It doesn’t ask for confirmation. Instead, it acts directly in your file.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FeMuEcTTvyZN60YUojn5x%2Fcodeassist_correct_code_insertion.gif?alt=media&#x26;token=280fdd76-61ee-4c44-811b-021463ccc62e" alt=""><figcaption></figcaption></figure></div>

At this point, when the assistant has generated code or made changes, you can:

* Let its code stay
* Edit or refine its generation
* Delete entire lines
* Rearrange code or fix indentation

Each of these choices then becomes a training signal post-recording.&#x20;

#### Rewards & Timing

| Your Action                            | Interpreted Signal         |
| -------------------------------------- | -------------------------- |
| Leave the assistant's code untouched   | *Positive* reward          |
| Edit it after a short delay            | *Moderate* positive reward |
| Delete it after working around it      | *Mild* negative reward     |
| Delete it immediately after it appears | *Harsh* negative penalty   |

If you delete everything it writes right away, you’re essentially teaching it to stop acting altogether.

{% hint style="warning" %}
Sometimes it’s better to let a generation live briefly, let it try one more move, and then delete or fix it to teach *gradual correction* and not *total rejection.*
{% endhint %}

#### Pausing

You can press `shift + space` or click the **Pause Assistant** button to temporarily stop the assistant. Typing anything (or even a space or cursor click) after pausing will **unpause it.**&#x20;

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2F74AdDF56xEO9xlxC6JM1%2Fcodeassist_pausing_assistance.gif?alt=media&#x26;token=5e0c9d2a-4372-4c0a-a45b-b0f8c0acb0c7" alt=""><figcaption></figcaption></figure></div>

#### No-Ops

When the assistant produces a **No-Op**, as in it does *nothing,* it's waiting for you. This is intentional. **No-Op** means the assistant is not confident enough to act. Make an an edit or press a key to resume.

{% hint style="info" %}
This is not a bug, it's a feature signaling that it's *your turn.*&#x20;
{% endhint %}

#### Cursor Awareness

CodeAssist inserts code relative to your current cursor position. If your cursor sits at the bottom of the file and isn’t indented, new code may appear misaligned.

Keep your cursor near the section you’re working on. If something looks misplaced, re-indent with `tab` and `shift tab` or move your cursor before letting the assistant act.

#### Context&#x20;

Each LeetCode problem has the actual written problem on the left side, with the text field on the right.&#x20;

There's also a starter function. However, the starter function and imports are *masked* (read-only) to prevent the assistant from editing them.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2Fb76XWJbZycoE0W8Gxedn%2Fcodeassist_default_view.png?alt=media&#x26;token=1e180451-ef00-4061-a980-326905c14ed9" alt=""><figcaption></figcaption></figure></div>

If you want to modify those lines, make a small manual edit, even a space, to unlock them.

{% hint style="warning" %}
Unlocking (unmasking) the initial solution shell *will* open up that starting function to the assistant, which means it will gain context to the problem's solution, but can also change that starter function.&#x20;
{% endhint %}

#### Keyboard Shortcuts & Controls

If you're relatively new to coding, there are several common keyboard shortcuts and controls commonly used when editing code in development tools that are handy to learn.

| Action                         | Shortcut                   |
| ------------------------------ | -------------------------- |
| Pause / Resume                 | `shift + space`            |
| Undo                           | `ctrl/command + z`         |
| Redo                           | `ctrl/command + shift + z` |
| Indent / Outdent selected code | `tab / shift + tab`        |
| Stop recording (end episode)   | `ctrl + c`                 |

#### Testing your Solution

When you're ready to test your code, click **Submit Solution.**&#x20;

* If your solution is incorrect, you will see a modal pop up that prompts you to return to the problem and try again.&#x20;

Then, you will also see the **Test Case** section, which is a solution tester, containing **Tests Passed, Error(s) Found In Case,** and **Cases Pending** section.&#x20;

This is a standardized solution tester which will contain `input`, `stdout`, and `output`, expected results, and any relevant errors (such as tracebacks) including the line the error was found on.

* If your solution is correct, you will be prompted with a different modal to return the problem *or* proceed to a new one. Congratulations!

{% columns %}
{% column %}

<figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FxRcxPeqfed77Eewc3R8O%2Fcodeassist_problem_not_solved.png?alt=media&#x26;token=973270d8-4326-4221-aaf3-517b3ce147ab" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FtATjDQSjz15boxXQCcOP%2Fcodeassist_problem_solved_successfully.png?alt=media&#x26;token=3130b811-5a3f-4a37-8ebd-30516218cbca" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### Completing an Episode & Training your Model

Once you're done coding, you can complete the episode recording and train the model. To do this, return to your terminal (or IDE, if running CodeAssist from within a developer tool like Cursor or VS Code) and input `ctrl + c`.&#x20;

{% hint style="success" %}
You do **not** need to successfully solve a LeetCode problem to train the model. At any point, once the CodeAssist web UI is running in your browser, you can stop training with `ctrl + c`.&#x20;
{% endhint %}

During training, CodeAssist will:

* Compare your edits to the assistants actions
* Calculate rewards and penalties based on your reaction to the assistant's code generations&#x20;
* Updates your local model checkpoint
* Take a few minutes (depending on your system specifications) and store new model weights under `~/.codeassist/models`
* Upload your trained model to Hugging Face [using your previously-set Hugging Face token](https://docs.gensyn.ai/testnet/codeassist/hugging-face-guide)

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FFqFefR6yswAr4Qpm3N1u%2Fcodeassist_successful_training_session.gif?alt=media&#x26;token=1f33aad3-de09-4ea6-abef-c09b463e06e6" alt=""><figcaption></figcaption></figure></div>

At this point, you can <mark style="color:$success;">restart CodeAssist to use your updated model</mark> trained on your most recent episode.&#x20;

### Best Practices for Effective Training

Every user starts with a pre-trained baseline model tuned to generic behavior. As such, your first few episodes may feel inconsistent. This is normal.

#### Expectations

Early on, the model may feel 'too quiet' or 'too confident.' After 1-2 training runs, the model's performance can also *regress* as it begins calibrating to your coding habits.&#x20;

Improvement becomes more and more clear after a minimum of **4-5 episodes of training.**&#x20;

{% columns %}
{% column %}

#### Do

* Treat CodeAssist as a collaborator, not an agent or an autocomplete tool.&#x20;
* Keep coding normally and let it naturally interject code.&#x20;
* Reward 'good enough' behavior by keeping useful code around for a minute before editing or removing.&#x20;
* Relax! This is *experimental research,* not an interview environment.&#x20;
* Record multiple varied problems to diversify its learning signals.&#x20;
  {% endcolumn %}

{% column %}

#### Don't&#x20;

* Expect it to solve problems end-to-end.&#x20;
* Delete every generation instantly, even if its wrong, as this will encourage 'passivity.'
* Sit back and wait for it to code everything for you.&#x20;
* Panic when it begins typing unexpectedly or indenting pieces of code. Give it a moment to figure things out and patiently guide it towards outputting code that you want!
  {% endcolumn %}
  {% endcolumns %}

### Iterating & Improving

After you've finished training, you can restart and rerun CodeAssist using the command below:

```bash
uv run run.py
```

This will reopen the web UI, and you can select a new problem and begin coding again.&#x20;

At this point, especially after 4-5 training runs, notice subtle changes in how CodeAssist acts: timing, confidence, where it chooses the help, how much code it generates and where, and especially any stylistic peculiarities it has when generating code comments.&#x20;

Continue recording and training to refine your assistant over time!

***

### Next Steps

CodeAssist is designed to explore what *personalized assistance learning* looks like, and a machine learning (ML) model that adapts to individuals through the curation of a 'dataset' containing one user's training data, not a general, globally-available dataset.&#x20;

Visit the [Troubleshooting](https://docs.gensyn.ai/testnet/codeassist/troubleshooting) page if you're having any issues with running or installing CodeAssist, setting up dependencies (like Docker) or running into problems training your model.

{% hint style="success" %}
If you need additional support, you can [open a ticket](https://github.com/gensyn-ai/codeassist/issues) or [visit our Discord.](https://discord.com/invite/gensyn)
{% endhint %}
