Skip to content

Interactive Mode

Interactive mode is where you spend most of your time with Claude Code. It's a read-eval-print loop with slash commands, keyboard shortcuts, session management, and a permission system that lets you control how much autonomy Claude Code gets. This lesson gets you past the "type a prompt and watch" phase and into the workflow you'll use every day.

Gnome mascot

What you'll learn

  • Interactive mode is the REPL: claude starts a session, claude "initial prompt" starts with a task, claude -c continues the last session, claude -r "id" resumes a specific one
  • Slash commands (/help, /compact, /clear, /context, /cost, /review, /model, /init, /memory, /permissions, /config, /status, /exit) control the session without leaving the conversation
  • Keyboard shortcuts are muscle memory: Ctrl+C cancels, Ctrl+D exits, Ctrl+R searches history, Ctrl+O saves transcript, Shift+Tab cycles permission modes
  • ! for shell commands, @ for file references, # for memory items -- these are the three prefixes you'll use constantly

The problem

Typing claude "fix the login bug" and watching it work is satisfying. But most real work is iterative -- you ask Claude Code to do something, you see the result, you adjust, you ask for more. Interactive mode is built for this loop. You start a session, give it a task, watch the tool calls, refine the approach, and keep going. Sessions persist so you can pick up where you left off.

The problem with treating interactive mode like a chatbot is that you miss the session management features. You start a new session every time instead of continuing. You type out full instructions instead of using slash commands. You approve every tool call manually instead of configuring the permission mode. Interactive mode is a power tool -- this lesson shows you how to drive it.

Options & when to use each

CommandWhat it doesWhen to use it
claudeStart a new interactive sessionStarting fresh work
claude "initial prompt"Start a session with a task already in the promptYou know exactly what you want to do first
claude -cContinue the most recent sessionPicking up where you left off after /exit or a crash
claude -r "session-id"Resume a specific session by IDYou have multiple sessions and want to go back to a specific one
--dangerously-skip-permissionsSkip all permission promptsYou trust Claude Code completely in this session and don't want to be interrupted
--permission-modeSet the permission modeacceptEdits auto-approves file changes, bypassPermissions skips everything, default prompts
--modelOverride the default modelTrying a different model for this specific session
--effortSet reasoning effortHigher effort for complex architecture work, lower for simple refactors

Build it

Step 1: Start an interactive session

Launch the read-eval-print loop (REPL) directly from your terminal. This initializes the context engine and drops you into the standard conversation interface.

bash
claude

You'll see a banner with the model name and version. The prompt waits for your input. Type a task and Claude Code responds.

Start with a task, not a greeting:

Add a docstring to every public function in src/main.py that's missing one.
Use the Google-style docstring format.

Claude Code reads the file, identifies functions without docstrings, adds them, and shows you the diff. You can accept, reject, or ask for changes.

Step 2: Use slash commands

These work at any point in an interactive session. Type / and the command name:

CommandWhat it does
/helpList all available slash commands and keyboard shortcuts
/compactCompress the conversation context to save tokens and avoid hitting limits
/clearClear the conversation history, start fresh within the same session
/contextShow what Claude Code knows about your current context (files, memory, rules)
/costShow the token usage and cost for the current session
/reviewReview the changes made in the current session (diff view)
/modelShow the current model or switch to a different one
/initInitialize a CLAUDE.md file for the current project
/memoryOpen the memory file for the current project to add or edit remembered facts
/permissionsShow and change the permission mode for the current session
/agentsList active subagents and their status
/mcpManage MCP server connections
/configShow or edit the current configuration
/statusShow session status: model, turns used, budget, tools active
/exitExit the session (saves it for later resume)

The three you'll use most: /compact (when the context gets long), /cost (to check spending), and /review (to see what changed).

Step 3: Master the keyboard shortcuts

These are the shortcuts you'll use constantly. They work at any point in interactive mode:

ShortcutWhat it does
Ctrl+CCancel the current operation. If Claude Code is running a tool or thinking, this stops it
Ctrl+DExit the session. Same as /exit
Ctrl+RSearch command history. Type to filter through past prompts
Ctrl+OSave the transcript to a file. Claude Code prompts for a filename
Shift+TabCycle through permission modes: default -> accept edits -> bypass -> back to default
!Prefix for shell commands. !git status runs git status without going through Claude Code
@Prefix for file references. @src/main.py tells Claude Code to read that file
#Prefix for memory items. #build-system pulls in a memory entry about your build system

