Watch
0
0
Fork
You've already forked hyperhive
0

swarm: /clear starts an agent's next turn on a fresh session

This commit is contained in:
iris 2026-11-16 01:01:31 +01:00
commit fb9d4b5040
2 changed files with 155 additions and 22 deletions

View file

@ -34,11 +34,13 @@ system raised it and how long ago. You can't change it from here, and it follows
the agent's own list within a few seconds.
Type `/` in an agent's message box and a menu lists what that agent accepts:
the swarm's own commands (`/compact`, `/clear-todos`) and the skills the
agent's harness published. Arrow keys move, Tab completes, Esc closes. Skills
are per agent, so two agents can offer different lists. `/clear-todos` marks all
of the agent's todos done without starting a turn, and the terminal shows how
many it cleared.
the swarm's own commands and the skills the agent's harness published. Arrow
keys move, Tab completes, Esc closes. Skills are per agent, so two agents can
offer different lists. The swarm's commands are `/compact`, which compacts the
agent's context after its current turn; `/clear`, which starts its next turn on
a fresh session; and `/clear-todos`, which marks all of the agent's todos done
without starting a turn, the terminal showing how many it cleared. Send each
alone, as it is a command and not a message.
Each page, its controls and what they send are in
[the swarm UI reference](../../4-implementation/web-ui/swarm-ui.md).

View file

@ -356,8 +356,10 @@ The text holds no secret, so nothing goes through the secret store.
**Editing.** `PUT /api/agents/<name>/agents-md` takes `{base_revision, diff}`.
The diff is a unified diff that names `a/AGENTS.md` and `b/AGENTS.md`, made
against the text at `base_revision`. swarm-controller sends it as a request on
the agent's command subject `$SWARM.control.<name>`, as it sends a cancel. The
harness refuses it when the file isn't at `base_revision`. Otherwise it runs
the agent's command subject `$SWARM.control.<name>`, as it sends a cancel. (The same
subject carries `POST /api/agents/<name>/new-session`, which the swarm UI sends for
`/clear`: the harness queues a session reset that takes effect at the agent's next
turn, and answers `acted: true`.) The harness refuses it when the file isn't at `base_revision`. Otherwise it runs
`git apply --check` and then `git apply` on a copy of the file, and writes the
result over the file only when both pass: