Repository navigation
Description
Summary
On macOS, OpenCode (Rune) 0.0.0-dev-527 sits at 5.8 GB in Activity Monitor during normal use (screenshot below). The built-in perf recorder says the Rune UI process itself is small (resident_bytes 453,820,416, peak_footprint_bytes 607,307,576), so I walked the process tree of opencode-desktop: the app had 15 project locations booted at once, and each location was running its own copy of every configured MCP server — 14 × rea node processes (~245 MB each), 14 × npm exec rea-agents launcher shims (~85 MB each) and 14–15 codegraph process trees (~140 MB each; codegraph itself spawns two nested node processes per instance). That is roughly 6.6 GB of duplicate MCP child processes on top of a ~1 GB opencode-cli sidecar.
Environment
- OpenCode (Rune):
0.0.0-dev-527(packaged dev build, latest release; bundled CLI0.0.0-dev-1390-arm64) - OS: macOS 27.2.1 (26B131), Apple M2 Pro (10 cores: 6P+4E), 32 GB, arm64
- Shell: fish 4.9.3
- Client: desktop app, dev channel, packaged
- MCP config: 2 top-level entries in
opencode.json(codegraphplus aserversgroup) that expand to 4 stdio/remote servers:rea(rea-agents@6.7.0 via npx),codegraph,browse, and one remote HTTP server - Usage: 15 project folders with sessions/tabs in the sidebar
Reproduction
- Keep sessions open across ~15 project folders (they stay in the sidebar's recent sessions).
- Use the app normally for a couple of hours. Activity Monitor reports 5.8 GB for
OpenCode (Rune)after ~2 h. - Compare with the process tree:
ps -axo pid,ppid,rss,args, then walk the children of theopencode-desktoppid.
Observed breakdown (2026-12-03 16:05 CST, also in process-tree.txt)
| group | procs | avg MB | total MB |
|---|---|---|---|
rea mcp (node) |
14 | 245 | 3,434 |
npm exec rea-agents shim |
14 | 85 | 1,196 |
opencode-cli sidecar |
1 | 997 | 997 |
codegraph.js child |
15 | 58 | 867 |
codegraph serve --mcp |
14 | 42 | 589 |
codegraph native node child |
13 | 43 | 565 |
opencode-desktop (Rune UI) |
1 | 472 | 472 |
browse mcp |
1 | 3 | 3 |
| total | 73 | 8,122 |
RSS double-counts shared pages (Activity Monitor's footprint for the same tree was 5.8 GB), but the shape is unambiguous: ~470 MB Rune UI + ~1 GB sidecar, and ~6.6 GB in duplicate MCP servers.
Per-location cost is about 465 MB: rea 245 MB + npx shim 85 MB + codegraph ~140 MB.
Log evidence (sanitized 7-day excerpt attached)
server-1/opencode.log, 2026-11-27 → 2026-12-03:
- 16 distinct
directory=values, 15 of them project folders. location services booted181,location services evicted125,location services reloaded2 — evictions do happen, yet there were still 14 live copies of each stdio MCP server.mcp connected710 (rea 180, codegraph 180, browse 181, remote 169); 204 today alone. Each boot of a location connects a fresh set of MCP servers.- 4,572
watcher subscribeand 2,920watcher started/stopped— every location also carries its own watcher set.
Perf recorder (desktop/perf/*):
perf.json(this launch):resident_bytes453,820,416,footprint_bytes476,464,952,peak_footprint_bytes607,307,576; recent 60 s window p50work_ms2.1 / p95 8.4 — frames are fine, this is not the idle poll storm from perf(desktop): stop 30s wake_after echo chamber and idle poll churn #1692.- One
memory-growthincident: minute floors 355 MB → 374 MB → 454 MB → 463 MB → 482 MB (+127,139,840 bytes in ~5 min),"confidence": "suspected growth, not a proven leak". - An earlier launch (pid 86038) grew from 147 MB to 607 MB over 45 min before exiting.
- A fresh launch with no sessions stays around 150–275 MB, so the baseline is fine; the growth tracks the number of open locations.
Expected behavior
Memory should scale with the projects actually in use, not with the number of folders that have a session in the sidebar. A global stdio MCP server should be shared across locations, or spawned only for the active location, and its children should be reaped when a location is evicted.
Relation to #1649 / #2025
This is the same symptom as #1649 (Windows), on macOS and after the #2025 fix. #2025 removed the eager used_projects() attach loop, but on dev-527 every one of these 15 folders genuinely has a session, so per-location MCP spawning still multiplies into 14 copies of rea and codegraph.
If one MCP set per open location is intended, then either the MCP servers need to be shared across locations or the number of simultaneously booted locations needs a cap / more aggressive eviction — closing a location does not appear to free its MCP children today. Also note that each codegraph instance is a chain of three node processes (launcher → codegraph.js → worker), so one configured server becomes 3 processes per location; that is on codegraph, but it triples the per-location cost.
Attachments
- opencode-rune-macos-memory-20261203.zip (178 KB) — sanitized archive:
desktop/perf/perf.json,perf.log,perf-incident-*.jsonunchangedmanifest.jsonwith paths replaced by placeholdersserver-1/opencode.logreduced to lifecycle/perf messages (mcp, location services, watcher, cli, plugin reconciliation, event stream, migration, errors) — home directory replaced with/Users/<user>, project paths pseudonymised asproject-NN, commandargs=and credential-looking values redactedprocess-tree.txt(the table above) andSANITIZATION.md

Activity
perf(workspace): stop booting and keeping alive inactive project loca…
Hona commentedon Dec 3, 2026
Thanks for the detailed process tree and sanitized
server-1/opencode.log— they pinpointed the exact client-side triggers behind the 14 booted locations.Client-side fixes landed in
opencode-rune(PR #2281, commitfba4e73c1)In
server-1/opencode.log(runse6377687and4e446b39), only 1–3 open tab folders booted at launch, followed seconds later by a simultaneous 9–11 location boot burst within ~3 ms (withoutmcp client attached server=rune). Auditing all location-scoped HTTP/WebSocket paths inopencode-runeturned up five client-side paths that booted cold project folders or prevented/undid idle location eviction:/automationcapability probe (apps/desktop/src/surfaces/automations/source.rs,crates/opencode-kit/src/client/automations.rs): Opening Automations spawned parallelGET /api/command?location[directory]=<dir>requests for everyused_projects()folder, every open tab, and every automation row — matching the 9–11 simultaneous location-boot burst in the log. It now probes at most one already-warm location per server (the return tab or the server default""with nolocation[directory]query) plus the single selected automation entry's directory.runeclient MCP (features/workspace-tools/src/rune_mcp/mod.rs,apps/desktop/src/workspace/lifecycle/rune_mcp.rs): After perf(rune-mcp): attach client MCP only to active/open folders, not all sidebar projects #2025 removedused_projects(),sync_windowstill held a persistentClientMcpWebSocket for every open tab, booting every restored background tab's location on launch and immediately re-booting evicted locations via WebSocket reconnect. It now attaches only to the active routed session/draft and actively busy background tabs (family_busy).apps/desktop/src/surfaces/browser/rpc/suppression.rs):maybe_start_capability_probepickedapp.projects.first(), booting an unopened project for a server-wide capability check. It now probes the server's already-booted default (or active draft) directory.location.shutdownhandling (apps/desktop/src/surfaces/browser/rpc/comes_back.rs,apps/desktop/src/surfaces/browser/rpc/mod.rs,apps/desktop/src/session/events/mod.rs): Disposes idle, off-screen attachments with no active commands whenlocation.shutdownarrives soAttachMachinebackoff retries do not immediately re-boot evicted locations.features/files/src/watch.rs):watch::connectedpreviously re-armedPOST /api/experimental/fs/watch?location[directory]=...for every restored session's open file tabs. It now re-arms only the active session on connect/reconnect and re-arms off-screen sessions lazily inwatch::shown.Verified locally:
cargo check -j 1 -p opencode-desktop,cargo clippy -j 1 -p opencode-kit -p opencode-feature-workspace-tools -p opencode-feature-files -p opencode-desktop --no-deps, andpwsh scripts/guardrails.ps1(11/11). Not yet verified interactively on macOS hardware.What still lives upstream in
anomalyco/opencodeserverLeaving this issue open for macOS verification on the next dev build and because two core parts of the memory footprint live in the
opencodeserver sidecar (anomalyco/opencode):rea,codegraph, etc.) rather than sharing a single global server process across locations.location services evicted), nested child trees (such asnpxshims andcodegraphlauncher → worker chains) need to be terminated cleanly so evicted locations actually release memory.Once the next dev release includes #2281, please re-check Activity Monitor /
server-1/opencode.logon macOS and let us know whether the simultaneous multi-location boot burst and idle background-tab boots are gone.