> ## 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 CLI

## TUI Mode

Run `qodercli` from any project root to enter the default TUI (interactive) mode. You can chat with the CLI by text or execute special functions via slash commands.

### Input modes

Multiple input modes are available in the TUI:

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

### Built-in tools

Qoder CLI ships with tools like Grep, Read, Write, and Bash for file/directory operations and shell command execution.

For more details about tool capabilities and controls, see [Tools](/en/cli/tools).

### Slash commands

Quickly access features and settings with these built-in slash commands:

| Command          | Description                                                                   |
| :--------------- | :---------------------------------------------------------------------------- |
| `/login`         | Log in to your Qoder account                                                  |
| `/help`          | Show TUI help                                                                 |
| `/init`          | Initialize or update the `AGENTS.md` memory file in the project               |
| `/memory`        | Open the memory overview for user, project, local, and auto-memory entries    |
| `/quest`         | Spec-driven delegated task                                                    |
| `/review`        | Code review for local changes                                                 |
| `/resume`        | List and resume sessions                                                      |
| `/clear`         | Clear the current session context history                                     |
| `/compact`       | Summarize the current session’s context history                               |
| `/usage`         | Show your current credit usage                                                |
| `/status`        | Show CLI status: version, model, account, API connectivity, tool status, etc. |
| `/config`        | Show system configuration of Qoder CLI                                        |
| `/effort`        | Adjust reasoning effort and related options for the current model             |
| `/agents`        | Subagent commands: list, create, manage subagents                             |
| `/tasks`         | List running background tasks                                                 |
| `/release-notes` | Show Qoder CLI release notes                                                  |
| `/vim`           | Open an external editor to edit input                                         |
| `/feedback`      | Send feedback about Qoder CLI                                                 |
| `/quit`          | Exit TUI                                                                      |
| `/logout`        | Log out of your Qoder account                                                 |

### Advanced startup options

When launching the CLI, use the following options to control its behavior:

| Command              | Description                      | Example                                          |
| :------------------- | :------------------------------- | :----------------------------------------------- |
| `-w`                 | Specify the workspace directory  | `qodercli -w /Users/demo/projects/nacos`         |
| `-c`                 | Continue the last session        | `qodercli -c`                                    |
| `-r`                 | Resume a specific session        | `qodercli -r *******-c09a-40a9-82a7-a565413fa39` |
| `--allowed-tools`    | Allow only specified tools       | `qodercli --allowed-tools=Read,Write`            |
| `--disallowed-tools` | Disallow specified tools         | `qodercli --disallowed-tools=Read,Write`         |
| `--max-turns`        | Maximum dialog turns             | `qodercli --max-turns=10`                        |
| `--worktree [name]`  | Start in a separate Git worktree | `qodercli --worktree feature-a`                  |
| `--yolo`             | Skip permission checks           | `qodercli --yolo`                                |

For permission-related flags and settings, see [Permissions](/en/cli/permissions).

## Print Mode

Print mode is non-interactive. Run `qodercli --print` to enter. Output is printed according to `--output-format`.

### Flags

Global options can be used with any command:

| Option               | Description                            | Example                                             |
| :------------------- | :------------------------------------- | :-------------------------------------------------- |
| `-p`                 | Run the Agent non-interactively        | `qodercli -p hi`                                    |
| `--output-format`    | Output format: text, json, stream-json | `qodercli --output-format=json`                     |
| `-w`                 | Specify the workspace directory        | `qodercli -w /Users/qoder_user/projects/qoder_demo` |
| `-c`                 | Continue the last session              | `qodercli -c`                                       |
| `-r`                 | Resume a specific session              | `qodercli -r ********-c09a-40a9-82a7-a565413fa393`  |
| `--allowed-tools`    | Allow only specified tools             | `qodercli --allowed-tools=Read,Write`               |
| `--disallowed-tools` | Disallow specified tools               | `qodercli --disallowed-tools=Read,Write`            |
| `--max-turns`        | Maximum dialog turns                   | `qodercli --max-turns=10`                           |
| `--worktree [name]`  | Start in a separate 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

Use `--worktree [name]` to start a Qoder CLI session in a separate Git worktree. This is useful when you want to run parallel sessions against the same repository without sharing the same working directory or touching the main checkout.

> Requirements: run the command inside a Git repository and make sure Git is installed locally.

### Start in a worktree

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

If you omit the worktree name, Qoder CLI generates one automatically. Worktree names can contain letters, digits, dots, underscores, dashes, and slash-separated segments, up to 256 characters total. Slash-separated names are flattened with `+` for the worktree directory and branch name.

When a new named worktree is created, Qoder CLI stores it under `<repo>/.qoder/worktrees/<flattened-name>` and uses a temporary branch named `worktree-<flattened-name>`. If a worktree with the same name already exists, Qoder CLI reuses it and resumes in that directory instead of creating another one.

New worktrees start from the local `origin/HEAD` default-branch ref when it is available. If `origin/HEAD` is not configured, Qoder CLI uses `origin/main` when it can resolve or fetch it; otherwise it falls back to the current `HEAD`. Run `git fetch origin` first when the worktree must start from the latest remote commit.

### Copy local files

A new worktree is a clean checkout, so untracked files such as `.env` are not present by default. To copy local files into new worktrees, add a `.worktreeinclude` file at the repository root:

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

Only files that both match `.worktreeinclude` and are already ignored by Git are copied. Project-local settings in `.qoder/settings.local.json` are copied automatically when present.

### Resume and clean up

When the session ends, Qoder CLI prints the worktree path and the command for resuming the session:

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

Interactive exits check for uncommitted files and commits created in the worktree. Clean worktrees can be removed automatically. Worktrees with local files or commits are kept or removed based on the exit prompt; removing a worktree discards those changes and deletes the temporary branch.

To remove a worktree manually, run:

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

Delete the `worktree-<flattened-name>` branch separately if you no longer need it:

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

### Use worktrees during a session

During an active session, you can ask Qoder CLI to work in an isolated worktree. It creates and enters a worktree for the current session, then can leave that worktree and restore the original working directory when asked.

Subagents can also use worktree isolation. Add `isolation: worktree` to a Markdown Subagent definition when that Subagent should edit files in a separate checkout. Clean Subagent worktrees are removed after the Subagent finishes; changed worktrees are preserved. See [Subagents](/en/cli/subagent) for Subagent configuration.

For in-session worktrees and worktree-isolated Subagents, `WorktreeCreate` hooks can provide a custom worktree path. See [Hooks](/en/cli/hooks) for the matching `WorktreeRemove` cleanup behavior. The `--worktree` startup flag itself expects a Git repository and uses Git for creation.

For full manual control, create a worktree with Git and run Qoder CLI from that directory:

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

## Memory

Qoder CLI carries context across sessions with `AGENTS.md` files and optional auto-memory. Common files include user-level `~/.qoder/AGENTS.md`, project-level `${project}/AGENTS.md`, and local project-level `${project}/AGENTS.local.md`.

### Automatically generate

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

### Manually manage

* Create `AGENTS.md` in the project and edit its content.
* In TUI, enter `/memory` to manage user, project, and local memory files.
* When auto-memory is enabled, use `/memory` to open the auto-memory folder, or enter `/memory manage` to manage automatically saved memory files.

For details, see [Memory](/en/cli/memory).
