disc0nct/dsh-memory-plugin ↗★ 0

@deepseek-ai/dsh-tool-memory

为智能体提供跨会话的持久化记忆存储与检索。 适合需要智能体记住历史偏好、项目决策等跨会话信息的任务。

套件
@deepseek-ai/dsh-tool-memory
相容性
待驗證
Harness 依賴範圍
^0.1.1-rc.2
Cordis 依賴範圍
^4.0.1
版本
1.3.1
授權
MIT
最近更新
2026年8月22日

同名套件的其他儲存庫

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:disc0nct/dsh-memory-plugin

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