Skip to content

Feature: groupScope option to consolidate group sessions into main #7524

@ThatGuySizemore

Description

@ThatGuySizemore

Problem

Currently, all group chats are always isolated into their own sessions via the session key format: agent:${agentId}:${channel}:${peerKind}:${peerId} (session-key.js line 130). There is no equivalent of dmScope: "main" for groups.

This means users cannot have a group chat consolidated into their main session for unified context, even when they want to.

Use Case

A user wants their family iMessage group chat to land in the same session as their DMs, so the agent has full conversational context across both. The agent can already differentiate DM vs group from the envelope metadata (ChatType, From, GroupSubject, etc.), so routing replies correctly is not an issue.

Meanwhile, other groups (e.g., a friend's group chat) should remain isolated.

Proposed Solution

Add a groupScope option (similar to dmScope) that controls whether group sessions consolidate or isolate:

// Global default
"session": {
  "groupScope": "isolated"  // default, current behavior
}

// Per-group override in channel config
"channels": {
  "bluebubbles": {
    "groups": {
      "chat_guid:any;+;96b8c77b...": {
        "groupScope": "main"  // consolidate this group to main session
      }
    }
  }
}

Values:

  • "isolated" (default): Current behavior, each group gets its own session
  • "main": Route to the agent's main session (like dmScope: "main" does for DMs)

Context

Discovered while migrating from imsg (legacy iMessage) to BlueBubbles. The imsg channel had a quirk where unconfigured groups weren't detected as groups (is_group: false), so they accidentally consolidated. BlueBubbles correctly reports isGroup: true via chat GUID format (;+; = group), which exposed the missing feature.

Affected Code

  • dist/routing/session-key.js - buildAgentPeerSessionKey() line ~130
  • dist/routing/resolve-route.js - buildAgentSessionKey()

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions