---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/auto-approving-actions.md
  - https://sourcecraft.dev/portal/docs/ru/code-assistant/operations/agent/auto-approving-actions.md
title: Auto-approving actions in SourceCraft Code Assistant
description: How to configure auto-approval of actions in SourceCraft Code Assistant for faster Visual Studio Code workflow
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt


# Auto-approving actions in SourceCraft Code Assistant

<!-- source: en/_includes/code-assistant/only-in-vscode.md -->
{% note warning %}

This feature is only available in Visual Studio Code.

{% endnote %}
<!-- endsource: en/_includes/code-assistant/only-in-vscode.md -->

_Auto-approval of actions_ accelerates your workflow by eliminating repetitive confirmation prompts but also significantly increases security risks.

{% note alert %}

Auto-approval settings bypass confirmation requests, granting Code Assistant direct access to your system, which could lead to data loss, file corruption, or even greater damage. Terminal access involves most risks, as Code Assistant may run potentially malicious operations that interfere with your system or compromise security. Only enable auto-approval for actions you deem fully credible.

{% endnote %}

## Quick start {#quick-start}

1. Click the **Auto-approve** panel in the chat <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="m8.581 9.298.776.143q.311.059.643.059A3.5 3.5 0 0 0 13.5 6q0-.177-.027-.352l-1.39 1.39a1.58 1.58 0 0 1-1.114.462A2.47 2.47 0 0 1 8.5 5.03c0-.417.166-.817.461-1.112l1.39-1.39A2.4 2.4 0 0 0 10 2.5a3.5 3.5 0 0 0-3.441 4.143l.143.776-3.813 3.813a1.329 1.329 0 0 0 1.879 1.879zm3.817-6.787a.795.795 0 0 0-.411-1.018C11.87 1.432 11.014 1 10 1a5 5 0 0 0-4.916 5.916l-3.256 3.256a2.828 2.828 0 1 0 4 4l3.256-3.256Q9.53 11 10 11a5 5 0 0 0 5-5c0-1.014-.432-1.87-.493-1.987l-.014-.027a.795.795 0 0 0-1.273-.207l-2.198 2.2a.07.07 0 0 1-.053.021.97.97 0 0 1-.969-.97q0-.03.022-.052L12.22 2.78a.8.8 0 0 0 .178-.27" clip-rule="evenodd"/></svg> toolbar.
1. Select which actions Code Assistant can perform without requesting permission.
1. Use the <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M13.488 3.43a.75.75 0 0 1 .081 1.058l-6 7a.75.75 0 0 1-1.1.042l-3.5-3.5A.75.75 0 0 1 4.03 6.97l2.928 2.927 5.473-6.385a.75.75 0 0 1 1.057-.081" clip-rule="evenodd"/></svg> toggle to the left of **Auto-approve** to quickly enable or disable permissions.

### API request limit {#api-request-limit}

In the <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="currentColor"><path d="M9.97 4.47a.75.75 0 1 1 1.06 1.06L7.665 8.895l1.363 1.515 4.942-4.94a.75.75 0 1 1 1.06 1.06l-5.5 5.5a.75.75 0 0 1-1.088-.028l-1.84-2.045L5.53 11.03a.75.75 0 0 1-1.094-.036l-3.5-4a.75.75 0 0 1 1.128-.988l2.972 3.396.56-.561-1.654-1.839a.75.75 0 0 1 1.116-1.004l1.601 1.78z"/><path d="M9.97 4.47a.75.75 0 1 1 1.06 1.06L7.665 8.895l1.363 1.515 4.942-4.94a.75.75 0 1 1 1.06 1.06l-5.5 5.5a.75.75 0 0 1-1.088-.028l-1.84-2.045L5.53 11.03a.75.75 0 0 1-1.094-.036l-3.5-4a.75.75 0 0 1 1.129-.988l2.971 3.396.56-.561-1.654-1.839a.75.75 0 0 1 1.116-1.004l1.601 1.78z"/></g></svg> **Auto-approve** settings, use the **Max Requests** input field to set the maximum number of API requests Code Assistant can execute automatically.

This helps prevent excessive API usage and unforeseen costs, e.g., when using high-priced models, testing new workflows, or running Code Assistant autonomously for extended periods.

By default, no limit is set.

{% note tip %}

