Skip to content

fix(memory): add write origin metadata seam#15346

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-154aaa9e
Apr 24, 2026
Merged

fix(memory): add write origin metadata seam#15346
teknium1 merged 1 commit into
mainfrom
hermes/hermes-154aaa9e

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #15315 by @helix4u — core seam only, bundled plugins untouched.

Summary

External memory providers can now opt into structured write-origin metadata (write_origin, execution_context, session_id, parent_session_id, platform, tool_name, task_id, tool_call_id) by widening their on_memory_write to accept metadata=None. Resolves #15219.

Changes (5 files, +184/-5)

  • agent/memory_provider.py: ABC widened with optional metadata kwarg.
  • agent/memory_manager.py: signature sniffer routes each provider to keyword / positional / legacy branch — legacy 3-arg providers keep working unchanged.
  • run_agent.py: _build_memory_write_metadata() helper + provenance wiring at 3 call sites (foreground memory tool, background-review forked agent, flush_memories).
  • Tests for opt-in metadata delivery, legacy 3-arg compat, and flush provenance.

Not changed

Bundled memory providers (byterover, holographic, honcho, openviking, retaindb, supermemory) stay on their 3-arg signature. The sniffer routes all of them to the legacy branch — zero behavior change. Third-party providers opt in by adding metadata=None when they have a use case.

Validation

Before After
Opt-in provider receives provenance no hook {write_origin, execution_context, session_id, parent_session_id, platform, tool_name, ...}
Legacy 3-arg provider works works (sniffer → legacy branch)
Bundled plugins 3-arg 3-arg, unchanged

Targeted tests: 71/71 pass (tests/agent/test_memory_provider.py, tests/run_agent/test_flush_memories_codex.py). Plugin tests: 187/188 pass; the 1 failure is pre-existing on main (hindsight setup test, unrelated).

Closes #15219.

@teknium1 teknium1 merged commit 6a957a7 into main Apr 24, 2026
8 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-154aaa9e branch April 24, 2026 21:37
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent loop, run_agent.py, prompt builder tool/memory Memory tool and memory providers labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder 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.

Add write-origin metadata for external memory provider writes

3 participants