DeepSeek Harness 插件

dsh-project-memory

为 DeepSeek Harness 提供的项目记忆插件:项目文件在读取时索引为可检索摘要,上下文失效后按需检索命中,无需重读文件,自带出处与 BM25 排序。

跳到安装方式

来源信息

GitHub 仓库
00080000/dsh-project-memory
最近更新
2026年8月20日
分类
记忆
GitHub stars
0

安装

默认先复制一段 Prompt,让 Agent 读页面和仓库;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读页面和仓库。

请先不要安装。阅读这个 DeepSeek Harness 插件,说明它解决什么问题、会访问哪些文件、网络或密钥,以及如何安装和卸载。

插件页面:https://deepseekplugins.org/zh/plugins/00080000/dsh-project-memory
GitHub:https://github.com/00080000/dsh-project-memory
插件名:dsh-project-memory
作者:00080000
安装命令:dsh plugin --profile web add "https://github.com/00080000/dsh-project-memory/releases/latest/download/dsh-project-memory-0.1.0.tgz"

确认前不要执行安装命令。

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-project-memory

[English](README.md) | [简体中文](README.zh-CN.md)

Persistent project memory for DeepSeek Harness(dsh) agents. Indexes documents (PDF / Markdown / txt) and code symbols into a per-workspace store, refreshes them automatically, and recalls them with source citations — documents are cross-linked to the code symbols they reference.

> The plugin keeps a compact project index on disk, with every entry pointing to a concrete file and line — the agent can reorient quickly instead of re-reading the whole project.

Features

  • Document indexing — PDF, Markdown, and plain text files are chunked and summarized by the LLM; each entry carries a path:line citation back to the source.
  • Code symbol table — function and class names are extracted with a lightweight regex scanner, without LLM token usage.
  • Automatic refresh — a background poll (watch_repo) detects new or changed files by content hash and re-indexes only those.
  • Read-time indexing — files are indexed the moment the model actually reads them (fs/observed), so the index is a byproduct of normal work, not a separate upfront scan. Files that are never read are never indexed. The project root is detected by markers (.git, package.json, …), a README plus source directories, or the file's own directory as a last resort.
  • Doc ↔ code cross-linking — when a document mentions a symbol, the match is recorded as a reference; querying a symbol also surfaces the documents that describe it.
  • BM25 retrieval — ranked search over documents, symbols, and experience notes, with optional LLM query expansion to handle vocabulary mismatch.
  • Experience notes — problems → solutions; similar problems supersede instead of duplicating, and notes are returned only when a search matches.
  • Minimal dependencies — pure JavaScript; the only runtime dependency is pdfjs-dist (PDF text extraction), no native builds required.

How it works

The design follows four principles:

  • Volatility — context is ephemeral; it is lost when a session is compacted.
  • Persistence — the index is stored on disk and survives compaction and new sessions.
  • Compactness — only summaries are stored; the index runs around 0.5% the size of the source it covers (8.8 MB of source → 49 KB of index in the example project), so retrieval replaces re-reading the full file.
  • Verifiability — hits carry a path:line citation where applicable, so the agent can confirm details against the source.

Building the index does not require an upfront scan: files are indexed as the model reads them, so the index grows to cover exactly what has been worked with. Re-reading a file that has not changed is a no-op (content hash), so the index stays fresh with minimal ongoing overhead.

The store is per-project and follows the codebase: changed files are re-extracted by content hash, deleted files are removed. Experience notes are retrieval-only, so accumulation does not affect context.

Installation

cd dsh-project-memory
dsh plugin --profile web add . -w

The -w (workspace-root) flag is required: the profile directory is a pnpm workspace root, and pnpm rejects add there without it. From any other directory, the path form works the same: dsh plugin --profile web add /path/to/dsh-project-memory -w.

A prebuilt tarball is published with each release, installable without a build step:

dsh plugin --profile web add /path/to/dsh-project-memory-0.1.0.tgz

Each indexed project has its own store at <root>/.dsh-project-memory/. Add it to .gitignore if it should not be committed.

Usage

