Языки: EN RU

Interactive Mode and Session Navigation

The Claude Code REPL is more than just an input line. It's a multi-layered environment: you can reference files, run shell commands, paste screenshots, switch models, and manage memory — all without leaving the conversation. The better you understand its layers, the less friction there is between an idea and its result.

If you're already familiar with installation and surfaces, the terminal surface (CLI) lives right here: the REPL you launch with claude from your project directory.


Three Modes, One Input Line

The input line looks the same visually, but its behavior is determined by the first character you type:

flowchart TD A["REPL Input Line"] --> B{"First character?"} B -->|"/"| C["Slash commands and skills\n/clear, /compact, /model…"] B -->|"!"| D["Shell mode\noutput into context"] B -->|"@"| E["File autocomplete\nfile content → context"] B -->|"(none)"| G["Regular prompt to Claude"]
flowchart TD
    A["REPL Input Line"] --> B{"First character?"}
    B -->|"/"| C["Slash commands and skills\n/clear, /compact, /model…"]
    B -->|"!"| D["Shell mode\noutput into context"]
    B -->|"@"| E["File autocomplete\nfile content → context"]
    B -->|"(none)"| G["Regular prompt to Claude"]
The first character determines the mode of the REPL input line
CharacterModeWhat happens
/Commands and skillsOpens the slash menu; the list filters as you type
!Shell modeThe command goes directly to the shell; output is added to the context
@File autocompleteClaude reads the file and includes its contents in the current turn

To exit shell mode, press Escape, Backspace, or Ctrl+U on an empty line. Switching is instant — there is no modal state.

Проверь себя
You are working in the REPL and want to quickly check git status without interrupting the conversation with Claude. What is the fastest way — and will the command output be added to the conversation context?

@-Mentions for Files

Start typing @ and path autocomplete will appear. This isn't just inserting a filename: Claude reads the file's contents and includes them in the context of the current turn.

@src/api/auth.ts explain the refresh token logic
@package.json  which dependencies are outdated?

You can mention multiple files in a single prompt. One important detail: an @-mention applies within a single turn — the file is not carried over automatically on the next turn. If you need a file available persistently, add a reference to it in CLAUDE.md via @path/to/import.

Be precise with large files. A 3,000-line module loaded for the sake of one function consumes context window space for no benefit — it's better to describe exactly what you need to find and let Claude use Grep/Glob on its own.


Быстрое повторение
Какой режим ввода используется для добавления содержимого файла в контекст текущего хода?

Pasting Images

Claude Code accepts images directly in the input line:

  • macOS (iTerm2): Cmd+V
  • Windows / WSL: Ctrl+V or Alt+V

