c9e8422fa8c2b8eb96dfb7ff0c91c2caef1306bd
16
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
73ecef0b36 |
memory: each memory is a Markdown file of its own
memory.json held every memory in one JSON file, which grew without
bound, was hard to read or fix by hand, and was rewritten whole on every
change. Memory is now a folder, `memory/` beside where memory.json was:
- `<id>.md` is the memory: YAML front matter (kind, scope, status,
origin, pinned, tags, why, sources, times) and the text as the body.
The file is the source of truth.
- `meta.json` holds what isn't one memory's: projects, the digest,
dismissed texts, deletions, declined suggestions, when a search last
returned each memory (so a search never rewrites a memory's file), and
the hash of each file as magpie last wrote it.
- `index.json` is a cache of the parsed files by size and mtime only:
deleted or garbled, memory reads the same.
- `journal.json` holds a change to more than one file (a merge, a sync)
before any is written; the next read finishes one cut off halfway.
A file whose hash isn't the one magpie wrote was edited or added by hand:
it is the user's (origin user, Edited), so a tidy leaves it and an
agent's change synced from another computer never writes over it. A file
with no front matter is a global fact named by its file. A write leaves
any file that changed on disk since it was read (a hand edit made
meanwhile), and so does a remove. A file that can't be parsed is left
out and never written over nor removed, sync included; meta.json that
can't be read is unknown (an error), as memory.json was.
memory.json is moved in on the first read, all under one journal, and
kept as memory.json.migrated. One that can't be read is an error and
nothing is written.
The scope of a hand-written file keeps its case (a project's holds a
path); "global" in any case is global.
Ran at this head (rebased on origin/main
|
||
|
|
8a59e76165 |
memory: candidates and set-aside memories don't stay forever
memory.json grew from distilled candidates nobody reviewed and from the superseded members of merges, which nothing ever removed. memory.Prune now applies retention on every hourly tick of memdistill.Keep, with distilling and dreaming on or off: - a candidate unchanged for 30 days (memory.Keep) is archived; - an archived or superseded memory unchanged for 30 more is removed, recorded in removed (a sync doesn't bring it back) and, if distilled, dismissed (never proposed again); - what the user wrote or pinned (Fixed) is never archived or removed. Untidy keeps a merged memory when one of its members was removed since: it is all that is left of that member. Run on mote at base |
||
|
|
72facf72e2 |
memory: a search or save can name its project, and every answer says whose and where (Norethcy on X, #6392)
The memory tools had no target-project argument and no way to see the caller context they resolved, so a scoped migration run from one project couldn't keep memories for another or check where they went. - memory_search and memory_save take `project`: a folder on this computer (absolute, or relative to the caller's own folder), or the key of a project memory knows (github.com/owner/repo, with or without project:, or a project's one name). A project named goes with scope project (a save's default then) or a search's all; global or agent with a project is refused, and an unknown project says which ones memory knows. - Answers name what was used: a memory reads "this project (<key>)" and "only for you (<agent>)", and a search ends "(looked in: everywhere, project <key>, agent <id>)". - New read-only memory_context: the agent the server takes the caller for and how it was found (router _meta, magpie mcp memory's initialize, key/User-Agent, the session's initialize), the project with its folder and source, the scopes a search looks in and the server version, as text and structuredContent. Given `project`, it shows that one. - HTTP and stdio are the same server (magpie mcp memory relays), and OwnMCPTools lists memory_context with the others. Run (mote, -tags nogui unless noted): - TestMemoryMCPProjectArgumentAndContext (new): folder, key and relative folder; the caller's own project untouched; refusals; memory_context's text and structuredContent; tools/list. Red with the project argument ignored by hand. - TestMemoryBridgeContextAndProject (new): the real gateway behind magpie mcp memory over stdio, initialized as codex as in the report. - go test ./internal/browsermcp ./internal/cli ./internal/library: ok; go test -run 'Memory|OwnMCP|Hub|RootDirs|Tool' ./internal/gateway: ok. - Windows (xiaomi-gpu, win-run): the new gateway, browsermcp and cli tests ok (a test's own unquoted Windows path was fixed on the way). - go vet darwin, linux nogui, windows for the four packages; gofmt. Not tried: Codex desktop itself over /mcp/run/magpie-memory; the full suite runs after the tag. |
||
|
|
1f05c311d9 |
library: an open memory holds still while the Memory tab polls (Nietzsche_Li on X)
"资源库-记忆中,被展开的记忆的表单会定时抖动". While search by meaning
still has memories to read (read < of, which can last up to a minute
between memembed.Keep's reads) or a learn-from-conversations run goes,
the Memory tab reads its row again every 2s, and each read drew the
whole page anew. The open editor was a new .lib-detail each time and
played its content-in entrance (opacity .5, 2px slide) every 2s.
- semWatch/distWatch draw nothing when the read changed nothing, and
redraw only their own row (redrawRow) when it did; the whole tab only
when the memories changed.
- render() marks a .lib-detail open before it (same data-detail) as kept,
so it doesn't replay its entrance. This covers every render of an
open editor in the Library: memories, instruction sets and agents'
files (the siblings; no other Library tab polls into render()).
- A new memory's text no longer takes the focus back on every render.
Run (mote): library-memory-steady.test.cjs, all 5 languages, 980/420,
chromium + webkit: green 4 of 4 whole-file runs after the last change
(webkit alone 2 of 2 before it). Broken by hand: the same test against
origin/main's client.js and library.css: 22 of 22 red ("the editor
played its entrance again"). One webkit de 420 red was the test's own
first row click intercepted by the header at 420px while the page
settled; the test now opens rows with a DOM click.
Also run, both engines, every language, 980/420: library-memory, library-memory-select, library-memory-suggest, memory-icon, library-instr-busy, library-instr-sets, library-linked-set, library-follow-server: all green. No Go code changed, so no go test or vet.
Not tried: the real app on a real memory store mid-read.
|
||
|
|
4028687b8c |
memory: dates in memory_search and the dream's notes are the user's local time, with the hour and offset (Norethcy on X)
memory_search printed a memory's Updated as a bare UTC date, so a memory
saved at 04:30 on the 11th in Shanghai read as the 10th, and the stored
times were written in UTC. Now:
- every memory time is written in the local zone (now() instead of
now().UTC()): created, updated, edited, used, sync tombstones, digest
publish time;
- memory_search shows 2026-11-11T04:30+08:00 (memoryStamp);
- the dream's notes list the creation day in local time, as "Today" there
already was.
Old data: the file already held full timestamps, only in UTC ("...Z").
They parse as the same instants and are shown in local time, so no
migration; they are rewritten with a local offset when next changed.
There is no date filter in memory_search, and the Memory tab shows no
dates, so nothing else read the UTC day.
Tests: TestMemorySearchDatesInLocalTime (gateway) with time.Local at +08:00
reads an old "Z" memory and checks a new save is stored with +08:00. Red on
the old code both halves, broken by hand: the DateOnly line printed
2026-11-10, and now().UTC() in memory.go failed the saved-zone check.
Run with TZ=UTC and TZ=Asia/Shanghai on mote: internal/memory,
internal/memdistill, internal/gui (memory tests) ok; gofmt clean;
go vet ./..., linux nogui, windows ok. Not run: full ./... suite before
the tag (started after it), GUI browser tests (no assets changed).
|
||
|
|
e0cadc3124 |
memory: goes with backups and sync, and suggests what holds everywhere or is a skill (P5)
Backups and sync. memory.json goes in every backup and in the WebDAV, S3 and GitHub sync, under its own toggle (on unless turned off, as the library is). A sync merges memories one by one (memory.Combine): the newer change wins, a memory the user edited or pinned is never taken over by one they didn't, an archived one is kept 30 days and the suggestions turned down are joined. Settings > Sync has a Memory tick, and the description lists memory. Promotion. Library > Memory (In use, no search) shows what memory suggests: a project memory that says the same in two or more projects (the same text, or 60% of its words with 6 or more on each side), or whose sources came from two or more, is offered as global; a procedure searches returned 5 or more times is offered as a skill. Taking a global one keeps the user's own or pinned memory first, then the most used, makes it global and supersedes the rest (into a global with the same text when there is one). Making a skill writes a library skill from its text and why, named from its first words (procedure-<id> for one in Chinese), for the agents ticked for instructions, and archives the memory. A suggestion declined isn't made again, and that goes with sync too. Routes: POST /api/memory/promote, /skill, /decline. Docs: docs/subsystems/memory.md (Backups and sync, Promotion), docs/subsystems/sync-backup.md. Pushed on origin/main |
||
|
|
e1a2226405 |
library: EverMe Memory and Nowledge Mem are offered in the market as memory sources, added in one step (OipsAnthony on X)
Both publish an MCP server: EverMe's @everme/memory-mcp (stdio, agent id and evt_ token, managed backend preset) and Nowledge Mem's Streamable HTTP endpoint at 127.0.0.1:14242/mcp (optional Bearer key for a Mem reached over Access Anywhere). Added beside Magpie Memory; their memories stay in their service, and magpie's digest and Memory tab don't read them (docs/subsystems/memory.md).
Run (wsl-run, magpie-wt/memprov at origin/main
|
||
|
|
d77eb6d236 |
memory: search by meaning, on a small model on this computer
A memory search now finds what means the same in other words or another
language ("什么时候上线" finds "Releases go out on Tuesdays"), for the
MCP server's memory_search and the Library's Memory tab alike. It is off
until switched on under Memory → Search by meaning, since it downloads
paraphrase-multilingual-MiniLM-L12-v2 (Xenova's int8 ONNX, ~135 MB,
pinned revision, size and sha256 checked); switched off, the model is
deleted.
- internal/pii/guard: the BERT code runs the embedder too (LoadEmbedder,
mean pooling; the tokenizer reads 250,002 pieces and WhitespaceSplit).
Its vectors match ONNX Runtime's int8 to cosine >= 0.995 and are no
further from fp32 than ORT's own; testdata carries both.
- internal/memembed: the switch, the download, vectors.bin keyed by each
memory's sha256 (read once, again when the text changes, a cut-short
file read as none), Keep reading in the backend, the model let go after
10 minutes unused.
- internal/memory: memory.Semantic fuses the meaning ranking with the word
ranking by reciprocal rank; a tie goes to the nearer in meaning, since
a first word hit may hold one common word ("when do we release" had
"Never delete images when..." first). Near 0.30 / Within 0.15 come from
97 real memories and 16 queries, half Chinese for English memories:
12 of 16 sought found with ~4 others each. Rank searches without noting
memories used.
- GUI: the Search by meaning row (download %, memories read, failures),
and the tab's search lists what the backend ranked first
(POST /api/memory/rank), then word matches. zh, zh-TW, ja, de.
- docs/subsystems/memory.md: the section, out of "Not built yet".
Why not multilingual-e5-small, which this was built on first: run for
real, its cosines sat at 0.78-0.89 for everything, and a Chinese search
ranked Chinese memories over the English one it meant. e5-small, e5-base
and MiniLM were compared in ONNX Runtime on the same 97 memories; MiniLM
put the sought one first 9 of 16 and in the top 3 12 of 16, with the
rest at a median cosine of 0.16.
Run before the rebases (mote, on origin/main as of the work):
- gofmt -l internal/ clean; go vet of memembed, memory, pii/..., gui,
library; GOOS=linux and GOOS=windows vet of memembed and pii/guard.
- MAGPIE_EMBED_DIR=~/models/pml go test -run Embedder ./internal/pii/guard:
7 texts (CJK, full width, emoji, digits before runs of spaces) at
0.9962-1.0000 with ORT int8.
- go test memembed, memory, memdistill, pii/..., library, browsermcp.
- Linux (magpie-desktop, -tags nogui, mote's disk was full): go test
memembed, memory, pii/guard, gui (461s), cli (1228s, past the default
10m timeout, so -timeout 30m); gateway -run 'MemoryMCP|OwnMCP'.
- Rebased on origin/main
|
||
|
|
6a253f8af7 |
memory: pick several memories and keep, archive or delete them at once (RealZeroP27 on X)
Library -> Memory reviewed one memory at a time: To review held
candidates that had to be opened and kept or deleted one by one.
- Select (beside the filters, shown when two or more are listed) puts a
box on each memory. A click picks one, Shift-click the range from the
last one clicked, up/down move between the boxes (Shift picks as it
goes), Cmd/Ctrl+A picks all shown, Escape ends it. A search or filter
unpicks what it hides.
- The bar under the list (the library's lib-pickbar, as Skills' Select)
keeps (To review), archives (In use) or restores (Archived) the picked
ones, and deletes them on a second click.
- POST /api/memory/status {ids, status}: memory.SetStatus changes them in
one write, each as Edit by the user (an archived inferred memory is
dismissed, so it isn't proposed again). Unknown ids are skipped; none
found, or a bad status, is a 400 and changes nothing.
Delete reuses POST /api/memory/remove {ids}.
Run (mote, at this head):
- go test ./internal/memory ./internal/memdistill ./internal/library: ok
- go test -run 'Memory|Distill|Dream' ./internal/gui: ok
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./..., and the three builds: ok. gofmt -l: clean.
- library-memory-select.test.cjs (new): 22/22, chromium and webkit,
en/zh/zh-TW/ja/de at 980 and 420 wide (no native select, no sideways
overflow).
- Every library-*, i18n-* and gui-* GUI file (67), both engines: 1309 of 1309 pass.
- Rebased on
|
||
|
|
350856f512 |
memory: read a backlog of conversations at once, with progress and a Stop (RealZeroP27 on X)
Every run, the hourly one and Read now alike, read at most 10
conversations (PerRun), so a backlog of 400 (All) took 40 hours.
- A run the user asks for reads every conversation due
(memdistill.ReadAll, through distillNow): switching on, picking a
model or a longer range, and Read now. Still one request at a time,
at the picked model and reasoning level.
- The hourly run reads up to 30 (PerRun, was 10), more than a busy
hour brings, so only a backlog left by a stop or a failure waits for
it.
- The row shows how far a run has gone ("Reading conversations… 37 of
400", Progress -> doing/of in GET /api/memory/distill), with a Stop
(memdistill.Stop, POST /api/memory/distill/stop); switching off stops
it too. A stop drops the request in flight, which is read next time,
and isn't an error.
- After a run the row says how many it left unread (State.Left), and
Read now reads them. All's menu note no longer says "10 an hour".
docs/subsystems/memory.md says all of this.
Run (mote; all at base
|
||
|
|
0e68455863 |
memory: pick how far back conversations are read, and the model's reasoning level (RealZeroP27 on X)
Learn from conversations read the last 7 days only (Back, fixed at switch-on) and asked its model with no reasoning level. Its row now has two more pickers, beside the model: - How far back it reads: 7 days (default), 30, 90, 1 year or All (State.Days; 0 stays 7 days, so an existing distill.json keeps its own Since until a range is picked). A longer range reads at once. Every range reads from the latest 400 conversations (memdistill.Listed) at 10 an hour (PerRun), so All is ~240 requests a day at most until the backlog is read; All's menu note says so. - Thinking: Default (none sent, as before) or one of the model's own levels, fitted and sent with room to think the way Vision and Searcher do (gateway.WithSideEffort over sideEffort/replyRoom/withFixedEffort). The nightly tidy uses the same level, and its row shows the picker when distilling is off. Fixed on the way, as the longer ranges depend on it: a conversation's mark was dropped after 30 days while Since stayed put, so anything older than 30 days inside Since was read again every hour. A mark is now dropped once it is before Since, or older than 30 days and past the oldest conversation listed. POST /api/memory/distill takes effort and days; a bad one is a 400. docs/subsystems/memory.md says all of this. Run (mote; first at base |
||
|
|
547585cd9c |
gateway: memory answers the agents on this computer alone
/mcp/magpie/memory ( |
||
|
|
2c2bd15d71 |
memory: Tidy up every night, a switch in the Memory tab
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.
|
||
|
|
3445d8384e |
memdistill: a proposal stands on words the user wrote
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). |
||
|
|
4d12d44163 |
memory: Learn from conversations, a switch in the Memory tab
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.
|
||
|
|
2b2ee49ded |
gui: the Library's Memory tab
A tab after Instructions lists what the agents remember, in use, to review (what an agent only guessed) and archived, pinned first then newest; searches it, narrows it by where it applies, and adds, edits, pins, keeps, archives and deletes memories (Delete asks with a second click). Kind and scope are picked from the app's menu, never a <select>. A card on top switches the digest in the ticked agents' instructions on or off and names those agents, and offers Magpie Memory while it isn't in the Library. /api/memory (GET; POST saves the user's own or edits by id), /api/memory/remove and /api/memory/digest; a change publishes the digest at once and its reply carries `problem` when that failed. Words other code also says (Archived, Pin, Keep, the kinds…) are in core i18n.js; the rest in the library plugin's, in zh, zh-TW, ja and de. docs/subsystems/memory.md describes the layer. Run (mote-run): - node --test internal/gui/tests/library-memory.test.cjs, Chromium and WebKit, 5 languages, 980 and 420 wide: ok - whole GUI suite: not run at this commit; it is queued on mote for the stack head (034f249af before the rebase) - go vet ./internal/gui, GOOS darwin, linux, windows: ok Broken by hand: the pinned sort read `b.pinned - a.pinned` (NaN for an unpinned one) and the test was red in every language until `!!`. Looked at: screenshots en light 980, zh dark 980, en 420. |