Skip to content

fix(memory): improve scoped recall and Pi memory fidelity - #141

Closed
Grivn wants to merge 19 commits into
masterfrom
codex/memory-regression-pi-flash
Closed

Grivn wants to merge 19 commits into
masterfrom
codex/memory-regression-pi-flash

Conversation

@Grivn

@Grivn Grivn commented Sep 14, 2026

Copy link
Copy Markdown
Member

Smart recall could ignore source/category filters, discard exact entity candidates, and change tied results between identical queries. Pi repeatedly accumulated its memory guide, used an incompatible host workflow, and could discard historical facts or hide later evidence behind brief prefixes.

Nine focused product commits apply scope before candidate cutoffs, retain bounded entity anchors, stabilize ranking while admitting strong graph neighbors first, and show query-relevant continuous excerpts. Pi now uses a per-turn native guide, supported compaction events, explicit supersedes history, broader brief discovery, and instructions to persist only supported facts. Deterministic tests retain independent scope, graph-budget, Unicode, lifecycle, and crash/race oracles.

Add frozen complex cases, eight selected LongMemEval oracle questions with provenance, and an isolated Pi/DeepSeek runner. Actual Pi 0.83.0 / DeepSeek Flash high runs are complete for the latest master baseline and final candidate, including natural writes, fresh sessions, temporal updates, multi-hop reasoning, and 30/120/500-record noise. Final candidate: 35 case runs and 43 input turns, with unchanged inputs, oracle, scorer, and formal runner budgets.

Acceptance Baseline strict Final strict
Native acquisition and history cases 1/2 2/2
Development QA 5/5 4/5
Fixed holdout QA 12/14 11/14
Selected official oracle QA 7/8 6/8
30 / 120 / 500 noise QA 3/4 · 3/4 · 3/4 3/4 · 3/4 · 4/4

End-to-end QA remains mixed. The report preserves raw failures, the separately frozen single-fence diagnostic, intermediate regressions, and actual tool evidence. It distinguishes alias/type/format failures from incorrect date arithmetic and choosing an old value after retrieving the update. Each condition has one model generation; repeated noise questions are not independent samples. These results do not establish an overall QA-accuracy improvement. Long exact-entity queries can still rank outside the default cutoff, and redundant retrieval remains.

Validation passed: build, make test, full make test-integration (258 CLI checks plus Go/race, Docker, Pi runtime and domain-operation coverage), two actual Pi SDK lifecycle tests, 12 runner boundary checks, and nine scorer checks. The final guide-only follow-up was rebuilt and rechecked. Controlled 25-turn SDK context decreased from 118,293 to 16,980 characters. Live results are separate from offline SDK tests; API credentials are absent from the diff and saved artifacts.

Full regression report · Reproduction commands · Fixture provenance

Final commit CI passed both build-and-test and windows-memory on 79562261.

GRIVN added 19 commits September 15, 2026 02:54
Apply exact category and source scope before keyword, vector, and recency anchor selection. Keep graph traversal inside the same eligible snapshot so excluded memories cannot bridge back into the results.

Validated with go build and the cmd/memory and internal/memory/search suites, including real SQLite regressions for candidate truncation, all output modes, empty scopes, and graph boundaries.
Resolve tied keyword and final scores by importance, creation time, and ID. Make vector and beam queues, recency anchors, graph admission, and anchor traversal deterministic, while preserving score priority and causal precedence.

Validated with go build and the cmd/memory and search suites. Regressions cover top-k permutations, tied heaps, real SQLite reverse scans, causal ties, and repeated recall on a dense equal-weight graph.
Add an independent top-20 entity overlap signal to RRF so common query words cannot discard every exact entity match before reranking. Reuse distinct nonempty entity matching for bounded anchor and final scores, with the existing category/source scope and supersedes handling.

Validated with go build and the cmd/memory and search suites. Real SQLite regressions cover English and Chinese long queries, noisy candidate cutoffs, exact matching, bounded ties, duplicate entities, filtered scopes, and explicit corrections.
Install a Pi-specific guide under prompt/pi so Pi can write memory with its
own tools without inheriting Claude's Task-only instructions. Preserve other
hosts' prompts and the selected memory scope. Teach brief discovery followed
by full lookup, and use directed supersedes links for routine corrections.

Validated go build -o mnemon . and go test ./internal/memory/setup ./cmd/memory
-count=1, including coexistence of Pi and Claude prompt files.
Supply the guide through Pi's per-turn system prompt and filter legacy guide
messages from model requests. Replace the ignored compaction return field with
a supported session_compact/context reminder, including agent continuations
that skip before_agent_start. Keep status checks bounded and report failures.

Validated go build -o mnemon ., make test, and offline regression tests using
the real Pi 0.83.0 SDK across 25 turns, compaction, continuation, legacy context,
and isolated stores. Document the pinned test and Pi prompt migration.
Rank eligible graph edges by their complete structural and semantic transition score before the visit budget is applied. Use stable IDs only to resolve ties, and reuse each computed score for global propagation and beam admission without changing traversal bounds.

