Skip to main content
Guides

Dynamic Workflows

Dynamic workflows let Qoder CN CLI run structured, multi-agent processes in the background. They are well suited for tasks that require phased execution, large-scale concurrency, cross-validation, or the reuse of a fixed process. A dynamic workflow places the orchestration plan in a JavaScript script. The script decides which subagents to start, how to divide phases, how to merge intermediate results, and what result to ultimately return to the current session.

When to Use Dynamic Workflows

ApproachSuitable Scenarios
SubagentA single focused subtask that only needs to return a summary to the main session.
SkillReusable instructions, domain knowledge, or a process the main agent should follow.
Dynamic workflowReusable orchestration that requires multiple subagents, multiple phases, parallel branches, or validation rounds.
You can use a dynamic workflow when a task is clearly larger than a single agent call: repository audits, deep research, migration planning, release checks, cross-file scans, or review processes that require multiple independent perspectives before being aggregated.

What Dynamic Workflows Can Do

CapabilityDescription
Scripted orchestrationKeeps loops, branches, phases, and intermediate state in the dynamic workflow script.
Multi-agent dispatchStarts multiple subagents for independent slices of work.
Phased executionShows progress with named phases such as scan, analyze, validate, and summarize.
Parallel or pipeline processingRuns independent branches concurrently, or passes each item through multiple processing phases in sequence.
Background executionAfter starting a dynamic workflow, you can continue using Qoder CN CLI.
Process reuseSaves common processes as project-level, user-level, plugin-level, or built-in dynamic workflows.

Running a Dynamic Workflow

You can ask Qoder CN CLI to use a dynamic workflow in natural language:
Use a dynamic workflow to audit the security risks of this repository and summarize the findings.
You can also directly call a saved or built-in dynamic workflow by name:
Use the deep-research dynamic workflow to investigate the trade-offs of this architectural decision.
Qoder CN CLI may create a dynamic workflow for the current request, or it may directly use an existing dynamic workflow when one matches the task. A dynamically generated workflow shows its plan before execution; you can run it, view the raw script, reject it with feedback, or cancel it. Dynamic workflows run as background tasks. After it starts, Qoder CN CLI returns a run ID and continuously shows the execution progress in the task interface.

Viewing Dynamic Workflows

In the TUI, use /workflows to open the dynamic workflow task panel.
/workflows
In the panel, you can view running and completed dynamic workflows and inspect their status, phases, agents, logs, output paths, errors, and final results. /tasks also shows dynamic workflow tasks alongside other background tasks. While a dynamic workflow is running, you can view individual agents on the details page. If an agent is still controllable, you can skip or retry it on the details page.

Saving Dynamic Workflows

A saved dynamic workflow can be reused by name. Qoder CN CLI discovers dynamic workflows from the following locations:
ScopeLocationUse Case
Project-level.qoder/workflowsThe dynamic workflow belongs to the current repository or team.
User-level~/.qoder-cn/workflowsA personal dynamic workflow that you want to use across projects.
PluginDynamic workflows provided by a pluginThe dynamic workflow is distributed with a plugin.
Built-inDynamic workflows built into Qoder CN CLIThe dynamic workflow is provided by Qoder CN CLI.
When names conflict, a project-level dynamic workflow takes precedence over plugin-level and built-in dynamic workflows. Team-shared processes are best placed in the project-level directory; personal processes that should not be committed to the repository are best placed in the user-level directory. A saved dynamic workflow is a JavaScript file that begins with a meta export object. The meta information tells Qoder CN CLI the dynamic workflow's name, description, phases, and, optionally, its use case or input schema.
export const meta = {
  name: "repo-audit",
  description: "Audit a repository area and summarize risks",
  whenToUse: "Use when the user asks for a structured repository audit",
  phases: [
    { title: "Scan", detail: "Find relevant files and areas" },
    { title: "Analyze", detail: "Run focused analysis agents" },
    { title: "Summarize", detail: "Merge findings into a final report" }
  ]
};
After saving it to .qoder/workflows/repo-audit.js, you can have Qoder CN CLI use it like this:
Run the repo-audit dynamic workflow, targeting the authentication module.
A saved dynamic workflow can receive input through args. Target paths, issue IDs, research questions, options, or any value that differs from run to run but should not require modifying the script are all suitable to pass in through args.

How Dynamic Workflows Run

A dynamic workflow script is plain JavaScript. The script can use helper functions such as agent(), parallel(), pipeline(), phase(), log(), workflow(), args, and budget.
  1. Qoder CN CLI selects a saved dynamic workflow for the task, or creates a new one.
  2. If review is required, Qoder CN CLI shows the dynamic workflow's name, phases, script, and run options.
  3. The dynamic workflow starts as a background task.
  4. The script starts subagents and groups them into different phases.
  5. Intermediate results are kept in the dynamic workflow runtime and do not fill up the main session context.
  6. The final result is written to the dynamic workflow run output and summarized back in the current session.
The script, manifest, journal, transcript, and output generated during a dynamic workflow run are written to the current session directory under .qoder/sessions.

Permissions and Safety

A dynamic workflow may run multiple subagents and consume tokens quickly. When validating large or high-cost dynamic workflows, we recommend starting with a smaller scope. Dynamic workflow scripts cannot directly access the shell, file system, network, Node.js APIs, or MCP services. All side effects occur through subagents, which are still subject to Qoder CN CLI's tool, permission, Hook, and sandbox settings. Use Permissions to control what dynamic workflow subagents can do; use Hooks to enforce organization-level policies before and after tool calls.