The tools below are invoked by the agent, not typed by the user. In the chat, just ask naturally — e.g. "index this project" or "what does the auth module do?" — or simply keep working, and the agent calls the matching tool automatically. By default (lazyIndexing) files are indexed the moment the model reads them, so memory fills in while you work. watch_repo keeps explicitly-watched roots fresh in the background; index_repo forces a full backfill of a project (unchanged files are skipped).

ToolPurpose
index_doc file_pathIndex one document (PDF/MD/txt): chunk → LLM summary → store with path:line. Unchanged files are skipped.
index_repo rootIndex a whole project: docs get LLM summaries, code files get a zero-token symbol table. Incremental, cleans up deleted files, cross-links docs to symbols.
watch_repo rootEnable automatic refresh: a background poll detects new/changed files (mtime + content hash) and re-indexes only those. Watched roots persist across plugin restarts.
query_memory queryBM25 search over docs + symbols + experience, optionally query-expanded by the LLM. Returns ranked hits with relative scores, sources, and doc→symbol references.
remember problem solutionSave an experience note. Similar problems supersede instead of duplicating.
forget id_or_queryDelete stale experience notes.

Design

.dsh-project-memory/
  index.json       file-level content-hash map (incremental)
  entries.json     doc summaries + symbol table entries, keyed by file
  experience.json  problem → solution notes (retrieval-only)
  watch.json       watched roots
  • Incremental — content hash per file; only changed files are re-extracted.
  • Cross-linking — after indexing, doc summaries are matched against symbol names; matches are attached to the doc entry as references and surfaced by query_memory.
  • Query expansionquery_memory may ask ctx.llm to rewrite the query into several variants (synonyms, EN/CN, identifier guesses) and then merges BM25 scores across variants. Auto-enabled for CJK queries (Chinese/Japanese/Korean) so Chinese questions can match English symbol names; config-gated otherwise (llmQueryExpansion, default off).
  • Consistency — the fact layer follows the codebase (hash re-extract / remove-on-delete); the experience layer is retrieval-only with supersede and forget. Store writes are serialized per memory directory; the lock is in-process, so avoid running multiple dsh instances against the same project store concurrently.

Configuration

KeyDefaultMeaning
memoryDir.dsh-project-memorystore directory inside each indexed root
chunkChars3000max chars per document chunk
maxChunksPerFile40max chunks per document
maxFileSizeMb50skip text and code files larger than this (MB)
maxOutputChars8000cap for query_memory result text (chars)
maxPdfPages1000PDF page cap when pages are not otherwise limited
llmQueryExpansionfalseexpand queries via ctx.llm before BM25 (off by default to save tokens)
expansionCount6max expansion variants
lazyIndexingtrueindex files the moment the model reads them (fs/observed)
autoIndexOnFirstUsefalsefull scan of the current working directory on plugin load (opt-in)
watchtrueenable the background refresh
watchInterval15poll interval (seconds)

Toggling features

The two most relevant switches are lazyIndexing (index a file the moment the model reads it; default on) and autoIndexOnFirstUse (full scan of the current working directory on plugin load; default off). Lazily indexed project roots are automatically registered with the watcher, so changed files stay fresh without an explicit watch_repo.

Settings live in the plugin's config object. To change them, add an override entry to your profile's cordis.patch.yml — for the web profile that is ~/.dsh/profiles/web/cordis.patch.yml:

- id: project-memory
  config:
    lazyIndexing: true          # on: index files as the model reads them (default)
    autoIndexOnFirstUse: false  # off: no upfront full scan (default)
    llmQueryExpansion: false    # off: do not spend tokens on LLM query expansion (default)
    watch: true                 # on: background refresh for watched roots (default)
    watchInterval: 15           # poll interval in seconds

Only list the keys you want to change; the rest fall back to the plugin defaults. Verify the result with dsh --profile web --dump-config.

For a one-off run without editing the profile, pass the override as a CLI patch overlay:

dsh web --patch ./config.yml

where config.yml contains the same override block.

Development (for contributors)

These commands are for maintaining the plugin code — regular users do not need them. Installing the plugin only requires the command in [Installation](#installation).

npm install
npm test          # 62 checks: chunker / symbols / store / tools / BM25 / links / watch / lazy / config / dump / concurrency / restore / size limit

License

MIT