MeghanBao/dsh-backstory ↗★ 2

dsh-backstory

Ask any line of code its backstory: what it does, and why it's here — grounded in git history and the agent's own session log. Ships a DeepSeek Harness plugin and a standalone MCP server. 适合需要追溯代码修改原因、作者及关联智能体对话的软件开发任务。

パッケージ
dsh-backstory
互換性
未検証
Harness ピア範囲
*
Cordis ピア範囲
*
バージョン
0.8.2
ライセンス
MIT
最終更新
2026/08/29

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:MeghanBao/dsh-backstory

ドキュメント

README 全文を読む ↗

Usage

Type the /backstory command, optionally with a file and line range:

/backstory src/auth.ts:40-60
/backstory utils/date.ts

Or just ask the agent in natural language (it uses the same backstory tool):

  • "what's the backstory of src/auth.ts line 88?"
  • "explain utils/date.ts lines 10–40 and why each part is there"

The tool returns each line with the commit that last touched it (author, date, message) and — when known — the agent turn/prompt that wrote it (🧬t). The agent narrates what the code does and uses the commit message + origin for why. Outside a git repo it degrades gracefully to source-only.

Tool: backstory

ParamTypeNotes
pathstring (required)absolute or workspace-relative
linenumberfirst line (1-based); omit for the whole file
endLinenumberlast line; defaults to line

Whole-file reads are bounded to 400 lines.

The ledger & commit trailers

The plugin records every write/edit to .dsh/backstory.jsonl automatically (via a tools/post-execute observer) — commit that file to make provenance travel with the repo.

To also anchor provenance in git history (drift handled by git), install the prepare-commit-msg hook once per clone:

npm run install-hook

From then on every commit gets the newest ledger record for its staged files folded into trailers automatically:

DSH-Turn: 14
DSH-Prompt: 支持德语双语
DSH-Session: 0f3a…

The hook is best-effort (never blocks a commit), idempotent (safe on --amend), and self-disabling if removed. It backs up any existing hook to *.backup.

Incremental explanations

Explaining a line costs a model call, so explanations are cached. After the agent explains the unexplained lines from a backstory result, it calls backstory_remember to store them — keyed by each line's content hash, in .dsh/backstory-notes.jsonl. Next time, unchanged lines come back with their explanation already attached (↳), and only lines whose text changed need re-explaining. Cheap, and never stale.

Privacy: redaction & opt-out

Prompts are stored in the ledger (and, via the hook, in commit trailers), so common secrets are scrubbed automatically before they are written — OpenAI / GitHub / AWS / Slack / Google keys, JWTs, Bearer tokens, and key=value pairs for password / token / secret / api_key become [REDACTED].

Turn recording off, or add your own patterns, via .dsh/backstory.config.json:

{ "record": true, "redactPatterns": ["ACME-\\d+"] }

Or disable it everywhere with an env var: DSH_BACKSTORY_DISABLE=1.

⚠️ Redaction is best-effort pattern matching, not a guarantee — review commits before pushing, and opt out for anything sensitive.