返回 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.
53
54 The parent model can also select a profile at call time without listing profile
55 names in the tool schema (prompt-cache stability):
56
57 ```text
58 task(profile="doc-rewriter", prompt="rewrite docs/01.md", write_paths=["docs/01.md"])
59 fleet(tasks=[
60 {profile="doc-rewriter", prompt="rewrite docs/01.md", write_paths=["docs/01.md"]},
61 {profile="doc-rewriter", prompt="rewrite docs/02.md", write_paths=["docs/02.md"]}
62 ])
63 ```
64
65 - `profile` on `task` / `fleet` items resolves a `runAs: subagent` Skill by name
66 (explicit names may call `invocation: manual` profiles).
67 - The profile body becomes the **full** child system prompt — no implicit
68 concise default is stacked on top.
69 - `write_paths` declares non-overlapping write targets so parallel writers can
70 share one workspace. Writer tasks that omit `write_paths` claim the whole
71 workspace (serializing against every other writer claim). In `fleet`,
72 multiple whole-workspace claims or any path overlap fail preflight and start
73 nothing.
74 - Session defaults: `agent.max_subagent_concurrency = 6`,
75 `agent.max_parallel_writers = 3` (both configurable 1–32; writers ≤ total).
76
77 For scripts and other headless use, choose an explicit command:
78
79 ```bash
80 # Preview with read-only tools.
81 reasonix subagent try reviewer "review the current diff"
82
83 # Run with the normal permission and sandbox policy.
84 reasonix subagent run reviewer "review and fix the current diff"
85
86 # Read the task from stdin and cap tool-call rounds.
87 git diff | reasonix subagent run reviewer --max-steps 20
88 ```
89
90 Put `run`/`try` flags before the task. Both commands also accept `--model REF`
91 and `--dir PATH`. `try` always selects the read-only runner. `run` uses the
92 normal isolated runner; permission `deny` rules and sandbox restrictions still
93 apply. Ordinary `reasonix run` remains a plain one-shot task entry point and
94 does not implicitly interpret `/<profile>` syntax.
95
96 ## Manage profiles
97
98 ```text
99 reasonix subagent list [--dir PATH]
100 reasonix subagent create <name> --description TEXT (--prompt TEXT | --prompt-file PATH)
101 [--scope project|global] [--model REF] [--effort LEVEL]
102 [--tools a,b] [--color NAME] [--dir PATH]
103 reasonix subagent edit <name> [--description TEXT]
104 [--prompt TEXT | --prompt-file PATH] [--model REF] [--effort LEVEL]
105 [--tools a,b] [--color NAME] [--dir PATH]
106 reasonix subagent delete <name> --yes [--dir PATH]
107 reasonix subagent try <name> [--model REF] [--max-steps N] [--dir PATH] <task>
108 reasonix subagent run <name> [--model REF] [--max-steps N] [--dir PATH] <task>
109 ```
110
111 `edit` changes only fields supplied on the command line. Use an explicit empty
112 value to clear an optional field:
113
114 ```bash
115 reasonix subagent edit reviewer --model= --effort= --tools= --color=
116 ```
117
118 An omitted or empty tool list means the profile adds no tool allowlist; the
119 runner's normal availability, permission, sandbox, and read-only rules still
120 apply. `delete` requires `--yes` so it is never an implicit destructive action.
121
122 Built-in profiles have no writable Skill file. Their `edit` command accepts
123 only `--model` and `--effort`, storing the same per-profile overrides used by
124 desktop settings. Clearing either value removes that override.
125
126 ## File format and advanced profiles
127
128 The CLI and desktop profile editors produce a compact Skill file like this:
129
130 ```yaml
131 ---
132 name: reviewer
133 description: Review changes for correctness and regressions
134 color: orange
135 invocation: manual
136 runAs: subagent
137 model: deepseek-pro
138 effort: high
139 read-only: true
140 allowed-tools: [read_file, grep, bash]
141 ---
142 You are a focused code reviewer. Inspect the requested changes and return only
143 actionable findings, ordered by severity.
144 ```
145
146 `invocation: manual` prevents automatic discovery in the model's pinned Skill
147 index; users can still invoke the profile explicitly. `allowed-tools` is a
148 profile-level allowlist, not a way to bypass permissions. `read-only: true`
149 forces the read-only tool registry (writer tools stripped); omitted/`false`
150 keeps the legacy writable default.
151
152 You may hand-author richer `runAs: subagent` Skills, including custom Skill
153 paths and extra frontmatter. They can be listed and invoked, but the profile
154 editors deliberately refuse to edit or delete:
155
156 - profiles outside project/global scope;
157 - profiles whose `invocation` is not `manual`;
158 - files with frontmatter the editor does not manage; or
159 - Skill directories containing `references/` or `scripts/`.
160
161 This prevents a simplified editor from silently discarding advanced Skill
162 content. Manage those profiles as Skill files instead.
163
164 ## Model and effort selection
165
166 The effective model and effort are selected in this order, from highest to
167 lowest priority:
168
169 1. per-profile entries in `agent.subagent_models` and
170 `agent.subagent_efforts`;
171 2. this call's `model` / `effort` arguments on `task` or `fleet`;
172 3. the profile's `model` and `effort` frontmatter;
173 4. `agent.subagent_model` and `agent.subagent_effort` defaults;
174 5. the configured executor/default model and its default effort.
175
176 For example:
177
178 ```toml
179 [agent]
180 subagent_model = "deepseek-pro"
181 subagent_effort = "high"
182 subagent_models = { reviewer = "deepseek/deepseek-v4-pro" }
183 subagent_efforts = { reviewer = "max" }
184 ```
185
186 The `--model` flag on `subagent run` or `subagent try` selects the default model
187 used to initialize that headless command; profile-specific configuration still
188 has its documented precedence.
189
190 ## Desktop and troubleshooting
191
192 Profiles created in desktop settings and with `reasonix subagent create` share
193 the same files. Refresh or start a new session after changing profiles so an
194 already-running session reloads the Skill registry.
195
196 If invocation reports an unknown or disabled profile, check
197 `reasonix subagent list`, the current `--dir`, and `skills.disabled_skills`. If
198 editing reports that a profile is custom or rich, edit its `SKILL.md` directly
199 instead of forcing it through the profile editor. Unknown model references and
200 invalid effort levels are rejected when Reasonix resolves the effective model.
201
201 lines MARKDOWN