Skip to main content
Core concepts

How Task Execution Works

Overview

Understanding how Qoder CLI CN works helps you better predict its behavior, write more effective prompts, and control or correct it properly when needed. At the core of Qoder CLI CN is an Agent: it receives your request, understands the intent, plans the steps, invokes tools to interact with your project and environment, and keeps adjusting its strategy based on the result of each step until the task is done. The whole process revolves around four elements working together — the Agent, tools, permissions, and context.

The Agent main loop

When Qoder CLI CN handles a request, it roughly goes through this loop:
  1. Receive the request: read your input and understand what you want to achieve, combined with the current context (conversation history, project instructions, memory).
  2. Plan the next step: the model decides what to do next — read files to understand the current state, search the code, edit directly, or run a command to verify.
  3. Invoke tools: the Agent performs concrete actions through tools, such as reading files, editing code, running Shell commands, searching code, or fetching web pages.
  4. Observe the result: feed the tool's result back into the context.
  5. Continue or finish: judge from the result whether the task is complete. If not, go back to step 2 and plan the next step; if complete, provide a summary.
This loop repeats over multiple turns until the task is done, the turn limit is reached, or you interrupt it. Precisely because it is a loop rather than one-shot generation, Qoder can handle complex tasks that require multiple steps, span multiple files, and verify while executing.
You can use --max-turns to limit the maximum number of conversation turns per run, preventing infinite loops in automation scenarios.

Tools

The Agent itself only thinks and makes decisions; all actual operations on the outside world are performed through tools. Qoder CLI CN ships with a set of common tools:
  • Files: read, write, and edit files; browse directories.
  • Execution: run Shell commands.
  • Search: search code by content (Grep), find files by name (Glob).
  • Information: web search and web page fetching.
Beyond the built-in tools, you can connect external tools via MCP, and extend the Agent's capabilities with Skills and Subagents. For the full list of tools, their purposes, and limitations, see Built-in Tools.

Permissions

Tool calls can have side effects — modifying files, running commands, accessing the network. To keep you in control at all times, Qoder performs a permission check before every tool call, with only three possible outcomes:
  • allow: execute the tool immediately.
  • ask: require confirmation before executing.
  • deny: block the call.
The concrete behavior of permissions is determined by the permission mode. For example, in the default mode, safe read operations run automatically while sensitive operations request confirmation; in more automated modes, more operations are allowed through automatically. Different runtime environments handle ask differently: an interactive terminal pops up a confirmation prompt, headless (non-interactive) mode converts ask into a denial, and SDK and IDE integrations hand the decision over to the host program. For a complete description of permission modes, rule configuration, and directory trust, see Permissions and Directory Trust.

Context

Qoder reconstructs the context for every session. The background information it relies on for decisions comes mainly from three layers:
  • Conversation context: the history of messages, tool calls, and results in the current session. Context accumulates as the conversation goes on.
  • Project instructions: static memory maintained by you or your team, such as AGENTS.md and rules, describing 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 finite. When a conversation gets long, Qoder manages context through mechanisms such as compaction (Compact). For the differences between the three layers and how they work together, see How Memory Works.

Different ways of working

What is described above is the most basic interactive loop. For different kinds of tasks, Qoder CLI CN also offers multiple ways of working: Plan for planning before executing, Goal for continuously working toward a goal, scheduled tasks, /loop for interval-based repetition, Workflow for multi-agent collaboration, and Headless mode for scripts. For how to choose, see Choosing a Way of Working.