npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kiwifruit/dsh-memory

v0.1.3

Published

Memory plugin bridging the agent-memory Python engine into the DeepSeek Harness

Readme

dsh-memory — agent-memory 记忆引擎的 DSH 插件

agent-memory(Python 记忆引擎,74 模块)桥接为 DeepSeek Harness(DSH)的 Cordis 插件:ctx.memory Service + 18 个模型可调用工具 + Agent Loop 自动存储 + 技能注册。自包含:内置引擎副本,首次启动自动安装 Python 依赖,装完即用。

引擎全局视角:Context Engineering 五维能力

agent-memory 以 ContextOrchestrator 为统一入口,实现上下文工程的五大核心能力:

选择(Select)── 噪声过滤 + 相关性筛选
压缩(Compress)── 5 种链结构提取 + 工具结果/上下文压缩
检索(Retrieve)── 决策引擎 + 重排序 + 多样性保证
状态(State)── 任务进度追踪 + 目标对齐 + 检查点
记忆(Memory)── 冲突检测 + 跨会话关联 + 遗忘机制

四层模块架构(74 模块)

ContextOrchestrator(统一入口:prepare_context / store_memory / compress_context / end_session)
        │ 协调
        ▼
协调层(cognitive, 18) ── 认知模型:CausalChainExtractor / CognitiveModelBuilder / KnowledgeGapIdentifier / StateInference / Insight...
   │     └─ 双轨实现(dual_track, 18):轨道A 语义桶  ⊕  轨道B 链提取(因果/逻辑/操作/叙事/时间)→ 融合层(关联+验证+摘要)
存储层(storage, 6) ── 感知 → 短期(5 语义桶)→ 长期(8 分类,索引/热度/遗忘)
基础设施(infra, 23) ── type_defs / 加密 / 隐私 / 安全 / 性能优化(缓存/预取/渐进压缩/智能分配/批量写入)
编排(orchestrator, 9) ── 多源协调 / 噪声过滤 / 权限边界 / 结果压缩 / 检索组织 / Token 预算 / 可观测
  • 双轨记忆:语义桶(topic 聚类)× 链提取(5 种链)并行,融合层做跨会话关联、交叉验证与多维摘要
  • 存储流:感知 → 短期记忆(5 语义桶,热度管理)→ 长期记忆(8 分类,索引 + 遗忘机制)
  • 降级优先:默认文件存储零外部依赖;Redis 为可选增强(未部署自动降级);模块故障/依赖缺失自动降级,核心流程不中断
  • 隐私内置:加密(cryptography)、隐私同意、意图安全检查、工具输出消毒

插件能力

| 面 | 说明 | |----|------| | ctx.memory Service | 26 个 RPC 方法,覆盖记忆全能力域(存储/检索/上下文/认知/状态/会话) | | 18 个工具 | memory_* 前缀,模型可直接调用(见下) | | Agent Loop 钩子 | agent/status → idle 自动存储(autoStore: true) | | 技能注册 | 将引擎 SKILL.md 注册到 ctx.skills(若宿主提供) |

工具清单(18)

  • 记忆:memory_store memory_search memory_forget memory_export memory_conflict
  • 认知:memory_cognitive_model memory_chain_extract memory_insight memory_knowledge_gap
  • 检索:memory_retrieval_decision memory_retrieval_quality
  • 状态:memory_state_sync memory_task_progress
  • 上下文:memory_prepare_context memory_compress memory_token_stats
  • 会话:memory_session_link memory_stats memory_end_session

安装

npm install @kiwifruit/dsh-memory

Python 依赖自动安装:首次启动时插件探测 pythonPath 解释器是否具备引擎依赖(解析自内置 requirements.txt);缺失则自动创建 venv 并 pip install(默认 venv 位于 ~/.dsh-memory/venv), 随后用 venv 解释器启动桥接 —— 目标环境无需手动装依赖(国内环境建议配置 pipIndex 镜像加速)。

DSH 装配

cordis.yml / cordis.patch.yml

- insert:
    - id: memory
      name: '@kiwifruit/dsh-memory'
      config:
        autoStore: true
        pipIndex: 'https://pypi.tuna.tsinghua.edu.cn/simple'   # 可选,国内加速

装配到 $DSH_HOME/profiles/<name>/cordis.patch.yml 后由 HMR watcher 热加载,无需重启。

配置项

| 字段 | 默认 | 说明 | |------|------|------| | pythonPath | python | Python 解释器(PATH 或绝对路径) | | skillRoot | 插件内置 python/agent-memory/ | 引擎根目录(scripts 所在),一般无需覆盖 | | bridgeScript | 插件内 python/bridge.py | 桥接脚本 | | maxContextTokens | 32000 | 上下文 Token 预算(透传引擎) | | autoStore | false | Agent Loop 空闲时自动存储 | | contextInjection | false | 上下文注入(预留) | | autoInstall | true | 缺依赖时自动创建 venv 并安装;false 则给出手动命令 | | venvDir | ~/.dsh-memory/venv | venv 位置(全局安装时包目录只读,故放用户目录) | | pipIndex | 空(pip 默认源) | 镜像源,如 https://pypi.tuna.tsinghua.edu.cn/simple |

已知限制

  • 记忆检索为子串匹配query in content),非语义检索;查询词需与存储内容有连续子串重合
  • contextInjection(pre-step 上下文注入)为预留能力,尚未启用
  • 引擎详情文档(API 参考、架构、双轨设计等)随包内置在 python/agent-memory/references/SKILL.md