Repository navigation
Feat/local semantic - #1
Merged
Merged
Conversation
New LocalEmbedder (transformers.js/onnxruntime, bge-small-zh-v1.5) and OllamaEmbedder classes with a shared interface, plus a provider factory. Config gains embedProvider/local*/ollama* options; .npmrc skips the onnxruntime CUDA fetch so npm install stays green. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
LocalReranker scores recall candidates via the bge-reranker-base model (text-classification logit delta, feature-extraction cosine fallback), filters by threshold and returns top-K. Config adds rerankEnabled/rerankModel/etc. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
K-Means (k-means++) pre-groups memories before the LLM consolidation call, vector-similarity flags potential conflicts in the prompt, and post-run index rebuild keeps the vector store in sync. Fail-safe: any semantic error degrades to plain consolidation. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
createVectorIndex wraps the store embedding column with model fingerprint tracking. service.searchMemories supports auto/vector/hybrid/keyword modes with optional rerank; memory_search tool gains hybrid mode and rerank control; index.js wires embedder/vectorIndex/reranker by config; api.js adds a semantic status endpoint. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Adds docs/SEMANTIC.md, docs/LOCAL_MODEL.md, docs/MIGRATION.md, benchmark-embed/rerank scripts, semantic sections in the plugin README and changelog. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Anans-Amarre
added a commit
that referenced
this pull request
Aug 20, 2026
modusensus
pushed a commit
that referenced
this pull request
Sep 9, 2026
#107) * feat(retrieval): recall fusion recipes + signal transparency (PR0+PR1) PR0 — benchmark harness trust: - Fix seeded-id mapping: store.save now receives the caller's id, so the seeded mem_* ids match TEST_CASES.expected (previously every row got a UUID and the harness reported 0% recall on both configs). - Expand the seed corpus with cross-topic distractor memories + 2 query cases, raising the recall bar for the fused ranking. - Add runFusionBenchmark() + --fusion CLI for the blend/rrf/minmax A/B. PR1 — #1 recall fusion + #2 signal transparency (off by default): - config.recallFusion: enum [blend | rrf | minmax], default �lend (legacy behavior preserved byte-for-byte; rrf = Reciprocal Rank Fusion with k=60, minmax = scale-aware normalized weighted sum). - config.signalTransparency: bool; when on, each search result carries a signals object { keyword, vector, bm25, final }. Decorative only. - Add both to the feature-flag whitelist so the panel can toggle them. - Update /features effective-count test (37 -> 37) for the two new keys. Verified: benchmark (legacy 83.3% -> fused 100% Recall@5), service-search blend weights (0.92/0.9) unchanged, api featureSnapshot, and ~200 panel/inject tests pass. * fix(retrieval): honor mode contract in rrf/minmax + searchMemories docs CodeRabbit flagged that opt-in fusion recipes could change keyword-only behavior. Verified: rrf/minmax ignored mode entirely, so a mode=keyword request would pull vector/BM25 rows in. Align both recipes with blend: - mode=keyword short-circuits to keyword-only (byte-for-byte mirror of the blend branch), so no recipe ever bleeds vector/BM25 into the text-only path. - mode=auto re-applies keyword-leads ordering for rrf/minmax, preserving the pre-fusion auto contract (keyword first, recipe fills the slots). Also adds a JSDoc for searchMemories and a regression test asserting mode=keyword stays keyword-only across all three recipes. Default remains blend=legacy; zero behavior change for existing users.
modusensus
added a commit
that referenced
this pull request
Oct 13, 2026
审计复核(DSH-MNEME_EUTHYNA_AUDIT_2026-10-13.md 发现 #1):本 PR 在 src/api.js:380、lib/api.js:380、test/api.test.js:1544 与 CHANGELOG 里 写的「全仓唯一直接调 llm.stream 的调用面」与事实不符——src/ 下直调 共 6 处。改写成可核验的口径:探针是唯一「接受并转发调用方档位、却 此前没有兜底」的调用面。 顺带把同段第二处不精确一并收口:实体抽取的兜底是 src/index.js:156-162 的手写等价版(该文件只 import 了 describeStreamFailure),不是 withEffortFallback 本身。CHANGELOG 同口径同步。 纯文案改动,无行为差异:npm test 1724/1723 pass/0 fail/1 skip, check-sync 58 文件一致,徽章 1724 未变。
modusensus
added a commit
that referenced
this pull request
Oct 13, 2026
审计复核(DSH-MNEME_EUTHYNA_AUDIT_2026-10-13.md 发现 #1):本 PR 在 src/api.js:380、lib/api.js:380、test/api.test.js:1544 与 CHANGELOG 里 写的「全仓唯一直接调 llm.stream 的调用面」与事实不符——src/ 下直调 共 6 处。改写成可核验的口径:探针是唯一「接受并转发调用方档位、却 此前没有兜底」的调用面。 顺带把同段第二处不精确一并收口:实体抽取的兜底是 src/index.js:156-162 的手写等价版(该文件只 import 了 describeStreamFailure),不是 withEffortFallback 本身。CHANGELOG 同口径同步。 纯文案改动,无行为差异:npm test 1724/1723 pass/0 fail/1 skip, check-sync 58 文件一致,徽章 1724 未变。
modusensus
added a commit
that referenced
this pull request
Oct 17, 2026
test(scan): 语料里的 OpenAI key 改拼接,并加字面量守卫(secret scanning alert #1)
modusensus
added a commit
that referenced
this pull request
Oct 18, 2026
* docs(readme): 门面加 News、补四种安装来源与 M.O. 能力,修掉文档漂移 根 README 是门面、dsh-mneme/README.md 是功能全集,这次两份一起改: 门面(根 README) - 新增「📰 最近更新」区块,中英各一份:v0.9.0 的 M.O. 手法 beta、设置面板 重排(#427)、安全审计第一批(#462)、路由策略重构(#464)、一条 secret scanning 告警结案(#465) - 新增「🧭 M.O.」章节,讲清为什么工作流该住进仓库而不是记忆库 - 新增「四种安装来源」小节:npm 包名 / Git / tarball / 本地目录。仓库是子目录 包,Git 地址必须带 #path:/dsh-mneme,省掉会装出 mneme.git 0.0.0 空壳; 本地路径必须绝对,相对路径被宿主直接拒掉 - 路线图补 v0.9 行,主题箭头链补到 M.O. 与生态 - 文档表补 docs/COMPARISON.md,并在正文露出与 Zep / Mem0 / Letta / Hindsight 的 11 行能力对比入口 - 删掉幽灵键 sessionLifecycleEnabled(src/ 全无命中,v0.7.11 已清理), 那一行改成 autoDream 功能全集(dsh-mneme/README.md) - 「模型工具(9 个)」→ 10 个,与同文件架构图的 10 对齐 - 「9 种记忆类型」→ 10 种,补 document 文档指针 - 新增「工作流(M.O. · 手法)」功能节 - 安装章节补方式三(Git,含 #path: 三种写法对照)与方式四(tarball, 必须用 npm pack:pnpm pack 会因 bin 脚本 CRLF 报 ERR_PNPM_BIN_CRLF) - 设计文档由 5 篇补到 11 项 - 版本历史补 v0.9.0 与 v0.8.x 两行 CHANGELOG - [Unreleased] 补安全三条:#462/#464 声明式路由鉴权、4 MiB 请求体上限与 413、 供应链三处收紧、secret scanning 告警 #1 结案与语料守卫 测试数六处由 2110 刷新为实测的 2131(scripts/test-count-sync.mjs 的 applyTestCount 施加,readTestCounts 复核一致)。 * docs(readme): 修正源码安装路径与设计文档位置说明 - 方式二的 cd 由 dsh-mneme 改为 mneme/dsh-mneme:先 clone 出的是 mneme/ 目录,直接 cd dsh-mneme 会失败 - 设计文档章节的导语说「位于仓库根 docs/」不准确:10 篇里 9 篇在 dsh-mneme/docs/,只有 COMPARISON.md 在仓库根 docs/
modusensus
added a commit
that referenced
this pull request
Oct 18, 2026
支持版本表停在 0.8.x 已经两个 minor 版本了(0.9.0 在 2026-10 发布), README 与 package.json 都已经是 0.9.0,只有这份政策还在说「请升级至 0.8.x」。中文表同样过时,且两张表的行数与内容也不一致。 一并修掉本文件里几处会被读者当真的旧话: - 依赖扫描工具写的是一个并不在 CI 里跑的第三方平台;CI 实况是 gitleaks(全历史)+ dependency-review(PR diff)+ OSV-Scanner (lockfile),仓库侧开着 Dependabot 告警与 secret scanning。 - 「本地优先,零网络」与同文件的安全特性表自相矛盾:embedProvider 默认是 openai,记忆正文会 POST 出去。改成本地优先但非零网络, 并把「文本绝不出机器」的具体做法写清楚。 - 中文「最小远程暴露面」三条是假承诺(说未配 token 时远程端点 「实际处于禁用状态」,实际是 fail-open 全放行)。整节换成英文 安全模型节的中文镜像:真正的边界是回环 + 宿主监听器,token 只 守写面,并列出开放读与受门控路由的完整清单。 - 中文段缺「独立外部 API」小节,补上(默认只绑回环、token 自动 生成、路由面、CLI 凭据位置)。 - docs/DAEMON.md 的相对链接少了 dsh-mneme/ 前缀,是本文件唯一的 死链。 - 贡献者指南补一条:测试语料要凭据形状不要字面量,用拼接而不是 整串写死(test/helpers 里的整串字面量正是 secret scanning 告警 #1 的来由)。 历史审计节(v0.2.10 ~ v0.6.5)的版本号保留不动——那里记的是过去 发生的事实,写死版本号是对的。 新增 test/security-doc.test.js 把两件事锁住,都是这次实际漂移过的: 支持版本表首行必须等于 package.json 的 major.minor(中英各一份, 且两表逐行一致);文件里的相对链接必须真的能 stat 到。另加一条 不许再出现那个旧供应商名的断言。三条都做过变异验证(改回 0.8.x / 断开链接 / 塞回旧供应商名 → 红,还原 → 绿)。
modusensus
added a commit
that referenced
this pull request
Oct 18, 2026
* docs(security): 支持版本表走到 0.9.x,并去掉功能描述里写死的版本号 支持版本表停在 0.8.x 已经两个 minor 版本了(0.9.0 在 2026-10 发布), README 与 package.json 都已经是 0.9.0,只有这份政策还在说「请升级至 0.8.x」。中文表同样过时,且两张表的行数与内容也不一致。 一并修掉本文件里几处会被读者当真的旧话: - 依赖扫描工具写的是一个并不在 CI 里跑的第三方平台;CI 实况是 gitleaks(全历史)+ dependency-review(PR diff)+ OSV-Scanner (lockfile),仓库侧开着 Dependabot 告警与 secret scanning。 - 「本地优先,零网络」与同文件的安全特性表自相矛盾:embedProvider 默认是 openai,记忆正文会 POST 出去。改成本地优先但非零网络, 并把「文本绝不出机器」的具体做法写清楚。 - 中文「最小远程暴露面」三条是假承诺(说未配 token 时远程端点 「实际处于禁用状态」,实际是 fail-open 全放行)。整节换成英文 安全模型节的中文镜像:真正的边界是回环 + 宿主监听器,token 只 守写面,并列出开放读与受门控路由的完整清单。 - 中文段缺「独立外部 API」小节,补上(默认只绑回环、token 自动 生成、路由面、CLI 凭据位置)。 - docs/DAEMON.md 的相对链接少了 dsh-mneme/ 前缀,是本文件唯一的 死链。 - 贡献者指南补一条:测试语料要凭据形状不要字面量,用拼接而不是 整串写死(test/helpers 里的整串字面量正是 secret scanning 告警 #1 的来由)。 历史审计节(v0.2.10 ~ v0.6.5)的版本号保留不动——那里记的是过去 发生的事实,写死版本号是对的。 新增 test/security-doc.test.js 把两件事锁住,都是这次实际漂移过的: 支持版本表首行必须等于 package.json 的 major.minor(中英各一份, 且两表逐行一致);文件里的相对链接必须真的能 stat 到。另加一条 不许再出现那个旧供应商名的断言。三条都做过变异验证(改回 0.8.x / 断开链接 / 塞回旧供应商名 → 红,还原 → 绿)。 * docs(security): 路由清单补上 persona 与 conflicts,并用测试锁住它 安全模型节的两张路由清单是从代码抄的,抄漏了没人发现: - 开放读漏了 /persona(policy token-write,GET/HEAD 开放) - 受门控漏了 /conflicts(policy token,只读也要 Bearer) - 受门控把 /mode、/features、/commands 的 GET 分支也算进去了,实际开放 改成「写操作按非 GET 分支描述、四条读单独列出」,并在 test/security-doc.test.js 加两条双向比对:拿 createApi 真实装配出的路由 (policy 来自注册声明)逐条对文档清单,少写、多写、写错边都红。 变异验证:删 /persona → 开放读用例红;删 /conflicts → 受门控用例红; 多写 /nope → 受门控用例红;还原 → 6 pass。
andimial
pushed a commit
to andimial/mneme
that referenced
this pull request
Oct 19, 2026
GitHub secret scanning 报了 alert slow-stack#1:test/helpers/write-admission-samples.js 里 openai-key 那条样本是整串字面量,被识别成 openai_api_key(open)。它不是泄露—— 正文是 a-z、0-9 的顺序串,一眼假——但扫描器只看形状,而同一文件里另外四条凭据 (GitHub PAT / Slack / JWT / Stripe)早就是 assemble() 拼的,只有这条漏了。 - 该值移进 SAMPLE_VALUES.openaiKey 走拼接,content 改成模板串引用它; - 新增一条守卫:扫 test/helpers/ 下所有 .js,出现完整形状的 sk- / ghp_ / xoxb- 字面量就红。规则形状与 src/sensitive-scan.js 同源,避免「逐条记得改」再漏; - 变异验证过:往 helpers 里塞一条整串字面量,这条用例立刻失败。 测试语义不变(测试关心的是形状能被判据抓住,值从哪来无所谓)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
项目代号:dsh-mneme-semantic
目标:为 dsh-mneme 引入本地向量模型 + Rerank 精排 + autoDream 语义增强,实现完全离线、高精度的语义记忆系统。
基础版本:dsh-mneme v0.1.x
Node.js 要求:≥24(node:sqlite + node:fs 原生能力)
许可证:MIT(继承原项目)