What would you like to be added?
Support declarative agent definitions — define custom agents via Markdown files with YAML frontmatter, instead of hardcoding them in TypeScript. This is the pattern Claude Code shipped in 2.1.167.
How it works in Claude Code
Users place a .claude/agents/<name>.md file with frontmatter:
---
name: code-reviewer
description: "Review code for bugs and style issues"
model: sonnet
effort: high
permissionMode: plan
tools:
- Read
- Bash
- Grep
disallowedTools:
- Write
- Edit
maxTurns: 10
skills:
- code-review
memory: project
isolation: worktree
hooks:
PreToolUse:
- command: "echo reviewing..."
---
You are a code reviewer. Focus on correctness bugs...
The Markdown body becomes the agent's system prompt. The agent is then available via the Agent tool and --agent CLI flag.
Full schema (confirmed via binary reverse engineering of CC 2.1.167)
| Field |
Type |
Description |
name |
string (required) |
Agent identifier, used by Agent tool and --agent flag |
description |
string (required) |
When to use this agent, shown in Agent tool listing |
model |
string |
Model override (haiku, sonnet, opus, or full ID). inherit = match parent |
tools |
string[] |
Tools available to this agent (replaces default set) |
disallowedTools |
string[] |
Tools removed from default set (ignored if tools is set) |
effort |
string |
Thinking effort: low, medium, high, max |
permissionMode |
string |
Permission mode the agent runs in |
mcpServers |
object |
MCP servers to connect when this agent runs |
hooks |
object |
Hooks registered while this agent runs |
maxTurns |
number/string/null |
Maximum conversation turns before agent stops |
skills |
string[] |
Skills preloaded for this agent |
initialPrompt |
string |
Auto-submitted first message (only when run as main session via --agent) |
memory |
string |
Memory scope: user, project, or local |
background |
boolean |
If true, agent runs in background by default |
isolation |
string |
Filesystem isolation: worktree runs in a temporary git worktree |
Why this matters
- User-defined agents — users can create project-specific agents (e.g. a DB migration agent, a security reviewer) without writing code
- Composable — agents can reference skills, hooks, and MCP servers declaratively
- Discoverable —
.qwen/agents/ directory makes agents visible and version-controllable
- Parity — Claude Code already ships this; community expects it
Suggested implementation
- Add
.qwen/agents/ directory scanning (similar to .qwen/skills/)
- Parse frontmatter with the same parser used for skills
- Register discovered agents in the existing
builtin-agents.ts / subagent-manager.ts pipeline
- Validate schema with zod (like CC does)
- Support both project-level (
.qwen/agents/) and user-level (~/.qwen/agents/) definitions
Prior art in this repo
- Skill frontmatter parsing already exists (
skill-load.ts, skill-manager.ts)
builtin-agents.ts has the registration path
subagent-manager.ts handles agent lifecycle
The skill loading pipeline can be largely reused — the main new work is the schema definition and wiring agents into the Agent tool's type resolution.
What would you like to be added?
Support declarative agent definitions — define custom agents via Markdown files with YAML frontmatter, instead of hardcoding them in TypeScript. This is the pattern Claude Code shipped in 2.1.167.
How it works in Claude Code
Users place a
.claude/agents/<name>.mdfile with frontmatter:The Markdown body becomes the agent's system prompt. The agent is then available via the
Agenttool and--agentCLI flag.Full schema (confirmed via binary reverse engineering of CC 2.1.167)
nameAgenttool and--agentflagdescriptionmodelhaiku,sonnet,opus, or full ID).inherit= match parenttoolsdisallowedToolstoolsis set)effortlow,medium,high,maxpermissionModemcpServershooksmaxTurnsskillsinitialPrompt--agent)memoryuser,project, orlocalbackgroundisolationworktreeruns in a temporary git worktreeWhy this matters
.qwen/agents/directory makes agents visible and version-controllableSuggested implementation
.qwen/agents/directory scanning (similar to.qwen/skills/)builtin-agents.ts/subagent-manager.tspipeline.qwen/agents/) and user-level (~/.qwen/agents/) definitionsPrior art in this repo
skill-load.ts,skill-manager.ts)builtin-agents.tshas the registration pathsubagent-manager.tshandles agent lifecycleThe skill loading pipeline can be largely reused — the main new work is the schema definition and wiring agents into the
Agenttool's type resolution.