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.

fix(host): tell bots the user talks to them through Codync

leepokai46d56a40cd27
diff --git a/docs/features/context-and-memory.md b/docs/features/context-and-memory.md
index 454f94bf..2954cd6e 100644
--- a/docs/features/context-and-memory.md
+++ b/docs/features/context-and-memory.md
@@ -18,7 +18,8 @@ its own context and compacts it itself.
## Instruction snapshot (`host/src/chat/context.rs`)
- The bot's instructions are rendered once, in English and kept general: profile (name, description), how to
- message the user, other conversations, workspace, skills, plus the memory section. How to use each tool
+ message the user, where the user is (Codync's apps, not the engine's own CLI; New session to start over),
+ other conversations, workspace, skills, plus the memory section. How to use each tool
lives with the tool (MCP server instructions, tool descriptions), not here. They're stored as a snapshot in `kv` under `context.<bot>`, keyed by **session + compaction
epoch**, and don't change until one of those changes. This keeps the prompt byte-identical so the prompt
cache stays warm.
diff --git a/host/src/chat/context.rs b/host/src/chat/context.rs
index 279de1a6..08c96e4e 100644
--- a/host/src/chat/context.rs
+++ b/host/src/chat/context.rs
@@ -181,6 +181,15 @@ pub fn render(store: &Store, cfg: &BotConfig) -> String {
"You are a persistent agent the user delegates work to through Codync, from their phone or computer."
.to_owned(),
);
+ // Claude Code's own system prompt, which this is appended to, says the user is in its CLI.
+ let engine = if cfg.backend == "custom" {
+ "the coding agent".to_owned()
+ } else {
+ crate::agent::fallback::name(&cfg.backend)
+ };
+ lines.push(format!(
+ "Environment: you run inside Codync. The user talks to you through Codync (its phone, desktop or terminal app), not in {engine}'s own CLI, IDE or app. The engine Codync runs you on is {engine}: where your base instructions describe its CLI, terminal, slash commands or keyboard shortcuts, they describe that engine, not where the user is, so don't point the user to them. To start over, the user starts a New session for this chat in Codync (the chat's menu in the apps, S in the terminal UI)."
+ ));
lines.push(String::new());
lines.push(format!("Messages: {}", crate::chat::outbox::INSTRUCTIONS));
lines.push(String::new());
@@ -269,6 +278,13 @@ mod tests {
assert!(system.contains("These rules apply to the current turn"));
}
+ #[test]
+ fn instructions_place_the_user_in_codync_not_in_the_engine() {
+ let system = render(&store(), &cfg("Reporter", ""));
+ assert!(system.contains("not in Claude Code's own CLI, IDE or app"), "{system}");
+ assert!(system.contains("The engine Codync runs you on is Claude Code:"), "{system}");
+ }
+
#[test]
fn snapshot_is_frozen_until_compaction_and_updates_are_announced_once() {
let store = store();