Set a reasonable limit based on task complexity; e.g., 50 to 100 requests is sufficient for most tasks.

{% endnote %}

When the limit is exceeded, Code Assistant stops and displays a dialog allowing you to reset the counter and continue.

### Available permissions {#available-permissions}

| Permission | Description | Risk level |
| --- | --- | --- |
| **Read** | Allows Code Assistant to access files without requesting approval | Medium |
| **Write** | Allows Code Assistant to modify files without requesting approval | **High** |
| **Execute** | Automatically runs terminal commands from the whitelist | **High** |
| **Browser** | Allows access to the browser without requesting approval | Medium |
| **MCP** | Allows Code Assistant to use configured [MCP servers](./mcp/overview.md) | Medium to high |
| **Mode** | Automatically switches [Code Assistant modes](../chat-prompts.md) | Low |
| **Subtasks** | Manages subtasks without requesting confirmation | Low |
| **Retry** | Automatically retries failed API requests | Low |

### Quickly enabling or disabling permissions {#enable-disable-permissions}

1. Click the **Auto-approve** panel in the chat <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="m8.581 9.298.776.143q.311.059.643.059A3.5 3.5 0 0 0 13.5 6q0-.177-.027-.352l-1.39 1.39a1.58 1.58 0 0 1-1.114.462A2.47 2.47 0 0 1 8.5 5.03c0-.417.166-.817.461-1.112l1.39-1.39A2.4 2.4 0 0 0 10 2.5a3.5 3.5 0 0 0-3.441 4.143l.143.776-3.813 3.813a1.329 1.329 0 0 0 1.879 1.879zm3.817-6.787a.795.795 0 0 0-.411-1.018C11.87 1.432 11.014 1 10 1a5 5 0 0 0-4.916 5.916l-3.256 3.256a2.828 2.828 0 1 0 4 4l3.256-3.256Q9.53 11 10 11a5 5 0 0 0 5-5c0-1.014-.432-1.87-.493-1.987l-.014-.027a.795.795 0 0 0-1.273-.207l-2.198 2.2a.07.07 0 0 1-.053.021.97.97 0 0 1-.969-.97q0-.03.022-.052L12.22 2.78a.8.8 0 0 0 .178-.27" clip-rule="evenodd"/></svg> toolbar.
1. Select which actions Code Assistant can perform without requesting permission.
1. Use the <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M13.488 3.43a.75.75 0 0 1 .081 1.058l-6 7a.75.75 0 0 1-1.1.042l-3.5-3.5A.75.75 0 0 1 4.03 6.97l2.928 2.927 5.473-6.385a.75.75 0 0 1 1.057-.081" clip-rule="evenodd"/></svg> toggle to the left of **Auto-approve** to quickly enable or disable permissions.

Permission settings are preserved when toggling.

For example, you can quickly disable auto-approval when working with sensitive code or enable it when rapidly iterating on a code change. This is also helpful when switching between code analysis and editing.

{% note info %}

Opening the **Auto-approve** menu temporarily disables auto-approval.

{% endnote %}

## Advanced settings panel {#advanced-settings}