After pasting, a [Image #1] chip appears in the input line. Multiple images are numbered in order and can be referenced explicitly:

[Image #1] what error is shown in this stack trace?
[Image #2] is it related to this design mockup?

PNG, JPEG, GIF, and WebP are supported. This is handy for screenshots of console errors, UI mockups, or Jupyter charts — anything that's hard to describe in words.

Проверь себя
You want to show Claude a screenshot of an error and at the same time reference the file src/error-handler.ts. How do you correctly combine both sources in a single prompt?

Shell Mode: Quick Access to the Terminal

The ! prefix runs a command directly, without going through Claude, and adds its output to the context:

! git log --oneline -10
! npm run test -- --testPathPattern=auth
! ls -la src/components/

This is not the same as asking the agent to "run a command": output appears instantly, you see it in real time, and Claude sees it on the next turn as well. Shell mode supports Tab autocomplete from the history of previous !-commands in the current project.

For long-running processes, Ctrl+B sends the command to the background. The conversation with Claude continues; the background task's output is saved to a file that the agent can read using the Read tool. tmux users need to press Ctrl+B twice due to a conflict with the tmux prefix.


Быстрое повторение
Какой символ нужно ввести в начало строки, чтобы команда ушла напрямую в шелл без посредничества Claude?

Keyboard Shortcuts That Change Your Daily Workflow

The full table in the documentation is long — here are the essential ones:

ShortcutAction
Shift+TabCycle permission modes (default → acceptEdits → plan → …)
Option+T / Alt+TToggle extended thinking on/off
Option+O / Alt+OToggle fast mode on/off
Option+P / Alt+PSwitch model without resetting the prompt
Ctrl+GOpen the prompt in $EDITOR
Ctrl+OShow the tool call log
Ctrl+RReverse search through command history
Ctrl+LRedraw the screen (if the terminal glitches)
EscInterrupt the response, preserving the completed portion
Esc + Esc (empty line)Open the rewind menu
Ctrl+X Ctrl+KStop all background subagents

Ctrl+G deserves a special mention. Enable the "Show last response in external editor" option in /config, and your editor will open with Claude's response as #-comments above your prompt. You edit in the context of the previous response, save the file, and the comments are removed automatically. This is useful for long, structured prompts that are difficult to type in a single-line input.

macOS note: most Alt/Option shortcuts require configuring the Option key as Meta in your terminal: iTerm2 → Settings → Profiles → Keys → Left Option key → "Esc+". Exception: Option+T works without this starting from version 2.1.132.


Быстрое повторение
Какая горячая клавиша переключает между режимами разрешений (default, acceptEdits, plan)?

Managing Long Sessions

The context window isn't infinite, and a full window is the biggest enemy of response quality. Here are the tools to keep it in check:

/compact — Claude summarizes the conversation, compressing it into a concise digest. Triggers automatically as the limit approaches. You can set a focus:

/compact focus on the authentication module

The summary will be targeted, not generic. After compaction, the project CLAUDE.md is re-injected — instructions are not lost.

/clear — start a new session. The conversation is reset, but the previous session is saved and accessible via /resume.

Double Esc (on an empty line) — opens the rewind menu to roll back to a previous point in the session. Covered in detail in the article Managing the Context Window.

/btw — a side question that is not recorded in the history. Works even while Claude is processing a task:

/btw what was the name of that date-parsing utility?

The answer appears in an overlay and doesn't pollute the context. Press f inside the overlay to fork the conversation into a separate session with full tool access — if you want to continue on that topic. /btw is the flip side of a subagent: it sees the entire conversation but has no tools. A subagent is the reverse: full tools, but a clean context.

Ctrl+T — show/hide the task list. When Claude is working on a multi-step task, it maintains a task list that persists across compactions — handy for long refactoring sessions.

Проверь себя
What is the fundamental difference between /compact and /clear? In what scenario is /compact preferable to starting a new session?

Searching Command History

Ctrl+R launches reverse search through command history — interactively, with match highlighting. By default, the search spans all projects. Ctrl+S inside the search cycles the scope: current session → current project → all projects. Tab or Esc accepts the match for further editing; Enter accepts and immediately executes it.

Command history is reset by /clear (starting a new session), but it is tied to the working directory — histories are independent across different projects.


Vim Mode and Multiline Input

For vim enthusiasts, enable vim mode via /config → Editor mode. A full subset is supported: NORMAL/INSERT/VISUAL modes, text objects (iw, i", i(), motions (f{char}, t{char}), u for undo, . for repeat. Block-visual (Ctrl+V) is not supported.

For multiline input without vim, the most universal approach is \ + Enter (works in any terminal). In iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal, and Windows Terminal — Shift+Enter works out of the box. If your terminal isn't on this list, run /terminal-setup.


Recap and Return Context

After three or more minutes of inactivity, Claude Code automatically generates a one-line summary of what happened in the session. It's ready the moment you return to the terminal. The /recap command generates a summary on demand.

The status bar at the bottom shows a link to the open PR for the current branch, with a color indicator: green — approved, yellow — awaiting review, red — changes requested, gray — draft. It's clickable via Cmd+Click / Ctrl+Click, updates every 60 seconds, and refreshes immediately after any gh pr or git push command.


See also

  • CLAUDE.md and the Memory System — how @path imports, auto memory, and /memory form persistent context
  • Managing the Context Window — strategies for /clear, /compact, /rewind, and context discipline
  • Permission Model, Security, and Trust — what exactly Shift+Tab cycles through and which modes exist
  • Slash Commands: Built-in and Custom — a complete reference for /commands
  • Subagents and Context Isolation — how /btw relates to subagents and when to use which
  • Model Selection and Thinking Modes — what Option+P and Option+T switch between
  • Headless Mode and CLI Scripting — non-interactive operation mode, claude -p

Источники

  1. Interactive mode — Claude Code docs
  2. How Claude remembers your project — Claude Code docs