返回目录
Agent 与会话 插件

dsh-hindsight-memory

WeilaiSun/dsh-hindsight-memory

Semantic long-term memory for DeepSeek Harness: hindsight_retain/recall/reflect tools + auto-recall over local Hindsight daemon (pgvector + DeepSeek embeddings)

Stars
1
Forks
1
Issues
0
更新
5 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:WeilaiSun/dsh-hindsight-memory

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-hindsight-memory

Semantic long-term memory for DeepSeek Harness — native hindsight_retain / hindsight_recall / hindsight_reflect tools over a local Hindsight daemon (PostgreSQL + pgvector + DeepSeek embeddings), with optional auto-recall injection before each agent step.

Everything is a plugin — this is a Cordis plugin that installs with dsh plugin add.

Why

DeepSeek Harness's built-in memory is session-scoped (per-session event logs + AGENTS.md instructions). This plugin adds cross-session semantic memory: high-value facts, user preferences, and lessons learned are embedded into a vector store and retrieved by meaning, not keywords — like Hermes's Hindsight integration.

Features

  • hindsight_retain — write a memory; Hindsight automatically extracts facts, resolves entities, generates the embedding, deduplicates similar facts, and links temporally/semantically.
  • hindsight_recall — semantic search (embedding similarity + knowledge-graph spreading activation). The query does not need to match keywords.
  • hindsight_reflect — LLM synthesis over recalled facts / mental models / directives for a distilled answer.
  • autoRecall — when enabled, the plugin hooks agent/pre-step and injects relevant memories as a <system-reminder> user message before each step, so the model never starts a task cold.
  • Isolation — the plugin drives its own Hindsight profile (default deepseek): independent daemon port, independent PostgreSQL instance, independent bank. It never reads or writes another profile's data.

Prerequisites

  • A local Hindsight install with the Python package hindsight_embed in a venv.
  • A DeepSeek API key (or any OpenAI-compatible endpoint) for embeddings.

The defaults expect the standard Hermes layout (F:\Hermes\HERMES_HOME\...); override with config if your install lives elsewhere.

Install

From GitHub (works today):

dsh plugin --profile web add git+https://github.com/WeilaiSun/dsh-hindsight-memory.git

From npm (once published):

dsh plugin --profile web add dsh-hindsight-memory

Then add the row to your agent preset or profile patch (cordis.patch.yml):

- id: hindsight-memory
  name: 'dsh-hindsight-memory'
  config:
    autoRecall: true

A new session picks it up (agent presets are fixed per session at creation).

Configuration

Key Default Description
venvPython F:\Hermes\HERMES_HOME\hermes-agent\venv\Scripts\python.exe Python with hindsight_embed installed
configJson F:\Hermes\HERMES_HOME\hindsight\config.json JSON with llm_api_key / llm_base_url / llm_model (source of the DeepSeek key; never hardcoded)
llmBaseUrl / llmModel / llmProvider DeepSeek defaults Embedding endpoint; deepseek/openai_compatible/openrouter map to openai
profile deepseek Hindsight profile name (own daemon port + PG instance + bank)
bank = profile Bank id used by retain/recall/reflect
autoRecall false Inject relevant memories before each agent step
recallTypes ["observation","experience","world"] Fact types searched
recallLimit 4 Max memories per recall
recallMinUserChars 20 Min user-message length before auto-recall triggers
recallBudgetTokens 1200 Token budget for auto-recall injection

Usage

The model calls the tools directly. Example retention policy (mirrors a self-evolution protocol):

  • Retain after complex tasks (5+ tool calls), after resolving a pitfall, when the user expresses a durable preference, or after key design decisions.
  • Recall at the start of complex tasks, when the user references past work, or when a situation smells like a repeat.
# agent preset row with auto-recall enabled
- id: hindsight-memory
  name: 'dsh-hindsight-memory'
  config:
    autoRecall: true
    recallLimit: 5

How it works

agent step (autoRecall) / model tool call
        │
        ▼
plugin (node) ──ensure daemon──▶ hindsight_embed (Python) ──spawn──▶ Hindsight daemon (REST)
        │                                                                      │
        └────────── fetch ──▶ /v1/default/banks/{bank}/memories[/recall|/reflect]
                                                                               │
                                                        PostgreSQL + pgvector + DeepSeek embeddings

The daemon auto-starts on first use and idle-stops (default 10 min). The plugin caches the daemon URL and re-ensures on failure.

Development

git clone <this-repo>
cd dsh-hindsight-memory
node --check lib/index.js          # syntax
node smoke-test.mjs                # end-to-end: fake ctx + real daemon

License

MIT

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类Agent 与会话
规则置信度

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: memory、semantic-search、vector-database。