1ccacad63281094de8a3372d5a507d38f9969e5c
7507
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8d9254729a |
agent: dsh's patch lists are parsed once a change for a look
The window asks /api/drift every 15s while it is up, and each ask read and parsed every dsh profile's patch list again, several times over (dshGet, dshGetEffort, dshOver for the home layer, dshCheck). With real accounts, forty asks allocated 38 MB, 13 MB of it dshRead and its parse. dshLook is dshRead through filememo.Read: parsed once each time the file changes and shared, so only the paths that look and write nothing use it (dshGet, dshGetEffort, dshOver, dshGetLegacy, dshCheck, dshSearchesHere). Every write path keeps dshRead, whose items it edits. A gone file reads as empty, as edit.Read made it for dshRead. Run: - TestDshLookParsesAnUnchangedListOnce: 0 allocations a look under a request's hold, dsh's own later save read, a gone list empty. Broken by hand (dshLook returning dshRead): red, 12 allocations a look. - go test ./internal/agent ./internal/edit ./internal/filememo on mote; go vet ./internal/agent for darwin, windows and linux. - Real accounts (sandbox HOME on mote, 40 /api/drift asks): see below. before (t23) 35.6 and 38.4 MB, 12.7 and 13.2 MB of it dshRead; after (t24) 26.0 and 15.7 MB, no dshRead or dshParse left in the profile. |
||
|
|
b27b660467 |
provider: Fable 5.2 counts in the Claude card's Fable week
aipha2025 on X asked to see Fable 5.2's allowance. Claude Code 2.1.321's
/usage, run for real on a Team account in a sandbox config dir (the
token it renewed written back to the account's keychain item), tells
one Fable week ("Current week (Fable): 0% used · resets Nov 11 at 6am"),
which magpie already shows as "7 days · Fable" and which claude-fable-*
counts against. The test holds those bytes and checks 5.2 and 5.1 both
stop at a spent Fable week while Opus doesn't.
The launch's limit resets are not shown and can't be used from magpie:
- /usage -p prints no reset; Claude Code reads them from its own usage
call (cedar_ember) and spends them with /limit-reset, a hidden,
interactive-only command behind a per-account flag, which POSTs
/api/organizations/<org>/reset_rate_limits.
- On the three accounts tried (Team, two Max 20x) the Fable reset
program is off: /limit-reset said "A 5-hour limit reset isn't
available right now", Team's said "Unknown command".
- magpie never calls Anthropic's endpoints as Claude Code, and a spend
can't be tried without a reset to spend, so nothing is offered; the
user spends one in claude.ai Settings > Usage or Claude Code's
/limit-reset.
Run at this tree (mote): the provider package's Claude tests with
the agent and gateway runs in the commit before; gofmt and the three
vets clean.
Rebased onto
|
||
|
|
6fe754cb20 |
claude: Fable 5.2 on Vertex, Bedrock, Desktop's fable tier and Anthropic's fast mode
Anthropic launched Claude Fable 5.2 (claude-fable-5-2) on 11-09 (thelegendof2414 on X: not in magpie's list). Checked against Anthropic's "What's new in Fable 5.2" page, AWS's model card, models.dev and Claude Code 2.1.321's own bundle: - Claude subscription and Anthropic API: the list follows models.dev, which already has claude-fable-5-2 (8/40, cache read 0.2, write 10, 1M context, 128k out), so it shows once the catalog syncs (at most 24h). TestClaudeAccountListsFable52 holds that with the literal models.dev row: listed first, priced, 1M window, low to max efforts. - Vertex global and Bedrock presets list it (global.anthropic.claude-fable-5-2 is on AWS's card). - Claude Desktop's fable tier now behaves as claude-fable-5-2 (2.1.321's latest_per_family); Desktop's own catalog v4371 still ends at 5.1. - Fast mode on Anthropic's API key: Fable 5.2 has it ($16/$80; 2.1.321's fast-mode opt-in set is fable-5-2 and mythos-5-2). Fable 5.1 never had it and stays off. A Claude subscription account still gets no fast mode in magpie, as before. - Claude Code's effort: 2.1.321 reads the top-level effortLevel only for models up to Fable 5.1 and Mythos 5.1, so 5.2 goes in modelSettings, as Opus 5.5 does (claudeReadsTop unchanged, test added). - Gateway: adaptive-only thinking, no sampling, thinking off never sent, xhigh kept: the version rules already cover 5.2; tests now name it. Run at this tree (mote): gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok; go test -count=1 ./internal/agent ./internal/gateway ./internal/provider -run 'Fable|Claude|Fast|Vertex|Bedrock|Effort|Thinking|Xhigh|XHigh|Desktop|Sampling|Adaptive' ok (84s, 178s, 36s). Not run before the push: the full go test ./... (mote had six suites queued on suite.lock at load 420); it runs after, and a red is filed. Not tried: a real Fable 5.2 request through magpie; fast mode on a real API key. |
||
|
|
b681b036d2 |
site: Mistral and Ollama pages in en, zh and ja
/docs/mistral and /docs/ollama (with zh/ and ja/) answer "how do I use Mistral / Ollama in Claude Code, Codex, Gemini CLI and OpenCode". Facts come from the source: the mistral, ollama and ollama-cloud presets in internal/provider/presets.go, chattidy.go (thinking parts, #483, #494), mistral_plan.go, ollama_usage.go, local_address.go, gateway/ollama.go, and the usage text of internal/cli/providers_cli.go and model_cli.go for every CLI example (provider add, fallback, models +id, model price, model efforts). Every docs page with a "By provider" line now lists both, in one order; sitemap.xml, llms.txt and llms-full.txt (rebuilt) carry them. Run on mote: node --test worker.test.mjs install.test.mjs (fail 0); JSON-LD of the six pages parsed. Deployed (e33573b9) and every new URL answers 200. Not tried: the CLI examples against a live magpie (read from the source's usage text instead). |
||
|
|
53b2773d77 |
providers: each model priced once, on catalogs worked out once per provider
The Providers page asked PricedFree and ListPrice of every model of every provider on each ask. Each ran listPrice, which worked out the provider's catalogs again (Catalogs' split, EndpointCatalog, the membership filter, kimiCodeMember's split once more), made the names to look up on the heap, and built userPrice's three keys as strings. A heap profile of 40 /api/providers asks with real accounts put 4MB there (2MB catalogs, 1.5MB names). provider.Pricer works the catalogs out once per provider (priceCats, kimiCodeMember included), and Prices gives a model its list price and its free mark from one listPrice. The names go into a stack buffer, userPrice skips its keys when the user set no prices and otherwise looks them up from a stack buffer without a copy, and PricedFree's plan filter copies the list only when a plan's catalog is in it. ListPrice and PricedFree keep their answers; they now share listPriceIn. Under the request's holds, two models priced went from 6 allocations and 10.5us to 0 and ~4us (213us to 4us outside a hold, where plugin.Cached stats plugins.json for each unpriced model). TestPricerAllocatesNothingPerModel: 0 allocations for a model, priced, at $0 or unpriced, under the holds; red (7) when Prices works the catalogs out per model again. TestPricedFreeIsTheProvidersOwnZero now also checks Pricer.Prices against ListPrice and PricedFree for every case, with and without the user's prices. Run on mote: go test ./internal/provider ./internal/gui ./internal/catalog ok; vet gui and provider for darwin and windows, provider for linux, ok. Real accounts (sandbox HOME copy), 40 asks paired twice with the build before: listPrice/PricedFree (~1.5MB a run there) no longer show in the profile; the totals are within the +-15MB run-to-run noise (95.7/90.5MB before, 97.0/98.4MB after). |
||
|
|
98c4b2e814 |
usage: a request opens on a page of its own
geesehowardt7 on X clicked a request on the Usage page to see where it came from. The click on its time opened Routing, which they hadn't asked for, and the row's details had no source address. A row's click, or Enter or Space on it, now pushes that request's own page (#ledReqPane, ledReqOpen/renderLedReq) over the list. The page gives the model and status, then ledDetail: time, agent, source IP (the previous commit's client_ip: loopback reads "This computer · 127.0.0.1", a gateway row from before the field "Not recorded", rows read from session files, other computers and magpie's own calls none), requested, provider, account, sent, served, effort, then status, error, duration, tokens, cost, credits, speed and the archive. Routing is the View routing link in it, and the time cell no longer links there. "Requests ‹" or Escape (not while a menu, dialog or field takes it) goes back to the list where it was left, with the row focused (ledReqClose). Leaving the Usage page closes it (ledLeave(true)), and a refresh keeps it. The in-table expanding row (ledOpen, tr.led-detail) and its narrow-window lc-opt copies are gone, since the page shows every field at every width. It slides in 200ms with the ease-out curve, and only fades with reduced motion. "Source IP" and "Not recorded" are added in zh, zh-TW, ja and de. The 20 ledger test files that opened a row's details now open the page. usage-request-page.test.cjs covers the page, the address, the way back, focus and a 560px window. docs/subsystems/gui-shell.md describes it. Run at this commit's tree (rebased on origin/main |
||
|
|
68865032c3 |
usage: a gateway row keeps the address its request came from, on this computer only
geesehowardt7 on X asked to see a request's source IP. No usage row
kept it.
Record.ClientIP (json client_ip) is set in appendUsage from peerAddr:
the connection's own address, never a forwarding header (the gateway
trusts none), so behind a reverse proxy it is the proxy's. Loopback is
127.0.0.1/::1. Rows kept before this, reported calls and magpie's own
calls have none. rowText packs it, or the ledger cache gave it back
empty (the cache's file is keyed on this package's source, so it is
rebuilt once).
It stays here:
- sync's OwnDays blanks it, as it does Archive and Computer;
- GET /v1/magpie/usage/requests (other computers, Remote magpie, key
holders) takes it out for every caller (withoutClientIPs);
- the CSV export, OTel and middleware points name their own columns
and don't carry it; telemetry sends ids only.
The window's /api/usage/requests keeps it for the Usage page.
Run (mote, at base
|
||
|
|
4894332d79 |
gui: the core scripts back under their budget after b3a57b3d8
|
||
|
|
f3d8a09d24 |
providers: another vendor's base isn't parsed to look for Tencent or OpenCode Go
The Providers page asks tencentPlanRegion and openCodeGateway of every
provider on each list. Both url.Parse'd every base, a heap profile of 40
/api/providers asks put 3MB of url.Parse there (2.5MB Tencent, 0.5MB
OpenCode). Every host either takes holds "tencentmaas.com" or
"opencode.ai", so a base without it (case folded; ToLower copies nothing
for an already lower-case base) returns at once.
TestOtherVendorsBasesAreNotParsed: 0 allocations for another vendor's
provider and base, and mixed-case Tencent and OpenCode Go bases still
resolve (ap-guangzhou, go). Red on the old code (3 and 1 allocations).
Run on mote at
|
||
|
|
682a1e3925 |
site: Gemini and Grok pages in en, zh and ja
New docs pages /docs/gemini and /docs/grok (with zh/ and ja/), each linked from every "By provider" line (the four agent guides, OpenRouter and Copilot in all three languages), sitemap.xml and llms.txt; llms-full.txt rebuilt. Gemini facts and their sources: - preset "google", AI Studio keys, models.dev google catalog (internal/provider/presets.go); Chat and native Gemini endpoints, only Gemini clients on the native API (provider/gemini_api.go). - thinking_config with include_thoughts, Gemini 2 budgets, xhigh/max sent as high (gateway/chat.go aiStudioThinking); a refused level is retried at the nearest one, a refused thinking_config falls back to reasoning_effort (gateway.go geminiRefusedLevel, refusesThinkingConfig). - thought signatures kept 90 days and returned only to their provider (gemini_sigstore.go sigKeep, gemini_signature.go); tool schema clean-up (gemini_schema.go); search only without function tools (search.go geminiKeySearches); per-minute 429s as rate limits (routing.go). - Vertex AI preset and options (provider/vertex.go, cli/providers_cli.go). - Code Assist and Antigravity worded as docs/subscriptions. Grok facts and their sources: - xai preset: Chat and Responses at api.x.ai/v1, Messages at api.x.ai (presets.go); Claude Code, Codex, OpenCode go as they are, Gemini CLI translated to Chat (provider.go Speaks, gateway.go usable). - fixes for xAI: xai_body.go, grok_schema.go (#2317), object_root.go (#1271), lone tool_choice (#378), additional_tools (#350), grok_integral.go (#1431), custom_tool.go. - effort fitting (decide.go fitFor), search (search.go), cache stickiness (affinity.go cacheWorth/cacheCold), errors (gateway.go tooLongRe, fallback.go shapeRefused). Grok Build's ~/.grok/config.toml (agent/grok.go). - The Grok subscription and its community plugin are left out on purpose. Run: mote-run `node --test worker.test.mjs install.test.mjs` in site/, 71 pass; JSON-LD of all six pages parsed with node on mote. Deployed (version f785815d) and curl-checked: all six pages 200, sitemap lists them. Not tried: no real Gemini or xAI request was made for this page; header names, vendor terms, free-tier numbers and xAI's own rate limits are left out because the source doesn't state them. |
||
|
|
954977d1a4 |
provider: the workspace-switch test's fake counts its asks under a lock (#5819)
LoginUsage reads every account at once, so TestCodexAppWorkspaceSwitch- ReadsEachWorkspace's fake handled ws-personal and ws-team together and wrote asked[ws]++ from two handlers unguarded. That is #5819's red ("workspaces read: map[ws-personal:1]", no per-account error: the team's reading was right, its count was lost) and, in the full run at |
||
|
|
b3a57b3d8f |
codex: turning the takeover off restarts the Codex app, so its ChatGPT projects come back
Herzz____ on X, the Windows Codex app: with Codex through magpie the sidebar's project list is empty; they use magpie only when their subscription runs out, and want to switch between magpie and the native sign-in with the projects whole each way. What happens. When the ChatGPT account is used up, magpie becomes Codex's provider (codex.out) without requires_openai_auth: on that account the app's composer gate greys Send for every model, magpie's too (#540). Checked again in ChatGPT.app 26.1029's bundle: the gate picks the account's own snapshot (limitName null) whenever it is blocked, before any per-model additional_rate_limits, so keeping the account during the takeover would still grey Send. The app-server then answers account/read with no account and the app hides its ChatGPT projects and chats ( |
||
|
|
547585cd9c |
gateway: memory answers the agents on this computer alone
/mcp/magpie/memory ( |
||
|
|
795cab91ff |
site: OpenRouter and GitHub Copilot pages in en, zh and ja
Two provider guides beside DeepSeek, Kimi, GLM, Qwen and MiniMax, at
/docs/{,zh/,ja/}{openrouter,copilot}, linked from each agent guide's
"By provider" line, from each other, the sitemap and llms.txt
(llms-full.txt rebuilt).
Facts come from source. OpenRouter: the preset's Chat and Anthropic
bases in presets.go, the relay path that sends Claude Code's requests
as they are, Messages for Claude models (MessagesFirst) so cache_control
survives, skipOpenRouterAnthropic for the model list, readOpenRouter's
credits, MaxRPM on free models and openRouterSharedPool, creditRest.
Copilot: device sign-in and the three read-only login sources
(copilot_accounts.go, copilot_cli.go), GHE.com hosts, /models and
copilot_refused.go, copilot_auto.go's pick and fallback, the plan names
(copilot_accounts.go: Free, Pro, Pro+, Max, Education, Business,
Enterprise), copilotSubscriptionUsage's windows, cacheWritesAlike.
Header names, GitHub's terms and env variables are left out.
Run: mote-run sh -c 'cd site && node --test worker.test.mjs
install.test.mjs': 71 pass, 0 fail. JSON-LD of the six pages parses.
Deployed (1a513b7d); the six pages answer with their titles.
Not tried: a real OpenRouter key or Copilot seat through the pages'
commands.
|
||
|
|
d3fc6f2bfa |
provider: FileError and groupsKeeping read providers.json's kept parse
Each Providers page asked FileError whether providers.json reads, and
groupsKeeping whether any group unlists models; outside a held request
both parsed the whole file again (6.7MB growslice of 112MB per 40
/api/providers asks on the real-account copy). Both now use the parse
filememo keeps until the file changes (storedFile); FileError falls
back to read() only when that parse fails, so a broken file still says
so with read's own error. Both are read-only uses.
Run: TestFileErrorReadsParsedFileOnce red with the memo path taken out
("parsed the file 3 more times"), green with it; TestFileError* and
the unlist tests on mote.
|
||
|
|
fda52fe5dd |
providers: the page finds each routing group's members once
providersState asked GroupFinder for a group's members once for every agent on that group, and again for the gateway's group list, and each ask built every member anew (a Member is 1408 bytes). groupsOnce keeps what was found for the page's build; the page only reads it. |
||
|
|
0ec28be0d4 |
provider: a look at the accounts for sign-in alerts is held, built once
signInStates ran twice every two minutes all day: once for the app's notification (WatchSignIns) and once for the gateway's hooks (tellHooksOfSignIns). Outside a request nothing is held, so each account's PluginOf built the plugins' list again (plugin.Cached reads plugins.json and the plugins' auth) and Logins read every login again. The look now holds the catalog (provider.Hold), as a request does, so each is built once a look. |
||
|
|
b3791e8a6a |
providers: the page's model, provider, preset and group-member lists are made at their size
/api/providers grew five lists by append, each of large elements: a group's members (Member, 1408 bytes) in membersFound, the picks a vendor list lacks (catalog.Model) in providerInfoWith, and the Providers and Presets lists of providersState. Each is now made once at its count. membersFound also clones a member's path and builds its key only after the checks that pass it over, and a group with no member found still gives nil. |
||
|
|
7c1dc198d1 |
usage: a turn over the Responses WebSocket counts what the socket was sent, and says so
A Codex turn kept on a Responses WebSocket sends only the new items as a
delta, but the row's ↑ was the whole HTTP body magpie built before the
transport ran, so a long conversation read as ~13MB up per turn
(matrix0487 on Discord). overSocket now records what each socket write
carried (wroteSocket) and, when the turn went out on the socket alone,
replaces the HTTP figure with those bytes (sentOnSocket); a turn that fell
back to HTTP keeps the HTTP body and adds any socket write made before the
fallback. errCodexSocketAgain's retry on a new socket counts both writes.
The row remembers that it went over the socket: Record.Socket (json "ws"),
packed as Flags bit 16384 (rowSocket, added to TestRowFlagsApart). The
Requests table's protocol badge says "Responses · WS" and the details'
Protocol line "Responses · WebSocket".
Run on mote at this commit (rebased on origin/main
|
||
|
|
b4a0a2a1ab |
cli: the Memory tab's routes wait for the library's stage of #4745
TestEveryRouteHasACommandOrIsNamed was red on this stack: the routes of /api/memory, /api/memory/distill and /api/memory/dream have no `magpie` command yet. They are the Library's Memory tab, so they are listed in notYet as L (stage 3: the library), as the other library routes are. Agents already reach memory without the GUI through `magpie mcp memory`. Run on mote: go test -count=3 -run TestEveryRouteHasACommandOrIsNamed ./internal/cli ok. |
||
|
|
eebb878977 |
cli: TestGroupSetID expects a renamed group's old id to find it
|
||
|
|
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.
|
||
|
|
408db02bf2 |
memory: the automatic model's empty note uses the core "No models"
370d2fd5f gave the Library plugin its own "no model" string, and internal/agent's antigravity_test.go says those words too, so i18n-keys' "a plugin's words are its own" went red. The note now uses the core "No models", which is already translated. Run on mote: i18n-keys 4/4, i18n-en-no-cjk 4/4 and library-memory 22/22, all with the P3 GUI change in the tree too. |
||
|
|
8c4c313eb7 |
memdistill: a nightly tidy of memory (Dreaming), undone in one step
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). |
||
|
|
0a08c37080 |
memory: Tidy merges and sets aside, Untidy undoes it
The store side of the nightly tidy (Dreaming). Tidy takes a plan: merges of memories that say the same thing, memories to set aside, and a date before which unreviewed distilled candidates are set aside. What the user wrote or pinned is never rewritten or set aside; merged with others it is the one kept, word for word, and two of them are never merged. A merge across scopes or of a memory no longer in use isn't done. Each change is returned with the states it replaced, and Untidy puts back only what is still as Tidy left it; a merged memory the user edited since stays. Run: mote-run go test -count=1 ./internal/memory: ok. Broken by hand: dropping the user/pinned guard on stale turns TestTidyNeverChangesTheUsers red; dropping Untidy's "still archived" check turns TestUntidyKeepsWhatTheUserChanged red (undo: 3). |
||
|
|
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.
|
||
|
|
60cd7367c2 |
memdistill: finished conversations proposed as memories to review
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. |
||
|
|
d61171d245 |
memory: a distilled memory the user threw away isn't proposed again
Distilling sessions (next) will propose candidates. One the user deletes or archives is remembered by its text (Dismissed, the last 1000), and a save from a conversation of the same text is skipped. An agent's own save of that text is still kept. A memory an agent forgot in a scope isn't proposed again in that scope. Run: mote-run go test ./internal/memory (ok). Broken by hand: Remove without dismiss, and Save without the Dismissed check, each red in TestDismissedNotProposedAgain; restored, green. Not tried: the distiller itself, which isn't built yet. |
||
|
|
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. |
||
|
|
a28744c325 |
gateway: memory is an MCP server every agent can mount
memory_search, memory_save and memory_forget at /mcp/magpie/memory, served and guarded as the search server is (serveMCP): another computer reaches it only while magpie is shared, with a gateway key. A save through it is active at once, origin agent, kept everywhere, for the project (the git repository the agent works in, by its remote) or for the agent alone; without a folder or a client name it says it can't know rather than guess. - The Library's market offers it as magpie-memory, run as `magpie mcp memory` (browsermcp.RunMemory): stdio relayed to the gateway with the folder it was started in (X-Magpie-Cwd) and the client name from initialize (X-Magpie-Mcp-Client). - Behind the MCP router the hub keeps it on this computer (hereOnly) and passes the caller's roots and client in _meta (wantsCaller), as it does for magpie's own server. - OwnMCPPath lists it among magpie's own servers. - Judged as its sibling servers are: a gateway key's MaxConcurrency doesn't hold it (a tool call of a turn already held), and a read-only key is refused (memory_save writes). The first full gateway run was red on TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute until the route was listed. Run (mote-run): - go test -tags nogui ./internal/gateway: ok (881.5s) - go test ./internal/browsermcp ./internal/cli ./internal/memory: ok - go test ./internal/library: ok (130.9s) - go vet, GOOS darwin, linux, windows: ok; gofmt -l clean Broken by hand, each red, then green restored: - the hub not sending memory its caller (wantsCaller without isMemory): TestHubTellsMagpieMemoryItsCaller "roots asked false" - the relay not setting X-Magpie-Cwd: TestMemoryBridgeSendsFolderAndClient - the gateway ignoring X-Magpie-Cwd: TestMemoryMCPSharedAcrossAgents (a project fact kept everywhere) Not tried: a real Claude Code or Codex mounting magpie-memory. |
||
|
|
79decfe71a |
library: the agents ticked for instructions are given memory's digest
The agents ticked under Library → Instructions get a "## Memory" part in
their instructions: the global memories, the agent's own, and each
project's under the folders it was seen in (memory.Digest), unless
Instructions.NoMemory. The digest changes only when published, so an
agent's instructions (and the prompt cache on them) change mid-session
only then: at once when the user changes memory (PublishMemory(false),
called by the GUI), and once a day from KeepLinked's loop for what
agents saved meanwhile (PublishMemory(true) -> memory.PublishDue).
PublishDue writes nothing while memory has never held anything, so a
user who never uses memory gets no memory.json.
Run (mote-run, whole worktree, with the rest of the memory layer):
- go test ./internal/memory ./internal/library: ok (library 130.9s)
- go vet ./internal/memory ./internal/library ./internal/gui, GOOS
darwin, linux, windows: ok
- gofmt -l: clean
Broken by hand (mote-run -run TestMemoryDigestInInstructions):
- memoryDigest's NoMemory check removed: red. It first stayed green,
since the test switched NoMemory on with memory.json deleted; the test
now gives memory back and sees the part return before switching it off.
- PublishDue's "nothing kept" guard removed: red ("a due publish with
nothing kept wrote memory.json").
Not tried: a real agent reading the digest in its instructions.
|
||
|
|
4f0c587306 |
memory: a store of what agents learn about the user, shared by every agent
The first part of the memory layer: internal/memory keeps memories in memory.json (lastgood + atomic writes under a file lock; a file that can't be read is unknown and never written over). Each memory has a scope (global, project:<git remote key>, agent:<id>), a kind (profile, preference, rule, reference, fact, procedure, episode), free tags, an origin and a status. Saving the same text in the same scope merges into the memory already there; an agent's save never changes the kind or why of a memory the user wrote or pinned. A project is keyed by its origin remote, so every clone and worktree of a repository shares its memories. Search is word-matched with CJK split into characters and pairs. The digest agents will be given is published on demand (a user's change, or once a day), never at an agent's save, so instructions don't change mid-session; its text names no app or vendor. Nothing uses the package yet: the MCP server, the Library's digest and the GUI come next. Run (on mote): go test -tags nogui ./internal/memory, -race -count=3, TZ=Asia/Shanghai; go vet for darwin, linux, windows; gofmt -l clean. Broken by hand: an agent's save allowed to change a user's memory (TestUsersMemoryNotChangedByAnAgentsSave red) and a digest computed live instead of published (TestDigestChangesOnlyWhenPublished red). |
||
|
|
e369d587c3 |
dsh: a round hashes dsh's files through a buffer, not read whole
dshFilesSum, which says whether anything a dsh round reads changed, read every profile's patch list, the home layer, settings, .env, keys and old config into memory with os.ReadFile only to hash them. Both dsh homes do a round every 30s at rest, and a patch list names every model magpie serves (39KB each in the real account here, two profiles), so each round allocated each file's size again. Now each file is streamed into the maphash through a pooled 32KB buffer (dshSumFile); the sum is the same as for the bytes written at once, so a round after the update still matches the one before. Measured on mote with a copy of the real accounts (acidle.sh, alloc between 60s and 180s at rest, the heap dump's own allocations left out): - t18 ( |
||
|
|
c02a491e87 |
provider: a Codex auth.json is parsed once for its bytes, not on every look
codexWho (email and workspace) and codexLoginIn's user and plan are read
from an auth.json's bytes alone, yet were a JSON parse and a JWT decode on
every call: codexName runs sameLogin over every saved account against each
other, and liveLogin("codex") is asked from four loops at rest
(loginsNow, rememberLogins, heldByCodex, renewLogins). Both now go
through authMemo, a map keyed by the bytes (a hit makes no string and
allocates nothing), emptied at 64 entries so tokens renewed every hour
don't pile up.
Measured on mote with a copy of the real accounts (acidle.sh, alloc
between 60s and 180s at rest):
- t17 (
|
||
|
|
9d4c338a67 |
gui: magpie web on a phone no longer scrolls sideways or keeps a band at its foot (#4943)
precis1onz (iOS Safari, dark, English, Usage) saw the page move sideways
and a dark band stay at the screen's foot.
- Sideways: Usage → Requests' "Split by" row (label and five choices) is
one unwrapped span, 393 to 558px wide at 375 to 430px. It was the only
thing wider than a phone in any view or language. On the phone layout
it now wraps inside the screen (app.css, phone block only).
- The band: the Requests table's stand-in scrollbar (#799) is sticky at
the view's foot, and a touch screen draws no bar in it, so it stood
there as an empty 12px band. ledHScroll now leaves it hidden on
(hover: none) and (pointer: coarse); a finger moves the table itself.
A desktop keeps it as before.
New test, phone-no-sideways.test.cjs: every view (Agents, Sessions,
Providers, Routing, Groups, Gateway, Library, Plugins, Masking, each
Usage tab, Settings' tabs) on an iPhone at 375 in en, zh, zh-TW, ja, de
and at 390 and 430 in en, in Chromium and WebKit, with long ids, emails
and paths; nothing may be wider than the screen and no empty band may
stay sticky at a view's foot. ledger-swipe now expects no bar on a
phone, and that the swipe moves the table.
Run (mote, through mote-run):
- phone-no-sideways: red on the old assets (
|
||
|
|
198c16d0c4 |
gui: a window set aside, counted of a total, takes a new cap of its own
9won on Discord: WorkBuddy's Credits and Extra credits (and the intl build's) could not be given a cap. The plugin sets those two aside (the account stops at "Total credits"), and |
||
|
|
c3f91f4496 |
i18n: de's fixed-amount cap tooltip names {window} as often as English does
40cbdaa7e's German for "{window} has a cap of its own: … used {n} of
{window}, until it renews" said {window} a third time ("bis {window} sich
erneuert"), so gui-de's "de has every zh string, with its placeholders and
tags" has been red on main since. It now says "bis es sich erneuert", as
the percentage cap's German beside it does, and "Klicken" as that one does.
Run on mote (macOS 27): gui-de and i18n-keys 7/7, TestCoreScriptBudget ok.
Red before: the same gui-de test failed on a clean origin/main
|
||
|
|
f2341e232a |
providers: the page says when subscription accounts are off, and leads to the switch
Subscription accounts (account discovery) are turned off in Settings ›
Privacy, and every subscription then stops working, but the Providers
page said nothing of it (the scattered settings audit after netube99 on
X). A line over the list, in the deprecation notices' quiet style, now
says they are off, with Settings › Privacy opening the switch, lit, and
Back to Providers. With MAGPIE_NO_ACCOUNTS set it says so instead. While
they are on there is no line. The core script budget is paid with three
comments cut, no raise.
Run on mote (macOS 27), Chromium and WebKit:
- new providers-discovery-off.test.cjs (every language, 1100 and 420
wide), account-discovery, i18n-keys, settings-back: 76/76.
- TestCoreScriptBudget and the app.js budget: ok.
- every file touching #movable (deprecated-subscriptions,
deprecation-notice, library-chip-fan, plugin-move, plugin-movable-review,
retired-move): green. plugin-move-unserved's "Try again takes the models
unticked" is red 4/4, the same 4 at a clean origin/main
|
||
|
|
0d99261dcc |
sessions: the page leads to Settings › Privacy's session history
Which agents' session history magpie reads is set in Settings › Privacy,
and the Sessions page it is about led there only through its first ask's
words (the scattered settings audit after netube99 on X). Its head now has
a Settings › that opens Privacy at those rows, lit, with Back to Sessions.
Gateway mode reads no agent's history and has no such rows, so no link.
Two things it found on the way:
- Privacy's session-history rows are drawn again when their read comes
back (loadSessionReads), which took the light off a row a link had just
lit; in Chromium it was gone before it showed. The redraw now keeps the
light on the row at the same place.
- The link takes ~70px of the head (en), and eight agents' tabs, which
fit a 1200px page (面条 on Discord), had 34px to spare. The search
now gives way to the tabs, down to its 110px least, before the agent
menu takes them; a narrow window's grid head is as before. The fit
watches the head, not the tabs' box the search's width changes, so no
ResizeObserver loop.
New test sessions-to-settings.test.cjs: the link's words, inside the head,
over nothing, the page fits; it lights Privacy's row; Back returns to
Sessions; none in gateway mode. Every language, Chromium and WebKit, at
1100 and 420 wide. sessions-toolbar now counts the link among the head's
controls that must fit.
Run on mote: every Sessions GUI file (13), gateway-conversations,
gateway-mode-sessions, i18n-keys and settings-back: 192 of 192.
Broken by hand: without the link, sessions-to-settings red; without the
redraw keeping the light, red in Chromium (timeout on the lit row);
without the search giving way, sessions-toolbar red ("a wide window keeps
the one-click agent tabs").
Not tried: the real app window.
|
||
|
|
8016b9fcad |
providers: the page counts the catalog instead of copying it
providersState read provider.Catalog() only for its length and its routing groups, and Catalog copies every listed model's Entry (1.6 KB each): catalogKeeping was 11.5MB of 128.5MB allocated over 40 asks of /api/providers on the real account. provider.CatalogGroups gives the groups (the caller's own copy) and the count Catalog would have, by the same Unlisted and group-unlisting rules, with no model copied. Measured on mote with the real account copy (aalloc.sh, 40 asks, alloc_space delta): 128.5MB (v0.1.3452) -> 115.4MB, -10%; 213.4MB before v0.1.3446. Run: go vet ./internal/provider ./internal/gui; go test -count=1 -timeout 45m ./internal/provider ./internal/gui (ok, ok) on mote. New TestCatalogGroupsIsCatalogs compares it with Catalog with no groups, a group listing alone beside an unlisted provider, and that group off; counting the unlisted models too, by hand, makes it fail in all three. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
8295db7d10 |
providers: hostOf shares hostnameOf's parsed URLs
|
||
|
|
a1f2c37ea8 |
gateway: a key's limit editor says Key limits is off and turns it on
A gateway key's limit is the Key limits built-in's (budget). With it
switched off, the editor under the key's row drew as usual, and Save was
refused with "turn the plugin on" without saying where (the scattered
settings audit after netube99 on X). The editor now has a line, shown
only while budget is off (data-feature-off), saying "Off in Plugins ›
Built-in" with a Turn on that switches it on in place; the line goes and
the editor stays open with its draft.
New test gateway-key-limit-off.test.cjs: off, the line shows inside the
editor with its words and the page fits; Turn on posts {id: budget, on:
true} once and hides it; on, it is hidden. Every language, Chromium and
WebKit, at 1000 and 420 wide.
Run on mote: gateway-key-limit-off 20 of 20; gateway-key-limit,
gateway-key-limits, gateway-key-cycle and i18n-keys 38 of 38.
Broken by hand: without data-feature-off the line shows when on, red;
without Turn on's call the line never goes, red (timeout).
Not tried: the real app window.
|
||
|
|
a09e967f53 |
providers: with no account removed, Hidden makes no account
Hidden read every sign-in (Accounts: Codex, plugins, Claude...) and then kept those the user removed. The Providers page asks it twice a poll (directly and through Excluded), and most users removed none; the real account has none, so ~0.6 MB a poll was made for an empty answer. It now looks at the saved file first and returns nil when nothing in it is hidden. Measured on mote with the real account copy, 40 asks of /api/providers (aalloc.sh, alloc_space delta): 169.8MB (v0.1.3447) -> 146.6MB, -14%. CPU for 30 asks (aeach.sh): 0.65s -> 0.56s. Run: go vet ./internal/provider; go test -count=1 -timeout 45m ./internal/provider ./internal/gui (ok, ok) on mote. New TestHiddenNoneMakesNoAccount fails with the check taken out by hand (254 allocations, its accounts 249) and checks a removed account is still listed. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
e9b8b1c83e |
gui: the core scripts back under their budget after b72256b59
|
||
|
|
b72256b599 |
gui: a Back in the title bar after a link into a setting, and a lit row keeps its corners
The owner (11-10): "点击设置链接跳转到设置页面之后,最好有一个返回按钮来返回到上一页,
类似于浏览器的返回按钮。" A link into a setting (openSettingsAt: the Usage
page's and Routing's Settings ›, the Gateway page's, a provider's, Plugins ›
Built-in's) and Plugins › Built-in's link to a page now leave a chevron
Back in the title bar, before the crumb (beside the sidebar) or after the
brand (the header's tabs), named "Back to {page}". It goes to that page:
the provider that was open, or Settings' tab and search. One step, like
a browser's first; going to another page by hand drops it. fitTop counts
it as the header's lead, so the tabs keep clear of it.
And (the owner, 11-10): "绿色边框的四个圆角会被切掉,这个很丑的". A lit row's
inset ring was square inside the list's rounded clip, so the first and
last rows lost their ring's corners. A lit row is rounded as the list is
inside its border (11px; 10px in the panel, whose lists have no border).
New test settings-back.test.cjs: Usage's Settings › lights the row with
rounded corners, Back shows with its name, fits, overlaps nothing in the
title bar, and goes back; Routing's the same; a page picked by hand drops
Back. Every language, Chromium and WebKit, 1100 and 420 wide.
The core's script budget pays for Back with five long comments in app.js
cut to a line each (Back's own, Built-in's rows, the refresh, its spin's
stop, a growing part's hold), no raise; TestCoreScriptBudget ok on mote.
Run on mote: settings-back, i18n-keys, settings-places, title-bar-tools:
53 of 54; the red is title-bar-tools' known WebKit flake (#2740, #4716),
red 1 run in 3 alone, the same at the base.
Broken by hand: without renderBack in show, settings-back red; without the
11px radius, red with row 0 vs list 11.
Not tried: the real app window.
|
||
|
|
1eebd1ff3c |
providers: a known maker price is answered without garbage too
|
||
|
|
b53f4e7c49 |
providers: a known price and a known hostname are answered without garbage
The Providers list asks the price memo for every model of every provider on each poll, and the hit built its key as a new string each time. The key is now built in a stack buffer and looked up through string(k), which Go doesn't allocate for a map index; it is copied out only when the price is new. hostnameOf parsed every provider's base URL with url.Parse on every poll; the hostname is now kept per URL (reset at 512). Measured on mote with the real account copy (aalloc.sh, 40 asks of /api/providers, alloc_space delta): 213.4MB at origin/main (t12), 186.9MB with this change (t13), -12%. CPU for 30 asks 0.64s -> 0.62s. Run: go vet ./internal/catalog ./internal/provider; go test -count=1 -timeout 45m ./internal/catalog ./internal/provider (ok, ok) on mote. New TestPricedOnceHitAllocatesNothing and TestHostnameOfKept fail on the old code (1 allocation each, broken by hand) and pass with it. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
a8aeb2cad2 |
usage: picked days can start and end at a minute
blrbrzkj on Discord asked to see usage from one time to another, not only whole days. The range menu has a start and an end time under its month (empty is the whole day; 9:30, 0930 and 09:30 all read 09:30). Picked with the days, the period is "2026-10-01T09:30..2026-10-01T18:00"; Enter applies new times to the days already picked. A time that isn't one, or an end not after the start on one day, is marked and asks for nothing. The opt says "Oct 1 09:30 – 18:00". The backend reads either end as a date or a date with its minute (usage.RangeOf, bounds); an untimed end is its next midnight. A timed range of 48 hours or less is drawn by the hour from the first's hour. CSV names drop the colons. Run (mote): node --test usage-range-times (new, chromium + webkit, en + zh), usage-range, i18n-keys, credit-days: 26/26 ok. go test ./internal/usage ./internal/gui ok (TestCoreScriptBudget fits, the periodDays comment cut to pay for its regex); gofmt clean; go vet native, GOOS=windows (usage, gui), GOOS=linux (usage) ok. Broken by hand: a timed end read as its day's midnight turns TestPickedMinutesArePeriod red. The page's own typedTime first clashed with app.js's hhmm and stopped the Usage page mounting; the GUI run caught it. Not tried: the real app with a real ledger; ja/de/zh-TW screens. Reported-by: blrbrzkj (Discord) |
||
|
|
f5a2edfd1c |
gui tests: a found group's old id reaches the group it was renamed to
|