mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat(hindsight): richer session-scoped retain metadata
- Add configurable retain_tags / retain_source / retain_user_prefix / retain_assistant_prefix knobs for native Hindsight. - Thread gateway session identity (user_name, chat_id, chat_name, chat_type, thread_id) through AIAgent and MemoryManager into MemoryProvider.initialize kwargs so providers can scope and tag retained memories. - Hindsight attaches the new identity fields as retain metadata, merges per-call tool tags with configured default tags, and uses the configurable transcript labels for auto-retained turns. Co-authored-by: Abner <abner.the.foreman@agentmail.to>
This commit is contained in:
parent
b8663813b6
commit
b66644f0ec
7 changed files with 387 additions and 150 deletions
20
run_agent.py
20
run_agent.py
|
|
@ -751,6 +751,11 @@ class AIAgent:
|
|||
prefill_messages: List[Dict[str, Any]] = None,
|
||||
platform: str = None,
|
||||
user_id: str = None,
|
||||
user_name: str = None,
|
||||
chat_id: str = None,
|
||||
chat_name: str = None,
|
||||
chat_type: str = None,
|
||||
thread_id: str = None,
|
||||
gateway_session_key: str = None,
|
||||
skip_context_files: bool = False,
|
||||
skip_memory: bool = False,
|
||||
|
|
@ -820,6 +825,11 @@ class AIAgent:
|
|||
self.ephemeral_system_prompt = ephemeral_system_prompt
|
||||
self.platform = platform # "cli", "telegram", "discord", "whatsapp", etc.
|
||||
self._user_id = user_id # Platform user identifier (gateway sessions)
|
||||
self._user_name = user_name
|
||||
self._chat_id = chat_id
|
||||
self._chat_name = chat_name
|
||||
self._chat_type = chat_type
|
||||
self._thread_id = thread_id
|
||||
self._gateway_session_key = gateway_session_key # Stable per-chat key (e.g. agent:main:telegram:dm:123)
|
||||
# Pluggable print function — CLI replaces this with _cprint so that
|
||||
# raw ANSI status lines are routed through prompt_toolkit's renderer
|
||||
|
|
@ -1471,6 +1481,16 @@ class AIAgent:
|
|||
# Thread gateway user identity for per-user memory scoping
|
||||
if self._user_id:
|
||||
_init_kwargs["user_id"] = self._user_id
|
||||
if self._user_name:
|
||||
_init_kwargs["user_name"] = self._user_name
|
||||
if self._chat_id:
|
||||
_init_kwargs["chat_id"] = self._chat_id
|
||||
if self._chat_name:
|
||||
_init_kwargs["chat_name"] = self._chat_name
|
||||
if self._chat_type:
|
||||
_init_kwargs["chat_type"] = self._chat_type
|
||||
if self._thread_id:
|
||||
_init_kwargs["thread_id"] = self._thread_id
|
||||
# Thread gateway session key for stable per-chat Honcho session isolation
|
||||
if self._gateway_session_key:
|
||||
_init_kwargs["gateway_session_key"] = self._gateway_session_key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue