Skip to content

[codex] Add opt-in raw-history dense and reranked memory baselines - #2362

Merged
pancacake merged 1 commit into
HKUDS:devfrom
sriv144:codex/memory-raw-history-rag
Nov 5, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
sriv144:codex/memory-raw-history-rag

Conversation

@sriv144

@sriv144 sriv144 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Problem and behavior

The evaluation example for RFC #2057 compares recent history, lexical top-two retrieval, and supplied L3 artifacts. Keyword overlap does not supply the requested raw-history dense retrieval plus reranking baseline. This draft adds runnable, opt-in raw_dense and raw_dense_reranked adapters while preserving the default lightweight preflight.

Visible pre-question events are split into overlapping character windows, embedded and ranked by normalized cosine similarity. The reranked variant scores only dense candidates with a cross-encoder. Both offer windows to the existing shared budget packer. Optional chunk-to-event provenance lets coverage count unique retained original events after packing. Adapter metadata records configuration, candidate/reranker scores, model revisions/versions, and separate indexing/query/reranking times.

Model SDK imports occur only under --raw-rag; public safetensors models use immutable revisions, CPU by default, token=False, and trust_remote_code=False. Overlong model inputs fail explicitly rather than silently truncating. Ordinary tests use injected vectors/model-boundary fakes and do not download weights. Documentation covers installation, commands, granularity differences and report interpretation.

Validation

  • Fresh Python 3.12 base environment: 76 focused tests pass, including 38 new retrieval tests. CI includes them on Linux and Windows.
  • Real public MiniLM embedding and cross-encoder models ran on CPU twice: all 55 developer case/adapter combinations succeeded and selected evidence/metrics matched between runs. No reader ran, so all answer-quality metrics remain null.
  • Pinned whole-repository Ruff lint/format, architecture checks, direct repository hygiene, and scoped changed-source mypy pass locally.
  • Whole memory suite before the final SDK-version regression: 263 passed, 4 skipped, with the same four existing Windows colon-filename fixture failures observed on unchanged source. Full hooks report exactly the same 25 broad mypy errors as unchanged source and an unavailable Windows python3 hygiene entry; equivalent direct scoped checks pass. General hooks, Ruff, secret scanning, and Bandit pass. Untouched frontend Prettier is skipped.

Scope for review

This supplies baseline machinery, not a completed research comparison or a claim that dense retrieval/reranking improves memory. The eleven supplied fixtures are synthetic, snapshots remain hand-authored, and source-ID coverage is not fact/span recall. Indices rebuild per case/adapter for isolation; timings are not production steady-state latency. Model loading/downloading is reported separately. No production memory tools, access rules, providers, or defaults change.

I am opening this as a draft for review of the baseline configuration and report contract before a larger held-out study with actual consolidation artifacts and a shared reader. It relates to #2057 and does not close that RFC.

@pancacake
pancacake merged commit 3ed050c into HKUDS:dev Nov 5, 2026
25 checks passed
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.

2 participants