Design pattern: Button actions that inform Ava's context

t-280.2.6·WorkTask·
·
·
·Omni/Agent/Telegram.hs
Parent:t-280.2·Created1 month ago·Updated1 month ago

Description

Edit

Figure out how button clicks should work so that: 1. Actions happen immediately (no LLM latency) 2. Ava understands what happened (for coherent follow-up)

Current Problem

  • Callbacks bypass the LLM entirely (handleCallbackQuery)
  • Messages go through LLM (handleAuthorizedMessage)
  • If user clicks button, Ava doesn't know about it
  • If user types command, it's slow (LLM roundtrip)

Options

Option A: Synthetic Messages

Button click triggers action, then injects synthetic message into conversation:

User clicked: [Start t-123]
System: Started work on t-123. Coder running...

Ava sees this in conversation history.

Option B: Event Log

Maintain separate event log that Ava can reference:

data AvaEvent = ButtonClicked Text | WorkStarted TaskId | WorkCompleted TaskId | ...

Inject recent events into Ava's context.

Option C: Hybrid Commands

Some messages bypass LLM (direct commands):

  • 'work t-123' → direct action
  • 'what should I work on?' → LLM decides

But still log everything for context.

Option D: Tool Results

Treat button clicks like tool calls - action happens, result goes into context:

[Button: start_task t-123]
[Result: Spawned pi-orchestrate for t-123]

Questions

  • How important is it that Ava can reason about past actions?
  • Is immediate response more important than coherence?
  • Should there be a 'catch up' mechanism?

Recommendation

Option A (Synthetic Messages) seems cleanest:

  • User clicks button
  • Action executes immediately
  • Synthetic user+assistant messages added to history
  • Next LLM call sees full context

Timeline (1)

🔄[human]Open → Done1 month ago