fix(hindsight): scope document_id per process + optional bank_id_template#15079
Merged
Conversation
…te (#6602) Reusing session_id as document_id caused data loss on /resume: when the session is loaded again, _session_turns starts empty and the next retain replaces the entire previously stored content. Now each process lifecycle gets its own document_id formed as {session_id}-{startup_timestamp}, so: - Same session, same process: turns accumulate into one document (existing behavior) - Resume (new process, same session): writes a new document, old one preserved - Forks: child process gets its own document; parent's doc is untouched Also adds session lineage tags so all processes for the same session (or its parent) can still be filtered together via recall: - session:<session_id> on every retain - parent:<parent_session_id> when initialized with parent_session_id Closes #6602
…anks
Adds an optional bank_id_template config that derives the bank name at
initialize() time from runtime context. Existing users with a static
bank_id keep the current behavior (template is empty by default).
Supported placeholders:
{profile} — active Hermes profile (agent_identity kwarg)
{workspace} — Hermes workspace (agent_workspace kwarg)
{platform} — cli, telegram, discord, etc.
{user} — platform user id (gateway sessions)
{session} — session id
Unsafe characters in placeholder values are sanitized, and empty
placeholders collapse cleanly (e.g. "hermes-{user}" with no user
becomes "hermes"). If the template renders empty, the static bank_id
is used as a fallback.
Common uses:
bank_id_template: hermes-{profile} # isolate per Hermes profile
bank_id_template: {workspace}-{profile} # workspace + profile scoping
bank_id_template: hermes-{user} # per-user banks for gateway
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.
Salvage of PR #6654 (@nicoloboschi) onto current main.
Resolves cherry-pick conflicts in plugins/memory/hindsight/init.py:
self._document_idlog field (scope fix is the point of the PR)Authorship preserved on both feature commits.
Closes #6602, closes #6654