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

dsh-df-memory

v0.5.1

Published

DeepSeek Harness(Cordis)插件:把 [df-memory](https://github.com/your-org/lhdrcMem) 记忆仓接入 agent 工具面。

Downloads

945

Readme

dsh-df-memory

DeepSeek Harness(Cordis)插件:把 df-memory 记忆仓接入 agent 工具面。

安装

依赖 npm 包 @lhdrc/core

dsh plugin add ./dsh-df-memory
# 或
dsh --patch ./dsh-df-memory/cordis.patch.yml

主 API 是工具,不是读仓文件

Agent 应通过以下工具访问记忆,不要cat brains/… 或直接读 markdown 当作主路径:

| 工具 | 用途 | |---|---| | memory_query | 检索相关记忆;可选 type 过滤(decision|lesson|note|experience|skill),命中带 schema_type 层标签。P8.2 默认排除 skill 与 *.overview.md/*.abstract.md 侧车(显式 type=skill 时豁免;侧车原文仍可 memory_read)。experience/skill 命中额外带 eta_score/support/source_paths(snippet 优先 trigger)。可选 brain 覆盖本次调用的 brain | | memory_read | 读单个节点原文;可选 brain | | memory_remember | LLM 编译写入(默认异步:返回 accepted+task_idwait=true 同步等到 kept;无 Key 且无 bridge → E_DISABLED)。可选 brain | | memory_job_status | 查询 remember/compile 任务状态(.dfmemory/jobs/{brainId}/)。只给 task_id 时只查当前默认 brain,扫其它 brain;可另传 brain | | memory_capture | 零 LLM 显式写一条 L0 笔记(captureNode,ADD-only,llm.provider=off 也可用)。可选 metric/value/unit/period 为该次 facts 记量纲(P9A.2:value 必须有 metricmetric 需至少一条 facts) | | memory_init | 在工作区初始化记忆仓(initMemoryRepogit: init\|existing\|off) | | memory_tree | 只读盘点仓内目录/文件(listTree/renderTree) | | memory_forget | 软归档节点(status=archived,D17,记 ledger) | | memory_sync | 显式把 dirty 刷进 git 账本(flushRepoLedger explicit,等价 sync --commit) | | memory_brain | brain 管理:list(含 sources / is_default)/ create(已有则保持) | | memory_rebuild_index | 从 md 重建索引(rebuildIndex;D1 索引可丢可重建) | | memory_events | 列出近期 ledger 事件(listLedgerEvents) | | memory_skill | 规则层(P8.3)list / find / read / inject;skill 不混默认 memory_queryinject 经宿主 ctx.skills.register 登记为会话 skill(trigger + procedure 摘要,非全文)。可选 brain | | memory_skill_outcome | P9.6:显式打分 { name, success, note? }eta_score/support/status因 success 自动 activate | | memory_trend | P9A.2(P9.5 插件面):查指标趋势 { metric, threshold?, direction?, brain? } → 扫 facts 的 metric/value 检测回归;points:[] 是合法结果(不报错)。数据用 memory_capture + metric/value 写入 |

Prompt section df-memory 会在 system prompt 中提醒模型遵守上述约定。

范围说明

  • 在 P4.2 A 档三工具基础上,为插件体验补齐了仓生命周期能力(init / capture / tree / forget / sync / brain / rebuild-index / events)。
  • LLM bridge(B 档):仓内 llm.provider=off 时,memory_remember 自动走 DSH 自己的 LLMctx.get("llm")complete()),无需在仓内配置任何 API key(默认路由 deepseek-official / deepseek-v4-flash,可用 llmProvider/llmModel 覆盖,llmBridge: false 关闭)。有 Key 时仍以仓内配置为准。bridge 覆盖 compile 抽取和懒蒸馏(judge/refine/abstract,需 @lhdrc/core ≥ 0.2.1);kill_switch 仍优先。
  • P8.1 任务队列:宿主 ctx.get("jobs") 无 enqueue 契约,以 .dfmemory/jobs/ 文件队列为权威(不进检索、不进 git)。
  • P8.1 挂钩autoBuffer 默认 true。session/event 只收 user/model + assistant;达窗 / dispose 入队 compile。autoBuffer: false 可关。
  • P8.2 检索分层memory_query 默认 excludeSchemaTypes: ["skill"] + excludeSidecars: true(与 P8.3 skill 独立查找面一致);显式 type 时豁免 skill 排除。core annotateHits 已按文件 frontmatter 补 eta_score/support/source_paths,插件透传不二次检索(读失败 fail-open)。
  • P8.3 Skill 注入:规则走独立工具 memory_skill(list/find/read/inject),不混默认 query。注入通道调研结论(P8.3 §3):选 A — 宿主 ctx.skills.register()@deepseek-ai/dsh-skill SkillRegistry 存在且稳定,返回 disposer 可摘除);find 命中 top-1 或显式 inject 时登记为会话 skill,插件卸载时摘掉;注入体为 trigger + procedure 摘要(skillInjectMaxChars 默认 2000),预算 skillInjectMaxCount 默认 3,同名幂等;shared skill 未 mount 不可见 → E_NOT_FOUND;不自动 activate。
  • P8.5 per-call brainmemory_query / memory_read / memory_remember / memory_job_status / memory_skill 可选参数 brain,覆盖 config.brainId / 仓默认;host 按 repoRoot+brainId 分实例。非法 id → E_USAGE/E_PATH_ESCAPE;不存在 → E_NOT_FOUND(不隐式 create)。同仓多 brain 的 git 历史共享,非密码学隔离;索引按 brain_id 分行。非 local 通道走 core authorize + assertBrainScope(插件测无法模拟非 local 时以本仓 core 单测为准)。不提供会话级「切换默认 brain」。
  • P9.6 outcome + 启动经验memory_skill_outcome 显式打分,success 自动 activate。agent/session-start 注入该 brain active 经验 top-3(bootInjectExperiences 默认 true);与 P8.1 门控注入按 path 去重。不注 skill、不注 L0。
  • rememberAsync 默认 true。
  • 宿主侧注意:ctx.llm 属性不可读(llm 不在插件 inject 列表),必须走规范访问 ctx.get("llm")

配置(cordis.yml)

repoRoot: null    # 默认从 DSH 会话工作区向上找 memory.yml(不是 dsh 进程 cwd)
brainId: null     # 默认仓内 brain_id
agentId: dsh      # created_by 前缀
llmBridge: true   # provider=off 时用 DSH 的 LLM 跑 memory_remember;false 关闭
llmProvider: deepseek-official   # bridge 路由 provider(可选)
llmModel: deepseek-v4-flash      # bridge 路由 model(可选)
skillInjectMaxChars: 2000  # P8.3 单 skill 注入体上限(可选)
skillInjectMaxCount: 3     # P8.3 会话级注入个数上限(可选)
injectTopK: 5              # P8.1 pre-step 知识注入 top-k(可选)
bootInjectExperiences: true  # P9.6 session-start 注入成熟经验(可选)
bootInjectTopK: 3            # P9.6 启动注入条数(可选)
# compile.job_timeout_ms: 120000  # 写在 memory.yml 的 compile 段;超时 job 标 failed + E_TIMEOUT,不写 L0

定位顺序:repoRootDF_MEMORY_ROOT → 当前会话 SessionHeader.cwdworkspaceRegistryprocess.cwd()。Web UI 里请把工作区选成含 memory.yml 的目录(例如 D:\memory_projects\test4humancli)。若仍报「未找到 memory.yml」,在插件 config 里写绝对 repoRoot,或让 agent 调用 memory_init 建仓。

测试

bun install
bun test

依赖

  • @lhdrc/core — 记忆读写、检索、编译的唯一实现路径;插件不复制写路径逻辑。