返回 DeepSeek-Reasonix
SUBAGENT_PROFILES.md
根目录 / docs / SUBAGENT_PROFILES.md
1 # Subagent profiles
2
3 Subagent profiles are reusable, explicitly invoked agents for focused work such
4 as code review, investigation, or documentation. Each profile is a manual Skill
5 with `runAs: subagent`: Reasonix starts an isolated child agent, gives it the
6 profile prompt and task, and returns only its final answer to the parent.
7
8 Profiles are shared by the desktop app, interactive CLI, and headless CLI. They
9 use the existing Skill file format and storage rather than a separate database.
10
11 ## Create a profile
12
13 Create a project profile from a prompt file:
14
15 ```bash
16 reasonix subagent create reviewer \
17 --description "Review changes for correctness and regressions" \
18 --prompt-file reviewer.md \
19 --tools read_file,grep,bash \
20 --model deepseek-pro \
21 --effort high
22 ```
23
24 With a workspace, `create` defaults to project scope. Outside a workspace it
25 defaults to global scope. Pass `--scope project` or `--scope global` to make the
26 choice explicit. Project profiles are stored under
27 `.reasonix/skills/<name>/SKILL.md`; global profiles are stored under the
28 Reasonix home Skill directory described in
29 [Configuration paths](./CONFIG_PATHS.md).
30
31 The prompt may come from `--prompt`, `--prompt-file PATH`,
32 `--prompt-file -`, or piped stdin:
33
34 ```bash
35 printf '%s\n' 'Review the task and report only actionable findings.' | \
36 reasonix subagent create reviewer --description "Code reviewer"
37 ```
38
39 Names may contain letters, digits, `_`, `-`, and `.`. Reasonix refuses a name
40 that already belongs to another project, global, custom, or built-in Skill.
41
42 ## Invoke a profile
43
44 In an interactive CLI or desktop chat, use a slash command:
45
46 ```text
47 /reviewer review the current diff
48 ```
49
50 This is a real isolated subagent run, not prompt text inserted into the parent
51 agent. The parent conversation retains the task and the child's final answer,
52 not the child's full working context. Review and security-review children also
53 receive a compact parent facts pack (confirmed decisions, evidence summary, file
54 anchors) and a 2048 output-token cap per response; their step budget is the
55 same as any other sub-agent's (an explicit `max_steps` wins).
56
57 The parent model can also select a profile at call time without listing profile
58 names in the tool schema (prompt-cache stability):
59
60 ```text
61 task(profile="doc-rewriter", prompt="rewrite docs/01.md", write_paths=["docs/01.md"])
62 fleet(tasks=[
63 {profile="doc-rewriter", prompt="rewrite docs/01.md", write_paths=["docs/01.md"]},
64 {profile="doc-rewriter", prompt="rewrite docs/02.md", write_paths=["docs/02.md"]}
65 ])
66 ```
67
68 - `profile` on `task` / `fleet` items resolves a `runAs: subagent` Skill by name
69 (explicit names may call `invocation: manual` profiles).
70 - The profile body becomes the **full** child system prompt — no implicit
71 concise default is stacked on top.
72 - `write_paths` declares write targets so parallel writers can share one
73 workspace. File claims must be disjoint to start together. Directory claims
74 may start together and only serialize when they realize the same file.
75 Writer tasks that omit `write_paths` start as a whole-workspace claim
76 (serializing at start). After path-bound writes only, that reservation
77 shrinks to the files touched; `bash`/MCP makes it whole-workspace again. In
78 `fleet`, concurrent omitted claims queue in the scheduler instead of failing
79 preflight; concurrent directory claims start together. Once a whole-workspace
80 writer is queued, later writers cannot bypass it.
81 - Session defaults: `agent.max_subagent_concurrency = 6`,
82 `agent.max_parallel_writers = 3` (both configurable 1–32; writers ≤ total).
83
84 For scripts and other headless use, choose an explicit command:
85
86 ```bash
87 # Preview with read-only tools.
88 reasonix subagent try reviewer "review the current diff"
89
90 # Run with the normal permission and sandbox policy.
91 reasonix subagent run reviewer "review and fix the current diff"
92
93 # Read the task from stdin and cap tool-call rounds.
94 git diff | reasonix subagent run reviewer --max-steps 20
95 ```
96
97 Put `run`/`try` flags before the task. Both commands also accept `--model REF`
98 and `--dir PATH`. `try` always selects the read-only runner. `run` uses the
99 normal isolated runner; permission `deny` rules and sandbox restrictions still
100 apply. Ordinary `reasonix run` remains a plain one-shot task entry point and
101 does not implicitly interpret `/<profile>` syntax.
102
103 ## Manage profiles
104
105 ```text
106 reasonix subagent list [--dir PATH]
107 reasonix subagent create <name> --description TEXT (--prompt TEXT | --prompt-file PATH)
108 [--scope project|global] [--model REF] [--effort LEVEL]
109 [--tools a,b] [--color NAME] [--dir PATH]
110 reasonix subagent edit <name> [--description TEXT]
111 [--prompt TEXT | --prompt-file PATH] [--model REF] [--effort LEVEL]
112 [--tools a,b] [--color NAME] [--dir PATH]
113 reasonix subagent delete <name> --yes [--dir PATH]
114 reasonix subagent try <name> [--model REF] [--max-steps N] [--dir PATH] <task>
115 reasonix subagent run <name> [--model REF] [--max-steps N] [--dir PATH] <task>
116 ```
117
118 `edit` changes only fields supplied on the command line. Use an explicit empty
119 value to clear an optional field:
120
121 ```bash
122 reasonix subagent edit reviewer --model= --effort= --tools= --color=
123 ```
124
125 An omitted or empty tool list means the profile adds no tool allowlist; the
126 runner's normal availability, permission, sandbox, and read-only rules still
127 apply. `delete` requires `--yes` so it is never an implicit destructive action.
128
129 Built-in profiles have no writable Skill file. Their `edit` command accepts
130 only `--model` and `--effort`, storing the same per-profile overrides used by
131 desktop settings. Clearing either value removes that override.
132
133 ## File format and advanced profiles
134
135 The CLI and desktop profile editors produce a compact Skill file like this:
136
137 ```yaml
138 ---
139 name: reviewer
140 description: Review changes for correctness and regressions
141 color: orange
142 invocation: manual
143 runAs: subagent
144 model: deepseek-pro
145 effort: high
146 read-only: true
147 allowed-tools: [read_file, grep, bash]
148 ---
149 You are a focused code reviewer. Inspect the requested changes and return only
150 actionable findings, ordered by severity.
151 ```
152
153 `invocation: manual` prevents automatic discovery in the model's
154 `session-context` Skills catalog; users can still invoke the profile explicitly. `allowed-tools` is a
155 profile-level allowlist, not a way to bypass permissions. `read-only: true`
156 forces the read-only tool registry (writer tools stripped); omitted/`false`
157 keeps the legacy writable default.
158
159 You may hand-author richer `runAs: subagent` Skills, including custom Skill
160 paths and extra frontmatter. They can be listed and invoked, but the profile
161 editors deliberately refuse to edit or delete:
162
163 - profiles outside project/global scope;
164 - profiles whose `invocation` is not `manual`;
165 - files with frontmatter the editor does not manage; or
166 - Skill directories containing `references/` or `scripts/`.
167
168 This prevents a simplified editor from silently discarding advanced Skill
169 content. Manage those profiles as Skill files instead.
170
171 ## Model and effort selection
172
173 The effective model and effort are selected in this order, from highest to
174 lowest priority:
175
176 1. per-profile entries in `agent.subagent_models` and
177 `agent.subagent_efforts`;
178 2. this call's `model` / `effort` arguments on `task` or `fleet`;
179 3. the profile's `model` and `effort` frontmatter;
180 4. `agent.subagent_model` and `agent.subagent_effort` defaults;
181 5. the configured executor/default model and its default effort.
182
183 For example:
184
185 ```toml
186 [agent]
187 subagent_model = "deepseek-pro"
188 subagent_effort = "high"
189 subagent_models = { reviewer = "deepseek/deepseek-v4-pro" }
190 subagent_efforts = { reviewer = "max" }
191 ```
192
193 The `--model` flag on `subagent run` or `subagent try` selects the default model
194 used to initialize that headless command; profile-specific configuration still
195 has its documented precedence.
196
197 ## Desktop and troubleshooting
198
199 Profiles created in desktop settings and with `reasonix subagent create` share
200 the same files. Refresh or start a new session after changing profiles so an
201 already-running session reloads the Skill registry.
202
203 If invocation reports an unknown or disabled profile, check
204 `reasonix subagent list`, the current `--dir`, and `skills.disabled_skills`. If
205 editing reports that a profile is custom or rich, edit its `SKILL.md` directly
206 instead of forcing it through the profile editor. Unknown model references and
207 invalid effort levels are rejected when Reasonix resolves the effective model.
208
208 lines MARKDOWN