Skip to content

feat(hindsight): memory provider improvements — recall_sync, retain_source, setup templates, memory indicators, error hints - #85494

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/hindsight-memory-improvements
Aug 13, 2026
Merged

feat(hindsight): memory provider improvements — recall_sync, retain_source, setup templates, memory indicators, error hints#85494
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/hindsight-memory-improvements

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Salvages PR #74379 (@benfrank241) with security and efficiency fixes applied on top.

Hindsight memory provider improvements: opt-in synchronous recall (recall_sync), actionable error hints for missing local runtime, opt-in retain_source attribution, starter memory templates during setup, provider-unavailable warning, and deterministic "recalled N memories" / "saving to memory" status indicators.

Fixes #5820, #7718, #2765. Supersedes #70278, #70295, #72926, #73415, #70257, #46504, #5838, #13101.

Changes

  • plugins/memory/hindsight/__init__.py: recall_sync, retain_source default, indicators, local runtime hint, unavailable_reason(), recall_status()
  • plugins/memory/hindsight/templates.py (new): starter bank template catalog fetch + apply + overwrite warning
  • agent/memory_provider.py: RecallStatus dataclass, unavailable_reason() and recall_status() ABC hooks, generic INDICATOR_GLYPH
  • agent/memory_manager.py: describe_recall() aggregator
  • agent/turn_context.py: recall indicator emit after prefetch
  • agent/agent_init.py: provider-unavailable warning with dedup guard
  • hermes_cli/memory_setup.py: systemd/.env inheritance hint

Fixes applied on top of @benfrank241's work

  1. Security: templates.py apply_template() and probe_existing_customization() now use open_credentialed_url() instead of bare urlopen() — prevents credential leak via cross-origin redirect.
  2. Efficiency: agent_init.py guards unavailable_reason() with the dedup set check before calling it — was running disk I/O + importlib probes on every gateway turn despite the warning being deduped.
  3. Abstraction: INDICATOR_GLYPH in core is now a generic brain (🧠) instead of Hindsight's brand mark. Hindsight overrides with its own _HINDSIGHT_GLYPH (👁️).

Validation

  • 129/129 targeted tests pass (7 test files)
  • Ruff clean
  • E2E smoke tests pass with real imports

Contributor: @benfrank241 (ben.bartholomew@vectorize.io) — authorship preserved via commit 1.

benfrank241 and others added 2 commits August 13, 2026 22:45
…ource, setup templates, memory indicators, error hints

Bundles previously-separate Hindsight/memory PRs into a single review surface:
- opt-in synchronous recall (recall_sync) — recall the injected memory in-turn instead of next-turn prefetch (NousResearch#5820)
- actionable error when local_embedded runtime is missing — tells the user which package to install (NousResearch#7718)
- default retain_source to 'hermes' so every stored memory self-identifies its provenance
- offer a starter memory template during hermes memory setup, plus warn before overwriting an already-configured bank
- warn when a configured memory provider reports unavailable (NousResearch#2765)
- deterministic 'recalled N memories' recall indicator — Hermes itself emits a status line when auto-recall injects memory
- 'saving to memory' retain indicator — emitted the moment a turn is dispatched to the writer

Authored by @benfrank241 (ben.bartholomew@vectorize.io).
Salvaged from PR NousResearch#74379.
…74379

1. Use open_credentialed_url() instead of bare urlopen() in
   templates.py apply_template() and probe_existing_customization().
   Both send Authorization: Bearer headers; bare urlopen forwards
   credentials on cross-origin redirects. The codebase has
   open_credentialed_url() in hermes_cli/urllib_security.py that
   strips credentials on cross-origin redirects — used by 4 other
   modules.

2. Guard unavailable_reason() with the dedup set check before
   calling it. The gateway builds a fresh AIAgent per message, so
   without this guard unavailable_reason() (which calls _load_config()
   → stat + file read + JSON parse, and _check_local_runtime() →
   importlib probes) runs on every gateway turn for an unavailable
   provider, even though the warning is deduped after the first.

3. Move INDICATOR_GLYPH from Hindsight's eye emoji to a generic
   brain (🧠) in core (agent/memory_provider.py). Hindsight overrides
   with its own _HINDSIGHT_GLYPH (👁️) in recall_status() and
   _emit_saving_indicator(). Other memory providers no longer inherit
   Hindsight's brand mark as the default glyph.
@alt-glitch alt-glitch added type/feature New feature or request comp/plugins Plugin system and bundled plugins comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard tool/memory Memory tool and memory providers P3 Low — cosmetic, nice to have labels Aug 13, 2026
@kshitijk4poor
kshitijk4poor merged commit 8b243df into NousResearch:main Aug 13, 2026
48 checks passed
woshicby added a commit to woshicby/hermes-agent that referenced this pull request Aug 17, 2026
…redentials

When HINDSIGHT_API_URL/key are absent (the systemd/gateway case where
~/.hermes/.env is not inherited), is_available() returns False and
agent_init warns — but unavailable_reason() returned empty for cloud
mode, so the user saw a bare warning with no idea which variables to
configure. Name the missing credentials and point at config/gateway
service env. Fixes the remaining gap in NousResearch#2765 (local mode hints landed
via NousResearch#85494).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard 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.

feat(memory): Allow synchronous recall for current turn as option for honcho and hindsight

3 participants