Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat(host): list_bots says what kind each agent is and picks one kind
leepokai65e945884df8
diff --git a/cloud/src/routes/assistant.ts b/cloud/src/routes/assistant.tsindex e1b78f57..9b11e4ae 100644--- a/cloud/src/routes/assistant.ts+++ b/cloud/src/routes/assistant.ts@@ -42,13 +42,21 @@ const TOOLS = [name: "list_bots",title: "List bots",description:- "The user's Codync bots you can message, with their IDs, specialties and status, also those on the user's " +- "other computers in that computer's network (IDs like reviewer@laptop). Narrow it with query; it returns at " +- "most limit at a time, with next for the rest. Without computer, every online computer answers.",+ "The user's Codync bots you can message, with their IDs, kinds, specialties and status, also those on the user's " ++ "other computers in that computer's network (IDs like reviewer@laptop), where Claude Code sessions and Codex " ++ "threads can be offered too. Narrow it with query or kind; it returns at most limit at a time, with next for " ++ "the rest. Without computer, every online computer answers.",inputSchema: {type: "object",properties: {query: { type: "string", description: "Words that must all appear in the bot's name or description." },+ kind: {+ type: "string",+ enum: ["codync", "claude-code", "codex", "terminal"],+ description:+ "Only this kind of agent: codync (Codync bots), claude-code (Claude Code sessions), codex (Codex threads) " ++ "or terminal (a person at a terminal on another computer).",+ },limit: { type: "integer", minimum: 1, maximum: 50, description: "At most this many (default 20)." },cursor: { type: "string", description: "next from the previous call, for the rest." },computer: COMPUTER,diff --git a/docs/design/codync-network.md b/docs/design/codync-network.mdindex 46ec712c..7c991742 100644--- a/docs/design/codync-network.md+++ b/docs/design/codync-network.md@@ -112,7 +112,8 @@ A computer in several networks runs one node per network, each with its own key,| Connectors | per network (private at home, relays for work) | one per computer || Wire | unchanged: old peers keep working | every request names its network || Cost | one endpoint (a socket, a relay connection) per network | one endpoint |-- `list_bots` takes `query`, `computer` (`this` for this one), `online`, `limit` and `cursor`, and an unnarrowed+- `list_bots` takes `query`, `computer` (`this` for this one), `online`, `kind` (`codync`, `claude-code`,+ `codex`, `terminal`), `limit` and `cursor`, and an unnarrowedlong list says how many bots each computer has, so a computer with many bots doesn't flood the agent. On onecomputer without a network it lists that computer's bots.diff --git a/docs/features/cloud-assistants.md b/docs/features/cloud-assistants.mdindex 198bc32a..f2bdb17a 100644--- a/docs/features/cloud-assistants.md+++ b/docs/features/cloud-assistants.md@@ -25,7 +25,8 @@ ChatGPT / Claude ──MCP over HTTPS──▶ mcp.codync.dev (cloud Worker)- **Protocol**: Streamable HTTP with JSON answers and no sessions. Stateless clients (2026-07-28: version in eachrequest's `_meta`, `server/discover`) and `initialize` clients (2025-03-26 to 2025-11-25) both work.- **Tools**: `list_computers` (from the account, answered by the Worker), and `list_bots`, `message_bot`,- `read_replies`, answered by the host. With several computers online, a listing asks each; a message needs+ `read_replies`, answered by the host (`list_bots` narrows by `query` and `kind`: `codync`, `claude-code`, `codex`,+ `terminal`). With several computers online, a listing asks each; a message needs`computer` then. `message_bot` returns at once; the bot's reply waits on the host for `read_replies`, sincenothing can wake a hosted assistant.- **Host** (`host/src/chat/team/assistant.rs`): the assistant messages bots like a bot doesdiff --git a/docs/features/codync-network.md b/docs/features/codync-network.mdindex 79821fd6..6a2275b9 100644--- a/docs/features/codync-network.md+++ b/docs/features/codync-network.md@@ -108,7 +108,11 @@ that was off learns of a removal.deleted bot can't reach the wrong one. What the network offers is published after each bot is created, changedor deleted.- `list_bots` lists this computer's bots, then the other computers' (ids `name@computer`, `status` online/away),- filtered by `query`, `computer`, `online`, and paged by `limit` (default 20, at most 50) and `cursor`. A listing+ filtered by `query`, `computer`, `online` and `kind`, and paged by `limit` (default 20, at most 50) and `cursor`.+ Every row says its `kind`: `codync` (a Codync bot), `claude-code`, `codex` (sessions a standalone daemon offers),+ `terminal`, or `other` (a computer from before kinds). Each computer states the kind in what it offers+ (`codync_network::AgentKind` on the wire `Agent`); for the sessions the network knocks on, the crate takes it from+ their `Reach`, and the network view's `agents` carry it too. A listingpast the limit adds `summary` (bots per computer). What other computers offer is cached for a minute and refreshedin the background; the first listing waits up to 5 s for it.- `message_bot` takes a bot id, an address name, or `name@computer`. A request to another computer is a letter; thediff --git a/host/crates/network/src/bin/codync-network/main.rs b/host/crates/network/src/bin/codync-network/main.rsindex b68f85a7..2c68d7a9 100644--- a/host/crates/network/src/bin/codync-network/main.rs+++ b/host/crates/network/src/bin/codync-network/main.rs@@ -4,7 +4,7 @@mod control;use anyhow::{Context, Result, anyhow, bail};-use codync_network::{Access, Address, Agent, Connector, Letter, Node, Reach, Rule, Sent};+use codync_network::{Access, Address, Agent, AgentKind, Connector, Letter, Node, Reach, Rule, Sent};use serde::{Deserialize, Serialize};use std::path::{Path, PathBuf};use std::sync::{Arc, Mutex};@@ -163,7 +163,9 @@ impl Daemon {"codex" => Reach::Codex { thread: handle.into() },_ => bail!("an agent is reached through claude or codex"),};- let agent = Agent { id: id.into(), name: id.into(), about: about.unwrap_or_default() };+ // The node makes it a Claude Code or Codex agent from its reach.+ let agent =+ Agent { id: id.into(), name: id.into(), about: about.unwrap_or_default(), kind: AgentKind::Other };self.add(LocalAgent { agent, reach })}["agents"] => Ok(self.listing()),@@ -279,7 +281,12 @@ impl Daemon {/// Tells the node what this computer offers: the terminal, then every registered agent.fn offer(&self) {- let terminal = Agent { id: TERMINAL.into(), name: "Terminal".into(), about: "A person at a terminal".into() };+ let terminal = Agent {+ id: TERMINAL.into(),+ name: "Terminal".into(),+ about: "A person at a terminal".into(),+ kind: AgentKind::Terminal,+ };let agents = self.agents.lock().unwrap_or_else(std::sync::PoisonError::into_inner);let offered = agents.iter().map(|a| (a.agent.clone(), a.reach.clone()));self.node.set_agents(std::iter::once((terminal, Reach::App)).chain(offered).collect::<Vec<_>>());diff --git a/host/crates/network/src/lib.rs b/host/crates/network/src/lib.rsindex f66a9f0e..62e46cf8 100644--- a/host/crates/network/src/lib.rs+++ b/host/crates/network/src/lib.rs@@ -31,4 +31,4 @@ pub use reach::Reach;pub use roster::Role;pub use rules::{Access, Rule};pub use types::{Address, Connector, Letter, Message, Peer, Sent};-pub use wire::{Agent, InviteInfo, MAX_BODY, read_invite};+pub use wire::{Agent, AgentKind, InviteInfo, MAX_BODY, read_invite};diff --git a/host/crates/network/src/node/mod.rs b/host/crates/network/src/node/mod.rsindex b2f5a687..a09ec0b0 100644--- a/host/crates/network/src/node/mod.rs+++ b/host/crates/network/src/node/mod.rs@@ -10,7 +10,7 @@ use crate::reach::{Held, Reach};use crate::roster::{self, Change, Role, Roster};use crate::rules::{self, Rule};use crate::types::{Address, Connector, Letter, Message, Peer, Sent};-use crate::wire::{self, ALPN, Agent, Request, Response, Ticket};+use crate::wire::{self, ALPN, Agent, AgentKind, Request, Response, Ticket};use anyhow::{Context, Result, anyhow, bail};use iroh::endpoint::Connection;use iroh::protocol::Router;@@ -228,7 +228,16 @@ impl Node {/// so what waited for it while it started comes now.pub fn set_agents(&self, agents: impl IntoIterator<Item = (Agent, Reach)>) {let before = self.inner.offered();- *locked(&self.inner.agents) = agents.into_iter().collect();+ // A session the network knocks on is the kind its harness is, whatever the app said.+ let agents = agents.into_iter().map(|(mut agent, reach)| {+ match reach {+ Reach::ClaudeCode { .. } => agent.kind = AgentKind::ClaudeCode,+ Reach::Codex { .. } => agent.kind = AgentKind::Codex,+ Reach::App => {}+ }+ (agent, reach)+ });+ *locked(&self.inner.agents) = agents.collect();if self.inner.offered() != before {self.inner.changed.send_replace(());}diff --git a/host/crates/network/src/wire.rs b/host/crates/network/src/wire.rsindex 6b518771..cddcdff0 100644--- a/host/crates/network/src/wire.rs+++ b/host/crates/network/src/wire.rs@@ -25,6 +25,25 @@ pub struct Agent {/// What it is good at, so other agents pick the right one.#[serde(default)]pub about: String,+ /// What it is, so others can pick one kind. Set from its [`Reach`](crate::Reach) for the+ /// sessions the network knocks on itself.+ #[serde(default)]+ pub kind: AgentKind,+}++/// What kind of agent is offered: a Codync bot, a Claude Code session, a Codex thread, a person+/// at a terminal.+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "kebab-case")]+pub enum AgentKind {+ Codync,+ ClaudeCode,+ Codex,+ Terminal,+ /// Not said (a computer from before kinds), or one this version doesn't know.+ #[default]+ #[serde(other)]+ Other,}/// A letter on the wire. The sending computer is whoever opened the connection (iroh provesdiff --git a/host/crates/network/tests/two_computers.rs b/host/crates/network/tests/two_computers.rsindex 8fb5c228..2ba1945f 100644--- a/host/crates/network/tests/two_computers.rs+++ b/host/crates/network/tests/two_computers.rs@@ -1,6 +1,6 @@//! Computers on this machine, connected directly (no relay, no internet).-use codync_network::{Address, Agent, Connector, Letter, Message, Node, Reach, Role, Sent};+use codync_network::{Address, Agent, AgentKind, Connector, Letter, Message, Node, Reach, Role, Sent};use std::path::PathBuf;use std::time::Duration;use tokio::sync::mpsc::Receiver;@@ -12,7 +12,7 @@ fn temp_dir(name: &str) -> PathBuf {}fn agent(id: &str) -> Agent {- Agent { id: id.into(), name: id.into(), about: String::new() }+ Agent { id: id.into(), name: id.into(), about: String::new(), kind: AgentKind::Codync }}fn offer(node: &Node, id: &str) {@@ -359,3 +359,25 @@ async fn an_invite_carries_the_networks_name() {desk.shutdown().await;let _ = std::fs::remove_dir_all(dir);}++#[tokio::test]+async fn a_session_the_network_knocks_on_is_offered_as_its_kind() {+ let (desk_dir, laptop_dir) = (temp_dir("desk9"), temp_dir("laptop9"));+ let (desk, _) = Node::start(&desk_dir, &Connector::Private).await.unwrap();+ desk.create("desk").unwrap();+ offer(&desk, "reviewer");+ let (laptop, _) = Node::start(&laptop_dir, &Connector::Private).await.unwrap();+ let session = Agent { id: "main".into(), name: "main".into(), about: String::new(), kind: AgentKind::Other };+ laptop.set_agents([(session, Reach::ClaudeCode { session: "s1".into() })]);+ laptop.join(&desk.invite().unwrap(), "laptop").await.unwrap();+ let peers = desk.peers().await.unwrap();+ assert_eq!(peers[0].agents[0].kind, AgentKind::Codync);+ assert_eq!(peers[1].agents[0].kind, AgentKind::ClaudeCode, "its reach says what it is");+ // A computer from before kinds says nothing, and a kind this version doesn't know reads as other.+ let old: Agent = serde_json::from_str(r#"{"id": "x", "name": "x"}"#).unwrap();+ let newer: Agent = serde_json::from_str(r#"{"id": "x", "name": "x", "kind": "gemini"}"#).unwrap();+ assert_eq!((old.kind, newer.kind), (AgentKind::Other, AgentKind::Other));+ for dir in [desk_dir, laptop_dir] {+ let _ = std::fs::remove_dir_all(dir);+ }+}diff --git a/host/src/chat/team.rs b/host/src/chat/team.rsindex 7b51cbf4..159229d6 100644--- a/host/src/chat/team.rs+++ b/host/src/chat/team.rs@@ -46,12 +46,13 @@ pub fn tools() -> Value {json!([{"name": "list_bots",- "description": "List the Codync bots you can message, with their IDs, specialties and status: this computer's first, then those on the user's other computers. Narrow it with query (words in a bot's name or description), computer, or online; it returns at most limit at a time, with next for the rest.",+ "description": "List the Codync bots you can message, with their IDs, kinds, specialties and status: this computer's first, then those on the user's other computers (where Claude Code sessions and Codex threads can be offered too). Narrow it with query (words in a bot's name or description), computer, kind, or online; it returns at most limit at a time, with next for the rest.","inputSchema": {"type": "object","properties": {"query": {"type": "string", "description": "Words that must all appear in the bot's name or description."},"computer": {"type": "string", "description": "Only the bots on the computer with this name (`this`: the one you run on)."},+ "kind": {"type": "string", "enum": ["codync", "claude-code", "codex", "terminal"], "description": "Only this kind of agent: codync (Codync bots), claude-code (Claude Code sessions), codex (Codex threads) or terminal (a person at a terminal on another computer)."},"online": {"type": "boolean", "description": "Only bots whose computer can take a message now."},"limit": {"type": "integer", "minimum": 1, "maximum": 50, "description": "At most this many (default 20)."},"cursor": {"type": "string", "description": "next from the previous call, for the rest."},diff --git a/host/src/chat/team/assistant.rs b/host/src/chat/team/assistant.rsindex 4f76c0ec..22b146ec 100644--- a/host/src/chat/team/assistant.rs+++ b/host/src/chat/team/assistant.rs@@ -213,9 +213,10 @@ pub fn tools() -> Value {json!([{"name": "list_bots",- "description": "List the user's Codync bots you can message, with their IDs, specialties and status: this computer's first, then those on the user's other computers (IDs like reviewer@laptop). Narrow it with query; it returns at most limit at a time, with next for the rest.",+ "description": "List the user's Codync bots you can message, with their IDs, specialties and status: this computer's first, then those on the user's other computers (IDs like reviewer@laptop). Narrow it with query or kind; it returns at most limit at a time, with next for the rest.","inputSchema": {"type": "object", "properties": {"query": {"type": "string", "description": "Words that must all appear in the bot's name or description."},+ "kind": {"type": "string", "enum": ["codync", "claude-code", "codex", "terminal"], "description": "Only this kind of agent: codync (Codync bots), claude-code (Claude Code sessions), codex (Codex threads) or terminal (a person at a terminal on another computer)."},"limit": {"type": "integer", "minimum": 1, "maximum": 50, "description": "At most this many (default 20)."},"cursor": {"type": "string", "description": "next from the previous call, for the rest."},}},diff --git a/host/src/chat/team/directory.rs b/host/src/chat/team/directory.rsindex a38a0ba3..130439e8 100644--- a/host/src/chat/team/directory.rs+++ b/host/src/chat/team/directory.rs@@ -5,7 +5,7 @@ use super::visible_bots;use crate::hub::Hub;use crate::store::BotConfig;use anyhow::Result;-use codync_network::Peer;+use codync_network::{AgentKind, Peer};use serde_json::{Value, json};const DEFAULT_LIMIT: usize = 20;@@ -20,6 +20,7 @@ struct Row {/// The other computer it is on; `None` for this one.computer: Option<String>,online: bool,+ kind: AgentKind,}/// `keep` picks which of this computer's bots the caller may see.@@ -46,11 +47,12 @@ fn rows(hub: &Hub, from: &str, remote: &[Peer], keep: impl Fn(&BotConfig) -> boo.map(|c| Row {words: format!("{} {}", c.name, c.description).to_lowercase(),value: json!({- "id": c.id, "name": c.name, "description": c.description,+ "id": c.id, "name": c.name, "description": c.description, "kind": AgentKind::Codync,"backend": c.backend, "cwd": c.cwd, "status": hub.runtime(&c.id).status,}),computer: None,online: true,+ kind: AgentKind::Codync,}).collect();let mut others: Vec<Row> = remote@@ -59,11 +61,12 @@ fn rows(hub: &Hub, from: &str, remote: &[Peer], keep: impl Fn(&BotConfig) -> boop.agents.iter().map(|a| Row {words: format!("{} {}", a.name, a.about).to_lowercase(),value: json!({- "id": format!("{}@{}", a.id, p.name), "name": a.name, "description": a.about,+ "id": format!("{}@{}", a.id, p.name), "name": a.name, "description": a.about, "kind": a.kind,"computer": p.name, "status": if p.online { "online" } else { "away" },}),computer: Some(p.name.clone()),online: p.online,+ kind: a.kind,})}).collect();@@ -72,11 +75,13 @@ fn rows(hub: &Hub, from: &str, remote: &[Peer], keep: impl Fn(&BotConfig) -> booOk(rows)}-/// What `query`, `computer` and `online` keep.+/// What `query`, `computer`, `online` and `kind` keep.struct Filter {words: Vec<String>,computer: Option<String>,online: bool,+ /// A kind this version doesn't know reads as `other`, never as no filter.+ kind: Option<AgentKind>,}impl Filter {@@ -85,11 +90,12 @@ impl Filter {words: args["query"].as_str().unwrap_or_default().split_whitespace().map(str::to_lowercase).collect(),computer: args["computer"].as_str().map(str::to_lowercase),online: args["online"].as_bool() == Some(true),+ kind: args["kind"].as_str().map(|k| serde_json::from_value(json!(k)).unwrap_or_default()),}}fn narrows(&self) -> bool {- !self.words.is_empty() || self.computer.is_some() || self.online+ !self.words.is_empty() || self.computer.is_some() || self.online || self.kind.is_some()}/// `here` is this computer's name in its network.@@ -102,6 +108,7 @@ impl Filter {self.words.iter().all(|w| row.words.contains(w))&& self.computer.as_ref().is_none_or(on)&& (!self.online || row.online)+ && self.kind.is_none_or(|kind| kind == row.kind)}}@@ -147,6 +154,7 @@ mod tests {words: format!("{name} {about}").to_lowercase(),computer: computer.map(str::to_owned),online,+ kind: AgentKind::Codync,}}@@ -180,4 +188,22 @@ mod tests {assert!(rest.get("next").is_none() && rest["bots"].as_array().unwrap().len() == 1);assert!(page(&rows, &json!({"limit": 2}), false).get("summary").is_none());}++ #[test]+ fn list_bots_picks_a_kind_of_agent() {+ let mut session = row("main", "", Some("laptop"), true);+ session.kind = AgentKind::ClaudeCode;+ let mut thread = row("refactor", "", Some("laptop"), true);+ thread.kind = AgentKind::Codex;+ let rows = [row("Coder", "", None, true), session, thread];+ assert_eq!(kept(&rows, &json!({"kind": "codync"}), None), ["Coder"]);+ assert_eq!(kept(&rows, &json!({"kind": "claude-code"}), None), ["main"]);+ assert_eq!(kept(&rows, &json!({"kind": "codex", "computer": "laptop"}), None), ["refactor"]);+ assert_eq!(+ kept(&rows, &json!({"kind": "gemini"}), None),+ Vec::<&str>::new(),+ "an unknown kind isn't no filter"+ );+ assert!(Filter::of(&json!({"kind": "codex"})).narrows());+ }}diff --git a/host/src/network/api.rs b/host/src/network/api.rsindex 7a57895f..9ce59953 100644--- a/host/src/network/api.rs+++ b/host/src/network/api.rs@@ -37,7 +37,8 @@ fn network(slot: &Slot) -> Value {.directory().into_iter().map(|p| {- let agents: Vec<Value> = p.agents.iter().map(|a| json!({"id": a.id, "name": a.name})).collect();+ let agents: Vec<Value> =+ p.agents.iter().map(|a| json!({"id": a.id, "name": a.name, "kind": a.kind})).collect();let may = |rule: fn(Role, Role) -> bool| !p.me && mine.is_some_and(|me| rule(me, p.role));json!({"name": p.name, "role": p.role, "me": p.me, "online": p.online, "agents": agents,diff --git a/host/src/network/mod.rs b/host/src/network/mod.rsindex 39c9d3ce..6cdedce3 100644--- a/host/src/network/mod.rs+++ b/host/src/network/mod.rs@@ -15,7 +15,7 @@ mod saved;use crate::LockExt;use crate::hub::Hub;use anyhow::{Context, Result, anyhow, bail};-use codync_network::{Address, Agent, Connector, Node, Peer, Reach};+use codync_network::{Address, Agent, AgentKind, Connector, Node, Peer, Reach};use serde_json::json;use std::collections::{BTreeSet, HashMap};use std::sync::{Arc, Mutex};@@ -344,7 +344,8 @@ pub fn publish(hub: &Hub) {.into_iter().filter_map(|b| {let id = handles.handle(&b.id)?;- Some((Agent { id, name: b.name.clone(), about: b.description.clone() }, Reach::App))+ let about = b.description.clone();+ Some((Agent { id, name: b.name.clone(), about, kind: AgentKind::Codync }, Reach::App))}).collect();*hub.network.unoffered.locked() = kept_off.iter().filter_map(|b| handles.handle(&b.id)).collect();@@ -378,7 +379,8 @@ mod tests {let root = std::env::temp_dir().join(format!("codync-recipient-{}", uuid::Uuid::new_v4()));let start = async |folder: &str| Node::start(&root.join(folder), &Connector::Private).await.unwrap().0;let offer = |node: &Node, id: &str| {- node.set_agents([(Agent { id: id.into(), name: id.into(), about: String::new() }, Reach::App)]);+ let agent = Agent { id: id.into(), name: id.into(), about: String::new(), kind: AgentKind::Codync };+ node.set_agents([(agent, Reach::App)]);};// This computer is desk in home and in work; each has a computer called laptop.let (home, work) = (start("home").await, start("work").await);diff --git a/host/tests/network_e2e.rs b/host/tests/network_e2e.rsindex d496c9b4..b5f1431d 100644--- a/host/tests/network_e2e.rs+++ b/host/tests/network_e2e.rs@@ -114,6 +114,14 @@ async fn a_bot_messages_a_bot_on_another_computer_and_relays_its_reply() {// Every visible bot goes by its address name (the host's own lead bot too).assert!(desk_row["agents"].as_array().unwrap().iter().any(|a| a["id"] == "reviewer"), "{desk_row}");+ // Listings say what kind of agent each one is, and can pick one kind.+ let list =+ |kind: &str| json!({"botId": lead, "name": "list_bots", "arguments": {"kind": kind, "computer": "desk"}});+ let bots = laptop.call("teamCall", list("codync")).await;+ let reviewer_row = bots["bots"].as_array().unwrap().iter().find(|b| b["id"] == "reviewer@desk").cloned().unwrap();+ assert_eq!(reviewer_row["kind"], "codync");+ assert_eq!(laptop.call("teamCall", list("codex")).await["total"], 0);+// The lead lists the reviewer by its address and messages it; its turn ends at once.laptop.call("send", json!({"botId": lead, "text": "DELEGATE reviewer@desk"})).await;let permission = desk.wait_for(&reviewer, |e| e["kind"] == "permission" && e["data"]["status"] == "pending").await;