Skip to content

feat(agent-routing): avoid waking every agent with the same group context #70

Description

@bingqilinweimaotai

Problem

Cumora currently conflates shared visibility with turn activation.

For an ordinary human group message, scheduler.ts fans out to every eligible agent. triage-core.ts then short-circuits human group messages to actionable=true, so every recipient reaches the big model and reasons over substantially the same public room context.

Prompts still differ by persona, private memory, climate, skills, read cursor, assignment, and BYOA session. However, the expensive public-context reasoning is replicated N times. Existing glance/HOLD/duplicate/claim defenses reduce duplicate posts only after the reasoning cost has already been paid.

The triage schema already exposes:

responseMode: "me" | "each" | "one-of-us" | null

but its consumers do not currently use it.

A typical example is this: when I assign a task, Iris remains silent throughout because the task does not require her involvement. Yet her model continues reasoning in the background and consuming my subscription quota. This is unintuitive and results in substantial unnecessary token usage.

Another issue is that when I ask a general question in a group chat without @mentioning anyone, every member jumps in to answer, often producing semantically repetitive responses. This also wastes tokens, as shown below:

Image

Desired model

Keep chat as one shared, durable public ledger, while selecting who receives a full turn:

message committed
       |
one routing decision
       |
selected agents ---- non-selected agents
full context/turn     no big-brain wake
       |
reply / claim / explicit handoff

This is selective activation, not hidden information. Non-selected agents remain members and can inspect the message later.

Routing semantics

  • me: deterministic targets—DM participant, exact mention, quote target, assignee, active work owner, or explicit handoff.
  • each: all eligible members for @all, voting, roll call, explicit independent answers, or deliberate multi-perspective review.
  • one-of-us: choose one primary by role fit, assignment/claim ownership, recent ownership, availability, and deterministic tie-breaking.

Use one cheap shared routing decision per message boundary rather than N independent routing calls. For one-of-us, use an atomic Redis/DB claim so multiple replicas select exactly one primary.

If the primary fails, is rate-limited, or finishes without handling the message, expire the lease and wake the next candidate. Human messages remain durable.

Safe fallback:

  • DM/mention/quote: deterministic delivery
  • explicit @all: all
  • router unavailable for a human group message: current all-agent behavior
  • agent-only chatter: retain existing fail-closed/loop-control behavior

Constraints

  • Preserve Cloud/BYOA parity and inbox durability.
  • Do not hide shared history or suppress explicit broadcasts.
  • Preserve mute and same-turn steering behavior.
  • Keep routing tenant-safe and stable across replicas.
  • Support explicit handoff without waking everyone.
  • Do not create a permanent central coordinator.

Acceptance criteria

  • Ordinary human group messages no longer unconditionally wake every big brain.
  • @all / each still wake all eligible members.
  • DM, mention, quote, assignee, and handoff delivery are deterministic.
  • Managed and BYOA paths consume responseMode.
  • one-of-us has one primary winner across replicas.
  • Primary failure/no-op triggers bounded fallback without losing the message.
  • Non-selected agents retain later access to the shared conversation.
  • Observability records mode, candidates, recipients, fallback, and avoided turns.
  • Tests cover groups, @all, targeting, handoff, outage, primary failure, mute, and replica races.
  • Benchmark shows fewer turns/message without reducing completion or useful multi-perspective output.

Relevant code

  • server/src/agents/scheduler.ts
  • server/src/agents/triage-core.ts
  • server/src/agents/inbox-triage.ts
  • server/src/agents/turn.ts
  • server/src/agents/runtime/inproc-client.ts
  • server/src/agents/computer/daemon.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions