master planner: add 'Team' mode + size bands per mode

Modes now: specialists (2–3 domain experts, deep prompts) · team (4–8
balanced roles, coordinator + complements) · swarm (10+ workers, self-
verifying loop) · scheduled (ephemeral, cron/one-shot) · triggered
(ephemeral, webhook). Backend planner_system_for() gains a TEAM_NOTE
using PLANNER_SYSTEM; specialists / scheduled / triggered notes are
rewritten to bake in the size + ephemeral guidance. Swarm's system
prompt now targets task_count>=10 explicitly.

Frontend MODES / INTRO copy match. Chat-preserving switchMode from the
prior commit handles the new mode transparently — no state-plumbing
changes needed.
This commit is contained in:
Omar Sobh
2026-07-07 04:18:29 -07:00
parent 9056937434
commit 987f4f0e84
2 changed files with 34 additions and 24 deletions
+23 -15
View File
@@ -51,30 +51,38 @@ pub struct PlannerMessage {
#[derive(Deserialize)]
pub struct PlannerChatRequest {
pub messages: Vec<PlannerMessage>,
/// Deploy mode: specialists | swarm | scheduled | triggered (default specialists).
/// Deploy mode: specialists | team | swarm | scheduled | triggered (default specialists).
#[serde(default)]
pub mode: String,
}
const SPECIALISTS_NOTE: &str = "\n\nMODE: Specialists. Each member is a DOMAIN SPECIALIST — set each member's \
brain_query to a concrete domain brain keyword (e.g. 'rust-2024', 'react-native', 'pentest-web', 'db-ops').";
const SCHEDULED_NOTE: &str = "\n\nMODE: Scheduled. Include a schedule in the proposal. Recurring: \
{\"cron\":\"<5-field>\",\"prompt\":\"<mission run each cycle>\"}. One-time: \
{\"one_shot_at\":\"<RFC3339 UTC datetime>\",\"prompt\":\"<mission>\"}.";
const TRIGGERED_NOTE: &str =
"\n\nMODE: Triggered. The team will be fired by a webhook on demand. Set the \
schedule field to {\"prompt\":\"<the default task the webhook runs>\"} (NO cron / one_shot_at).";
const SPECIALISTS_NOTE: &str = "\n\nMODE: Specialists. Propose a TIGHTLY-SCOPED group of 2 or 3 DOMAIN \
SPECIALISTS with high-quality, focused system_prompts. Each member's brain_query MUST be a concrete domain \
brain keyword (e.g. 'rust-2024', 'react-native', 'pentest-web', 'db-ops'). Prefer depth over breadth.";
const TEAM_NOTE: &str = "\n\nMODE: Team. Propose a balanced team of 4 to 8 agents that covers the goal \
end-to-end — a coordinator plus complementary roles. Bias toward roles that will actually be exercised each \
iteration; do not pad. Each member's brain_query should be a keyword the brain registry can resolve.";
const SCHEDULED_NOTE: &str = "\n\nMODE: Scheduled. Propose a team (28 agents is typical) and INCLUDE a \
schedule in the proposal. Recurring: {\"cron\":\"<5-field>\",\"prompt\":\"<mission run each cycle>\"}. \
One-time: {\"one_shot_at\":\"<RFC3339 UTC datetime>\",\"prompt\":\"<mission>\"}. The team is EPHEMERAL — \
provisioned at fire time and destroyed after the run — so keep member count tight.";
const TRIGGERED_NOTE: &str = "\n\nMODE: Triggered. Propose a team the user can fire by hitting a webhook \
(with a JSON payload the mission can reference). The team is EPHEMERAL — spun up on receipt, torn down when \
the run terminates — so keep the roster tight. Set schedule to {\"prompt\":\"<default task the webhook \
runs>\"} (NO cron / one_shot_at).";
const SWARM_SYSTEM: &str = "You are the planner for a self-verifying agent SWARM (Opus plans + verifies, a worker \
swarm executes, the loop repeats until every output passes). The user describes a job; you turn it into a swarm \
spec. The CHECKLIST is the verification contract — each item must be objectively checkable per task (e.g. 'states \
a revenue figure', 'cites a resolvable source URL', 'no field left empty'). Have a brief conversation, then emit \
the spec. ALWAYS respond with STRICT JSON ONLY: {\"reply\":\"<concise message>\",\"swarm\":null|{\"goal\":\"<the \
decomposable job>\",\"checklist\":[\"...\",\"...\"],\"task_count\":<int>,\"worker_model\":\"auto\"}}. Set swarm to \
null while still clarifying; include it once the job + checklist are concrete.";
swarm executes, the loop repeats until every output passes). Swarms are for BIG parallel jobs — target 10 or more \
workers (`task_count >= 10`). The user describes a job; you turn it into a swarm spec. The CHECKLIST is the \
verification contract — each item must be objectively checkable per task (e.g. 'states a revenue figure', 'cites \
a resolvable source URL', 'no field left empty'). Have a brief conversation, then emit the spec. ALWAYS respond \
with STRICT JSON ONLY: {\"reply\":\"<concise message>\",\"swarm\":null|{\"goal\":\"<the decomposable job>\",\
\"checklist\":[\"...\",\"...\"],\"task_count\":<int>,\"worker_model\":\"auto\"}}. Set swarm to null while still \
clarifying; include it once the job + checklist are concrete.";
fn planner_system_for(mode: &str) -> String {
match mode {
"swarm" => SWARM_SYSTEM.to_string(),
"team" => format!("{PLANNER_SYSTEM}{TEAM_NOTE}"),
"scheduled" => format!("{PLANNER_SYSTEM}{SCHEDULED_NOTE}"),
"triggered" => format!("{PLANNER_SYSTEM}{TRIGGERED_NOTE}"),
_ => format!("{PLANNER_SYSTEM}{SPECIALISTS_NOTE}"),