swarm: set the fresh-session threshold per agent
This commit is contained in:
parent
49ee678117
commit
5175d3663e
3 changed files with 154 additions and 32 deletions
|
|
@ -83,7 +83,7 @@ Manage agents across the swarm
|
|||
* `mint-forge-token` — Check one agent's forge token, and mint it if it's missing or stale
|
||||
* `set-state` — Declare the state a hive converges an agent to: `up`, `offline`, `paused` or `destroyed`
|
||||
* `watch` — Follow an agent's terminal rows live: the newest retained rows, then each new one, one line per row, until Ctrl-C or the stream ends
|
||||
* `inference` — Show the model, effort, subagent models, subagent cap and soft context limit the swarm sets for an agent, or change the model, effort and subagent models
|
||||
* `inference` — Show the model, effort, subagent models, subagent cap and the two context limits the swarm sets for an agent, or change the model, effort and subagent models
|
||||
* `permissions` — Show or change the permissions the swarm grants an agent
|
||||
* `agents-md` — Show an agent's AGENTS.md, or edit it with a diff
|
||||
|
||||
|
|
@ -192,9 +192,9 @@ The swarm-level counterpart of `hivectl agent watch`, read from the swarm-contro
|
|||
|
||||
## `swarmctl agent inference`
|
||||
|
||||
Show the model, effort, subagent models, subagent cap and soft context limit the swarm sets for an agent, or change the model, effort and subagent models.
|
||||
Show the model, effort, subagent models, subagent cap and the two context limits the swarm sets for an agent, or change the model, effort and subagent models.
|
||||
|
||||
`get` prints the subagent cap (`max_subagents`) and the soft context limit (`soft_context_percent`); `set` has no flag for them and keeps stored ones. Only swarm-ui sets them.
|
||||
`get` prints the subagent cap (`max_subagents`), the soft context limit (`soft_context_percent`) and the fresh-session threshold (`fresh_session_percent`); `set` has no flag for them and keeps stored ones. Only swarm-ui sets them.
|
||||
|
||||
A field the swarm sets wins over the agent's own value (its agent.nix or a `hyperhive-model`/`hyperhive-effort` file) from its next turn on; the agent reads its settings every ten seconds. A field the swarm doesn't set, or clears, leaves the agent on its own value.
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,17 @@ swarmctl agent inference clear iris
|
|||
dialog; `set` has no flag for it either. It's the percent of the model's
|
||||
context window at which the agent compacts at the end of a turn, in place of
|
||||
the harness's own 75%: 20 on a 1M window compacts once the context passes
|
||||
200k. A turn can still run past it, and it changes nothing else (the idle
|
||||
autoreset, the context shown in the UI). It's a whole number from 5 to 100;
|
||||
200k. A turn can still run past it, and it changes nothing else (the
|
||||
context shown in the UI). It's a whole number from 5 to 100;
|
||||
unset keeps the harness's own watermark
|
||||
([`claude-invocation.md`](../turn-loop/claude-invocation.md)).
|
||||
- You set the fresh-session threshold, `fresh_session_percent`, with it: the
|
||||
percent of the context window above which a turn that finds the prompt cache
|
||||
cold starts a fresh session instead of resuming, in place of the harness's
|
||||
own 50%. It's a whole number from 5 to 100, and not above the soft limit when
|
||||
both are set, since the agent compacts at the soft limit and the context would
|
||||
never reach a higher threshold; the controller refuses a pair that crosses.
|
||||
`set` has no flag for it either, and the dialog edits both on one slider.
|
||||
- `get` shows each field, naming the unset ones (or says the swarm sets
|
||||
nothing for the agent), and then the model and effort the agent reports
|
||||
running on, each with where it comes from.
|
||||
|
|
@ -54,6 +61,7 @@ effort: (not set; the agent's own)
|
|||
subagent_models: (not set; the agent's own)
|
||||
max_subagents: (not set; no cap)
|
||||
soft_context_percent: (not set; the harness's own watermark)
|
||||
fresh_session_percent: (not set; the harness's own half)
|
||||
running model: opus (swarm)
|
||||
running effort: medium (local_file)
|
||||
```
|
||||
|
|
@ -103,7 +111,8 @@ which swarm-controller alone writes:
|
|||
"effort": "high",
|
||||
"subagent_models": ["haiku", "sonnet"],
|
||||
"max_subagents": 3,
|
||||
"soft_context_percent": 20
|
||||
"soft_context_percent": 20,
|
||||
"fresh_session_percent": 10
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -130,7 +139,9 @@ in-memory model or effort without writing `hyperhive-model` or
|
|||
|
||||
The same loop hands `soft_context_percent` to the Bus
|
||||
(`set_soft_context_percent`), which the compaction policy reads when it decides
|
||||
at turn end; a key with no limit, or no key, clears it on the next read.
|
||||
at turn end, and `fresh_session_percent` (`set_fresh_session_percent`), which
|
||||
the pre-turn auto-reset reads; a key with no limit, or no key, clears it on the
|
||||
next read.
|
||||
|
||||
The subagent daemon (`hive-subagent-mcp`'s `swarm_models`) reads
|
||||
`subagent_models` and `max_subagents` with the same direct get, under the
|
||||
|
|
|
|||
|
|
@ -188,7 +188,8 @@ still applies.
|
|||
- **Auto session-reset** — a third path (`turn::maybe_auto_reset`,
|
||||
pre-turn) that fires when both conditions hold: context is ≥ a watermark
|
||||
(`HIVE_AUTO_RESET_WATERMARK_TOKENS`, default **50% of the reported
|
||||
window**, none until the API reports one) AND the time since the last turn
|
||||
window**, none until the API reports one; the swarm replaces the 50% per
|
||||
agent with its `fresh_session_percent`, [`inference.md`](../swarm/inference.md)) AND the time since the last turn
|
||||
exceeds the assumed prompt-cache TTL (`HIVE_CACHE_TTL_SECS`, default
|
||||
`3600`; `0` turns the check off, so an idle session is always resumed, and
|
||||
the harness logs a warning at start when it's off). Claude's prompt cache goes cold after a while; once it's cold,
|
||||
|
|
|
|||
Loading…
Reference in a new issue