Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Memory service: Memories across machines, and Memories bundled with Harness (#1136)

Dee065f7b075bf4
diff --git a/cli/AGENTS.md b/cli/AGENTS.md
index 7a2d65e13..0073a7dd0 100644
--- a/cli/AGENTS.md
+++ b/cli/AGENTS.md
@@ -33,7 +33,7 @@ they show as `harnessd`, `harnessd-core` and `harnessd-<process>` (`src/harnessd
| models | grid, local models, the Model Manager | on demand: once grid is in use here (a managed grid, saved grid pictures, local models), or on a models request |
| updater | checks, downloads and stages a new build (`src/services/updaterProcess.ts`) | by the master, for the installed copy only |
| devices | the dials, the window bridges, the fleet, the voice router, the Wi-Fi device | on demand: once there is a device |
-| orchestrator, teams (with Tab collaboration), sharing, commandBar | the experiments | on demand: on a request, or saved state at start |
+| orchestrator, teams (with Tab collaboration), sharing, commandBar, memory | the experiments | on demand: on a request, or saved state at start |
`HARNESSD_SERVICES` names a subset to run in their own processes, by service or by process.
`HARNESSD_SERVICES=none` runs every service in the core's process, for debugging or a quick way back. How
diff --git a/cli/build-bundle.mjs b/cli/build-bundle.mjs
index f196a85da..b815e6bfd 100644
--- a/cli/build-bundle.mjs
+++ b/cli/build-bundle.mjs
@@ -13,7 +13,7 @@
import * as esbuild from 'esbuild'
import { appendFileSync, readFileSync, copyFileSync, rmSync, writeFileSync } from 'fs'
import { readDshRegistry } from './scripts/lib/dshRegistry.mjs'
-import { readBuiltinBundle, readHarnessMonitorBundle, readModelManagerBundle } from './scripts/lib/modelManagerBundle.mjs'
+import { readBuiltinBundle, readHarnessMonitorBundle, readMemoriesBundle, readModelManagerBundle } from './scripts/lib/modelManagerBundle.mjs'
import { readProcessImageBundle } from './scripts/lib/processImageBundle.mjs'
import { leanBlock } from './scripts/lib/leanBlock.mjs'
import { asciiOnly } from './scripts/lib/asciiOnly.mjs'
@@ -22,6 +22,7 @@ import { basename } from 'node:path'
const modelManagerBundle = JSON.stringify(readModelManagerBundle(fileURLToPath(new URL('../store/agents/autonomous-grid', import.meta.url))))
const devicesBundle = JSON.stringify(readBuiltinBundle(fileURLToPath(new URL('../store/agents/devices', import.meta.url)), ['harness.json', 'AGENTS.md', 'LICENSE', 'template']))
const harnessMonitorBundle = JSON.stringify(readHarnessMonitorBundle(fileURLToPath(new URL('../store/agents/harness-monitor', import.meta.url))))
+const memoriesBundle = JSON.stringify(readMemoriesBundle(fileURLToPath(new URL('../store/agents/memories', import.meta.url))))
const version =
process.env.ADAPTER_VERSION ||
@@ -52,6 +53,7 @@ const options = {
__MODEL_MANAGER_BUNDLE__: JSON.stringify(modelManagerBundle),
__DEVICES_BUNDLE__: JSON.stringify(devicesBundle),
__HARNESS_MONITOR_BUNDLE__: JSON.stringify(harnessMonitorBundle),
+ __MEMORIES_BUNDLE__: JSON.stringify(memoriesBundle),
__DARWIN_PROCESS_IMAGES__: processImages ? JSON.stringify(processImages) : 'undefined',
},
// The copyright line is MIT's one condition — it has to travel with the copy the user actually
diff --git a/cli/build.mjs b/cli/build.mjs
index cb7ab29d1..41582b528 100644
--- a/cli/build.mjs
+++ b/cli/build.mjs
@@ -2,11 +2,12 @@ import * as esbuild from 'esbuild'
import { readdirSync, statSync, readFileSync } from 'fs'
import { join } from 'path'
import { readDshRegistry } from './scripts/lib/dshRegistry.mjs'
-import { readBuiltinBundle, readHarnessMonitorBundle, readModelManagerBundle } from './scripts/lib/modelManagerBundle.mjs'
+import { readBuiltinBundle, readHarnessMonitorBundle, readMemoriesBundle, readModelManagerBundle } from './scripts/lib/modelManagerBundle.mjs'
import { fileURLToPath } from 'node:url'
const modelManagerBundle = JSON.stringify(readModelManagerBundle(fileURLToPath(new URL('../store/agents/autonomous-grid', import.meta.url))))
const devicesBundle = JSON.stringify(readBuiltinBundle(fileURLToPath(new URL('../store/agents/devices', import.meta.url)), ['harness.json', 'AGENTS.md', 'LICENSE', 'template']))
const harnessMonitorBundle = JSON.stringify(readHarnessMonitorBundle(fileURLToPath(new URL('../store/agents/harness-monitor', import.meta.url))))
+const memoriesBundle = JSON.stringify(readMemoriesBundle(fileURLToPath(new URL('../store/agents/memories', import.meta.url))))
// Bake the version in so `node dist/cli.js version` works in the dev/per-file build too (parity with
// build-bundle.mjs). The bundle build overrides this from ADAPTER_VERSION at release time.
@@ -47,6 +48,7 @@ try {
__MODEL_MANAGER_BUNDLE__: JSON.stringify(modelManagerBundle),
__DEVICES_BUNDLE__: JSON.stringify(devicesBundle),
__HARNESS_MONITOR_BUNDLE__: JSON.stringify(harnessMonitorBundle),
+ __MEMORIES_BUNDLE__: JSON.stringify(memoriesBundle),
},
logLevel: 'info',
})
diff --git a/cli/e2e/memory.e2e.ts b/cli/e2e/memory.e2e.ts
new file mode 100644
index 000000000..5e11560f8
--- /dev/null
+++ b/cli/e2e/memory.e2e.ts
@@ -0,0 +1,92 @@
+/**
+ * Memory, an experiment in a process of its own (services/memory.ts), on the real daemon: what another
+ * machine's Memories pane asks of this one, answered by the real Memories package (store/agents/memories,
+ * linked into this daemon's own Store folder) reading a made-up home.
+ *
+ * What it must do: no process until the first request; `memory_snapshot` answers what the agents in this
+ * home remember; `memory_about_put` writes another machine's About You with its build number and never an
+ * older one over a newer one; `memory_deliver` applies the person's on/off choice with its own time and
+ * never an older choice over a newer one — the Claude Code hook in this home appearing and going. Killed,
+ * it costs its own request alone, the core and the next request go on.
+ */
+import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { afterEach, describe, expect, it, onTestFailed } from 'vitest'
+import { LocalClient } from './harness/client.js'
+import { IsolatedDaemon, until } from './harness/daemon.js'
+
+const HOST = 'memory'
+const PACKAGE = fileURLToPath(new URL('../../store/agents/memories', import.meta.url))
+
+const started = (d: IsolatedDaemon): number[] =>
+ [...d.log().matchAll(new RegExp(`\\[harnessd\\] service ${HOST} started \\(pid (\\d+)\\)`, 'g'))].map((match) => Number(match[1]))
+
+/** The hook delivery puts in Claude Code's settings in this daemon's home, or none. */
+const ourHook = (home: string): boolean => {
+ try {
+ const settings = JSON.parse(readFileSync(join(home, '.claude', 'settings.json'), 'utf8')) as { hooks?: Record<string, Array<{ hooks: Array<{ command: string }> }>> }
+ return (settings.hooks?.SessionStart ?? []).some((block) => block.hooks.some((hook) => hook.command.includes('harness-memories-about-you')))
+ } catch { return false }
+}
+
+describe('memory, an experiment in its own process', () => {
+ let daemon: IsolatedDaemon | undefined
+ afterEach(async () => { await daemon?.close(); daemon = undefined })
+
+ it('answers another machine\'s pane through the package, and never moves this machine backwards', async () => {
+ // Every folder the package reads or writes, under this test's own root: a developer's shell may point
+ // any of these at their real agent homes, and delivery writes About You into them (cli/AGENTS.md rule 6).
+ const own = mkdtempSync(join(tmpdir(), 'memory-e2e-'))
+ const homes = Object.fromEntries(['XDG_CONFIG_HOME', 'GEMINI_HOME', 'PI_HOME', 'GROK_HOME', 'HERMES_HOME', 'OPENCLAW_HOME', 'MEMORIES_HOME']
+ .map((name) => [name, join(own, name.toLowerCase())]))
+ const d = await IsolatedDaemon.create({ env: { HARNESSD_SERVICE_INITIAL_BACKOFF_MS: '200', HARNESSD_SERVICE_MAX_BACKOFF_MS: '1000', ...homes } })
+ daemon = d
+ onTestFailed(() => { console.log(`---- daemon log\n${d.log().split('\n').slice(-150).join('\n')}`) })
+ const home = d.env.HOME!
+ // Memories, linked into this daemon's Store folder as a developer's `harness dsh install --link` would.
+ mkdirSync(d.env.DSH_DIR!, { recursive: true })
+ writeFileSync(join(d.env.DSH_DIR!, 'installed.json'), JSON.stringify([{ id: 'autonomous/memories', dir: PACKAGE, source: PACKAGE, ref: null, commit: null, linked: true, installedAt: 1 }]))
+ // What Claude Code remembers in this home: one note about the person.
+ const notes = join(home, '.claude', 'projects', '-work-app', 'memory')
+ mkdirSync(notes, { recursive: true })
+ writeFileSync(join(notes, 'short.md'), '---\nname: short\ndescription: Wants short answers\ntype: feedback\n---\nKeep it short.\n')
+ await d.start()
+ const client = await LocalClient.connect(d)
+ await until('the services to connect', () => d.log().includes('[services] search connected') || null, 30_000, 200)
+ expect(started(d), 'memory no one asked for').toEqual([])
+
+ const first = await client.request('memory_snapshot', {}, 60_000) as { snapshot: { memories: Array<{ title: string; kind: string }>; about: unknown } }
+ expect(first.snapshot.memories.map((row) => [row.title, row.kind])).toEqual([['Short', 'you']])
+ expect(first.snapshot.about).toBeNull()
+ expect(started(d)).toHaveLength(1)
+
+ // Another machine's About You, build 5; then an older build 3, which must not replace it.
+ expect(await client.request('memory_about_put', { text: '## How you work\n- From the other machine.\n', gen: 5 }, 60_000)).toMatchObject({ ok: true })
+ expect(await client.request('memory_about_put', { text: '## How you work\n- An older build.\n', gen: 3 }, 60_000)).toMatchObject({ ok: true })
+ const about = (await client.request('memory_snapshot', {}, 60_000) as { snapshot: { about: { text: string; gen: number } } }).snapshot.about
+ expect(about.gen).toBe(5)
+ expect(about.text).toMatch(/From the other machine/)
+ expect(await client.request('memory_about_put', { text: '', gen: 6 })).toMatchObject({ error: 'INVALID_MEMORY' })
+
+ // The person's choice from another machine: on at 10, an older off at 9 ignored, off at 11 applied.
+ expect(await client.request('memory_deliver', { on: true, choiceAt: 10 }, 60_000)).toMatchObject({ ok: true })
+ expect(ourHook(home)).toBe(true)
+ expect(await client.request('memory_deliver', { on: false, choiceAt: 9 }, 60_000)).toMatchObject({ ok: true, delivery: { ignored: true } })
+ expect(ourHook(home)).toBe(true)
+ expect(await client.request('memory_deliver', { on: false, choiceAt: 11 }, 60_000)).toMatchObject({ ok: true })
+ expect(ourHook(home)).toBe(false)
+
+ // Killed between requests: the next one starts it again; the core never restarts.
+ const [pid] = started(d)
+ process.kill(pid, 'SIGKILL')
+ await until('memory to start again', async () => {
+ const answer = await client.request('memory_snapshot', {}, 60_000).catch(() => null) as { snapshot?: unknown } | null
+ return answer?.snapshot ? answer : null
+ }, 60_000, 500)
+ expect(started(d).length).toBeGreaterThanOrEqual(2)
+ expect(d.coresStarted()).toBe(1)
+ client.close()
+ }, 180_000)
+})
diff --git a/cli/scripts/lib/modelManagerBundle.mjs b/cli/scripts/lib/modelManagerBundle.mjs
index 0c0e7b209..f960e4541 100644
--- a/cli/scripts/lib/modelManagerBundle.mjs
+++ b/cli/scripts/lib/modelManagerBundle.mjs
@@ -11,6 +11,11 @@ export function readHarnessMonitorBundle(root) {
return readBuiltinBundle(root, ['harness.json', 'AGENTS.md', 'LICENSE', 'package.json', 'viewer.sh', 'viewer.mjs', 'viewer', 'lib', 'toolchain', 'template', 'skills'])
}
+/** Memories: everything the harness and its `mem` command run on; its tests and Store page stay behind. */
+export function readMemoriesBundle(root) {
+ return readBuiltinBundle(root, ['harness.json', 'AGENTS.md', 'LICENSE', 'README.md', 'package.json', 'viewer.sh', 'viewer.mjs', 'viewer', 'lib', 'toolchain', 'template', 'skills'])
+}
+
export function readBuiltinBundle(root, paths) {
const files = {}
const visit = relative => {
diff --git a/cli/scripts/test-core-harness-upgrade.mjs b/cli/scripts/test-core-harness-upgrade.mjs
index dbb462c00..875efd32d 100644
--- a/cli/scripts/test-core-harness-upgrade.mjs
+++ b/cli/scripts/test-core-harness-upgrade.mjs
@@ -5,7 +5,7 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync }
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
-import { readBuiltinBundle, readHarnessMonitorBundle, readModelManagerBundle } from './lib/modelManagerBundle.mjs'
+import { readBuiltinBundle, readHarnessMonitorBundle, readMemoriesBundle, readModelManagerBundle } from './lib/modelManagerBundle.mjs'
const cli = resolve(process.argv[2] || fileURLToPath(new URL('../dist/cli.js', import.meta.url)))
const root = mkdtempSync(join(tmpdir(), 'core-harness-upgrade-'))
@@ -15,6 +15,7 @@ const packages = [
['autonomous-grid', 'model-manager', readModelManagerBundle],
['devices', 'devices', dir => readBuiltinBundle(dir, ['harness.json', 'AGENTS.md', 'LICENSE', 'template'])],
['harness-monitor', 'harness-monitor', readHarnessMonitorBundle],
+ ['memories', 'memories', readMemoriesBundle],
]
const env = { ...process.env, DSH_DIR: dshDir, ADAPTER_DATA_DIR: join(root, 'data'),
ADAPTER_COMPUTER_ID: 'core-upgrade-test', ADAPTER_COMPUTER_ID_FILE: join(root, 'computer-id') }
diff --git a/cli/src/core/api.ts b/cli/src/core/api.ts
index 56e1e0cdf..660b2f0cb 100644
--- a/cli/src/core/api.ts
+++ b/cli/src/core/api.ts
@@ -464,6 +464,9 @@ export const MONITOR_REQUESTS = ['machine_resources'] as const
/** The command bar (services/commandBar.ts), an experiment: the socket's `command_bar`, and the hook server's
* `/api/command-bar/*`, which it asks as `command_bar_http`. */
export const COMMAND_BAR_REQUESTS = ['command_bar', 'command_bar_http'] as const
+/** Memories (services/memory.ts), an experiment: what this machine's agents remember, for the owner's Memories
+ * panes on their other machines, and the About You profile and its on/off choice from them. */
+export const MEMORY_REQUESTS = ['memory_snapshot', 'memory_about_put', 'memory_deliver'] as const
/** The project and folder readers (services/projects.ts). */
export const PROJECTS_REQUESTS = ['git_pull_request', 'git_project_info', 'scm_project_info', 'project_preview', 'fs_list_dir', 'agent_read_file'] as const
/** A window's name for its repo and its work, by a small model in the background (services/windowNames.ts). */
@@ -553,6 +556,8 @@ export const EXPERIMENTS: Readonly<Record<string, { requests: readonly string[];
sharing: { requests: SHARE_REQUESTS, state: ['harness-shares.json', 'harness-collaboration.json'] },
// Request-only: it keeps nothing, so it is on from its first request until the daemon stops.
commandBar: { requests: COMMAND_BAR_REQUESTS, state: [] },
+ // Request-only too: another machine's Memories pane asks, and the package's own files are its state.
+ memory: { requests: MEMORY_REQUESTS, state: [] },
}
/** The core's calls into Share: an observer's frame as the relay handed it over, the relay gone (every observer
diff --git a/cli/src/core/main.ts b/cli/src/core/main.ts
index 993572d2d..983c4c0ca 100644
--- a/cli/src/core/main.ts
+++ b/cli/src/core/main.ts
@@ -149,7 +149,7 @@ import { createEngineHooks, installEngineHooks, installOpencodePluginBeforeSpawn
import { createCursorDiscovery } from './engines/cursorDiscovery.js'
import { createCursorTaskHooks, loadPendingCursorTasks } from './engines/cursorTasks.js'
import { databaseHistory, hermesDb } from './transcripts/databaseHistory.js'
-import { COMMAND_BAR_REQUESTS, CONNECTORS_REQUESTS, createCoreApi, DEVICES_FALLBACKS, DEVICES_REQUESTS, emptyPorts, HANDOFF_REQUESTS, EXPERIMENTS, LONG_ANSWERS, MODELS_FALLBACKS, MODELS_OFF, MODELS_REQUESTS, MONITOR_FALLBACKS, MONITOR_OFF, MONITOR_REQUESTS, ORCHESTRATOR_FALLBACKS, ORCHESTRATOR_REQUESTS, SHARE_REQUESTS, SHARING_FALLBACKS, PROJECTS_REQUESTS, SEARCH_FALLBACKS, SEARCH_REQUESTS, STORE_FALLBACKS, STORE_OFF, STORE_REQUESTS, TEAMS_FALLBACKS, TEAMS_REQUESTS, USAGE_FALLBACKS, USAGE_REQUESTS, VIEWERS_FALLBACKS, WIFI_FALLBACKS, WINDOW_NAMES_REQUESTS, WORKSPACES_FALLBACKS, type GatewayAccount, type GatewayOps, type GatewayStatus, type RouteAnswer, type TeamsPort, type WindowFocus } from './api.js'
+import { COMMAND_BAR_REQUESTS, CONNECTORS_REQUESTS, MEMORY_REQUESTS, createCoreApi, DEVICES_FALLBACKS, DEVICES_REQUESTS, emptyPorts, HANDOFF_REQUESTS, EXPERIMENTS, LONG_ANSWERS, MODELS_FALLBACKS, MODELS_OFF, MODELS_REQUESTS, MONITOR_FALLBACKS, MONITOR_OFF, MONITOR_REQUESTS, ORCHESTRATOR_FALLBACKS, ORCHESTRATOR_REQUESTS, SHARE_REQUESTS, SHARING_FALLBACKS, PROJECTS_REQUESTS, SEARCH_FALLBACKS, SEARCH_REQUESTS, STORE_FALLBACKS, STORE_OFF, STORE_REQUESTS, TEAMS_FALLBACKS, TEAMS_REQUESTS, USAGE_FALLBACKS, USAGE_REQUESTS, VIEWERS_FALLBACKS, WIFI_FALLBACKS, WINDOW_NAMES_REQUESTS, WORKSPACES_FALLBACKS, type GatewayAccount, type GatewayOps, type GatewayStatus, type RouteAnswer, type TeamsPort, type WindowFocus } from './api.js'
import { createServiceHost, testFaults } from './serviceHost.js'
import { startStalls } from './stall.js'
import { createServiceLinks, type ServiceLinks } from './serviceLinks.js'
@@ -1392,6 +1392,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {
if (!outOfProcess.has('projects')) serviceHost.serve('projects', inline!.startProjects, coreApi, PROJECTS_REQUESTS)
if (!outOfProcess.has('windowNames')) serviceHost.serve('windowNames', inline!.startWindowNames, coreApi, WINDOW_NAMES_REQUESTS)
if (!outOfProcess.has('commandBar')) serviceHost.serve('commandBar', inline!.startCommandBar, coreApi, COMMAND_BAR_REQUESTS)
+ if (!outOfProcess.has('memory')) serviceHost.serve('memory', inline!.startMemory, coreApi, MEMORY_REQUESTS)
if (!outOfProcess.has('handoff')) serviceHost.serve('handoff', inline!.startHandoff, coreApi, HANDOFF_REQUESTS)
// Connected services' MCP bridge and the Connectors screen (services/connectors.ts): here, or in the edge host.
if (!outOfProcess.has('connectors')) serviceHost.serve('connectors', inline!.startConnectors, coreApi, CONNECTORS_REQUESTS)
diff --git a/cli/src/dsh/builtinIds.ts b/cli/src/dsh/builtinIds.ts
index 98c563363..443f83c7f 100644
--- a/cli/src/dsh/builtinIds.ts
+++ b/cli/src/dsh/builtinIds.ts
@@ -10,6 +10,8 @@ export const DEVICES_HARNESS_ID = 'autonomous/devices'
export const DEVICES_BUILTIN_SOURCE = 'builtin:devices'
export const HARNESS_MONITOR_ID = 'autonomous/harness-monitor'
export const HARNESS_MONITOR_BUILTIN_SOURCE = 'builtin:harness-monitor'
+export const MEMORIES_ID = 'autonomous/memories'
+export const MEMORIES_BUILTIN_SOURCE = 'builtin:memories'
/** Built-ins opened through their own product entry points, absent from the public picker. */
export function isHiddenBuiltin(record: { source?: string | null }): boolean {
diff --git a/cli/src/dsh/builtins.spec.ts b/cli/src/dsh/builtins.spec.ts
index 98ba4f788..a1b9b462f 100644
--- a/cli/src/dsh/builtins.spec.ts
+++ b/cli/src/dsh/builtins.spec.ts
@@ -3,8 +3,8 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, wri
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { env } from '../config/env.js'
-import { ensureBundledCoreHarnesses, ensureBundledDevices, ensureBundledHarnessMonitor, ensureBundledModelManager,
- DEVICES_HARNESS_ID, HARNESS_MONITOR_ID, HARNESS_MONITOR_BUILTIN_SOURCE, MODEL_MANAGER_ID, type BundledFiles } from './builtins.js'
+import { ensureBundledCoreHarnesses, ensureBundledDevices, ensureBundledHarnessMonitor, ensureBundledMemories, ensureBundledModelManager,
+ DEVICES_HARNESS_ID, HARNESS_MONITOR_ID, HARNESS_MONITOR_BUILTIN_SOURCE, MEMORIES_BUILTIN_SOURCE, MEMORIES_ID, MODEL_MANAGER_ID, type BundledFiles } from './builtins.js'
import { dshListRows } from './wire.js'
import { installedDsh, invalidateInstalledDsh, readInstalledIndex, upsertInstalledRecord } from './installed.js'
import { lockDsh } from './lock.js'
@@ -147,7 +147,9 @@ it('refreshes every bundled core tool together and leaves ordinary Store apps al
vi.stubGlobal('__MODEL_MANAGER_BUNDLE__', JSON.stringify(coreFiles(MODEL_MANAGER_ID)))
vi.stubGlobal('__DEVICES_BUNDLE__', JSON.stringify(coreFiles(DEVICES_HARNESS_ID)))
vi.stubGlobal('__HARNESS_MONITOR_BUNDLE__', JSON.stringify(coreFiles(HARNESS_MONITOR_ID)))
+ vi.stubGlobal('__MEMORIES_BUNDLE__', JSON.stringify(coreFiles(MEMORIES_ID)))
expect(ensureBundledCoreHarnesses()).toBe(true)
+ expect(installedDsh(MEMORIES_ID)!.source).toBe(MEMORIES_BUILTIN_SOURCE)
const oldDevices = installedDsh(DEVICES_HARNESS_ID)!, oldMonitor = installedDsh(HARNESS_MONITOR_ID)!
vi.stubGlobal('__DEVICES_BUNDLE__', JSON.stringify(coreFiles(DEVICES_HARNESS_ID, 'next release')))
vi.stubGlobal('__HARNESS_MONITOR_BUNDLE__', JSON.stringify(coreFiles(HARNESS_MONITOR_ID, 'next release')))
@@ -223,3 +225,20 @@ it('reports a non-Error dependency failure and still prepares the other bundled
expect(installedDsh(HARNESS_MONITOR_ID)).toBeDefined()
} finally { failure.mockRestore() }
})
+
+it('ships Memories with the release, adopting the Store copy and never a developer\'s linked one', () => {
+ // A person who got Memories from the Store before it shipped with Harness: the release takes it over.
+ const storeDir = join(root, 'autonomous', 'memories')
+ mkdirSync(storeDir, { recursive: true })
+ for (const [name, file] of Object.entries(coreFiles(MEMORIES_ID, 'from the store'))) writeFileSync(join(storeDir, name), file.content)
+ upsertInstalledRecord({ id: MEMORIES_ID, dir: storeDir, source: 'https://github.com/autonomous-ai/openharness', path: 'store/agents/memories',
+ ref: 'main', commit: 'b'.repeat(40), linked: false, installedAt: 9 })
+ expect(ensureBundledMemories(coreFiles(MEMORIES_ID))).toBe(true)
+ expect(installedDsh(MEMORIES_ID)!.source).toBe(MEMORIES_BUILTIN_SOURCE)
+ expect(installedDsh(MEMORIES_ID)!.installedAt).toBe(9)
+ const linked = join(root, 'developer-memories')
+ upsertInstalledRecord({ id: MEMORIES_ID, dir: linked, source: linked, ref: 'main', commit: null, linked: true, installedAt: 1 })
+ expect(ensureBundledMemories(coreFiles(MEMORIES_ID, 'next release'))).toBe(true)
+ expect(readInstalledIndex().find(row => row.id === MEMORIES_ID)!.dir).toBe(linked)
+ expect(ensureBundledMemories({})).toBe(false)
+})
diff --git a/cli/src/dsh/builtins.ts b/cli/src/dsh/builtins.ts
index 0411313ab..51a11e234 100644
--- a/cli/src/dsh/builtins.ts
+++ b/cli/src/dsh/builtins.ts
@@ -1,7 +1,7 @@
import { createHash, randomUUID } from 'node:crypto'
import { existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
-import { DEVICES_BUILTIN_SOURCE, DEVICES_HARNESS_ID, HARNESS_MONITOR_BUILTIN_SOURCE, HARNESS_MONITOR_ID, MODEL_MANAGER_ID } from './builtinIds.js'
+import { DEVICES_BUILTIN_SOURCE, DEVICES_HARNESS_ID, HARNESS_MONITOR_BUILTIN_SOURCE, HARNESS_MONITOR_ID, MEMORIES_BUILTIN_SOURCE, MEMORIES_ID, MODEL_MANAGER_ID } from './builtinIds.js'
import { dshRootDir, isBrokenDsh, readInstalledIndex, resolveInstalled, upsertInstalledRecord } from './installed.js'
import { lockDsh } from './lock.js'
import { readDshManifest } from './manifest.js'
@@ -10,7 +10,8 @@ import { samePackageSource } from './updates.js'
import { builtinFiles } from './bundledFiles.js'
export {
- DEVICES_BUILTIN_SOURCE, DEVICES_HARNESS_ID, HARNESS_MONITOR_BUILTIN_SOURCE, HARNESS_MONITOR_ID, isHiddenBuiltin, MODEL_MANAGER_ID,
+ DEVICES_BUILTIN_SOURCE, DEVICES_HARNESS_ID, HARNESS_MONITOR_BUILTIN_SOURCE, HARNESS_MONITOR_ID, isHiddenBuiltin, MEMORIES_BUILTIN_SOURCE,
+ MEMORIES_ID, MODEL_MANAGER_ID,
} from './builtinIds.js'
export type BundledFiles = Record<string, { content: string; executable: boolean; encoding?: 'base64' }>
@@ -38,11 +39,21 @@ export function ensureBundledHarnessMonitor(files?: BundledFiles): boolean {
what: 'Harness Monitor', legacyPath: 'store/agents/harness-monitor' })
}
+/** Memories is part of Harness: every agent's memories, About You in every agent, on every machine. Its memory
+ * service (services/memory.ts) runs its `mem` command, so it must be here on every machine. */
+export function ensureBundledMemories(files?: BundledFiles): boolean {
+ files ??= builtinFiles('memories')
+ if (!files?.['harness.json']) return false
+ return installBuiltin({ id: MEMORIES_ID, source: MEMORIES_BUILTIN_SOURCE, folder: 'memories', files,
+ what: 'Memories', legacyPath: 'store/agents/memories' })
+}
+
/** Core app DSHs ship with the release. Store applications keep their explicit Update action. */
export function ensureBundledCoreHarnesses(log: (line: string) => void = console.warn): boolean {
let ready = true
for (const [name, install] of [
['Model Manager', ensureBundledModelManager], ['Devices', ensureBundledDevices], ['Harness Monitor', ensureBundledHarnessMonitor],
+ ['Memories', ensureBundledMemories],
] as const) {
try { if (!install()) ready = false }
catch (error) {
diff --git a/cli/src/dsh/bundledFiles.ts b/cli/src/dsh/bundledFiles.ts
index a5aaf3d12..945f4159c 100644
--- a/cli/src/dsh/bundledFiles.ts
+++ b/cli/src/dsh/bundledFiles.ts
@@ -3,11 +3,13 @@ import type { BundledFiles } from './builtins.js'
declare const __MODEL_MANAGER_BUNDLE__: string
declare const __DEVICES_BUNDLE__: string
declare const __HARNESS_MONITOR_BUNDLE__: string
+declare const __MEMORIES_BUNDLE__: string
/** Kept in one shared asset module by the lean build; the self-contained CLI embeds the same bytes. */
-export function builtinFiles(name: 'models' | 'devices' | 'monitor'): BundledFiles | undefined {
+export function builtinFiles(name: 'models' | 'devices' | 'monitor' | 'memories'): BundledFiles | undefined {
const source = name === 'models' ? (typeof __MODEL_MANAGER_BUNDLE__ === 'string' ? __MODEL_MANAGER_BUNDLE__ : undefined)
: name === 'devices' ? (typeof __DEVICES_BUNDLE__ === 'string' ? __DEVICES_BUNDLE__ : undefined)
- : (typeof __HARNESS_MONITOR_BUNDLE__ === 'string' ? __HARNESS_MONITOR_BUNDLE__ : undefined)
+ : name === 'memories' ? (typeof __MEMORIES_BUNDLE__ === 'string' ? __MEMORIES_BUNDLE__ : undefined)
+ : (typeof __HARNESS_MONITOR_BUNDLE__ === 'string' ? __HARNESS_MONITOR_BUNDLE__ : undefined)
return source === undefined ? undefined : JSON.parse(source) as BundledFiles
}
diff --git a/cli/src/harnessd/services.ts b/cli/src/harnessd/services.ts
index 3b3408263..412b24d6d 100644
--- a/cli/src/harnessd/services.ts
+++ b/cli/src/harnessd/services.ts
@@ -389,6 +389,10 @@ export const SERVICE_HOSTS: Readonly<Record<string, ServiceHostSpec>> = {
// The command bar (services/commandBarProcess.ts), an experiment: started at its first request. What it holds
// is at most eight decisions in flight and one bounded JEV answer each (lib/commandBar.ts).
commandBar: { services: ['commandBar'], heapLimitMiB: 128, rssLimitMiB: 384, onDemand: true },
+ // Memories (services/memoryProcess.ts), an experiment: started at its first request, another machine's
+ // Memories pane asking. It runs the Memories package's own command: writes one at a time, snapshots
+ // asked together as one read, each answer at most 8 MB.
+ memory: { services: ['memory'], heapLimitMiB: 128, rssLimitMiB: 384, onDemand: true },
// Tab collaboration and teams, an experiment: the prompt scopes, a few drafts and fingerprints per agent, and
// beside them the teams, their mailbox and the tab channels (services/collaborationProcess.ts), each on its
// own link to the core. Started only once it is on (core/api.ts `EXPERIMENTS`).
diff --git a/cli/src/lib/e2ee/applicationFrames.ts b/cli/src/lib/e2ee/applicationFrames.ts
index 17b61f10f..052ecb482 100644
--- a/cli/src/lib/e2ee/applicationFrames.ts
+++ b/cli/src/lib/e2ee/applicationFrames.ts
@@ -23,7 +23,9 @@ const FLEET_REQUESTS = new Set(['grid_fleet_capabilities', 'grid_fleet_run', 'gr
'grid_fleet_models_list', 'grid_fleet_model_download', 'grid_fleet_model_start', 'grid_fleet_model_stop'])
const FLEET_RESULTS = new Set([...FLEET_REQUESTS].map(type => `${type}_result`))
// `group_sync`: the trust-group roster exchange (groupSyncer.ts) — keys, so always sealed.
-const MACHINE_REQUESTS = new Set([...SHELL_REQUESTS, 'agent_purge', 'agent_worktree_delete', 'agents_cleanup_preview', 'agent_close', 'git_project_info', 'scm_project_info', 'git_pull_request', 'machine_resources', 'api_connections', 'connectors', 'group_sync', 'phone_pair', 'viewer_surface', 'orchestrator', 'agent_handoff_prepare', ...OWNER_COMMAND_TYPES])
+const MACHINE_REQUESTS = new Set([...SHELL_REQUESTS, 'agent_purge', 'agent_worktree_delete', 'agents_cleanup_preview', 'agent_close', 'git_project_info', 'scm_project_info', 'git_pull_request', 'machine_resources', 'api_connections', 'connectors', 'group_sync', 'phone_pair', 'viewer_surface', 'orchestrator', 'agent_handoff_prepare',
+ // Memories (services/memory.ts): what this machine's agents remember, and About You and its on/off choice.
+ 'memory_snapshot', 'memory_about_put', 'memory_deliver', ...OWNER_COMMAND_TYPES])
const MACHINE_RESULTS = new Set([...MACHINE_REQUESTS].map(type => `${type}_result`))
/** The pair brain, machine to machine (daemons/BRAIN.md). A watch carries question text and recaps; the
* writes (answer, send, stop, start, pause, resume) act on a harness through the owning machine's floor
diff --git a/cli/src/serviceProcess.ts b/cli/src/serviceProcess.ts
index 1d192043b..5100e2a94 100644
--- a/cli/src/serviceProcess.ts
+++ b/cli/src/serviceProcess.ts
@@ -47,6 +47,7 @@ export const SERVICE_RUNNERS: ReadonlyMap<string, () => Promise<Runner>> = new M
['sharing', async () => (await import('./services/sharingProcess.js')).runSharingService],
['orchestrator', async () => (await import('./services/orchestratorProcess.js')).runOrchestratorService],
['commandBar', async () => (await import('./services/commandBarProcess.js')).runCommandBarService],
+ ['memory', async () => (await import('./services/memoryProcess.js')).runMemoryService],
// Not a service the core knows: the master runs it beside them (harnessd/services.ts `UPDATER_HOST`).
['updater', async () => (await import('./services/updaterProcess.js')).runUpdaterService],
['gateway', async () => (await import('./gateway/gatewayProcess.js')).runGatewayService],
diff --git a/cli/src/services/AGENTS.md b/cli/src/services/AGENTS.md
index fb17e2a6d..7b9335a46 100644
--- a/cli/src/services/AGENTS.md
+++ b/cli/src/services/AGENTS.md
@@ -62,6 +62,7 @@ that process. A process per risk, not per feature (`SERVICE_HOSTS` in `src/harne
| `teams` | teams, collaboration | an experiment: Tab collaboration beside the prompt scopes | on demand |
| `sharing` | sharing | an experiment: Share | on demand |
| `commandBar` | commandBar | an experiment: the command bar | on demand |
+| `memory` | memory | an experiment: Memories across machines | on demand |
A fault in one of the edge host's services can cost the others in it, never the core. Every service in
`KNOWN_SERVICES` runs out of the core's process by default, unless `HARNESSD_SERVICES` names a subset, by
@@ -206,7 +207,7 @@ like any other. Named in `HARNESSD_SERVICES`, it starts with the others.
## Experiments
-An experiment (the orchestrator, Tab collaboration, Share, the command bar) is a service that costs nothing
+An experiment (the orchestrator, Tab collaboration, Share, the command bar, memory) is a service that costs nothing
until it is on: its own process, which the master starts only when the core asks for it (`want`), when one of
its requests arrives or, as the core starts, when its saved state is in the data folder. Off, nothing of it runs or
is loaded anywhere; one failing costs its own process and nothing else. `e2e/experiments.e2e.ts` proves it:
diff --git a/cli/src/services/inline.spec.ts b/cli/src/services/inline.spec.ts
index b12219db1..9df1630f1 100644
--- a/cli/src/services/inline.spec.ts
+++ b/cli/src/services/inline.spec.ts
@@ -9,6 +9,7 @@ import { liveFor } from '../engines/live.js'
import { runtimeFor } from '../engines/runtime.js'
import { startGateway } from '../gateway/start.js'
import { startCommandBar } from './commandBar.js'
+import { startMemory } from './memory.js'
import { startConnectors } from './connectors.js'
import { startDevices } from './devices.js'
import { startHandoff } from './handoff.js'
@@ -31,6 +32,6 @@ import { startWorkspaces } from './workspaces.js'
describe('the services the core runs in its own process only when they do not run in theirs', () => {
it('are their own starts, unchanged: the same services either way', () => {
- expect({ ...inline }).toEqual({ engineTranscriptFor, liveFor, runtimeFor, screenFor, submissionFor, nativeControlFor, modelControlFor, questionControlFor, startCommandBar, startConnectors, startDevices, startHandoff, startGateway, startModels, startMonitor, startOrchestrator, startProjects, startRecaps, startSearch, startSharing, startShell, startStoreInCore, startTeamsInCore, startUsageInCore, startViewers, startWifi, startWindowNames, startWorkspaces })
+ expect({ ...inline }).toEqual({ engineTranscriptFor, liveFor, runtimeFor, screenFor, submissionFor, nativeControlFor, modelControlFor, questionControlFor, startCommandBar, startConnectors, startDevices, startHandoff, startGateway, startMemory, startModels, startMonitor, startOrchestrator, startProjects, startRecaps, startSearch, startSharing, startShell, startStoreInCore, startTeamsInCore, startUsageInCore, startViewers, startWifi, startWindowNames, startWorkspaces })
})
})
diff --git a/cli/src/services/inline.ts b/cli/src/services/inline.ts
index b69b06f90..ed03ea9ae 100644
--- a/cli/src/services/inline.ts
+++ b/cli/src/services/inline.ts
@@ -22,6 +22,7 @@ export { modelControlFor } from '../engines/modelControls.js'
export { runtimeFor } from '../engines/runtime.js'
export { startGateway } from '../gateway/start.js'
export { startCommandBar } from './commandBar.js'
+export { startMemory } from './memory.js'
export { startConnectors } from './connectors.js'
export { startDevices } from './devices.js'
export { startHandoff } from './handoff.js'
diff --git a/cli/src/services/memory.spec.ts b/cli/src/services/memory.spec.ts
new file mode 100644
index 000000000..5e52a1919
--- /dev/null
+++ b/cli/src/services/memory.spec.ts
@@ -0,0 +1,167 @@
+import { chmodSync, mkdirSync, mkdtempSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { fakeCore } from '../testing/fakeCore.js'
+import { memEnv, MEMORY_REQUESTS, runMem, startMemory, type MemoryDeps } from './memory.js'
+
+vi.mock('../dsh/installed.js', () => ({ installedDsh: vi.fn(() => undefined) }))
+
+const owner = { local: false, owner: true }
+const device = { local: false, owner: false }
+
+/** A Memories package whose `mem` answers what the test says, and records what it was asked. */
+function deps(answer: (args: string[], input?: string) => unknown = () => ({ ok: true })): MemoryDeps & { calls: Array<[string[], string | undefined]> } {
+ const calls: Array<[string[], string | undefined]> = []
+ return {
+ calls,
+ packageDir: () => '/pkg',
+ run: async (_dir, args, input) => {
+ calls.push([args, input])
+ const value = answer(args, input)
+ if (value instanceof Error) throw value
+ return { stdout: JSON.stringify(value) }
+ },
+ }
+}
+
+describe('memory: this machine\'s memories for the owner\'s other machines', () => {
+ afterEach(() => vi.clearAllMocks())
+
+ it('answers the three requests it declares', () => {
+ expect(Object.keys(startMemory(fakeCore(), deps())).sort()).toEqual([...MEMORY_REQUESTS].sort())
+ })
+
+ it('answers only the owner', async () => {
+ const memory = startMemory(fakeCore(), deps())
+ for (const type of MEMORY_REQUESTS) expect(await memory[type]!({}, device)).toEqual({ error: 'OWNER_REQUIRED' })
+ })
+
+ it('memory_snapshot runs `mem snapshot --json` and answers what it printed', async () => {
+ const d = deps(() => ({ memories: [{ id: 'claude:x.md' }] }))
+ expect(await startMemory(fakeCore(), d).memory_snapshot!({}, owner)).toEqual({ snapshot: { memories: [{ id: 'claude:x.md' }] } })
+ expect(d.calls).toEqual([[['snapshot', '--json'], undefined]])
+ })
+
+ it('memory_about_put writes another machine\'s build with its number', async () => {
+ const d = deps(() => ({ written: true, refreshed: ['codex'] }))
+ const memory = startMemory(fakeCore(), d)
+ expect(await memory.memory_about_put!({ text: '## A\n- one\n', gen: 7 }, owner)).toEqual({ ok: true, written: true })
+ expect(d.calls).toEqual([[['about', 'write', '--gen', '7', '--json'], '## A\n- one\n']])
+ expect(await memory.memory_about_put!({ text: ' ', gen: 7 }, owner)).toMatchObject({ error: 'INVALID_MEMORY' })
+ expect(await memory.memory_about_put!({ text: 'x'.repeat(70_000), gen: 7 }, owner)).toMatchObject({ error: 'INVALID_MEMORY' })
+ expect(await memory.memory_about_put!({ text: '## A\n- one\n', gen: '7' }, owner)).toMatchObject({ error: 'INVALID_MEMORY' })
+ expect(await memory.memory_about_put!({ gen: 7 }, owner)).toMatchObject({ error: 'INVALID_MEMORY' })
+ })
+
+ it('memory_deliver applies the choice with the time it was made', async () => {
+ const d = deps(() => ({ on: false, results: [] }))
+ const memory = startMemory(fakeCore(), d)
+ expect(await memory.memory_deliver!({ on: false, choiceAt: 1_791_600_000_000 }, owner)).toEqual({ ok: true, delivery: { on: false, results: [] } })
+ expect(await memory.memory_deliver!({ on: true, choiceAt: 5 }, owner)).toMatchObject({ ok: true })
+ expect(d.calls.map(([args]) => args)).toEqual([['deliver', 'off', '--choice-at', '1791600000000', '--json'], ['deliver', 'on', '--choice-at', '5', '--json']])
+ for (const bad of [{ on: 'yes', choiceAt: 5 }, { on: true }, { on: true, choiceAt: 0 }, { on: true, choiceAt: 1.5 }]) {
+ expect(await memory.memory_deliver!(bad, owner)).toMatchObject({ error: 'INVALID_MEMORY' })
+ }
+ })
+
+ it('says when Memories is not installed, and what failed when its command did', async () => {
+ const missing = startMemory(fakeCore(), { ...deps(), packageDir: () => null })
+ expect(await missing.memory_snapshot!({}, owner)).toMatchObject({ error: 'MEMORIES_NOT_INSTALLED' })
+ const broken = startMemory(fakeCore(), deps(() => new Error('the session index is busy')))
+ expect(await broken.memory_snapshot!({}, owner)).toEqual({ error: 'MEMORY_FAILED', detail: 'the session index is busy' })
+ expect(await broken.memory_about_put!({ text: '## A\n- x\n', gen: 1 }, owner)).toMatchObject({ error: 'MEMORY_FAILED' })
+ expect(await broken.memory_deliver!({ on: true, choiceAt: 2 }, owner)).toMatchObject({ error: 'MEMORY_FAILED' })
+ const garbled = startMemory(fakeCore(), { packageDir: () => '/pkg', run: async () => ({ stdout: 'not json' }) })
+ expect(await garbled.memory_snapshot!({}, owner)).toMatchObject({ error: 'MEMORY_FAILED' })
+ const thrown = startMemory(fakeCore(), { packageDir: () => '/pkg', run: async () => { throw 'plain' } })
+ expect(await thrown.memory_snapshot!({}, owner)).toEqual({ error: 'MEMORY_FAILED', detail: 'plain' })
+ })
+
+ it('by default, finds the installed package and says when there is none', async () => {
+ const { installedDsh } = await import('../dsh/installed.js')
+ expect(await startMemory(fakeCore()).memory_snapshot!({}, owner)).toMatchObject({ error: 'MEMORIES_NOT_INSTALLED' })
+ expect(installedDsh).toHaveBeenCalledWith('autonomous/memories')
+ })
+})
+
+describe('memory: one write at a time, one read for many', () => {
+ it('runs writes in the order they came, and shares one snapshot among those asked together', async () => {
+ const order: string[] = []
+ let release: () => void = () => {}
+ const gate = new Promise<void>((resolve) => { release = resolve })
+ let reads = 0
+ const memory = startMemory(fakeCore(), {
+ packageDir: () => '/pkg',
+ run: async (_dir, args) => {
+ if (args[0] === 'snapshot') { reads++; await gate; return { stdout: '{"memories":[]}' } }
+ order.push(`start ${args[1]}`)
+ if (args[1] === 'on') await gate
+ order.push(`end ${args[1]}`)
+ return { stdout: '{"written":false}' }
+ },
+ })
+ const on = memory.memory_deliver!({ on: true, choiceAt: 10 }, owner)
+ const off = memory.memory_deliver!({ on: false, choiceAt: 11 }, owner)
+ const first = memory.memory_snapshot!({}, owner)
+ const second = memory.memory_snapshot!({}, owner)
+ await new Promise((resolve) => setTimeout(resolve, 10))
+ expect(order).toEqual(['start on'])
+ release()
+ await Promise.all([on, off, first, second])
+ expect(order).toEqual(['start on', 'end on', 'start off', 'end off'])
+ expect(reads).toBe(1)
+ expect(await memory.memory_about_put!({ text: '## A\n- older\n', gen: 1 }, owner)).toEqual({ ok: true, written: false })
+ // A write that fails does not stop the ones after it.
+ const failing = startMemory(fakeCore(), { packageDir: () => '/pkg', run: async (_dir, args) => { if (args[1] === 'on') throw new Error('no'); return { stdout: '{}' } } })
+ const bad = failing.memory_deliver!({ on: true, choiceAt: 2 }, owner)
+ const good = failing.memory_deliver!({ on: false, choiceAt: 3 }, owner)
+ expect(await bad).toMatchObject({ error: 'MEMORY_FAILED' })
+ expect(await good).toMatchObject({ ok: true })
+ })
+})
+
+describe('runMem: the package\'s own command, on this process\'s Node', () => {
+ const pkg = (body: string): string => {
+ const dir = mkdtempSync(join(tmpdir(), 'memory-pkg-'))
+ mkdirSync(join(dir, 'toolchain'))
+ writeFileSync(join(dir, 'toolchain', 'mem.mjs'), body)
+ chmodSync(join(dir, 'toolchain', 'mem.mjs'), 0o755)
+ return dir
+ }
+
+ it('passes the arguments and the input, and returns what it printed', async () => {
+ const dir = pkg(`let input = ''; process.stdin.on('data', (c) => { input += c }).on('end', () => console.log(JSON.stringify({ args: process.argv.slice(2), input })))`)
+ const { stdout } = await runMem(dir, ['about', 'write', '--json'], 'hello')
+ expect(JSON.parse(stdout)).toEqual({ args: ['about', 'write', '--json'], input: 'hello' })
+ const quiet = await runMem(dir, ['snapshot'])
+ expect(JSON.parse(quiet.stdout)).toEqual({ args: ['snapshot'], input: '' })
+ })
+
+ it('rejects with the command\'s last line of error output, and never with a command line', async () => {
+ const dir = pkg(`console.error('first'); console.error('the profile has no lines'); process.exit(1)`)
+ await expect(runMem(dir, ['about', 'write'])).rejects.toThrow('the profile has no lines')
+ const silent = pkg(`process.exit(3)`)
+ await expect(runMem(silent, [])).rejects.toThrow('mem stopped (exit 3)')
+ const garbled = pkg(`console.log('{ not json'); process.exit(1)`)
+ await expect(runMem(garbled, [])).rejects.toThrow('mem stopped (exit 1)')
+ })
+
+ it('says a run was too slow, or stopped by a signal, in words', async () => {
+ const slow = pkg(`setTimeout(() => {}, 10_000)`)
+ await expect(runMem(slow, [], undefined, process.versions.node, 200)).rejects.toThrow('mem stopped (too slow)')
+ const killed = pkg(`process.kill(process.pid, 'SIGKILL')`)
+ await expect(runMem(killed, [])).rejects.toThrow('mem stopped (exit unknown)')
+ })
+
+ it('takes the answer of a run that wrote some agents and not others (exit 1, its JSON printed)', async () => {
+ const dir = pkg(`console.log(JSON.stringify({ on: true, results: [{ agent: 'claude', ok: true }, { agent: 'codex', ok: false, error: 'is a link' }] })); process.exit(1)`)
+ const { stdout } = await runMem(dir, ['deliver', 'on', '--json'])
+ expect(JSON.parse(stdout).results[1]).toEqual({ agent: 'codex', ok: false, error: 'is a link' })
+ })
+
+ it('needs Node 22, and never hands the daemon\'s credentials to the package', async () => {
+ await expect(runMem('/pkg', [], undefined, '20.10.0')).rejects.toThrow('Memories needs Node 22 or newer; this Harness runs on 20.10.0.')
+ expect(memEnv({ HOME: '/h', HARNESSD_SERVICE_TOKEN: 'secret', HARNESSD_SERVICES: 'x', PATH: '/bin' })).toEqual({ HOME: '/h', PATH: '/bin' })
+ })
+})
diff --git a/cli/src/services/memory.ts b/cli/src/services/memory.ts
new file mode 100644
index 000000000..77a2a6a85
--- /dev/null
+++ b/cli/src/services/memory.ts
@@ -0,0 +1,121 @@
+/**
+ * Memory: what the agents on this machine remember, for the owner's Memories panes on their other machines
+ * (store/agents/memories), and the About You profile and its on/off choice from them. An experiment
+ * (core/api.ts `EXPERIMENTS`): its own process, started at the first request, nothing loaded before.
+ *
+ * - `memory_snapshot`: this machine's memories, agents, About You and activity, as the Memories package's
+ * `mem snapshot --json` reads them.
+ * - `memory_about_put` `{ text, gen }`: another machine's About You, written here with that build's number
+ * (`mem about write --gen`); the package refuses one older than what is here, and refreshes this
+ * machine's agents' copies when delivery is on.
+ * - `memory_deliver` `{ on, choiceAt }`: the person's on/off choice from another machine, applied with its
+ * own time (`mem deliver on|off --choice-at`); the package ignores one older than the choice here.
+ *
+ * The daemon never reads an agent's memory itself and loads no package code: it runs the package's own
+ * command, as the package's pane does, so there is one reader of those folders and one writer of About
+ * You. Each run is bounded in time and output. Only the owner may ask: a device or an observer may not.
+ */
+import { execFile } from 'node:child_process'
+import { join } from 'node:path'
+import type { CoreApi, ServiceRequests } from '../core/api.js'
+import { MEMORIES_ID } from '../dsh/builtinIds.js'
+import { installedDsh } from '../dsh/installed.js'
+
+/** The requests memory answers for the apps, declared in core/api.ts for the core to route. */
+export { MEMORY_REQUESTS } from '../core/api.js'
+
+/** The bridge drops a frame past 8 MB; `mem snapshot` keeps itself under 4 MB. */
+const MAX_OUTPUT = 8 * 1024 * 1024
+/** Under the core's 30 s wait for a routed answer: a slow run is told as this service's failure, with its
+ * reason, not as the service being down. */
+const TIMEOUT_MS = 25_000
+const MAX_ABOUT = 64 * 1024
+/** `node:sqlite`, which the package reads the session index with, and `--disable-warning`. */
+const NODE_MAJOR = 22
+
+export interface MemoryDeps {
+ /** The installed Memories package's folder, or null when it is not installed here. */
+ packageDir(): string | null
+ /** Run the package's `mem` with these arguments (and this standard input): its output, or an error. */
+ run(dir: string, args: string[], input?: string): Promise<{ stdout: string }>
+}
+
+/** What `mem` is run with: this process's environment without the daemon's own credentials. */
+export function memEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
+ return Object.fromEntries(Object.entries(env).filter(([key]) => !key.startsWith('HARNESSD_')))
+}
+
+export function runMem(dir: string, args: string[], input?: string, node: string = process.versions.node, timeoutMs: number = TIMEOUT_MS): Promise<{ stdout: string }> {
+ return new Promise((resolve, reject) => {
+ if (Number(node.split('.')[0]) < NODE_MAJOR) { reject(new Error(`Memories needs Node ${NODE_MAJOR} or newer; this Harness runs on ${node}.`)); return }
+ // This process's own Node: the one Harness ships, which has the built-in SQLite the package reads the
+ // session index with. Its experimental warning would only reach the log.
+ const child = execFile(process.execPath, ['--disable-warning=ExperimentalWarning', join(dir, 'toolchain', 'mem.mjs'), ...args],
+ { cwd: dir, timeout: timeoutMs, maxBuffer: MAX_OUTPUT, env: memEnv() },
+ (error, stdout, stderr) => {
+ if (!error) { resolve({ stdout }); return }
+ // `mem deliver` exits 1 when one agent's file could not be written (a linked folder, say) and still
+ // prints what it did for every agent: that answer is the truth, not a failure of the whole request.
+ if (stdout.trim().startsWith('{')) { try { JSON.parse(stdout); resolve({ stdout }); return } catch { /* not an answer */ } }
+ const said = String(stderr).trim().split('\n').slice(-1)[0]
+ reject(new Error((said || `mem stopped (${error.killed ? 'too slow' : `exit ${error.code ?? 'unknown'}`})`).slice(0, 300)))
+ })
+ child.stdin?.end(input ?? '')
+ })
+}
+
+const DEFAULTS: MemoryDeps = {
+ packageDir: () => installedDsh(MEMORIES_ID)?.dir ?? null,
+ run: runMem,
+}
+
+const failed = (error: unknown): Record<string, unknown> =>
+ ({ error: 'MEMORY_FAILED', detail: error instanceof Error ? error.message : String(error) })
+
+export function startMemory(_core: CoreApi, deps: MemoryDeps = DEFAULTS): ServiceRequests {
+ // Writes one at a time: two machines' panes can send a choice or a profile at the same moment, and each
+ // run reads and rewrites the same files. In order, "never older over newer" holds; side by side, an older
+ // choice could land last. Snapshots asked for together share one read.
+ // `mem` below never rejects (a failure is an answer), so the chain never breaks.
+ let writes: Promise<unknown> = Promise.resolve()
+ const queued = <T>(work: () => Promise<T>): Promise<T> => {
+ const result = writes.then(work)
+ writes = result
+ return result
+ }
+ let reading: Promise<Record<string, unknown>> | null = null
+ const mem = async (args: string[], input?: string): Promise<Record<string, unknown>> => {
+ const dir = deps.packageDir()
+ if (!dir) return { error: 'MEMORIES_NOT_INSTALLED', detail: 'Memories is not installed on this machine.' }
+ try {
+ const { stdout } = await deps.run(dir, args, input)
+ return { ok: true, value: JSON.parse(stdout) as unknown }
+ } catch (error) { return failed(error) }
+ }
+ return {
+ memory_snapshot: async (_payload, asker) => {
+ if (!asker.owner) return { error: 'OWNER_REQUIRED' }
+ reading ??= mem(['snapshot', '--json']).finally(() => { reading = null })
+ const answer = await reading
+ return answer.ok ? { snapshot: answer.value } : answer
+ },
+ memory_about_put: async (payload, asker) => {
+ if (!asker.owner) return { error: 'OWNER_REQUIRED' }
+ const text = typeof payload.text === 'string' ? payload.text : ''
+ const gen = payload.gen
+ if (!text.trim() || text.length > MAX_ABOUT) return { error: 'INVALID_MEMORY', detail: 'memory_about_put needs About You text under 64 KB' }
+ if (!Number.isSafeInteger(gen)) return { error: 'INVALID_MEMORY', detail: 'memory_about_put needs the build number (gen)' }
+ const answer = await queued(() => mem(['about', 'write', '--gen', String(gen), '--json'], text))
+ // `written: false`: a newer About You was already here, and stays.
+ return answer.ok ? { ok: true, written: Boolean((answer.value as { written?: unknown }).written) } : answer
+ },
+ memory_deliver: async (payload, asker) => {
+ if (!asker.owner) return { error: 'OWNER_REQUIRED' }
+ if (typeof payload.on !== 'boolean' || !Number.isSafeInteger(payload.choiceAt) || (payload.choiceAt as number) < 1) {
+ return { error: 'INVALID_MEMORY', detail: 'memory_deliver needs on and the time it was chosen (choiceAt)' }
+ }
+ const answer = await queued(() => mem(['deliver', payload.on ? 'on' : 'off', '--choice-at', String(payload.choiceAt), '--json']))
+ return answer.ok ? { ok: true, delivery: answer.value } : answer
+ },
+ }
+}
diff --git a/cli/src/services/memoryProcess.spec.ts b/cli/src/services/memoryProcess.spec.ts
new file mode 100644
index 000000000..2770f9876
--- /dev/null
+++ b/cli/src/services/memoryProcess.spec.ts
@@ -0,0 +1,30 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { runServiceProcess, type ServiceProcessOptions } from './process.js'
+import { runMemoryService } from './memoryProcess.js'
+
+// The real default reaches a real socket: never in a test.
+vi.mock('./process.js', () => ({ runServiceProcess: vi.fn(() => ({ stop: vi.fn() })) }))
+
+describe('memory in its own process', () => {
+ afterEach(() => vi.clearAllMocks())
+
+ it('answers with the same handlers as in the core\'s process', async () => {
+ let options: ServiceProcessOptions | null = null
+ const service = { stop: vi.fn() }
+ const handle = runMemoryService({
+ dataDir: '/data', socketPath: '/data/daemon-1.sock', machineId: 'm', token: 't',
+ run: (given) => { options = given; return service },
+ start: () => ({ memory_snapshot: async () => ({ snapshot: { memories: [] } }), memory_about_put: async () => ({ ok: true }), memory_deliver: async () => ({ ok: true }) }),
+ })
+ expect(handle).toBe(service)
+ expect(options).toMatchObject({ name: 'memory', socketPath: '/data/daemon-1.sock', machineId: 'm', token: 't' })
+ expect(await options!.requests.memory_snapshot!({}, { local: true, owner: true })).toEqual({ snapshot: { memories: [] } })
+ })
+
+ it('runs as a real service by default', () => {
+ runMemoryService({ dataDir: '/data', socketPath: '/data/daemon-1.sock', machineId: 'm', token: 't' })
+ expect(runServiceProcess).toHaveBeenCalledWith(expect.objectContaining({
+ name: 'memory', requests: { memory_snapshot: expect.any(Function), memory_about_put: expect.any(Function), memory_deliver: expect.any(Function) },
+ }))
+ })
+})
diff --git a/cli/src/services/memoryProcess.ts b/cli/src/services/memoryProcess.ts
new file mode 100644
index 000000000..73eae3941
--- /dev/null
+++ b/cli/src/services/memoryProcess.ts
@@ -0,0 +1,28 @@
+/**
+ * Memory in its own process (`harness __service memory`): the same handlers as in the core's process
+ * (services/memory.ts). It asks the core nothing; the package command it runs is this process's alone.
+ */
+import { startMemory } from './memory.js'
+import { runServiceProcess, type ServiceProcess } from './process.js'
+import { processCoreApi } from './processCoreApi.js'
+
+export interface MemoryServiceOptions {
+ dataDir: string
+ socketPath: string
+ machineId: string
+ token: string
+ /** Swapped in tests for one that does not touch the real socket or process. */
+ run?: typeof runServiceProcess
+ /** Swapped in tests for a memory service that runs no package command. */
+ start?: typeof startMemory
+}
+
+export function runMemoryService(options: MemoryServiceOptions): ServiceProcess {
+ return (options.run ?? runServiceProcess)({
+ name: 'memory',
+ socketPath: options.socketPath,
+ machineId: options.machineId,
+ token: options.token,
+ requests: (options.start ?? startMemory)(processCoreApi(options.dataDir, 'memory')),
+ })
+}
diff --git a/desktop/assets/engine-icons/NOTICE.txt b/desktop/assets/engine-icons/NOTICE.txt
index 23a6a024b..df4b94972 100644
--- a/desktop/assets/engine-icons/NOTICE.txt
+++ b/desktop/assets/engine-icons/NOTICE.txt
@@ -131,6 +131,11 @@ autonomous/harness-builder
License: MIT
Source: https://github.com/autonomous-ai/openharness/blob/main/store/branding/harness-builder.svg
+autonomous/memories
+© 2026 OpenHarness contributors
+License: MIT
+Source: https://github.com/autonomous-ai/openharness/blob/main/store/branding/memories.svg
+
licenses/original.txt
MIT License
diff --git a/desktop/assets/engine-icons/memories.png b/desktop/assets/engine-icons/memories.png
new file mode 100644
index 000000000..74a1fcdf8
Binary files /dev/null and b/desktop/assets/engine-icons/memories.png differ
diff --git a/desktop/assets/store/covers/memories.jpg b/desktop/assets/store/covers/memories.jpg
new file mode 100644
index 000000000..72e5a47a9
Binary files /dev/null and b/desktop/assets/store/covers/memories.jpg differ
diff --git a/desktop/assets/store/covers/sources.json b/desktop/assets/store/covers/sources.json
index 93b1c6d9b..3cf124fff 100644
--- a/desktop/assets/store/covers/sources.json
+++ b/desktop/assets/store/covers/sources.json
@@ -332,6 +332,14 @@
"capture": "Synthetic test fleet with an empty home directory. No user account, machines, or activity were read.",
"harness": "autonomous/harness-monitor"
},
+ {
+ "asset": "memories.jpg",
+ "source": "desktop/tool/store_artwork/capture-covers.mjs memories",
+ "credit": "OpenHarness example",
+ "sha256": "def5e19216c090cde07a51a6236ed326920d12b4763053012263446733bffb39",
+ "capture": "Synthetic memories and sessions in an empty home directory. No user account, machines, or activity were read.",
+ "harness": "autonomous/memories"
+ },
{
"asset": "machine-monitor.jpg",
"source": "desktop/tool/store_artwork/capture-covers.mjs machine-monitor",
diff --git a/desktop/lib/e2ee/envelope.dart b/desktop/lib/e2ee/envelope.dart
index 38d331bf2..cb488e0e6 100644
--- a/desktop/lib/e2ee/envelope.dart
+++ b/desktop/lib/e2ee/envelope.dart
@@ -70,6 +70,10 @@ const Set<String> encryptedDownTypes = {
// The harness's branch and pull-request history is a machine RPC too (applicationFrames.ts
// `MACHINE_REQUESTS`): unsealed, the machine answers E2EE_REQUIRED.
'git_pull_request',
+ // Memories across machines (CLI services/memory.ts).
+ 'memory_snapshot',
+ 'memory_about_put',
+ 'memory_deliver',
// The trust-group roster swap (`viewer/group_sync.dart`): the keys every member trusts.
'group_sync',
'codex_profiles_list',
diff --git a/desktop/lib/store/store_cover_art.dart b/desktop/lib/store/store_cover_art.dart
index eb30a9869..f05009ed4 100644
--- a/desktop/lib/store/store_cover_art.dart
+++ b/desktop/lib/store/store_cover_art.dart
@@ -302,6 +302,13 @@ const storeCoverArt = <String, StoreCoverArt>{
viewport: Rect.fromLTWH(0, 0, 1080, 540),
background: Color(0xff131312),
),
+ 'autonomous/memories': StoreCoverArt(
+ asset: 'assets/store/covers/memories.jpg',
+ description: 'Memories’ About You and agent notes from an illustrative demo home',
+ imageSize: Size(1080, 720),
+ viewport: Rect.fromLTWH(0, 0, 1080, 540),
+ background: Color(0xff0e0f11),
+ ),
'autonomous/machine-monitor': StoreCoverArt(
asset: 'assets/store/covers/machine-monitor.jpg',
description: 'Machine Monitor’s fleet view with an illustrative demo fleet',
diff --git a/desktop/lib/widgets/engine_identity.dart b/desktop/lib/widgets/engine_identity.dart
index ee899ead4..ef349625e 100644
--- a/desktop/lib/widgets/engine_identity.dart
+++ b/desktop/lib/widgets/engine_identity.dart
@@ -270,6 +270,15 @@ const _harnesses = <String, EngineIdentity>{
color: Color(0xff9bd9dd),
asset: 'assets/engine-icons/machine-monitor.png',
),
+ 'autonomous/memories': EngineIdentity(
+ id: "autonomous/memories",
+ label: "Memories",
+ category: "Code",
+ tagline: "Every memory your agents keep, in one place",
+ creator: "Autonomous",
+ color: Color(0xfff0b9a6),
+ asset: 'assets/engine-icons/memories.png',
+ ),
'autonomous/simskill': EngineIdentity(
id: "autonomous/simskill",
label: "SimSkill",
@@ -797,6 +806,7 @@ const knownHarnessBase = <String, String>{
'autonomous/foam-agent': 'codex',
'autonomous/juce-agent-toolkit': 'codex',
'autonomous/machine-monitor': 'claude',
+ 'autonomous/memories': 'claude',
'autonomous/simskill': 'codex',
'autonomous/roundtable': 'claude',
diff --git a/desktop/tool/store_artwork/capture-covers.mjs b/desktop/tool/store_artwork/capture-covers.mjs
index 26ee08d36..e8663c010 100644
--- a/desktop/tool/store_artwork/capture-covers.mjs
+++ b/desktop/tool/store_artwork/capture-covers.mjs
@@ -1,20 +1,20 @@
/** Capture original Harness viewers with isolated demo data, never the user's fleet/models.
- * node capture-covers.mjs <all|machine-monitor|harness-monitor|mlx-lm|ollama|vllm|home-assistant>
+ * node capture-covers.mjs <all|machine-monitor|harness-monitor|memories|mlx-lm|ollama|vllm|home-assistant>
* --playwright /path/to/playwright/index.mjs --output /tmp/store-covers
- * COVER_DUMP_TEXT=1 prints Harness Monitor's visible text, to check it holds nothing personal.
+ * COVER_DUMP_TEXT=1 prints Harness Monitor's and Memories' visible text, to check it holds nothing personal.
* Home Assistant is the upstream public demo; all other pages run on loopback.
*/
import { EventEmitter } from 'node:events';
-import { mkdir, mkdtemp, rm } from 'node:fs/promises';
+import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
-import { join, resolve } from 'node:path';
+import { dirname, join, resolve } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
const root = fileURLToPath(new URL('../../../', import.meta.url));
const args = process.argv.slice(2);
const option = (name, fallback) => args.includes(name) ? args[args.indexOf(name) + 1] : fallback;
const mode = args[0] || 'all';
-const ids = ['machine-monitor', 'harness-monitor', 'mlx-lm', 'ollama', 'vllm', 'home-assistant'];
+const ids = ['machine-monitor', 'harness-monitor', 'memories', 'mlx-lm', 'ollama', 'vllm', 'home-assistant'];
if (mode !== 'all' && !ids.includes(mode)) throw new Error(`Choose all or ${ids.join(', ')}.`);
const output = resolve(option('--output', join(tmpdir(), 'harness-cover-captures')));
const playwright = option('--playwright', 'playwright');
@@ -120,6 +120,82 @@ try {
await page.close(); await viewer.close(); await rm(workspace, { recursive: true, force: true });
for (const [key, value] of Object.entries(env)) value === undefined ? delete process.env[key] : process.env[key] = value;
}
+ } else if (id === 'memories') {
+ const { createViewer } = await source('store/agents/memories/viewer.mjs');
+ const { sessionIndex, DAY } = await source('store/agents/memories/test/fixtures.mjs');
+ const { writeAbout } = await source('store/agents/memories/lib/about.mjs');
+ // An invented person's home: what five agents remember and four months of messages, all made up here.
+ const home = await mkdtemp(join(tmpdir(), 'memories-cover-'));
+ const put = async (path, text) => { await mkdir(dirname(join(home, path)), { recursive: true }); await writeFile(join(home, path), text); };
+ const notes = {
+ payments: [
+ ['short-answers', 'feedback', 'Wants replies under five lines', 'Keep replies short; lead with the answer.'],
+ ['retries', 'project', 'Webhooks retry with backoff', 'Webhook retries back off to one hour, then page.'],
+ ['ledger', 'reference', 'Where the ledger docs live', 'The ledger design is in docs/ledger.md.'],
+ ],
+ widgets: [
+ ['tests-first', 'feedback', 'Run the tests before saying done', 'Run `make test` before calling anything done.'],
+ ['renderer', 'project', 'The legacy renderer is going away', 'New work targets the grid renderer only.'],
+ ],
+ 'docs-site': [
+ ['plain-words', 'user', 'Writes docs in plain words', 'Prefers short sentences and no jargon.'],
+ ['deploys', 'project', 'Docs deploy from main', 'Every merge to main publishes the site.'],
+ ],
+ 'mobile-app': [
+ ['screenshots', 'feedback', 'Reviews UI from screenshots', 'Send a screenshot with every UI change.'],
+ ['release-train', 'project', 'Releases go out on Tuesdays', 'Never release on a Friday.'],
+ ],
+ };
+ for (const [project, list] of Object.entries(notes)) {
+ await mkdir(join(home, 'code', project), { recursive: true });
+ const key = join(home, 'code', project).replace(/[^A-Za-z0-9]/g, '-');
+ for (const [name, type, description, body] of list) {
+ await put(`.claude/projects/${key}/memory/${name}.md`, `---\nname: ${name}\ndescription: ${description}\ntype: ${type}\n---\n\n${body}\n`);
+ }
+ }
+ await put('.codex/config.toml', '[features]\nmemories = true\n');
+ await put('.codex/memories/memory_summary.md', 'Prefers small pull requests with one change each.\n');
+ await put('.codex/memories/MEMORY.md', '# Handbook\n\n## Testing\nRun `make test` first.\n\n## Reviews\nOne change per pull request.\n');
+ await put('.grok/config.toml', '[memory]\nenabled = true\n');
+ await put('.grok/memory-v2/global/topics/style.md', '# Code style\n\nTwo-space indentation everywhere.\n');
+ await put('.hermes/memories/USER.md', 'Prefers terse answers.\n§\nWorks late in the evening.\n');
+ await put('.gemini/GEMINI.md', '## Gemini Added Memories\n- Prefers tabs in Go files\n- Lives in UTC+1\n');
+ const asks = ['keep it short, tldr only', 'run the tests before you say done', 'one change per pull request',
+ 'why does the retry back off that far?', 'walk me through the ledger migration', 'ship it once CI is green',
+ 'make the empty state clearer', 'never release on a Friday', 'write the docs in plain words', 'add a test that fails first'];
+ const engines = ['claude', 'codex', 'codex', 'claude', 'grok', 'hermes'];
+ const projects = Object.keys(notes);
+ const now = Date.now();
+ const turns = [];
+ for (let day = 0; day < 120; day++) {
+ // Busy weekdays, quiet weekends, and a holiday week: a believable four months.
+ const weekday = new Date(now - day * DAY).getDay();
+ const count = day >= 50 && day < 57 ? 0 : weekday === 0 || weekday === 6 ? day % 3 : 2 + ((day * 7) % 9);
+ for (let n = 0; n < count; n++) {
+ const project = projects[(day + n) % projects.length];
+ turns.push({ session: `s${day}-${n % 3}`, engine: engines[(day * 5 + n) % engines.length], cwd: join(home, 'code', project),
+ title: `${project} work`, ask: asks[(day * 3 + n) % asks.length], answer: 'done', daysAgo: day + n / 24 });
+ }
+ }
+ sessionIndex(join(home, '.harness', 'cli', 'data'), { now, turns });
+ const env = { MEMORIES_HOME: join(home, '.harness', 'memory') };
+ writeAbout(env.MEMORIES_HOME, ['# About you', '', '## How you work',
+ '- Works across Claude Code and Codex, most days of the week. [asks:480]',
+ '- Asks "why" before agreeing to a design. [asks:41]', '',
+ '## What you want from agents',
+ '- Short answers that lead with the result. [claude:short-answers.md, hermes:USER.md]',
+ '- Tests run before anything is called done. [claude:tests-first.md, codex:MEMORY.md]',
+ '- One change per pull request. [codex:memory_summary.md]', '',
+ '## Taste', '- Plain words in docs; no jargon. [claude:plain-words.md]', ''].join('\n'), { gen: now, now });
+ const viewer = createViewer({ workspace: home, intervalMs: 60_000, env, home });
+ const page = await browser.newPage({ viewport: { width: 1080, height: 720 }, deviceScaleFactor: 1, colorScheme: 'dark' });
+ try {
+ await page.goto(`http://127.0.0.1:${await viewer.start()}/`);
+ await page.waitForSelector('#list > *');
+ await page.waitForTimeout(1500); // Let the layout settle before recording.
+ await page.screenshot({ path: join(output, `${id}.png`) });
+ if (process.env.COVER_DUMP_TEXT) console.log(await page.innerText('body'));
+ } finally { await page.close(); await viewer.close(); await rm(home, { recursive: true, force: true }); }
} else {
const { createServer } = await source('store/agents/mlx-lm/src/server.mjs');
const { MLX_CATALOG } = await source('store/agents/mlx-lm/src/mlx.mjs');
diff --git a/docs/design/2026-10-04-harnessd-before-after.md b/docs/design/2026-10-04-harnessd-before-after.md
index 848a5e287..bebf0b63e 100644
--- a/docs/design/2026-10-04-harnessd-before-after.md
+++ b/docs/design/2026-10-04-harnessd-before-after.md
@@ -177,7 +177,8 @@ The core keeps sessions, and reaches each service only through its link. Measure
├── orchestrator experiment
├── teams experiment: Tab collaboration
├── sharing experiment: Share
- └── commandBar experiment: the command bar
+ ├── commandBar experiment: the command bar
+ └── memory experiment: Memories across machines
```
One service failing costs its own process, and the master restarts it. The core answers its requests
diff --git a/mobile/lib/e2ee/envelope.dart b/mobile/lib/e2ee/envelope.dart
index ebfe91b4a..1ba1017b0 100644
--- a/mobile/lib/e2ee/envelope.dart
+++ b/mobile/lib/e2ee/envelope.dart
@@ -50,6 +50,10 @@ const Set<String> encryptedDownTypes = {
'git_project_info',
// The harness's branch and pull-request history is a machine RPC too.
'git_pull_request',
+ // Memories across machines (CLI services/memory.ts).
+ 'memory_snapshot',
+ 'memory_about_put',
+ 'memory_deliver',
// The trust-group roster swap (`viewer/group_sync.dart`): the keys every member trusts.
'group_sync',
'codex_profiles_list',
diff --git a/store/agents/memories/lib/sources.mjs b/store/agents/memories/lib/sources.mjs
index b47627819..069f291ae 100644
--- a/store/agents/memories/lib/sources.mjs
+++ b/store/agents/memories/lib/sources.mjs
@@ -357,7 +357,9 @@ function readGemini(h) {
const path = join(h.gemini, 'GEMINI.md')
const content = read(path)
if (!content?.text.trim()) return rows
- const added = sections(content.text).find((part) => /gemini added memories/i.test(part.title ?? ''))
+ // Delivery appends About You at the end of GEMINI.md, which is inside this section when it comes last:
+ // read without it, or About You's own lines come back as things Gemini saved.
+ const added = sections(withoutOurBlock(content.text)).find((part) => /gemini added memories/i.test(part.title ?? ''))
if (added) {
added.body.split(/\r?\n/).map((line) => line.replace(/^\s*[-*]\s+/, '').trim()).filter(Boolean).forEach((line, n) => rows.push(makeRow(h, {
agent: 'gemini', file: path, part: `saved-${n}`, body: line, kind: 'you', type: 'saved', title: firstLine(line, 90), modified: content.modified,
diff --git a/store/agents/memories/test/deliver.test.mjs b/store/agents/memories/test/deliver.test.mjs
index 7ebae3d75..1270d91fa 100644
--- a/store/agents/memories/test/deliver.test.mjs
+++ b/store/agents/memories/test/deliver.test.mjs
@@ -136,10 +136,16 @@ test('review: About You never cites its own copies as something the person wrote
const { collect } = await import('../lib/sources.mjs')
const { dir, env } = home({ codexAgents: '# My rules\n\nUse pnpm.\n' })
mkdirSync(join(dir, '.grok', 'rules'), { recursive: true })
+ // Gemini's saved memories come last in GEMINI.md, so the delivered block lands inside their section.
+ mkdirSync(join(dir, '.gemini'), { recursive: true })
+ writeFileSync(join(dir, '.gemini', 'GEMINI.md'), '## Gemini Added Memories\n- Prefers tabs\n')
deliver('on', { env, home: dir })
- const told = collect({ env, home: dir }).memories.filter((row) => row.kind === 'instructions')
+ assert.match(readFileSync(join(dir, '.gemini', 'GEMINI.md'), 'utf8'), /Wants short answers/)
+ const rows = collect({ env, home: dir }).memories
+ const told = rows.filter((row) => row.kind === 'instructions')
assert.ok(told.every((row) => !row.body.includes('Harness Memories')), 'no delivered copy is read back as an instruction')
- assert.deepEqual(told.map((row) => row.body.trim()), ['# My rules\n\nUse pnpm.'])
+ assert.deepEqual(told.map((row) => row.body.trim()), ['# My rules\n\nUse pnpm.', '## Gemini Added Memories\n- Prefers tabs'])
+ assert.deepEqual(rows.filter((row) => row.agent === 'gemini' && row.kind === 'you').map((row) => row.body), ['Prefers tabs'], 'nor as something Gemini saved')
})
test('review: a linked config folder is left alone; nothing is written into the other repository', () => {
diff --git a/store/agents/memories/toolchain/mem.mjs b/store/agents/memories/toolchain/mem.mjs
index 363dc43a4..5ffdd13d0 100755
--- a/store/agents/memories/toolchain/mem.mjs
+++ b/store/agents/memories/toolchain/mem.mjs
@@ -157,6 +157,12 @@ export async function run(argv, { out = (line) => process.stdout.write(line + '\
const gen = flags.gen !== undefined ? Number(flags.gen) : undefined
if (gen !== undefined && !Number.isInteger(gen)) { err('--gen takes a whole number'); return 2 }
const path = writeAbout(h.memory, stdin(), gen !== undefined ? { gen } : {})
+ if (flags.json) {
+ const refreshed = path ? deliver('refresh', { env, home }) : { results: [] }
+ print({ written: Boolean(path), refreshed: refreshed.results.filter((r) => r.ok && r.changed).map((r) => r.agent) })
+ return 0
+ }
+ if (!path) { out('A newer About You is already here; left as it is.'); return 0 }
out(`wrote ${tilde(path, h.home)}`)
// Agents that hold a copy get the new one now; Claude Code's hook reads the file itself.
const refreshed = deliver('refresh', { env, home })
diff --git a/store/branding/README.md b/store/branding/README.md
index dce8438b1..198ef3be0 100644
--- a/store/branding/README.md
+++ b/store/branding/README.md
@@ -44,6 +44,8 @@ The catalog audit on 2026-09-21 added eight original wrapper marks:
| Harness Monitor | Status rows and an activity trace | MIT |
| Harness Builder | Building block and creation spark | MIT |
+Memories (2026-10-10): stacked memory cards and the About You spark, MIT.
+
Harness Monitor and Harness Builder are locally linked tools, not public catalog
entries. Their marks are recognized when a daemon reports them; bundling an icon
does not add an installable product to the Store.
diff --git a/store/branding/marks.json b/store/branding/marks.json
index 1ba3ca80a..0528a30ba 100644
--- a/store/branding/marks.json
+++ b/store/branding/marks.json
@@ -220,5 +220,14 @@
"credit": "© 2026 OpenHarness contributors",
"licenseFile": "licenses/original.txt",
"catalog": "linked"
+ },
+ {
+ "id": "autonomous/memories",
+ "file": "memories.svg",
+ "color": "#f0b9a6",
+ "kind": "original",
+ "license": "MIT",
+ "credit": "© 2026 OpenHarness contributors",
+ "licenseFile": "licenses/original.txt"
}
]
diff --git a/store/branding/memories.svg b/store/branding/memories.svg
new file mode 100644
index 000000000..fa496f622
--- /dev/null
+++ b/store/branding/memories.svg
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
+ <rect x="2" y="2" width="60" height="60" rx="15" fill="#3E312D"/>
+ <rect x="21" y="10" width="31" height="37" rx="5" stroke="#B9968B" stroke-width="3.5"/>
+ <rect x="12" y="18" width="31" height="37" rx="5" fill="#3E312D" stroke="#F0B9A6" stroke-width="4"/>
+ <path d="M19 41h17M19 48h11" stroke="#F0B9A6" stroke-width="3.5" stroke-linecap="round"/>
+ <path d="M27.5 23.5q1 5 5.5 5.5q-4.5 .5-5.5 5.5q-1-5-5.5-5.5q4.5-.5 5.5-5.5z" fill="#EBC680" stroke="#EBC680" stroke-width="1.5" stroke-linejoin="round"/>
+</svg>
diff --git a/store/branding/rendered.json b/store/branding/rendered.json
index e3ca9e12e..7e30bf9ce 100644
--- a/store/branding/rendered.json
+++ b/store/branding/rendered.json
@@ -130,5 +130,11 @@
"sourceSha256": "2369e3ceabeeb694117202ebd25f889b158ac5923d84067982a60c548e59ebf9",
"pngSha256": "289f7c3b806bcb3e2d1efce9e65435d1e9d44be938058ab6fff208031fb0323b",
"renderer": "AppKit"
+ },
+ {
+ "id": "autonomous/memories",
+ "sourceSha256": "11e195634f1c67a34d98d24dcd4efab0eb0211a860317aec630a7a4661892394",
+ "pngSha256": "057c8b1d978fb01e832016d75fd1038cdf5b3f36837ef184c329aafb7f8e3ba6",
+ "renderer": "AppKit"
}
]