hermes - 💡(How to fix) Fix Feature: Per-Chat Memory Isolation (Scoped Memory)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

Current Workarounds (Fragile)

Users resort to manual workarounds:

  1. Hard-coding chat ID checks in skill files (SKILL.md)
  2. Moving sensitive data out of memory entirely into skills (losing memory's convenience)
  3. Using memory only as a pointer: "credentials are in X skill"

Code Example

{
  "action": "add",
  "target": "memory",
  "content": "Production DB host: 10.0.1.50",
  "scope": "telegram:123456789"
}
RAW_BUFFERClick to expand / collapse

Problem

Hermes Agent's memory system is currently global — all memory entries are unconditionally injected into every session, regardless of the session's chat source, platform, or profile. This works well for single-user setups but creates a significant privacy vulnerability in multi-chat environments.

Scenario:

  • A user runs Hermes on multiple Telegram chats — a private DM and a public group
  • Sensitive information discussed in the DM (API keys, server credentials, project details) gets saved to memory
  • Those memory entries are then injected into the public group session, where anyone can prompt the agent to reveal them

There is no system-level mechanism to scope memory to specific chats, platforms, or profiles.

Current Workarounds (Fragile)

Users resort to manual workarounds:

  1. Hard-coding chat ID checks in skill files (SKILL.md)
  2. Moving sensitive data out of memory entirely into skills (losing memory's convenience)
  3. Using memory only as a pointer: "credentials are in X skill"

These are brittle, require constant discipline, and offer no enforcement.

Proposed Solution

Add an optional scope parameter to the memory tool:

{
  "action": "add",
  "target": "memory",
  "content": "Production DB host: 10.0.1.50",
  "scope": "telegram:123456789"
}

Behavior:

  • scope is set → entry is ONLY injected into sessions matching that scope
  • scope is unset → entry is injected everywhere (backward compatible — no breaking change)

Supported scope formats:

ScopeMeaning
telegram:123456789Specific Telegram chat
discord:999888777Specific Discord channel
telegram:*All Telegram chats
profile:workSpecific Hermes profile
(unset)Global — current behavior

Injection filtering: When building the system prompt, filter memory entries:

  • Entry has scope → check if session source matches → inject or skip
  • Entry has no scope → inject always (backward compatible)

Alternatives Considered

  1. Per-platform memory stores — Separate databases per platform. Coarse-grained (can't split DM vs group on same platform).
  2. Config-based filter rules — Filter memory by tags via config.yaml. More complex to configure.
  3. Do nothing — Acceptable for single-user setups, leaves a foot-gun for multi-chat deployments.

Scope / Impact

  • Memory tool schema: Add optional scope parameter (string)
  • Memory injection: Filter entries by scope during prompt building
  • Backward compatibility: No breaking changes — unscoped entries behave exactly as today
  • Storage: Add scope column to memory store (nullable)

Priority

Medium-High — privacy issue with real-world impact for users running Hermes across multiple chats or profiles.

Related

  • Current memory tool signature: action (add/replace/remove), target (user/memory), content, old_text
  • Memory injected into system prompt at session start
  • Session context already carries source information (platform + chat ID)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Feature: Per-Chat Memory Isolation (Scoped Memory)