Skip to content

feat: expose completed-turn message context to memory providers (salvage #28065)#34097

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/memori-trace-messages
May 28, 2026
Merged

feat: expose completed-turn message context to memory providers (salvage #28065)#34097
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/memori-trace-messages

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Salvages #28065 onto current main.

What this does

Adds an optional messages keyword to the MemoryProvider.sync_turn contract so external/community memory plugins can receive the OpenAI-style conversation message list for the completed turn — including assistant tool calls and tool result content — not just the final assistant text.

This is the slimmed-down outcome agreed in the #28065 discussion: no structured-trace envelope in core. Providers reconstruct whatever they need (tool calls, results) from the standard message list. The earlier version/capture_policy/per-tool-duration schema and the _record_turn_tool_trace/_turn_tool_trace machinery are gone.

Why salvage

The original branch was 17 commits behind main, and its diff reverse-applied an intervening context-probe-tier fix (agent/conversation_loop.py). This branch re-applies only the intended feature changes on top of fresh mainconversation_loop.py gets exactly one line (messages=messages,), nothing else.

Backward compatibility

Dispatch uses signature inspection (_provider_sync_accepts_messages): only providers that declare a messages parameter (or **kwargs) receive it. All 8 in-tree providers (honcho, mem0, supermemory, hindsight, retaindb, openviking, holographic, byterover) keep their legacy text-only sync_turn signature and are called unchanged — verified against their real signatures.

Verification

  • 93 tests pass (tests/agent/test_memory_provider.py, tests/run_agent/test_memory_sync_interrupted.py), including new coverage for opted-in vs legacy dispatch.
  • ruff check clean on all touched core files; all compile.
  • Backward-compat confirmed against every in-tree provider's real signature.
  • scripts/release.py AUTHOR_MAP updated so the contributor audit passes (both of the original author's commit emails mapped).

Original author preserved via authorship + Co-authored-by. Closes #28065.

@kshitijk4poor kshitijk4poor force-pushed the salvage/memori-trace-messages branch 2 times, most recently from 1290110 to a7daf73 Compare May 28, 2026 20:44
devwdave and others added 2 commits May 29, 2026 02:16
Adds an optional `messages` keyword to the `MemoryProvider.sync_turn`
contract so external/community memory plugins can receive the OpenAI-style
conversation message list for the completed turn — including assistant tool
calls and tool result content — not just the final assistant text.

Dispatch uses signature inspection (`_provider_sync_accepts_messages`): only
providers that declare a `messages` parameter (or `**kwargs`) receive it; all
existing in-tree providers keep their legacy text-only signature and are
called unchanged. No structured-trace envelope is added to core — providers
reconstruct whatever they need from the standard message list.

Also documents Memori as a standalone community memory provider.

Salvaged from NousResearch#28065 — rebased onto current main.

Co-authored-by: Dave Heritage <david@memorilabs.ai>
Maps both commit emails (david@memorilabs.ai, dave@devwdave.com) used on
NousResearch#28065 to the devwdave GitHub account so the contributor audit in
scripts/release.py passes.
@kshitijk4poor kshitijk4poor force-pushed the salvage/memori-trace-messages branch from a7daf73 to d464d08 Compare May 28, 2026 20:46
@kshitijk4poor kshitijk4poor merged commit 11d9309 into NousResearch:main May 28, 2026
21 checks passed
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ri-trace-messages

feat: expose completed-turn message context to memory providers (salvage NousResearch#28065)
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