An architectural enhancement suite for Hermes Agent by Nous Research.
It introduces dynamic vector-backed memory retrieval, adaptive persona alignment, real-time reasoning tracing, and intelligent multi-provider task classification without breaking per-conversation prompt caching.
-
VectorMemoryStore (
vector_memory.py)- High-performance local semantic search over user memories using embeddings.
- Enables fast context lookup without bloating the primary prompt window.
-
DynamicMemoryContext & Prefetch (
dynamic_memory.py)- Automatically prefetches and injects relevant memories dynamically based on current user prompts.
-
AdaptiveSoul & StyleLearner (
adaptive_soul.py)- Learns user style preferences, rules, and corrections over time.
- Logs persistent behavioral rules and audits adaptations transparently.
-
AdaptiveWorkflow (
adaptive_workflow.py)- Classifies task complexity in real time to route sub-tasks to optimal LLM models (e.g. lightweight vs. pro models).
-
ReasoningTracer & SourceAttribution (
reasoning_trace.py)- Traces step-by-step reasoning, manages uncertainty scores, and tracks source attribution across execution steps.
-
Seamless Integration Layer (
integration.py&inject_hook.py)- Non-destructive hook injection into
agent_init.py. - Survives
hermes-agentupgrades andpip install --upgraderoutines.
- Non-destructive hook injection into
Normally, Hermes Agent loads your entire memory file (all custom rules, preferences, and details) into the System Prompt of every single message. As your memory grows, your system prompt bloats, wasting thousands of tokens per turn and skyrocketing your API costs.
This package solves this through two main optimizations:
-
Semantic Memory Selection (Vector Search):
- Instead of injecting the entire memory dump,
VectorMemoryStoreindexes your memories using local embeddings (viasentence-transformersor a lightweight TF-IDF fallback). - On each message, it performs a quick search and only injects the 1-3 memories relevant to your current prompt (e.g., retrieving your TV setup details only when you talk about Stremio).
- Instead of injecting the entire memory dump,
-
Preserving Prompt Caching:
- Because the bulk of inactive memories is kept out of the prompt, the system prompt stays stable.
- This allows LLM providers (like Google Gemini or Anthropic Claude) to hit 100% Prompt Cache on repetitive turns. You only pay for processing new messages, saving up to 50-80% on API bills.
- Python:
>= 3.10 - Memory:
≥ 2 GB RAM(if usingsentence-transformersembeddings) - Optional Dependencies:
sentence-transformers&numpy(for vector semantic search; falls back to TF-IDF if omitted)
Ensure you have Hermes Agent installed and active:
hermes --versionCopy the hermes_improvements directory into your Hermes configuration home:
mkdir -p ~/.hermes/improvements
cp -r src/hermes_improvements/* ~/.hermes/improvements/Run the non-destructive injector script to pair the improvements with Hermes Agent's execution core:
python3 src/inject_hook.pyCheck if the improvements package is initialized properly:
python3 -c "import sys, os; sys.path.insert(0, os.path.expanduser('~/.hermes')); import improvements; print(improvements.__version__)"- Upgrades: Running
python3 src/inject_hook.pyis safe to run after everypip install --upgrade hermes-agentorgit pull. It checks if the hook is already present before modifyingagent_init.py. - Platform Support: Full support for Linux and macOS. Windows environments gracefully fall back when file-locking is unavailable.
MIT License. Free to use, modify, and distribute for the Hermes Agent community.