bot0-proactive-architecture.md

bot0 Proactive Engine Architecture

Overview

The Proactive Engine is an addon layer that sits on top of the reactive system. While the reactive system waits for user commands, the proactive engine observes, thinks, and acts autonomously — within boundaries the user defines.

Key principle: The proactive engine learns what it can do autonomously through user approvals over time. It starts by asking for everything, then builds confidence.

šŸ“– Related documentation:


Relationship to Reactive System

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                                                                             │
│                         PROACTIVE ENGINE (addon)                            │
│                                                                             │
│   Observes → Thinks → Acts (or Asks)                                       │
│                                                                             │
│   Generates tasks, suggestions, notifications                               │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                                    │
                                    │ Feeds tasks into
                                    ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                                                                             │
│                         REACTIVE SYSTEM (core)                              │
│                                                                             │
│   Desktop ←→ Daemon ←→ Hub ←→ Other Daemons                                │
│                                                                             │
│   Executes tasks                                                            │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

The proactive engine creates tasks. The reactive system executes tasks.

Tasks flow through the Task Queue Manager (in Hub) which handles prioritization, scheduling, and daemon dispatch. See bot0-queue-manager.md for details.


The Goal System

Every proactive engine instance has a north star goal set by the user.

yaml
goal: primary: "Run the business efficiently and grow revenue to $1B" sub_goals: - "Keep customers happy (NPS > 50)" - "Ship features faster (cycle time < 1 week)" - "Reduce manual work (automate repetitive tasks)" - "Stay informed (no surprises)" constraints: - "Never spend more than $1000 without approval" - "Never send external emails without review" - "Never delete production data"

The proactive engine evaluates every potential action against this goal:

  • "Does this action move toward the goal?"
  • "Does this violate any constraints?"
  • "Do I have permission to do this autonomously?"

Core Components

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                         PROACTIVE ENGINE                                     │
│                                                                             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │                         DATA LAYER                                   │   │
│  │                                                                      │   │
│  │   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”             │   │
│  │   │  Data Syncs  │  │   Memory     │  │   Triggers   │             │   │
│  │   │  (Sheets)    │  │   Store      │  │   Registry   │             │   │
│  │   │              │  │              │  │              │             │   │
│  │   │ • Revenue    │  │ • User prefs │  │ • Webhooks   │             │   │
│  │   │ • Analytics  │  │ • Approvals  │  │ • Events     │             │   │
│  │   │ • GitHub     │  │ • Context    │  │ • Thresholds │             │   │
│  │   │ • Gmail      │  │ • Insights   │  │              │             │   │
│  │   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜             │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                    │                                        │
│                                    ā–¼                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  │
│  │                       OBSERVATION LAYER                               │  │
│  │                                                                       │  │
│  │   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”              │  │
│  │   │   Watchers   │  │   Schedules  │  │   Ingestors  │              │  │
│  │   │              │  │              │  │              │              │  │
│  │   │ Poll syncs   │  │ Cron jobs    │  │ Process      │              │  │
│  │   │ at intervals │  │ Time-based   │  │ webhook      │              │  │
│  │   │              │  │ triggers     │  │ events       │              │  │
│  │   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜              │  │
│  │                                                                       │  │
│  │   Batching • Debouncing • Rate Limiting                              │  │
│  │                                                                       │  │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  │
│                                      │                                      │
│                                      ā–¼                                      │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │                        THINKING LAYER                                  │ │
│  │                                                                        │ │
│  │   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  │ │
│  │   │                      EVALUATOR                                  │  │ │
│  │   │                                                                 │  │ │
│  │   │  Input: Batch of observations                                  │  │ │
│  │   │                                                                 │  │ │
│  │   │  Process:                                                       │  │ │
│  │   │  1. What changed? What's significant?                          │  │ │
│  │   │  2. Does this relate to the goal?                              │  │ │
│  │   │  3. What actions are possible?                                 │  │ │
│  │   │  4. Do I have permission for each action?                      │  │ │
│  │   │  5. What's the confidence level?                               │  │ │
│  │   │                                                                 │  │ │
│  │   │  Output: List of potential actions with confidence scores      │  │ │
│  │   │                                                                 │  │ │
│  │   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  │ │
│  │                                                                        │ │
│  │   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  │ │
│  │   │                   PERMISSION CHECKER                            │  │ │
│  │   │                                                                 │  │ │
│  │   │  • Check user's explicit rules                                 │  │ │
│  │   │  • Check learned permissions (past approvals)                  │  │ │
│  │   │  • Check constraints                                           │  │ │
│  │   │                                                                 │  │ │
│  │   │  Output: autonomous | needs_approval | forbidden               │  │ │
│  │   │                                                                 │  │ │
│  │   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  │ │
│  │                                                                        │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
│                                       │                                     │
│                                       ā–¼                                     │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │                         ACTION LAYER                                   │ │
│  │                                                                        │ │
│  │   ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”               │ │
│  │   │  EXECUTE     │  │  ASK         │  │  STORE       │               │ │
│  │   │              │  │              │  │              │               │ │
│  │   │ Autonomous   │  │ Request      │  │ Log insight  │               │ │
│  │   │ action via   │  │ approval via │  │ for later    │               │ │
│  │   │ reactive     │  │ preferred    │  │ reference    │               │ │
│  │   │ system       │  │ channel      │  │              │               │ │
│  │   ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜               │ │
│  │                                                                        │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Data Sources

