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

# Using the CLI

## TUI mode

Run `qodercli` in any project root directory to enter the default TUI (interactive) mode. You can converse with the CLI via text or execute specific functions using slash commands.

### Input Modes

The TUI provides multiple input modes:

| Command | Description                                                            |
| :------ | :--------------------------------------------------------------------- |
| `>`     | Dialog mode (default). Enter any text to converse with the CLI         |
| `!`     | Bash Mode. Enter `!` in dialog mode to directly run shell commands     |
| `/`     | Slash mode. Enter `/` in dialog mode to open and run built-in commands |
| `\` `⏎` | Press Enter to start multiline input                                   |

### Built-in Tools

Qoder CLI includes built-in tools such as Grep, Read, Write, and Bash for file/directory operations and shell command execution.

For details on tool capabilities and control methods, see [Tools](/en/cli/07-reference/tools).

### Slash commands

Quickly access features and settings using the following built-in slash commands:

| Command          | Description                                                                                                          |
| :--------------- | :------------------------------------------------------------------------------------------------------------------- |
| `/login`         | Sign in to your Qoder account                                                                                        |
| `/help`          | Display TUI help                                                                                                     |
| `/init`          | Initialize or update the `AGENTS.md` memory file in the project                                                      |
| `/memory`        | Open Memory Overview to manage user-level, project-level, and local memory, as well as Auto-Memory entries           |
| `/quest`         | Intelligent workflow orchestrator that guides you through feature development step-by-step using dedicated subagents |
| `/review`        | Review local code changes                                                                                            |
| `/resume`        | View and restore sessions                                                                                            |
| `/clear`         | Clear the historical context of the current session                                                                  |
| `/compact`       | Summarize the historical context of the current session                                                              |
| `/usage`         | Display current Credits usage                                                                                        |
| `/status`        | View CLI status, including version, model, account, API Connectivity, tool status, etc.                              |
| `/config`        | View Qoder CLI system configuration                                                                                  |
| `/effort`        | Adjust the thinking depth and related Model Parameters for the current model                                         |
| `/agents`        | Subagent commands: view, create, and manage subagents                                                                |
| `/tasks`         | View currently running background tasks                                                                              |
| `/release-notes` | Display the Qoder CLI changelog                                                                                      |
| `/vim`           | Toggle Vim edit mode                                                                                                 |
| `/feedback`      | Send feedback related to Qoder CLI                                                                                   |
| `/quit`          | Exit the TUI                                                                                                         |
| `/logout`        | Sign out of your Qoder account                                                                                       |

### Advanced Startup Options

When starting the CLI, you can use the following options to control its behavior:

| Command              | Description                                                                      | Example                                          |
| :------------------- | :------------------------------------------------------------------------------- | :----------------------------------------------- |
| `-w`                 | Specify the working directory                                                    | `qodercli -w /Users/demo/projects/nacos`         |
| `-c`                 | Resume the last session                                                          | `qodercli -c`                                    |
| `-r`                 | Restore a specific session                                                       | `qodercli -r *******-c09a-40a9-82a7-a565413fa39` |
| `--allowed-tools`    | Allow only specified tools                                                       | `qodercli --allowed-tools=Read,Write`            |
| `--disallowed-tools` | Deny specified tools                                                             | `qodercli --disallowed-tools=Read,Write`         |
| `--tools`            | Restrict available built-in tools (`""` to disable all, `default` to enable all) | `qodercli --tools=Read,Edit -p "Fix login"`      |
| `--max-turns`        | Maximum conversation turns                                                       | `qodercli --max-turns=10`                        |
| `--worktree [name]`  | Start in an isolated git worktree                                                | `qodercli --worktree feature-a`                  |
| `--yolo`             | Skip permission checks                                                           | `qodercli --yolo`                                |

For permission-related startup arguments and settings, see [Permissions](/en/cli/06-configuration-and-security/permissions).

## Print mode

Print mode is a non-interactive mode. Run `qodercli --print` to enter it, and the output will be printed in the format specified by the `--output-format` parameter.

### Parameters

Global parameters can be used with any command:

| Parameter             | Description                            | Example                                             |
| :-------------------- | :------------------------------------- | :-------------------------------------------------- |
| `-p`                  | Run the agent non-interactively        | `qodercli -p hi`                                    |
| `-o, --output-format` | Output format: text, JSON, stream-json | `qodercli --output-format=json`                     |
| `-w`                  | Specify the working directory          | `qodercli -w /Users/qoder_user/projects/qoder_demo` |
| `-c`                  | Resume the last session                | `qodercli -c`                                       |
| `-r`                  | Restore a specific session             | `qodercli -r ********-c09a-40a9-82a7-a565413fa393`  |
| `--allowed-tools`     | Allow only specified tools             | `qodercli --allowed-tools=Read,Write`               |
| `--disallowed-tools`  | Deny specified tools                   | `qodercli --disallowed-tools=Read,Write`            |
| `--max-turns`         | Maximum conversation turns             | `qodercli --max-turns=10`                           |
| `--worktree [name]`   | Start in an isolated git worktree      | `qodercli --worktree feature-a -p "Fix login"`      |
| `--yolo`              | Skip permission checks                 | `qodercli --yolo`                                   |

<div id="shell-command-prefix">
  ## Shell command prefix
</div>

Set `QODER_SHELL_PREFIX` before starting Qoder CLI to route supported local shell commands through an executable wrapper.

**macOS and Linux**

```shell theme={null}
QODER_SHELL_PREFIX=/absolute/path/to/wrapper qodercli
```

**Windows PowerShell**

```powershell theme={null}
$env:QODER_SHELL_PREFIX = 'C:\absolute\path\to\wrapper.exe'
qodercli
```

**Windows Command Prompt**

```shell theme={null}
set "QODER_SHELL_PREFIX=C:\absolute\path\to\wrapper.exe"
qodercli
```

A POSIX-compatible wrapper can implement the required dispatch as follows:

```bash theme={null}
#!/usr/bin/env bash
exec bash -c "$1"
```

The wrapper receives the complete generated command line as one shell-quoted first argument (`$1` in a POSIX wrapper). It must re-evaluate that argument with a POSIX-compatible shell rather than treat the entire argument as an executable path. Using `exec` as shown above preserves stdin, stdout, stderr, the exit status, and signals. On Windows, the wrapper must pass its first argument to Git Bash as `bash.exe -c <argument>` and preserve the same process behavior; PowerShell and `cmd.exe` do not parse this quoted command format correctly.

Use a single executable path as the variable value; do not append shell arguments. For consistent behavior across all prefixed entry points, the executable path must not contain a space followed by a hyphen (` -`), which the POSIX shell prefix parser reserves.

The prefix applies to Bash mode (`!`), the Bash tool, bash-compatible shell-form command hooks and custom status line commands, and stdio MCP servers. It does not apply to exec-form hooks, PowerShell hooks or status line commands, URL-based MCP transports, or interactive PTY commands. If Qoder CLI inherits a shell prefix from its startup environment, set `QODER_SHELL_PREFIX` explicitly to an empty value to disable it. Existing permission, trust, and sandbox checks still apply.

## Worktree

Using `--worktree [name]` allows you to start a Qoder CLI session in an isolated git worktree. This is ideal for handling multiple tasks in parallel within the same repository, preventing multiple sessions from sharing the same working directory or altering the main checkout.

> Requirement: Run this command in a Git repository and ensure Git is installed locally.

### Starting in a worktree

```shell theme={null}
qodercli --worktree feature-a
qodercli --worktree feature-a "Implement the login fix"
qodercli --worktree
```

If no worktree name is provided, Qoder CLI will automatically generate one. A worktree name can be up to 256 characters long and may contain letters, numbers, dots, underscores, hyphens, and segments separated by `/`. Names containing `/` will be converted to `+` in both directory and branch names.

When creating a new named worktree, Qoder CLI places it under `<repo>/.qoder/worktrees/<flattened-name>` and creates a temporary branch named `worktree-<flattened-name>`. If a worktree with the same name already exists, Qoder CLI reuses that directory directly instead of creating a new one.

The new worktree is preferably created based on the default branch reference pointed to by the local `origin/HEAD`. If `origin/HEAD` is not configured, Qoder CLI will use `origin/main` if it can be resolved or fetched; otherwise, it falls back to the current `HEAD`. If you must start from the latest remote commit, execute `git fetch origin` first.

### Copying Local Files

A new worktree is a clean checkout and does not include untracked files like `.env` by default. To copy local files to the new worktree, add `.worktreeinclude` in the repository root:

```text theme={null}
.env
.env.local
config/secrets.json
```

Only files that match `.worktreeinclude` and are already ignored by Git will be copied. The local project-level setting `.qoder/settings.local.json` is automatically copied if it exists.

### Resuming and Cleaning Up

When the session ends, Qoder CLI prints the worktree path and the command to resume the session:

```shell theme={null}
cd <worktree-path> && qodercli --resume <session-id>
```

An interactive exit checks for uncommitted files and new commits in the worktree. A clean worktree can be deleted automatically; if local files or commits exist, the exit prompt will ask you to choose whether to keep or delete them. Deletion discards these changes and removes the temporary branch.

To manually delete a worktree, run:

```shell theme={null}
git worktree remove <worktree-path>
```

If the `worktree-<flattened-name>` branch is no longer needed, you can delete it separately:

```shell theme={null}
git branch -d worktree-<flattened-name>
```

### Using worktrees in a session

In an existing session, you can also ask Qoder CLI to handle tasks in an isolated worktree. It will create and enter a worktree for the current session; when you need to leave, you can ask it to exit the worktree and restore the original working directory.

Subagents can also use worktree isolation. When a Markdown Subagent needs to modify files in an isolated checkout, add `isolation: worktree` to its definition. A clean subagent worktree is deleted after the subagent finishes; worktrees with changes are retained. See [Subagent](/en/cli/04-extending-qoder-cli/subagent) for configuration details.

For worktrees created during a session and subagents with worktree isolation enabled, the `WorktreeCreate` hook can provide a custom worktree path. See [Hooks](/en/cli/04-extending-qoder-cli/hooks) for the accompanying `WorktreeRemove` cleanup behavior. The `--worktree` startup argument itself requires usage within a Git repository and uses Git to create the worktree.

If you need full manual control over directories and branches, you can directly use Git to create a worktree and then start Qoder CLI in that directory:

```shell theme={null}
git worktree add ../project-feature-a -b feature-a
cd ../project-feature-a && qodercli
```

## Memory

Qoder CLI retains context across sessions using `AGENTS.md` files and optional Auto-Memory. Commonly used files include the user-level `~/.qoder/AGENTS.md`, project-level `${project}/AGENTS.md`, and local project-level `${project}/AGENTS.local.md`.

### Automatic Generation

Start the TUI in the target project and enter `/init` to generate `AGENTS.md` in the project directory.

### Manual Management

* Create `AGENTS.md` in the project and edit its contents.
* Enter `/memory` in the TUI to manage user-level, project-level, and local memory files.
* When Auto-Memory is enabled, you can open the auto-memory folder in the `/memory` panel, or enter `/memory manage` to manage automatically saved memory files.

For complete instructions, see [Memory](/en/cli/04-extending-qoder-cli/memory).
