Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(memory-upkeep): add per-bot "Learn facts into About me" switch (#7662)
CI fixtured132b09a649d
diff --git a/docs/memory.md b/docs/memory.mdindex 6b59dda00a..fb6efe49b8 100644--- a/docs/memory.md+++ b/docs/memory.md@@ -214,7 +214,9 @@ off. It keeps the notes in shape without the bot having to decide to:dated line `- 2026-09-25 · learned by Scout · …`. **Added by your bots**under About me lists each one with **Remove**; a removed fact is neveradded again. On a shared installation, another person's messages never add- to the owner's About me.+ to the owner's About me. **Learn facts into About me**, under Memory+ upkeep, turns this off for one bot: its notes are still noticed, filed and+ tidied, and only About me is left alone.- **Nightly tidy-up.** Once a day after 3 am (`memory.tidyHour`), or at thenext check if the computer was asleep, never while the bot is working, andon **Tidy up now**: expired entries move to `memory/archive.md` (fromdiff --git a/electron/cloud-send-parts.mjs b/electron/cloud-send-parts.mjsindex edc1b49243..2b0ed53144 100644--- a/electron/cloud-send-parts.mjs+++ b/electron/cloud-send-parts.mjs@@ -12,7 +12,7 @@ export const BOT_PARTS = Object.freeze({access: ["approvalMode", "alwaysAllow"],voice: ["speakReplies", "replyStyle", "voice", "voiceNotes"],tools: ["browser", "composio", "connectorTools", "connectorScopes", "outbound", "xResearch", "mcpServers", "toolScope"],- memory: ["memoryEnabled", "memoryUpkeep"],+ memory: ["memoryEnabled", "memoryUpkeep", "memoryLearnAboutMe"],team: ["section"],habits: ["notifications", "parkDirectMessages", "helperModel", "cacheKeepWarm", "recordBrowserSteps"],});diff --git a/packages/phone-protocol/src/wire.ts b/packages/phone-protocol/src/wire.tsindex ac5a800392..5737d5e381 100644--- a/packages/phone-protocol/src/wire.ts+++ b/packages/phone-protocol/src/wire.ts@@ -373,11 +373,12 @@ export interface WireBot extends DefaultBotFields, BotAccessFields {fallback?: ModelSelection[];/** Whether this bot gets the app's built-in browser. */browser?: boolean;- /** Record a screenshot and a short note of each browser action, kept with- * the conversation. Off unless true. */+ /** Record a screenshot and a short note of each browser action, kept with the conversation. Off unless true. */recordBrowserSteps?: boolean;/** Capture facts from finished chats into memory and About me, and tidy nightly. On unless false. */memoryUpkeep?: boolean;+ /** When false, capture and the dream add nothing to About me; the bot's own notes are kept and tidied as before. On unless false. */+ memoryLearnAboutMe?: boolean;/** The model memory upkeep uses on this bot's OpenRouter connection; absent uses the connection's automatic pick. */memoryModel?: { instanceId: string; model: string };/** Prompt-cache keep-warm for this bot's Claude threads: true or false overrides the workspace setting; absent follows it. */@@ -398,8 +399,7 @@ export interface WireBot extends DefaultBotFields, BotAccessFields {/** What the bot is doing right now; transient like busy. */activity?: BotActivity;createdAt: number;- /** Who may see this bot on a workspace several people share. Absent means- * everyone. Sent to admins only; a member's copy of a bot never carries it. */+ /** Who may see this bot on a workspace several people share. Absent means everyone. Sent to admins only; a member's copy of a bot never carries it. */visibility?: BotVisibility;}diff --git a/server/app-settings/registry-bots.ts b/server/app-settings/registry-bots.tsindex e49f573b2d..e0366f67eb 100644--- a/server/app-settings/registry-bots.ts+++ b/server/app-settings/registry-bots.ts@@ -45,6 +45,7 @@ const OTHER = {voiceNoteEveryReply: { label: "a voice note with every reply", value: z.boolean().nullable(), shown: onOff, was: (one: BotRecord) => one.voiceNoteEveryReply ?? null },memoryEnabled: { label: "memory", value: z.boolean(), shown: onOff, was: (one: BotRecord) => on(one.memoryEnabled) },memoryUpkeep: { label: "memory upkeep", value: z.boolean(), shown: onOff, was: (one: BotRecord) => on(one.memoryUpkeep) },+ memoryLearnAboutMe: { label: "learning facts into About me", value: z.boolean(), shown: onOff, was: (one: BotRecord) => on(one.memoryLearnAboutMe) },helperModel: { label: "helper model", value: z.boolean(), shown: onOff, was: (one: BotRecord) => on(one.helperModel) },browser: { label: "built-in browser", value: z.boolean(), shown: onOff, was: (one: BotRecord) => on(one.browser) },recordBrowserSteps: { label: "saving browser steps", value: z.boolean(), shown: onOff, was: (one: BotRecord) => set(one.recordBrowserSteps) },diff --git a/server/memory-dream.test.ts b/server/memory-dream.test.tsindex 3f4e29700e..2602627e3e 100644--- a/server/memory-dream.test.ts+++ b/server/memory-dream.test.ts@@ -259,6 +259,7 @@ describe("dreaming in the upkeep loop", () => {sinces = [];aboutMeAdded = [];BOT.memoryUpkeep = true;+ BOT.memoryLearnAboutMe = undefined;clock = new Date(2026, 9, 22, 10, 0);chats = [{ threadId: "a", lines: [{ by: "person", text: "Shorter please" }] },@@ -314,6 +315,24 @@ describe("dreaming in the upkeep loop", () => {expect(upkeep().status(BOT.id)).toMatchObject({ lastDream: { conversations: 2 } });});+ it("keeps what the dream learned in the notes but adds nothing to About me while the bot's switch for that is off", async () => {+ BOT.memoryLearnAboutMe = false;+ ensureWorkspace(BOT.id);+ chats[0]!.lines[0]!.text = "I want drafts under 100 words. I prefer plain words.";+ chats[1]!.lines[0]!.text = "Again, drafts under 100 words. I prefer plain words.";+ const evidence = chats.map((chat) => chat.lines[0]!.text);+ answers.push(JSON.stringify({+ learned: [+ { text: "The person wants drafts under 100 words", from: [1, 2], evidence, confidence: 0.9 },+ { text: "The person prefers plain words", from: [1, 2], evidence, aboutUser: true, confidence: 0.8 },+ ],+ }));+ const report = await upkeep().dream(BOT.id);+ expect(report.aboutMe).toBe(0);+ expect(report.learned.map((item) => item.text)).toEqual(["The person wants drafts under 100 words", "The person prefers plain words"]);+ expect(aboutMeAdded).toEqual([]);+ });+it("refuses invented numbers before notebook or profile writes", async () => {ensureWorkspace(BOT.id);writeMemoryFile(BOT.id, "# Memory\n\n- 2026-09-01 · The person lives in Pune\n");diff --git a/server/memory-upkeep.test.ts b/server/memory-upkeep.test.tsindex c2c8bfab56..f360484223 100644--- a/server/memory-upkeep.test.ts+++ b/server/memory-upkeep.test.ts@@ -295,6 +295,7 @@ describe("the upkeep loop", () => {busy = false;aboutMeAdded = [];BOT.memoryUpkeep = undefined;+ BOT.memoryLearnAboutMe = undefined;clock = new Date(2026, 8, 25, 10, 0);organizeAnswer = '{"moves": []}';organizePrompts = [];@@ -329,6 +330,20 @@ describe("the upkeep loop", () => {expect(aboutMeAdded).toEqual(["The person is vegetarian"]);});+ it("keeps a bot's notes but adds nothing to About me while its switch for that is off", async () => {+ BOT.memoryLearnAboutMe = false;+ ensureWorkspace(BOT.id);+ answers.push(JSON.stringify([+ { text: "The person is vegetarian", kind: "preference", evidence: "I'm vegetarian", aboutUser: true, confidence: 0.9 },+ { text: "The person has exams this weekend", kind: "fact", evidence: "I have exams this weekend", until: "2026-09-27", confidence: 0.9 },+ ]));+ const report = await upkeep().capture({ botId: BOT.id, threadId: "t1", turns: [{ person: "I'm vegetarian and I have exams this weekend", bot: "Good luck!" }] });+ expect(report).toMatchObject({ added: 2, topics: 0, aboutMe: 0 });+ expect(memory()).toContain('- 2026-09-25 · from chat "Plans" (noticed) · The person is vegetarian\n');+ expect(memory()).toContain("The person has exams this weekend · until 2026-09-27");+ expect(aboutMeAdded).toEqual([]);+ });+it("captures onto a full MEMORY.md: every fact lands, the oldest entries move to the archive, both journaled", async () => {const old = Array.from({ length: 200 }, (_, i) => `- 2026-08-01 · old fact ${i}`);writeMemoryFile(BOT.id, `${old.join("\n")}\n`);diff --git a/server/memory-upkeep.ts b/server/memory-upkeep.tsindex b529dacadd..87dcc72afd 100644--- a/server/memory-upkeep.ts+++ b/server/memory-upkeep.ts@@ -44,6 +44,12 @@ export interface UpkeepBot {name: string;memoryUpkeep?: boolean;memoryEnabled?: boolean;+ memoryLearnAboutMe?: boolean;+}++/** Whether what this bot's capture and dream learn about the person is added to About me. */+function learnsAboutMe(bot: Pick<UpkeepBot, "memoryLearnAboutMe">): boolean {+ return bot.memoryLearnAboutMe !== false;}export function upkeepEnabled(bot: Pick<UpkeepBot, "memoryUpkeep" | "memoryEnabled"> | undefined): bot is UpkeepBot {@@ -489,7 +495,7 @@ export function createMemoryUpkeep(deps: UpkeepDeps): MemoryUpkeep {return { added, topics };});const learned = filed.filter((item) => item.aboutMe).map((item) => item.candidate.text);- const aboutMe = learned.length ? deps.addToAboutMe({ botId: id, botName: bot.name }, learned) : 0;+ const aboutMe = learned.length && learnsAboutMe(bot) ? deps.addToAboutMe({ botId: id, botName: bot.name }, learned) : 0;const organized = await organize(id);const report: CaptureReport = { at, added, topics, aboutMe, organized };if (cancelled(started)) return report;@@ -821,7 +827,7 @@ export function createMemoryUpkeep(deps: UpkeepDeps): MemoryUpkeep {return { outdated, kept, stale };});const aboutUser = dreamt.learned.filter((item) => item.aboutUser).map((item) => item.text);- const aboutMe = aboutUser.length ? deps.addToAboutMe({ botId, botName: bot.name }, aboutUser) : 0;+ const aboutMe = aboutUser.length && learnsAboutMe(bot) ? deps.addToAboutMe({ botId, botName: bot.name }, aboutUser) : 0;const done: DreamReport = {at,conversations: conversations.length,diff --git a/server/routes/bot-patch.test.ts b/server/routes/bot-patch.test.tsindex 9e06fba33d..729fca30c4 100644--- a/server/routes/bot-patch.test.ts+++ b/server/routes/bot-patch.test.ts@@ -632,6 +632,19 @@ describe("PATCH /api/bots/:id unread", () => {});});+describe("PATCH /api/bots/:id memoryLearnAboutMe", () => {+ it("saves the switch for learning into About me only as true or false, and leaves what was saved on a bad value", async () => {+ const { store, bot, patch } = fixture();+ expect(store.bot(bot.id)?.memoryLearnAboutMe).toBeUndefined();+ expect((await patch(bot.id, { memoryLearnAboutMe: false })).status).toBe(200);+ expect(store.bot(bot.id)?.memoryLearnAboutMe).toBe(false);+ expect((await patch(bot.id, { memoryLearnAboutMe: "off" })).status).toBe(400);+ expect(store.bot(bot.id)?.memoryLearnAboutMe).toBe(false);+ expect((await patch(bot.id, { memoryLearnAboutMe: true })).status).toBe(200);+ expect(store.bot(bot.id)?.memoryLearnAboutMe).toBe(true);+ });+});+describe("PATCH /api/bots/:id fallback", () => {it("checks a backup's reasoning as a model choice is checked, saves what that check returns, and passes plain rows as before", async () => {const engine = { instanceId: "codex", driverKind: "codex", enabled: true, adapter: { capabilities: {} } } as unknown as ProviderInstance;diff --git a/server/routes/bot-patch.ts b/server/routes/bot-patch.tsindex 9a664d9b27..fa16f38544 100644--- a/server/routes/bot-patch.ts+++ b/server/routes/bot-patch.ts@@ -394,6 +394,10 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {if (typeof body.memoryUpkeep !== "boolean") return json(res, 400, { error: "memoryUpkeep must be true or false" });patch.memoryUpkeep = body.memoryUpkeep;}+ if (body.memoryLearnAboutMe !== undefined) {+ if (typeof body.memoryLearnAboutMe !== "boolean") return json(res, 400, { error: "memoryLearnAboutMe must be true or false" });+ patch.memoryLearnAboutMe = body.memoryLearnAboutMe;+ }let memoryModel: MemoryModelSelection | undefined;if (body.memoryModel !== undefined) {const parsed = z.object({diff --git a/src/components/bot-settings/MemorySection.test.ts b/src/components/bot-settings/MemorySection.test.tsindex 24a885b603..624ded55e1 100644--- a/src/components/bot-settings/MemorySection.test.ts+++ b/src/components/bot-settings/MemorySection.test.ts@@ -173,6 +173,18 @@ describe("MemoryUpkeepCard", () => {expect(off).not.toContain("Learn from group chats");});+ it("shows Learn facts into About me beside upkeep, only while upkeep is on", () => {+ const aboutMe = { enabled: true, onToggle: noop };+ const on = render(createElement(MemoryUpkeepCard, { enabled: true, status: null, tidying: false, onToggle: noop, onTidy: noop, aboutMe }));+ expect(on).toContain("Learn facts into About me");+ expect(on).toContain("this bot still keeps its own notes and tidies them");+ expect(on).toContain('aria-label="Learn facts into About me"');+ const unchecked = render(createElement(MemoryUpkeepCard, { enabled: true, status: null, tidying: false, onToggle: noop, onTidy: noop, aboutMe: { ...aboutMe, enabled: false } }));+ expect(unchecked).not.toContain('aria-checked="true" aria-label="Learn facts into About me"');+ const off = render(createElement(MemoryUpkeepCard, { enabled: false, status: null, tidying: false, onToggle: noop, onTidy: noop, aboutMe }));+ expect(off).not.toContain("Learn facts into About me");+ });+it("says under Learn from group chats when this bot's engine can't make the background call, and only then", () => {const rooms = { enabled: true, saving: false, error: "", onToggle: noop };const line = "can't make the background model call this needs, so it won't learn anything from group chats";diff --git a/src/components/bot-settings/MemorySection.tsx b/src/components/bot-settings/MemorySection.tsxindex 1bdaadab92..ed8e0a782e 100644--- a/src/components/bot-settings/MemorySection.tsx+++ b/src/components/bot-settings/MemorySection.tsx@@ -356,6 +356,7 @@ export function MemorySection({ bot, active = true, onToggle }: { bot: Bot; actionToggle={toggleUpkeep}onTidy={() => void tidyNow()}rooms={{ enabled: learnFromRooms, saving: roomsSaving, error: roomsError, onToggle: () => void toggleRooms() }}+ aboutMe={{ enabled: bot.memoryLearnAboutMe !== false, onToggle: () => dispatch({ type: "updateBot", botId: bot.id, patch: { memoryLearnAboutMe: bot.memoryLearnAboutMe === false } }) }}model={active && bot.memoryUpkeep !== false? <MemoryModelSetting key={bot.id} bot={bot} upkeep={upkeep} className="mt-3 border-t border-hairline/40" /> : undefined}/>}@@ -487,6 +488,7 @@ export function MemoryUpkeepCard({onToggle,onTidy,rooms,+ aboutMe,model,}: {enabled: boolean;@@ -495,6 +497,7 @@ export function MemoryUpkeepCard({onToggle: () => void;onTidy: () => void;rooms?: { enabled: boolean; saving: boolean; error: string; onToggle: () => void };+ aboutMe?: { enabled: boolean; onToggle: () => void };model?: ReactNode;}) {return (@@ -526,6 +529,15 @@ export function MemoryUpkeepCard({/></div>)}+ {enabled && aboutMe && (+ <div className="mt-3 flex items-start justify-between gap-3 border-t border-hairline/40 pt-3">+ <div className="min-w-0">+ <div className="text-[13px] font-medium text-ink">{t("memory.learnAboutMe.title")}</div>+ <p className="mt-0.5 text-[13px] leading-relaxed text-ink-secondary">{t("memory.learnAboutMe.subtitle")}</p>+ </div>+ <Switch checked={aboutMe.enabled} aria-label={t("memory.learnAboutMe.title")} onClick={aboutMe.onToggle} />+ </div>+ )}{enabled && status && !status.modelSteps && (<p className="mt-2 text-[13px] text-ink-secondary">{t("memory.upkeep.noModelSteps")}</p>)}diff --git a/src/locales/en.json b/src/locales/en.jsonindex cf38252006..97e1dc901d 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -1742,6 +1742,8 @@"memory.learnFromRooms.subtitle": "For every bot: also notice facts from the group chats a bot is in. Your own words count as yours; other bots' only when they're checked results or decisions you agreed to. A group chat fewer people can see than the bot never feeds its memory. Off by default.","memory.learnFromRooms.error": "Could not save the group chat setting.","memory.learnFromRooms.noModelSteps": "This bot's AI can't make the background model call this needs, so it won't learn anything from group chats.",+ "memory.learnAboutMe.title": "Learn facts into About me",+ "memory.learnAboutMe.subtitle": "Add lasting facts this bot notices about you to About me, where every bot reads them. Off, this bot still keeps its own notes and tidies them.","memory.upkeep.noModelSteps": "This bot's AI can't make the quick background model call upkeep uses, so it only archives expired notes and merges exact duplicates.","memory.lendingReviewStale": "The memory changed again after you looked, so it can't use your computer yet. Check the notes below, then mark them reviewed.","cloudSignIn.title": "Connect an AI to the Cloud",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 0dd3959498..2000ffcd0b 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -1548,6 +1548,8 @@"memory.learnFromRooms.subtitle": "Vale para todos os bots: eles também identificam fatos nos chats em grupo de que participam. Suas palavras são atribuídas a você; as dos outros bots só contam se forem resultados verificados ou decisões com que você concordou. Se menos pessoas têm acesso ao chat em grupo do que ao bot, esse chat nunca alimenta a memória dele. Desligado por padrão.","memory.learnFromRooms.error": "Não foi possível salvar a configuração de chats em grupo.","memory.learnFromRooms.noModelSteps": "Para aprender com chats em grupo, o bot precisa chamar o modelo em segundo plano. A IA deste bot não consegue fazer isso, então ele não vai aprender nada com esses chats.",+ "memory.learnAboutMe.title": "Aprender fatos para o Sobre mim",+ "memory.learnAboutMe.subtitle": "Adiciona ao Sobre mim fatos duradouros que este bot percebe sobre você, onde todos os bots leem. Desligado, este bot continua mantendo as próprias anotações e organizando-as.","memory.upkeep.noModelSteps": "A IA deste bot não consegue fazer a chamada rápida ao modelo em segundo plano necessária para a manutenção. Por isso, a manutenção só arquiva notas expiradas e junta duplicatas exatas.","memory.lendingReviewStale": "A memória mudou novamente depois que você conferiu, então o bot ainda não pode usar seu computador. Confira as notas abaixo e marque-as como revisadas.","cloudSignIn.title": "Conecte uma IA ao Cloud",diff --git a/src/state/bot-patch-queue.ts b/src/state/bot-patch-queue.tsindex 4c2b366d20..31147c01b9 100644--- a/src/state/bot-patch-queue.ts+++ b/src/state/bot-patch-queue.ts@@ -46,6 +46,7 @@ export type BotUpdatePatch = Partial<| "browser"| "browserProfile"| "memoryUpkeep"+ | "memoryLearnAboutMe"| "cacheKeepWarm"| "checkWork"| "mcpServers"diff --git a/src/state/store.tsx b/src/state/store.tsxindex 7d97bc8cdb..3d69f58f5b 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -328,7 +328,7 @@ export interface Bot extends DefaultBotFields, Pick<WireBot, "mascotFaceColor" |fallback?: ModelSelection[];browser?: boolean;recordBrowserSteps?: boolean;- memoryUpkeep?: boolean;+ memoryUpkeep?: boolean; memoryLearnAboutMe?: boolean;cacheKeepWarm?: boolean | null;helperModel?: boolean; checkWork?: import("../../shared/check-work").CheckWork | null;mcpServers?: string[] | null;