1. Data Syncs (Sheets)

Your existing sync sheets — structured data pulled from external systems.

yaml
data_syncs: - name: "revenue" source: "stripe" frequency: "every 1 hour" sheet_id: "sheet_abc123" schema: - mrr: number - customers: number - churn_rate: number - name: "github_activity" source: "github" frequency: "every 15 minutes" sheet_id: "sheet_def456" schema: - open_prs: number - merged_today: number - issues_created: number - name: "user_analytics" source: "mixpanel" frequency: "every 6 hours" sheet_id: "sheet_ghi789" schema: - dau: number - signups: number - activation_rate: number

2. Memory Store

The agent's knowledge base — learnings, context, user preferences.

yaml
memory: user_preferences: communication_channel: "telegram" quiet_hours: "22:00-08:00" digest_time: "09:00" learned_permissions: - action: "archive_newsletter_emails" approved: true learned_from: "approval_2024_01_15" times_executed: 47 - action: "send_external_email" approved: false requires: "explicit_approval" context: current_focus: "Series A fundraising" key_contacts: - name: "Sarah Chen" role: "Sequoia partner" relationship: "warm intro from Mike" insights: - date: "2024-01-20" observation: "Revenue drops correlate with support ticket spikes" confidence: 0.8

3. Triggers Registry

Events that can wake up the proactive engine.

yaml
triggers: webhooks: - name: "github_pr_opened" source: "github" event: "pull_request.opened" - name: "stripe_payment_failed" source: "stripe" event: "payment_intent.payment_failed" - name: "slack_mention" source: "slack" event: "app_mention" thresholds: - name: "revenue_drop" sync: "revenue" condition: "mrr_change < -10%" - name: "high_churn" sync: "revenue" condition: "churn_rate > 5%" - name: "pr_stale" sync: "github_activity" condition: "pr_age > 3 days"

4. Schedules

Time-based triggers.

yaml
schedules: - name: "morning_briefing" cron: "0 9 * * 1-5" # 9am weekdays action: "generate_daily_briefing" - name: "weekly_review" cron: "0 18 * * 5" # 6pm Friday action: "generate_weekly_summary" - name: "sync_check" cron: "*/30 * * * *" # Every 30 min action: "check_all_syncs"

Observation Layer: Batching & Rate Limiting

The proactive engine does NOT spin up on every event. It batches and debounces.