The !, @, and # prefixes are the muscle memory you need to build. Instead of typing "read the file src/main.py and tell me what it does," you type @src/main.py explain this file.

Step 4: Manage sessions

Control session lifecycles using command line flags. This allows you to pause work and pick up existing context without losing memory state.

bash
# Continue the most recent session
claude -c

# Start a session with an initial prompt
claude "Review the diff in the last commit and suggest improvements"

# Resume a specific session (find the ID with /status first)
claude -r "abc123"

Sessions persist automatically. When you /exit or Ctrl+D, the session is saved. claude -c picks it up right where you left off -- same conversation history, same context, same files open.

Step 5: Configure permissions for your workflow

The permission system controls what Claude Code can do without asking you. There are three modes:

# During a session, use /permissions to see current mode
/permissions

# Cycle through modes with Shift+Tab
# Or start a session with the mode you want:
claude --permission-mode acceptEdits
ModeWhat it doesWhen to use it
defaultPrompts before file edits and shell commandsMost of the time. You want to approve changes before they happen
acceptEditsAuto-approves file edits, prompts for shell commandsWhen you trust Claude Code's edits but want to review commands
bypassPermissionsSkips all promptsWhen you're iterating quickly and know exactly what you want. Use --dangerously-skip-permissions as a flag for the same effect

Step 6: Use !, @, and # in practice

These three prefixes are the efficiency boosters in interactive mode. Instead of writing full sentences, you use shorthand:

# Instead of: "read the file src/api/routes.py and tell me what endpoints it defines"
@src/api/routes.py what endpoints does this define?

# Instead of: "run git diff to see what changed"
!git diff

# Instead of: "use the memory about our build system"
#build-system -- run the tests using that

The @ prefix auto-completes file paths. Type @src/ and press Tab to cycle through files.

What goes wrong

MistakeHow you notice itThe fix
Context gets too long and Claude Code slows downResponses take longer, tokens are expensive/compact compresses the history. Do this regularly in long sessions. Claude Code also auto-compacts when it's close to the limit
You lose your session after a crashclaude -c says "No sessions to continue"Sessions are auto-saved on normal exit. If Claude Code crashes, the session might not be saved. Use Ctrl+O to save transcripts periodically in important sessions
You approve a file edit you didn't wantClaude Code changes a file and you approved it by habitUse /review to see all changes before accepting. If you already approved, git diff to see what changed and git checkout to revert
Permission mode is wrong for the taskYou're prompted for every trivial edit, or Claude Code makes changes you didn't wantShift+Tab cycles permission modes. Set it once at the start of the session. default for careful work, acceptEdits for fast iteration
! commands don't work because you're in the wrong directory!ls shows the wrong filesClaude Code inherits the working directory from where you launched claude. Start from the project root, or !cd /path/to/project first
Slash commands don't autocompleteYou type /com and nothing happensNot all slash commands support autocomplete. Type the full command name or use /help to see the list

Confirm it worked

Test out the full suite of interactive features by running through these validation steps. It confirms that slash commands, syntax shortcuts, and session recovery are operational.

bash
# 1. Start an interactive session
claude

# 2. In the session, run a multi-step task that uses multiple tools:
# "Check the git log for the last 3 commits. For each commit, show the files
# changed and the number of lines added and removed. Summarize what changed."

# 3. Use a slash command to check cost:
# /cost

# 4. Use the @ prefix to reference a file:
# @README.md summarize what this project does

# 5. Use the ! prefix to run a shell command:
# !git status

# 6. Exit and continue the session:
# /exit
# claude -c

# 7. Verify the session resumed with the same conversation history

If Claude Code completed the multi-step task, /cost showed token usage, @ and ! both worked, and the session resumed correctly -- interactive mode is working. This is the workflow you'll use every day.

Next: CLAUDE.md & Memory -- the memory system that keeps context cheap across sessions, and how to make Claude Code walk into your project already knowing the rules.