Skip to content

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.

feat: name new bots from their first conversations

leepokai0fa3e880bf52
diff --git a/apps/linux/src/compose.rs b/apps/linux/src/compose.rs
index fec9277d..1cde6e35 100644
--- a/apps/linux/src/compose.rs
+++ b/apps/linux/src/compose.rs
@@ -5,7 +5,7 @@
use crate::client;
use crate::rows::{hline, icon_button, label};
use crate::ui::{self, App, flat_header};
-use crate::{avatar, dialogs};
+use crate::avatar;
use adw::prelude::*;
use serde_json::{Value, json};
use std::cell::{Cell, RefCell};
@@ -372,18 +372,14 @@ fn open_chat(ui: &App, id: &str) {
}
}
-/// "New Bot" (or the typed name) with sensible defaults: the first available agent and a personal workspace.
+/// A bot with the typed name, or none (the host names it after its first conversations), with
+/// sensible defaults: the first available agent and a personal workspace.
fn create(ui: &App) {
if ui.compose_page.creating.replace(true) {
return;
}
render(ui);
- let typed = ui.compose_page.to.text().trim().to_owned();
- let name = if typed.is_empty() {
- "New Bot".to_owned()
- } else {
- typed
- };
+ let name = ui.compose_page.to.text().trim().to_owned();
let body = {
let st = ui.state.borrow();
let backends = st.hello["backends"].as_array().cloned().unwrap_or_default();
@@ -406,10 +402,6 @@ fn create(ui: &App) {
ui2.state.borrow_mut().bots.insert(id.clone(), bot.clone());
if ui2.compose_page.recipients.borrow().is_empty() {
open_chat(&ui2, &id);
- // A fresh "New Bot" opens on its settings, like the Mac's details panel.
- if bot["name"] == "New Bot" {
- dialogs::editor(&ui2, Some(bot));
- }
} else {
choose(&ui2, &bot);
}
diff --git a/apps/linux/src/dialogs.rs b/apps/linux/src/dialogs.rs
index 1290ccd8..79e79521 100644
--- a/apps/linux/src/dialogs.rs
+++ b/apps/linux/src/dialogs.rs
@@ -84,6 +84,8 @@ pub fn editor(ui: &App, bot: Option<Value>) {
.title("Name")
.text(d.borrow()["name"].as_str().unwrap_or(""))
.build();
+ // A new bot is named from its first conversations (Grok Bot's flow); rename it any time after.
+ name.set_visible(!is_new);
profile.add(&name);
let shapes = gtk::FlowBox::builder()
.selection_mode(gtk::SelectionMode::None)
diff --git a/docs/features/context-and-memory.md b/docs/features/context-and-memory.md
index af63cce2..8ae6ef6a 100644
--- a/docs/features/context-and-memory.md
+++ b/docs/features/context-and-memory.md
@@ -46,6 +46,12 @@ its own context and compacts it itself.
- Other harnesses get the instructions inline, in `~/.codync/memory-keeper`.
- **Episodes:** every 6 remembered exchanges (pending turns in `memory.episode.<bot>`), the keeper writes one
`[episode]` journal sentence.
+- **Automatic names** (`chat/naming.rs`): a bot created without a name is called "New Bot" with `autoName` set;
+ clients don't ask for a name when creating one. From its 3rd remembered exchange the keeper shows the last 6
+ (`naming.turns.<bot>`) to the same one-shot agent and asks for a 1–4 word name in the user's language, retrying
+ after each exchange until the purpose is clear. The name goes through `updateBot`, so the agent gets it as a
+ profile update. The description is never touched (it holds standing instructions). Renaming the bot yourself
+ clears `autoName` for good.
- The agent is told where its memory folder is so it can grep older facts. Facts learned mid-session reach its
prompt at the next compaction or session.
- **API:** `memory`, `forgetMemory`, `clearMemory`. The Memory card in bot settings lists and removes facts.
diff --git a/host/src/chat/memory.rs b/host/src/chat/memory.rs
index 05361853..c5128a30 100644
--- a/host/src/chat/memory.rs
+++ b/host/src/chat/memory.rs
@@ -583,11 +583,19 @@ pub struct Exchange {
}
/// Starts the bot's keeper: exchanges are remembered one at a time, in the
-/// background. It stops when the bot actor drops the sender.
+/// background, and an unnamed bot is named from them (see `naming`). It stops when the bot actor drops the sender.
pub fn spawn_keeper(hub: Arc<Hub>, bot_id: String) -> mpsc::UnboundedSender<Exchange> {
let (tx, mut rx) = mpsc::unbounded_channel::<Exchange>();
tokio::spawn(async move {
while let Some(x) = rx.recv().await {
+ let turn = EpisodeTurn {
+ ts: x.at,
+ user: acp::truncate(&x.user, EXCHANGE_CHARS),
+ agent: acp::truncate(&x.agent, EXCHANGE_CHARS),
+ };
+ if let Err(e) = crate::chat::naming::observe(&hub, &bot_id, turn).await {
+ tracing::warn!(bot = %bot_id, error = format!("{e:#}"), "naming the bot failed");
+ }
if let Err(e) = remember(&hub, &bot_id, x).await {
tracing::warn!(bot = %bot_id, error = format!("{e:#}"), "memory keeper failed");
}
@@ -639,7 +647,7 @@ async fn remember(hub: &Arc<Hub>, bot_id: &str, x: Exchange) -> Result<()> {
/// Runs one prompt on a throwaway agent of the bot's harness and returns its reply.
/// Claude gets a real system prompt, no tools, no settings and no saved session;
/// other harnesses get the instructions inline.
-async fn one_shot(hub: &Arc<Hub>, cfg: &BotConfig, system: &str, user: &str) -> Result<String> {
+pub(crate) async fn one_shot(hub: &Arc<Hub>, cfg: &BotConfig, system: &str, user: &str) -> Result<String> {
let cwd = crate::service::data_dir().join("memory-keeper");
tokio::fs::create_dir_all(&cwd).await?;
let cwd = cwd.to_string_lossy().into_owned();
diff --git a/host/src/chat/mod.rs b/host/src/chat/mod.rs
index 704f81e7..820fd437 100644
--- a/host/src/chat/mod.rs
+++ b/host/src/chat/mod.rs
@@ -1,8 +1,9 @@
//! Conversation features on top of bots: group room turns, bot-to-bot
-//! requests, prompt snapshots and long-term memory.
+//! requests, prompt snapshots, long-term memory and automatic bot names.
pub mod context;
pub mod group;
pub mod memory;
+pub mod naming;
pub mod team;
pub mod uploads;
diff --git a/host/src/chat/naming.rs b/host/src/chat/naming.rs
new file mode 100644
index 00000000..1762ebfe
--- /dev/null
+++ b/host/src/chat/naming.rs
@@ -0,0 +1,103 @@
+//! Automatic bot names, as in Grok Bot: a bot created without a name is called
+//! [`PLACEHOLDER`] until its first few conversations show what it's for. Then
+//! the keeper (see `memory`) asks a one-shot agent of the bot's harness for a
+//! short name. The user renaming it ends this. The description stays the
+//! user's: it holds standing instructions.
+
+use crate::chat::memory::{self, EpisodeTurn};
+use crate::hub::Hub;
+use crate::store::Store;
+use anyhow::Result;
+use serde_json::json;
+use std::sync::Arc;
+
+pub const PLACEHOLDER: &str = "New Bot";
+/// Conversations before the first naming attempt.
+const NAME_AFTER: usize = 3;
+/// The most recent conversations shown to the namer (it retries after each one).
+const WINDOW: usize = 6;
+const MAX_NAME_CHARS: usize = 40;
+
+fn key(bot_id: &str) -> String {
+ format!("naming.turns.{bot_id}")
+}
+
+fn pending(store: &Store, bot_id: &str) -> Vec<EpisodeTurn> {
+ store.kv_get(&key(bot_id)).and_then(|v| serde_json::from_str(&v).ok()).unwrap_or_default()
+}
+
+/// Records a finished conversation and, once there are enough, names the bot.
+pub async fn observe(hub: &Arc<Hub>, bot_id: &str, turn: EpisodeTurn) -> Result<()> {
+ let Some(cfg) = hub.store.bot(bot_id)?.filter(|b| !b.deleted && b.config.auto_name).map(|b| b.config) else {
+ return Ok(());
+ };
+ let mut turns = pending(&hub.store, bot_id);
+ turns.push(turn);
+ let skip = turns.len().saturating_sub(WINDOW);
+ turns.drain(..skip);
+ hub.store.kv_set(&key(bot_id), &serde_json::to_string(&turns)?)?;
+ if turns.len() < NAME_AFTER {
+ return Ok(());
+ }
+ let raw = memory::one_shot(hub, &cfg, SYSTEM_PROMPT, &user_prompt(&turns)).await?;
+ let Some(name) = parse(&raw) else {
+ tracing::info!(bot = %bot_id, "purpose not clear yet; naming later");
+ return Ok(());
+ };
+ // The user may have renamed it while the namer ran.
+ if !hub.store.bot(bot_id)?.is_some_and(|b| !b.deleted && b.config.auto_name) {
+ return Ok(());
+ }
+ let patch = json!({"id": bot_id, "name": name, "autoName": false});
+ let hub2 = hub.clone();
+ tokio::task::spawn_blocking(move || hub2.update_bot(&patch)).await??;
+ hub.store.kv_set(&key(bot_id), "[]")?;
+ tracing::info!(bot = %bot_id, "named from its conversations");
+ Ok(())
+}
+
+const SYSTEM_PROMPT: &str = "\
+You name a personal assistant bot after its first conversations with the user.
+Read the conversations and work out what the user relies on this bot for.
+Output exactly one line:
+name: <a short name for the bot, 1-4 words, saying what it does, like a job title or a team nickname>
+Write it in the language and script the user writes in (Traditional and Simplified Chinese are different). No quotes, no emoji, no trailing punctuation.
+Output exactly NONE if the conversations don't show a clear purpose yet (only greetings, tests or small talk).";
+
+fn user_prompt(turns: &[EpisodeTurn]) -> String {
+ let body = turns
+ .iter()
+ .map(|t| format!("User: {}\nBot: {}", t.user.trim(), t.agent.trim()))
+ .collect::<Vec<_>>()
+ .join("\n\n");
+ format!("Conversations so far, oldest first:\n\n{body}")
+}
+
+fn parse(raw: &str) -> Option<String> {
+ let name = raw.lines().find_map(|line| {
+ let (tag, rest) = line.trim().trim_start_matches(['-', '*', ' ']).split_once(':')?;
+ tag.trim().eq_ignore_ascii_case("name").then(|| rest.trim().trim_matches(['"', '“', '”', '「', '」']))
+ })?;
+ let name = name.trim_end_matches(['.', '。']).trim();
+ (!name.is_empty() && !name.eq_ignore_ascii_case("none") && name.chars().count() <= MAX_NAME_CHARS)
+ .then(|| name.to_owned())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn names_are_parsed() {
+ assert_eq!(parse("name: 「記帳助手」").as_deref(), Some("記帳助手"));
+ assert_eq!(parse("Sure!\n- Name: Release Captain.").as_deref(), Some("Release Captain"));
+ }
+
+ #[test]
+ fn unclear_or_bad_names_are_rejected() {
+ assert_eq!(parse("NONE"), None);
+ assert_eq!(parse("name: NONE"), None);
+ assert_eq!(parse("name: "), None);
+ assert_eq!(parse(&format!("name: {}", "x".repeat(41))), None);
+ }
+}
diff --git a/host/src/hub.rs b/host/src/hub.rs
index a508dce3..30778277 100644
--- a/host/src/hub.rs
+++ b/host/src/hub.rs
@@ -213,6 +213,11 @@ impl Hub {
pub fn create_bot(self: &Arc<Self>, mut cfg: BotConfig) -> Result<Value> {
cfg.id = uuid::Uuid::new_v4().to_string();
cfg.created_at = crate::store::now_ms();
+ // No name yet (Grok Bot's flow): it gets one after its first few conversations.
+ cfg.auto_name = !cfg.is_group() && cfg.name.trim().is_empty();
+ if cfg.auto_name {
+ crate::chat::naming::PLACEHOLDER.clone_into(&mut cfg.name);
+ }
if cfg.is_group() {
cfg.members = crate::chat::group::valid_members(&self.store, &cfg.id, &cfg.members)?;
// The same bots again: open the group they already share (Grok Bot's rule).
@@ -243,6 +248,13 @@ impl Hub {
}
}
let mut cfg: BotConfig = serde_json::from_value(merged)?;
+ if cfg.name.trim().is_empty() {
+ cfg.name.clone_from(&row.config.name);
+ }
+ // A name the user picked ends automatic naming; the namer passes `autoName` itself.
+ if cfg.name != row.config.name && patch.get("autoName").is_none() {
+ cfg.auto_name = false;
+ }
if cfg.kind != row.config.kind {
bail!("a bot can't become a group, or a group a bot");
}
diff --git a/host/src/store.rs b/host/src/store.rs
index 4e20b5f4..f3e245f0 100644
--- a/host/src/store.rs
+++ b/host/src/store.rs
@@ -62,6 +62,7 @@ pub enum BotKind {
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
+#[expect(clippy::struct_excessive_bools, reason = "independent user settings stored as plain JSON flags")]
pub struct BotConfig {
pub id: String,
#[serde(default)]
@@ -104,6 +105,10 @@ pub struct BotConfig {
/// The bot gets the built-in `computer` MCP server (see `screen`).
#[serde(default)]
pub computer: bool,
+ /// Created without a name: the host names it from its first conversations (see `naming`)
+ /// until the user renames it.
+ #[serde(default)]
+ pub auto_name: bool,
#[serde(default)]
pub created_at: i64,
}
@@ -957,6 +962,7 @@ mod tests {
connectors: vec![],
skills: vec![],
computer: false,
+ auto_name: false,
created_at: 0,
};
s.save_bot(&cfg).unwrap();
diff --git a/host/src/tui/app.rs b/host/src/tui/app.rs
index a05aa615..c7a05203 100644
--- a/host/src/tui/app.rs
+++ b/host/src/tui/app.rs
@@ -2116,7 +2116,7 @@ impl App {
if f.saving {
return;
}
- if f.name.text.trim().is_empty() {
+ if f.bot_id.is_some() && f.name.text.trim().is_empty() {
f.error = Some("Give the bot a name.".into());
return;
}
diff --git a/host/src/tui/view.rs b/host/src/tui/view.rs
index 0bf8ddc3..c9bafa7b 100644
--- a/host/src/tui/view.rs
+++ b/host/src/tui/view.rs
@@ -2052,7 +2052,11 @@ fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {
}
};
match field {
- Field::Name => text_field(buf, &f.name, "Name", y),
+ Field::Name => {
+ // A new bot may stay unnamed: the host names it after its first conversations.
+ let placeholder = if f.bot_id.is_none() { "Named after a few chats" } else { "Name" };
+ text_field(buf, &f.name, placeholder, y);
+ }
Field::Instructions => {
text_field(buf, &f.instructions, "e.g. Reviews PRs. Never pushes without asking.", y);
}
diff --git a/kit/Sources/CodyncKit/Models/Models.swift b/kit/Sources/CodyncKit/Models/Models.swift
index 1d1c72fa..ed17dc69 100644
--- a/kit/Sources/CodyncKit/Models/Models.swift
+++ b/kit/Sources/CodyncKit/Models/Models.swift
@@ -29,6 +29,8 @@ public struct Bot: Codable, Identifiable, Hashable, Sendable {
public var skills: [String]
/// The bot can see and operate the computer's desktop (the built-in `computer` tools).
public var computer: Bool
+ /// Created without a name: the host names it after its first few conversations.
+ public var autoName: Bool = false
public var createdAt: Int64
// Runtime, filled in by the host.
@@ -511,6 +513,7 @@ extension Bot {
connectors = try c.decodeIfPresent([String].self, forKey: .connectors) ?? []
skills = try c.decodeIfPresent([String].self, forKey: .skills) ?? []
computer = try c.decodeIfPresent(Bool.self, forKey: .computer) ?? false
+ autoName = try c.decodeIfPresent(Bool.self, forKey: .autoName) ?? false
createdAt = try c.decodeIfPresent(Int64.self, forKey: .createdAt) ?? 0
rev = try c.decodeIfPresent(Int64.self, forKey: .rev) ?? 0
status = try c.decodeIfPresent(String.self, forKey: .status) ?? "idle"
diff --git a/kit/Sources/CodyncUI/Bots/BotEditorView.swift b/kit/Sources/CodyncUI/Bots/BotEditorView.swift
index 47f92dd4..ea20f01c 100644
--- a/kit/Sources/CodyncUI/Bots/BotEditorView.swift
+++ b/kit/Sources/CodyncUI/Bots/BotEditorView.swift
@@ -145,8 +145,11 @@ struct BotSettingsForm: View {
}
.frame(maxWidth: .infinity)
- Field("Name") {
- TextField("Name", text: $draft.name).fieldBox()
+ // A new bot is named from its first conversations (Grok Bot's flow); rename it any time after.
+ if draft.id != nil {
+ Field("Name") {
+ TextField("Name", text: $draft.name).fieldBox()
+ }
}
Field("Standing instructions") {
TextField("e.g. Reviews PRs. Never pushes without asking.", text: $draft.description, axis: .vertical)
@@ -374,7 +377,8 @@ extension View {
}
extension BotDraft {
- var isValid: Bool { !name.trimmingCharacters(in: .whitespaces).isEmpty }
+ /// A new bot may go without a name: the host names it after its first conversations.
+ var isValid: Bool { id == nil || !name.trimmingCharacters(in: .whitespaces).isEmpty }
/// What the host should get: no stale command unless the agent is custom.
var normalized: BotDraft {
@@ -397,9 +401,9 @@ public extension BotStore {
}
}
- /// Creates "New Bot" with sensible defaults and opens it (desktop compose flow).
+ /// Creates an unnamed bot with sensible defaults and opens it (desktop compose flow).
func createDefaultBot() async throws -> Bot {
- var draft = BotDraft(name: "New Bot")
+ var draft = BotDraft()
fillDefaults(&draft)
let bot = try await save(draft)
selection = bot.id
diff --git a/kit/Sources/CodyncUI/Thread/ThreadView.swift b/kit/Sources/CodyncUI/Thread/ThreadView.swift
index 3536176d..bca9cfef 100644
--- a/kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -185,9 +185,6 @@ public struct ThreadView: View {
}
.background(Palette.background)
}
- .onAppear {
- if bot?.name == "New Bot", model.chat(botId).isEmpty { editingDetails = true }
- }
#endif
.readingConversation(botId)
.codyncSheet(isPresented: $showTrace) {