Batching Strategy

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                         OBSERVATION BATCHING                                 │
│                                                                             │
│   Events arrive:                                                            │
│   ─────────────────────────────────────────────────────────────────────    │
│   │ │ │ │││ │  │ │  │││││ │ │  │                                           │
│   ─────────────────────────────────────────────────────────────────────    │
│                                                                             │
│   Batched into windows:                                                     │
│   ─────────────────────────────────────────────────────────────────────    │
│   [  batch 1  ] [  batch 2  ] [   batch 3   ] [  batch 4  ]               │
│   ─────────────────────────────────────────────────────────────────────    │
│       │              │              │              │                        │
│       ā–¼              ā–¼              ā–¼              ā–¼                        │
│    Evaluate       Evaluate       Evaluate       Evaluate                    │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Configuration

yaml
batching: # Default batch window default_window: "30 seconds" # Max events before forced processing max_batch_size: 100 # Per-source overrides sources: github: window: "5 minutes" debounce: true # Only process latest state stripe: window: "immediate" # Payment events are urgent email: window: "2 minutes" analytics: window: "1 hour" # No rush rate_limits: # Max evaluations per time period evaluations_per_minute: 10 evaluations_per_hour: 100 # Max actions per time period actions_per_minute: 5 actions_per_hour: 50 # Cooldown after action action_cooldown: "30 seconds"

Debouncing

For data syncs, we often only care about the final state:

Email sync events:
  10:00:01 - New email (id: 1)
  10:00:02 - New email (id: 2)
  10:00:03 - New email (id: 3)
  10:00:04 - Email read (id: 1)
  10:00:05 - New email (id: 4)

After debounce (30s window):
  → "4 emails received, 1 read" (single evaluation)

NOT:
  → 5 separate evaluations

Permission System

How Permissions Work

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                         PERMISSION RESOLUTION                                │
│                                                                             │
│   Action: "Send email to customer about renewal"                            │
│                                                                             │
│   Step 1: Check explicit rules                                              │
│   ─────────────────────────────────────────────────────────────────────    │
│   Rule: "Never send external emails without approval"                       │
│   Result: NEEDS_APPROVAL                                                    │
│                                                                             │
│   ──────────────────────────────────────────────────────────────────────   │
│                                                                             │
│   Action: "Archive newsletter email"                                        │
│                                                                             │
│   Step 1: Check explicit rules                                              │
│   ─────────────────────────────────────────────────────────────────────    │
│   No matching rule.                                                         │
│                                                                             │
│   Step 2: Check learned permissions                                         │
│   ─────────────────────────────────────────────────────────────────────    │
│   Found: User approved this 47 times, never rejected.                       │
│   Result: AUTONOMOUS                                                        │
│                                                                             │
│   ──────────────────────────────────────────────────────────────────────   │
│                                                                             │
│   Action: "Delete production database"                                      │
│                                                                             │
│   Step 1: Check constraints                                                 │
│   ─────────────────────────────────────────────────────────────────────    │
│   Constraint: "Never delete production data"                                │
│   Result: FORBIDDEN                                                         │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Permission Levels

LevelMeaningExample
AUTONOMOUSDo it without askingArchive newsletters
NOTIFYDo it, but tell userAuto-responded to support ticket
NEEDS_APPROVALAsk before doingSend email to investor
FORBIDDENNever do thisDelete production data

Learning Permissions

yaml
# When user approves an action approval_event: action_type: "respond_to_support_ticket" action_details: ticket_type: "billing_question" response_template: "standard_billing_faq" approved: true timestamp: "2024-01-20T10:30:00Z" # System learns learned_permission: action_pattern: "respond_to_support_ticket WHERE ticket_type = billing_question" confidence: 0.3 # Low after 1 approval approvals: 1 rejections: 0 # After 10 approvals of similar actions learned_permission: action_pattern: "respond_to_support_ticket WHERE ticket_type = billing_question" confidence: 0.95 # High confidence approvals: 10 rejections: 0 auto_approve: true # Now autonomous

Confidence Thresholds

yaml
permission_thresholds: # Minimum approvals before auto-approve considered min_approvals: 5 # Minimum confidence for autonomous action autonomous_threshold: 0.9 # If rejection ratio exceeds this, always ask rejection_threshold: 0.1 # Time decay - recent approvals weight more decay_half_life: "30 days"

User Communication

Channel Preferences

