Skip to content

fix(hindsight): fix hindsight memory plugin and memory provider setup#5044

Closed
cdbartholomew wants to merge 3 commits into
NousResearch:mainfrom
cdbartholomew:fix/hindsight-memory-integration
Closed

fix(hindsight): fix hindsight memory plugin and memory provider setup#5044
cdbartholomew wants to merge 3 commits into
NousResearch:mainfrom
cdbartholomew:fix/hindsight-memory-integration

Conversation

@cdbartholomew

@cdbartholomew cdbartholomew commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes multiple issues preventing the hindsight memory plugin from working correctly. Also fixes dependency auto-install in hermes memory setup which was broken for all providers not bundled in .[all].

Generic memory setup fixes

  • Fix dependency auto-installhermes memory setup used python -m pip install but the install script creates venvs with uv venv which does not include pip. This meant auto-install never worked for any provider not bundled in .[all] (everything except honcho). Changed to use uv pip install --python.

  • Conditional fields (when clause) — Config schema fields can now specify a when condition so providers can show different options based on previous selections (e.g. cloud mode shows API URL + key, local mode shows LLM provider + key + model).

  • Dynamic defaults (default_from) — A field's default can be derived from another field's value via a lookup map (e.g. LLM model default changes based on selected provider: groq → openai/gpt-oss-120b, anthropic → claude-haiku-4-5).

  • Import name mapping — Added hindsight-allhindsight to the pip-to-import name mapping so dependency checks work correctly.

Hindsight plugin

  • Fix UI URL (appui.hindsight.vectorize.io)
  • Fix client constructor parameter (api_urlbase_url)
  • Fix is_available() to work when API key is in .env but not in config
  • Add cloud/local mode with conditional setup fields
  • Local mode uses HindsightEmbedded with background daemon startup
  • Add memory_mode (hybrid/context/tools) and prefetch_method (recall/reflect) config
  • Add bank_id, budget, and provider-specific LLM model defaults to setup wizard
  • Auto-restart daemon when LLM config changes (provider, model, or key)
  • Suppress daemon Rich output to ~/.hermes/logs/hindsight-embed.log
  • Disable HindsightEmbedded.__del__ to prevent aiohttp event loop errors during GC
  • Use dedicated asyncio event loop for cloud client to avoid session leaks
  • Update README with full configuration reference

Test plan

  • 12 new tests added (6 dispatch routing, 6 setup field filtering)
  • All 60 memory tests pass
  • Verified dependency auto-install in fresh Docker container using official install script — confirmed pip install fails, uv pip install succeeds
  • Tested cloud mode: recall, retain, reflect tools working
  • Tested local mode: daemon startup, config change detection, provider switching
  • Tested setup wizard: conditional fields, dynamic defaults, re-run preserves secrets

… and local mode

- Fix sequential tool dispatch: memory provider tools were not routed through
  memory_manager in _execute_tool_calls_sequential, causing all memory provider
  tools (hindsight, honcho, mem0, etc.) to silently fail with "Unknown tool"
  when called as single tool calls. Only the concurrent path had the dispatch.

- Fix hindsight UI URL: changed from app.hindsight.vectorize.io to
  ui.hindsight.vectorize.io for API key registration.

- Fix Hindsight client constructor: use base_url parameter (not api_url).

- Fix is_available(): check for configured api_url in addition to API key,
  since the key lives in .env and may not be in the config file.

- Add recall_mode config (context/tools/hybrid, default hybrid) matching
  honcho's pattern — context mode hides tools, tools mode skips prefetch.

- Add conditional setup fields (when clause) so cloud mode only shows URL +
  API key, local mode shows LLM provider/key/model.

- Add uv fallback for dependency installation when pip is not in the venv.

- Use dedicated asyncio event loop for hindsight client calls to avoid
  aiohttp session leaks from ephemeral loops.

- Local mode: use HindsightEmbedded with background daemon startup and
  OS-level fd redirect to capture rich startup output in hindsight-embed.log.

- Suppress HindsightEmbedded.__del__ to prevent "attached to a different
  loop" errors during garbage collection.

- Remove duplicate hindsight_hermes pip package that conflicted with plugin.
Fixes multiple issues preventing the hindsight memory plugin from working
correctly. Also fixes two bugs in the generic memory infrastructure that
were discovered during this work.

Generic memory fixes:
- Fix memory provider tools not dispatched in sequential execution path
  (_execute_tool_calls_sequential skipped memory_manager, affecting all
  providers)
- Fix dependency auto-install in hermes memory setup (use uv instead of
  pip, which was never available in standard installs)
- Add conditional fields (when) and dynamic defaults (default_from) to
  setup wizard schema

Hindsight plugin:
- Fix UI URL (app -> ui.hindsight.vectorize.io)
- Fix client constructor parameter (api_url -> base_url)
- Fix is_available() to check api_url when API key is in .env
- Add cloud/local mode with conditional setup fields
- Local mode uses HindsightEmbedded with background daemon startup
- Add memory_mode (hybrid/context/tools) and prefetch_method (recall/reflect)
- Add bank_id, budget, and provider-specific LLM model defaults to setup
- Auto-restart daemon on LLM config change
- Suppress daemon output to ~/.hermes/logs/hindsight-embed.log
- Update README with full configuration reference

Tests: 12 new tests for dispatch routing and setup field filtering
@cdbartholomew cdbartholomew changed the title fix(hindsight): complete overhaul of hindsight memory plugin fix(hindsight): fix hindsight memory plugin and memory provider setup Apr 4, 2026
@cdbartholomew

Copy link
Copy Markdown
Contributor Author

@teknium1 could you review this when you get a chance?

teknium1 pushed a commit that referenced this pull request Apr 4, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR #5044 by cdbartholomew.
teknium1 pushed a commit that referenced this pull request Apr 4, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR #5044 by cdbartholomew.
@teknium1

teknium1 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Merged via PR #5094. Your hindsight plugin overhaul and memory setup wizard changes were cherry-picked onto current main with your authorship preserved in git log. The non-hindsight changes (cron, doctor, openviking, test skips) were dropped as they conflicted with commits that landed after your branch point. Thanks for the thorough work on this!

@teknium1 teknium1 closed this Apr 4, 2026
naoironman-hue pushed a commit to naoironman-hue/hermes-agent that referenced this pull request Apr 5, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
- Dedicated asyncio event loop for Hindsight async calls (fixes aiohttp session leaks)
- Client caching (reuse instead of creating per-call)
- Local mode daemon management with config change detection and auto-restart
- Memory mode support (hybrid/context/tools) and prefetch method (recall/reflect)
- Proper shutdown with event loop and client cleanup
- Disable HindsightEmbedded.__del__ to avoid GC loop errors
- Update API URLs (app -> ui.hindsight.vectorize.io, api_url -> base_url)
- Setup wizard: conditional fields (when clause), dynamic defaults (default_from)
- Switch dependency install from pip to uv (correct for uv-based venvs)
- Add hindsight-all to plugin.yaml and import mapping
- 12 new tests for dispatch routing and setup field filtering

Original PR NousResearch#5044 by cdbartholomew.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants