Skip to content

Internal Architecture

This section explains how Protege's runtime components are structured and how they coordinate. You don't need to read this to use Protege, but it helps if you're building custom extensions, debugging issues, or contributing to the framework.

Component Map

Protege has five major components:

┌──────────────────────────────────────────────────────────┐
│                      Your Machine                        │
│                                                          │
│  ┌───────────────┐   ┌──────────────┐   ┌─────────────┐  │
│  │   Gateway     │───│   Harness    │───│  Scheduler  │  │
│  │ (SMTP edge,   │   │ (context,    │   │ (cron,      │  │
│  │  relay client,│   │  LLM calls,  │   │  run queue, │  │
│  │  actions)     │   │  tool loop)  │   │  execution) │  │
│  └───────────────┘   └──────────────┘   └─────────────┘  │
│          │                                               │
│  ┌───────────────┐                      ┌─────────────┐  │
│  │    Chat       │                      │  Extensions │  │
│  │ (terminal UI  │                      │ (tools,     │  │
│  │  over shared  │                      │  providers, │  │
│  │  storage)     │                      │  hooks,     │  │
│  └───────────────┘                      │  resolvers) │  │
│                                         └─────────────┘  │
└──────────────────────────────────────────────────────────┘

          ▼ (optional)
┌───────────────────┐
│   Relay Server    │  ← External, public SMTP bridge
│ (SMTP ↔ WebSocket)│
└───────────────────┘
ComponentDirectoryRole
Gatewayengine/gateway/SMTP ingress/egress, relay tunnel, runtime actions
Harnessengine/harness/Context assembly, LLM provider loop, tool orchestration
Schedulerengine/scheduler/Responsibility sync, cron, run queue, execution
Chatengine/chat/Terminal inbox/thread client over shared storage
Relayrelay/Optional external SMTP-to-WebSocket bridge

Request Lifecycle

Here's what happens when your agent receives an email:

Scheduled responsibilities follow the same path, but instead of a real inbound email, the scheduler creates a synthetic message from the responsibility's prompt text.

Storage Model

Each persona has isolated storage:

  • Identity and configpersonas/{persona_id}/ (persona.json, keys, PERSONA.md, responsibilities, knowledge)
  • Runtime datamemory/{persona_id}/ (SQLite database, active memory, attachments, logs)

The SQLite database (temporal.db) stores threads, messages, tool traces, and scheduler run records. Chat, gateway, and scheduler all read/write from the same database.

Read More