Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Let kwants hand off to teammates with @mentions
Oleksandr Ivanchenko3e34375f1540
diff --git a/README.md b/README.mdindex c0e0da00..c826e8ce 100644--- a/README.md+++ b/README.md@@ -11,6 +11,7 @@ Kwants is a high-performance, self-hosted multi-agent AI platform packaged as a- **Single-Binary Zero-Dependency Deploy**: No Node.js or Docker required in production. One compiled native binary (`kwnt`) serves both the Tokio/Axum asynchronous engine and the embedded modern React web application in under 25 MB of RAM on your laptop or a VPS.- **Sub-50ms Intelligent Routing with Laya**: By default, task-based model selection queries [convaiinnovations/laya](https://huggingface.co/convaiinnovations/laya) over its `/v1/systemone` API in ~33ms, with seamless offline heuristic fallback and dynamic effort-level selection.- **Hybrid Driver Fleet**: Run direct cloud & local APIs (xAI Grok, Anthropic Claude, OpenAI, OpenRouter, local Ollama) or supervise host CLI agents (`claude`, `codex`, `grok` CLIs).+- **Kwant-to-Kwant Handoffs**: Every kwant knows its teammates in the current channel or team. When a reply @mentions a teammate (or `@everyone`), that teammate answers right after in the same chat, up to 4 handoffs per message.- **Human-in-the-Loop Permission Broker**: Security-critical operations (shell execution, workspace file edits) require user approval via modern security cards: `[Allow Once]`, `[Always Allow]`, `[Deny]`.- **Sleek Modern Grok Bot Interface**: Dark zinc aesthetics (`zinc-950`), clean typography (`Inter`, `JetBrains Mono`), collapsible reasoning disclosures (`Thought for Xs • Laya [Grok] • Low Effort`), role-based SVG/gradient avatars, and subtle modern micro-interaction click & completion sounds synthesized via the Web Audio API.diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 0d8f8ecc..27e789af 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -230,6 +230,7 @@ export const App: React.FC = () => {totalTurns: event.data?.total_turns,currentSpeaker: initialSpeakerName,currentTurn: 1,+ kind: event.data?.kind,});setIsStreaming(true);playSfx('alert');@@ -245,6 +246,7 @@ export const App: React.FC = () => {...prev,inProgress: true,currentSpeaker: spkName,+ askedBy: event.data?.asked_by,currentTurn: event.data?.turn_index,totalTurns: event.data?.total_turns ?? prev.totalTurns,}));diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex f8f11a25..a2867e6f 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -25,6 +25,10 @@ export interface DiscussionState {currentSpeaker?: string;currentTurn?: number;totalTurns?: number;+ /** 'handoff' when kwants pulled each other in with @mentions. */+ kind?: string;+ /** Who handed the current speaker the turn (handoffs only). */+ askedBy?: string;}export interface RoutingCandidate {@@ -502,7 +506,17 @@ export const ChatView: React.FC<ChatViewProps> = ({<div className="flex items-center gap-2 text-sky-200"><Users size={14} className="text-sky-400 animate-pulse" /><span>- Team Discussion: <strong>{discussionState.currentSpeaker || 'Team member'}</strong> speaking (Turn {discussionState.currentTurn || 1} of {discussionState.totalTurns || 1})+ {discussionState.kind === 'handoff' ? (+ <>+ Handoff: <strong>{discussionState.currentSpeaker || 'Teammate'}</strong> is replying+ {discussionState.askedBy ? <> (asked by {discussionState.askedBy})</> : null}+ {' '}• {discussionState.currentTurn || 1} of {discussionState.totalTurns || 1}+ </>+ ) : (+ <>+ Team Discussion: <strong>{discussionState.currentSpeaker || 'Team member'}</strong> speaking (Turn {discussionState.currentTurn || 1} of {discussionState.totalTurns || 1})+ </>+ )}</span></div>{onCancelDiscussion && (diff --git a/src/drivers/api.rs b/src/drivers/api.rsindex 841b568a..a08fad94 100644--- a/src/drivers/api.rs+++ b/src/drivers/api.rs@@ -73,7 +73,14 @@ impl Driver for ApiDriver {let mut messages = vec![json!({"role": "system", "content": system_prompt})];for msg in &input.history {- messages.push(json!({"role": msg.sender_role, "content": msg.text}));+ let (role, content) = match msg.sender_role.as_str() {+ "kwant" if msg.sender_id == input.kwant.name => ("assistant", msg.text.clone()),+ // Teammates' replies are context from other speakers, not this kwant's own turns+ "kwant" => ("user", format!("[{}]: {}", msg.sender_id, msg.text)),+ "system" => ("system", msg.text.clone()),+ _ => ("user", msg.text.clone()),+ };+ messages.push(json!({"role": role, "content": content}));}messages.push(json!({"role": "user", "content": input.prompt}));diff --git a/src/drivers/cli.rs b/src/drivers/cli.rsindex 778a3a2a..06cfc86c 100644--- a/src/drivers/cli.rs+++ b/src/drivers/cli.rs@@ -86,6 +86,8 @@ pub fn build_cli_prompt(input: &TurnInput) -> String {for msg in recent {let role = match msg.sender_role.as_str() {"user" => "User",+ // Name the speaker so a kwant can tell its own earlier replies from its teammates'+ "kwant" if !msg.sender_id.is_empty() && msg.sender_id != input.kwant.name => &msg.sender_id,"kwant" => "Assistant","system" => "System",_ => &msg.sender_role,@@ -346,6 +348,7 @@ mod tests {team_context: None,workspace_dir: None,sandbox_id: None,+ teammates: vec![],};let result = build_cli_prompt(&input);@@ -382,6 +385,7 @@ mod tests {team_context: None,workspace_dir: None,sandbox_id: None,+ teammates: vec![],};let result = build_cli_prompt(&input);diff --git a/src/drivers/events.rs b/src/drivers/events.rsindex 2220a5fb..a51dfd91 100644--- a/src/drivers/events.rs+++ b/src/drivers/events.rs@@ -31,6 +31,9 @@ pub enum RuntimeEvent {total_turns: usize,speakers: Vec<String>,plan: Vec<String>,+ /// "discussion" for a planned team discussion, "handoff" when kwants @mentioned each other.+ #[serde(default)]+ kind: String,},#[serde(rename = "discussion_turn_started", alias = "DiscussionTurnStarted")]DiscussionTurnStarted {@@ -39,6 +42,9 @@ pub enum RuntimeEvent {turn_index: usize,total_turns: usize,prompt: String,+ /// Kwant that handed this speaker the turn with an @mention (handoffs only).+ #[serde(default, skip_serializing_if = "Option::is_none")]+ asked_by: Option<String>,},#[serde(rename = "discussion_completed", alias = "DiscussionCompleted")]DiscussionCompleted {diff --git a/src/drivers/mod.rs b/src/drivers/mod.rsindex 9e7f73f4..c86b9a02 100644--- a/src/drivers/mod.rs+++ b/src/drivers/mod.rs@@ -48,6 +48,15 @@ pub struct TurnInput {/// Sandbox whose browser is shown to the user for this conversation (team, channel or kwant).#[serde(default)]pub sandbox_id: Option<String>,+ /// Other kwants in this chat that the speaker can hand the turn to with an @mention.+ #[serde(default)]+ pub teammates: Vec<Teammate>,+}++#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]+pub struct Teammate {+ pub name: String,+ pub title: String,}impl TurnInput {@@ -105,7 +114,29 @@ impl TurnInput {api = api,);- format!("{}{}{}", base, team_block, sandbox_rules)+ let teammates_block = if self.teammates.is_empty() {+ String::new()+ } else {+ let list = self+ .teammates+ .iter()+ .map(|t| format!("- @{} ({})", t.name, t.title))+ .collect::<Vec<_>>()+ .join("\n");+ format!(+ "\n\n[Teammates in this chat]\n{list}\n\+ These are the only teammates you have. To involve one, mention them as @Name in your reply, or @everyone for all of them \+ (e.g. \"@{first}, can you take the database part?\"). kwnt hands each mentioned teammate the turn right after you, \+ and they answer here in the same chat. Only use @ when you actually want that teammate to reply now; \+ to merely refer to a teammate, write their name without the @. \+ Never contact anyone else: no other agents, sessions, chats or people through tools, CLIs or APIs. \+ Never claim you asked or will relay something from a teammate unless you @mentioned them in this reply.",+ list = list,+ first = self.teammates[0].name,+ )+ };++ format!("{}{}{}{}", base, team_block, teammates_block, sandbox_rules)}}diff --git a/src/router/mod.rs b/src/router/mod.rsindex 483efacc..6c212b41 100644--- a/src/router/mod.rs+++ b/src/router/mod.rs@@ -6,7 +6,7 @@ pub mod team;pub use fallback::heuristic_fallback;pub use laya::LayaRouter;-pub use tags::{parse_mentions, parse_mentions_with_lookup, TagMention};+pub use tags::{handoff_targets, parse_mentions, parse_mentions_with_lookup, TagMention};pub use team::{heuristic_pick_kwant, heuristic_team_decision, parse_laya_kwant_choice, parse_laya_team_answers,TeamDecision,diff --git a/src/router/tags.rs b/src/router/tags.rsindex 8991ea0a..4274fe43 100644--- a/src/router/tags.rs+++ b/src/router/tags.rs@@ -88,10 +88,54 @@ fn is_team_mention(token: &str) -> bool {|| lower.ends_with("infra")}+/// Teammates (as indices into `names`) that `text` hands the turn to with `@Name`,+/// in order of first mention. `@everyone` / `@all` selects every teammate.+/// Mentions inside inline code or code fences are ignored.+pub fn handoff_targets(text: &str, names: &[&str]) -> Vec<usize> {+ let mut prose = String::with_capacity(text.len());+ let mut in_code = false;+ for c in text.chars() {+ if c == '`' {+ in_code = !in_code;+ prose.push(' ');+ } else if !in_code {+ prose.push(c);+ }+ }++ let mut picked = Vec::new();+ for mention in parse_mentions_with_lookup(&prose, |_| Some(false)) {+ let tag = mention.name();+ if tag.eq_ignore_ascii_case("everyone") || tag.eq_ignore_ascii_case("all") {+ for i in 0..names.len() {+ if !picked.contains(&i) {+ picked.push(i);+ }+ }+ } else if let Some(i) = names.iter().position(|n| n.eq_ignore_ascii_case(tag)) {+ if !picked.contains(&i) {+ picked.push(i);+ }+ }+ }+ picked+}+#[cfg(test)]mod tests {use super::*;+ #[test]+ fn test_handoff_targets() {+ let names = ["Architect", "TechLead", "DevOps"];+ assert_eq!(handoff_targets("@techlead and @DevOps, say hi!", &names), vec![1, 2]);+ assert_eq!(handoff_targets("@DevOps then @devops again", &names), vec![2]);+ assert_eq!(handoff_targets("hey @everyone", &names), vec![0, 1, 2]);+ assert_eq!(handoff_targets("email [email protected] or run `@DevOps`", &names), Vec::<usize>::new());+ assert_eq!(handoff_targets("@Stranger please help", &names), Vec::<usize>::new());+ assert_eq!(handoff_targets("```\n@Architect\n``` ok @Architect", &names), vec![0]);+ }+#[test]fn test_mention_methods() {let k = TagMention::Kwant("Architect".into());diff --git a/src/server/routes.rs b/src/server/routes.rsindex 0a8ee958..a34fb4a9 100644--- a/src/server/routes.rs+++ b/src/server/routes.rs@@ -233,6 +233,23 @@ fn routing_candidates(members: &[Kwant]) -> Vec<RoutingCandidate> {.collect()}+/// Everything a kwant turn needs besides the speaker and the prompt, shared by handoff turns.+struct TurnScope {+ state: AppState,+ channel_id: Option<String>,+ kwant_id: Option<String>,+ team_keys: Option<(String, String)>,+ team_context: Option<crate::drivers::TeamContext>,+ workspace_dir: Option<std::path::PathBuf>,+ /// Kwants in this chat that a speaker may hand the turn to with an @mention.+ teammates: Vec<Kwant>,+ cancel_token: CancellationToken,+}++/// Max follow-up turns kwants may trigger by @mentioning each other for one user message.+const MAX_HANDOFFS: usize = 4;++#[allow(clippy::too_many_arguments)]fn execute_single_turn(state: AppState,target_kwant: Kwant,@@ -243,16 +260,126 @@ fn execute_single_turn(kwant_id: Option<String>,team_context: Option<crate::drivers::TeamContext>,workspace_dir: Option<std::path::PathBuf>,+ teammates: Vec<Kwant>,) {- let event_broadcast = state.event_sender.clone();- let db = state.db.clone();- let router = state.router.clone();let active_cancellations = state.active_cancellations.clone();- let channel_id = payload.channel_id.clone();- let kwant_id = kwant_id.or_else(|| payload.kwant_id.clone());+ let scope = TurnScope {+ channel_id: payload.channel_id.clone(),+ kwant_id: kwant_id.or_else(|| payload.kwant_id.clone()),+ team_keys,+ team_context,+ workspace_dir,+ teammates,+ cancel_token,+ state,+ };let prompt = payload.prompt.clone();tokio::spawn(async move {+ if let Some(reply) = run_kwant_turn(&scope, &target_kwant, prompt.clone()).await {+ run_handoffs(&scope, &[target_kwant.id.clone()], &[(target_kwant.clone(), reply)], &prompt).await;+ }++ let mut tokens = active_cancellations.lock().await;+ tokens.remove(&session_id);+ if let Some(cid) = &scope.channel_id {+ tokens.remove(cid);+ }+ if let Some(kid) = &scope.kwant_id {+ tokens.remove(kid);+ }+ if let Some((team_id, team_name)) = &scope.team_keys {+ tokens.remove(team_id);+ tokens.remove(team_name);+ }+ });+}++/// Lets teammates that kwants @mentioned in `replies` answer in turn, so kwants can delegate to each other.+/// `already_spoken` kwants are not handed the turn again.+async fn run_handoffs(scope: &TurnScope, already_spoken: &[String], replies: &[(Kwant, String)], user_prompt: &str) {+ let mut spoken: Vec<String> = already_spoken.to_vec();+ let mut queue: std::collections::VecDeque<(Kwant, String, String)> = std::collections::VecDeque::new();+ let enqueue = |queue: &mut std::collections::VecDeque<(Kwant, String, String)>,+ spoken: &[String],+ from: &Kwant,+ text: &str| {+ let names: Vec<&str> = scope.teammates.iter().map(|k| k.name.as_str()).collect();+ for i in crate::router::handoff_targets(text, &names) {+ let k = &scope.teammates[i];+ if k.id != from.id && !spoken.contains(&k.id) && !queue.iter().any(|(q, _, _)| q.id == k.id) {+ queue.push_back((k.clone(), from.name.clone(), text.to_string()));+ }+ }+ };+ for (from, text) in replies {+ enqueue(&mut queue, &spoken, from, text);+ }+ if queue.is_empty() {+ return;+ }++ let events = scope.state.event_sender.clone();+ let context_id = scope+ .channel_id+ .clone()+ .or_else(|| scope.kwant_id.clone())+ .unwrap_or_else(|| replies[0].0.id.clone());+ let total = |queue_len: usize, done: usize| (1 + done + queue_len).min(1 + MAX_HANDOFFS);+ let _ = events.send(RuntimeEvent::DiscussionStarted {+ team_id: context_id,+ team_name: scope.team_keys.as_ref().map(|(_, n)| n.clone()).unwrap_or_default(),+ total_turns: total(queue.len(), 0),+ speakers: queue.iter().map(|(k, _, _)| k.id.clone()).collect(),+ plan: queue.iter().map(|(k, from, _)| format!("{}: asked by {}", k.name, from)).collect(),+ kind: "handoff".into(),+ });++ let mut done = 0;+ while let Some((kwant, from, from_text)) = queue.pop_front() {+ if done >= MAX_HANDOFFS || scope.cancel_token.is_cancelled() {+ break;+ }+ let prompt = format!(+ "{from} handed this conversation to you by mentioning you.\n\nThe user's original request:\n{user}\n\n{from} wrote:\n{text}\n\n\+ Reply to the user now with your own part of this, in character. Don't repeat what {from} already said.",+ from = from,+ user = user_prompt,+ text = truncate_chars(&from_text, 4000),+ );+ let _ = events.send(RuntimeEvent::DiscussionTurnStarted {+ speaker_id: kwant.id.clone(),+ speaker_name: kwant.name.clone(),+ turn_index: done + 2,+ total_turns: total(queue.len(), done + 1),+ prompt: prompt.clone(),+ asked_by: Some(from.clone()),+ });+ done += 1;+ spoken.push(kwant.id.clone());+ match run_kwant_turn(scope, &kwant, prompt).await {+ Some(reply) => enqueue(&mut queue, &spoken, &kwant, &reply),+ None if scope.cancel_token.is_cancelled() => break,+ None => {}+ }+ }++ let _ = events.send(RuntimeEvent::DiscussionCompleted { total_turns: done + 1 });+}++/// Runs one kwant turn: picks model/effort, syncs the bot browser, streams the reply and saves it.+/// Returns the reply text, or `None` if the turn was cancelled or failed.+async fn run_kwant_turn(scope: &TurnScope, target_kwant: &Kwant, prompt: String) -> Option<String> {+ let state = &scope.state;+ let event_broadcast = state.event_sender.clone();+ let db = state.db.clone();+ let router = state.router.clone();+ let channel_id = scope.channel_id.clone();+ let kwant_id = scope.kwant_id.clone();+ let team_keys = &scope.team_keys;+ let cancel_token = &scope.cancel_token;++ {let available_models = crate::drivers::detect_available_models(&db).await;let route = match router.route_prompt_with_models(&prompt, "chat", &available_models).await {Ok(r) => r,@@ -389,9 +516,15 @@ fn execute_single_turn(history,model_override: Some(target_model),effort_level: Some(effort_level),- team_context,- workspace_dir,+ team_context: scope.team_context.clone(),+ workspace_dir: scope.workspace_dir.clone(),sandbox_id: Some(sandbox_target.clone()),+ teammates: scope+ .teammates+ .iter()+ .filter(|k| k.id != target_kwant.id)+ .map(|k| crate::drivers::Teammate { name: k.name.clone(), title: k.title.clone() })+ .collect(),};let (driver_tx, mut driver_rx) = mpsc::channel(32);@@ -451,27 +584,16 @@ fn execute_single_turn(direct_kwant_id: kwant_id.clone(),sender_role: "kwant".into(),sender_id: target_kwant.name.clone(),- text: output.text,+ text: output.text.clone(),reasoning_content: output.reasoning,tool_calls: None,tokens_used: output.tokens_used as i64,};let _ = db.insert_message(&asst_msg).await;+ return Some(output.text);}-- let mut tokens = active_cancellations.lock().await;- tokens.remove(&session_id);- if let Some(cid) = &channel_id {- tokens.remove(cid);- }- if let Some(kid) = &kwant_id {- tokens.remove(kid);- }- if let Some((team_id, team_name)) = &team_keys {- tokens.remove(team_id);- tokens.remove(team_name);- }- });+ None+ }}pub async fn send_chat(@@ -576,6 +698,23 @@ pub async fn send_chat(None};+ // Kwants in this chat that a speaker can hand the turn to by @mentioning them+ let chat_teammates: Vec<Kwant> = if let Some(ref t) = active_team {+ let ids: Vec<String> = serde_json::from_str(&t.member_kwants).unwrap_or_default();+ ids.iter().filter_map(|id| all_kwants.iter().find(|k| &k.id == id).cloned()).collect()+ } else if let Some(cid) = &payload.channel_id {+ match state.db.get_channel(cid).await {+ Ok(Some(c)) if c.name == "general" => all_kwants.clone(),+ Ok(Some(c)) => {+ let ids: Vec<String> = serde_json::from_str(&c.member_kwants).unwrap_or_default();+ ids.iter().filter_map(|id| all_kwants.iter().find(|k| &k.id == id).cloned()).collect()+ }+ _ => Vec::new(),+ }+ } else {+ Vec::new()+ };+let active_team_context = active_team.as_ref().map(|t| crate::drivers::TeamContext {id: t.id.clone(),name: t.name.clone(),@@ -688,6 +827,7 @@ pub async fn send_chat(kwant_id_cleanup,active_team_context,workspace_dir.clone(),+ members.clone(),);Ok(Json(json!({@@ -732,6 +872,7 @@ pub async fn send_chat(let prompt = payload.prompt.clone();let active_cancellations = state.active_cancellations.clone();let all_kwants_clone = all_kwants.clone();+ let members_clone = members.clone();let team_clone = team.clone();let speakers_clone = speakers.clone();let plan_clone = plan.clone();@@ -753,9 +894,11 @@ pub async fn send_chat(total_turns: turns,speakers: speakers_clone.clone(),plan: plan_clone.clone(),+ kind: "discussion".into(),});let mut cumulative_transcript: Vec<(String, String)> = Vec::new();+ let mut replies: Vec<(Kwant, String)> = Vec::new();for (turn_idx, speaker_id) in speakers_clone.iter().enumerate() {if cancel_token_clone.is_cancelled() {@@ -831,6 +974,7 @@ pub async fn send_chat(turn_index: turn_idx + 1,total_turns: turns,prompt: speaker_prompt.clone(),+ asked_by: None,});let available_models = crate::drivers::detect_available_models(&db).await;@@ -871,6 +1015,11 @@ pub async fn send_chat(}),workspace_dir: workspace_dir_clone.clone(),sandbox_id: Some(team_clone.id.clone()),+ teammates: members_clone+ .iter()+ .filter(|k| k.id != speaker.id)+ .map(|k| crate::drivers::Teammate { name: k.name.clone(), title: k.title.clone() })+ .collect(),};let (driver_tx, mut driver_rx) = mpsc::channel(32);@@ -921,6 +1070,7 @@ pub async fn send_chat(tokens_used: output.tokens_used as i64,};let _ = db.insert_message(&asst_msg).await;+ replies.push((speaker.clone(), output.text.clone()));cumulative_transcript.push((speaker.name.clone(), output.text));}}@@ -929,6 +1079,27 @@ pub async fn send_chat(total_turns: turns,});+ // Teammates outside the planned speakers that the discussion @mentioned get their turn too+ if !cancel_token_clone.is_cancelled() {+ let scope = TurnScope {+ state: state_clone.clone(),+ channel_id: channel_id.clone(),+ kwant_id: kwant_id.clone(),+ team_keys: Some((team_clone.id.clone(), team_clone.name.clone())),+ team_context: Some(crate::drivers::TeamContext {+ id: team_clone.id.clone(),+ name: team_clone.name.clone(),+ description: team_clone.description.clone(),+ workspace_path: team_clone.workspace_path.clone(),+ repo_url: team_clone.repo_url.clone(),+ }),+ workspace_dir: workspace_dir_clone.clone(),+ teammates: members_clone.clone(),+ cancel_token: cancel_token_clone.clone(),+ };+ run_handoffs(&scope, &speakers_clone, &replies, &prompt).await;+ }+let mut tokens = active_cancellations.lock().await;tokens.remove(&session_id_clone);if let Some(cid) = &channel_id {@@ -1030,6 +1201,7 @@ pub async fn send_chat(kwant_id_cleanup,active_team_context,workspace_dir,+ chat_teammates,);Ok(Json(json!({diff --git a/tests/driver_test.rs b/tests/driver_test.rsindex 6395d2d7..af89ad77 100644--- a/tests/driver_test.rs+++ b/tests/driver_test.rs@@ -87,6 +87,7 @@ async fn test_mock_driver_streaming() {team_context: None,workspace_dir: None,sandbox_id: None,+ teammates: vec![],};let handle = tokio::spawn(async move {@@ -143,6 +144,7 @@ fn test_turn_input_format_system_prompt_with_and_without_team_context() {team_context: None,workspace_dir: None,sandbox_id: None,+ teammates: vec![],};let solo_prompt = input_solo.format_system_prompt();@@ -153,6 +155,13 @@ fn test_turn_input_format_system_prompt_with_and_without_team_context() {assert!(!vps_input.format_system_prompt().contains("127.0.0.1:8899"));assert!(solo_prompt.contains("bulletproof distributed architectures"));assert!(!solo_prompt.contains("Active Team Alignment"));+ assert!(!solo_prompt.contains("[Teammates in this chat]"));++ let mut with_mates = input_solo.clone();+ with_mates.teammates = vec![kwnt::drivers::Teammate { name: "TechLead".into(), title: "Staff Engineer".into() }];+ let mates_prompt = with_mates.format_system_prompt();+ assert!(mates_prompt.contains("- @TechLead (Staff Engineer)"));+ assert!(mates_prompt.contains("Never contact anyone else"));// 2. With team contextlet input_team = TurnInput {@@ -172,6 +181,7 @@ fn test_turn_input_format_system_prompt_with_and_without_team_context() {}),workspace_dir: None,sandbox_id: None,+ teammates: vec![],};let team_prompt = input_team.format_system_prompt();@@ -198,6 +208,7 @@ fn test_turn_input_format_system_prompt_with_and_without_team_context() {}),workspace_dir: Some(std::path::PathBuf::from("/Users/dev/app")),sandbox_id: None,+ teammates: vec![],};let ws_prompt = input_workspace.format_system_prompt();