The Memory tab gets a second row under Learn from conversations. It is
off by default. Switched on, the first tidy is due at the next 03:00.
Tidy now runs one at once, and Undo puts the last one back. While
distillation is off, the row has its own model picker; both rows share
one model.
Routes: POST /api/memory/dream {on}, /dream/run and /dream/undo.
GET /api/memory/distill carries "dreaming", so a tidy no longer shows
as conversations being read.
The prompt's stale rule is narrower. On the first real run it set aside
two decisions because "the work is done". Now only a note that later
notes contradict, one past its date, or one about a finished one-off
task is stale; a decision, direction or preference stays.
docs/subsystems/memory.md gets a Dreaming section.
Real run: a sandbox memory.json of 62 real distilled memories, 12 active
and one each user-written and pinned, with auto/claude-haiku-5-5 through
the live gateway.
- Before the prompt change: 12 changes in 48s, 10 merges and 2 set aside.
Both set-aside notes were decisions.
- After: 12 merges in 46s, none set aside. Each merge joins real
duplicates (three ~/.codex/sessions cleanup rules into one, the
TestFlight 1.66/1.68 pair). One went into the fixed memory, whose text
was kept word for word.
- Undo: 25 restored. memory.json's ids and statuses equal the backup
taken before the run, and every merged memory is gone.
Broken by hand, each red:
- Undo not reloading the list: library-memory 22 failed.
- Ignoring DreamSince: TestDreamsOnceANight.
- A plan applied after an error: TestDreamFailureChangesNothing.
- Tidy's fixed guard and Untidy's status check: their memory tests.
Run on mote at this tree:
- go test internal/memory, memdistill, library: ok.
- internal/gui -run 'Distill|Dream|I18n|Budget': ok.
- library-memory.test.cjs: 22/22 in both engines.
- i18n-keys and i18n-en-no-cjk: 4/4 each.
- go vet (darwin), GOOS=linux -tags nogui, GOOS=windows: ok.
Not run yet: the full suite at this head.
Switched on (off by default), once a day from 03:00 local time the
hourly loop shows a model each scope's memories, 120 at a time under
short names, the user's own and pinned ones marked fixed, and asks which
say the same thing and which are no longer true. memory.Tidy merges and
sets aside what it names; candidates distilled from conversations and
left unreviewed for 30 days are set aside too, with no request when
nothing else could change. A request that fails changes nothing: the
error is kept and the tidy is tried on the next tick. What the last tidy
did is kept in distill.json and Undo puts it back once.
The prompt names neither magpie nor a vendor.
Run: mote-run go test -count=1 ./internal/memdistill ./internal/memory: ok.
Broken by hand: applying the plan after a failed request turns
TestDreamFailureChangesNothing red; ignoring when it was switched on
turns TestDreamsOnceANight red.
Not tried yet: a real model (next, with the GUI).
A real run (Haiku through the live gateway, 10 of this Mac's Claude Code
conversations, magpie's config/cache/state in a sandbox, HOME real)
proposed 38 candidates. The ones without a quote were the assistant's
own standing instructions said back (run heavy commands on mote, no
git add -A, ask before deleting), not anything the user said. Now the
prompt asks for the user's words copied exactly and leaves out what
only the assistant said, and keep drops a proposal whose quote is
missing or isn't in the user's text (letters and digits compared,
case aside).
Same 10 conversations again: 24 candidates, every one quoting the
user, none of the echoes.
Run (mote): go test ./internal/memdistill: ok. Broken by hand: the
check off, TestReadsQuietSessionsOnce red (Added 5, want 3).
The Memory tab gets a row that reads finished conversations into
candidate memories (To review). It is off until switched on; switched
on it reads at once, then hourly (5 minutes after start, then every
hour), through the gateway this process serves under the agent
"memory", with the automatic model unless one is picked through the
app's menu. Read now runs it again; a run that stopped says why.
- memdistill: Keep (the hourly loop) and Running.
- gui: /api/memory/distill (GET, POST {on, model}), /distill/run;
distillComplete posts /v1/messages to the served gateway's handler
with the memory agent's token.
- library client: the row, its poll while a run goes, and the
memories reloaded when it ends; strings in zh, zh-TW, ja, de.
- docs/subsystems/memory.md: a Distillation section.
Run (mote, at this tree):
- go vet ./internal/gui ./internal/memdistill ./internal/memory; GOOS=linux
-tags nogui and GOOS=windows vet of gui and memdistill: clean.
- go test ./internal/gui ./internal/memdistill ./internal/memory
./internal/library: ok.
- node --test internal/gui/tests/library-memory.test.cjs: 22/22, Chromium
and WebKit, 5 languages, 980 and 420.
Broken by hand:
- the memories not reloaded after a run: the GUI test is red waiting
for the proposed memory.
- the token not the memory agent's (earlier): TestDistillCompleteThroughGateway
red on the Trace's agent.
Not tried yet: a real model's run (next), the whole GUI suite (queued
behind the suite lock on mote), the full Go suite.
A model reads an agent's session once it has been quiet for 30 minutes
and writes down what will hold beyond it: a stated preference, a rule
from a correction, a project fact the code doesn't say. Each one waits
in memory as a candidate (To review), with the session, folder and the
user's words it came from; nothing reaches an agent until kept.
- Off until switched on (distill.json); switched on, it looks back 7 days.
- Main sessions only: no subagents, gateway-only or read-only sessions,
none of its own (agent "memory"), and two user turns at least.
- At most 10 sessions a run, the latest first; a session is read again
only once it goes on. A model that fails stops the run and says why;
the sessions not read are read next time.
- The model is sent user and assistant text alone (no thinking, tool
calls or results), cut to 24k characters (start and end), with the
memories already known so they aren't proposed again. Its
instructions name neither the app nor a vendor.
- A distilled memory the user deleted isn't proposed again (2e0058330).
- An unreadable distill.json is never written over, and nothing runs.
Not wired to the gateway or the GUI yet (next commit).
Run: mote-run go test ./internal/memdistill (ok), go vet (ok).
Broken by hand, each red then green restored: the quiet check
(ReadsQuietSessionsOnce), the read-once mark (three tests), the
text-only filter (WhatIsSent), the on switch (OffReadsNothing), skipping
gateway-only/own sessions (ReadsQuietSessionsOnce).
Not tried: a real model; that comes with the wiring.