Subagents: task tool with explore and general #113

Merged
hermes merged 1 commits from subagents into main 2026-10-02 13:57:55 +00:00
Collaborator

task(prompt, kind) runs a child agent with a fresh context; only its final answer (cut at 8 KB, plus a stats line) returns.

  • explore (default): read-only (read, lsp, bash), cheapest model of the provider (Haiku / Luna) or explore_model in config.
  • general: the parent tools (minus ask_user and task) and model; lens hooks run on its edits.
  • Max 3 in parallel (semaphore), no recursion, parent abort stops children (also while waiting for a slot).
  • State shared with the parent (read-guard). Child sessions at <session>.sub/NNN-kind.jsonl; hx stats lists them. Child usage rolls into the parent total via State.sub_usage and a new sub_usage event (footer, /usage, NDJSON).
  • TUI tool row shows explore · 12 tool calls · 41k tok · 38s.
  • hx prefix: +149 tok for the tool (613 -> 763).

Caveat (README): a child starts with a cold cache; this saves main-context size, not total tokens. Measure on a real search-heavy session before relying on it.

Tests: subagent.rs (result+usage+model+session file, kind routing/cut, abort), tests/m8_e2e.sh (parent->child->parent over the fake API, tool sets, model, stats), all.sh green locally (124 unit tests).

`task(prompt, kind)` runs a child agent with a fresh context; only its final answer (cut at 8 KB, plus a stats line) returns. - `explore` (default): read-only (read, lsp, bash), cheapest model of the provider (Haiku / Luna) or `explore_model` in config. - `general`: the parent tools (minus ask_user and task) and model; lens hooks run on its edits. - Max 3 in parallel (semaphore), no recursion, parent abort stops children (also while waiting for a slot). - State shared with the parent (read-guard). Child sessions at `<session>.sub/NNN-kind.jsonl`; `hx stats` lists them. Child usage rolls into the parent total via `State.sub_usage` and a new `sub_usage` event (footer, /usage, NDJSON). - TUI tool row shows `explore · 12 tool calls · 41k tok · 38s`. - `hx prefix`: +149 tok for the tool (613 -> 763). Caveat (README): a child starts with a cold cache; this saves main-context size, not total tokens. Measure on a real search-heavy session before relying on it. Tests: subagent.rs (result+usage+model+session file, kind routing/cut, abort), tests/m8_e2e.sh (parent->child->parent over the fake API, tool sets, model, stats), all.sh green locally (124 unit tests).
hermes added 1 commit 2026-10-02 11:58:01 +00:00
Subagents: task tool (explore on cheap model, general), child sessions, usage roll-up, stats
ci / check (pull_request) Canceled after 0s
ci / check (push) Canceled after 0s
359a5058d7
hermes merged commit 1671498cd9 into main 2026-10-02 13:57:55 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/hx#113