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: turn the agent's own memory off by default, with a switch per bot
leepokai20509f8c3fbf
diff --git a/apps/desktop/src/renderer/store/bot-store.ts b/apps/desktop/src/renderer/store/bot-store.tsindex fa407640..95ed5b5a 100644--- a/apps/desktop/src/renderer/store/bot-store.ts+++ b/apps/desktop/src/renderer/store/bot-store.ts@@ -257,6 +257,11 @@ export class BotStore extends BotSync {this.patchBot(bot, { sharedMemory })}+ /** Whether the bot's harness keeps its own memory on beside Codync's. */+ setHarnessMemory(bot: Bot, harnessMemory: boolean) {+ this.patchBot(bot, { harnessMemory })+ }+setHidden(bot: Bot, hidden: boolean) {this.patchBot(bot, { hidden })}diff --git a/apps/desktop/src/renderer/views/bots/HarnessMemorySheet.tsx b/apps/desktop/src/renderer/views/bots/HarnessMemorySheet.tsxnew file mode 100644index 00000000..2776c9b6--- /dev/null+++ b/apps/desktop/src/renderer/views/bots/HarnessMemorySheet.tsx@@ -0,0 +1,39 @@+import { CardForm, CardSection } from '../../components/Controls'+import { Icon } from '../../components/Icon'+import { ModalHeader, SheetPage } from '../../components/Overlay'+import { HStack, IconSlot, VStack } from '../../components/Stack'+import { Text } from '../../components/Text'++/**+ * The memory screen's info button beside the harness's own memory switch: what turning it on means. The same text+ * as the kit's; the terminal UI says it short in a confirmation before turning it on. `readable`: Codync shows its+ * notes (Claude Code's are a file).+ */+export function HarnessMemorySheet({ harness, readable }: { harness: string; readable: boolean }) {+ const details = [+ { icon: 'brain', title: 'A memory of its own', detail: `${harness} keeps notes apart from Codync's memory. It's off by default, so this bot has one memory and you see and change all of it here.` },+ { icon: 'square.on.square', title: 'Remembered twice', detail: 'With both on, the bot may save the same thing twice, and the two can disagree after something changes.' },+ { icon: 'trash', title: 'Forgetting', detail: `Forgetting something here doesn't remove it from ${harness}'s notes. Codync can't change them.` },+ { icon: 'eye', title: 'Where to see it', detail: readable ? `Its notes show read-only under the ${harness} tab.` : `Codync can't show it; look in ${harness} itself.` },+ ]+ return (+ <SheetPage>+ <ModalHeader title={`${harness}'s own memory`} />+ <CardForm>+ <CardSection>+ {details.map((d) => (+ <HStack key={d.title} align="flex-start" gap={12}>+ <IconSlot width={20} tone="secondary" className="memory-info-icon">+ <Icon name={d.icon} size={15} />+ </IconSlot>+ <VStack gap={2} grow>+ <span>{d.title}</span>+ <Text size="footnote" tone="secondary">{d.detail}</Text>+ </VStack>+ </HStack>+ ))}+ </CardSection>+ </CardForm>+ </SheetPage>+ )+}diff --git a/apps/desktop/src/renderer/views/bots/MemoryView.tsx b/apps/desktop/src/renderer/views/bots/MemoryView.tsxindex 8859a291..4036a09c 100644--- a/apps/desktop/src/renderer/views/bots/MemoryView.tsx+++ b/apps/desktop/src/renderer/views/bots/MemoryView.tsx@@ -2,16 +2,19 @@ import { useEffect, useMemo, useState } from 'react'import { Button, CardSection, DropdownMenu, IconButton, Switch, TabChoice } from '../../components/Controls'import { Icon } from '../../components/Icon'import { Dialog, ModalHeader, Sheet } from '../../components/Overlay'+import { HStack } from '../../components/Stack'import { useModel } from '../../lib/observable'import { useStore } from '../../store/context'import { MemoryStore, authorLabel, type MemoryEntry } from '../../store/memory-store'+import { FormSheet } from '../marketplace/pieces'import { relativeTime } from '../thread/chat-items'+import { HarnessMemorySheet } from './HarnessMemorySheet'import { type FileTarget, MemoryFileSheet, fileRows } from './MemoryFiles'import './memory.css'-type Section = 'yours' | 'bot' | 'dreams' | 'project'+type Section = 'yours' | 'bot' | 'dreams' | 'harness'-/** A bot's memory: what all your bots know about you, what this one knows, its dreams and its project's notes. */+/** A bot's memory: what all your bots know about you, what this one knows, its dreams, and its harness's own notes when the user kept them on. */export function MemoryCard({ botId }: { botId: string }) {const host = useStore()const memory = useModel(useMemo(() => new MemoryStore(botId, () => host.ready()), [botId, host]))@@ -20,13 +23,17 @@ export function MemoryCard({ botId }: { botId: string }) {const [draft, setDraft] = useState<{ id?: number; text: string } | null>(null)const [confirmClear, setConfirmClear] = useState(false)const [file, setFile] = useState<FileTarget | null>(null)+ const [aboutHarness, setAboutHarness] = useState(false)// Memory changes anywhere move the bot's `memoryRev`: fetch again.- useEffect(() => { void memory.load() }, [memory, bot?.memoryRev, bot?.sharedMemory])+ useEffect(() => { void memory.load() }, [memory, bot?.memoryRev, bot?.sharedMemory, bot?.harnessMemory])const view = memory.view+ // Claude Code's section goes when its memory is turned off (on another device too).+ useEffect(() => { if (section === 'harness' && view && !view.projectMemory) setSection('bot') }, [section, view])+ const harness = host.backendName(bot?.backend ?? 'claude')const sections: { id: Section; label: string }[] = [{ id: 'yours', label: 'About you' }, { id: 'bot', label: 'This bot' }, { id: 'dreams', label: 'Dreams' },- ...(view?.projectMemory ? [{ id: 'project' as const, label: 'Project' }] : []),+ ...(view?.projectMemory ? [{ id: 'harness' as const, label: harness }] : []),]const layer = section === 'yours' ? view?.yours : section === 'bot' ? view?.bot : undefinedconst save = () => {@@ -36,13 +43,22 @@ export function MemoryCard({ botId }: { botId: string }) {return <><div className="memory-panel">- <TabChoice label="Memory" selection={section} options={sections} onChange={setSection} />+ <TabChoice label="Memory" selection={section} options={sections} onChange={(next) => {+ setSection(next)+ // Claude Code writes its notes outside Codync, so nothing moves `memoryRev`: read them again on the way in.+ if (next === 'harness') void memory.load()+ }} /><CardSection>{memory.error && <p role="alert" className="memory-error">{memory.error}</p>}{!view && !memory.error && <p className="memory-muted">Loading memory…</p>}{view && bot && section === 'yours' && <Switch on={bot.sharedMemory} disabled={memory.busy} onChange={(on) => host.setSharedMemory(bot, on)}>Use what your bots share</Switch>}+ {view && bot && section === 'bot' && bot.harnessMemory !== null && <HStack gap={4}>+ <span>{harness}'s own memory</span>+ <IconButton title={`About ${harness}'s own memory`} icon="info.circle" onClick={() => setAboutHarness(true)} />+ <Switch on={bot.harnessMemory} disabled={memory.busy} onChange={(on) => host.setHarnessMemory(bot, on)} label={`${harness}'s own memory`} className="memory-harness-switch" />+ </HStack>}{layer && [<div key="note" className="memory-layer-note"><p className="memory-muted">{section === 'yours'@@ -76,10 +92,12 @@ export function MemoryCard({ botId }: { botId: string }) {{!dream.undone && <IconButton title="Undo this dream" icon="arrow.uturn.backward" disabled={memory.busy} onClick={() => void memory.mutate('undoDream', { id: dream.id })} />}</div>),]}- {view?.projectMemory && section === 'project' && <div className="memory-content">- <p className="memory-muted">The project folder's own notes, kept by Claude Code. Read-only here.</p>+ {view?.projectMemory && section === 'harness' && <div className="memory-content">+ <p className="memory-muted">Claude Code's own notes, read-only here.</p><small className="memory-muted">{view.projectMemory.path}</small>- <pre className="memory-history">{view.projectMemory.text}</pre>+ {view.projectMemory.text+ ? <pre className="memory-history">{view.projectMemory.text}</pre>+ : <div className="memory-empty"><Icon name="brain" size={20} color="var(--tertiary)" /><span>Nothing yet. Claude Code's notes show up here once it saves some.</span></div>}</div>}</CardSection></div>@@ -96,6 +114,9 @@ export function MemoryCard({ botId }: { botId: string }) {<Sheet open={file !== null} onClose={() => setFile(null)} width={640}>{file && <MemoryFileSheet memory={memory} target={file} onClose={() => setFile(null)} />}</Sheet>+ <FormSheet open={aboutHarness} onClose={() => setAboutHarness(false)} height={460}>+ <HarnessMemorySheet harness={harness} readable={bot?.backend === 'claude'} />+ </FormSheet><Dialog open={confirmClear}title={section === 'yours' ? 'Forget everything your bots share about you?' : 'Forget everything this bot remembers?'}actions={[{ title: 'Forget everything', destructive: true, action: () => { void memory.mutate('clearMemory', { shared: section === 'yours' }) } }]}diff --git a/apps/desktop/src/renderer/views/bots/memory.css b/apps/desktop/src/renderer/views/bots/memory.cssindex 8707f8bd..b3277ee9 100644--- a/apps/desktop/src/renderer/views/bots/memory.css+++ b/apps/desktop/src/renderer/views/bots/memory.css@@ -20,3 +20,5 @@.memory-attention { color: var(--attention); }.memory-file-sheet { display: flex; flex-direction: column; height: 100%; background: var(--background); }.memory-file-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; font: var(--text-callout)/1.5 var(--mono); }+.memory-info-icon { padding-top: 2px; }+.switch.memory-harness-switch { flex: 1; justify-content: flex-end; }diff --git a/apps/desktop/src/shared/models.ts b/apps/desktop/src/shared/models.tsindex 5f46458f..567e19e5 100644--- a/apps/desktop/src/shared/models.ts+++ b/apps/desktop/src/shared/models.ts@@ -39,6 +39,8 @@ export interface Bot {computer: boolean/** Uses the memory all the user's bots share ("About you"). */sharedMemory: boolean+ /** Keeps the harness's own memory (Claude Code's…) on beside Codync's; null where it has no switch. */+ harnessMemory: boolean | null/** Moves whenever memory changes, so an open memory screen fetches it again. */memoryRev: numberautoName: boolean@@ -83,6 +85,7 @@ export function normalizeBot(raw: Partial<Bot> & { id: string }): Bot {skills: raw.skills ?? [],computer: raw.computer ?? false,sharedMemory: raw.sharedMemory ?? raw.managedWorkspace ?? false,+ harnessMemory: raw.harnessMemory ?? null,memoryRev: raw.memoryRev ?? 0,autoName: raw.autoName ?? false,createdAt,@@ -458,6 +461,7 @@ export interface BotDraft {skills?: string[]computer?: booleansharedMemory?: boolean+ harnessMemory?: boolean}export function draftOf(bot: Bot): BotDraft {diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Models.swiftindex 0ea9fbf5..e74f236d 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift@@ -41,6 +41,8 @@ public struct Bot: Codable, Identifiable, Hashable, Sendable {public var computer: Bool/// Uses the memory all the user's bots share ("About you"). Nil from an older host.public var sharedMemory: Bool?+ /// Keeps the harness's own memory (Claude Code's…) on beside Codync's. Nil where it has no switch.+ public var harnessMemory: Bool?/// Moves whenever memory changes, so an open memory screen fetches it again.public var memoryRev: Int64?/// Created without a name: the host names it after its first few conversations.@@ -363,6 +365,8 @@ public struct BotDraft: Codable, Hashable, Sendable {public var computer: Bool?/// Only sent when the user changes it: unset, the host picks by the bot's folder.public var sharedMemory: Bool?+ /// Only sent when the user changes it.+ public var harnessMemory: Bool?public init(name: String = "", description: String = "", avatarColor: String = AvatarPalette.colors.randomElement()!.id,avatarShape: String = AvatarPalette.shapes.randomElement()!, backend: String = "claude", cwd: String = "",@@ -431,6 +435,7 @@ extension Bot {skills = try c.decodeIfPresent([String].self, forKey: .skills) ?? []computer = try c.decodeIfPresent(Bool.self, forKey: .computer) ?? falsesharedMemory = try c.decodeIfPresent(Bool.self, forKey: .sharedMemory)+ harnessMemory = try c.decodeIfPresent(Bool.self, forKey: .harnessMemory)memoryRev = try c.decodeIfPresent(Int64.self, forKey: .memoryRev)autoName = try c.decodeIfPresent(Bool.self, forKey: .autoName) ?? falsecreatedAt = try c.decodeIfPresent(Int64.self, forKey: .createdAt) ?? 0diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/HarnessMemorySheet.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/HarnessMemorySheet.swiftnew file mode 100644index 00000000..4600dc7e--- /dev/null+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/HarnessMemorySheet.swift@@ -0,0 +1,43 @@+import CodyncKit+import SwiftUI++/// The memory screen's info button beside the harness's own memory switch: what turning it on means. The same+/// text as the desktop app's; the terminal UI says it short in a confirmation before turning it on.+struct HarnessMemorySheet: View {+ /// The harness's name ("Claude Code").+ let harness: String+ /// Whether Codync can show the harness's notes (Claude Code's are a file on the computer).+ let readable: Bool++ private var details: [(icon: String, title: String, detail: String)] {+ [("brain", "A memory of its own", "\(harness) keeps notes apart from Codync's memory. It's off by default, so this bot has one memory and you see and change all of it here."),+ ("square.on.square", "Remembered twice", "With both on, the bot may save the same thing twice, and the two can disagree after something changes."),+ ("trash", "Forgetting", "Forgetting something here doesn't remove it from \(harness)'s notes. Codync can't change them."),+ ("eye", "Where to see it", readable ? "Its notes show read-only under the \(harness) tab." : "Codync can't show it; look in \(harness) itself.")]+ }++ var body: some View {+ VStack(spacing: 0) {+ ModalHeader("\(harness)'s own memory")+ CardForm {+ CardSection {+ ForEach(details, id: \.title) { item in+ HStack(alignment: .firstTextBaseline, spacing: 12) {+ Image(systemName: item.icon)+ .foregroundStyle(Palette.secondary)+ .frame(width: 22)+ VStack(alignment: .leading, spacing: 2) {+ Text(item.title)+ Text(item.detail)+ .font(.footnote)+ .foregroundStyle(Palette.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ }+ }+ }+ }+ }+ .background(Palette.background)+ }+}diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swiftindex 57db33c6..040d33ac 100644--- a/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift@@ -1,7 +1,8 @@import CodyncKitimport SwiftUI-/// A bot's memory: what all your bots know about you, what this one knows, its dreams and its project's notes.+/// A bot's memory: what all your bots know about you, what this one knows, its dreams, and its harness's own notes+/// when the user kept them on.struct MemoryCard: View {let botId: String@Environment(BotStore.self) private var host@@ -9,26 +10,37 @@ struct MemoryCard: View {@State private var section: Section = .bot@State private var editor: MemoryEditTarget?@State private var confirmClear = false+ @State private var aboutHarness = false- enum Section: Hashable { case yours, bot, dreams, project }+ enum Section: Hashable { case yours, bot, dreams, harness }private var bot: Bot? { host.bots[botId] }var body: some View {VStack(spacing: 10) {- TabChoice(selection: Binding(get: { section }, set: { value in withAnimation(Motion.layout) { section = value } }),- options: sections(memory?.view))+ TabChoice(selection: Binding(get: { section }, set: { value in+ withAnimation(Motion.layout) { section = value }+ // Claude Code writes its notes outside Codync, so nothing moves `memoryRev`: read them again on the way in.+ if value == .harness { Task { await memory?.load() } }+ }), options: sections(memory?.view))CardSection {if let memory { contents(memory) }else { Text("Loading memory…").foregroundStyle(Palette.secondary) }}}// Memory changes anywhere move the bot's `memoryRev`: fetch again.- .task(id: "\(botId)-\(bot?.memoryRev ?? 0)-\(bot?.sharedMemory ?? false)") {+ .task(id: "\(botId)-\(bot?.memoryRev ?? 0)-\(bot?.sharedMemory ?? false)-\(bot?.harnessMemory ?? false)") {let store = memory ?? MemoryStore(botId: botId) { try await host.ready() }memory = storeawait store.load()}+ // Claude Code's section goes when its memory is turned off (on another device too).+ .onChange(of: memory?.view.map { $0.projectMemory == nil } ?? false) { _, gone in+ if gone && section == .harness { section = .bot }+ }+ .codyncSheet(isPresented: $aboutHarness) {+ if let bot { HarnessMemorySheet(harness: host.backendName(bot.backend), readable: bot.backend == "claude") }+ }.codyncSheet(item: $editor) { target inif let memory { MemoryEditorView(memory: memory, target: target) }}@@ -46,7 +58,7 @@ struct MemoryCard: View {switch section {case .yours, .bot: layer(memory, view: view)case .dreams: dreams(memory, view.dreams)- case .project: project(view.projectMemory)+ case .harness: harness(view.projectMemory)}} else if memory.error == nil {Text("Loading memory…").foregroundStyle(Palette.secondary)@@ -55,7 +67,7 @@ struct MemoryCard: View {private func sections(_ view: MemoryView?) -> [(id: Section, label: String)] {[(Section.yours, "About you"), (.bot, "This bot"), (.dreams, "Dreams")]- + (view?.projectMemory != nil ? [(.project, "Project")] : [])+ + (view?.projectMemory != nil ? [(.harness, host.backendName(bot?.backend ?? "claude"))] : [])}@ViewBuilder private func layer(_ memory: MemoryStore, view: MemoryView) -> some View {@@ -65,6 +77,19 @@ struct MemoryCard: View {Toggle("Use what your bots share", isOn: Binding(get: { bot.sharedMemory ?? view.shared }, set: { host.setSharedMemory(bot, $0) })).toggleStyle(.codync)}+ if !shared, let bot, let on = bot.harnessMemory {+ let name = host.backendName(bot.backend)+ HStack(spacing: 4) {+ Text("\(name)'s own memory").lineLimit(1).layoutPriority(1)+ IconButton("About \(name)'s own memory", systemImage: "info.circle") {+ withAnimation(Motion.layout) { aboutHarness = true }+ }+ Toggle(isOn: Binding(get: { on }, set: { host.setHarnessMemory(bot, $0) })) { EmptyView() }+ .toggleStyle(.codync)+ .disabled(memory.busy)+ .accessibilityLabel("\(name)'s own memory")+ }+ }HStack(alignment: .top, spacing: 8) {Text("\(shared ? "Your name, time zone, people and lasting preferences, shared by your bots." : "What this bot learned about you.") \(layer.used) of \(layer.cap) in use.").font(.footnote).foregroundStyle(Palette.secondary)@@ -127,12 +152,13 @@ struct MemoryCard: View {}}- @ViewBuilder private func project(_ project: MemoryView.Project?) -> some View {+ @ViewBuilder private func harness(_ project: MemoryView.Project?) -> some View {if let project {- Text("The project folder's own notes, kept by Claude Code. Read-only here.")+ Text("Claude Code's own notes, read-only here.").font(.footnote).foregroundStyle(Palette.secondary)Text(project.path).font(.caption).foregroundStyle(Palette.tertiary).textSelection(.enabled)- Text(project.text).textSelection(.enabled).frame(maxWidth: .infinity, alignment: .leading)+ if project.text.isEmpty { empty("brain", "Nothing yet. Claude Code's notes show up here once it saves some.") }+ else { Text(project.text).textSelection(.enabled).frame(maxWidth: .infinity, alignment: .leading) }}}diff --git a/apps/ios/Kit/Sources/CodyncUI/Controls.swift b/apps/ios/Kit/Sources/CodyncUI/Controls.swiftindex 8d63bc75..bf78de16 100644--- a/apps/ios/Kit/Sources/CodyncUI/Controls.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Controls.swift@@ -357,6 +357,8 @@ public struct TabChoice<ID: Hashable>: View {.font(.subheadline).foregroundStyle(on ? Palette.text : Palette.secondary).lineLimit(1)+ // Four tabs on a narrow iPhone shrink a little rather than cut a label short.+ .minimumScaleFactor(0.8).padding(.horizontal, 12).padding(.vertical, 6).background {diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swiftindex c165eb50..24b49f7f 100644--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swift@@ -191,6 +191,14 @@ extension BotStore {perform(replay: true) { _ = try await $0.updateBot(d) }}+ /// Whether the bot's harness keeps its own memory on beside Codync's.+ public func setHarnessMemory(_ bot: Bot, _ on: Bool) {+ var d = BotDraft(bot)+ d.harnessMemory = on+ bots[bot.id]?.harnessMemory = on+ perform(replay: true) { _ = try await $0.updateBot(d) }+ }+/// Saves the user's version of a handoff that hasn't been sent. Whether it did.public func editHandoff(_ entry: Entry, text: String) async -> Bool {do {diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.mdindex fc19f8d2..3f176337 100644--- a/apps/ios/WhatsNew.md+++ b/apps/ios/WhatsNew.md@@ -9,72 +9,14 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o### zh-Hant+- 指向專案資料夾的 Claude Code bot 也改用 Codync 的記憶,不再用 Claude Code 自己的記憶;專案相關的事會記在 bot 自己的筆記裡。+- 想讓 Claude Code 也保留自己的記憶,可以在 bot 的「記憶」→「This bot」打開「Claude Code's own memory」(預設關閉)。旁邊的資訊按鈕會說明可能出現的問題,例如同一件事記兩次、兩邊記的內容不一致;打開後,可以在「Claude Code」分頁唯讀查看它的筆記。- 電腦上的 Codync 太舊、還看不了新版記憶時,記憶頁會直接提示你更新電腦上的 Codync。+- 開新 session 時,聊天裡不再多出一行說明。### en-US+- Claude Code bots in project folders now use Codync's memory too, instead of Claude Code's own, and keep what they learn about a project in their own notes.+- To let Claude Code keep its own memory as well, turn on "Claude Code's own memory" under Memory → This bot (off by default). Its info button explains the catch: things remembered twice, and two memories that can disagree. Once it's on, read its notes in the Claude Code tab.- When the Codync on your computer is too old for the new memory, the Memory page now asks you to update it.--## 2.18.1--### zh-Hant--- 記憶不再出現在聊天裡:bot 記下或改了什麼,都到 bot 詳細資料的「記憶」查看、修改或忘記。每個 bot 都會直接記,不再跳卡片詢問。-- 修正在記憶裡儲存或新增筆記時 App 會閃退的問題。-- 「新增記憶」視窗的內容改為從上方開始,不再空一大塊。-- 聊天裡只在開新對話時留一行說明;對話摘要和「保留這段對話」不再顯示。-- 斜線選單拿掉「New session」,要開新對話請用聊天選單裡的「New session」。--### en-US--- Memory stays out of the chat. Whatever a bot remembers or changes, you see, edit or forget it under Memory in the bot's details. Every bot remembers directly, with no cards to approve.-- Fixed the app closing when you saved or created a note in memory.-- The Add memory sheet now starts at the top instead of leaving a gap.-- The chat explains only a fresh conversation, in one line; summaries and kept conversations no longer show.-- New session left the / menu; start one from the chat's menu.--## 2.18.0--### zh-Hant--- 記憶改版:分成「關於你」(你所有的 bot 共用)和這個 bot 自己的記憶,都可以新增、編輯、釘選、封存或忘記,也能決定每個 bot 要不要使用共用的記憶。-- bot 記下一件事時,聊天裡會顯示出來,一鍵就能復原;設定成「先問我」的 bot 會改用卡片詢問,由你決定要不要記。-- bot 會在空檔時整理記憶,只採用你親口打的字,貼上或引用的內容不算;每次整理都列在 Dreams 裡,可以復原。-- 原本的記憶會自動搬過來。-- 對話太長時,bot 會先摘要較早的內容,摘要可以在聊天裡展開;摘要也不夠用時,會改用一張卡片開新對話,你可以先編輯它要帶過去的內容,或選擇保留原本的對話。-- bot 可以把較長的細節寫成筆記(每個主題一份),在記憶裡就能閱讀、編輯、刪除或還原任何一個版本;bot 改了筆記時,聊天裡會顯示改了哪些地方,一鍵就能復原。-- bot 的詳細資料重新整理成一頁:上方是 bot 的頭像和名字,下面分成「詳細資料」、「記憶」、「設定」三個分頁,設定改了就自動儲存;也能從這裡把 bot 分享成範本。-- 訊息框多了麥克風:用說的就能打字,在手機上辨識,按送出前都不會傳出去。--### en-US--- Memory, redone: what all your bots know about you, and what each bot knows on its own. Add, edit, pin, archive or forget any of it, and choose per bot whether it uses the shared memory.-- When a bot remembers something, the chat shows it with a one-tap undo. A bot set to ask first shows a card instead, and you decide.-- Between chats, bots tidy their memory using only words you typed yourself, not pasted or quoted text. Every run is listed under Dreams and can be undone.-- Your existing memory moves over automatically.-- When a chat runs long, the bot summarizes the earlier part, and you can open the summary in the chat. When that's no longer enough, a card offers a fresh conversation: edit what it carries over, or keep the current one.-- Bots can keep longer notes, one topic each. Read, edit, delete or bring back any version from memory, and when a bot changes a note, the chat shows what changed with a one-tap undo.-- A bot's details are one page now: its avatar and name on top, then Details, Memory and Settings tabs. Settings save as you edit, and you can share the bot as a template from here.-- A mic in the message box: say it instead of typing it. It's recognized on the phone, and nothing goes out until you send it.--## 2.17.5--### zh-Hant--- 對話中的連結加上底線,在淺色與深色模式下都更容易辨識與點選。--### en-US--- Links in conversations are now underlined, making them easier to recognize and tap in both light and dark mode.--## 2.17.2--### zh-Hant--- 在輸入框打 / 就會列出所有指令:快速模式、開新工作階段,以及 bot 的 skills,每一項都附上說明。快速模式改從這裡開關,不再放在 + 選單。-- Claude Code 等 agent 需要重新登入時,對話裡會出現登入卡片,點「Sign in」就能直接登入;登入後,剛才沒回覆的訊息會自動重送。--### en-US--- Type / in the composer to see every command with what it does: Fast mode, New session and the bot's skills. Fast mode now switches from here instead of the + menu.-- When Claude Code or another agent needs you to sign in again, a card in the chat lets you sign in right there, and the messages it couldn't answer go out again once you're signed in.+- Starting a new session no longer adds a line to the chat.diff --git a/docs/README.md b/docs/README.mdindex c36d647a..5530f10b 100644--- a/docs/README.md+++ b/docs/README.md@@ -29,6 +29,7 @@ Source review, a passing build, local integration tests and production acceptanc- [Bot-to-bot collaboration](features/bot-collaboration.md)- [Context and memory](features/context-and-memory.md)- [Bot memory and compaction](design/bot-memory.md) (design; storage, gate and dreaming built, compaction to come)+- [Harness memory](plans/harness-memory.md) (the switch that keeps a harness's own memory on; a choice of it instead of Codync's, planned)- [Bot memory research](design/bot-memory-research.md) (files vs. database, embeddings, open-source systems, harness instructions)- [Bot workspaces](features/bot-workspaces.md)- [Voice calls](features/voice-call.md)@@ -52,6 +53,7 @@ docs/│ └── fixtures/├── features/ # Current behavior and implementation entry points├── design/ # UI rules, rendering and system integration+├── plans/ # Work planned or in progress, not released yet└── archive/ # Dated plans/audits; never current instructions```diff --git a/docs/design/bot-memory.md b/docs/design/bot-memory.mdindex 436dccd3..2a275d9a 100644--- a/docs/design/bot-memory.md+++ b/docs/design/bot-memory.md@@ -114,7 +114,7 @@ database, embeddings, and harness instructions is in [bot memory research](bot-m| Retrieval on demand | Vector RAG, our former "context" section | A community evaluation found about 60% of failures were the agent never searching. | Only for archived memory and the transcript. || Raw transcript search | Letta's filesystem benchmark (grep agent ≈74%) | Beats most memory products. Replacing the transcript with summaries or extracted facts lowers accuracy (LongMemEval). | **Adopted**: `search_history` over the host transcript. || Knowledge graph / temporal graph | Zep/Graphiti, A-MEM | Graphiti invalidates old facts instead of deleting them. Benchmark gains are small next to benchmark noise: 6.4% of LoCoMo's answer key is wrong. | Not built. We borrow "supersede, don't delete". |-| File-based memory | CLAUDE.md, Claude Code auto memory, Codex memories, OpenClaw `MEMORY.md` | Transparent and editable, but no transactions and no sync to three clients. | SQLite, made fully visible in the UI. Harness file memory stays for project bots only. |+| File-based memory | CLAUDE.md, Claude Code auto memory, Codex memories, OpenClaw `MEMORY.md` | Transparent and editable, but no transactions and no sync to three clients. | SQLite, made fully visible in the UI. Harness file memory is off unless the user keeps it on for a bot. || Sleep-time consolidation ("dreaming") | ChatGPT dreaming, Claude Code auto-dream, OpenClaw, Letta sleep-time, Grok Build `/dream` | Useful, and every product adds guards. OpenClaw rejects a rewrite that removes more than 0.25 of entries and keeps a pre-image. Hermes removed its `replace` action because it wiped other facts, and #5563 traced lost memory to corruption and the cap. Claude Code auto-dream keeps "no log of what was created, modified, or removed" (#38493). | Adopted, with the guards below. || External memory service | Engram, Mem0 cloud, Supermemory, Honcho | A separate process owns the writes and has its own failure modes. | Dropped. |@@ -468,15 +468,15 @@ answered from its memory as before.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, 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):+**The harness's own memory.** For every bot and 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). Where it+can, the user may keep it on for one bot ([Claude Code's own memory](#claude-codes-own-memory)):| 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 |+| Qwen Code | Auto memory and its own dreaming, on | `.qwen/settings.json` in a bot's own workspace: `memory.enableManagedAutoMemory` and `enableManagedAutoDream` false. Nothing in a project folder, whose files are the user's || 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 |@@ -571,15 +571,20 @@ The user can edit it as a draft before it is sent (Amp's handoff works this way)| Bot | Auto memory | Auto-dream | Why ||---|---|---|---|-| Personal (workspace Codync created) | Off: `autoMemoryEnabled: false` + `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` | Off: `autoDreamEnabled: false` | Only one memory, fully visible in Codync |-| Project (points at a real repo) | On | Off | It is the project's working memory. |+| Every bot (default) | Off: `autoMemoryEnabled: false` + `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` | Off: `autoDreamEnabled: false` | Only one memory, fully visible in Codync |+| Kept on by the user | Claude Code's own setting | Claude Code's own setting | The user's choice, warned first |-For project bots:+Until 2.18 a project bot kept auto memory on as the project's working memory. It was turned off on 2026-10-19 at+the owner's request, because memory is bot-based: its `user`/`feedback` notes overlapped Codync's person memory and+ran outside Codync's rules. A project bot keeps project knowledge in its own notes, and writes `CLAUDE.md` or+`AGENTS.md` only when the user asks.-- The auto-memory directory is shared with the user's own Claude Code sessions in the terminal.-- Its `user`/`feedback` notes overlap Codync's person memory.-- Codync shows the project's `MEMORY.md` read-only, so it isn't unseen.-- The opening states the split: people in Codync memory, the project in harness memory and `CLAUDE.md`.+The user can keep it on per bot, for example to share the auto-memory directory with their own Claude Code+sessions in the terminal. The switch sits on the memory screen with an info button on what it costs: the bot may+remember things twice, the two memories can disagree, and forgetting something in Codync doesn't reach Claude+Code's notes. Codync then shows the folder's `MEMORY.md` read-only, so it isn't unseen. The same switch covers+Copilot, CodeBuddy and (in a bot's own workspace) Qwen Code. Using it instead of Codync's memory is planned:+[harness memory](../plans/harness-memory.md).The adapter passes `claudeCode.options.settings` and `.env` through untouched, so these settings reach the SDK.@@ -611,7 +616,7 @@ build.settings.- **The dream log** with undo.- **Entry actions:** edit, pin, forget, and forget everything.-- **For project bots**, the project `MEMORY.md`, read-only.+- **The harness's own memory switch** in the bot's section, off by default, with an info button; kept on, Claude Code's `MEMORY.md` shows read-only.- **Long-form memory** under each layer's cards: the files with name, description, size and date, an over-capmark, and a detail view to read, edit, and restore any version. The desktop app can open a file in the user'seditor.diff --git a/docs/features/context-and-memory.md b/docs/features/context-and-memory.mdindex 38e52f59..edff6154 100644--- a/docs/features/context-and-memory.md+++ b/docs/features/context-and-memory.md@@ -40,7 +40,8 @@ its own context and compacts it itself.## Memory (`host/src/chat/memory/`, crate `host/crates/memory`)-Memory records the person, not the work; the [design](../design/bot-memory.md) explains why. The rules live in+Memory entries record the person, not the work; what a bot learns about a project goes in its own notes. The+[design](../design/bot-memory.md) explains why. The rules live inthe `codync-mem` crate; `chat/memory` runs them in the host.- **Two layers** in the host database (`memory_entries`): "yours", shared by every bot that uses it, and one per@@ -95,12 +96,19 @@ the `codync-mem` crate; `chat/memory` runs them in the host.line to a long-form file (a new file gets frontmatter with the run's description), and, when a layer isnine-tenths full, move an entry the user didn't write out into one. It never rewrites a file; undoing the runputs the files back unless they changed since.-- **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` shows- read-only on its memory screen.-- **The apps** (iPhone, desktop, terminal) show "About you", "This bot", the dream log and the project's notes,+- **The harness's own memory** is off for every bot and for background jobs (`agent/own_memory.rs`): Claude Code+ (`autoMemoryEnabled` and `autoDreamEnabled` false, `CLAUDE_CODE_DISABLE_AUTO_MEMORY`), Copilot (its memory tools+ excluded), CodeBuddy, and Qwen Code (workspace settings, so only in a bot's own workspace: a project folder's+ files are the user's). Gemini CLI, Kilo Code and Kiro have no switch Codync can use. Project knowledge goes in+ the bot's own notes, and into the project's `CLAUDE.md` or `AGENTS.md` only when the user asks.+- **Keeping it on.** Where Codync has the switch, the memory screen's "This bot" section offers "<harness>'s own+ memory" (bot field `harnessMemory`, `null` without a switch), off by default, with an info button: the bot may+ remember things twice, the two memories can disagree, and forgetting something in Codync doesn't reach it.+ Changing it restarts the agent, which resumes its session where it can, and moves `memoryRev`. Kept on, the+ harness runs its memory as it sets it, and Claude Code's `MEMORY.md` shows read-only in a "Claude Code" section+ (empty until it saves something). An edit to another harness turns the switch off. Using the harness's memory+ instead of Codync's is planned: [harness memory](../plans/harness-memory.md).+- **The apps** (iPhone, desktop, terminal) show "About you", "This bot", the dream log and Claude Code's notes,with add, edit, pin, archive, forget and forget-everything. Under each layer's entries (the terminal: a Notessection) they list its notes with description, size and date, marked past a cap; a note opens to read, edit,delete or bring back any version, and on the desktop, when the host is this computer, in the user's editor. Theydiff --git a/docs/plans/android-app.md b/docs/plans/android-app.mdindex 7b9e8313..4a7ad8a3 100644--- a/docs/plans/android-app.md+++ b/docs/plans/android-app.md@@ -50,9 +50,9 @@ was walked through on an emulator against a real host.- **Bot memory (2.18.0).** The host's memory moved out of Engram ([bot memory](../design/bot-memory.md)). Thememory screen still calls the removed `memoryDetail`, `reviewMemory`, `exportMemory` and `importMemory`(`MemoryModel.kt`, `MemoryCard.kt`, `LiveMemoryTest.kt`), so it shows an error. Missing too: the two layers- (yours and the bot's) with pending and archived entries, memory notes (long-form files with versions), the- `memoryFile` chat lines, compaction summaries and the handoff card. Port them from the iPhone- (`MemoryView.swift`, `MemoryFilesView.swift`, `MemoryFileRow.swift`, `HandoffRows.swift`).+ (yours and the bot's) with archived entries, memory notes (long-form files with versions), the harness's own+ memory switch with its info sheet (2.19.0) and the handoff card. Port them from the iPhone (`MemoryView.swift`,+ `MemoryFilesView.swift`, `HarnessMemorySheet.swift`, `HandoffRows.swift`).### Not verified (needs an account, a key, a device or the real Mac)diff --git a/docs/plans/harness-memory.md b/docs/plans/harness-memory.mdnew file mode 100644index 00000000..ca9d3329--- /dev/null+++ b/docs/plans/harness-memory.md@@ -0,0 +1,58 @@+# Harness memory++Status: the switch that keeps a harness's own memory on **beside** Codync's shipped in 2.19.0 (below). Giving a bot+its harness's memory **instead of** Codync's is planned, not released. The owner (2026-10-19) wants users to choose+freely between the two later; a host-side draft exists only on the owner's machine (branch `feat/harness-memory`,+not pushed), so treat the design below as the spec. Current behavior:+[context and memory](../features/context-and-memory.md).++## Shipped: keep the harness's memory on (2.19.0)++- Every bot runs with its harness's own memory off where Codync can turn it off, project folders included (until+ 2.18 a project bot kept Claude Code's). Project knowledge goes in the bot's own notes, and into `CLAUDE.md` or+ `AGENTS.md` only when the user asks.+- The memory screen's "This bot" section has a switch, "Claude Code's own memory", with an info button: it keeps+ notes apart from Codync's; with both on the bot may remember things twice and the two can disagree; forgetting+ something in Codync doesn't reach it; where to read it. The terminal asks the same on `m` before turning it on.+- Offered where Codync controls it (`own_memory::switchable`): Claude Code, Copilot and CodeBuddy in any folder,+ Qwen Code only in the bot's own workspace (its switch is a file in the folder, and a project folder's files are+ the user's). Gemini CLI, Kilo Code and Kiro have no switch Codync can use.+- Kept on, the harness sets its memory itself (Claude Code's auto-dream too); Claude Code's `MEMORY.md` shows+ read-only in a "Claude Code" section. Changing it restarts the agent, which resumes its session where it can.+- Wire, additive: bots carry `harnessMemory` (bool, `null` without a switch); `updateBot` takes it, and an edit+ to another harness turns it off (`own_memory::settle`).++## Planned: the harness's memory instead of Codync's++Some users will prefer the harness's memory alone, for example to share one memory between a bot and their own+Claude Code sessions in the terminal. The choice adds an off switch for Codync's memory beside today's:++| | Codync's memory (default) | The harness's memory only |+|---|---|---|+| Memory in the instructions and `<memory_update>` notices | Yes | None, including "About you" |+| Memory tools | All | `search_history` only (the chat history is Codync's) |+| Memory folders in `additionalDirectories` | Yes | No |+| Dreaming and the daily time review | Yes | Skipped; its bookmark moves on |+| Memory screen | As today | The switches, a line on what the bot uses, and the harness's notes read-only where Codync can read them |++- **Offered only where the harness has a memory**, or the bot is left with none. A bot moved to a harness without+ one goes back to Codync's.+- **Turning Codync's memory off starts a fresh conversation**: the instructions and tools change, and resuming+ would mix the two memories.+- **Nothing is deleted.** Codync's entries and notes stay; turning it back on brings them back. Dreaming skips the+ time spent without it.+- **What the detail text says the user gives up**: "About you" shared across bots, editing from the iPhone (only+ Claude Code's notes are readable; Copilot's are in the cloud), the "forgotten stays forgotten" rule and the write+ checks (passwords, keys, planted instructions), and memory that follows the bot to another agent.++The draft (`chat::memory::on`, the `history`-only memory server, the skipped dreaming, the restart with a fresh+session) was written as a one-or-the-other `MemoryOwner`; rebase it as a Codync on/off beside `harnessMemory`, then+do the apps (iPhone, desktop, terminal; Android once its memory screen is ported), the docs, a minor release and a+Mac e2e.++## Open questions++- Gemini CLI's memory is one global `~/.gemini/GEMINI.md` shared by every Gemini session, not per bot. Say so in+ its detail text, or leave Gemini out.+- Codex's memories are off unless the user turns them on in their own config. Offer the choice when that config+ has them on.diff --git a/host/src/agent/bot/launch.rs b/host/src/agent/bot/launch.rsindex 4637550d..4d86ff23 100644--- a/host/src/agent/bot/launch.rs+++ b/host/src/agent/bot/launch.rs@@ -21,15 +21,15 @@ pub(super) fn claude_meta(cfg: &BotConfig, system: &str) -> Value {json!({"systemPrompt": {"append": system, "excludeDynamicSections": true}, "claudeCode": claude_options(cfg)})}-/// Claude Code's own memory stays off where Codync's is the bot's only one (a bot in its own workspace); in a-/// project folder it is the project's working memory and stays on. Its auto-dream rewrites memory with no log, so-/// it is off everywhere ([design](../../../../docs/design/bot-memory.md#claude-codes-own-memory)).+/// Claude Code's own memory and its auto-dream stay off, so Codync's is the bot's one memory, unless the user kept+/// them on; then Claude Code sets both itself ([design](../../../../docs/design/bot-memory.md#claude-codes-own-memory)).fn claude_options(cfg: &BotConfig) -> Value {// The bot's replies and memory are Codync's own tools, which follow the bot's permission inside Codync: the// user's Claude Code auto-mode classifier mustn't refuse them (it blocked a reply naming the user's daughter).- let mut settings = json!({"autoDreamEnabled": false, "permissions": {"allow": ["mcp__chat", "mcp__memory"]}});- if crate::agent::workspace::is_managed(cfg) {+ let mut settings = json!({"permissions": {"allow": ["mcp__chat", "mcp__memory"]}});+ if !crate::agent::own_memory::kept(cfg) {settings["autoMemoryEnabled"] = false.into();+ settings["autoDreamEnabled"] = false.into();}json!({"options": {"settings": settings}})}@@ -180,4 +180,26 @@ mod tests {let auto = json!({"models": {"availableModels": [{"modelId": "default"}]}});assert_eq!(split_variant(&auto, "default[]"), ("default", vec![]));}++ #[test]+ fn claude_codes_memory_is_off_in_any_folder_unless_the_user_kept_it() {+ let bot = |kept: Value| -> BotConfig {+ serde_json::from_value(+ json!({"id": "a", "name": "B", "backend": "claude", "cwd": "/work/app", "harnessMemory": kept}),+ )+ .unwrap()+ };+ let settings = |cfg: &BotConfig| claude_options(cfg)["options"]["settings"].clone();+ // `null`: a client sending back a bot that had no switch.+ for off in [json!(false), Value::Null] {+ let off = settings(&bot(off));+ assert_eq!(off["autoMemoryEnabled"], false, "a project folder too");+ assert_eq!(off["autoDreamEnabled"], false);+ }+ let kept = settings(&bot(json!(true)));+ assert!(+ kept.get("autoMemoryEnabled").is_none() && kept.get("autoDreamEnabled").is_none(),+ "Claude Code decides"+ );+ }}diff --git a/host/src/agent/bot/queue.rs b/host/src/agent/bot/queue.rsindex 28eff9ee..74c543d3 100644--- a/host/src/agent/bot/queue.rs+++ b/host/src/agent/bot/queue.rs@@ -1,6 +1,7 @@//! Commands from clients and the queue of turns waiting for the bot.use super::{Actor, CANCEL_GRACE, Cmd, Done, NoticeStyle, Queued, RESUME_PROMPT, RoutineCompletion, inflight_key};+use crate::agent::own_memory;use crate::chat::memory;use crate::hub::BotStatus;use crate::market::requests;@@ -76,12 +77,18 @@ impl Actor {}Cmd::Reconfigure(cfg) => {let cfg = *cfg;+ // The harness reads its own memory's switch when it starts: an agent that can resume its session+ // restarts into it, one that can't starts afresh.+ let memory_changed = own_memory::kept(&cfg) != own_memory::kept(&self.cfg);+ let resumes = self.conn.as_ref().is_none_or(|c| c.sessions.load);let restart = cfg.backend != self.cfg.backend|| cfg.command != self.cfg.command|| cfg.cwd != self.cfg.cwd|| cfg.model != self.cfg.model- || cfg.model_options != self.cfg.model_options;- self.tools_changed |= cfg.connectors != self.cfg.connectors || cfg.computer != self.cfg.computer;+ || cfg.model_options != self.cfg.model_options+ || (memory_changed && !resumes);+ self.tools_changed |=+ cfg.connectors != self.cfg.connectors || cfg.computer != self.cfg.computer || memory_changed;// Live sessions switch before their next turn (see `fast_mode`).let fast_changed = cfg.fast_mode != self.cfg.fast_mode;// Name, description and skill changes reach the agent as a profile update@@ -90,6 +97,10 @@ impl Actor {if fast_changed {self.fast_mode_changed();}+ if memory_changed {+ // Claude Code's notes come or go on the memory screen.+ memory::screen_changed(&self.hub, &self.cfg.id);+ }if restart {self.files.cancel();if let Some(c) = self.conn.take() {@@ -101,7 +112,7 @@ impl Actor {if self.session_id.is_some() {self.forget_session();self.notice(- "The agent, model, command or folder changed — the agent starts with a fresh context.",+ "The agent, model, command, folder or memory changed — the agent starts with a fresh context.",NoticeStyle::Divider,);}diff --git a/host/src/agent/bot/session.rs b/host/src/agent/bot/session.rsindex 4766a94a..88b040c7 100644--- a/host/src/agent/bot/session.rs+++ b/host/src/agent/bot/session.rs@@ -170,10 +170,7 @@ impl Actor {self.hub.set_runtime(&self.id(), |r| r.activity = "Starting agent…".into());// 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.- own_memory::turn_off(&self.cfg.backend, &self.cfg.cwd, &mut env, &mut candidates).await;- }+ own_memory::apply(&self.cfg, &mut env, &mut candidates).await;if self.cfg.backend == "codex" && !env.iter().any(|(k, _)| k == "CODEX_CONFIG") {// Codex's `/compact` takes no instructions: the keep-list is its config's `compact_prompt`.let config = json!({"compact_prompt": codync_mem::compaction::KEEP});diff --git a/host/src/agent/own_memory.rs b/host/src/agent/own_memory.rsindex 4babcb6d..2d16f266 100644--- a/host/src/agent/own_memory.rs+++ b/host/src/agent/own_memory.rs@@ -1,7 +1,9 @@-//! 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`).+//! The harnesses' own memory, turned off wherever Codync can, so a bot has one memory and the user sees all of it:+//! every bot unless the user keeps its harness's memory on, 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 crate::store::BotConfig;use anyhow::{Context, Result};use serde_json::{Value, json};use std::path::Path;@@ -18,41 +20,94 @@ pub fn args(backend: &str) -> &'static str {}}-/// Turns the harness's own memory off for one launch in `workspace`: its environment, its command, and the-/// settings it reads from the folder.+/// Whether Codync can turn the bot's harness's own memory off, and so offers the user a switch for it. Qwen Code+/// reads it from the workspace folder, which Codync writes only in a bot's own workspace: a project folder's files+/// are the user's.+pub fn switchable(cfg: &BotConfig) -> bool {+ match cfg.backend.as_str() {+ "claude" | "copilot" | "codebuddy" => true,+ "qwen" => crate::agent::workspace::is_managed(cfg),+ _ => false,+ }+}++/// Whether the user kept the bot's harness's own memory on beside Codync's.+pub fn kept(cfg: &BotConfig) -> bool {+ cfg.harness_memory && switchable(cfg)+}++/// Fits the switch to an edited bot: it was turned on for one harness, so another harness (unless the edit sets it+/// too), or a bot where there is no switch, has it off.+pub fn settle(cfg: &mut BotConfig, before: &BotConfig, patch: &Value) {+ if cfg.backend != before.backend && patch.get("harnessMemory").is_none() {+ cfg.harness_memory = false;+ }+ cfg.harness_memory &= switchable(cfg);+}++/// Sets the harness's own memory for one launch of the bot's agent: off, unless the user kept it on.+pub async fn apply(cfg: &BotConfig, env: &mut Vec<(String, String)>, commands: &mut [String]) {+ let on = kept(cfg);+ if !on {+ switch_off(&cfg.backend, env, commands);+ }+ if crate::agent::workspace::is_managed(cfg) {+ write_settings(&cfg.backend, &cfg.cwd, on).await;+ }+}++/// Turns the harness's own memory off for one launch in `workspace`, a folder of Codync's own: 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]) {+ switch_off(backend, env, commands);+ write_settings(backend, workspace, false).await;+}++fn switch_off(backend: &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));}+}++async fn write_settings(backend: &str, workspace: &str, on: bool) {let (backend, workspace) = (backend.to_owned(), workspace.to_owned());- match tokio::task::spawn_blocking(move || prepare_workspace(&backend, Path::new(&workspace))).await {+ match tokio::task::spawn_blocking(move || prepare_workspace(&backend, Path::new(&workspace), on)).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"),+ Ok(Err(error)) => tracing::warn!(error = format!("{error:#}"), "couldn't set the harness's own memory"),+ Err(error) => tracing::warn!(%error, "couldn't set the harness's own memory"),}}-/// Settings a harness reads from the workspace folder itself.-fn prepare_workspace(backend: &str, workspace: &Path) -> Result<()> {+/// Settings a harness reads from the workspace folder itself: off, or (kept on) taken out again so the harness's+/// own setting applies.+fn prepare_workspace(backend: &str, workspace: &Path, on: bool) -> Result<()> {match backend {- "qwen" => merge(- &workspace.join(".qwen/settings.json"),- &json!({"memory": {"enableManagedAutoMemory": false, "enableManagedAutoDream": false}}),- ),+ "qwen" => edit(&workspace.join(".qwen/settings.json"), |settings| {+ const KEYS: [&str; 2] = ["enableManagedAutoMemory", "enableManagedAutoDream"];+ if on {+ if let Some(memory) = settings["memory"].as_object_mut() {+ for key in KEYS {+ memory.remove(key);+ }+ }+ } else {+ overlay(settings, &json!({"memory": {KEYS[0]: false, KEYS[1]: false}}));+ }+ }),_ => Ok(()),}}-/// Sets `settings`' keys in the JSON file at `path`, keeping the rest of it.-fn merge(path: &Path, settings: &Value) -> Result<()> {+/// Changes the JSON file at `path` (none yet: `{}`), keeping the rest of it, and writes it only if it changed.+fn edit(path: &Path, change: impl FnOnce(&mut 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);+ change(&mut current);if current == before {return Ok(());}@@ -83,15 +138,56 @@ mod tests {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");+ prepare_workspace("qwen", &dir, false).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"],+ settings()["memory"],json!({"other": 1, "enableManagedAutoMemory": false, "enableManagedAutoDream": false}));- prepare_workspace("codex", &dir.join("none")).unwrap();+ prepare_workspace("qwen", &dir, true).unwrap();+ assert_eq!(settings()["memory"], json!({"other": 1}), "kept on, Qwen Code's own setting applies again");+ assert_eq!(settings()["model"]["name"], "qwen3");+ prepare_workspace("codex", &dir.join("none"), false).unwrap();assert!(!dir.join("none").exists(), "nothing for other harnesses");std::fs::remove_dir_all(dir).unwrap();}++ #[test]+ fn the_switch_is_offered_only_where_codync_can_turn_it_off() {+ let id = "5f0c7a52-0000-4000-8000-000000000004";+ let bot = |backend: &str, cwd: &str| -> BotConfig {+ serde_json::from_value(+ json!({"id": id, "name": "B", "backend": backend, "cwd": cwd, "harnessMemory": true}),+ )+ .unwrap()+ };+ let own = crate::agent::workspace::path(id).to_string_lossy().into_owned();+ assert!(kept(&bot("claude", "/work/app")), "Claude Code's is switched through its settings, in any folder");+ assert!(kept(&bot("qwen", &own)));+ assert!(!switchable(&bot("qwen", "/work/app")), "Qwen Code's lives in the project's own files");+ assert!(!switchable(&bot("codex", &own)) && !switchable(&bot("gemini", &own)));+ let mut off = bot("claude", &own);+ off.harness_memory = false;+ assert!(!kept(&off));+ }++ #[test]+ fn an_edit_to_another_harness_turns_the_switch_off() {+ let bot = |backend: &str| -> BotConfig {+ serde_json::from_value(+ json!({"id": "a", "name": "B", "backend": backend, "cwd": "/work/app", "harnessMemory": true}),+ )+ .unwrap()+ };+ let mut moved = bot("copilot");+ settle(&mut moved, &bot("claude"), &json!({"backend": "copilot"}));+ assert!(!moved.harness_memory, "the user turned it on for Claude Code, not Copilot");+ let mut chosen = bot("copilot");+ settle(&mut chosen, &bot("claude"), &json!({"backend": "copilot", "harnessMemory": true}));+ assert!(chosen.harness_memory);+ let mut none = bot("codex");+ settle(&mut none, &bot("codex"), &json!({"harnessMemory": true}));+ assert!(!none.harness_memory, "no switch to keep on");+ }}diff --git a/host/src/chat/memory/api.rs b/host/src/chat/memory/api.rsindex 617d1379..580fe4dd 100644--- a/host/src/chat/memory/api.rs+++ b/host/src/chat/memory/api.rs@@ -133,10 +133,11 @@ fn view(hub: &Hub, cfg: &BotConfig) -> Result<Value> {}))}-/// Claude Code's own memory of a project bot's folder (`~/.claude/projects/<folder>/memory/MEMORY.md`), shown-/// read-only so nothing a bot remembers is out of the user's sight.+/// Claude Code's own memory of the bot's folder (`~/.claude/projects/<folder>/memory/MEMORY.md`), where the user+/// kept it on, shown read-only so nothing a bot remembers is out of the user's sight. Empty text until Claude Code+/// saves something, so the apps show its section as soon as the switch is on.fn project_memory(cfg: &BotConfig) -> Value {- if crate::agent::workspace::is_managed(cfg) || cfg.backend != "claude" {+ if cfg.backend != "claude" || !crate::agent::own_memory::kept(cfg) {return Value::Null;}let folder: String = cfg.cwd.chars().map(|c| if c.is_ascii_alphanumeric() { c } else { '-' }).collect();@@ -149,7 +150,14 @@ fn project_memory(cfg: &BotConfig) -> Value {std::io::Read::read_to_end(&mut std::io::Read::take(file, PROJECT_MEMORY_BYTES), &mut bytes)?;Ok(String::from_utf8_lossy(&bytes).into_owned())});- read.map_or(Value::Null, |text| json!({"path": path.to_string_lossy(), "text": text}))+ match read {+ Ok(text) => json!({"path": path.to_string_lossy(), "text": text}),+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => json!({"path": path.to_string_lossy(), "text": ""}),+ Err(error) => {+ tracing::warn!(%error, "couldn't read Claude Code's memory");+ Value::Null+ }+ }}fn bot(hub: &Hub, id: &str) -> Result<BotConfig> {diff --git a/host/src/chat/memory/mod.rs b/host/src/chat/memory/mod.rsindex f92639c8..befde49e 100644--- a/host/src/chat/memory/mod.rs+++ b/host/src/chat/memory/mod.rs@@ -70,6 +70,15 @@ pub fn changed(hub: &Hub, bot: Option<&str>) {}}+/// What a bot's memory screen shows changed outside the store (Claude Code's notes came or went): moves+/// `memoryRev` so the apps fetch it again, without telling the bot's sessions.+pub fn screen_changed(hub: &Hub, bot: &str) {+ if let Err(error) = hub.store.memory_write(|_, _, _| Ok(())) {+ tracing::warn!(bot, error = format!("{error:#}"), "couldn't move the memory revision");+ }+ hub.emit_bot(bot);+}+/// The memory revision a bot's layers are at.fn revision_key(bot: &str) -> String {format!("memory.revision.{bot}")diff --git a/host/src/chat/memory/tools.rs b/host/src/chat/memory/tools.rsindex a67f65ea..6027be7b 100644--- a/host/src/chat/memory/tools.rs+++ b/host/src/chat/memory/tools.rs@@ -16,7 +16,8 @@ const SEARCH_TEXT_CHARS: usize = 1_500;pub const INSTRUCTIONS: &str = "Your memory holds what you know about the user, and every session opens with it. \Save lasting facts about the user with remember, and keep entries true with revise_memory and archive_memory \-(the [id] is in your instructions). Project and code knowledge belongs in the project's own files, not here. \+(the [id] is in your instructions). Project and code knowledge worth keeping goes in a long-form note of yours on \+that project, not in entries; don't make the project's CLAUDE.md or AGENTS.md your memory unless the user asks. \Lists, itineraries, histories and other detail longer than a sentence or two go in a long-form note on that topic \(listed in your instructions), not in entries. search_memory finds archived entries and lines of those notes; \search_history finds what was actually said in your past chats. When the user asks you to forget something, \diff --git a/host/src/hub.rs b/host/src/hub.rsindex 118e098c..e3e2b951 100644--- a/host/src/hub.rs+++ b/host/src/hub.rs@@ -248,6 +248,7 @@ impl Hub {}validate(&cfg)?;crate::agent::workspace::prepare(&mut cfg)?;+ crate::agent::own_memory::settle(&mut cfg, &row.config, patch);{let _g = self.emit_lock.locked();self.store.save_bot(&cfg)?;diff --git a/host/src/hub/sync.rs b/host/src/hub/sync.rsindex 21fa8858..5d3ab1cf 100644--- a/host/src/hub/sync.rs+++ b/host/src/hub/sync.rs@@ -11,6 +11,9 @@ impl Hub {let cfg = &row.config;let mut v = serde_json::to_value(cfg).expect("BotConfig is plain data and always serializes");v["managedWorkspace"] = crate::agent::workspace::is_managed(cfg).into();+ // Null where there is no switch to show.+ v["harnessMemory"] =+ (!cfg.is_group() && crate::agent::own_memory::switchable(cfg)).then_some(cfg.harness_memory).into();if !cfg.is_group() {v["sharedMemory"] = crate::chat::memory::shared(cfg).into();v["memoryRev"] = self.store.memory_rev().into();diff --git a/host/src/store/bots.rs b/host/src/store/bots.rsindex e4ec4a43..8c8776e9 100644--- a/host/src/store/bots.rs+++ b/host/src/store/bots.rs@@ -227,6 +227,7 @@ mod tests {skills: vec![],computer: false,shared_memory: None,+ harness_memory: false,auto_name: false,created_at: 0,};diff --git a/host/src/store/model.rs b/host/src/store/model.rsindex 6c2a82c8..d1e885b7 100644--- a/host/src/store/model.rs+++ b/host/src/store/model.rs@@ -110,6 +110,11 @@ pub struct BotConfig {/// project folder (see `chat::memory::shared`).#[serde(default, skip_serializing_if = "Option::is_none")]pub shared_memory: Option<bool>,+ /// Keeps the harness's own memory (Claude Code's auto memory…) on beside Codync's. Off unless the user turns it+ /// on, and only where Codync can turn it off (see `agent::own_memory::kept`). A client sending back the bot as+ /// it got it sends `null` where there is no switch.+ #[serde(default, deserialize_with = "null_as_false")]+ pub harness_memory: bool,/// Created without a name: the host names it from its first conversations (see `naming`)/// until the user renames it.#[serde(default)]@@ -124,6 +129,10 @@ impl BotConfig {}}+fn null_as_false<'de, D: serde::Deserializer<'de>>(value: D) -> Result<bool, D::Error> {+ Ok(Option::<bool>::deserialize(value)?.unwrap_or(false))+}+fn default_color() -> String {"blue".into()}diff --git a/host/src/tui/app/model.rs b/host/src/tui/app/model.rsindex 3799fe4a..9fa7e4c1 100644--- a/host/src/tui/app/model.rs+++ b/host/src/tui/app/model.rs@@ -107,6 +107,8 @@ pub struct Bot {pub hidden: bool,pub notify: bool,pub computer: bool,+ /// The harness's own memory kept on beside Codync's; `None` where it has no switch.+ pub harness_memory: Option<bool>,pub connectors: Vec<String>,pub skills: Vec<String>,pub status: Status,@@ -215,6 +217,7 @@ impl Bot {hidden: v["hidden"].as_bool().unwrap_or(false),notify: v["notify"].as_bool().unwrap_or(true),computer: v["computer"].as_bool().unwrap_or(false),+ harness_memory: v["harnessMemory"].as_bool(),connectors: strs(&v["connectors"]),skills: strs(&v["skills"]),status: match v["status"].as_str() {diff --git a/host/src/tui/app/overlay_keys.rs b/host/src/tui/app/overlay_keys.rsindex 7d75673b..7854130d 100644--- a/host/src/tui/app/overlay_keys.rs+++ b/host/src/tui/app/overlay_keys.rs@@ -84,6 +84,9 @@ impl App {ConfirmAct::ClearMemory(id, shared) => {self.call("clearMemory", json!({"botId": id, "shared": shared}), changed);}+ ConfirmAct::KeepHarnessMemory(id) => {+ self.call("updateBot", json!({"id": id, "harnessMemory": true}), changed);+ }ConfirmAct::DeleteMemoryFile { bot, shared, name, base } => {let body = json!({"botId": bot, "file": name, "shared": shared, "base": base});self.call("deleteMemoryFile", body, changed);diff --git a/host/src/tui/app/ui.rs b/host/src/tui/app/ui.rsindex 2143187e..fa1ffb58 100644--- a/host/src/tui/app/ui.rs+++ b/host/src/tui/app/ui.rs@@ -93,6 +93,8 @@ pub enum ConfirmAct {NewSession(String),/// A bot's own memory, or (`true`) the one all bots share.ClearMemory(String, bool),+ /// Keeps a bot's harness's own memory on beside Codync's.+ KeepHarnessMemory(String),DeleteRoutine(String, String),RotateRoutineKey(String, String),RemoveConnector(String),diff --git a/host/src/tui/manage/memory.rs b/host/src/tui/manage/memory.rsindex 59308245..12234e3a 100644--- a/host/src/tui/manage/memory.rs+++ b/host/src/tui/manage/memory.rs@@ -1,5 +1,5 @@//! A bot's memory, as in the other apps: what it knows about you (shared by your bots) and on its own, its dream-//! log, and its project folder's own memory, driven from the keyboard.+//! log, and Claude Code's own memory where the user kept it on, driven from the keyboard.use super::super::app::{App, Confirm, ConfirmAct, Editor, Overlay};use super::s;@@ -14,12 +14,12 @@ pub enum Section {/// Both layers' long-form files.Notes,Dreams,- /// The project folder's own memory (Claude Code's `MEMORY.md`), read-only.- Project,+ /// Claude Code's own memory (its `MEMORY.md`), read-only, where the user kept it on.+ Harness,}impl Section {- const ALL: [Self; 5] = [Self::Yours, Self::Bot, Self::Notes, Self::Dreams, Self::Project];+ const ALL: [Self; 5] = [Self::Yours, Self::Bot, Self::Notes, Self::Dreams, Self::Harness];pub fn label(self) -> &'static str {match self {@@ -27,7 +27,7 @@ impl Section {Self::Bot => "This bot",Self::Notes => "Notes",Self::Dreams => "Dreams",- Self::Project => "Project memory",+ Self::Harness => "Claude Code",}}@@ -36,7 +36,7 @@ impl Section {match self {Self::Yours => Some(true),Self::Bot => Some(false),- Self::Notes | Self::Dreams | Self::Project => None,+ Self::Notes | Self::Dreams | Self::Harness => None,}}}@@ -106,7 +106,7 @@ impl MemorySheet {}return rows;}- Section::Project => return Vec::new(),+ Section::Harness => return Vec::new(),};list.as_array().cloned().unwrap_or_default()}@@ -116,16 +116,22 @@ impl MemorySheet {let key = |row: &Value| json!([row["id"], row["name"], row["shared"]]);let was = self.rows().get(self.cursor).map(key);self.view = Some(view);+ if !self.sections().contains(&self.section) {+ // Claude Code's memory was just turned off; its scroll position means nothing elsewhere.+ self.section = Section::Bot;+ self.cursor = 0;+ return;+ }let rows = self.rows();self.cursor = was.and_then(|k| rows.iter().position(|row| key(row) == k)).unwrap_or_else(|| self.cursor.min(rows.len().saturating_sub(1)));}- /// Sections worth showing: project memory only when the folder has one.+ /// Sections worth showing: Claude Code's memory only when it is kept on.pub fn sections(&self) -> Vec<Section> {- let project = self.view.as_ref().is_some_and(|v| v["projectMemory"].is_object());- Section::ALL.into_iter().filter(|s| *s != Section::Project || project).collect()+ let harness = self.view.as_ref().is_some_and(|v| v["projectMemory"].is_object());+ Section::ALL.into_iter().filter(|s| *s != Section::Harness || harness).collect()}fn step(&mut self, by: isize) {@@ -155,6 +161,12 @@ impl App {self.overlays.push(Overlay::Memory(m));}+ /// The name of the bot's harness as the agent list gives it ("Claude Code").+ pub fn harness_name(&self, bot: &str) -> String {+ let Some(backend) = self.bots.get(bot).map(|b| b.backend.as_str()) else { return String::new() };+ self.backends.iter().find(|b| b["id"] == backend).map_or_else(|| backend.to_owned(), |b| s(b, "name"))+ }+/// A bot's memory changed somewhere (its `memoryRev` moved): an open sheet fetches it again.pub(in crate::tui) fn memory_moved(&mut self, bot: &Value) {let mut stale = Vec::new();@@ -198,11 +210,11 @@ impl App {let entry = selected.as_ref().filter(|_| m.section.shared().is_some());match k.code {KeyCode::Esc | KeyCode::Char('q' | 'M') => return None,- KeyCode::Tab | KeyCode::Right | KeyCode::Char('l') => m.step(1),- KeyCode::BackTab | KeyCode::Left | KeyCode::Char('h') => m.step(-1),+ KeyCode::Tab | KeyCode::Right | KeyCode::Char('l') => self.step_section(&mut m, 1),+ KeyCode::BackTab | KeyCode::Left | KeyCode::Char('h') => self.step_section(&mut m, -1),KeyCode::Down | KeyCode::Char('j') => {- // Project memory scrolls by line; the other sections move between rows.- let last = if m.section == Section::Project {+ // Claude Code's memory scrolls by line; the other sections move between rows.+ let last = if m.section == Section::Harness {m.view.as_ref().map_or(0, |v| v["projectMemory"]["text"].as_str().unwrap_or_default().lines().count())@@ -273,6 +285,7 @@ impl App {Reply::MemorySaved(m.bot.clone()),);}+ KeyCode::Char('m') if !m.busy => return self.harness_memory_key(m),KeyCode::Char('D') if !rows.is_empty() && !m.busy => {if let Some(shared) = m.section.shared() {let c = Confirm {@@ -302,6 +315,45 @@ impl App {Some(Overlay::Memory(m))}+ /// Moves to another section. Claude Code writes its notes outside Codync, so nothing moves `memoryRev`: its+ /// section reads them again on the way in.+ fn step_section(&mut self, m: &mut MemorySheet, by: isize) {+ m.step(by);+ if m.section == Section::Harness {+ m.busy = true;+ self.sheet("memory", m.body(), Reply::Memory(m.bot.clone()));+ }+ }++ /// `m`: turns the harness's own memory off, or asks first, saying what it costs, before turning it on.+ fn harness_memory_key(&mut self, mut m: MemorySheet) -> Option<Overlay> {+ match self.bots.get(&m.bot).and_then(|b| b.harness_memory) {+ Some(true) => {+ m.busy = true;+ self.sheet(+ "updateBot",+ json!({"id": m.bot, "harnessMemory": false}),+ Reply::MemorySaved(m.bot.clone()),+ );+ }+ Some(false) => {+ // One line each in the confirmation: the info sheets' points, short.+ let c = Confirm {+ title: format!("Turn on {}'s own memory?", self.harness_name(&m.bot)),+ detail: "It may store things twice; the two memories can disagree.".into(),+ note: "Forgetting something in Codync doesn't reach it.".into(),+ button: "Turn on",+ act: ConfirmAct::KeepHarnessMemory(m.bot.clone()),+ };+ self.overlays.push(Overlay::Memory(m));+ self.overlays.push(Overlay::Confirm(c));+ return None;+ }+ None => {}+ }+ Some(Overlay::Memory(m))+ }+/// Keys on a note: read it, edit it, delete it, or bring back a version.fn note_key(&mut self, mut m: MemorySheet, k: KeyEvent) -> Option<Overlay> {let MemoryMode::File { name, shared, detail } = &m.mode else { return Some(Overlay::Memory(m)) };@@ -381,4 +433,20 @@ mod tests {m.show(view([1, 2, 4]));assert_eq!(m.cursor, 0, "gone: the cursor stays in range");}++ #[test]+ fn turning_claude_codes_memory_off_leaves_its_section() {+ let entries = json!({"entries": [{"id": 1}, {"id": 2}]});+ let mut m = MemorySheet {+ bot: "b".into(),+ view: Some(json!({"bot": entries, "projectMemory": {"path": "p", "text": "a\nb\nc\nd"}})),+ section: Section::Harness,+ cursor: 3,+ mode: MemoryMode::Browse,+ error: None,+ busy: false,+ };+ m.show(json!({"bot": entries, "projectMemory": null}));+ assert_eq!((m.section, m.cursor), (Section::Bot, 0), "its scroll position isn't a row");+ }}diff --git a/host/src/tui/sheets/memory_view.rs b/host/src/tui/sheets/memory_view.rsindex 8749c6a2..bf2c2c85 100644--- a/host/src/tui/sheets/memory_view.rs+++ b/host/src/tui/sheets/memory_view.rs@@ -1,4 +1,4 @@-//! A bot's memory: about you, this bot's own, its dreams and its project's memory.+//! A bot's memory: about you, this bot's own, its dreams and Claude Code's own memory where it is kept on.use super::{App, Buffer, Rect, centered, footer, frame_box, input_line, name_of, page_tabs, put, row, s, theme, u, window,@@ -45,9 +45,9 @@ pub fn draw(buf: &mut Buffer, area: Rect, app: &App, memory: &MemorySheet) {dreams(buf, body, memory);"←→ section · ↑↓ move · u undo · r refresh · Esc close"}- Section::Project => {- project(buf, body, memory);- "←→ section · read-only: the project's own notes · Esc close"+ Section::Harness => {+ harness(buf, body, memory);+ "←→ section · read-only: Claude Code's own notes · r refresh · m turns them off · Esc close"}},};@@ -82,12 +82,16 @@ fn tabs(buf: &mut Buffer, inner: Rect, memory: &MemorySheet) {fn entries(buf: &mut Buffer, body: Rect, app: &App, memory: &MemorySheet) {let palette = theme();let Some(view) = &memory.view else { return };- let note = match (memory.section, view["shared"] == true) {- (Section::Yours, true) => "Shared by your bots · s stops this bot using it",- (Section::Yours, false) => "This bot doesn't use what your bots share · s turns it on",- _ => "What this bot learned about you",+ let bot = app.bots.get(&memory.bot);+ let harness = app.harness_name(&memory.bot);+ let note = match (memory.section, view["shared"] == true, bot.and_then(|b| b.harness_memory)) {+ (Section::Yours, true, _) => "Shared by your bots · s stops this bot using it".to_owned(),+ (Section::Yours, false, _) => "This bot doesn't use what your bots share · s turns it on".to_owned(),+ (_, _, Some(true)) => format!("What this bot learned about you · {harness}'s own memory on · m turns it off"),+ (_, _, Some(false)) => format!("What this bot learned about you · {harness}'s own memory off · m turns it on"),+ (_, _, None) => "What this bot learned about you".to_owned(),};- put(buf, body.x, body.y, body.width, note, palette.secondary.patch(palette.panel));+ put(buf, body.x, body.y, body.width, ¬e, palette.secondary.patch(palette.panel));let rows = memory.rows();if rows.is_empty() {let empty = if memory.section == Section::Yours {@@ -240,7 +244,7 @@ fn note(buf: &mut Buffer, body: Rect, app: &App, memory: &MemorySheet, detail: O}}-fn project(buf: &mut Buffer, body: Rect, memory: &MemorySheet) {+fn harness(buf: &mut Buffer, body: Rect, memory: &MemorySheet) {let palette = theme();let Some(project) = memory.view.as_ref().map(|v| &v["projectMemory"]) else { return };put(@@ -251,6 +255,11 @@ fn project(buf: &mut Buffer, body: Rect, memory: &MemorySheet) {&truncate(s(project, "path"), usize::from(body.width)),palette.dim.patch(palette.panel),);+ if s(project, "text").is_empty() {+ let empty = "Nothing yet. Claude Code's notes show up here once it saves some.";+ put(buf, body.x, body.y + 2, body.width, empty, palette.secondary);+ return;+ }let text = Rect::new(body.x, body.y + 2, body.width, body.height.saturating_sub(2));Paragraph::new(s(project, "text")).wrap(Wrap { trim: false })diff --git a/host/tests/fixtures/wire-shape.json b/host/tests/fixtures/wire-shape.jsonindex 797becde..7e8fbe48 100644--- a/host/tests/fixtures/wire-shape.json+++ b/host/tests/fixtures/wire-shape.json@@ -18,6 +18,7 @@"event:bot.bot.fastMode": "bool","event:bot.bot.fastModeIssue": "null","event:bot.bot.fastModeSupport": "string",+ "event:bot.bot.harnessMemory": "null","event:bot.bot.hidden": "bool","event:bot.bot.id": "string","event:bot.bot.kind": "string",