interactive-mode.mdx 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. ---
  2. title: "Interactive Mode"
  3. description: "Master the interactive CLI with keyboard shortcuts, slash commands, and file mentions"
  4. ---
  5. Interactive mode is the primary way to work with Cline CLI when you want a collaborative, conversational experience. Unlike headless mode (which runs a single task and exits), interactive mode keeps a session open where you can have back-and-forth conversations with Cline, refine your requests, and guide the AI as it works.
  6. ## Why Use Interactive Mode?
  7. Interactive mode is ideal when you:
  8. - **Don't know exactly what you need yet** - Explore a codebase, ask questions, and let Cline help you understand the architecture before making changes
  9. - **Want to review before acting** - Toggle Plan mode to see Cline's strategy, then switch to Act mode when you're ready
  10. - **Need iterative refinement** - Build on previous responses, ask follow-up questions, and guide Cline to the right solution
  11. - **Prefer human oversight** - Review each action, approve file changes, and maintain control over what Cline does
  12. - **Working on complex tasks** - Multi-step refactoring, debugging sessions, or feature development that requires judgment calls
  13. For automated workflows, scripts, or CI/CD pipelines, see [headless mode](/cline-cli/overview#headless-mode-non-interactive) instead.
  14. ## Prerequisites
  15. Before using interactive mode, you need to have Cline CLI installed and authenticated. If you haven't done this yet, follow the [Installation & Setup guide](/cline-cli/installation) first.
  16. ## Launching Interactive Mode
  17. Start interactive mode by running `cline` without any arguments:
  18. ```bash
  19. cline
  20. ```
  21. You'll see an animated welcome screen with the Cline robot. Start typing your task in the input field at the bottom of the screen.
  22. ## Keyboard Shortcuts
  23. Keyboard shortcuts are the primary way to navigate and control the interactive CLI. Since there's no mouse interaction in the terminal, learning these shortcuts will help you work efficiently and switch between modes, manage input, and control your session without breaking your flow.
  24. ### Mode Controls
  25. | Shortcut | Action |
  26. |----------|--------|
  27. | `Tab` | Toggle between Plan and Act mode |
  28. | `Shift+Tab` | Toggle auto-approve all actions |
  29. | `Esc` | Exit or cancel current operation |
  30. ### Input Controls
  31. | Shortcut | Action |
  32. |----------|--------|
  33. | `Enter` | Submit your message |
  34. | `↑` / `↓` | Navigate message history |
  35. | `Home` / `End` | Move cursor to start/end of line |
  36. | `Ctrl+A` | Move cursor to beginning |
  37. | `Ctrl+E` | Move cursor to end |
  38. | `Ctrl+W` | Delete word before cursor |
  39. | `Ctrl+U` | Delete entire line |
  40. ### Session Controls
  41. | Shortcut | Action |
  42. |----------|--------|
  43. | `Ctrl+C` | Exit with session summary |
  44. ## File Mentions with @
  45. Reference files from your workspace by typing `@` followed by the filename:
  46. ```text
  47. @src/utils.ts can you add error handling to this file?
  48. ```
  49. As you type after `@`, Cline shows a fuzzy search dropdown of matching files. Use arrow keys to navigate and `Enter` to select.
  50. <Tip>
  51. File search uses ripgrep for fast, fuzzy matching. You can type partial paths like `@utils` to find `src/utils/helpers.ts`.
  52. </Tip>
  53. ### Multiple File Mentions
  54. Include multiple files in a single message:
  55. ```text
  56. Compare @src/old-api.ts with @src/new-api.ts and list the breaking changes
  57. ```
  58. ## Slash Commands
  59. Type `/` to see available commands. Slash commands provide quick access to settings, history, and workflows.
  60. ### Built-in Commands
  61. | Command | Description |
  62. |---------|-------------|
  63. | `/settings` | Open the settings panel |
  64. | `/models` | Quick model switching |
  65. | `/history` | Browse and resume previous tasks |
  66. | `/clear` | Start a fresh task (clears current conversation) |
  67. | `/help` | Show help and available commands |
  68. | `/exit` | Exit the CLI |
  69. ### Workflow Commands
  70. If you have [workflows](/customization/workflows) configured, they appear as additional slash commands. For example, if you have a workflow named `code-review`, you can invoke it with:
  71. ```text
  72. /code-review
  73. ```
  74. ## Settings Panel
  75. Access the settings panel with `/settings`. Navigate between tabs using arrow keys.
  76. | Tab | Description | Settings |
  77. |-----|-------------|----------|
  78. | **API** | Configure your AI provider and model | Provider selection, model choice, extended thinking toggle, thinking budget |
  79. | **Auto-approve** | Control which actions Cline can perform without prompting | Read files, write files, execute commands, browser actions, MCP tools |
  80. | **Features** | Toggle Cline capabilities | Hooks, skills, auto-compact, sound notifications |
  81. | **Account** | Manage your Cline account | View account status, sign in/out, manage subscription |
  82. | **Other** | Additional preferences | Theme preferences, debug options |
  83. ## Plan and Act Modes
  84. Cline operates in two modes, toggled with `Tab`. These modes work the same way in the CLI as they do in the VS Code extension. For a deeper explanation of how Plan and Act modes work, see the [Plan and Act documentation](/core-workflows/plan-and-act).
  85. ### Plan Mode
  86. In Plan mode, Cline analyzes your request and creates a strategy before making changes. Use this when:
  87. - Exploring a new codebase
  88. - Working on complex refactoring
  89. - You want to review the approach first
  90. ### Act Mode
  91. In Act mode, Cline executes tasks directly. Use this when:
  92. - You're confident in the task
  93. - Making straightforward changes
  94. - Running quick operations
  95. <Tip>
  96. Press `Tab` anytime to switch modes. Starting in Plan mode and switching to Act after reviewing is a common workflow.
  97. </Tip>
  98. ## Auto-approve Toggle
  99. Press `Shift+Tab` to toggle auto-approve for all actions. This removes the approval prompts that appear before each action, letting Cline work continuously without interruption.
  100. ### When to Enable Auto-approve
  101. Auto-approve is useful when:
  102. - **You trust the task** - Well-defined tasks where you're confident in the outcome
  103. - **Speed matters** - Long-running tasks where constant approvals slow you down
  104. - **You're watching anyway** - You can see Cline's work in real-time and can interrupt if needed
  105. - **Iterating quickly** - Rapid prototyping where you want to see results fast
  106. ### What Gets Auto-approved
  107. When enabled, these actions happen without prompting:
  108. - File reads
  109. - File writes
  110. - Command execution
  111. - Browser actions
  112. - MCP tool calls
  113. You can also configure granular auto-approve settings (e.g., auto-approve reads but not writes) via `/settings` → Auto-approve tab, or see the [Auto-approve documentation](/features/auto-approve) for more details.
  114. <Warning>
  115. Auto-approve gives Cline full autonomy. Use on a clean git branch so you can easily revert changes if needed. You can always press `Ctrl+C` to stop Cline immediately.
  116. </Warning>
  117. ## Session Summary
  118. When you exit with `Ctrl+C`, Cline displays a session summary showing:
  119. - Tasks completed
  120. - Files modified
  121. - Commands executed
  122. - Token usage
  123. This helps you track what was accomplished during your session.
  124. ## Running Multiple Instances
  125. By default, all CLI instances share the same settings and state. However, you may want to run isolated instances with separate configurations for scenarios like:
  126. - **Different models for different tasks** - Use a fast, cheap model for quick questions in one terminal and a more capable model for complex refactoring in another
  127. - **Separate work and personal projects** - Keep API keys, rules, and task history isolated between contexts
  128. - **Testing configuration changes** - Experiment with new settings without affecting your main setup
  129. - **Team vs. individual settings** - Use shared team configuration for work projects and personal preferences for side projects
  130. To run isolated instances, use the `--config` flag with different directories:
  131. ```bash
  132. # Work instance with team configuration
  133. cline --config ~/.cline-work
  134. # Personal instance with different model/provider
  135. cline --config ~/.cline-personal
  136. # Experimental instance for testing new settings
  137. cline --config ~/.cline-test
  138. ```
  139. Each config directory maintains its own provider settings, API keys, task history, and preferences.
  140. <Tip>
  141. Use terminal multiplexers like tmux or split terminals to run multiple Cline instances in parallel, each working on different parts of your project with different models or settings.
  142. </Tip>
  143. ## Tips for Effective Usage
  144. ### Start with Context
  145. Give Cline context about what you're working on:
  146. ```text
  147. I'm building a REST API with Express. The routes are in @src/routes/ and models in @src/models/. Help me add user authentication.
  148. ```
  149. ### Use Plan Mode for Exploration
  150. When you're unsure about the best approach:
  151. ```text
  152. [Tab to Plan mode]
  153. How should I structure the database schema for a multi-tenant SaaS app?
  154. ```
  155. ### Iterate with Follow-ups
  156. The interactive CLI maintains conversation context. Build on previous messages:
  157. ```text
  158. > Add a login endpoint
  159. [Cline creates the endpoint]
  160. > Now add rate limiting to it
  161. [Cline modifies the same endpoint]
  162. > Add tests for both features
  163. [Cline creates test files]
  164. ```
  165. ## Next Steps
  166. <Columns cols={2}>
  167. <Card title="Headless Mode" icon="robot" href="/cline-cli/three-core-flows">
  168. Run Cline autonomously in scripts, CI/CD pipelines, and automated workflows.
  169. </Card>
  170. <Card title="Configuration" icon="gear" href="/cline-cli/configuration">
  171. Explore `cline config` and advanced configuration options.
  172. </Card>
  173. </Columns>