Gate task subagents behind permission prompt; subagents=false / --no-subagents; description: only when asked

This commit is contained in:
hermes committed 2026-11-14 13:18:27 +00:00
1 parent 161c33fe6c
commit b84b6ab23a
6 files changed
+46 -6

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
# model = "claude-sonnet-5-5" # model for the chosen provider; "auto" = pick per prompt (see [auto])
# claude_model = "claude-sonnet-5-5" # default: the account's latest Sonnet
# codex_model = "gpt-5.6-sol" # default: Codex's top-listed model
# subagents = false # do not offer the `task` tool (default true; every call asks first)
# explore_model = "claude-haiku-4-5" # read-only `task` subagents; default: cheapest tier of the provider
# remember_model = true # reuse the last model picked with /model or /provider
# compact_at = 900000 # auto-compact at this many tokens; default: 90% of the context window
+10 -2
View File
@@ -49,6 +49,9 @@ struct Cli {
/// prompt (also `permissions = "auto"`).
#[arg(long, conflicts_with = "yolo")]
auto: bool,
/// Do not offer the `task` subagent tool to the model.
#[arg(long)]
no_subagents: bool,
/// Run bash, LSP servers and lens runners in a sandbox (bwrap / seatbelt).
#[arg(long, conflicts_with = "no_sandbox")]
sandbox: bool,
@@ -160,6 +163,8 @@ struct Config {
max_tokens: Option<u32>,
/// Model for read-only `task` subagents; default: the provider's cheapest tier (Haiku / Luna).
explore_model: Option<String>,
/// Register the `task` subagent tool (default true; each call still asks the user). `--no-subagents` = off.
subagents: Option<bool>,
/// Add the `codemode` tool: JS scripts that call the other tools (default false).
codemode: Option<bool>,
/// Capture the mouse for wheel scrolling (default true; false = terminal selection works without shift).
@@ -236,6 +241,7 @@ impl Config {
compact_at: o.compact_at.or(c.compact_at),
max_tokens: o.max_tokens.or(c.max_tokens),
explore_model: o.explore_model.or(c.explore_model),
subagents: o.subagents.or(c.subagents),
codemode: o.codemode.or(c.codemode),
mouse: o.mouse.or(c.mouse),
remember_model: o.remember_model.or(c.remember_model),
@@ -704,7 +710,9 @@ async fn main() -> Result<()> {
];
rows.extend(skill_rows);
let mut specs = reg.specs();
specs.push(hx_core::subagent::spec());
if !cli.no_subagents && cfg.subagents != Some(false) {
specs.push(hx_core::subagent::spec());
}
specs.sort_by_key(|t| {
std::cmp::Reverse(serde_json::to_string(t).map_or(0, |s| s.len()))
});
@@ -1052,7 +1060,7 @@ async fn main() -> Result<()> {
mgr.warm(probe).await;
}
trace("lens");
{
if !cli.no_subagents && cfg.subagents != Some(false) {
// children get the parent's tools as of now (no `task`, so no recursion)
let mut general = agent.tools.clone();
general.retain(|n| n != "ask_user" && n != "exit_plan");