Repository navigation
feat(sdk): indexed reads, workspace memory, and cursor contracts - #655
Conversation
Deliver a cursor-bound SQLite metadata query index with transactional maintenance and authoritative scan fallback, plus deterministic workspace-memory rollups for bounded context and search. Converge cursor fingerprints on contract-declared semantics, compact get child projections, extract typed search contracts, remediate CodeQL alert 30 with a linear path primitive, refresh SDK documentation and generated changelog, and record the linked pm lifecycle evidence.
Record PR #655 on every implemented tracker item so the hosted review and exact-head evidence remain discoverable from pm history.
|
@greptileai please review the current head.\n\n@coderabbitai full review |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 59 minutes. |
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (46)
📝 WalkthroughWalkthroughAdds deterministic workspace-memory rollups, a rebuildable SQLite metadata query index, contract-driven cursor fingerprinting, shared search contracts, indexed list execution, child projection adjustments, security regression coverage, documentation, and project-tracking metadata. ChangesWorkspace memory and query surfaces
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Client
participant runSearch
participant readWorkspaceMemory
participant searchWorkspaceMemoryReadResult
Client->>runSearch: execute search
runSearch->>readWorkspaceMemory: load corpus memory
readWorkspaceMemory->>searchWorkspaceMemoryReadResult: provide snapshot and cache status
searchWorkspaceMemoryReadResult->>runSearch: return matching rollups
runSearch->>Client: return search results with workspace_memory
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Sorry @unbraind, your pull request is larger than the review limit of 150000 diff characters
Merging this PR will regress 6 benchmarks
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | createQueryFingerprint |
516.2 µs | 517.8 µs | -0.31% |
| ❌ | stableStringify (nested contract) |
161.3 µs | 161.5 µs | -0.1% |
| ❌ | normalizeLowercaseWhitespace |
135.8 µs | 135.9 µs | -0.02% |
| ❌ | tokenize + score query over 2000 docs |
7.5 ms | 7.5 ms | -0.01% |
| ❌ | tokenizeAlphaNumeric |
367.3 µs | 367.3 µs | 0% |
| ❌ | score query over 2000 docs |
5.6 ms | 5.6 ms | 0% |
| ⚡ | decodeQueryCursor |
116.1 µs | 114.2 µs | +1.64% |
| ⚡ | encodeQueryCursor |
101.2 µs | 101 µs | +0.24% |
| ⚡ | build index (2000 docs x 80 words) |
161.4 ms | 161.3 ms | +0.03% |
| ⚡ | jaccardSimilarity |
153.3 µs | 153.3 µs | +0.03% |
| ⚡ | build index (200 docs x 40 words) |
8.4 ms | 8.4 ms | 0% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing feat/sdk-indexed-memory-and-cursor-contracts (0badc41) with main (221980a)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/pm/history/pm-801d.jsonl:
- Line 77: Update the completion evidence in the metadata comment to remove the
unsupported claim of automatic external-mutation fallback, or explicitly state
that in-place external edits require forceSourceScan or reindex for recovery.
Keep the evidence limited to mutation paths actually supported by the
implementation.
In @.agents/pm/history/pm-v3zd3o.jsonl:
- Around line 8-9: Keep the issue open while hosted exact-head CodeQL closure
remains unverified. Update the metadata status and closure fields associated
with the close operation, or create an explicit follow-up task, so closure
occurs only after the hosted CodeQL result is recorded.
In @.agents/pm/issues/pm-v3zd3o.toon:
- Line 5: Update the issue status from closed to an open verification state
while hosted CodeQL exact-head closure remains pending. Keep it closed only
after confirming the hosted alert is cleared, consistent with the existing
closed-line comments and close_reason.
In `@CHANGELOG.md`:
- Around line 3-16: Add bullets under CHANGELOG.md’s Unreleased section
describing the persistent SQLite metadata query index with bounded indexed reads
and the compact standard pm get child projection. Place these user-visible
deliverables in the existing Unreleased categories, using the project’s
established issue references where available.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4d42bd26-ae4d-4137-b299-cf752e832bac
📒 Files selected for processing (44)
.agents/pm/chores/pm-fgih.toon.agents/pm/extensions/.managed-extensions.json.agents/pm/features/pm-5qmm.toon.agents/pm/features/pm-801d.toon.agents/pm/history/pm-5qmm.jsonl.agents/pm/history/pm-801d.jsonl.agents/pm/history/pm-b0twiy.jsonl.agents/pm/history/pm-ds3b.jsonl.agents/pm/history/pm-fgih.jsonl.agents/pm/history/pm-v3zd3o.jsonl.agents/pm/issues/pm-b0twiy.toon.agents/pm/issues/pm-v3zd3o.toon.agents/pm/tasks/pm-ds3b.toonCHANGELOG.mddocs/COMMANDS.mddocs/CONTEXT_RELEVANCE.mddocs/PERFORMANCE.mddocs/SDK.mdsrc/cli/commands/context.tssrc/cli/commands/get.tssrc/core/shared/primitives.tssrc/core/store/item-metadata-cache.tssrc/core/store/item-metadata-query-index.tssrc/sdk/cli-contracts/flag-contracts.tssrc/sdk/index.tssrc/sdk/item-children.tssrc/sdk/item-metadata-index.tssrc/sdk/pagination.tssrc/sdk/query/list.tssrc/sdk/query/search-contracts.tssrc/sdk/query/search-pagination.tssrc/sdk/query/search.tssrc/sdk/workspace-memory.tstests/fixtures/contracts/full.jsontests/unit/commands/get-append-command.spec.tstests/unit/commands/list-command.spec.tstests/unit/commands/search-command.spec.tstests/unit/commands/workspace-memory-command-integration.spec.tstests/unit/core/item/item-metadata-derived-index.spec.tstests/unit/core/item/item-metadata-query-index.spec.tstests/unit/core/shared/shared-primitives.spec.tstests/unit/sdk/history-read-primitives.spec.tstests/unit/sdk/pagination.spec.tstests/unit/sdk/workspace-memory.spec.ts
Append the direct-edit recovery correction, record exact-head CodeQL verification, add the non-duplicate completed indexed-read child boundary with full evidence, and regenerate the package-owned changelog.
|
Regarding CodeRabbit’s review invocation: acknowledged the included-review limit notice. The service subsequently completed its current-head analysis and posted four actionable threads, all of which have now been individually answered and resolved. |
|
Regarding CodeRabbit’s walkthrough: the architecture summary is accurate, but the generic 50% docstring warning is not. The repository-owned static gate measured 100% source, exported, and member docstring coverage, and the hosted static gate is green; no generated docstring mutation was applied. |
|
Regarding Gemini Code Assist: acknowledged that this consumer reviewer has been sunset. It supplied no code findings for this head, so no implementation action is applicable. |
|
Regarding CodSpeed’s report: reviewed and acknowledged. The report flags different runtime environments; the largest displayed regression is 0.24%, while six benchmarks improve and the repository’s hosted benchmark gate plus the 10k CLI/SDK scale gate pass. This is measurement noise below the project’s enforced budgets, so no code change is justified. |
|
Regarding Codecov: acknowledged. All modified coverable lines are covered, hosted coverage is green, and the literal all-source run remains exactly 100% statements, branches, functions, and lines. |
|
Regarding Sourcery’s review: acknowledged the service’s 150,000-character review ceiling. It produced no code findings; repository gates and the other current-head review surfaces cover the full broad PR. |
|
Regarding CodeRabbit’s four-finding review: all four threads were verified against current code, answered inline, reacted to, and resolved. ac2fad2 records the recovery-contract correction, exact-head CodeQL evidence, and generated indexed-read/compact-get changelog entry. |
|
@greptileai please review the current head ac2fad2.\n\n@coderabbitai full review |
Persist the accepted recovery clarification, exact-head CodeQL disposition, and generated-changelog resolution on their canonical tracker items.
|
@greptileai please review exact head 0badc41 after GitHub head refresh.\n\n@coderabbitai full review |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 35 minutes. |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 34 minutes. |
|
Regarding CodeRabbit invocation 66fb8baf: acknowledged. It targeted the true refreshed head 0badc41 but supplied only the included-review rate-limit notice and no new findings; the exact-head hosted check suite is fully green. |
|
Regarding CodeRabbit invocation e834ca30: acknowledged as a stale pre-refresh invocation against ac2fad2. It supplied no findings, and the later 0badc41 invocation plus exact-head checks supersede it. |
|
Regarding CodeRabbit empty review 4762222796: acknowledged. The review contains no body, inline comment, or actionable finding; current-head thread inventory remains empty. |
|
Regarding CodeRabbit empty review 4762226384: acknowledged. The review contains no body, inline comment, or actionable finding; current-head thread inventory remains empty. |
|
Regarding CodeRabbit empty review 4762232990: acknowledged. The review contains no body, inline comment, or actionable finding; current-head thread inventory remains empty. |
|
Regarding CodeRabbit empty review 4762233726: acknowledged. The review contains no body, inline comment, or actionable finding; current-head thread inventory remains empty. |
What changed
pm getchild context compact through counts, status summaries, and continuations while retaining explicit/full child samplespm-changelog2026.7.23Why
The CLI and SDK need reusable project-management primitives that treat project management as bounded, precise context management. This change makes large workspaces cheaper to query, preserves source files as the sole authority, gives package authors public customization surfaces, and removes presentation-only cursor invalidation drift.
Tracked work
The completed workspace-memory, cursor-contract, and security items are closed. The broader 1M-index and rolling SDK-reference items were returned to open with their remaining acceptance recorded; no work item remains in progress.
Verification
pnpm benchmark:scale:check: CLI and SDK 10k budgets passedpminit/create/list/context/search passedpm-changelog2026.7.23 installed; generation and check are reproducibleThe local Greptile gate reached the external service but returned
free_reviews_limit_reached; hosted checks and available reviewer feedback will be handled on this PR.Summary by cubic
Delivers a rebuildable SQLite metadata query index for fast, bounded list reads and adds deterministic workspace‑memory rollups that keep large histories searchable. Unifies cursor identities via flag contracts, compacts single‑item child projections by default, and fixes a CodeQL‑flagged ReDoS in path trimming.
New Features
listpages serve windowed rows and counts from the index; SDK exposesqueryItemMetadataIndex(pm-801d, pm-px153l).contextauto‑attaches; SDK surfaces read/select/search APIs (pm-5qmm).pm getchildren are compact by default (counts, status summary, continuation); deep/full retains bounded samples.Bug Fixes
Written for commit 0badc41. Summary will update on new commits.