chancelu/dsh-llmwiki

本地Markdown wiki作为DeepSeek Harness的长期记忆——RRF融合检索(关键词+wikilink图+时间维度),令牌预算注入,自动捕获。从llmwiki移植而来。

项目介绍Project Overview

dsh-llmwiki 是 DeepSeek Harness 的长期记忆插件,基于本地 Markdown 知识库。它通过关键词、wikilink 图谱与时间检索融合 RRF,在每轮注入相关上下文,并提供 memory_search、memory_save 工具及自动日志。适合需要跨会话记忆、可用 Obsidian 整理笔记的场景。注意:ripgrep/SQLite FTS 与 LLM 自动整理尚未移植。

dsh-llmwiki is a DeepSeek Harness plugin that adds long-term memory using a local Markdown vault. It injects relevant wiki context per turn, registers memory_search and memory_save tools, and auto-captures sessions to daily logs, using keyword, wikilink-graph, and temporal retrieval fused by RRF under a token budget. Use it for cross-session recall and Obsidian-curated notes. Caveat: ripgrep/SQLite FTS and LLM curation are not yet ported.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add dsh-llmwiki

chancelu/dsh-llmwiki 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-llmwiki

Context Window = RAM, Local Wiki = Disk — long-term memory for DeepSeek Harness, powered by your local Markdown vault.

TypeScript port of llmwiki (Python: llmwiki-harness on PyPI), packaged as a native dsh plugin.

What it does

Mechanism dsh extension point
Inject relevant wiki knowledge into the same turn's model request session/event (agent/inbox/spliced, pre-assembly live event) → ctx.systemPrompt.context()
Teach the model about memory ctx.systemPrompt.section()
memory_search — model recalls prior sessions / curated notes ctx.tools.register()
memory_save — model persists durable insights ctx.tools.register()
Auto-capture every turn to chronicle/daily/YYYY-MM-DD.md session/event (turn/end)

Retrieval: keyword + wikilink graph + temporal strategies fused with RRF (Reciprocal Rank Fusion), assembled under a token budget, with an LRU + TTL cache. Zero runtime dependencies beyond Node.js.

Vault layout (created automatically)

my-vault/
├── raw/               # Layer 1: session dumps
├── chronicle/daily/   # Layer 2: auto-captured daily logs
├── entities/          # Layer 3: compiled knowledge
├── concepts/
├── comparisons/
├── projects/
└── queries/

Open it with Obsidian, curate Layer-3 notes with [[wikilinks]] — the graph strategy follows them.

Install

Requires Node.js ≥ 22 (same as dsh itself) and a working dsh CLI (npm install -g @deepseek-ai/dsh) with pnpm on PATH.

# from npm
dsh plugin --profile web add dsh-llmwiki

# or from a tarball
dsh plugin --profile web add ./dsh-llmwiki-0.1.1.tgz

# verify the layer, then boot
dsh --profile web --dump-config   # shows a "# == dsh-llmwiki" layer
dsh web                           # logs: [dsh-llmwiki] memory plugin loaded, vault: ...

The package declares dsh.bundle, so dsh plugin add activates it automatically — no manual patching needed.

Configure

The plugin works zero-config (vault defaults to ~/llmwiki-vault). To override, add a row to your profile's cordis.patch.yml (or a --patch overlay) — note the override restates the row by id without insert:

- id: llmwiki
  config:
    vaultPath: /path/to/your/vault   # Obsidian vault welcome
    tokenBudget: 2000
    strategies: [keyword, graph, temporal]
    daysBack: 7
    topK: 5
    autoInject: true
    autoCapture: true

A patch replaces the row's entire config, so restate every key you want to keep.

Config

Key Default Meaning
vaultPath ~/llmwiki-vault Markdown vault path; structure created if missing
tokenBudget 2000 Max tokens of injected wiki context
strategies [keyword, graph, temporal] Enabled recall strategies
daysBack 7 Temporal look-back window
topK 5 Results per retrieval
priority relevance Assembly priority: relevance / recency / diversity / structured
cacheTtl 300 Cache TTL seconds
autoInject true Inject wiki context on each user message
autoCapture true Append each turn to the daily chronicle

How the pieces map from the Python original

Python (llmwiki) TypeScript (dsh-llmwiki)
core/retriever.py src/retriever.ts
core/assembler.py src/assembler.ts
core/cache.py src/cache.ts
vault/capture.py src/capture.ts
search/python_engine.py merged into retriever.ts (keeps the package zero-dep)
OpenClawMemoryHook adapter the dsh plugin itself (src/index.ts)

Not yet ported: ripgrep / SQLite FTS engines (the pure-JS engine keeps installs dependency-free — contributions welcome), the LLM-driven curate pipeline (run the Python CLI alongside for now).

License

MIT

上一个 Prev dsh-nix 下一个 Next otto-dsh