hermes - 💡(How to fix) Fix [Feature Request] Project-scoped memory pools (global + per-project) [1 participants]

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…
GitHub stats
NousResearch/hermes-agent#16833Fetched 2026-04-29 06:38:42
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Code Example

memory:
  global_max_chars: 1500      # global pool limit
  project_max_chars: 2500     # per-project pool limit
  auto_detect_projects: true  # scan workdir for .hermes-project marker

---

{
  "name": "my-project",
  "memory_file": "my-project.json"
}

---

# Global memory (existing)
memory(action="add", target="memory", content="...")
memory(action="remove", target="memory", old_text="...")

# Project memory (new)
memory(action="add", target="project", content="...")
memory(action="remove", target="project", old_text="...")
memory(action="list", target="project")  # shows current project's memory

---

MEMORY (global) [40% -- 882/2,200 chars]
...

PROJECT MEMORY: my-project [35% -- 875/2,500 chars]
...
RAW_BUFFERClick to expand / collapse

Feature Request: Project-Scoped Memory Pools

Problem

Hermes currently has a single global short-term memory pool that is injected into every session regardless of context. Users working on multiple projects end up with a mixed bag of facts -- infrastructure details, deployment rules, project-specific terminology, and personal preferences -- all competing for the same 2,200-character limit.

This leads to:

  • Context pollution: A session about Project A gets injected with facts about Project B, C, and D
  • Premature pruning: Users must delete still-relevant facts to make room for the current project's context
  • No isolation: There is no way to say "these facts only matter when I am in a specific project directory"

Proposed Solution: Two-Pool Memory System

Split short-term memory into two distinct pools:

1. Global Memory Pool (existing behavior)

  • Always injected into every session
  • Intended for: user preferences, communication style, infrastructure facts, security rules
  • Current behavior, just renamed/clarified

2. Project Memory Pool (new)

  • Only injected when the session's workdir (or explicit --project flag) matches a registered project path
  • Intended for: project-specific deployment rules, file paths, conventions, deadlines
  • Stored per-project, e.g.:
    • ~/.hermes/memory/projects/project-a.json
    • ~/.hermes/memory/projects/project-b.json

Configuration

memory:
  global_max_chars: 1500      # global pool limit
  project_max_chars: 2500     # per-project pool limit
  auto_detect_projects: true  # scan workdir for .hermes-project marker

Auto-Detection Mechanism

When auto_detect_projects: true, Hermes checks on session start:

  1. Is there a .hermes-project file in workdir or any parent directory?
  2. If yes, load the project memory pool associated with that marker
  3. If no, only load the global pool

.hermes-project marker file (optional, JSON):

{
  "name": "my-project",
  "memory_file": "my-project.json"
}

If the marker is absent but workdir matches a known project path from memory.projects.*, load that pool anyway.

CLI / Tool Interface

# Global memory (existing)
memory(action="add", target="memory", content="...")
memory(action="remove", target="memory", old_text="...")

# Project memory (new)
memory(action="add", target="project", content="...")
memory(action="remove", target="project", old_text="...")
memory(action="list", target="project")  # shows current project's memory

When inside a project context, target="project" is the default for add/remove.

Session Display

MEMORY (global) [40% -- 882/2,200 chars]
...

PROJECT MEMORY: my-project [35% -- 875/2,500 chars]
...

Benefits

  1. Isolation: Project facts never leak into unrelated sessions
  2. Scale: Each project gets its own budget instead of fighting for global space
  3. Discoverability: New sessions in a project directory automatically get relevant context
  4. Backward compatibility: Global memory works exactly as before; project memory is opt-in

Related

  • Complements #16831 (configurable memory limit) -- both address the same underlying scarcity problem
  • Honcho already handles long-term cross-project memory; this proposal fills the gap for short-term, project-local context

extent analysis

TL;DR

Implement a two-pool memory system with global and project-specific memory pools to address context pollution and premature pruning issues.

Guidance

  • Introduce a new project memory pool that is only injected when the session's workdir matches a registered project path.
  • Configure the memory settings in the YAML file to define the global and project memory pool limits.
  • Use the auto_detect_projects feature to automatically detect project directories and load the corresponding project memory pool.
  • Update the CLI interface to support project memory operations, such as adding, removing, and listing project memory entries.

Example

memory:
  global_max_chars: 1500
  project_max_chars: 2500
  auto_detect_projects: true

Notes

The proposed solution requires changes to the existing memory management system and the introduction of new configuration options. It is essential to test the new system thoroughly to ensure backward compatibility and correct behavior.

Recommendation

Apply the proposed two-pool memory system workaround to address the context pollution and premature pruning issues, as it provides a more scalable and isolated memory management solution.

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