diff --git a/docs/swarm/ui.md b/docs/swarm/ui.md index 43188320..b6c4e42b 100644 --- a/docs/swarm/ui.md +++ b/docs/swarm/ui.md @@ -330,6 +330,22 @@ The panel reads `GET /api/agents/{agent}/inference`; before the agent's first report reaches the controller, it shows the swarm's stored values only. [inference](inference.md) describes the settings themselves. +### Editing an agent's instructions + +The **instructions** row of an agent's detail panel has an **edit** button. It +opens `AGENTS.md`, the file the agent reads its instructions from, in a plain +text box. The text is the copy the agent last published, so the box still +opens for a stopped agent, but **save** needs the agent running. + +Save sends the swarm a diff against the version you opened, and the agent +applies it to its own file with git. When the agent changed the file in the +meantime, the swarm refuses the diff. The box then keeps your text, shows the +agent's version below it, and offers two ways on: **keep my text, replace the +agent's changes**, which makes your text the new base for the next save, or +**use the agent's version**, which drops yours. A diff that git refuses for any +other reason shows git's message and leaves the file as it was. Closing the +dialog keeps an unsaved edit for the next time you open it. + ### Resource caps The agent's detail panel shows its CPU quota and memory max under **resource diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx index c471371e..808afa77 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentDetail.tsx @@ -11,6 +11,7 @@ import { Badge } from "@hive/shared/badge.js"; import { RelativeTime } from "../../ui/relative-time/RelativeTime.js"; import type { AgentActions } from "../roster/AgentActions.js"; import { AgentInference } from "./AgentInference.js"; +import { AgentInstructions } from "./AgentInstructions.js"; import { AgentLimits } from "./AgentLimits.js"; import { AgentTermPreview } from "../terminal/AgentTermPreview.js"; import { FRESHNESS, type AgentRow } from "../AgentTypes.js"; @@ -103,6 +104,10 @@ export function AgentDetail({
+ The instructions {agent} reads. This is the copy the agent last + published, so a stopped agent still shows. Saving needs the agent + running: it applies your change to its own file, and refuses when it + edited the file since you opened this. +
++ {load.status === "loading" + ? "loading…" + : busy + ? "saving…" + : saved + ? "saved" + : ""} +
+ {load.status === "error" ? ( + <> +