Skip to content

feat(read): diversity on read(), sync and async (core#656) - #22

Merged
izgorodin merged 1 commit into
mainfrom
feat/read-diversity
Oct 6, 2026
Merged

izgorodin merged 1 commit into
mainfrom
feat/read-diversity

Conversation

@izgorodin

@izgorodin izgorodin commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Adds diversity: float = 0.0 to MnemoClient.read() and AsyncMnemoClient.read(), passed to core's POST /memory/read (core#656, live since 2026-10-04; same parameter as mcp-memory-server 0.15.0 memory_read). Above 0 a near-copy of an already picked match gives its slot to the next distinct memory; it changes which memories come back, not their scores. Sent only when above 0, so existing request bodies are unchanged.

Tests: sent from both clients at 0.3; omitted at 0. Local: pytest 69 passed, mypy strict clean (ruff is not a CI gate here, unchanged baseline of 20).

CHANGELOG under Unreleased; release (0.5.0, a new keyword argument is a MINOR) as a follow-up.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an optional diversity setting to synchronous and asynchronous memory reads. Values above 0 can reduce near-duplicate results when there are more matches than requested, while preserving result scores.
    • Diversity defaults to 0; at that setting, requests remain unchanged.

Sent only when above 0, so a caller that does not use it sends the same
body as before.

Co-Authored-By: Σ <sigma@mnemoverse.ai>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 96337fc0-cb83-44e0-9d7b-610d539647f8
📥 Commits

Reviewing files that changed from the base of the PR and between 279c38a and ebc27bc.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • mnemoverse/_async_client.py
  • mnemoverse/client.py
  • tests/test_client.py

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The synchronous and asynchronous read() methods now accept a diversity option that defaults to 0.0. The async client sends nonzero values in the request body. Tests cover nonzero serialization for both clients and omission of 0.0.

Changes

Read diversity option

Layer / File(s) Summary
Expose and forward the option
mnemoverse/client.py, mnemoverse/_async_client.py
Both read() methods accept diversity, and the synchronous client forwards it to the asynchronous client. The method documentation describes diversity selection.
Serialize and verify diversity
mnemoverse/_async_client.py, tests/test_client.py, CHANGELOG.md
The async client includes nonzero diversity in the request body. Tests verify that 0.3 is sent through both clients and that 0.0 is omitted. The changelog documents the option and its selection behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to ebc27

The change adds an optional read parameter, and the available evidence establishes no actionable merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding the diversity option to synchronous and asynchronous read().
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit reads the memory stack,
And adds a choice to bring things back.
Near-copies step aside from view,
While distinct memories hop through.
Zero leaves the request unchanged,
The rabbit’s notes are neatly ranged.

Comment @coderabbitai help to get the list of available commands.

@sigma-mnemoverse sigma-mnemoverse Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigma Charlie v6 (subscription) could not complete its review of ebc27bce880e84900d22c9af80d4fe3e0d6c0881.

Executor: owner-login (producer on the owner's subscription login in Sigma's sandbox; verifier on Sigma's API keys through the credential gateway).

Recorded attempt states: incomplete 2.

Verified findings: unknown. No verified report is established; this does not mean no defects.

Supplied changed files: 4. Model-declared reviewed files: unknown. These are accepted recorded declarations, not measured code coverage. Coverage gaps or unavailable declarations remain.

No required checks were configured.

Recorded API cost: known $0.000000; held $0.000000. Token-derived records, not an invoice. These are the recorded API amounts, not a current ledger lookup.

Subscription reference estimate: $1.279299 from 2 recorded observations; not a charge or invoice. It is separate from API cost. Subscription charges are unknown.

Accepted independent verifier evidence is unavailable.

Reason: Model reports incomplete required tasks.

Observations from an incomplete review

These are producer observations, not findings of a completed review. Only explicitly labelled accepted verifier assessments have been validated.

  • P2: `diversity` request field is absent from the bundled core API contract — producer/claude-review, attempt d5cdc09f-b05a-4324-8be8-a49ecbf2b62d

    (unverified). Proof gap: Diffed mnemoverse/_async_client.py and mnemoverse/client.py against the extracted baseline (/tmp/baseline_extract from /baseline/source.tar) to confirm `diversity` is new in this change; inspected /work/_openapi.json's `components.schemas.ReadRequestSchema` directly and confirmed every other field sent by read() (including those added in the immediately preceding 0.4.0 release) is present there except `diversity`. I could not reach the actual core service (outside the suppli… Acceptance of this producer evidence is not established.

  • P3: No range validation for the new `diversity` parameter — producer/claude-review, attempt d5cdc09f-b05a-4324-8be8-a49ecbf2b62d

    (unverified). Proof gap: Read the full _async_client.py and client.py read() implementations; grepped for existing length/range validation (`512`, `max_length`, `len(`) and found none elsewhere in the two files, confirming this is consistent with pre-existing SDK style rather than a one-off regression. Did not test actual server-side rejection behavior (requires the live core service, outside supplied material). Acceptance of this producer evidence is not established.

Model-declared notes

  • producer/claude-review, attempt d5cdc09f-b05a-4324-8be8-a49ecbf2b62d (diagnostic, acceptance unconfirmed): Cannot reach the live Mnemoverse core service (outside the supplied repository snapshot) to confirm whether POST /api/v1/memory/read actually implements the `diversity` field referenced as core#656 in CHANGELOG.md; the only locally available evidence is the bundled, unchanged _openapi.json contract snapshot, which does not list a `diversity` property, so the production behavior of this new parameter remains unconfirmed.

  • producer/claude-review, attempt d5cdc09f-b05a-4324-8be8-a49ecbf2b62d (diagnostic, acceptance unconfirmed): No network access in the sandbox to install pytest/httpx/pytest-asyncio, so none of the suite (new or pre-existing) could be run locally; REQUIRED_CHECK_RESULTS_JSON lists no required checks for this change, so there is no external test-run evidence to rely on either.

  • producer/claude-review, attempt d5cdc09f-b05a-4324-8be8-a49ecbf2b62d (diagnostic, acceptance unconfirmed): Could not execute the two new tests in tests/test_client.py (test_read_sends_diversity_when_above_zero, test_read_omits_diversity_at_zero) or any other targeted pytest run against the changed code in /work: pytest, httpx and pytest-asyncio are not installed in this sandbox's Python, and there is no network access to install them (pip install failed with DNS/connection errors), so the test additions in this diff were reviewed by static reading and baseline diffing only, not b…

Limitations

  • Stage claude-review declared attempts were exhausted.

Run: 2c1c4b50-553f-4834-a5f3-cdd5a4a3c142.

Detailed execution history is available to the connection owner in Sigma.

Severity: P0–P3 · What verified means.

@izgorodin
izgorodin merged commit 5db94e2 into main Oct 6, 2026
9 checks passed
@izgorodin
izgorodin deleted the feat/read-diversity branch October 6, 2026 13:28
@izgorodin izgorodin mentioned this pull request Oct 6, 2026
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