Ava as orchestrator: idea → tasks → monitoring → notification

t-280·Epic·
·
·
·Omni/Ava.hs
Created1 month ago·Updated1 month ago

Dependencies

Execution Summary

11/11
Tasks Completed
$0.00
Total Cost
0s
Total Time

Design

Edit

Goal: Drive the entire dev process from phone via Telegram. Discuss ideas with Ava, she creates tasks, monitors execution, notifies on issues.

Current State

  • Ava exists as Telegram bot (Omni/Ava.hs, Omni/Agent/Telegram.hs)
  • Has various tools (calendar, email, notes, etc.)
  • Subagent spawning exists (Omni/Agent/Subagent/Coder.hs) but unreliable
  • Jr exists (Omni/Jr.hs) as CLI for task+agent work
  • Dev environment issues cause failures
  • Context window explosion hits guardrails

Desired Flow

1. User chats with Ava about an idea 2. Ava helps refine into concrete tasks (uses task create) 3. Ava spawns workers (pi subprocess, not custom agent loop) 4. Ava monitors progress (polls task status, watches for issues) 5. Ava notifies user of completion or problems 6. User can intervene via chat at any point

Key Design Decisions

Worker execution: subprocess to pi (not custom agent loop)

Prior attempts (Coder.hs, Jr) built custom agent loops that:

  • Hit context limits
  • Had tool implementation bugs
  • Couldn't match pi's reliability

New approach:

  • Ava spawns pi --task t-123 as subprocess
  • pi does the actual coding work
  • Ava just monitors task status and stdout/stderr
  • Much simpler, leverages pi's battle-tested loop

Environment setup

Current issue: Ava runs as systemd service, may not have full dev env. Solutions:

  • Run pi via direnv exec . pi ...
  • Or run in tmux session with env already loaded
  • Or use nix-shell wrapper

Context management

Don't try to keep full context in Ava. Instead:

  • Task descriptions are the shared context
  • pi reads task, does work, updates task
  • Ava reads task status, summarizes for user
  • Ava's context is just: user conversation + task summaries

Monitoring approach

  • Poll task status every N seconds while worker running
  • Watch subprocess stdout for progress
  • Timeout handling
  • Failure detection (task status = needs-help, or subprocess crash)

Implementation Path

Phase 1: Basic subprocess spawning

  • Ava tool to spawn pi-task <id> (wrapper from t-278)
  • Capture stdout/stderr
  • Update task on completion

Phase 2: Monitoring loop

  • Background thread watches running workers
  • Polls task status
  • Sends Telegram notification on state change

Phase 3: Conversational task creation

  • Ava can discuss ideas
  • Extracts tasks from conversation
  • Creates task tree (epic + subtasks)
  • Asks for confirmation before spawning workers

Phase 4: Intervention handling

  • User can send "pause" / "stop" / "help"
  • Ava can kill worker, update task status
  • User can provide guidance, Ava adds to task description

Files to examine

  • Omni/Ava.hs - main entry
  • Omni/Agent/Telegram.hs - bot loop, message handling
  • Omni/Agent/Subagent/Coder.hs - prior subprocess attempt (too complex)
  • Omni/Agent/Subagent/Jobs.hs - job tracking (may be useful)
  • Omni/Jr.hs - CLI that combines task + agent

Dependencies

  • t-278 (pi + task integration) should complete first

Success criteria

  • Can message Ava "build feature X", she creates task and starts worker
  • Get notified when task completes or fails
  • Can check status mid-work via chat
  • Works reliably from phone (no SSH needed for basic flow)

Child Tasks

  • t-280.1 - Manual test: orchestrator workflow with pi-code + pi-review [Done]
  • t-280.2 - Design Ava Telegram interface for task orchestration [Done]
  • t-280.3 - Implement Ava orchestrator: spawn and monitor pi subprocesses [Done]

Timeline (1)

🔄[human]Open → Done1 month ago