three-core-flows.mdx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. ---
  2. title: "Three Core Flows"
  3. description: "Learn the three ways to use Cline CLI: interactive mode, headless automation, and multi-instance parallelization"
  4. ---
  5. Two concepts to understand:
  6. **Task** - A single job for Cline to complete ("add tests to utils.js"). You describe what you want, Cline plans how to do it, then executes the plan. Tasks run on instances.
  7. **Instance** - An independent Cline workspace. Each instance runs one task at a time. Create multiple instances to run multiple tasks that work on different parts of your project in parallel.
  8. ## 1. Interactive mode: Plan first, then act
  9. Start here to see how Cline works. Interactive mode opens a chat session where you can review plans before execution.
  10. ```bash
  11. cline
  12. ```
  13. Cline opens an interactive session in your current directory. Type your task as a message. Cline enters Plan mode and proposes a step-by-step strategy.
  14. Review or edit the plan in chat. When you're ready, switch to execution:
  15. ```bash
  16. /act
  17. ```
  18. Cline executes the approved steps—reading files, writing code, running commands. You maintain control throughout the process.
  19. ## 2. Headless single-shot: Complete a task without chat
  20. Use this for automation where you want a one-liner that just does the work.
  21. ```bash
  22. cline instance new --default
  23. cline task new -y "Generate unit tests for all Go files"
  24. ```
  25. With the `-y` (YOLO) flag, Cline plans and executes autonomously without interactive chat. Perfect for CI, cron jobs, or scripts.
  26. Examples:
  27. ```bash
  28. # Create a complete feature
  29. cline task new -y "Create a REST API for user authentication"
  30. # Generate documentation
  31. cline task new -y "Add JSDoc comments to all functions in src/"
  32. # Refactor code
  33. cline task new -y "Convert all var declarations to const/let"
  34. ```
  35. Monitor your task with:
  36. ```bash
  37. # View task status
  38. cline task view
  39. # Follow task progress in real-time
  40. cline task view --follow
  41. ```
  42. Press Ctrl+C to exit the view.
  43. <Note>
  44. Run YOLO mode with care on a directory or a clean Git branch. You get speed in exchange for oversight, so be ready to revert if needed.
  45. </Note>
  46. ## 3. Multi-instance: Run parallel agents
  47. Multiple instances let you parallelize work on the same project without colliding contexts. Run frontend, backend, and infrastructure tasks simultaneously.
  48. Create your first instance:
  49. ```bash
  50. cline instance new
  51. ```
  52. This returns an instance address you'll use to target tasks. Attach a task to this instance:
  53. ```bash
  54. # Frontend work on first instance
  55. cline task new -y "Build React components"
  56. ```
  57. Create a second instance and set it as default in one command:
  58. ```bash
  59. cline instance new --default
  60. ```
  61. Now you can create tasks without specifying the address—they automatically use the default instance:
  62. ```bash
  63. # Backend work on the new default instance
  64. cline task new -y "Implement API endpoints"
  65. ```
  66. List all running instances:
  67. ```bash
  68. cline instances list
  69. ```
  70. Stop all instances when done:
  71. ```bash
  72. cline instances kill -a
  73. ```
  74. <Tip>
  75. Keep track of instance addresses returned by `cline instance new`. When scripting multiple agents, store these IDs and direct your tasks to the appropriate instance.
  76. </Tip>
  77. ## Configuring context window for local providers
  78. For Ollama and LM Studio, you can configure the model context window via CLI:
  79. ```bash
  80. # For Ollama
  81. cline config s ollama-api-options-ctx-num=32768
  82. # For LM Studio
  83. cline config s lm-studio-max-tokens=32768
  84. ```
  85. For other providers (Anthropic, OpenRouter, etc.), the context window is defined per model in the model metadata and is not user-configurable—Cline uses each model's built-in context limits automatically.
  86. ## Choosing the right flow
  87. - **Interactive mode**: Best for exploring new problems, learning how Cline works, or when you want to review plans before execution
  88. - **Headless single-shot**: Perfect for automation, CI/CD, and tasks where you trust Cline to execute without supervision
  89. - **Multi-instance**: Use when you need to parallelize work or maintain separate contexts for different parts of your project
  90. <Tip>
  91. For in-depth commands and flags, check out the [CLI reference](/cline-cli/cli-reference) page for complete documentation on all available options.
  92. </Tip>
  93. ## Next steps
  94. <Columns cols={2}>
  95. <Card title="CLI reference" icon="terminal" href="/cline-cli/cli-reference">
  96. Complete command documentation including configuration, instance management, and task commands.
  97. </Card>
  98. <Card title="Plan and Act" icon="brain" href="/features/plan-and-act">
  99. Deep dive into Plan and Act modes, including when to use each and how to switch between them.
  100. </Card>
  101. <Card title="YOLO mode" icon="zap" href="/features/yolo-mode">
  102. Understand how YOLO mode works and when to use full automation versus manual approval.
  103. </Card>
  104. <Card title="Task management" icon="clipboard-check" href="/features/tasks/task-management">
  105. Learn how Cline tracks and manages tasks, including saving and restoring state from checkpoints.
  106. </Card>
  107. </Columns>