deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:disc0nct/dsh-memory-plugin
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A persistent memory plugin for DeepSeek Harness (DSH) that enables agents to store and recall information across sessions, similar to the memory system in Hermes agent AI.
keyword+semantic (token Jaccard + substring) with mode: hybrid|keyword|semanticgeneral)memory_store, memory_search, memory_get, memory_list, memory_delete, memory_clear, memory_statswrite+rename with mkdir -p, corrupt-file recovery to *.corrupt.*mtime cache (no re-read if unchanged), MAX_FACTS cap, timeoutMs:5000, isConcurrencySafe for readsmemory_clear requires confirm:true, exec.signal abort handlinglib/config|storage|validation|search/scoring|tools/*, peerDependencies to avoid dual-instance prepare bugThis package ships a dsh.bundle manifest, so it can be installed as a
regular profile bundle.
Add the plugin to your DSH profile (this runs pnpm add in the profile
directory, so a git URL works):
dsh plugin --profile <your-profile> add github:disc0nct/dsh-memory-plugin
Register it as a bundle in the profile's package.json
($DSH_HOME/profiles/<your-profile>/package.json):
{
"dependencies": {
"@deepseek-ai/dsh-tool-memory": "github:disc0nct/dsh-memory-plugin"
},
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"@deepseek-ai/dsh-tool-memory"
]
}
}
}
Boot the profile:
dsh --profile <your-profile>
Once installed, the following tools become available to your DSH agent:
memory_storeSave 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_searchSearch 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_getFast 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_listList 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_deleteDelete a specific memory by its key.
await ctx.tools.memory_delete({
key: "user-name"
});
memory_clearClear 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_statsGet 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}}
Memories are stored in ~/.dsh/memory.json with this structure:
{
"facts": [
{
"id": "unique-identifier",
"key": "user-name",
"value": "Alice",
"category": "preferences",
"timestamp": "2024-01-15T10:30:00.000Z"
}
]
}
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/<your-profile>/cordis.patch.yml):
- id: tool-memory
config:
memoryPath: /absolute/path/to/memory.json
// When user introduces themselves
if (userMessage.includes("my name is")) {
const name = extractName(userMessage);
await ctx.tools.memory_store({
key: "user-name",
value: name,
category: "identity"
});
}
// Later, when needing to address the user
const memory = await ctx.tools.memory_search({
query: "name",
category: "identity"
});
if (memory.results.length > 0) {
await ctx.tools.memory_store({
key: "greeting-used",
value: `Hello ${memory.results[0].value}!`,
category: "interaction"
});
}
// When starting work on a project
await ctx.tools.memory_store({
key: "project-start",
value: `Started work on ${projectName} at ${new Date().toISOString()}`,
category: "project"
});
// When making a technical decision
await ctx.tools.memory_store({
key: "tech-decision-db",
value: "Selected PostgreSQL for reliability",
category: "decisions"
});
// Later, when continuing work
const projectInfo = await ctx.tools.memory_list({
category: "project"
});
The plugin implements persistent memory by:
writeFile(tmp)+rename to ~/.dsh/memory.json (no double-write), mkdir -p, max 5000 factsmtime+size cache in lib/storage.js:8-78 — no re-read if file unchanged, clone on return, save updates cachelib/search/scoring.js:12-137 (token Jaccard + substring boosts) then ISO timestamp desc; empty query → recencymemory_store replaces existing memories with the same key and moves it to most-recentkey/category kebab-case (^[a-z0-9]+(-[a-z0-9]+)*$), value ≤10000 chars, category ≤32 charsmemory.json.corrupt.<ts> and returns empty storelib/config.js, lib/storage.js, lib/validation.js, lib/search/scoring.js, lib/tools/* (DSH apply re-exports)Config via @deepseek-ai/schemastery, defineTool with timeoutMs:5000, isConcurrencySafe for reads, kind hints, exec.signal abort, peerDependenciescrypto.randomUUID, fs/promises.rename/stat)@deepseek-ai/cordis: ^4.0.1@deepseek-ai/dsh-tools: ^0.1.0-rc.8@deepseek-ai/schemastery: ^3.18.1MIT License - feel free to use, modify, and distribute this plugin.
To contribute to this plugin:
Inspired by the memory systems in agents like Hermes AI, this plugin brings similar long-term memory capabilities to the DeepSeek Harness ecosystem.
Built with ❤️ for the DSH community
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。