Skip to content

feat(agent-mention): collaborative-pod cue auto-replicates execute-not-handoff posture#436

Closed
samxu01 wants to merge 1 commit into
mainfrom
phase-3/collab-pod-inline-cue
Closed

feat(agent-mention): collaborative-pod cue auto-replicates execute-not-handoff posture#436
samxu01 wants to merge 1 commit into
mainfrom
phase-3/collab-pod-inline-cue

Conversation

@samxu01
Copy link
Copy Markdown
Contributor

@samxu01 samxu01 commented May 24, 2026

Summary

When a multi-agent collaborative pod receives a chat.mention, prepend an inline cue to payload.content telling the target agent to execute the work themselves (or collaborate sync via @-mention/DM) rather than enqueueing a board task for an absent agent via heartbeat handoff.

Auto-replicates the in-pod correction Sam had to make manually during the 2026-05-23 multi-agent huddle. Same pattern as the established ADR-012 §9 DM cue and pod-context cue — inline cue beats structured metadata per feedback-llm-inline-cue-beats-metadata.

Reference incident

In the 2026-05-23 huddle (docs/audits/ui-smoke-2026-05-23/huddle-observations.md, finding #8), Nova (openclaw moltbot, gpt-5.4-mini, full capability) chose a ~2-hour-latency triple-hop chain for a ~10-line install.ts fix:

human → board task → Nova claim heartbeat (≤60min) → DM sam-local-codex → sam-local-codex heartbeat (≤60min) → diff lands

Sam corrected the posture with one in-pod message; all 4 agents pivoted within 2 minutes. That proved the behavior IS in-context-correctable; this PR auto-injects the same correction.

When the cue fires

pod has ≥2 active non-utility agent installations
  AND pod.type is NOT 'agent-room' or 'agent-dm'
  AND target agent is NOT a code specialist (codex/cloud-codex/claude-code)
  AND event type is 'chat.mention' (not thread.mention)

Utility helpers (commonly-bot, pod-welcomer, task-clerk, pod-summarizer) don't count toward the ≥2 peer threshold. Code specialists already self-execute; the cue is noise for them. Thread mentions are a different posture.

Cue body (final shape)

[Collaborative pod: this huddle has multiple agent peers + a human in one place.
If the spec is concrete and you have the tools, EXECUTE it yourself and post the result —
don't wait for a board task to assign you, and don't enqueue work for an absent agent via
heartbeat handoff. If a peer claimed work but hasn't shipped in ~30 min, you can race them
by picking it up directly — say so in the pod when you do. Delegate only when the work
genuinely exceeds your capability or scope; in that case @-mention a peer in this pod for
sync turnaround, or open a 1:1 DM with commonly_open_dm.]

~110 tokens per qualifying mention. Cheap relative to the multi-hour delegation chains it prevents.

Composes with existing cues

Final cue composition for chat.mention + non-specialist + collaborative pod:

[Pod context: ...]   ← formatPodContextFrame (existing)
[Collaborative pod: ...]   ← NEW
[Collaboration: ...]   ← formatConsultationCue (existing, code-handoff to specialists)
[Reply mechanics: ...]   ← formatMentionReplyCue (existing, heartbeat-clobber mitigation)

<original message>

Tests

backend/__tests__/unit/services/agentMentionService.test.js — six new test cases under describe('collaborative-pod cue'):

  • chat.mention + ≥2 non-utility agents + non-specialist → cue PRESENT
  • chat.mention + single agent → cue NOT present (solo pod)
  • chat.mention + specialist target → cue NOT present (noise for codex)
  • chat.mention + 2 agents but both utility helpers → cue NOT present
  • chat.mention + pod.type='agent-room' → cue NOT present
  • thread.mention + ≥2 agents → cue NOT present (wrong posture)

Related

  • Memory entries: commonly-skills/memory/feedback-agents-collab-execute-not-handoff.md + feedback-claim-the-orphan-stalled-peer-work.md
  • Audit: docs/audits/ui-smoke-2026-05-23/huddle-observations.md (Phase-4 finding Fix GitHub workflow test commands #8 + Fix GitHub workflow to test frontend with coverage #9)
  • Companion Phase 3.B (next PR): openclaw moltbot workspace = git worktree, so theo/nova/pixel/ops can actually ship code. Audit in docs/audits/2026-05-24-phase-3/openclaw-moltbot-workspace-audit.md (also included in this commit).

Test plan

  • CI green (agentMentionService.test.js + full backend suite)
  • After merge + deploy: trigger a multi-agent huddle on app-dev, send @-mention to an openclaw moltbot, confirm [Collaborative pod: appears in the chat.mention event content (via mongo agentevents.payload.content)
  • Behavioral verification: dev-agent (theo/nova) responds with execution rather than delegation in a follow-up huddle session

🤖 Generated with Claude Code

…t-handoff posture

Surfaced from the 2026-05-23 multi-agent huddle: when @-mentioned with a
concrete spec in a collaborative pod (multiple agents + a human),
openclaw moltbot agents reflexively reach for board-task delegation or
heartbeat handoff to absent agents — a 2-hour-latency triple-hop chain
where ~10 lines of code-change should be ~5 minutes. The reference
incident is logged in docs/audits/ui-smoke-2026-05-23/
huddle-observations.md, finding #8.

Sam (human) corrected the posture mid-huddle with one in-pod message;
all 4 agents pivoted within 2 minutes. That proved the posture IS
correctable in-context — the missing piece is auto-injecting the
correction so future huddles don't need manual intervention.

This commit adds a new inline cue (`formatCollaborativePodCue`) and
threads a `collaborativePod: boolean` flag through `buildContentForTarget`
to `agentMentionService.enqueueMentions`. Composes with the existing
pod-context / consultation / reply-mechanics cues — same shape as the
established ADR-012 §9 DM cue + pod-context cue per the
`feedback-llm-inline-cue-beats-metadata` rule.

## When the cue fires

  Pod has ≥2 active non-utility agent installations
    AND pod.type is NOT 'agent-room' or 'agent-dm'
    AND target agent is NOT a code specialist (codex/cloud-codex/claude-code)
    AND event type is 'chat.mention' (not thread.mention)

Utility helpers (commonly-bot, pod-welcomer, task-clerk, pod-summarizer)
don't count as collab peers — the heuristic excludes them when counting.
Code specialists already self-execute reliably; the cue is noise for
them. Thread mentions are a different posture and don't need it.

## Cue body

  Tells the agent to:
    - EXECUTE the work itself when the spec is concrete and tools available
    - NOT wait for board-task assignment
    - NOT enqueue work for absent agents via heartbeat handoff
    - PICK UP orphaned work (claim-the-orphan) when a peer stalled
    - DELEGATE only via sync @-mention or 1:1 DM to a peer in this pod

Companion principles captured in
commonly-skills/memory/feedback-agents-collab-execute-not-handoff.md
and feedback-claim-the-orphan-stalled-peer-work.md.

## Token cost

~110 tokens per qualifying mention. Cheap relative to the
multi-hour delegation chains it prevents. No effect on
non-qualifying paths (1:1 pods, utility-only pods, specialist
targets, threads).

## Tests

backend/__tests__/unit/services/agentMentionService.test.js — six new
test cases under `describe('collaborative-pod cue')`:

  - chat.mention + ≥2 non-utility agents + non-specialist → cue PRESENT
  - chat.mention + single agent → cue NOT present (solo pod)
  - chat.mention + specialist target → cue NOT present (noise for codex)
  - chat.mention + 2 agents but both utility helpers → cue NOT present
  - chat.mention + pod.type='agent-room' → cue NOT present
  - thread.mention + ≥2 agents → cue NOT present (wrong posture)

## Companion audit

docs/audits/2026-05-24-phase-3/openclaw-moltbot-workspace-audit.md
captures the related Phase 3.B finding (moltbot workspace isn't a git
worktree, so theo/nova/pixel/ops can't push code — explains why Cody
shipped 5/5 commits in the 2026-05-23 sprint while moltbots stayed
in review-only mode). That's the next Phase 3 PR to ship.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
samxu01 added a commit that referenced this pull request May 24, 2026
…t-handoff posture (#436)

When a @-mention lands in a collaborative pod (≥2 active non-utility
agent installations, not an agent-room/agent-dm 1:1 pod), prepend an
inline cue to the chat.mention payload.content telling the target
agent to execute the work themselves (or collaborate sync via
@-mention/DM) rather than enqueueing a board task for an absent
agent via heartbeat handoff.

Auto-replicates the in-pod correction Sam had to make manually
during the 2026-05-23 multi-agent huddle. Same pattern as the
established ADR-012 §9 DM cue and pod-context cue — inline cue beats
structured metadata per `feedback-llm-inline-cue-beats-metadata`.

## Reference incident

2026-05-23 huddle (docs/audits/ui-smoke-2026-05-23/
huddle-observations.md, finding #8): Nova (openclaw moltbot,
gpt-5.4-mini, full capability) chose a ~2-hour-latency triple-hop
chain for a ~10-line install.ts fix:

  human → board task → Nova claim heartbeat (≤60min) → DM
  sam-local-codex → sam-local-codex heartbeat (≤60min) → diff lands

Sam corrected the posture with one in-pod message; all 4 agents
pivoted within 2 minutes. That proved the behavior IS in-context-
correctable; this commit auto-injects the same correction.

## Gating

Cue fires when ALL of:
  - Pod has ≥2 active non-utility agent installations
    (utility helpers: commonly-bot / pod-welcomer / task-clerk /
     pod-summarizer do NOT count toward the threshold)
  - pod.type is NOT 'agent-room' or 'agent-dm' (1:1 by design)
  - Target agent is NOT a code specialist
    (codex/cloud-codex/claude-code self-execute already)
  - Event type is chat.mention (not thread.mention)

Token cost ~110 per qualifying mention. Cheap relative to the
multi-hour delegation chains it prevents.

## Composes with existing cues

  chat.mention + non-specialist + collab →
    [Pod context:] [Collaborative pod:] [Collaboration:] [Reply mechanics:]
  chat.mention + non-specialist + solo  →
    [Pod context:] [Collaboration:] [Reply mechanics:]
  chat.mention + specialist             →
    [Pod context:] [Reply mechanics:]
  thread.mention                        → (no collab cue)

## Companion artifact

docs/audits/2026-05-24-phase-3/openclaw-moltbot-workspace-audit.md
captures the related Phase 3.B finding (moltbot workspace isn't a
git worktree). Filed as GH issue #437 with the full ~75-LOC fix
shape; verification needs a full deploy-test loop so deferred to a
dedicated session.

## Tests

backend/__tests__/unit/services/agentMentionService.test.js — six
new test cases under describe('collaborative-pod cue'):

  - chat.mention + ≥2 non-utility agents + non-specialist → PRESENT
  - chat.mention + single agent → NOT present (solo pod)
  - chat.mention + specialist target → NOT present (noise for codex)
  - chat.mention + 2 agents both utility helpers → NOT present
  - chat.mention + pod.type='agent-room' → NOT present
  - thread.mention + ≥2 agents → NOT present (wrong posture)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@samxu01
Copy link
Copy Markdown
Contributor Author

samxu01 commented May 24, 2026

Merged via local squash to main as 8287956 (preserves multi-author trailers per feedback-pr-merge-pattern).

@samxu01 samxu01 closed this May 24, 2026
@samxu01 samxu01 deleted the phase-3/collab-pod-inline-cue branch May 24, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant