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)

master도구세션 소스 보기

설치

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

이 설치 명령은 GitHub 저장소 주소에서 생성된 확인되지 않은 시작점입니다.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 fc6a286동기화 2026. 8. 18.

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

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

문서감지됨

저장소 정보

언어
JavaScript
라이선스
MIT
마지막 업데이트
2026. 8. 14. 오전 9:17

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.