Skip to content

feat(memory): unify owner identity across channels in Honcho#9308

Open
handsdiff wants to merge 3 commits into
NousResearch:mainfrom
handsdiff:feat/user-unify
Open

feat(memory): unify owner identity across channels in Honcho#9308
handsdiff wants to merge 3 commits into
NousResearch:mainfrom
handsdiff:feat/user-unify

Conversation

@handsdiff

Copy link
Copy Markdown
Contributor

Summary

  • Owner messages from different channels (Telegram, Discord, CLI) each created separate Honcho peers, fragmenting the owner's memory representation and breaking cross-channel continuity
  • Add gateway-side owner detection (_is_owner_source) so the provisioner's configured peerName: "user" survives for owner sources, while strangers still get isolated transport-level peers
  • Dual-read legacy transport-level peer representations at init so existing owner history isn't orphaned after unification

Detail

Owner detection

New _is_owner_source helper on GatewayRunner with intentionally conservative checks:

  • DM-only: requires chat_type == "dm" (group home channels fall through)
  • Platform identity enforcement: skips webhook and API server (spoofable user_ids)
  • Home channel match: chat_id must match the platform's configured home channel

At both memory-participating AIAgent construction sites, passes user_id=None for recognized owner sources. The honcho plugin's unconditional user_id override (restored by #9287) doesn't fire, so peerName: "user" from honcho.json survives → all owner DMs land on the same peer.

Dual-read for orphaned history

Without dual-read, the first post-deploy owner message would see an empty user representation (all history is under transport-level peers like telegram-12345). The gateway computes legacy_peer_ids from home channel chat_ids and threads them through to get_prefetch_context, which fetches those peers' representations and merges them into the first-turn context as "Prior Channel History."

Synthetic source fix

Background process completion notifications create a synthetic SessionSource without chat_type (defaults to "dm"). Set chat_type="synthetic" to prevent false-positive owner detection.

Depends on

Test plan

  • Send messages from owner's Telegram DM and CLI — both land on peer user
  • Ask from Telegram about something said via CLI — agent remembers cross-channel
  • Non-owner DMs the bot — lands on transport-level peer, user not polluted
  • First-turn context includes both user representation and legacy peer history
  • Hub DM from CombinatorAgent — still attributes to CombinatorAgent peer
  • Webhook/API server message — falls through to transport-level peer regardless
  • Background process notification — lands on transport peer (chat_type="synthetic")
  • /sethome bootstrap: pre-sethome message on transport peer, post-sethome on user, dual-read surfaces both

🤖 Generated with Claude Code

@handsdiff handsdiff force-pushed the feat/user-unify branch 10 times, most recently from c66a947 to c95f69b Compare April 19, 2026 22:11
@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers labels Apr 21, 2026
handsdiff and others added 2 commits April 23, 2026 23:23
… memory

Cron-triggered agents had zero memory — skip_memory=True meant Honcho
and Hindsight were both disabled, so self-reflection crons couldn't read
prior self-reflections and hub-discovery crons couldn't remember what
they'd already found.

Route each cron job to its own Honcho peer (cron-{job_name}) so Honcho
builds a coherent representation per scheduled behavior. The assistant
peer still accumulates all actions into the agent's unified self-model.

Changes:
- Remove skip_memory=True from cron AIAgent construction, pass
  user_id="cron-{slug(name)}" to route to per-job peers
- Add agent.shutdown_memory_provider() to cron teardown so final
  sync_turn/aretain_batch writes aren't dropped
- Delete the _cron_skipped guard from HonchoMemoryProvider (flag init,
  cron/flush check in initialize(), and 9 early-return checks)
- Add skip_memory=True to the hygiene compress agent, which was
  accidentally protected by the cron guard but should never write
  to memory providers
- Revert NousResearch#6995 peerName guard (not cfg.peer_name) that blocked ALL
  user_id overrides on provisioned agents — cron peers, stranger
  isolation, and future owner-unification all depend on the override
  being unconditional

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner messages from different channels (Telegram, Discord, CLI, etc.)
were each creating separate Honcho peers, fragmenting the owner's
representation. The agent couldn't remember cross-channel conversations.

Add gateway-side owner detection so the configured peerName ("user")
survives for owner sources while strangers still get transport-level
peer isolation:

- Add _is_owner_source helper with strict DM-only check, untrusted
  platform exclusion (webhook, API server), and chat_id match against
  home channels
- At both memory-participating AIAgent construction sites, pass
  user_id=None for owner sources so the honcho plugin's unconditional
  override doesn't fire, letting peerName: "user" survive
- Set chat_type="synthetic" on the background process notification's
  synthetic SessionSource to prevent false-positive owner detection
- Thread legacy_peer_ids through AIAgent → memory init → honcho plugin
  for dual-read of pre-unification transport-level peer representations
- Extend get_prefetch_context to fetch legacy peer contexts and merge
  into first-turn context as "Prior Channel History" so existing owner
  history isn't orphaned after unification

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cyrene963 pushed a commit to Cyrene963/hermes-agent that referenced this pull request May 3, 2026
…cation

Adds  command that:
1. Reads config.yaml to find Telegram home channel chat_id
2. Falls back to largest memory directory detection
3. Automatically migrates data and creates symlinks
4. Sets up global MEMORY.md/USER.md for CLI access

Addresses feedback on NousResearch#9308 overlap:
- NousResearch#9308 auto-detects owner at gateway layer (Honcho only)
- This provides auto-setup for owner + manual mapping for any user
- Works with all memory providers, not just Honcho

Commands: auto-setup, map, unmap, list, resolve, migrate
Cyrene963 pushed a commit to Cyrene963/hermes-agent that referenced this pull request May 7, 2026
…cation

Adds  command that:
1. Reads config.yaml to find Telegram home channel chat_id
2. Falls back to largest memory directory detection
3. Automatically migrates data and creates symlinks
4. Sets up global MEMORY.md/USER.md for CLI access

Addresses feedback on NousResearch#9308 overlap:
- NousResearch#9308 auto-detects owner at gateway layer (Honcho only)
- This provides auto-setup for owner + manual mapping for any user
- Works with all memory providers, not just Honcho

Commands: auto-setup, map, unmap, list, resolve, migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins 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.

2 participants