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

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 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 (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 (lines 49–52), which outputs the formatted HELP_TEXT to the terminal.

>>> /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, lines 726–731).

>>> /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).

>>> /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, lines 38–55), probes the model's effort support, and switches the active model via model_switcher.probe_and_switch_model() (lines 749–754).
>>> /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, lines 761–789).
>>> /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).

>>> /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).

>>> /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 (lines 966–970) by checking if the stripped lowercase input matches ["exit", "quit", "/quit", "/ext"].

>>> /quit

Implementation Architecture

The slash command system relies on several key files:

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:

>>> /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:

>>> /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:

>>> /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 and automatic effort probing.
  • Configuration persistence allows /effort and /yolo to update runtime settings stored in 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, 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.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →