Skip to main content
Core Concepts

How Qoder CLI Completes Tasks

Overview

Understanding how Qoder CLI works helps you better predict its behavior, write more effective prompts, and properly control and correct it when needed. At its core, Qoder CLI is an Agent: it receives your requests, understands the intent, plans the steps, calls tools to interact with your project and environment, and continuously adjusts its strategy based on the results of each step until the task is complete. The entire process is driven by the collaboration of four core elements: the Agent, tools, permissions, and context.

Agent Main Loop

When Qoder CLI processes a request, it generally goes through the following loop:
  1. Receive request: Reads your input and combines it with the current context (Conversation History, project instructions, Memory) to understand what you want to achieve.
  2. Plan the next step: The model decides what to do next—whether to read a file to understand the current state, search the codebase, make direct modifications, or run a command for verification.
  3. Call tools: The Agent executes specific actions through tools, such as reading files, editing code, executing shell commands, searching code, or retrieving web pages.
  4. Observe results: Incorporates the results returned by the tools back into the context.
  5. Continue or finish: Determines whether the task is complete based on the results. If not, it returns to step 2 to plan the next step; if complete, it provides a summary.
This loop repeats for multiple turns until the task is completed, the maximum number of turns is reached, or you manually interrupt it. Because it is a loop rather than a one-shot generation, Qoder can handle complex tasks that require multiple steps, cross-file operations, and continuous verification during execution.
You can use --max-turns to limit the maximum number of Conversation Turns for a single run, preventing infinite loops in automated scenarios.

Tools

The Agent itself is only responsible for thinking and decision-making; all actual operations on the external world are performed through tools. Qoder CLI includes a set of commonly used Built-in Tools:
  • File operations: Read, write, and edit files, and browse directories.
  • Execution: Run shell commands.
  • Search: Search code by content (Grep) and find files by name (Glob).
  • Information: Web search and Web Scraping.
In addition to built-in tools, you can integrate external tools via MCP, and extend the Agent's capabilities through Skills and Subagents. For a complete list of tools, their purposes, and limitations, see Built-in Tools.

Permissions

Tool calls may have side effects—modifying files, running commands, or accessing the network. To ensure you always remain in control, Qoder performs a permission check before every tool call. The outcome falls into one of three categories:
  • allow: Execute the tool immediately.
  • ask: Require confirmation before execution.
  • deny: Block the call.
The specific behavior of permissions is determined by the permission mode. For example, in the default mode, safe read operations are executed automatically, while sensitive operations require confirmation; in more automated modes, more operations are automatically allowed. Different runtime environments handle ask differently: an interactive terminal will prompt you for confirmation, non-interactive (Headless) mode will convert ask to a denial, and SDK and IDE integrations will delegate the decision to the Host Application. For a complete explanation of permission modes, rule configurations, and directory trust, see Permissions.

Context

Qoder reconstructs the context for each session. The background information it relies on for decision-making primarily comes from three levels:
  • Conversation Context: Historical messages, tool calls, and results within the current session. As the conversation progresses, the context continuously accumulates.
  • Project instructions: Static memory maintained by you or your team, such as AGENTS.md and rules, which describe the project structure, development standards, and collaboration conventions.
  • Long-term memory: Information retained across sessions, including team conventions and optional Auto-Memory.
The context window is limited. When a conversation becomes very long, Qoder manages the context through mechanisms like Compact. For the differences and collaboration methods among these three, see How Qoder CLI Remembers Information.

Different Working Modes

The above describes the most basic interactive loop. For different tasks, Qoder CLI also offers various working modes: Plan for planning before execution, Goal for continuously achieving objectives, Scheduled Tasks, /loop for repeating at intervals, Workflow for multi-Agent collaboration, and Headless Mode for scripts. For guidance on how to choose, see Choosing the Right Working Mode.