songjongdevsecops/dsh-lembrar ↗★ 0

dsh-lembrar

跨会话历史发言的语义召回与注入工具 适合需要Agent在对话中自动参考、召回同工作区历史记忆的用户。

套件
dsh-lembrar
相容性
待驗證
版本
0.1.1
授權
MIT
最近更新
2026年10月18日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:songjongdevsecops/dsh-lembrar

Configuration

Every path is configurable and the defaults derive from your home directory, so nothing is tied to a specific machine. Override by environment variable, or by the config of the lembrar line in your profile patch. A patch replaces the whole config of the line, so restate every key you want to keep.

Config keyEnvironment variableDefaultMeaning
colecao—sessoes-bgem3-v1memsearch collection
injetar—trueappend memories to each turn via agent/pre-step
maxTokens—800token cap for the appended block (~4 characters per token)
k—8events returned by one search, before the token cut
scoreMinimo—0.55similarity floor; below it the hook stays silent
buscarHabilitado—trueregister the on-demand lembrar tool
buscarTimeoutMs—30000engine timeout per search
exigirMesmoCwd—trueonly sessions with the caller's exact cwd are authorized
estadoDirLEMBRAR_ESTADO_DIR$XDG_STATE_HOME/dsh-lembrar/.estado, or `
/.lembrar/.estadofor a locallink:` installwhere the index marker lives
bancoLEMBRAR_BANCO~/.dsh/storages/session-search.dbsession database
memsearchLEMBRAR_MEMSEARCHmemsearch on PATHsearch engine binary

Profile patch example (~/.dsh/profiles/web/cordis.patch.yml):

- id: lembrar
  config:
    colecao: sessoes-bgem3-v1
    estadoDir: '/home/you/.local/state/dsh-lembrar/.estado'

Usage

You do not call anything. On the first step of each turn the hook searches your current message against the index, keeps the hits above the floor, and appends a short block at the end of the message list. Appending (never rewriting an earlier message) is what preserves the prompt prefix cache: only the new suffix is paid for. When nothing matches, the decision comes back untouched and the turn costs zero extra tokens.

The agent can also search on demand with the lembrar tool:

lembrar { "consulta": "what did we decide about the backup schedule" }

Each hit returns session_id, seq and the excerpt. The lembrar-recall skill describes the follow-up: open the original event with session_event_read when the excerpt is not enough.