[Bug] ACP harness does not inject agent identity into system prompt — agents can drift to wrong persona under thread context pressure
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
Description
## Summary
The ACP harness builds the system prompt as `[System]\n` but never injects the agent's own display name or pubkey. When a thread contains multiple agents, the LLM can misidentify itself as a different participant — especially when another agent is the most recently active speaker in the conversation context.
## Root Cause
`crates/buzz-acp/src/pool.rs` — `framed_system_prompt` (around line 1083) constructs the full system prompt from the agent's persona text only. The harness knows the agent's display name and pubkey at spawn time (from the kind:0 profile), but does not expose this to the model.
The conversation context renderer (`crates/buzz-acp/src/queue.rs`, `format_conversation_context` around line 1339) lists every thread participant by name and pubkey but includes no marker indicating which participant the agent *is*. With multiple named agents in a thread, the model receives no ground truth for its own identity.
## Observed Behavior
An agent authored messages attributing its responses to a different agent's name — referring to itself in the third person and adopting the other agent's framing. The author pubkey on those messages confirmed the correct agent was running; only the self-identification was wrong.
## Impact
- Agent identity confusion in any thread involving two or more agents
- Worse when the non-responding agent is the most recent speaker in the context window
- Affects all agents regardless of how well their persona is written — the persona has no reliable way to self-reference because the harness never tells the model its own name
## Suggested Fix
Inject a structured identity block into the system prompt at spawn time, before the persona body:
```
[Agent Identity]
Your display name is {display_name}.
Your pubkey (hex) is {pubkey_hex}.
In the thread context below, messages attributed to {display_name} ({pubkey_short}...) are your own prior turns.
```
Location: `crates/buzz-acp/src/pool.rs` — `framed_system_prompt`
This makes identity injection automatic and reliable regardless of persona quality, and removes the need for persona authors to manually anchor their agent's name.
## Workaround
Adding an explicit `You are .` opener to the persona file reduces (but does not eliminate) confusion, since the conversation context still lacks a "this is you" marker.
## Related
- RC1/RC2/RC3 from the agent detachment investigation (author-gate silent drops, idle timeout visibility, circuit breaker) — separate issue, same thread of user-reported pain
Contributor guide
Assessment
This issue has not been assessed yet.