1. In the chat's top panel, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M7.199 2H8.8a.2.2 0 0 1 .2.2c0 1.808 1.958 2.939 3.524 2.034a.2.2 0 0 1 .271.073l.802 1.388a.2.2 0 0 1-.073.272c-1.566.904-1.566 3.164 0 4.069a.2.2 0 0 1 .073.271l-.802 1.388a.2.2 0 0 1-.271.073C10.958 10.863 9 11.993 9 13.8a.2.2 0 0 1-.199.2H7.2a.2.2 0 0 1-.2-.2c0-1.808-1.958-2.938-3.524-2.034a.2.2 0 0 1-.272-.073l-.8-1.388a.2.2 0 0 1 .072-.271c1.566-.905 1.566-3.165 0-4.07a.2.2 0 0 1-.073-.27l.801-1.389a.2.2 0 0 1 .272-.072C5.042 5.138 7 4.007 7 2.199c0-.11.089-.199.199-.199M5.5 2.2c0-.94.76-1.7 1.699-1.7H8.8c.94 0 1.7.76 1.7 1.7a.85.85 0 0 0 1.274.735 1.7 1.7 0 0 1 2.32.622l.802 1.388c.469.813.19 1.851-.622 2.32a.85.85 0 0 0 0 1.472 1.7 1.7 0 0 1 .622 2.32l-.802 1.388a1.7 1.7 0 0 1-2.32.622.85.85 0 0 0-1.274.735c0 .939-.76 1.7-1.699 1.7H7.2a1.7 1.7 0 0 1-1.699-1.7.85.85 0 0 0-1.274-.735 1.7 1.7 0 0 1-2.32-.622l-.802-1.388a1.7 1.7 0 0 1 .622-2.32.85.85 0 0 0 0-1.471 1.7 1.7 0 0 1-.622-2.32l.801-1.389a1.7 1.7 0 0 1 2.32-.622A.85.85 0 0 0 5.5 2.2m4 5.8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0" clip-rule="evenodd"/></svg> **Settings**.
1. In the left-hand panel, navigate to <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="currentColor"><path d="M9.97 4.47a.75.75 0 1 1 1.06 1.06L7.665 8.895l1.363 1.515 4.942-4.94a.75.75 0 1 1 1.06 1.06l-5.5 5.5a.75.75 0 0 1-1.088-.028l-1.84-2.045L5.53 11.03a.75.75 0 0 1-1.094-.036l-3.5-4a.75.75 0 0 1 1.128-.988l2.972 3.396.56-.561-1.654-1.839a.75.75 0 0 1 1.116-1.004l1.601 1.78z"/><path d="M9.97 4.47a.75.75 0 1 1 1.06 1.06L7.665 8.895l1.363 1.515 4.942-4.94a.75.75 0 1 1 1.06 1.06l-5.5 5.5a.75.75 0 0 1-1.088-.028l-1.84-2.045L5.53 11.03a.75.75 0 0 1-1.094-.036l-3.5-4a.75.75 0 0 1 1.129-.988l2.971 3.396.56-.561-1.654-1.839a.75.75 0 0 1 1.116-1.004l1.601 1.78z"/></g></svg> **Auto-approve**.
1. Select which actions Code Assistant can perform without requesting permission:
    * [Read](#read)
    * [Write](#write)
    * [Browser](#browser)
    * [Retry](#retry)
    * [MCP](#mcp)
    * [Mode](#mode)
    * [Subtasks](#subtasks)
    * [Execute](#execute)

### Read {#read}

When enabled, Code Assistant automatically scans directory contents and reads files without prompting you to click **Approve**. _Risk: medium._

The additional **Include files outside workspace** option allows Code Assistant to read files you have access to outside the current working directory. _Risk: medium._

Although this setting only allows reading (not modifying) files, it could potentially expose sensitive data. We recommend this practice as a starting point for most users; yet, be mindful of which files Code Assistant can access.

This option is disabled by default, i.e., Code Assistant can only read files within your current working directory.

{% note tip %}

Keep **Include files outside workspace** disabled unless you specifically need to grant access to external files.

{% endnote %}

### Write {#write}

When enabled, Code Assistant automatically creates and edits files without prompting you to click **Approve**. _Risk: high._

Additional options:
* **Include files outside workspace**: Allows Code Assistant to modify files you have access to outside the current working directory.
* **Include protected files**: Allows Code Assistant to modify files normally protected by `.codeassistantignore` and the `.codeassistant/` directory, as well as Code Assistant configuration files, e.g., `package.json`, `tsconfig.json`, etc., if they contain Code Assistant settings.
* **Delay after writes**: Introduces a delay after writes to diagnose potential issues:
  * `1000 ms`: Default value, suitable for most projects with active diagnostics. 
  * `2000 ms or more`: Recommended for complex projects where diagnostics take longer. 
  * `0 ms`: Use when speed is critical. 
  * `1000 ms`: Use only in controlled environments.

  When you enable auto-approval for file writes, the delay timer integrates with the **Problems** panel in VS Code:
  1. Code Assistant makes changes in your file.
  1. VS Code diagnostic tools analyze the changes.
  1. The **Problems** panel updates with any errors or warnings.
  1. Code Assistant detects these issues before proceeding.

  This brings a pause for the developer to review errors after code changes. You can adjust the delay based on:
  * Project complexity.
  * Language server performance.
  * Criticality of error detection for your workflow.

### Browser {#browser}

When enabled, Code Assistant automatically performs browser actions without prompting you to click **Approve**, including opening websites, navigating pages, and interacting with web elements. _Risk: medium._

{% note info %}

This setting only applies if supported by the AI model.

{% endnote %}

### Retry {#retry}

When enabled, Code Assistant automatically retries failed API requests without prompting you to click **Approve** if the server returns an error. _Risk: low._

The additional **Delay before retrying the request** option sets the wait time before a retry attempt. The default value is 10 seconds.

The retry mechanism uses exponential backoff:
* The **Delay before retrying the request** value is the initial delay.
* Subsequent delays follow this formula: `min(baseDelay * 2^retryAttempt, 600)`.
* The maximum delay is 600 seconds.

> Here is an example retry sequence with an initial delay of ten seconds:
> * Retry 1: 10 seconds
> * Retry 2: 20 seconds
> * Retry 3: 40 seconds
> * Retry 4: 80 seconds
> * Retry 5: 160 seconds
> * Retry 6: 320 seconds
> * Retry 7 and subsequent retries: 600 seconds

This helps prevent API overload while recovering from transient errors.

### MCP {#mcp}

When enabled, Code Assistant automatically uses individual tools from configured [MCP servers](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/overview.md) without prompting you to click **Approve**. _Risk: medium to high depending on configured MCP tools._

For security, this setting requires two-step approval:
1. On the <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="currentColor"><path d="M9.97 4.47a.75.75 0 1 1 1.06 1.06L7.665 8.895l1.363 1.515 4.942-4.94a.75.75 0 1 1 1.06 1.06l-5.5 5.5a.75.75 0 0 1-1.088-.028l-1.84-2.045L5.53 11.03a.75.75 0 0 1-1.094-.036l-3.5-4a.75.75 0 0 1 1.128-.988l2.972 3.396.56-.561-1.654-1.839a.75.75 0 0 1 1.116-1.004l1.601 1.78z"/><path d="M9.97 4.47a.75.75 0 1 1 1.06 1.06L7.665 8.895l1.363 1.515 4.942-4.94a.75.75 0 1 1 1.06 1.06l-5.5 5.5a.75.75 0 0 1-1.088-.028l-1.84-2.045L5.53 11.03a.75.75 0 0 1-1.094-.036l-3.5-4a.75.75 0 0 1 1.129-.988l2.971 3.396.56-.561-1.654-1.839a.75.75 0 0 1 1.116-1.004l1.601 1.78z"/></g></svg> **Auto-approve** panel, enable <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M0 8a5.5 5.5 0 0 1 5.5-5.5h5a5.5 5.5 0 1 1 0 11h-5A5.5 5.5 0 0 1 0 8m6.5 0a4 4 0 1 0 8 0 4 4 0 0 0-8 0" clip-rule="evenodd"/></svg> **MCP**.
1. Expand the required MCP server's menu and select the **Auto-Run** option for the relevant tools.

The system will save your permissions and apply them the next time Code Assistant uses MCP tools.

### Mode {#mode}

When enabled, Code Assistant automatically switches between different [modes](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat-prompts.md) without prompting you to click **Approve**. _Risk: low._

### Subtasks {#subtasks}

When enabled, Code Assistant automatically creates and completes subtasks without prompting you to click **Approve**. _Risk: low._

### Execute {#execute}

When enabled, Code Assistant automatically runs allowed terminal commands without prompting you to click **Approve**. _Risk: high._

Under **Allowed Auto-Execute Commands**, add the prefix of a command you want to auto-execute and click **Add**. Repeat this for all commands you want to run automatically. Add the `*` prefix to allow all commands (use this with extreme caution).

To remove a command prefix, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06" clip-rule="evenodd"/></svg> to its right.

{% note tip %}

* Use a whitelist with specific command prefixes.
* Never use the `*` prefix in production environments or when handling sensitive data.
* Carefully evaluate the security implications of each command you allow.
* Always review commands that interact with external systems.
* Be very specific with prefixes, e.g., instead of allowing all `python` commands, restrict to `python -m pytest` for test execution only.

{% endnote %}

> Here is an example of a command whitelist:
> * `git`: Running version control operations.
> * `npm run`: Running scripts from `package.json`.
> * `python -m pytest`: Running Python tests.
> * `cargo test`: Running Rust tests.
> * `go test`: Running Go tests.
> * `docker ps`: Listing Docker containers.
> * `ls`: Listing directory contents.
> * `cat`: Displaying file contents.