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): turn off other harnesses' own memory for personal bots
leepokai66babc1c1655
diff --git a/docs/architecture/file-structure.md b/docs/architecture/file-structure.mdindex 6dc49955..ffd47515 100644--- a/docs/architecture/file-structure.md+++ b/docs/architecture/file-structure.md@@ -84,7 +84,7 @@ Codync/| SQLite transcript, bots, lanes and sessions | `host/src/store/` (`entries.rs`, `bots.rs`, `model.rs`, `devices.rs`, `schema.rs`) || Agent process, ACP, queue and session lifecycle | `host/src/agent/bot/` (`queue.rs`, `session.rs`, `turn.rs`, `updates.rs`), `acp.rs` || Group room turns / bot-to-bot requests | `host/src/chat/group.rs` / `team.rs` |-| Prompt snapshots and memory | `host/src/chat/context.rs`, `memory/` (`api.rs`, `tools.rs`, `notices.rs`, `dream.rs`, `import.rs`); the rules in `host/crates/memory` (`codync-mem`) |+| Prompt snapshots and memory | `host/src/chat/context.rs`, `memory/` (`api.rs`, `tools.rs`, `notices.rs`, `dream.rs`, `import.rs`); the rules in `host/crates/memory` (`codync-mem`); harnesses' own memory turned off in `host/src/agent/own_memory.rs` || Identity, encryption and direct channel | `host/src/remote/identity.rs`, `crypto.rs`, `channel.rs` || Host cloud state and relay connection | `host/src/remote/cloud.rs`, `relay.rs` || Agent discovery, sign-in, setup terminal, Node.js for npm agents | `host/src/agent/backends.rs`, `registry.rs`, `auth.rs`, `term.rs`, `node.rs` |diff --git a/docs/design/bot-memory.md b/docs/design/bot-memory.mdindex 8c841fcb..43b3b05e 100644--- a/docs/design/bot-memory.md+++ b/docs/design/bot-memory.md@@ -390,12 +390,21 @@ vendor's extension, and it isn't re-sent on `session/load`.the agent advertises the capability (M3). Agents that can't reach them read and write through `read_memory` and`edit_memory`.-**The harness's own memory.** For a bot in its own workspace, Codync turns each harness's own memory off where it-can, so the bot has one memory and it is visible:+**The harness's own memory.** For a bot in its own workspace, and for every background job, Codync turns each+harness's own memory off where it can, so the bot has one memory and it is visible (`agent/own_memory.rs`,+surveyed 2026-10-18):-| Harness | Its own memory | Turned off by |+| Harness | Its own memory | What Codync does ||---|---|---|| Claude Code | Auto memory, auto-dream | `autoMemoryEnabled: false`, `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`, `autoDreamEnabled: false` |+| Copilot CLI | Copilot Memory, on for individual plans | `--excluded-tools=store_memory,vote_memory` |+| Qwen Code | Auto memory and its own dreaming, on | `.qwen/settings.json` in the workspace: `memory.enableManagedAutoMemory` and `enableManagedAutoDream` false |+| CodeBuddy | Auto memory | `CODEBUDDY_DISABLE_AUTO_MEMORY=1` |+| Codex, Goose, Grok, oh-my-pi, Qoder, Cortex | Off unless the user turns it on | Nothing |+| Gemini CLI | Its system prompt has the model edit `~/.gemini/GEMINI.md` | Nothing: no switch short of replacing its system prompt or its home folder |+| Kilo Code | Memory tools, on per project | Nothing: the only per-process switch replaces the whole config |+| Kiro | Memory with a global setting | Nothing: no per-workspace key |+| OpenCode, Cursor, Kimi, Amp, Cline, Droid, Devin, others | None found | Nothing |### Compactiondiff --git a/docs/features/context-and-memory.md b/docs/features/context-and-memory.mdindex b962c6a4..86db61fd 100644--- a/docs/features/context-and-memory.md+++ b/docs/features/context-and-memory.md@@ -66,8 +66,10 @@ the `codync-mem` crate; `chat/memory` runs them in the host.nor do bare acknowledgements. It only adds and archives, at most 10 changes and never more than a quarter ofthe entries, and drops a run when the user edited memory meanwhile. It waits while the plan's usage is above75%. Every run is logged and can be undone; what an undo removes isn't learned again.-- **Claude Code's own memory** is off for bots in their own workspace (`autoMemoryEnabled: false`,- `CLAUDE_CODE_DISABLE_AUTO_MEMORY`); auto-dream is off for every bot. A project bot's `MEMORY.md` shows+- **The harness's own memory** is off for bots in their own workspace and for background jobs+ (`agent/own_memory.rs`): Claude Code (`autoMemoryEnabled: false`, `CLAUDE_CODE_DISABLE_AUTO_MEMORY`), Copilot+ (its memory tools excluded), Qwen Code (workspace settings) and CodeBuddy. Claude Code's auto-dream is off for+ every bot. Gemini CLI, Kilo Code and Kiro have no switch Codync can use. A project bot's `MEMORY.md` showsread-only on its memory screen.- **The apps** (iPhone, desktop, terminal) show "About you", "This bot", the dream log and the project's notes,with add, edit, pin, archive, forget and forget-everything. They fetch with `memory` and fetch again when thediff --git a/host/src/agent/bot/session.rs b/host/src/agent/bot/session.rsindex 1b2948c6..842fb237 100644--- a/host/src/agent/bot/session.rs+++ b/host/src/agent/bot/session.rs@@ -3,6 +3,7 @@use super::fast_mode::Listing;use super::{Actor, Conn, Instructions, NoticeStyle, SessionCaps};use crate::agent::acp::{self, Acp, Incoming};+use crate::agent::own_memory;use crate::chat::context;use crate::store::{BotConfig, Entry, EntryKind, Lane, lane_key};use anyhow::{Result, anyhow, bail};@@ -148,7 +149,7 @@ impl Actor {}if self.conn.is_none() {let (hub, id) = (self.hub.clone(), self.cfg.id.clone());- let candidates = launch_commands(&self.cfg, move |msg: &str| {+ let mut candidates = launch_commands(&self.cfg, move |msg: &str| {let msg = msg.to_owned();hub.set_runtime(&id, |r| r.activity = msg);})@@ -157,8 +158,8 @@ impl Actor {// Keys saved from an "environment variable" sign-in.let mut env = crate::agent::auth::env(&self.hub.store, &self.cfg.backend)?;if crate::agent::workspace::is_managed(&self.cfg) {- // Codync's memory is the only one a bot in its own workspace has (see `claude_meta`).- env.push(("CLAUDE_CODE_DISABLE_AUTO_MEMORY".into(), "1".into()));+ // Codync's memory is the only one a bot in its own workspace has.+ own_memory::turn_off(&self.cfg.backend, &self.cfg.cwd, &mut env, &mut candidates).await;}let mut last_err = None;for (i, command) in candidates.iter().enumerate() {diff --git a/host/src/agent/mod.rs b/host/src/agent/mod.rsindex 7c6bb769..943913af 100644--- a/host/src/agent/mod.rs+++ b/host/src/agent/mod.rs@@ -7,6 +7,7 @@ pub mod backends;pub mod bot;pub mod config;pub mod node;+pub mod own_memory;pub mod registry;pub mod term;pub mod workspace;diff --git a/host/src/agent/own_memory.rs b/host/src/agent/own_memory.rsnew file mode 100644index 00000000..4babcb6d--- /dev/null+++ b/host/src/agent/own_memory.rs@@ -0,0 +1,97 @@+//! The harnesses' own memory, turned off where Codync's is the bot's only one: a bot in its own workspace, and+//! Codync's background jobs ([design](../../../docs/design/bot-memory.md#instructions-in-every-harness)).+//! Claude Code also gets its settings through `_meta` (see `agent::bot`).++use anyhow::{Context, Result};+use serde_json::{Value, json};+use std::path::Path;++/// For the agent's process. A harness ignores the variables meant for the others.+pub const ENV: &[(&str, &str)] = &[("CLAUDE_CODE_DISABLE_AUTO_MEMORY", "1"), ("CODEBUDDY_DISABLE_AUTO_MEMORY", "1")];++/// Appended to the harness's ACP command.+pub fn args(backend: &str) -> &'static str {+ match backend {+ // Copilot Memory writes through these two tools.+ "copilot" => " --excluded-tools=store_memory,vote_memory",+ _ => "",+ }+}++/// Turns the harness's own memory off for one launch in `workspace`: its environment, its command, and the+/// settings it reads from the folder.+pub async fn turn_off(backend: &str, workspace: &str, env: &mut Vec<(String, String)>, commands: &mut [String]) {+ env.extend(ENV.iter().map(|(k, v)| ((*k).to_owned(), (*v).to_owned())));+ for command in commands {+ command.push_str(args(backend));+ }+ let (backend, workspace) = (backend.to_owned(), workspace.to_owned());+ match tokio::task::spawn_blocking(move || prepare_workspace(&backend, Path::new(&workspace))).await {+ Ok(Ok(())) => {}+ Ok(Err(error)) => tracing::warn!(error = format!("{error:#}"), "couldn't turn off the harness's own memory"),+ Err(error) => tracing::warn!(%error, "couldn't turn off the harness's own memory"),+ }+}++/// Settings a harness reads from the workspace folder itself.+fn prepare_workspace(backend: &str, workspace: &Path) -> Result<()> {+ match backend {+ "qwen" => merge(+ &workspace.join(".qwen/settings.json"),+ &json!({"memory": {"enableManagedAutoMemory": false, "enableManagedAutoDream": false}}),+ ),+ _ => Ok(()),+ }+}++/// Sets `settings`' keys in the JSON file at `path`, keeping the rest of it.+fn merge(path: &Path, settings: &Value) -> Result<()> {+ let mut current = match std::fs::read_to_string(path) {+ Ok(text) => serde_json::from_str(&text).with_context(|| format!("reading {}", path.display()))?,+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => json!({}),+ Err(e) => return Err(e).with_context(|| format!("reading {}", path.display())),+ };+ let before = current.clone();+ overlay(&mut current, settings);+ if current == before {+ return Ok(());+ }+ if let Some(dir) = path.parent() {+ std::fs::create_dir_all(dir)?;+ }+ std::fs::write(path, serde_json::to_string_pretty(¤t)?).with_context(|| format!("writing {}", path.display()))+}++fn overlay(target: &mut Value, settings: &Value) {+ match (target, settings) {+ (Value::Object(target), Value::Object(settings)) => {+ for (key, value) in settings {+ overlay(target.entry(key.clone()).or_insert(Value::Null), value);+ }+ }+ (target, value) => *target = value.clone(),+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn workspace_settings_keep_what_the_user_set() {+ let dir = std::env::temp_dir().join(format!("codync-own-memory-{}", uuid::Uuid::new_v4()));+ let file = dir.join(".qwen/settings.json");+ std::fs::create_dir_all(file.parent().unwrap()).unwrap();+ std::fs::write(&file, r#"{"model": {"name": "qwen3"}, "memory": {"other": 1}}"#).unwrap();+ prepare_workspace("qwen", &dir).unwrap();+ let settings: Value = serde_json::from_str(&std::fs::read_to_string(&file).unwrap()).unwrap();+ assert_eq!(settings["model"]["name"], "qwen3");+ assert_eq!(+ settings["memory"],+ json!({"other": 1, "enableManagedAutoMemory": false, "enableManagedAutoDream": false})+ );+ prepare_workspace("codex", &dir.join("none")).unwrap();+ assert!(!dir.join("none").exists(), "nothing for other harnesses");+ std::fs::remove_dir_all(dir).unwrap();+ }+}diff --git a/host/src/chat/oneshot.rs b/host/src/chat/oneshot.rsindex 9dd32254..75ca9617 100644--- a/host/src/chat/oneshot.rs+++ b/host/src/chat/oneshot.rs@@ -12,8 +12,8 @@ use std::time::Duration;const TIMEOUT: Duration = Duration::from_secs(180);/// 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.+/// Claude gets a real system prompt, no tools, no settings and no saved session; an agent with ACP+/// `systemPrompt` gets the instructions there, other harnesses inline. None of them may remember the job.pub async fn one_shot(hub: &Arc<Hub>, cfg: &BotConfig, system: &str, user: &str) -> Result<String> {let cwd = crate::service::data_dir().join("background");tokio::fs::create_dir_all(&cwd).await?;@@ -21,10 +21,12 @@ pub async fn one_shot(hub: &Arc<Hub>, cfg: &BotConfig, system: &str, user: &str)if hub.store.kv_read(&format!("agent-env:{}", cfg.backend))?.is_some() {crate::market::vault::unlock(hub.clone()).await?;}- let env = crate::agent::auth::env(&hub.store, &cfg.backend)?;+ let mut env = crate::agent::auth::env(&hub.store, &cfg.backend)?;+ let mut commands = crate::agent::bot::launch_commands(cfg, |_| {}).await?;+ crate::agent::own_memory::turn_off(&cfg.backend, &cwd, &mut env, &mut commands).await;let mut conn = None;let mut last_err = None;- for command in crate::agent::bot::launch_commands(cfg, |_| {}).await? {+ for command in commands {match crate::agent::bot::start_agent(&command, &cwd, &env, Duration::from_secs(60)).await {Ok(c) => {conn = Some(c);