JackZo400/dsh-memory-search ↗★ 0

dsh-memory-search

基于本地向量与FTS5的Markdown笔记检索 适合需要将本地Markdown笔记作为Agent长期记忆的用户。

包名
dsh-memory-search
兼容性
待验证
版本
0.1.0
许可证
MIT
最近更新
2026年9月27日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:JackZo400/dsh-memory-search

配置

配置写在你的 profile patch 里(bundle patch 的 insert 段):

- insert:
    - id: memory-search
      name: dsh-memory-search
      config:
        dbPath: .dsh-memory/index.db    # 索引库落哪;相对路径按 dsh 的工作目录算
        roots:                          # 语料根目录:递归收集里面的 .md
          - ./memory
        modelPath: ''                   # GGUF 嵌入模型;留空 = 只跑关键词
        recall:
          enabled: true                 # 每轮自动召回
          limit: 4                      # 最多带几条
          budgetChars: 1600             # 注入的字符预算
          order: 130                    # 在系统提示里的排序位
        embedding:
          enabled: true
          threads: 6                    # CPU 线程数
          contextSize: 1024             # 上下文窗口(开大更吃内存)
          batchSize: 256
          queryInstruction: ''          # 见下
        search:
          candidatePool: 40             # 每路召回各取多少候选
          rrfK: 10                      # RRF 平滑常数
        exclude: ['**/.index/**', '**/node_modules/**']
        syncIntervalMs: 300000          # 多久扫一次新写的笔记
        acceptSpecChange: false         # 换切块规则才设 true(会重算全部向量)

几个容易踩的点:

  • roots 不配就是空索引,日志会提醒你。
  • modelPath 留空时插件只建关键词索引,embedding.enabled 开着也白开(不会报错)。
  • queryInstruction:默认值是给 Qwen3-Embedding 用的指令前缀(它 instruction-aware, 检索质量吃这个前缀)。换别的嵌入模型(bge-m3、nomic 之类)建议在配置里显式清空, 不然前缀会污染语义。
  • 换嵌入模型要删掉索引库重建 —— 向量维度不同,旧向量没法复用(代码会检测到维度不匹配, 直接放弃语义那一路,不会给你算出垃圾结果)。