Skip to content

feat(memory): add enhanced-memory plugin — two-tier store with condensation and semantic search - #33379

Closed
labaznov wants to merge 1 commit into
NousResearch:mainfrom
labaznov:feat/enhanced-memory-plugin
Closed

feat(memory): add enhanced-memory plugin — two-tier store with condensation and semantic search#33379
labaznov wants to merge 1 commit into
NousResearch:mainfrom
labaznov:feat/enhanced-memory-plugin

Conversation

@labaznov

Copy link
Copy Markdown

Summary

A new memory provider plugin (enhanced-memory) that offers a structured, two-tier architecture for persistent agent memory.

Features

  • Two-tier fact storage: raw_facts → condenser → condensed — raw conversational facts are periodically grouped, deduplicated, and summarized into priority-ranked condensed entries
  • FTS5 full-text search on both tiers with auto-sync triggers
  • Pluggable embedding providers for semantic vector search:
    • Gemini API (default, 3072-dim)
    • OpenAI API (1536/3072-dim, supports custom base_url for Azure/vLLM/Ollama)
    • Local sentence-transformers (no API needed, cpu/cuda/mps)
  • Automatic fact extraction from conversations (EN + RU patterns)
  • Priority-based condensation with category-aware scoring (security=9-10, user_pref=8-9, etc.)
  • Thread-safe SQLite with WAL mode
  • Hooks: on_session_end, on_memory_write, on_pre_compress

Architecture

Dialog → auto_extract → raw_facts (SQLite + FTS5)
                              ↓ condense
                         condensed (7 categories, priority 1-10)
                              ↓ embed (Gemini / OpenAI / Local)
                         vec_memory (sqlite-vec KNN search)

Configuration

memory:
  provider: enhanced-memory

plugins:
  enhanced-memory:
    db_path: $HERMES_HOME/memory_store.db
    auto_extract: true
    auto_condense: true
    embedding_provider: gemini  # or openai, local, none

Categories

Category Priority Description
security 9-10 SSH, keys, passwords
user_pref 8-9 User preferences
decision 7-9 Decisions and choices
project 7 Project details
tool 6-8 Tools and configs
env 5 Environment/infra
general 4 Everything else

Requirements

  • Core: Python 3.10+, SQLite 3.35+ (FTS5)
  • Semantic search (optional): pip install sqlite-vec + one of: GOOGLE_API_KEY / OPENAI_API_KEY / pip install sentence-transformers

Files

File Lines Description
__init__.py 630 MemoryProvider implementation
store.py 652 SQLite/FTS5 backend
condenser.py 399 Fact condensation engine
embedding_providers.py 381 Gemini/OpenAI/Local providers
embeddings.py 367 Provider-agnostic vec search
plugin.yaml 7 Plugin metadata
README.md 257 Full documentation
SKILL.md 84 Agent-facing skill docs

Testing

Tested locally with:

  • Store CRUD + FTS5 search ✅
  • Condensation pipeline (group/dedup/prioritize) ✅
  • Semantic search with Gemini embeddings ✅
  • Graceful degradation when provider unavailable ✅
  • Thread safety (3 concurrent writers) ✅
  • Full MemoryProvider integration (prefetch, hooks, tool calls) ✅

…sation and semantic search

A new memory provider plugin that offers:
- Two-tier fact storage: raw_facts → condenser → condensed
- FTS5 full-text search on both tiers with auto-sync triggers
- Pluggable embedding providers for semantic vector search:
  * Gemini API (default, 3072-dim)
  * OpenAI API (1536/3072-dim, supports custom base_url)
  * Local sentence-transformers (no API needed, cpu/cuda/mps)
- Automatic fact extraction from conversations (EN + RU patterns)
- Priority-based condensation with category-aware scoring
- Thread-safe SQLite with WAL mode
- Hooks: on_session_end, on_memory_write, on_pre_compress

Categories: user_pref, project, tool, env, decision, security, general
with configurable priority ranges and keyword-based boosting.

Requires: Python 3.10+, SQLite 3.35+ (FTS5)
Optional: pip install sqlite-vec + embedding provider (Gemini/OpenAI/local)
@alt-glitch alt-glitch added type/feature New feature or request comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers P3 Low — cosmetic, nice to have labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This must be a standalone plugin repo now, see CONTRIBUTING.md

@alt-glitch alt-glitch closed this May 27, 2026
@labaznov

Copy link
Copy Markdown
Author

ohh sry just a moment, it seems i will did it again, cancel plz

@labaznov

Copy link
Copy Markdown
Author

Done! Moved to a standalone plugin repo as per CONTRIBUTING.md:

👉 https://github.com/labaznov/hermes-enhanced-memory

Includes:

  • Two-tier fact storage with auto-condensation
  • FTS5 + semantic vector search (sqlite-vec)
  • Pluggable embedding providers (Gemini/OpenAI/Local)
  • 187 tests, 78% coverage
  • Diplodoc documentation (7 pages)
  • pyproject.toml for pip install

Install: cd ~/.hermes/plugins && git clone https://github.com/labaznov/hermes-enhanced-memory.git enhanced_memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have tool/memory Memory tool and memory providers type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants