# Slash Commands in ML Intern: A Complete Guide to the Interactive CLI

> Master ML Intern slash commands like /help, /undo, and /model. Control agent behavior, manage context, and configure settings efficiently from the interactive CLI.

- Repository: [Hugging Face/ml-intern](https://github.com/huggingface/ml-intern)
- Tags: how-to-guide
- Published: 2026-04-24

---

**ML Intern provides eight built-in slash commands—`/help`, `/undo`, `/compact`, `/model`, `/effort`, `/yolo`, `/status`, and `/quit`—that allow users to control the agent's behavior, manage context windows, switch models, and configure runtime preferences without sending requests to the underlying LLM.**

The ML Intern repository by Hugging Face includes an interactive REPL agent that interprets any user input starting with a forward slash as a **slash command**. These commands provide direct control over the agent's internal state, manipulation of reasoning effort settings, and management of the conversation context. Unlike regular chat messages that generate remote LLM requests, most slash commands in ML Intern execute locally within the CLI dispatcher to modify configuration or session data immediately.

## How Slash Commands Work in ML Intern

All slash commands are parsed and dispatched in [`agent/main.py`](https://github.com/huggingface/ml-intern/blob/main/agent/main.py) within the `_handle_slash_command` function (lines 722–805). This dispatcher extracts the command name and optional arguments, then executes the corresponding logic or creates a `Submission` object that the agent core consumes to modify internal state.

The supported commands and their descriptions are defined in [`agent/utils/terminal_display.py`](https://github.com/huggingface/ml-intern/blob/main/agent/utils/terminal_display.py) (lines 37–46), which stores the `HELP_TEXT` constant rendered when users invoke `/help`.

## Available Slash Commands

### `/help` – Display Command Reference

Shows the built-in help screen listing all available slash commands. The implementation calls `print_help()` from [`agent/utils/terminal_display.py`](https://github.com/huggingface/ml-intern/blob/main/agent/utils/terminal_display.py) (lines 49–52), which outputs the formatted `HELP_TEXT` to the terminal.

```python
>>> /help

```

### `/undo` – Revert the Last Turn

Generates an **Undo** operation that tells the agent to revert the previous turn. The command creates a `Submission` with `OpType.UNDO` and enqueues it for processing (implemented in [`agent/main.py`](https://github.com/huggingface/ml-intern/blob/main/agent/main.py), lines 726–731).

```python
>>> /undo

```

### `/compact` – Compress Context Window

Requests a **Compact** operation that forces the context window to be compressed. Like `/undo`, this creates a `Submission` object, but with `OpType.COMPACT` (lines 733–738 in [`agent/main.py`](https://github.com/huggingface/ml-intern/blob/main/agent/main.py)).

```python
>>> /compact

```

### `/model [id]` – Switch or List Models

Functions in two modes depending on whether an argument is provided:

- **Without argument**: Prints a list of suggested models and the currently selected one by calling `model_switcher.print_model_listing()` (lines 740–745).
- **With argument**: Validates the supplied model ID using `model_switcher.is_valid_model_id()` (defined in [`agent/core/model_switcher.py`](https://github.com/huggingface/ml-intern/blob/main/agent/core/model_switcher.py), lines 38–55), probes the model's effort support, and switches the active model via `model_switcher.probe_and_switch_model()` (lines 749–754).

```python
>>> /model
>>> /model MiniMaxAI/MiniMax-M2.7

```

### `/effort [level]` – Configure Reasoning Effort

Shows or updates the *reasoning-effort* preference. Valid levels are: `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, or `off`.

- **Without argument**: Prints the current preference and any cached per-model effort values.
- **With argument**: Validates against the allowed set and updates `config.reasoning_effort`, clearing cached probe results so the next `/model` command re-probes (implemented in [`agent/main.py`](https://github.com/huggingface/ml-intern/blob/main/agent/main.py), lines 761–789).

```python
>>> /effort
>>> /effort high

```

### `/yolo` – Toggle Auto-Approval Mode

Toggles **YOLO mode**, which auto-approves every tool call without prompting for confirmation. The command flips `config.yolo_mode` and prints the new state (lines 755–759).

```python
>>> /yolo
YOLO mode: ON

```

### `/status` – View Session Snapshot

Prints a short status report including the current model, reasoning effort setting, turn count, and number of context items. This reads from `config` and the active `session` object (lines 795–803).

```python
>>> /status
Model: bedrock/us.anthropic.claude-opus-4-6-v1
Reasoning effort: max
Turns: 12
Context items: 7

```

### `/quit` or `/exit` – Exit the REPL

Exits the interactive REPL cleanly. The main input loop detects this command in [`agent/main.py`](https://github.com/huggingface/ml-intern/blob/main/agent/main.py) (lines 966–970) by checking if the stripped lowercase input matches `["exit", "quit", "/quit", "/ext"]`.

```python
>>> /quit

```

## Implementation Architecture

The slash command system relies on several key files:

- **[`agent/main.py`](https://github.com/huggingface/ml-intern/blob/main/agent/main.py)**: Contains the core REPL loop, input parsing, and the `_handle_slash_command` dispatcher that queues `Submission` objects.
- **[`agent/utils/terminal_display.py`](https://github.com/huggingface/ml-intern/blob/main/agent/utils/terminal_display.py)**: Stores `HELP_TEXT` and renders the help screen via `print_help()`.
- **[`agent/core/model_switcher.py`](https://github.com/huggingface/ml-intern/blob/main/agent/core/model_switcher.py)**: Validates model IDs, prints model listings, and performs the probe-and-switch logic for `/model`.
- **[`agent/config.py`](https://github.com/huggingface/ml-intern/blob/main/agent/config.py)**: Holds runtime configuration (`reasoning_effort`, `yolo_mode`) that slash commands manipulate.
- **[`agent/core/effort_probe.py`](https://github.com/huggingface/ml-intern/blob/main/agent/core/effort_probe.py)**: Implements the effort-probe mechanism used by `/model` to verify a model's supported reasoning level.
- **[`backend/models.py`](https://github.com/huggingface/ml-intern/blob/main/backend/models.py) & [`backend/main.py`](https://github.com/huggingface/ml-intern/blob/main/backend/main.py)**: Define the `Submission` and `Operation` data structures consumed by the REPL.

## Practical Usage Examples

### Switching Models with Validation

When switching to a new model, the CLI validates the ID, performs a 1-token probe to check effort support, then activates the model:

```python
>>> /model MiniMaxAI/MiniMax-M2.7

```

Output:

```

Model switched to MiniMaxAI/MiniMax-M2.7 (effort: high)

```

### Adjusting Reasoning Effort

Update the reasoning effort and clear cached probe results:

```python
>>> /effort low

```

Output:

```

Reasoning effort: low
run /model <current> to re-probe, or send a message — the agent adjusts automatically if the new level isn't supported.

```

### Undo and Compact Workflow

Revert a mistake and then compress the context window:

```python
>>> /undo
>>> /compact

```

## Summary

- **Eight core commands** provide local control over the ML Intern agent: `/help`, `/undo`, `/compact`, `/model`, `/effort`, `/yolo`, `/status`, and `/quit`.
- **Local execution** means most commands don't generate remote LLM requests; they modify `config` objects or enqueue `Submission` instances with specific `OpType` values.
- **Model management** via `/model` includes validation against [`agent/core/model_switcher.py`](https://github.com/huggingface/ml-intern/blob/main/agent/core/model_switcher.py) and automatic effort probing.
- **Configuration persistence** allows `/effort` and `/yolo` to update runtime settings stored in [`agent/config.py`](https://github.com/huggingface/ml-intern/blob/main/agent/config.py).
- **Context control** commands (`/undo`, `/compact`) create operation objects that the agent processes to modify session history.

## Frequently Asked Questions

### What is the difference between `/undo` and `/compact` in ML Intern?

`/undo` generates a `Submission` with `OpType.UNDO` that reverts the entire previous turn, while `/compact` creates a `Submission` with `OpType.COMPACT` that compresses the context window to save tokens. `/undo` rolls back state, whereas `/compact` optimizes storage without changing the logical conversation flow.

### Does the `/model` command immediately switch the LLM backend?

No, the `/model` command first validates the model ID using `is_valid_model_id()` in [`agent/core/model_switcher.py`](https://github.com/huggingface/ml-intern/blob/main/agent/core/model_switcher.py), then probes the model with a 1-token request to verify effort support via `probe_and_switch_model()`. Only after successful validation and probing does it switch the active model, ensuring compatibility with current settings.

### Can I use `/effort` with any model, or only specific ones?

While you can set any valid effort level (`minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `off`) via `/effort`, the actual support depends on the specific model. When you subsequently use `/model` or send a message, the agent automatically adjusts if the new level isn't supported by the current backend, as verified by the effort probe mechanism.

### What happens to tool calls when YOLO mode is enabled?

When you toggle `/yolo` to ON, the agent sets `config.yolo_mode = True`, causing all future tool calls to be auto-approved without prompting for user confirmation. This speeds up workflows but should be used with caution as it bypasses the safety confirmation prompts for executable operations.