disc0nct/dsh-memory-plugin ↗★ 0
@deepseek-ai/dsh-tool-memory
为智能体提供跨会话的持久化记忆存储与检索。 适合需要智能体记住历史偏好、项目决策等跨会话信息的任务。
同名包的其他仓库
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:disc0nct/dsh-memory-plugin说明文档
阅读完整 README ↗Usage
Available Tools
Once installed, the following tools become available to your DSH agent:
memory_store
Save an important fact to long-term memory.
// Store a user preference
await ctx.tools.memory_store({
key: "user-name",
value: "Alice",
category: "preferences"
});
// Store project information
await ctx.tools.memory_store({
key: "project-language",
value: "TypeScript",
category: "project"
});
// Store a decision
await ctx.tools.memory_store({
key: "api-decision",
value: "Use REST API for simplicity",
category: "decisions"
});
memory_search
Search for memories by keyword, category, or semantic paraphrase (hybrid keyword+token Jaccard ranking, dependency-free).
// Search all memories
const results = await ctx.tools.memory_search({
query: "Alice"
});
// Search by category
const results = await ctx.tools.memory_search({
category: "preferences"
});
// Combined search
const results = await ctx.tools.memory_search({
query: "API",
category: "decisions",
limit: 5
});
// Semantic paraphrase: "fav color" matches "favorite-color"
const results = await ctx.tools.memory_search({
query: "fav color",
mode: "hybrid" // | "keyword" | "semantic" (default: "hybrid")
});
// Force exact substring only
const results = await ctx.tools.memory_search({
query: "color",
mode: "keyword"
});
memory_get
Fast exact lookup by key (vs memory_search scan).
const { found, fact } = await ctx.tools.memory_get({ key: "user-name" });
if (found) console.log(fact.value);
memory_list
List all stored memories (most recent first, optionally filtered).
// List all memories
const memories = await ctx.tools.memory_list();
// List memories by category
const memories = await ctx.tools.memory_list({
category: "project"
});
memory_delete
Delete a specific memory by its key.
await ctx.tools.memory_delete({
key: "user-name"
});
memory_clear
Clear ALL stored memories (requires explicit confirmation).
// cancelled without confirm
await ctx.tools.memory_clear(); // { cleared:false, count: N }
// confirmed
await ctx.tools.memory_clear({ confirm: true }); // { cleared:true, count: N }
memory_stats
Get health stats (count, per-category, oldest/newest, file size).
const stats = await ctx.tools.memory_stats();
console.log(stats.count, stats.categories); // {count: 12, categories:{project:5}}
Configuration
The memory file defaults to $DSH_HOME/memory.json (or ~/.dsh/memory.json
when DSH_HOME is unset). Override it in the profile's patch layer
($DSH_HOME/profiles//cordis.patch.yml):
- id: tool-memory
config:
memoryPath: /absolute/path/to/memory.json