yaml
user_communication: preferred_channel: "telegram" fallback_channels: - "email" - "desktop_notification" quiet_hours: enabled: true start: "22:00" end: "08:00" timezone: "America/New_York" urgency_overrides: critical: true # Always notify, even in quiet hours high: false medium: false low: false batching: enabled: true digest_time: "09:00" # Non-urgent items batched to morning digest channel_preferences: telegram: - urgent_alerts - approval_requests email: - daily_digest - weekly_summary desktop: - suggestions - insights

Message Types

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                          MESSAGE TYPES                                       │
│                                                                             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │  APPROVAL REQUEST                                                    │   │
│  │                                                                      │   │
│  │  "Revenue dropped 23%. Should I create a detailed report?"          │   │
│  │                                                                      │   │
│  │  [Yes, create report] [Yes, also draft email] [No, ignore]         │   │
│  │                                                                      │   │
│  │  → User response feeds back into permission learning                │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                                                             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │  NOTIFICATION (action taken)                                         │   │
│  │                                                                      │   │
│  │  "āœ“ Archived 12 newsletter emails"                                  │   │
│  │  "āœ“ Auto-responded to 3 support tickets"                            │   │
│  │                                                                      │   │
│  │  [Undo] [Don't do this anymore]                                     │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                                                             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │  SUGGESTION (low priority)                                           │   │
│  │                                                                      │   │
│  │  "I noticed you've had 3 meetings about pricing this week.          │   │
│  │   Want me to create a summary doc?"                                 │   │
│  │                                                                      │   │
│  │  → Shown in daily digest or when user opens Desktop                 │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                                                             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │  INSIGHT (background)                                                │   │
│  │                                                                      │   │
│  │  Stored silently, surfaced when relevant.                           │   │
│  │                                                                      │   │
│  │  User: "Why did signups drop?"                                      │   │
│  │  Agent: "I've been tracking this. I noticed that..."                │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Self-Evolution Actions

The proactive engine can modify itself — within limits.

Actions the Engine Can Take on Itself

yaml
self_evolution_actions: memory: - action: "memory.create" description: "Store new insight or context" autonomous: true - action: "memory.update" description: "Update existing memory" autonomous: true - action: "memory.delete" description: "Remove outdated memory" autonomous: false # Ask first - action: "memory.reorganize" description: "Restructure memory for better retrieval" autonomous: true data_syncs: - action: "sync.create" description: "Create new data sync" autonomous: false # Ask first (costs money, API access) - action: "sync.update" description: "Modify sync frequency or schema" autonomous: false - action: "sync.pause" description: "Temporarily pause a sync" autonomous: true # Can auto-pause if errors - action: "sync.delete" description: "Remove a data sync" autonomous: false triggers: - action: "trigger.create" description: "Create new trigger" autonomous: false - action: "trigger.update" description: "Modify trigger conditions" autonomous: false - action: "trigger.disable" description: "Disable a trigger" autonomous: true # Can auto-disable if noisy schedules: - action: "schedule.create" description: "Create new scheduled task" autonomous: false - action: "schedule.update" description: "Modify schedule timing" autonomous: false - action: "schedule.skip" description: "Skip next occurrence" autonomous: true

Example: Engine Improves Itself

Observation:
  "Email sync trigger fired 500 times today but only 3 were relevant"

Evaluation:
  "This trigger is too noisy. It's wasting compute and my attention."

Action (autonomous):
  1. Update trigger to filter by sender/subject patterns
  2. Store insight: "Most irrelevant emails are from no-reply@ addresses"
  3. Notify user: "I refined the email trigger to reduce noise by 95%"

────────────────────────────────────────────────────────────────────────

Observation:
  "User asks about competitor pricing every week"

Evaluation:
  "User cares about competitor pricing. No sync exists for this."

Action (needs approval):
  "I noticed you ask about competitor pricing often.
   Should I create a sync that tracks their pricing page weekly?"

   [Yes, create sync] [No thanks]

Processing Pipeline

Full Flow

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                         PROACTIVE PROCESSING PIPELINE                        │
│                                                                             │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │ 1. COLLECT                                                           │   │
│  │                                                                      │   │
│  │    Data syncs poll at their frequencies                             │   │
│  │    Webhooks arrive and queue                                        │   │
│  │    Schedules fire at their times                                    │   │
│  │                                                                      │   │
│  │    All events go into OBSERVATION QUEUE                             │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                    │                                        │
│                                    ā–¼                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │ 2. BATCH                                                             │   │
│  │                                                                      │   │
│  │    Wait for batch window (30s default)                              │   │
│  │    OR max batch size reached (100 events)                           │   │
│  │    OR urgent event arrives (bypass batching)                        │   │
│  │                                                                      │   │
│  │    Debounce: collapse multiple events into final state              │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                    │                                        │
│                                    ā–¼                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │ 3. EVALUATE                                                          │   │
│  │                                                                      │   │
│  │    Load context: goal, memory, recent actions                       │   │
│  │                                                                      │   │
│  │    For each observation in batch:                                   │   │
│  │      - Is this significant?                                         │   │
│  │      - Does it relate to the goal?                                  │   │
│  │      - What actions are possible?                                   │   │
│  │                                                                      │   │
│  │    Output: List of potential actions                                │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                    │                                        │
│                                    ā–¼                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │ 4. CHECK PERMISSIONS                                                 │   │
│  │                                                                      │   │
│  │    For each potential action:                                       │   │
│  │      - Check constraints (forbidden?)                               │   │
│  │      - Check explicit rules                                         │   │
│  │      - Check learned permissions                                    │   │
│  │      - Assign: AUTONOMOUS | NOTIFY | NEEDS_APPROVAL | FORBIDDEN     │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                    │                                        │
│                                    ā–¼                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │ 5. EXECUTE / ASK / STORE                                             │   │
│  │                                                                      │   │
│  │    AUTONOMOUS actions:                                              │   │
│  │      → Send to reactive system (Hub → Daemon)                       │   │
│  │      → Optionally notify user after                                 │   │
│  │                                                                      │   │
│  │    NOTIFY actions:                                                  │   │
│  │      → Execute, then notify user                                    │   │
│  │      → User can undo or disable                                     │   │
│  │                                                                      │   │
│  │    NEEDS_APPROVAL actions:                                          │   │
│  │      → Send approval request via preferred channel                  │   │
│  │      → Wait for response                                            │   │
│  │      → If approved: execute + learn permission                      │   │
│  │      → If rejected: learn rejection                                 │   │
│  │                                                                      │   │
│  │    FORBIDDEN actions:                                               │   │
│  │      → Log attempt                                                  │   │
│  │      → Do nothing                                                   │   │
│  │                                                                      │   │
│  │    Low-confidence insights:                                         │   │
│  │      → Store in memory for later                                    │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                    │                                        │
│                                    ā–¼                                        │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │
│  │ 6. LEARN                                                             │   │
│  │                                                                      │   │
│  │    Record action taken and outcome                                  │   │
│  │    Update permission confidence scores                              │   │
│  │    Store insights for future context                                │   │
│  │                                                                      │   │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Implementation in Bytespace

apps/
ā”œā”€ā”€ bytespace-api/
│   ā”œā”€ā”€ api/
│   │   └── ...
│   │
│   ā”œā”€ā”€ proactive/
│   │   ā”œā”€ā”€ engine.ts           # Main orchestrator
│   │   │
│   │   ā”œā”€ā”€ data/
│   │   │   ā”œā”€ā”€ syncs.ts        # Data sync management
│   │   │   ā”œā”€ā”€ memory.ts       # Memory store
│   │   │   └── triggers.ts     # Trigger registry
│   │   │
│   │   ā”œā”€ā”€ observation/
│   │   │   ā”œā”€ā”€ queue.ts        # Observation queue
│   │   │   ā”œā”€ā”€ batcher.ts      # Batching logic
│   │   │   ā”œā”€ā”€ watchers.ts     # Sync polling
│   │   │   └── ingestors.ts    # Webhook processing
│   │   │
│   │   ā”œā”€ā”€ thinking/
│   │   │   ā”œā”€ā”€ evaluator.ts    # Main evaluation logic
│   │   │   ā”œā”€ā”€ goal.ts         # Goal checking
│   │   │   └── permissions.ts  # Permission resolution
│   │   │
│   │   ā”œā”€ā”€ action/
│   │   │   ā”œā”€ā”€ executor.ts     # Autonomous execution
│   │   │   ā”œā”€ā”€ approval.ts     # Approval request handling
│   │   │   └── notify.ts       # User notification
│   │   │
│   │   └── learning/
│   │       ā”œā”€ā”€ permissions.ts  # Permission learning
│   │       └── insights.ts     # Insight storage
│   │
│   └── jobs/
│       ā”œā”€ā”€ sync-runner.ts      # Runs data syncs
│       ā”œā”€ā”€ scheduler.ts        # Runs scheduled tasks
│       └── batch-processor.ts  # Processes observation batches

Database Schema (Additions)

sql
-- Goals CREATE TABLE proactive_goals ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), primary_goal TEXT, sub_goals JSONB, constraints JSONB, created_at TIMESTAMP, updated_at TIMESTAMP ); -- Data Syncs CREATE TABLE data_syncs ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), name TEXT, source TEXT, frequency TEXT, config JSONB, last_run TIMESTAMP, status TEXT, created_at TIMESTAMP ); -- Memory Store CREATE TABLE proactive_memory ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), category TEXT, -- 'preference', 'context', 'insight', 'learned_permission' key TEXT, value JSONB, confidence FLOAT, created_at TIMESTAMP, updated_at TIMESTAMP, expires_at TIMESTAMP ); -- Triggers CREATE TABLE proactive_triggers ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), name TEXT, source TEXT, event_type TEXT, conditions JSONB, enabled BOOLEAN DEFAULT true, created_at TIMESTAMP ); -- Schedules CREATE TABLE proactive_schedules ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), name TEXT, cron TEXT, action TEXT, config JSONB, enabled BOOLEAN DEFAULT true, last_run TIMESTAMP, next_run TIMESTAMP, created_at TIMESTAMP ); -- Learned Permissions CREATE TABLE learned_permissions ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), action_pattern TEXT, approvals INTEGER DEFAULT 0, rejections INTEGER DEFAULT 0, confidence FLOAT DEFAULT 0, auto_approve BOOLEAN DEFAULT false, last_used TIMESTAMP, created_at TIMESTAMP ); -- Observation Queue CREATE TABLE observation_queue ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), source TEXT, event_type TEXT, payload JSONB, priority TEXT, -- 'urgent', 'normal', 'low' batch_id UUID, processed BOOLEAN DEFAULT false, created_at TIMESTAMP ); -- Action Log CREATE TABLE proactive_actions ( id UUID PRIMARY KEY, user_id UUID REFERENCES users(id), trigger_id UUID, action_type TEXT, action_details JSONB, permission_level TEXT, -- 'autonomous', 'notify', 'approved', 'rejected' outcome TEXT, created_at TIMESTAMP );

Open Questions

  1. Evaluation model: Use same LLM as reactive system? Smaller/faster model for frequent evaluations?

  2. Cost control: How to limit LLM calls in proactive loop? Cache similar evaluations?

  3. Multi-user/team: How do team permissions work? Can team admin set constraints for all members?

  4. Conflict resolution: What if two triggers fire conflicting actions? → Partially resolved: Task Queue Manager handles priority-based scheduling. See bot0-queue-manager.md.

  5. Audit trail: How detailed should action logging be for compliance?

  6. Rate limiting proactive actions: → Resolved: Task Queue Manager enforces per-user rate limits and backpressure. See bot0-queue-manager.md.


Summary

ComponentPurpose
GoalNorth star that guides all decisions
Data SyncsStructured data from external systems
MemoryContext, preferences, learned permissions
TriggersEvents that wake up the engine
SchedulesTime-based triggers
BatchingPrevents overwhelming with events
EvaluatorDecides what to do
PermissionsDetermines autonomy level
LearningGets smarter over time
Self-EvolutionCan improve its own configuration

The proactive engine turns bot0 from a tool you use into an agent that works for you.