No description
- Python 99.8%
- Just 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| tests | ||
| .gitignore | ||
| __init__.py | ||
| AGENTS.md | ||
| justfile | ||
| messages.py | ||
| plugin.yaml | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
kuri-memory-guard
A Hermes plugin that guards memory tool calls against stale, transient, or narrative content. Two-tier system: hard blocks always reject; soft blocks first time blocks with explanation; identical operation retry (same action/target/content/old_text) within a 5-minute window passes exactly once.
How it works
pre_tool_callhook interceptsmemorytool calls- Checks
content(single operation) andoperations[](batch) - Hard guards: dates (ISO, YYYY/MM/DD, M/D, dot-date MM.DD, Chinese dates), relative dates (today/今天/本週/上週/下週), placeholders, TODOs, WIP/TBD/FIXME/XXX, session labels, proc IDs, commit SHAs, list-memory probes — always blocked
- Soft guards: work verbs, user quotes, incident narratives, cron/session artifacts, version snapshots, cleanup meta — first hit blocks with guidance; an identical operation retry (same action/target/content/old_text) within a 5-minute window passes exactly once
- Batch hygiene: two or more guarded operations receive one short indexed summary and must be split; this does not consume soft retries
- Length guard: three-stage (refine/split/narrative) with early S2 trigger at 3+ markers — soft block; hard ceiling is an unconditional 180-char absolute limit
- Retry state: one-time pending fingerprints (atomic consume) with 5-minute TTL and 128-per-session cap; session state with 24-hour TTL and 1,024-session LRU cap
Installation
Clone to the Hermes user plugins directory:
git clone https://git.xlion.tw/xlionjuan/kuri-memory-guard.git \
~/.hermes/plugins/kuri-memory-guard
Enable
hermes plugins enable kuri-memory-guard
Takes effect after a gateway restart (/restart or restart the Hermes gateway service).
Using in other profiles
mkdir -p ~/.hermes/profiles/<profile>/plugins
ln -s ../../../plugins/kuri-memory-guard \
~/.hermes/profiles/<profile>/plugins/kuri-memory-guard
hermes plugins --profile <profile> enable kuri-memory-guard
Verification
cd ~/.hermes/plugins/kuri-memory-guard
just verify
just verify uses the locked uv environment and runs Ruff lint, Ruff format check, ty, and pytest. The equivalent standalone commands are:
uv run ruff check .
uv run ruff format --check .
uv run ty check .
uv run pytest -v
All four checks must pass before committing.