Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add auuduu/dsh-timem-memory --skill timem-rule-learninggit clone --depth 1 https://github.com/auuduu/dsh-timem-memoryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/auuduu/dsh-timem-memory/timem-rule-learning)<a href="https://agentmods.dev/skills/auuduu/dsh-timem-memory/timem-rule-learning"><img src="https://agentmods.dev/badge/skills/auuduu/dsh-timem-memory/timem-rule-learning.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00141 | $0.02225 |
| Opus 5 | $0.00071 | $0.01112 |
| Sonnet 5 | $0.00028 | $0.00445 |
| Haiku 4.5 | $0.00014 | $0.00222 |
Grade A, and why
timem-rule-learning scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.
TiMEM Rule Learning(DSH 适配版)
编排规则闭环 —— recall → apply → grade → learn —— 只用 MCP 原子工具。
规则是可复用的 「情境 X 做 Y」 教训:它们改变智能体下一次的行为。
没有情境→行动教训的事实、偏好、背景归记忆 skill(mcp__timem__create_memory),不归这里。
可用性检查
TiMEM 工具在 DSH 中以 mcp__timem__* 命名。若工具列表中不存在这些工具,说明 TiMEM MCP 未连接——跳过本 skill,不要猜别的工具名。
触发
TiMEM MCP 已连接且出现以下任一情况:
- 新用户回合开始(首次实质响应前必须基线调用
mcp__timem__recall_rules) - 用户要求学习、回忆或管理可复用规则
- 用户说「记住/always/never」或给出可能形成可复用教训的纠正
指令
- Recall:每个用户回合开始时调用一次
mcp__timem__recall_rules,在首次实质响应或行动之前。空结果是正常的——继续干活。 - Verify & Apply:对照当前请求和文件核实每条命中的规则。只应用匹配的。记录你实际应用的
rule_id。 - 干活:执行用户请求。
- Grade:结果可知后,对每条实际影响过行动的规则调用
mcp__timem__record_rule_outcome(rule_id, helpful, note)。 - Learn:任务结束时评估是否出现了可靠的「当 X,做 Y」教训。是 →
mcp__timem__learn_rule(每任务最多 3 条)。否 → 学 0 条。
任务生命周期清单
- [ ] 1. 每个用户回合 → 首次实质响应/行动前 recall_rules 一次
(包括简单或一次性请求;空结果正常——继续)
- [ ] 2. 对照当前请求/文件核实每条命中;只应用匹配的;跟踪已应用的 rule_id
- [ ] 3. 干活
- [ ] 4. 结果可知 → 对每条 APPLIED 规则 record_rule_outcome(helpful=true/false + note)
- [ ] 5. 任务结束 → LEARN EVAL:本对话是否产生了可靠的、跨未来类似情境仍有用的
situation→action 规则?
- 否 → 学 0 条
- 是 → 直接 learn_rule;每个判断点一条,最多 3 条
- 不要为了判断重复而先跑 recall/list
Recall(摘要)
每个用户回合做一次强制性基线 mcp__timem__recall_rules 调用,在首次实质响应或行动之前。
问候、澄清问题、只读回答、极小的一次性请求都不跳过。同一回合后续出现实质性新决策背景时
允许追加 recall。
mode |
用途 |
|---|---|
similarity(默认) |
仅标签/BM25/向量检索;不做适用性判断 |
judged |
对完整过滤后的规则池做判断 |
auto |
检索 top_k,对候选做判断,判断失败回退检索 |
必填: 一个非空 query_text 用于检索。judged/auto 需要决策证据时才传
judge_scene_text 和 judge_context_text。
Grade(应用后必须)
应用规则的结果可知后:mcp__timem__record_rule_outcome(rule_id, helpful, note) —— 每条
实际影响过行动的规则调用一次。helpful=false 加例外说明,是让后端改进该规则的方式。
绝不为未应用的规则打分,绝不在结果可观察前猜测。
Learn(摘要)
任务结束时问一个核心问题:
本对话/情境是否揭示了一条可靠的 「当 X,做 Y」 教训,且在未来类似情境中仍然有用?
三个维度都明确为「是」才学:
- 长期可复用: 超越当前条目、回合、日期或临时状态仍然有用。
- 可泛化: 适用于当前用户/智能体范围内的一类未来类似情境——不只是这一次。
- 可靠且可行动: 有明确的持久指令/纠正或已验证的结果支撑,并点明具体行动。
否则学 0 条。明确的「记住/always/never」措辞或纠正触发的是立即评估,不是自动学习。 纯事实/偏好归记忆,静态仓库约定归项目文件,秘密哪里都不放。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 7d ago First seen · 143 lines · 141 tokens per session scan A df57065c640d
timem-rule-learning is a skill published in the GitHub repository auuduu/dsh-timem-memory (0 stars, last pushed 20d ago), licensed MIT. It adds 141 tokens to every session and 2,225 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
causal-memory
Causal memory for agents — install/setup the causal-memory MCP server, then record decisions/outcomes and recall them before acting. Trigger when the user asks to install or set up causal-memory/agent memory, when causal-memory MCP tools are available and the agent faces a non-trivial decision (architecture, debugging…
event-review
A weekly review process for event logs and leftover task records, turning repeated problems or useful lessons into proposed memory, knowledge, or skill entries.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
Context Doctor
Identify and repair degradation in system prompt, external memory, and skills preventing you from following instructions or remembering information as well as you should.
dsh-sdk-upgrade
Safely select and install a compatible official @deepseek-ai SDK release for dsh plugin projects (dsh-web, dsh-trading, and similar monorepos) from npm using an isolated worktree, explicit cohort review, CI-equivalent validation, and controlled rollout — including syncing the project's declared DSH host-version floor…
dsh-web-sdk-compatibility
Adapt and repair dsh-web after an approved official @deepseek-ai SDK/runtime cohort is selected or installed. Compare public API, type, service-injection, module-table, protocol, and behavior changes; map every change to repository consumers; implement the smallest fixes and durable compatibility contracts; handle…