Files
hermes-agent/plugin-catalog/memory-shaper.yaml

22 lines
5.0 KiB
YAML

name: memory-shaper
title: "Dynmem (keyword index)"
repo: https://github.com/ockentap/hermes-dynamic-memory
sha: "f2aa3a2dadbd2204e4c058572c2ed833b5999146"
subdir: plugin/dynmem
description: "Keyword-index memory for Hermes: a small resident index of 'keyword keyword -> file.md' routing lines stays in the system prompt while verbose topic files stay on disk and are read only when the conversation touches their keywords. Retrieval is done by the model reading a literal index — no embeddings, no vector store, no retrieval service. Disclosure — a pre_tool_call hook and a tool_execution middleware refuse a non-memory tool's write to the memory index across the recognised write vectors (write_file, patch, shell redirects, tee, sed -i; best-effort against arbitrary shell indirection) and refuse malformed index lines with a fix message rather than fixing them silently (including the keyword count: an entry outside the documented 5-20 keywords is refused, and the ASCII arrow is refused on every code path), while read-only commands and reads through a pipe always pass so the agent can audit the file it maintains; the same guard refuses any memory-tool remove, replace or patch whose old_text lands inside the index header, because on the stock store the whole preamble is a single §-joined entry and such an edit would rewrite or delete every header line at once; a documented escape hatch lets a scripted rewrite proceed when the sentinel file $HERMES_HOME/state/.dynmem_rewrite_approved exists or DYNMEM_ALLOW_REWRITE=1 is set. Beyond $HERMES_HOME/memories/, the guard reads one thing: when a shell command invokes python3 on a script file, it opens that script (and the execute_code payload is already in args) to check whether the code would write the index; no file content is retained or sent anywhere. The repo also ships an optional core patch (scripts/patches/0001-flat-memory-separator.patch, changes tools/memory_tool_store.py) that the plugin does not need and never applies; a user who applies it by hand must re-apply it after every Hermes update. No network calls, no subprocesses, nothing spawned in the background. The pre-1.8 MEMORY_SHAPER_* variable names and the .memory_shaper_rewrite_approved sentinel are still accepted, so the rename cannot strand an existing install. A second hook pair (pre_llm_call + transform_llm_output) appends, only when the plugin's own setting plugins.entries.dynmem.settings.memcheck.enabled is true (off by default; MEMCHECK_DISABLED=1 is a one-process kill switch), a hidden tagged self-report to the first four user messages of a session asking which memory files were read, which were nearly read, and whether the routing turned out wrong; on Hermes 0.22.6 and later the transform hook is registered with hold_stream so the tag never streams to the user (older releases show it while the reply streams), the tag is stripped before the reply is stored or shown, every claim (filename, keyword, quoted fact) is checked against the index and the topic file body, and it is skipped on cron, subagent, one-shot and batch runs. That hook keeps per-session state under $HERMES_HOME/state/memcheck/: state.json holds the last four user messages and the last verdict, samples.jsonl appends one record per checked turn (the tag fields plus the first 400 characters of the user message) and rotates at 5 MiB, keeping one previous window as samples.jsonl.1; nothing leaves the machine. A third pre_llm_call hook adds one setup question to the first turn after install (fewer requests or fewer tokens), asking the agent to record the answer with hermes config set plugins.entries.dynmem.settings.profile, then adds a one-line mode reminder once per session; it skips cron, subagent, one-shot and batch runs and keeps only the asked time and the last 50 session ids in $HERMES_HOME/state/dynmem/billing.json. Separately, the plugin writes one line of its own: when MEMORY.md already looks like a dynmem index (an arrow entry or the template line), it inserts or refreshes a single '# All memories are located in: <absolute path>' header line, atomically, with one backup slot under $HERMES_HOME/state/, and DYNMEM_NO_PATH_HEADER=1 disables it; a stock-store or prose MEMORY.md is never touched. An index write that would give a file a second entry point is refused too: a line whose target already owns an index line (DUPLICATE TARGET), or a file already reachable through a synapse (DOUBLE-HOMED), is rejected with the offending line quoted back."
maintainer: ockentap
tier: community
category: tools
version: "1.13.0"
requires_hermes: ">=0.22.2"
docs_url: https://github.com/ockentap/hermes-dynamic-memory#readme
readme: true
platforms: [linux, macos]
known_issues:
- "The routing rule from skill/ (or an equivalent line in your personality file) is part of the setup: stock Hermes injects the index with no instructions, so without the rule the agent still finds the right file, but by brute-force filesystem search which does not scale."
capabilities:
provides_tools: []
provides_hooks: [pre_tool_call, pre_llm_call, transform_llm_output]
provides_middleware: [tool_execution]
requires_env: []