Validated with go build, cmd/memory and search tests, and their race suites. Real SQLite regressions cover high-degree direct and intermediate hubs, incoming edges, semantic priority, scope exclusion, and unchanged visit limits; the independent CLI counterexample again returns the strong neighbor.
Preserve 16 original development and holdout cases plus eight selected MIT-licensed LongMemEval oracle cases, with model inputs separated from answer and provenance oracles. Add deterministic scoring, reproducible topical noise, and an isolated raw-query recall probe without presenting these selected cases as full benchmark scores.

Validated frozen input hashes, nine scorer checks, and baseline/candidate CLI probes at 30, 120, and 500 noise records. A paired 120-query check kept SQLite bytes unchanged and exposed limited evidence coverage despite stable candidate ordering.
Run the installed Mnemon extension in the pinned Pi SDK with independent stores, fresh question sessions, explicit live authorization, and stdin-only credentials. Separate lossless conversation retrieval from natural memory acquisition, retain tool traces and bounded SQLite snapshots, and keep provider failures outside answer scores.

Bound requests and process lifetimes, pin actual resource and endpoint selection, and retain reproducible input and binary hashes. Validate with offline helper and real SDK transport boundaries covering scope, cleanup, credential redaction, and failed generations.
Record the latest-main baseline, scoped recall and Pi lifecycle repairs, deterministic and integration validation, and frozen high-noise evidence coverage. Preserve observed limitations and distinguish actual provider failures from model answer accuracy.

Keep natural acquisition and end-to-end DeepSeek acceptance pending until successful provider generations are available.
Admit data-only Memory fixtures and the two pinned Pi dependency manifests through the existing closed JSON categories. Keep arbitrary runner JSON, generated report shapes, temporary files, local state, and credentials rejected.

The initial CI failure exposed that the hygiene gate only examines Git-tracked blobs; the new inputs were untracked during the earlier local gate. Validate the complete indexed change with make test and explicit positive and negative category examples.
Capture synchronous CLI output in a test-owned temporary file instead of writing to an undrained pipe. Larger recall responses can otherwise fill the platform pipe buffer before the reader starts, preventing the test from returning.

An oversized output regression first timed out in the writer and now preserves every byte and restores stdout. Validated the indexed change with make test and the cmd/memory race suite without adding a background reader or truncating output.
Allow an explicit prompt deadline up to 900 seconds so acceptance runs can outlast the documented DeepSeek queue window. Keep the 90-second default, request limits, outer deadline, and cleanup behavior.

Validation: all 10 runner helper tests passed, including Python/Node deadline agreement and an actual Pi SDK request with the extended budget against a local failure endpoint.
Describe the single-command tool boundary and reject unquoted shell operators before CLI execution while preserving literal arguments and fixed-store guards. Allow CLI help, clarify raw JSON answers without changing scoring, and retain turn and tool-call IDs for auditable live comparisons.

Validated with 12 offline helper tests, including Pi 0.83.0 against a loopback 503 endpoint, node --check, and git diff --check. No external provider calls were made.
State that the single-command constraint applies to each bash tool call. A live calibration response had interpreted it as a limit for the whole run, which can interfere with multi-step memory updates.

Validation: all 12 helper tests passed, including the actual Pi SDK payload check for the clarified per-call interface. Scoring and memory behavior are unchanged.
Allow mnemon log in the isolated evaluation store. Soft-deleted memory content can remain visible in operation-log previews, so denying this read-only command obscures an existing historical-evidence fallback.

Validation: all 12 runner helper tests passed. A real baseline CLI import, update, forget, and read-only log probe recovered the old dated residence without changing the database files.
Start compact discovery with ten candidates and treat excerpts as incomplete evidence. Change repeated unproductive recalls to focused searches, avoid redundant full reads, and compare effective dates before answering current or historical questions.

Validated with the two actual Pi SDK lifecycle tests and go test ./internal/memory/setup. Preserve the first live comparisons and evaluate this change separately after observing their discovery failures.
Select one continuous passage around distinct query matches so long prefixes do not hide nearby values, dates, and qualifications. Keep the existing prefix fallback, result ordering, limits, full content, and detail hint; bound query size and the active match window, and count omission marks in the rune limit.

Validated with go build, cmd/memory and search tests, and 46,547 fuzz executions. Real SQLite regressions and 52 independent CLI calls cover recall, basic recall, and search: all 12 generic long-content cases expose their adjacent qualifiers while preserving IDs and scores.
A live memory write expanded a user-supplied place into an unstated personal detail. Require supported facts and preserved uncertainty when writing memories instead of enriching them through assumptions.

Validated with both actual Pi SDK lifecycle tests; preserve the observed live result and repeat native acceptance and the frozen QA suites on this final candidate.
Record the frozen baseline and final Pi/DeepSeek runs, independently verified tool evidence, nine product fixes, and the intermediate failures that motivated follow-up changes.

Keep raw scores, format and evidence distinctions, resource limits, binary hashes, and reproducible commands. Document passing deterministic and integration checks without claiming an overall QA accuracy improvement.
@Grivn Grivn changed the title fix(memory): stabilize scoped recall and Pi continuity fix(memory): improve scoped recall and Pi memory fidelity Sep 15, 2026
@Grivn
Grivn marked this pull request as ready for review September 15, 2026 03:02
@Grivn Grivn closed this Sep 15, 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