feat: add Hindsight memory integration (local memory option)#1811
Closed
benfrank241 wants to merge 5 commits into
Closed
feat: add Hindsight memory integration (local memory option)#1811benfrank241 wants to merge 5 commits into
benfrank241 wants to merge 5 commits into
Conversation
Registers hindsight_retain, hindsight_recall, and hindsight_reflect as built-in tools. Configured via HINDSIGHT_API_URL, HINDSIGHT_API_KEY, and HINDSIGHT_BANK_ID environment variables. Tools are only available when hindsight-client is installed and configured. Hindsight provides structured fact extraction, entity resolution, knowledge graph traversal, and cross-encoder reranking for memory retrieval. See https://github.com/vectorize-io/hindsight
a3031ed to
27a8b61
Compare
Contributor
|
@teknium1 could you review this PR? |
Adds Hindsight as a long-term memory layer alongside Honcho, mirroring the Honcho integration pattern end-to-end. Core integration: - hindsight_integration/client.py: HindsightClientConfig + client factory - hindsight_integration/session.py: HindsightSessionManager with async retain queue and background recall prefetch - hindsight_integration/cli.py: setup/status/bank/budget subcommands Agent loop (run_agent.py): - Auto-retains each turn to build the knowledge graph - Prefetches recall in background before each turn - Injects recalled context into system prompt (first turn) or user message (subsequent turns) - sync_honcho renamed to sync_memory to cover both integrations Tools (tools/hindsight_tools.py): - hindsight_retain (with optional context label) - hindsight_recall - hindsight_reflect - All tool calls run in isolated threads with fresh aiohttp sessions to avoid event loop conflicts with Hermes's asyncio runtime CLI (hermes_cli/main.py): - hermes hindsight setup/status/bank/budget toolsets.py: adds hindsight toolset entry
Adds a local Hindsight mode backed by hindsight-all/HindsightEmbedded, which auto-starts a local API server with embedded PostgreSQL. No Hindsight account or API key needed — only an LLM API key is required. - HindsightClientConfig: new fields (mode, llm_provider, llm_api_key, llm_model, llm_base_url, local_profile) with env var fallbacks (HINDSIGHT_MODE, HINDSIGHT_LLM_PROVIDER, HINDSIGHT_LLM_API_KEY, HINDSIGHT_LLM_MODEL) - get_hindsight_client(): branches on mode to return HindsightEmbedded (local) or Hindsight (cloud) - Setup wizard: mode selection as first step; local flow prompts LLM provider (numbered list with defaults), API key, model, bank ID, budget - cmd_status(): shows Mode, LLM, Profile, and data path for local mode - _hindsight_should_activate(): accepts local mode (checks llm_api_key instead of api_key) - _fresh_client() and _check_hindsight_available(): mode-aware branching - When Hindsight is active, disable background MEMORY.md/USER.md writes (mirrors Honcho behaviour) - pyproject.toml: add hindsight-local = ["hindsight-all>=0.4.18"] extra
Keep both _inject_hindsight_turn_context (our addition) and the new _should_parallelize_tool_batch / _extract_parallel_scope_path / _paths_overlap helpers from main.
3 tasks
teknium1
added a commit
that referenced
this pull request
Mar 29, 2026
Introduces MemoryProvider ABC, MemoryManager orchestrator, and BuiltinMemoryProvider for the existing MEMORY.md/USER.md system. Key design decisions: - Built-in memory is ALWAYS active, never disabled by external providers - Multiple providers can be active simultaneously - Prefetch results from all providers are merged per-turn - Sync fans out to all providers after each turn - Each provider can expose its own tools Three registration paths: 1. Built-in (BuiltinMemoryProvider) — always first, not removable 2. First-party (Honcho stays as-is for now, migration in follow-up) 3. Plugin — ctx.register_memory_provider() in plugin system Files: - agent/memory_provider.py — ABC with core + optional lifecycle hooks - agent/memory_manager.py — orchestrator, single integration point - agent/builtin_memory_provider.py — wraps existing MemoryStore - hermes_cli/plugins.py — register_memory_provider() + accessor - run_agent.py — MemoryManager wired alongside existing Honcho code - tests/agent/test_memory_provider.py — 37 tests This establishes the interface for all pending memory backend PRs (#1811 Hindsight, #2732 RetainDB, #2933 Mem0, #3499 Byterover, #3369 OpenViking, #2351 Holographic, #727 Cognitive) to implement as plugins rather than one-off integrations.
teknium1
added a commit
that referenced
this pull request
Mar 30, 2026
Adapts PR #1811 (Hindsight by benfrank241) and PR #2933 (Mem0 by kartik-mem0) to the MemoryProvider interface as drop-in plugins. Hindsight plugin (plugins/hindsight-memory/): - 3 tools: hindsight_retain, hindsight_recall, hindsight_reflect - Cloud (API key) or local (embedded PostgreSQL) modes - Background prefetch with thread isolation for aiohttp - Auto-sync turns to knowledge graph Mem0 plugin (plugins/mem0-memory/): - 4 tools: mem0_profile, mem0_search, mem0_context, mem0_conclude - Server-side LLM fact extraction and deduplication - Semantic search with optional reranking - Verbatim fact storage via conclude (infer=False) Both require API keys (HINDSIGHT_API_KEY / MEM0_API_KEY) and the respective SDK packages (hindsight-client / mem0ai). is_available() gates on credentials so installing the plugin without a key is safe.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 28, 2026
Introduces MemoryProvider ABC, MemoryManager orchestrator, and BuiltinMemoryProvider for the existing MEMORY.md/USER.md system. Key design decisions: - Built-in memory is ALWAYS active, never disabled by external providers - Multiple providers can be active simultaneously - Prefetch results from all providers are merged per-turn - Sync fans out to all providers after each turn - Each provider can expose its own tools Three registration paths: 1. Built-in (BuiltinMemoryProvider) — always first, not removable 2. First-party (Honcho stays as-is for now, migration in follow-up) 3. Plugin — ctx.register_memory_provider() in plugin system Files: - agent/memory_provider.py — ABC with core + optional lifecycle hooks - agent/memory_manager.py — orchestrator, single integration point - agent/builtin_memory_provider.py — wraps existing MemoryStore - hermes_cli/plugins.py — register_memory_provider() + accessor - run_agent.py — MemoryManager wired alongside existing Honcho code - tests/agent/test_memory_provider.py — 37 tests This establishes the interface for all pending memory backend PRs (NousResearch#1811 Hindsight, NousResearch#2732 RetainDB, NousResearch#2933 Mem0, NousResearch#3499 Byterover, NousResearch#3369 OpenViking, NousResearch#2351 Holographic, NousResearch#727 Cognitive) to implement as plugins rather than one-off integrations.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 28, 2026
Adapts PR NousResearch#1811 (Hindsight by benfrank241) and PR NousResearch#2933 (Mem0 by kartik-mem0) to the MemoryProvider interface as drop-in plugins. Hindsight plugin (plugins/hindsight-memory/): - 3 tools: hindsight_retain, hindsight_recall, hindsight_reflect - Cloud (API key) or local (embedded PostgreSQL) modes - Background prefetch with thread isolation for aiohttp - Auto-sync turns to knowledge graph Mem0 plugin (plugins/mem0-memory/): - 4 tools: mem0_profile, mem0_search, mem0_context, mem0_conclude - Server-side LLM fact extraction and deduplication - Semantic search with optional reranking - Verbatim fact storage via conclude (infer=False) Both require API keys (HINDSIGHT_API_KEY / MEM0_API_KEY) and the respective SDK packages (hindsight-client / mem0ai). is_available() gates on credentials so installing the plugin without a key is safe.
CumulusService
pushed a commit
to Cumulus-Service-GmbH/hermes-agent
that referenced
this pull request
May 30, 2026
Introduces MemoryProvider ABC, MemoryManager orchestrator, and BuiltinMemoryProvider for the existing MEMORY.md/USER.md system. Key design decisions: - Built-in memory is ALWAYS active, never disabled by external providers - Multiple providers can be active simultaneously - Prefetch results from all providers are merged per-turn - Sync fans out to all providers after each turn - Each provider can expose its own tools Three registration paths: 1. Built-in (BuiltinMemoryProvider) — always first, not removable 2. First-party (Honcho stays as-is for now, migration in follow-up) 3. Plugin — ctx.register_memory_provider() in plugin system Files: - agent/memory_provider.py — ABC with core + optional lifecycle hooks - agent/memory_manager.py — orchestrator, single integration point - agent/builtin_memory_provider.py — wraps existing MemoryStore - hermes_cli/plugins.py — register_memory_provider() + accessor - run_agent.py — MemoryManager wired alongside existing Honcho code - tests/agent/test_memory_provider.py — 37 tests This establishes the interface for all pending memory backend PRs (NousResearch#1811 Hindsight, NousResearch#2732 RetainDB, NousResearch#2933 Mem0, NousResearch#3499 Byterover, NousResearch#3369 OpenViking, NousResearch#2351 Holographic, NousResearch#727 Cognitive) to implement as plugins rather than one-off integrations.
CumulusService
pushed a commit
to Cumulus-Service-GmbH/hermes-agent
that referenced
this pull request
May 30, 2026
Adapts PR NousResearch#1811 (Hindsight by benfrank241) and PR NousResearch#2933 (Mem0 by kartik-mem0) to the MemoryProvider interface as drop-in plugins. Hindsight plugin (plugins/hindsight-memory/): - 3 tools: hindsight_retain, hindsight_recall, hindsight_reflect - Cloud (API key) or local (embedded PostgreSQL) modes - Background prefetch with thread isolation for aiohttp - Auto-sync turns to knowledge graph Mem0 plugin (plugins/mem0-memory/): - 4 tools: mem0_profile, mem0_search, mem0_context, mem0_conclude - Server-side LLM fact extraction and deduplication - Semantic search with optional reranking - Verbatim fact storage via conclude (infer=False) Both require API keys (HINDSIGHT_API_KEY / MEM0_API_KEY) and the respective SDK packages (hindsight-client / mem0ai). is_available() gates on credentials so installing the plugin without a key is safe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds persistent long-term memory for Hermes via Hindsight, an open-source memory system for AI agents. Unlike the existing
memorytool (flat markdown files), Hindsight extracts structured facts, resolves entities, builds a knowledge graph, and uses multi-strategy retrieval with cross-encoder reranking.Three new tools:
hindsight_retain— store information with automatic fact extraction and entity resolutionhindsight_recall— multi-strategy retrieval (semantic + BM25 + graph + temporal) with rerankinghindsight_reflect— LLM-powered synthesis across stored memoriesTwo modes:
hindsight-client, API key required)hindsight-all, which auto-starts an embedded API server backed by embedded PostgreSQL. No Hindsight account needed — just an LLM API key for fact extraction.Tools are hidden unless configured — zero impact for users who do not set up Hindsight.
When Hindsight is active, background writes to
MEMORY.md/USER.mdare disabled (mirrors Honcho behaviour) so facts are not split across two stores.Setup:
How to test (local mode, no Docker or account needed):
How to test (cloud mode):
Changes:
tools/hindsight_tools.py— three self-registering toolshindsight_integration/client.py—HindsightClientConfig(cloud + local modes, env var fallbacks), client factoryhindsight_integration/cli.py—hermes hindsight setup|status|bank|budgetcommandshindsight_integration/session.py—HindsightSessionManager(per-turn recall prefetch + context injection)run_agent.py— Hindsight activation, tool surface rebuild, memory write disabling,_hindsight_should_activate()for both modesmodel_tools.py— addedhindsight_toolsto tool discoverytoolsets.py— added tools to core tool list andhindsighttoolset definitionpyproject.toml—hindsightandhindsight-localoptional extras;hindsight_integrationinpackages.findCONTRIBUTING.md— updated project structurePlatforms tested: macOS (Apple Silicon)