Qoder Agent (Print Mode - Non-Interactive)
Use Print mode (-p) for all Qoder CLI work in OpenClaw. TUI mode is not supported in automated environments.
✅ All-Sessions Ready: This skill works in:
- - Direct 1:1 chats
- Group chats (DingTalk, Discord, Slack, etc.)
- Shared workspace sessions
- Private sessions
⚠️ Important: Print Mode Only
TUI mode is NOT supported in OpenClaw or other automated environments due to TTY requirements.
Always use Print mode with the -p flag:
CODEBLOCK0
🔐 Environment Setup (Auto-Detected)
Qoder CLI authentication is automatically available via:
CODEBLOCK1
In any session type, the environment variable is inherited from the shell, so Qoder CLI works seamlessly.
🚀 Quick Start
Basic Usage
CODEBLOCK2
🎯 Print Mode Flags
| Flag | Description | Example |
|---|
| INLINECODE2 | Required - Run non-interactively | INLINECODE3 |
| INLINECODE4 |
Quiet mode (hide spinner) |
qodercli -q -p "task" |
|
--output-format | Output format: text, json, stream-json |
qodercli --output-format=json |
|
-w | Specify workspace directory |
qodercli -w /path/to/project |
|
-c | Continue last session |
qodercli -c -p "continue" |
|
-r | Resume specific session |
qodercli -r <session-id> |
|
--model | Model tier selection |
qodercli --model=ultimate |
|
--max-turns | Maximum dialog turns (0 = unlimited) |
qodercli --max-turns=10 |
|
--max-output-tokens | Max tokens: 16k, 32k |
qodercli --max-output-tokens=32k |
|
--yolo | Skip permission checks |
qodercli --yolo |
|
--allowed-tools | Allow only specified tools |
qodercli --allowed-tools=READ,WRITE |
|
--disallowed-tools | Disallow specified tools |
qodercli --disallowed-tools=Bash |
|
--agents | JSON object defining custom agents |
qodercli --agents='{"reviewer":{...}}' |
|
--attachment | Attach image files (repeatable) |
qodercli --attachment=img.png |
🧠 Model Selection
Qoder CLI uses automatic model routing - it selects the globally optimal model based on task characteristics. You can override this:
| Model Value | Use Case | Speed | Quality | Cost |
|---|
| INLINECODE30 | Default - automatic routing | ⚡⚡⚡ | ⭐⭐⭐ | 💰💰💰 |
| INLINECODE31 |
Quick tasks, simple queries | ⚡⚡⚡⚡ | ⭐⭐ | 💰💰 |
|
lite | Very simple tasks | ⚡⚡⚡⚡⚡ | ⭐ | 💰 |
|
performance | Complex tasks needing depth | ⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰💰 |
|
ultimate |
Best quality - refactoring, architecture, code review | ⚡ | ⭐⭐⭐⭐⭐ | 💰💰💰💰💰 |
|
qmodel | Qwen model family | ⚡⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰 |
|
q35model | Qwen 3.5 specific | ⚡⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰 |
|
mmodel | MiniMax model | ⚡⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰 |
|
gmodel | GPT model family | ⚡⚡ | ⭐⭐⭐⭐⭐ | 💰💰💰💰 |
Recommendations:
- - Default: Use
--model=auto (let Qoder choose) - Refactoring/Architecture: INLINECODE40
- Quick fixes: INLINECODE41
- Code review:
--model=performance or INLINECODE43 - Simple queries:
--model=lite or INLINECODE45
🎯 Quest Mode (Spec-Driven Development)
Quest Mode allows you to write specifications while AI automatically completes development tasks using subagents.
CODEBLOCK3
Quest Mode automatically:
- 1. Analyzes requirements
- Routes to appropriate subagents
- Coordinates multi-step development
- Ensures consistency across files
🤖 Subagents
Subagents are specialized AI agents for specific tasks with their own context windows and tool permissions.
Create a Subagent (Manual)
Create markdown files in:
- -
~/.qoder/agents/<agentName>.md - User-level (all projects) - INLINECODE47 - Project-level
Example: code-review agent
CODEBLOCK4
Use Subagents
CODEBLOCK5
🌳 Worktree (Parallel Jobs)
Worktree jobs are concurrent jobs that use Git worktrees to run tasks in parallel, avoiding read/write conflicts.
Requirements: Git installed and usable locally.
Commands
| Command | Description |
|---|
| INLINECODE48 | Create and start new worktree job |
| INLINECODE49 |
List existing worktree jobs |
|
qodercli rm <jobId> | Remove a job (delete worktree) |
Create a Job
CODEBLOCK6
View Jobs
CODEBLOCK7
Delete Jobs
CODEBLOCK8
⚠️ Warning: Deletion is irreversible. Proceed with caution.
Parallel Issue Fixing Example
CODEBLOCK9
🔌 MCP Servers
Qoder CLI integrates with any standard MCP (Model Context Protocol) tool.
Add MCP Servers
CODEBLOCK10
Recommended MCP Tools
CODEBLOCK11
Manage MCP Servers
CODEBLOCK12
🔐 Permissions
Qoder CLI enforces precise tool execution permissions.
Configuration Files (precedence: high → low)
- 1.
${project}/.qoder/settings.local.json - Project-level, highest (gitignore) - INLINECODE52 - Project-level
- INLINECODE53 - User-level
Permission Strategies
| Strategy | Description |
|---|
| INLINECODE54 | Automatically allow matching operations |
| INLINECODE55 |
Automatically deny matching operations |
|
ask | Prompt for permission (default for outside project) |
Example Configuration
CODEBLOCK13
Permission Types
1. Read & Edit Rules
Patterns follow gitignore-style matching:
| Pattern Form | Description | Example | Matches |
|---|
| INLINECODE57 | Absolute from system root | INLINECODE58 | INLINECODE59 |
| INLINECODE60 |
From home directory |
Read(~/Documents/*.png) |
/Users/demo/Documents/xx.png |
|
path or
./path | Relative to current dir |
Read(/*.java) |
./xx.java |
|
!** | Negation pattern |
Read(!**/node_modules/**) | Excludes node_modules |
2. WebFetch Rules
Restrict domains for network fetch:
CODEBLOCK14
3. Bash Rules
Restrict commands for shell execution:
CODEBLOCK15
📝 Memory (AGENTS.md)
Qoder CLI uses AGENTS.md as memory - content is auto-loaded as context.
File Locations
- - User-level:
~/.qoder/AGENTS.md - Applies to all projects - Project-level:
${project}/AGENTS.md - Applies to current project
Typical Content
- - Development standards and notes
- Overall system architecture
- Project-specific conventions
- API documentation
- Testing requirements
Generate/Manage
CODEBLOCK16
⚡ Advanced Options
| Option | Description | Example |
|---|
| INLINECODE72 | Specify workspace directory | INLINECODE73 |
| INLINECODE74 |
Continue last session |
qodercli -c -p "continue" |
|
-r | Resume specific session |
qodercli -r <session-id> |
|
--allowed-tools | Allow only specified tools |
qodercli --allowed-tools=READ,WRITE |
|
--disallowed-tools | Disallow specified tools |
qodercli --disallowed-tools=Bash |
|
--max-turns | Maximum dialog turns |
qodercli --max-turns=10 |
|
--yolo | Skip permission checks |
qodercli --yolo |
|
--worktree | Create worktree job |
qodercli --worktree "task" |
|
--branch | Set branch for worktree |
qodercli --worktree --branch=main |
|
--agents | Define custom agents inline |
qodercli --agents='{...}' |
|
--attachment | Attach image files |
qodercli --attachment=img.png |
⚠️ Rules
- 1. Print mode only - TUI mode not supported in OpenClaw
- Always use
-p flag - Non-interactive mode required - Respect workdir - Qoder sees only the specified directory's context
- Monitor with process:log - check background session progress
- Use worktrees for parallel work - avoid read/write conflicts
- Initialize AGENTS.md - helps Qoder understand project context
- Configure permissions - set appropriate access rules per project
- Leverage subagents - specialized agents for specific tasks
- Add MCP servers - extend capabilities with external tools
- Works in all sessions - environment variables are inherited automatically
- Use ultimate model for complex tasks - refactoring, architecture, code review
Progress Updates (Critical)
When you spawn Qoder CLI in the background, keep the user in the loop:
- - Send 1 short message when you start (what's running + where)
- Then only update again when something changes:
- a milestone completes (build finished, tests passed)
- the CLI asks a question / needs input
- you hit an error or need user action
- the CLI finishes (include what changed + where)
- - If you kill a session, immediately say you killed it and why
This prevents the user from seeing only "Agent failed before reply" and having no idea what happened.
Auto-Notify on Completion
For long-running background tasks, append a wake trigger:
CODEBLOCK17
This triggers an immediate wake event — you get pinged in seconds, not minutes.
🌐 Cross-Session Usage
In Group Chats (DingTalk, Discord, Slack)
CODEBLOCK18
In Direct Messages
Same as group chats - works out of the box.
In Shared Workspaces
CODEBLOCK19
Privacy Note
- - Qoder CLI only accesses the specified INLINECODE95
- Environment variables are inherited from the host shell
- No credentials are exposed in chat messages
- Each session has isolated Qoder CLI state
📊 Comparison with Other Coding Agents
| Feature | Qoder CLI | Codex | Claude Code |
|---|
| Print Mode | ✅ | ✅ | ❌ |
| Subagents |
✅ | ❌ | ❌ |
| Worktrees | ✅ | ❌ | ❌ |
| MCP Servers | ✅ | ✅ | ✅ |
| Memory (AGENTS.md) | ✅ | ✅ | ✅ |
| Model Selection | ✅ (auto-routing) | ❌ | ❌ |
| Quest Mode | ✅ | ❌ | ❌ |
| Permission System | ✅ (granular) | ⚠️ | ⚠️ |
| All-Sessions Ready | ✅ | ⚠️ | ⚠️ |
Qoder CLI strengths:
- - Subagents for specialized tasks
- Worktrees for parallel development
- Quest mode for spec-driven development
- Automatic model routing
- Granular permission system
- Cross-session compatibility
📋 Quick Reference Card
CODEBLOCK20
🔧 Troubleshooting
Not Logged In
CODEBLOCK21
Permission Denied
CODEBLOCK22
Model Selection Issues
CODEBLOCK23
TUI Mode Error
TUI mode is NOT supported in OpenClaw. Always use Print mode:
CODEBLOCK24
Qoder Agent (打印模式 - 非交互式)
在 OpenClaw 中所有 Qoder CLI 工作都使用打印模式(-p)。自动化环境不支持 TUI 模式。
✅ 全会话就绪: 此技能适用于:
- - 直接 1:1 聊天
- 群聊(钉钉、Discord、Slack 等)
- 共享工作区会话
- 私人会话
⚠️ 重要提示:仅限打印模式
由于 TTY 要求,OpenClaw 或其他自动化环境不支持 TUI 模式。
始终使用带 -p 标志的打印模式:
bash
✅ 正确 - 打印模式(非交互式)
bash workdir:~/project command:qodercli -p 添加错误处理
❌ 错误 - TUI 模式需要交互式终端
bash pty:true command:qodercli # 会失败
🔐 环境设置(自动检测)
Qoder CLI 认证可通过以下方式自动获取:
bash
环境变量(在 ~/.zshrc 中设置)
QODER
PERSONALACCESS
TOKEN=yourtoken_here
或检查是否已认证
qodercli status
在任何会话类型中,环境变量都从 shell 继承,因此 Qoder CLI 可以无缝工作。
🚀 快速开始
基本用法
bash
快速一次性任务
bash workdir:~/project command:qodercli -p 为 API 调用添加错误处理
使用终极模型获得最佳质量
bash workdir:~/project command:qodercli --model=ultimate -p 重构此模块
使用 JSON 输出
bash workdir:~/project command:qodercli --output-format=json -p 分析此代码
继续上次会话
bash workdir:~/project command:qodercli -c -p 继续重构
最大轮次限制
bash workdir:~/project command:qodercli --max-turns=10 -p 修复此错误
Yolo 模式(跳过权限检查)
bash workdir:~/project command:qodercli --yolo -p 进行更改
🎯 打印模式标志
| 标志 | 描述 | 示例 |
|---|
| -p | 必需 - 非交互式运行 | qodercli -p 任务 |
| -q |
安静模式(隐藏加载动画) | qodercli -q -p 任务 |
| --output-format | 输出格式:text、json、stream-json | qodercli --output-format=json |
| -w | 指定工作区目录 | qodercli -w /path/to/project |
| -c | 继续上次会话 | qodercli -c -p 继续 |
| -r | 恢复特定会话 | qodercli -r <会话ID> |
| --model | 模型层级选择 | qodercli --model=ultimate |
| --max-turns | 最大对话轮次(0 = 无限制) | qodercli --max-turns=10 |
| --max-output-tokens | 最大令牌数:16k、32k | qodercli --max-output-tokens=32k |
| --yolo | 跳过权限检查 | qodercli --yolo |
| --allowed-tools | 仅允许指定工具 | qodercli --allowed-tools=READ,WRITE |
| --disallowed-tools | 禁止指定工具 | qodercli --disallowed-tools=Bash |
| --agents | 定义自定义代理的 JSON 对象 | qodercli --agents={reviewer:{...}} |
| --attachment | 附加图片文件(可重复) | qodercli --attachment=img.png |
🧠 模型选择
Qoder CLI 使用自动模型路由——它根据任务特征选择全局最优模型。您可以覆盖此设置:
| 模型值 | 使用场景 | 速度 | 质量 | 成本 |
|---|
| auto | 默认 - 自动路由 | ⚡⚡⚡ | ⭐⭐⭐ | 💰💰💰 |
| efficient |
快速任务、简单查询 | ⚡⚡⚡⚡ | ⭐⭐ | 💰💰 |
| lite | 非常简单的任务 | ⚡⚡⚡⚡⚡ | ⭐ | 💰 |
| performance | 需要深度的复杂任务 | ⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰💰 |
| ultimate |
最佳质量 - 重构、架构、代码审查 | ⚡ | ⭐⭐⭐⭐⭐ | 💰💰💰💰💰 |
| qmodel | Qwen 模型系列 | ⚡⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰 |
| q35model | Qwen 3.5 专用 | ⚡⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰 |
| mmodel | MiniMax 模型 | ⚡⚡⚡ | ⭐⭐⭐⭐ | 💰💰💰 |
| gmodel | GPT 模型系列 | ⚡⚡ | ⭐⭐⭐⭐⭐ | 💰💰💰💰 |
建议:
- - 默认:使用 --model=auto(让 Qoder 选择)
- 重构/架构:--model=ultimate
- 快速修复:--model=efficient
- 代码审查:--model=performance 或 ultimate
- 简单查询:--model=lite 或 efficient
🎯 任务模式(规范驱动开发)
任务模式允许您编写规范,同时 AI 使用子代理自动完成开发任务。
bash
通过提示进入任务模式
bash workdir:~/project command:qodercli --model=ultimate -p 构建一个带有认证、速率限制和日志记录的 REST API
任务模式会自动:
- 1. 分析需求
- 路由到适当的子代理
- 协调多步骤开发
- 确保文件间的一致性
🤖 子代理
子代理是用于特定任务的专门 AI 代理,拥有自己的上下文窗口和工具权限。
创建子代理(手动)
在以下位置创建 Markdown 文件:
- - ~/.qoder/agents/.md - 用户级别(所有项目)
- ${project}/agents/.md - 项目级别
示例:代码审查代理
markdown
name: code-review
description: 代码审查专家,负责质量和安全检查
tools: Read, Grep, Glob, Bash
您是一名高级代码审查员,负责确保代码质量。
检查清单:
- 1. 可读性和代码风格
- 命名约定
- 错误处理
- 安全检查
- 测试覆盖率
- 性能考虑
使用子代理
bash
显式调用
bash workdir:~/project command:qodercli -p 使用 code-review 子代理检查代码问题
隐式调用
bash workdir:~/project command:qodercli -p 分析此代码是否存在潜在性能问题
链式子代理
bash workdir:~/project command:qodercli -p 先使用 design 子代理进行系统设计,然后使用 code-review 子代理
内联自定义代理
bash workdir:~/project command:qodercli --agents={\reviewer\:{\description\:\审查代码\,\prompt\:\您是一名代码审查员\}} -p 审查此代码
🌳 工作树(并行任务)
工作树任务是并发任务,使用 Git 工作树并行运行任务,避免读写冲突。
要求: 已安装 Git 并可在本地使用。
命令
| 命令 | 描述 |
|---|
| qodercli --worktree 任务描述 | 创建并启动新的工作树任务 |
| qodercli jobs --worktree |
列出现有的工作树任务 |
| qodercli rm
| 删除任务(删除工作树) |
创建任务
bash
基本工作树任务(非交互式)
bash workdir:~/project command:qodercli --worktree -p 修复问题 #78
指定分支
bash workdir:~/project command:qodercli --worktree --branch=main -p 实现功能
设置最大轮次
bash workdir:~/project command:qodercli --work