WeilaiSun / dsh-hindsight-memory

Listed

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

masterToolSession View source

Installation

npx -y @deepseek-ai/dsh plugin --profile web add github:WeilaiSun/dsh-hindsight-memory

This installation command is an unverified starting point generated from the GitHub repository address.

README

Maintainer-authored documentation snapshot.

View on GitHub ↗
Commit fc6a286Synced Aug 18, 2026

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

KeyDefaultDescription
venvPythonF:\Hermes\HERMES_HOME\hermes-agent\venv\Scripts\python.exePython with hindsight_embed installed
configJsonF:\Hermes\HERMES_HOME\hindsight\config.jsonJSON with llm_api_key / llm_base_url / llm_model (source of the DeepSeek key; never hardcoded)
llmBaseUrl / llmModel / llmProviderDeepSeek defaultsEmbedding endpoint; deepseek/openai_compatible/openrouter map to openai
profiledeepseekHindsight profile name (own daemon port + PG instance + bank)
bank= profileBank id used by retain/recall/reflect
autoRecallfalseInject relevant memories before each agent step
recallTypes["observation","experience","world"]Fact types searched
recallLimit4Max memories per recall
recallMinUserChars20Min user-message length before auto-recall triggers
recallBudgetTokens1200Token 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

Project files and signals

Shown items are public repository signals detected in the directory snapshot.

DocumentationDetected

Repository information

Language
JavaScript
License
MIT
Last updated
Aug 14, 2026, 9:17 AM

Install deliberately

Review source code, permissions, lifecycle hooks, dependencies and network access. Test untrusted plugins in an isolated environment.