Repository navigation
feat: Brain Map redesign — glass surface, connection-sized entities, rebuild from the whole account - #12878
feat: Brain Map redesign — glass surface, connection-sized entities, rebuild from the whole account#12878nathanchengx wants to merge 30 commits into
Conversation
45d2247 to
e6966b5
Compare
|
Ready for review. Verification before flipping from draft:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
All reported issues were addressed across 41 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…anup (#12891) (#12892) * fix(desktop): restore AutoCreatedTasksStep deleted by dead-module cleanup (#12891) desktop/windows/src/renderer/src/pages/Onboarding.tsx still imports and renders AutoCreatedTasksStep (step 14, wired in #12229), but 5701283 ("remove retired agent-runtime residue and dead-module clusters") deleted the component and its test, misclassifying it as dead. Any build or typecheck of desktop/windows on main has been broken since (`npm run build` runs `typecheck` first, so `build`/`build:win`/`build:linux`/`build:unpack` all fail before bundling), confirmed by PR #12878 hitting TS2307 when it touched that tree. Restore both files verbatim from 5701283^ (the last commit where they existed and matched Onboarding.tsx's usage). * docs(failure-class): register FC-reachability-cleanup-deletes-live-reference Companion to the fix in this branch: 5701283 deleted AutoCreatedTasksStep.tsx as "dead" while Onboarding.tsx still imported and rendered it, breaking desktop/windows typecheck and every build variant. No existing failure-class definition covers a cleanup's reachability scan missing a live reference, so this registers a new one per pr-preflight's failure-class-protocol.
`POST /v1/knowledge-graph/rebuild` used to read memories only and refuse
assertion-backed accounts with a 409. An account with two memories and
hundreds of conversations rebuilt into three dots.
- `utils/memory/brain_map_sources.py` turns conversations (title, topic,
summary, action items, events, transcript excerpt), memories, the people
directory and active goals into extraction payloads. Memories keep their
own ids; every other source is prefixed (`conversation:<id>`,
`people:directory`, `goals:active`) so clients know what they cite.
- Rebuild is open to every account: it replaces only the shared store and
never touches canonical assertions. `DELETE` keeps its gate.
- Graph reads merge the shared rebuilt store under the canonical first
page via `kg_db.merge_shared_graph_records`, canonical winning on
overlapping labels and citations.
- Rebuild progress is recorded at `users/{uid}/knowledge_graph_meta/rebuild`
and returned as `rebuild` on graph reads so a client can wait for the
rebuild it asked for.
Verification: `tests/unit/test_brain_map_rebuild_sources.py` (new),
`test_knowledge_graph_canonical_mutation_routes.py`,
`test_knowledge_graph_canonical_pagination.py`,
`test_knowledge_graph_legacy_fallback.py`, `test_bounded_firestore_list_reads.py`,
`test_memory_graph_assertion_read.py`, `test_knowledge_graph_rebuild_ordering.py`,
`test_knowledge_graph_delete_route.py`, `test_app_client_schema_inventory.py`
each pass run individually with pytest; `scripts/export_openapi.py
--surface app-client --check` up to date; `check_app_client_openapi_compatibility.py
--base-ref origin/main` passed.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…ccount The map now looks like the rest of the app and shows the whole account. Surface: - No black mat: the map sits on the panel's own glass, Ink resolving on the light ground like every other page. Edge, territory and node weights retuned for it. - No timeline footer, no replay or pop-in animation; the map is always complete. `MemoryAtlasPlayback` and the `memory_atlas_set_time` bridge action are gone. - No type colours: entities are monochrome glass circles (`MemoryAtlasGlassMark`); the inspector states the type in words. The legend is gone with them. - Rebuild is a plain button, not a three-dots menu, and narrates progress. - Catalog (memory-only) records are no longer drawn as unlabeled grey dots. Rebuild: - Tries the server first and waits for the rebuild it started using the new `rebuild` status on graph reads (up to ten minutes). - When the server refuses (409, 429, or no route), `BrainMapLocalRebuild` reads conversations, memories, people and goals through the API, packs them into at most 24 batches under the extract endpoint's hourly limit, extracts through `/v1/knowledge-graph/extract`, attributes citations by label, stores the result under `brainmap:` ids in the local knowledge graph store and merges it under every server read, server winning on matching labels. - The inspector resolves `conversation:` citations to the conversation's title and summary and opens the conversation; people and goals sources describe themselves. - The `memory_graph_rebuild` bridge action now presses the real button path and `memory_graph_snapshot` reports what the map shows. Verification: `swift test --filter 'BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap| DesktopAutomationSecondaryAction|GlassContentChrome'` — 208 tests, 0 failures (12 new in BrainMapLocalRebuildTests). Exercised in the omi-brain-map-redesign named bundle against the dev backend: Rebuild fell back to the desktop path after the server's 429 and rebuilt 236 conversations, 3 memories, 6 people and 2 goals in 17 batches into 246 entities and 280 connections, shown merged under the server graph. ViewExporter renders 16–19 checked on the light ground. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…es flow Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
pyright (reportUnnecessaryCast / reportUnnecessaryIsInstance) on the typed SharedKnowledgeGraph lists. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…n the duration guard routers/knowledge_graph no longer imports the LLM extractor eagerly, so the first test that touches utils.llm.knowledge_graph pays that module import (1.19s CPU); the guard's structural exception applies. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…ld status Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…d status Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…builds The Rebuild button used to carry a spinner and narrate each step. Now the old map fades under a minimal indeterminate bar with the words beneath it, no percentage, and the button simply dims until the rebuild is done. Steps still go to the log. A `20-brain-map-building` ViewExporter render covers the state. Verification: `swift test --filter 'MemoryAtlas|MemoryGraph|BrainMapLocalRebuild|ExternalPreviewBuild|MemoryHubBrainMap'` — 167 tests, 0 failures; ViewExporter index 12 rendered and checked. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The building state moves to the top right, in the Rebuild button's place: a thin bar that fills as the rebuild advances, "Building Brain Map" under it, no number, and the map underneath untouched. The desktop rebuild reports a real fraction (reading, then one batch at a time, then saving); the server path paces the bar against a typical rebuild's duration and completes it when the server reports the rebuild finished. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…p moves - A round viewfinder button left of the zoom pill returns the camera to the whole map. - Entity names, rings and territory captions no longer vanish for the length of every pan and zoom. The gesture still reuses the cached entity cohort; only positions move per frame. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Label budgets past overview were tuned for a wall of thousands of dots and held most names back until the last zoom level. They are now generous (neighbourhood 48, detail 110, focus 180, inspect 240 labels; per-cluster 16/40/96/200) so lower-ranked entities are named as soon as collision admission finds room beside them. The performance harness ceilings move with them; they bound the SwiftUI label overlay, which stays bounded. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The toolbar row sat above the canvas and cut the map off along the top, territories included. It now floats over the map's top edge, so the map owns the whole column and the search field and Rebuild control simply sit on it. The selection label ceiling in the performance harness moves to the detail-level budget introduced with the earlier-label change. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The canvas painted a dark disc under the account holder and the selection, and a small dot under every entity that also has a glass ring. Through the translucent glass those read as a shadow behind the person and a small bubble inside each big one, with the lines seeming to end at the small bubble. The ring is now the only mark for any ringed entity; the canvas dot is drawn only for entities without one. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
… ground Captions are 8pt tracked caps with a thin capsule rule and no fill, and no hover state: they are part of the map, not chips. Placement keeps them inside their zone (the off-coast fallback now applies only once the user has gone into a place) and prefers ground with no entity mark under it. Entity names stay hard blockers; marks are a preference, because a territory that cannot be named loses its outline too, and on a real account the strict version emptied the map of zones. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…re-solving it Dragging and zooming the Brain Map re-solved caption placement every frame: every candidate spot against every entity name and mark, twice, for every island, plus the inland tests against each coastline. Under a gesture nothing about that solution changes except where it is on screen, so the layer solved with the camera at rest is now kept on the render-plan cache in map coordinates and projected per frame; it is re-solved when the camera settles. The glass marks also lose their blurred shadow, which was the next most expensive thing drawn a couple of hundred times per frame for a cue invisible at that size. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
A 28pt fade instead of a hard clip, so the map reads as continuing under the chips rather than cropped by them. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…ction Territories came and went with the camera: hidden at inspect zoom and on any selection, capped at eight, dropped whenever their caption found no room, and dropped below 26pt on screen. Every island on screen is now drawn at every zoom level and with any selection; the caption budget is gone; a caption that finds no clear spot takes the least-crowded one, and an island whose name still cannot be placed keeps its ground unnamed. The visibility test moves with the rule: the redesign asked for the ground to stay, so hiding it is the regression now. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The blurred influence field could leave a lobe or sliver of land past a group's last member, and a lake traced inside an island came back as a ring of its own; both drew as a zone with nobody in it. A coastline ring that holds none of the group's members is now dropped where coastlines are built. Regression test: a ring of members keeps its island and every island it gets holds a member. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Territories are off behind `drawsTerritories`. What matters about an entity is now its size: rings and canvas dots scale by the square root of the entity's connections (capped, so a hub is a landmark and not a planet), the account holder is fixed at landmark size, and a selection is drawn a step larger. Cluster rank no longer decides size. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…egacy conversations in the rebuild Review round on #12878. The rebuild call now returns a `rebuild_id`; every status write carries it and is skipped when a later rebuild owns the status document, so an earlier rebuild finishing cannot turn a running one into "complete". Status reads and writes are best effort: a meta-document failure neither fails a graph read nor the rebuild that already ran. The canonical first page reports `shared_truncated` when the shared store was cut at its read bound, since no later page carries what was cut. A shared edge over a canonical relationship keeps the canonical edge id. Conversations are read with `include_discarded=True` and filtered in Python, so rows written before the field existed are not dropped by the store's equality filter, and `get_conversations` names every row by its document id. Verification: pytest on test_brain_map_rebuild_sources (6), test_knowledge_graph_canonical_mutation_routes (21), test_knowledge_graph_canonical_pagination (17), test_knowledge_graph_legacy_fallback (4), test_knowledge_graph_rebuild_ordering (4), test_bounded_firestore_list_reads (17), test_knowledge_graph_delete_route (2), test_app_client_schema_inventory (12); all pass. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…uild_id and shared_truncated `backend/scripts/export_openapi.py --surface app-client --write`, then generate_dart_models.py (misc) and generate_ts_openapi_types.py for the four TypeScript clients. The Swift DTOs do not carry these schemas. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…e and waits for its own server rebuild Review round on #12878, the rebuild path. The desktop rebuild reads every source under the pinned authorization and fails, leaving the previous map untouched, when a source cannot be read or a batch still fails after its one retry; before, unreadable sources were skipped silently and a partial extraction replaced the map. Edge citations are persisted (`memoryIdsJson`, migration `addLocalKGEdgeCitations`), node ids hash the normalized label so labels that only slug alike stay distinct, and rows the file indexer or a chat tool save under the reserved `brainmap:` prefix are moved off it. Waiting for a server rebuild now matches the `rebuild_id` the call returned, or on a server without ids requires the rebuild to have both started and finished after the request, so an earlier rebuild ending is not taken as this one's. Graph reads are numbered and shown only if nothing later has been shown, so a refresh overlapping a rebuild cannot put the old map back. The `memory_graph_rebuild` bridge action is acknowledged synchronously by the mounted surface (no receiver is reported as `no_receiver` rather than `posted=true`) and, with `wait_seconds`, waits for the outcome and reports the path taken and the resulting counts; the dead `inline` target is gone and e2e S8b asserts on the outcome. Verification: swift test --filter "BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|DesktopAutomationSecondaryAction|GlassContentChrome|KnowledgeGraph" (233 tests, 0 failures); pinned swift-format lint clean. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…only; islands keep inhabited lakes Review round on #12878, the atlas surface. Catalog records are excluded from hit-testing and from every zoom and label policy sized by the map (`MemoryAtlasSnapshot.entityCount`). The people and goals sources in the inspector are plain statements rather than rows that pretend to open something. Territory caption placement scores each candidate once over the marks that can touch it instead of inside the comparator. An island ring holding none of its group's members is kept only as a lake inside one of the group's islands where another group lives, so the hole survives even-odd fill; the islands test now proves the tracer produced a lake before the rule removes it. `ViewExporter.standaloneViewCount` matches its 13-entry registry, with a test, and the unused `atlasSource()` test helper is gone. Verification: swift test --filter "MemoryAtlas|ViewExporterRegistry|DesktopAutomationSecondaryAction" (0 failures); pinned swift-format lint clean. Failure-Class: none Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…n waiter and the rebuild outcome out of oversized files The product-file line-count ratchet flagged the base bridge file, the atlas view model and RewindDatabase. The Brain Map actions now live in DesktopAutomationBridge+MemoryAtlas.swift (the flow lint and the registry tests glob every DesktopAutomationBridge*.swift), NotificationWaiter is its own file, the rebuild outcome type sits with the rebuild in BrainMapLocalRebuild.swift, and the local_kg_edges citations migration is registered through LocalKGSchema next to the knowledge-graph store. Verification: swift test --filter "BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|DesktopAutomationSecondaryAction|GlassContentChrome|KnowledgeGraph|ViewExporterRegistry" (236 tests, 0 failures); pinned swift-format lint clean. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…rebuild-sources test The fast-unit duration guard charges a test's first heavy import to that test; importing `database.conversations` at collection keeps the reader test at 0.0s of call-phase CPU instead of 0.51s. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
e6966b5 to
22efe52
Compare
|
Reviewed the Brain Map redesign end to end — this is substantial, coherent work, and the account-wide rebuild directly addresses the "three dots" problem of rebuilding a whole account from its memories alone. The engineering care shows; a few things I verified:
Two minor observations, neither blocking: (1) write_knowledge_graph_rebuild_status is read-then-write rather than transactional, so two rebuilds finishing concurrently could interleave once — cosmetic, status-only. (2) Every first-page graph read now also loads the shared store and the assertions fence; bounded, but it is extra reads on a hot path, and a full-account rebuild is now up to ~700 extraction calls (vs ~500 memories before) — worth a glance at LLM spend per rebuild. Automation/agent-facing note: this PR changes the desktop automation surface and CI guidance that agents consume — backend/tests/fast_unit_duration_allowlist.txt adds one narrowly-scoped slow-test entry (accurate: the router now imports the extractor lazily), the memory_graph_rebuild bridge action now drives the mounted surface with a wait_seconds param and a no_receiver outcome instead of calling the API directly, and memory_atlas_set_time is removed with the timeline. The new contracts are documented in the registry and pinned by DesktopAutomationSecondaryActionTests, BrainMapLocalRebuildTests, and e2e flow S8b, so the guidance agents see stays accurate — but any external automation calling the removed/changed actions will need updating. Leaving for human maintainer review rather than approving: this needs a product direction decision on the redesign itself (the timeline/replay and territory zones are removed, and the map's visual identity changes substantially), and maintainer sign-off on the relaxed rebuild gate plus the desktop-local rebuild fallback. Both are exactly the kind of judgment the automation shouldn't make alone. The technical implementation, in my reading, is sound. Thanks @nathanjcx — genuinely impressive PR. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Addendum to the earlier automated review of this head — it covered the rebuild invariant, merge semantics, and desktop rebuild path end to end, and nothing here changes its conclusion. Two smaller findings from a second pass that it did not cover, both in the desktop fallback rebuild, both non-blocking:
Neither blocks merge in my reading; both are worth a maintainer decision alongside the product-direction call on the redesign itself and sign-off on the relaxed rebuild gate. — automated addendum on behalf of David (Git-on-my-level); the open maintainer decisions are the Brain Map product direction, the relaxed rebuild gate, and locked-conversation parity in the desktop fallback. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
… document The rebuild status fence refused every write whose rebuild_id differed from the document's, so once a first rebuild had finished, a second rebuild's running claim — and then its complete — were both dropped. The document stayed on the first rebuild's id forever, and a desktop waiting for the rebuild it started polled to its ten-minute budget and reported failure even though the rebuild had succeeded. The fence now protects exactly what it documented: a rebuild starting always claims the document (which also recovers a rebuild that crashed leaving running behind), while a finish only lands while the document still belongs to that rebuild — an earlier rebuild finishing still cannot turn a later one's running into its own complete. Verification: backend/.venv/bin/python -m pytest backend/tests/unit/test_knowledge_graph_canonical_mutation_routes.py backend/tests/unit/test_brain_map_rebuild_sources.py backend/tests/unit/test_knowledge_graph_legacy_fallback.py backend/tests/unit/test_knowledge_graph_rebuild_ordering.py backend/tests/unit/test_knowledge_graph_canonical_pagination.py backend/tests/unit/test_knowledge_graph_delete_route.py backend/tests/unit/test_knowledge_graph_extract_route.py backend/tests/unit/test_knowledge_graph_extract_helper.py backend/tests/unit/test_canonical_graph_state_probe.py — 76 passed; the three new fence regression tests false-failed against the old fence. Failure-Class: none
…e-laying-out the entity overlay every frame The redesign kept the SwiftUI entity overlay (glass marks, name labels, hit targets) mounted during pan and zoom, where the pre-redesign atlas dropped it for the length of the gesture, and roughly doubled the label budgets behind it (12/24/36/72/96 became 12/48/110/180/240), so every gesture frame repositioned up to a few hundred composed views. Scroll-wheel zoom never flagged the camera as moving at all, so every scroll tick re-ran the full planner over the whole graph (one pass measures ~13ms CPU on the 2,400-node production-scale fixture) and re-admitted labels, rebuilding the overlay mid-scroll. Mid-gesture on an unemphasised map — the same inputs that admit the cached render plan — the Canvas now paints the cohort's marks and admitted names itself, and the SwiftUI overlay returns the moment the camera rests and the settled plan re-admits it. A selection or search keeps the overlay up: emphasis is the point of those states, and their gestures bypass the plan cache anyway. Scroll bursts now count as camera movement and settle 0.3s after the last tick, so a burst plans once per detail band instead of once per tick. Measured layer: planner CPU on the synthetic fixture (debug build); the overlay's frame cost is reasoned from the render path, and framerate on a real 1,500-node account was not measured. Verification: xcrun swift build -c debug --package-path Desktop; xcrun swift test -c debug --package-path Desktop --filter "MemoryAtlas|MemoryGraph|BrainMap" (177 tests, 0 failures, including the new overlay-gating harness test and the gesture-cache work-budget tests); pinned swift-format lint clean; SwiftLint 0 violations; desktop test-quality ratchet at baseline.
|
QA evaluation of this PR (stacked with the other beta-candidate PRs) surfaced two issues; pushed two fix commits on top of your branch as maintainer (your commits are untouched — nothing rewritten):
Line-count exceptions you'd already added to the PR body were left as-is. Happy to hand either root cause back if you'd rather take the fix a different way — everything is additive, revert with two reverts. |
|
Reviewed this end to end — this is a genuinely cohesive piece of work: the macOS Brain Map redesign and the whole-account rebuild that feeds it, with strong tests on both sides (the fenced rebuild-status race, the canonical-wins merge, the citation prefixes, and the bridge acknowledgement contract are all pinned by tests; every backend suite, shard, and hermetic gate is green). On the three red required checks — I dug into the logs, and none of them is caused by this diff:
Things I'd want a maintainer to sign off on before merge (beyond the CI situation):
Leaving for human maintainer review (product direction on the redesign itself — dropping the timeline replay, territories, and type colours — and the rebuild-route decisions above). Thanks for the unusually thorough test suite on a change this size. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…22078) Mobile Mind Map can show an empty screen because the compatibility graph omits saved-memory catalog records and later canonical pages. Read the canonical catalog when the compatibility view is empty or owner-only, keep memories without relationships readable, and provide Refresh / Show More without attempting the rejected canonical rebuild. Existing nonempty compatibility/shared graphs remain visible, including the projection proposed in #12878. Canonical pages remain revision-fenced and session-bound. Stale cursors restart at page one, late refresh responses cannot replace newer data, label changes render, backend/session changes and rejected authorization clear old data, and failed ordinary refreshes preserve same-session content. Expired cursors discard the invalidated revision before retry, including if that retry fails. The canvas keeps a 200-entity bound and fitted small maps retain readable labels. Catalog records remain separate from graph entities and never create relationships. Onboarding skips the legacy mutation after a successful canonical read. Initial compatibility failures stop without a second expensive graph read; each read retains zero transport retries. The loopback regression fixture uses a stable backend override and the existing token-I/O seam so session fencing remains enabled. The backend adds an absence-only response header so a genuinely new account can show an empty state while an unreadable canonical revision remains a retryable failure. The existing HTTP status/body stay compatible. Refs #20481, #20463. Complements #20744; this PR is independent of #12878's broader macOS/account-wide rebuild work. It does not assert that affected accounts have eligible Long-term memories or that missing assertions/data have been repaired. ## Validation - Canonical backend service/FastAPI route suite: 17 passed. - Final focused Flutter HTTP/error/widget/layout suites: 49 passed, including real loopback HTTP gateway retry bounds, authorization/backend changes, stale cursor restart failure, label refresh, viewport fitting and bounded large pages. - Visual audit passed: empty, saved-memory catalog, and later-page graph states. Inspected captures; recovered graphs now fit the viewport with readable, separated labels. - Focused analyzer reported no errors/warnings (pre-existing informational lints remain). - App-client schema inventory: 13 passed; explicit endpoint URLs retain contract discovery while requests stay pinned to their backend. - Normal pre-push gate passed without skip flags on `2d70dcd229`: all 41 shared preflight checks, backend typecheck (0 errors), runtime-image source closure, selected backend tests, OpenAPI compatibility, generated Dart/Swift/TypeScript models, Flutter build_runner and Dart formatting. The [final Mobile App Checks run](https://github.com/BasedHardware/omi/actions/runs/39102810940) passed, including the analyzer ratchet, regular Flutter suite, generated files and Mobile Release Eligibility. Native compile/emulator and seeded-journey jobs were not selected for this Dart-only diff; physical-device/store verification remains pending. Commands: `cd app && flutter test --no-pub test/unit/http_pool_manager_retry_test.dart test/unit/knowledge_graph_read_test.dart test/unit/knowledge_graph_error_message_test.dart test/widgets/memory_graph_empty_state_test.dart test/widgets/memory_graph_fit_to_bounds_test.dart`; `cd backend && .venv/bin/python -m pytest tests/unit/test_knowledge_graph_canonical_pagination.py -q` (includes the FastAPI request path) and separately `tests/unit/test_app_client_schema_inventory.py -q`. Focused `flutter analyze --no-pub --no-fatal-infos` covered the changed API, graph/catalog widgets, identity helper and tests. The [backend CI run](https://github.com/BasedHardware/omi/actions/runs/39102810914) passed five unit shards and the slow guardrails on its first attempt. Shard 1 passed its assertions but hit an unrelated CPU timing guard (`test_capture_evidence_admission.py`: 1.03s against 1.00s); all four tests in that file also passed locally under the unchanged 1.00s limit. Only failed jobs were retried on the same commit, with no budget or allowlist changes. ## Release and customer verification Merge, deploy the backend absence header first, then release iOS and Android. Retest on physical phones with affected accounts: open Mind Map, verify saved memories or relationships, load more, refresh/reopen, and confirm onboarding no longer attempts a canonical rebuild. If still empty, privately check memory eligibility, processing and assertion state. No customer account or production records were accessed. Public store release evidence checked 2026-10-18: [App Store iOS 1.0.558+ notes](https://apps.apple.com/us/app/omi-smart-meeting-notes/id6502156163) and [Google Play notes (updated October 15)](https://play.google.com/store/apps/details?id=com.friend.ios&hl=en_US) both explicitly list the canonical knowledge-graph 409 onboarding fix from #20744. This supports public release on both platforms. The exact Android binary/source SHA and rollout coverage have not been verified through Codemagic; the available login has no Omi workspace access. Release of that error handling does not establish that an affected account has a populated map. ## Product invariants affected - INV-MEM-1: existing memory tiers and eligibility remain unchanged. - INV-MEM-4: read-only client recovery; no new promotion or graph mutation authority. Failure-Class: FC-derived-state-gate-without-legacy-source-path The canonical presence/absence probe must preserve the compatibility path for unprovisioned accounts while rejecting unreadable state as empty. Backend route and mobile HTTP/widget tests guard both sides. ## UI evidence   
Onboarding still treated a failed Mind Map read as an empty legacy account and sent a rebuild POST. This could turn a canonical read outage, invalid response or replaced account session into an unnecessary/rejected mutation. The optional prebuild now stops on read failure; the normal map view retains its read/retry path. The orchestration moves from the widget to `KnowledgeGraphApi.prebuildForOnboarding`, which uses the existing production reader, rebuild and polling owners. Successful canonical reads and populated compatibility maps never rebuild. A positively absent canonical account can still use legacy rebuild; 409 remains terminal and a queued legacy rebuild retains bounded stability polling. No server guard, memory promotion, storage, auth policy or wire schema changes. Refs #20481. The issue discussion by julio23jaz-dotcom also identified this catch-and-rebuild path. Builds on merged #20744 and #22078; #12878 is closed unmerged and is not a dependency. This finishes the reproduced failed-read onboarding gap, not a claim about every affected account's current graph. ## Verification - Six regressions fail after a behavior-preserving extraction of the original catch-and-rebuild method; seven successful/legacy scenarios still pass. With the fix, all 13 pass through the real HTTP client against loopback (synthetic responses and the existing local auth gateway; no live identity provider). - Focused graph/API/widget/identity suite: 88 passed. - Analyzer ratchet: passed. Direct analysis reports only the existing `avoid_print` in unchanged stability polling; no new diagnostic. - Final diff reviewed; all 27 local manifest checks and the bounded pre-push gate passed. The local history-dependent 90-day class ratchet explicitly skipped on the shallow checkout; CI runs with full history. Exact-head CI remains pending; stays draft. - `make mobile-verify ARGS="fast --paths app/lib/backend/http/api/knowledge_graph_api.dart app/lib/pages/onboarding/wrapper.dart"`: both selected hermetic journeys passed (9 checks; source `43866f9f0032844e08902aa01f41ce390cc6ef14`, clean). The loopback flow exercises the entire changed orchestration boundary, including parsing, read failures, account replacement, no-write outcomes, terminal conflict and successful legacy polling. No UI layout, native or hardware behavior changes; no physical-device test is needed for this boundary. ## Failure class Failure-Class: new `FC-failed-probe-permits-mutating-recovery`: a failed probe was caught and reinterpreted as permission to mutate. Why isn't this a shared primitive instead? It is: the API owner now holds the prebuild flow, and its loopback contract tests are the reusable prevention artifact rather than a widget-specific source check. ## Release and customer follow-up Merge and release the mobile update on iOS/Android. No additional backend deployment is required for this incremental fix. Existing canonical-read backend support from #22078 remains required and was previously verified deployed. Keep support tracking open until the affected users confirm their map loads and remains available after refresh/reopen on the released build. No customer data, assignment, deployment or account mutation was performed. UI-Evidence: none The widget only delegates its existing optional background request; no visible control or layout changes. ## Product invariants affected none; canonical read/mutation and promotion authority are preserved (INV-MEM-1, INV-MEM-4).
What this is
The macOS Brain Map redesigned, and rebuilt from everything the account knows instead of memories only.
Surface (macOS)
MemoryAtlasPlaybackand thememory_atlas_set_timebridge action are removed.MemoryAtlasGlassMark); the inspector states the type in words. The legend goes with them.drawsTerritories; instead every entity's ring and dot scale with the square root of its connections, capped, so hubs read as landmarks. The territory code is retained behind the switch (entering a region still frames it).20-brain-map-buildingrender).Rebuild from the whole account
POST /v1/knowledge-graph/rebuildreads conversations (title, topic, summary, action items, events, transcript excerpt), memories, the people directory and active goals (utils/memory/brain_map_sources.py), is open to every account, replaces only the shared store, never touches canonical assertions, and records progress atusers/{uid}/knowledge_graph_meta/rebuild. The call returns arebuild_id; every status write carries it and a finished rebuild never overwrites a later rebuild'srunning. Graph reads merge the shared store under the canonical first page (kg_db.merge_shared_graph_records, canonical winning, canonical edge ids kept) and returnrebuildstatus plusshared_truncatedwhen the shared store was cut at its read bound. Status reads and writes are best effort: a meta-document failure neither fails a graph read nor the rebuild. Conversations are read withinclude_discarded=Trueand filtered in Python, so rows written before thediscardedfield existed are included, andget_conversationsnames every row by its document id.DELETEkeeps its 409 gate.rebuild_id(or, on a server without ids, by a rebuild that both started and finished after the request), up to ten minutes. When the server refuses (409, 429, or no route, which is what the deployed dev backend answers today),BrainMapLocalRebuildreads the same sources through the API under the pinned authorization, packs them into at most 24 batches under the extract endpoint's hourly limit, extracts through/v1/knowledge-graph/extract(one retry per batch), attributes citations by label, and stores the result underbrainmap:ids in the local knowledge-graph store, edge citations included, merged under every server read. The map is replaced only by a whole one: a source that cannot be read or a batch that fails twice leaves the previous map untouched and reports why. Rows the file indexer or a chat tool save under the reserved prefix are moved off it. A graph read is shown only if no later read has been shown, so a refresh overlapping a rebuild cannot put the old map back.conversation:citations to the conversation's title and summary and opens it; people and goals sources are shown as plain statements, not openable rows.DesktopAutomationBridge+MemoryAtlas.swiftand the genericNotificationWaiterto its own file (the base bridge file is under itsmainsize); the rebuild outcome type lives inBrainMapLocalRebuild.swift.memory_graph_rebuildbridge action is acknowledged synchronously by the mounted surface (so no receiver is reported as such) and, withwait_seconds, waits for the outcome and reports the path taken (server/local) and the resulting counts; e2e S8b asserts on those.Known limits
drawsTerritoriesat the user's direction and retained because entering a region still frames it; its placement cost and ring handling were fixed in review regardless.MemoryGraphPageuntouched (still dark mat) for accounts not on the canonical atlas.Line-count exceptions
Line-Count-Exception: backend/database/conversations.py | 2324 -> 2331 |
get_conversationsnames each row by its Firestore document id (review P0 on the rebuild reader); seven lines in the one reader the Brain Map rebuild uses, matching the sibling readers that already do thisLine-Count-Exception: desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift | 3630 -> 3631 | one-line registration of
LocalKGSchema.registerMigrations; thelocal_kg_edgescitations migration itself lives with the knowledge-graph storeFailure class (fixes)
Failure-Class: none
The
fix:commits here correct behaviour introduced earlier on this same branch (single mark per entity, zones vanishing with the camera, empty zones, the toolbar clipping the map, the missing Rebuild fallback on 429); none is a regression that shipped.Product invariants affected
INV-AUTH-1:
RewindDatabase.swiftchanges by one line, registering thelocal_kg_edgescitations column migration throughLocalKGSchema; no session, owner-transition or per-owner storage behaviour changes. The desktop rebuild reads under the pinnedRuntimeOwnerAuthorizationSnapshotand writes throughLocalMutationAuthorization, as before.INV-MEM-4: canonical promotion stays the sole Long-term authority. The rebuild writes only the shared-graph projection (
knowledge_nodes/knowledge_edges), a retryable derived view; assertions andmemory_stateare never read for gating nor written. INV-MEM-1: no tier vocabulary changes; memory sources are read throughMemoryService.read.Review round (cubic, 26 findings)
Every finding was addressed in code, with a test where behaviour changed: rebuild ids and fenced status writes;
finished(since:)requiring the rebuild's own id or start time; no local commit after a failed read or batch (with one retry);shared_truncatedon the canonical route; exporter count 13 with a registry test; caption placement scored once over prefiltered marks; bridge acknowledgement/outcome instead ofposted=true; reservedbrainmap:prefix relocation; non-openable people/goals sources;include_discarded=Trueplus document ids; the islands test now proves a lake exists before the rule removes it, and lakes another group lives in stay holes; canonical edge ids preserved on merge; memories read under the pinned authorization; edge citations persisted (memoryIdsJson, migrationaddLocalKGEdgeCitations); hashed node ids; catalog placements excluded from hit-testing and from policy counts (entityCount); a monotonic publish guard on graph reads; best-effort status reads/writes; S8b asserts the fallback's outcome; the unused test helper and the deadinlinetarget removed. The territory layer being off is intentional (see Known limits).Verification
Backend (each file run individually with pytest, py3.11 venv):
test_brain_map_rebuild_sources.py(6),test_knowledge_graph_canonical_mutation_routes.py(21),test_knowledge_graph_canonical_pagination.py(17),test_knowledge_graph_legacy_fallback.py(4),test_bounded_firestore_list_reads.py(17),test_knowledge_graph_rebuild_ordering.py(4),test_knowledge_graph_delete_route.py(2),test_app_client_schema_inventory.py(12) — all pass.scripts/export_openapi.py --surface app-client --checkup to date; Dart/TS clients regenerated from the snapshot.Desktop: full package suite (
swift test --package-path Desktop) run before marking ready: every suite green except twoJITProactivityRuntimeTestscases that fail only in the full run and pass in isolation (35/35); that code is untouched by this branch (recent main commits #12798/#12817) and the failures are order-dependent. After the review round the focused suites (BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|DesktopAutomationSecondaryAction|GlassContentChrome|KnowledgeGraph|ViewExporterRegistry, 233 + 90 tests) pass. Pinned swift-format lint clean;make preflightrun locally before the push.Real path: in the
omi-brain-map-redesignnamed bundle against the dev backend, Rebuild fell back to the desktop path after the server's 429 and rebuilt 236 conversations, 3 memories, 6 people and 2 goals in 17 batches (0 failed) into 246 entities / 280 connections, shown merged under the server graph and surviving a relaunch. ViewExporter renders 16–19 checked on the light ground.🤖 Generated with Claude Code
https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao