harness: unify agent + manager prompts into single template (closes #519)

This commit is contained in:
damocles 2026-05-27 22:47:02 +02:00 committed by Mara
commit 01af5003d1
9 changed files with 325 additions and 75 deletions

View file

@ -156,9 +156,12 @@ in `migrate.rs` (idempotent, marker-guarded).
### E — prompt + tools
- `prompts/manager.md` vs `prompts/agent.md` — two separate system
prompts. **Per-agent cap list** of what the agent can do, rendered
into a single parametrised prompt at boot.
- `prompts/system.md` with `<!-- role:agent -->` / `<!-- role:manager -->`
marker blocks, assembled by `hive_ag3nt::prompt::render` based on
flavor (closes #519). **Per-agent cap list** of what the agent can
do — already a single parametrised prompt; once #513 lands the
marker grammar grows `cap:<group>` blocks the renderer reads from
the per-agent ToolGroup set.
- `mcp.rs::Flavor::{Agent, Manager}` controls which MCP tools claude
sees. Already structured this way internally — the per-flavour
allow-list becomes a per-cap-set lookup.

View file

@ -360,7 +360,8 @@ updates the manager itself.
## Manager policy
From `hive-ag3nt/prompts/manager.md`: the manager does NOT
From `hive-ag3nt/prompts/system.md` (`<!-- role:manager -->` block,
rendered via `hive_ag3nt::prompt::render`): the manager does NOT
rubber-stamp sub-agent config requests. It verifies (role match,
package legitimacy, cheaper alternative, blast radius) before
committing and calling `request_apply_commit`.
@ -447,7 +448,8 @@ regular claude turn so the manager can react. Variants
asker sees the matching `QuestionAnswered`.
To add a new event: new `HelperEvent` variant + call sites + update
`prompts/manager.md` so the manager knows the new shape.
`prompts/system.md` (`<!-- role:manager -->` block, the lifecycle-
event list) so the manager knows the new shape.
## Auto-update on startup

View file

@ -163,11 +163,14 @@ socket at `/run/hive/` once at startup:
- `claude-settings.json` — the `--settings` blob (auto-compact and
auto-memory off, effortLevel medium).
- `claude-system-prompt.md` — rendered from
`hive-ag3nt/prompts/{agent,manager}.md` with `{label}` and
`{operator_pronouns}` substituted. Pronouns come from
`HIVE_OPERATOR_PRONOUNS` env (set by the meta flake from
`services.hive-c0re.operatorPronouns`, default `she/her`).
Passed via `--system-prompt-file`.
`hive-ag3nt/prompts/system.md` by `hive_ag3nt::prompt::render`:
HTML-comment markers (`<!-- role:agent -->...<!-- /role:agent -->`,
same for `role:manager`) gate the role-specific blocks (closes
#519); everything else is shared. Then `{label}` and
`{operator_pronouns}` get substituted in the assembled output.
Pronouns come from `HIVE_OPERATOR_PRONOUNS` env (set by the meta
flake from `services.hive-c0re.operatorPronouns`, default
`she/her`). Passed via `--system-prompt-file`.
The shared per-turn plumbing lives in `hive_ag3nt::turn::{write_mcp_config,
write_settings, write_system_prompt, run_turn, drive_turn,