Skip to content

fix: index Cursor transcript lookups - #2

Draft
Alex793x wants to merge 2 commits into
mainfrom
fix/memdev-45-cursor-key-scans
Draft

fix: index Cursor transcript lookups#2
Alex793x wants to merge 2 commits into
mainfrom
fix/memdev-45-cursor-key-scans

Conversation

@Alex793x

@Alex793x Alex793x commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Cursor capture repeatedly scanned the entire SQLite key-value table when loading composer metadata and each conversation's bubbles. On the populated Mac used for MEMDEV-45, the Cursor database is approximately 11 GB. Use bounded ranges on its existing binary key index so capture can seek directly to each prefix.

The regression tests enforce bounded query work with 10,000 unrelated rows and cover literal wildcard characters and adjacent conversation prefixes. No platform scheduling or model behavior changes.

Validation:

  • Both bounded-work regressions fail on the previous queries and pass with this fix.
  • 179 adapter tests pass locally. The 35 Cursor tests pass on Windows, Linux and macOS CI; the full workspace suite and remaining CI checks pass.
  • Native read-only checks on the actual database returned identical row counts and digests: composer lookup fell from 12.334 s to 0.264 s (198 rows), and one conversation's bubbles from 11.268 s to 0.011 s (151 rows). Query plans changed from full scans to indexed searches. Caches were preserved.
  • The patched adapter read and parsed the full database in 40.26 s: 298,365 records, 729,238 events, zero parse errors. This measures adapter work separately from daemon preparation and model scoring.
  • A local ONNX-enabled Cortex containing the fix passed 30 paced queries over 30 minutes and 20 calls over a 30-second burst. The measured owner tree averaged 8.16% at baseline, about 12.33% during paced work, 88.23% during the burst and 9.89% over ten quiet recovery minutes. Percentages use one core as 100%. After installing the patched sidecar and restoring isolation, a final three-minute quiet interval after normal startup averaged 7.29% for the complete owner tree (Cortex 0.35%), with both sidecars alive and no counter faults. Startup settling took about 82 seconds, including a graph-readiness query and a thirty-second settling check.

These are not a clean general-release CPU acceptance: the paced trace had one short-lived-child sampling fault; an automatically reconnected MCP client's CPU was outside the owner tree; periodic search warmup still drives idle bursts; and fresh learned scoring was not exercised (the newly captured governance document is exempt by design). The original 5% quiet gate remains unmet. This PR fixes the verified Cursor scan defect; MEMDEV-45 remains open for the other cases and packaged integration.

Read composer and bubble prefixes through the key index so each conversation no longer scans unrelated rows. Add instruction-budget regressions and run the Cursor tests on macOS, Windows and Linux.
@blocksorg

blocksorg Bot commented Sep 10, 2026

Copy link
Copy Markdown

Mention Blocks like a regular teammate with your question or request:

@blocks review this pull request
@blocks make the following changes ...
@blocks create an issue from what was mentioned in the following comment ...
@blocks explain the following code ...
@blocks are there any security or performance concerns?

Run @blocks /help for more information.

Workspace settings | Disable this message

@Alex793x

Copy link
Copy Markdown
Collaborator Author

Expanded macOS validation of the same locally patched nightly is complete. This broader baseline supersedes using the earlier narrow search-only run as a general usage estimate.

Apple M5 Pro, 15 cores, 24 GiB, macOS 26.5; populated local graph, normal embeddings and Cortex enabled, CPU governor off. Timed phases ran on battery. All Memtrace processes, clients, Node helpers and exited-child CPU are included; percentages are per one CPU core. The complete 59.6-minute timed trace has valid continuous counters and both native sidecars alive.

Scenario Total average CPU
Complete paced/burst/quiet run, 59.6 minutes 29.44%
One request per minute, 30 minutes 39.35%
20 requests over 30 seconds 106.13%
Three-minute recovery after that burst 10.55%
20 simultaneous requests, completed in 6.174 seconds 593.23%
Twenty unattended minutes 14.97%
Three quiet minutes after normal restart 11.00%
Three quiet minutes after restoring the primary repository 11.53%

Short burst CPU uses enclosing one-second samples: 31.1 seconds and 7.0 seconds respectively, retaining the first/last fractions of work. Worst rolling three-minute CPU during unattended observation was 19.70%; no rolling three-minute quiet window fell below 7%. During that twenty-minute interval, Memcore averaged 8.24%, Cortex 0.51%, and owners/clients/helpers 6.22%. The complete timed run peaked at 3.24 GiB aggregate RSS and 6.90 GiB accounted footprint; system memory pressure was normal in 35 snapshots and warning in 25.

All 90 exposed MCP tools were invoked with representative inputs, alongside actual feature/refactor/test commits, file watching, indexing and file-change stress. This is invocation coverage, not 90 blanket correctness passes. All 70 timed requests completed: 68 passed answer checks and two dependency-path requests returned an explicitly incomplete graph at the projection ceiling. Both 20-request bursts passed. Paced latency p50 was 0.940 seconds; the history calls took 47.1–47.6 seconds.

The previously missing fresh learned-scoring case is now covered: a normally captured Git feature decision was ingested and received a persisted learned gate verdict, and its arc returned two Produced episode links. More than 12,000 real existing decisions were also scored. The preserved model cache loaded in 1,299 ms.

Remaining findings include ambiguous graph identities after combined replay/fleet/file-change stress, a named-workspace/member-recall scope issue with explicit existing-store overrides, incomplete process-flow results, and the manual scope cleanup required to return an expanded store to single-repository mode. Exact triggering operations are not all isolated, and these findings are not attributed to this Cursor change without a matched reproduction. A hot Memcore sample during unattended observation captured property scanning, record decoding and gRPC response work. The preserved two-minute search warmup is a candidate caller, not a proven attribution of every burst.

The targeted Cursor lookup improvement remains verified, and this PR's Windows/Linux/macOS Cursor tests and full CI remain green. The broader runtime does not meet the requested roughly 7% idle target or the original 5% criterion. This is a local Cortex-patched 1.2.1-nightly.20260908.1aa9fed, not a newly published package. MEMDEV-45 should remain open; this run does not support an all-Mac-CPU-issues-solved release claim.

The disposable fixture graph and watcher were removed. Primary graph counts remained unchanged, and the primary runtime was restored. Full raw timing, process samples, logs, response evidence and charts are retained locally; no transcripts, graph contents or private paths are included here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant