todo-53.3-event-prompt-payload-singleton.md 1.6 KB

Todo 53.3: EventPrompt Payload Singleton

Problem

The DOM refresh path removes duplicate generated EventPrompt items, but collectSystemPrompts() in dual_agent currently serializes every prompt item. A stale or user-edited custom item containing the complete generated EventPrompt signature can therefore be sent alongside the managed EventPrompt.

Scope

  • At the outbound collection boundary, discard generated-signature custom items in both invocation modes.
  • In dual_agent, retain only the managed event_agent_system item plus ordinary custom prompts.
  • In chat_agent_tools, retain ordinary custom prompts only and send no EventPrompt.
  • Preserve prompt order and content for ordinary custom items.
  • Do not alter restore, EventPrompt positioning, backend contracts, or UI layout.

TDD Steps

  1. Change the existing Node behavior test so dual_agent expects exactly one generated prompt instead of accepting a generated-signature custom duplicate.
  2. Run the focused test and confirm RED against the current collector.
  3. Apply the minimal filter in collectSystemPrompts().
  4. Verify ordinary custom prompts and managed EventPrompt order remain unchanged.
  5. Run focused/full WebSocket tests, Node syntax, diff checks, and independent review.

Acceptance

  • dual_agent serializes ordinary custom prompts and at most one managed EventPrompt.
  • chat_agent_tools serializes ordinary custom prompts and zero EventPrompt content.
  • A generated-signature custom item cannot bypass the outbound boundary.
  • EventPrompt visibility, ordering, restore deduplication, and tool-derived content remain unchanged.