Skip to content

feat(tools): 工具暴露开关 disableMemorySearch/disableMemoryArchive + 检索/归档描述使用纪律 - #276

Merged
modusensus merged 5 commits into
mainfrom
feat/tool-exposure-switches
Sep 21, 2026
Merged

modusensus merged 5 commits into
mainfrom
feat/tool-exposure-switches

Conversation

@modusensus

@modusensus modusensus commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

背景

慢/轻量模型(如 glm-5.3-flash 一类)对「何时该用工具」的判断较弱,而跨会话记忆本就由 inject 每轮自动注入系统提示词,memory_search / memory_archive 极易被顺手反复调用——每次工具调用都是一次串行往返(生成参数 → 执行 → 回填 → 再生成),在慢模型上被放大成明显卡顿。

变更

  • 工具暴露开关:config.js + settings.js(FEATURE_FLAG_BOOLEANS 白名单)新增 disableMemorySearch / disableMemoryArchive 两个布尔开关,面板可启停 = 线上回滚开关;默认关 = 行为逐字节不变
  • 注册侧硬隐藏:tools.js 注册循环按 config 跳过被禁用的工具——模型看不到就不会调,比在描述里劝它少调用更可靠。已知边界:live patch reload 下已注册工具不被宿主反注册,排除只对全新会话生效(已注释说明)
  • 描述使用纪律(与 [Feature] 注入形态:能力说明 + 指针 + 分时机注入(设计提案) #249 的 TOOL_GUIDE 互补:那是 opt-in,这里是零配置兜底):
    • memory_search 基础描述补「跨会话记忆已自动注入,注入里没有才搜」
    • memory_archive 补「仅用户要求或条目确实过时才归档,别自作主张清理」
  • MCP 平价同步:bin/dsh-mneme-mcp.mjs 的 TOOL_SEARCH_DESCRIPTION 同步(lockstep 测试护栏)

测试

  • 全量 1247 全绿(含新增:工具隐藏三态、描述纪律断言、features effective 计数 +2)
  • check-sync ✓(src ↔ lib 43 文件一致)

Summary by CodeRabbit

  • 新功能

    • 新增可配置开关,可分别隐藏记忆搜索和记忆归档工具。
    • 记忆搜索与归档工具的使用提示更加明确:仅在必要时搜索,避免主动归档。
    • 面板支持管理上述功能开关,默认保持现有行为。
  • 改进

    • 明确提示相关跨会话记忆会自动注入,减少不必要的重复搜索调用。

…_search/archive 描述使用纪律

慢/轻量模型(如 glm-5.3-flash)对「何时该用工具」判断弱,而跨会话记忆
已由 inject 每轮自动注入,memory_search/memory_archive 极易被顺手乱调——
每次工具调用都是一次串行往返,在慢模型上被放大成明显卡顿。

- config.js + settings.js(FEATURE_FLAG_BOOLEANS)新增两个布尔开关,
  面板可启停=线上回滚开关;默认关=行为逐字节不变
- tools.js 注册循环按 config 隐藏对应工具:模型看不到就不会调,比在
  描述里劝它少调用更可靠。注意 live patch reload 下已注册工具不被宿主
  反注册,排除只对全新会话生效(已注释说明)
- memory_search 基础描述补「记忆已自动注入、注入里没有才搜」纪律(与
  #249 的 TOOL_GUIDE 互补:那是 opt-in,这里是零配置兜底);memory_archive
  补「仅用户要求或条目确实过时才归档,别自作主张清理」
- bin/dsh-mneme-mcp.mjs TOOL_SEARCH_DESCRIPTION 同步(lockstep 测试护栏)
- tests: 工具隐藏三态 + 描述纪律断言(tools.test.js)、features effective
  计数 +2(api.test.js)

Co-authored-by: Anans-Ivresse <[email protected]>
Copilot AI lite review requested due to automatic review settings September 21, 2026 06:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Warning

Review limit reached

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: slow-stack/dsh-mneme/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c8092e9f-f662-4429-9469-87fb3c0fd423

📥 Commits

Reviewing files that changed from the base of the PR and between 1496be2 and f7a35c7.

📒 Files selected for processing (9)
  • dsh-mneme/bin/dsh-mneme-mcp.mjs
  • dsh-mneme/lib/config.js
  • dsh-mneme/lib/settings.js
  • dsh-mneme/lib/tools.js
  • dsh-mneme/src/config.js
  • dsh-mneme/src/settings.js
  • dsh-mneme/src/tools.js
  • dsh-mneme/test/api.test.js
  • dsh-mneme/test/tools.test.js

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: slow-stack/dsh-mneme/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 7f0582f3-3859-44b8-b639-35fcd9fc34c1

📥 Commits

Reviewing files that changed from the base of the PR and between 9089a71 and cbc607a.

📒 Files selected for processing (9)
  • dsh-mneme/bin/dsh-mneme-mcp.mjs
  • dsh-mneme/lib/config.js
  • dsh-mneme/lib/settings.js
  • dsh-mneme/lib/tools.js
  • dsh-mneme/src/config.js
  • dsh-mneme/src/settings.js
  • dsh-mneme/src/tools.js
  • dsh-mneme/test/api.test.js
  • dsh-mneme/test/tools.test.js

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

本次变更新增两个记忆工具暴露开关,更新 memory_search 与 memory_archive 的描述,并增加工具隐藏行为、描述内容及 feature flag 数量测试。

Changes

记忆工具控制

Layer / File(s) Summary
配置与 feature flag
dsh-mneme/lib/config.js, dsh-mneme/src/config.js, dsh-mneme/lib/settings.js, dsh-mneme/src/settings.js
新增默认值为 false 的 disableMemorySearch 和 disableMemoryArchive,并将其加入 feature flag 白名单。
工具描述与暴露门控
dsh-mneme/bin/..., dsh-mneme/lib/tools.js, dsh-mneme/src/tools.js
更新两个记忆工具的调用说明。配置启用时,注册流程跳过对应工具并记录 info 日志。
行为验证
dsh-mneme/test/api.test.js, dsh-mneme/test/tools.test.js
更新 effective feature flag 数量断言,并测试单独或同时隐藏两个工具及其描述文本。

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: heptaspirit

Sequence Diagram(s)

sequenceDiagram
  participant FeatureFlags
  participant Config
  participant ToolRegistration
  FeatureFlags->>Config: 设置 disableMemorySearch 或 disableMemoryArchive
  Config->>ToolRegistration: 传递工具暴露配置
  ToolRegistration->>ToolRegistration: 跳过对应工具并记录 info 日志
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更的主要内容:新增工具暴露开关,并更新检索与归档的使用纪律。表述清晰、具体且简洁。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI review requested due to automatic review settings September 21, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 21, 2026 15:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@modusensus
modusensus merged commit 44cbf63 into main Sep 21, 2026
9 checks passed
@modusensus
modusensus deleted the feat/tool-exposure-switches branch September 21, 2026 15:41
modusensus added a commit that referenced this pull request Sep 21, 2026
CHANGELOG 的 [Unreleased] 转为 v0.8.6 小节,并补上三份未登账的改动:
工具暴露开关与描述纪律(#276)、蒸馏游标持久化(#229/#274)与旧宿主降级路径
(#279)、能力说明第 5 条文案精确性(#277)、CI 与徽章口径收敛(#281/#273/#272)。
两个 README 的 v0.8.6 占位行补描述(版本历史 + 路线图),测试徽章与注释数按
badge:sync 对齐到 1275。
modusensus added a commit that referenced this pull request Sep 21, 2026
* chore: v0.8.6 发布准备(版本号 + 测试徽章 + CHANGELOG/路线图占位行)

请在 CHANGELOG 与两个 README 的占位行补描述后再合并。

* chore(release): v0.8.6 发布说明与路线图补齐

CHANGELOG 的 [Unreleased] 转为 v0.8.6 小节,并补上三份未登账的改动:
工具暴露开关与描述纪律(#276)、蒸馏游标持久化(#229/#274)与旧宿主降级路径
(#279)、能力说明第 5 条文案精确性(#277)、CI 与徽章口径收敛(#281/#273/#272)。
两个 README 的 v0.8.6 占位行补描述(版本历史 + 路线图),测试徽章与注释数按
badge:sync 对齐到 1275。

---------

Co-authored-by: modusensus <[email protected]>
modusensus added a commit that referenced this pull request Sep 21, 2026
- 版本号 0.8.6 → 0.8.5:0.8.4 之后的下一个版本,npm 与 tag 均未占用(此前
  按 #276 注释里的 v0.8.6 定版,注释与 package.json 一并归位到 v0.8.5)。
- dsh-mneme/README.md「版本历史亮点」表是倒序(新在上),prep 脚本的占位行
  插在了最新已发布行(v0.8.4)之后,把 v0.8.5 排到了 v0.8.4 下面;移到表首。
  路线图表为正序,v0.8.5 留在末尾不变。
- src 三处注释与两处测试注释的版本标注同步;lib/ 由 npm run sync 重生成。
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