Skip to main content

Core Concepts Overview

Egregore is built around a few core architectural concepts that work together to provide a powerful, flexible framework for building AI agents. This page provides a high-level overview of these concepts and how they relate to each other.

The Five Pillars

1. PACT Architecture

Positioned Adaptive Context Tree - The foundation of Egregore’s context management system. PACT treats context like a DOM (Document Object Model), allowing you to:
  • Position components at precise coordinates like (0,1,0) or (d2, 1, -3)
  • Adapt automatically as conversation history grows through ODI (Overlap Demotion Invariant)
  • Tree structure enables infinite addressability and hierarchical organization

Learn More

Deep dive into PACT architecture, coordinates, and the ODI system

2. Context Management

The context system provides DOM-like manipulation of agent memory with four component lifecycle types:
  • Permanent (ttl=None) - Never expire, most common for message content
  • Temporary (ttl=N) - Expire after N turns, gone forever
  • Sticky (ttl=1, cadence=1) - Follow their parent through ODI movements
  • Cyclic (ttl=N, cadence=M) - Expire and reappear on a schedule

Learn More

Explore context operations, component lifecycles, and TTL management

3. Messaging System

Universal message handling with the ProviderThread container and ContentBlocks:

3 Message Types

  • SystemHeader: System instructions and configuration
  • ProviderResponse: AI model responses
  • ClientRequest: User messages

Content Blocks

  • TextContent: Plain text messages
  • ToolCalls: Function call requests
  • Media types: Image, Audio, Video, Document

Learn More

Understand ProviderThread, ContentBlocks, and universal message handling

4. Provider System

Unified interface for 30+ AI providers with standardized methods:
Features:
  • Universal token counting across all providers
  • OAuth interceptors for premium models (GPT-5, Claude, etc.)
  • 3-tier parameter merging (defaults < model_config < kwargs)

Learn More

Explore the provider system and supported models

5. Agent System

The orchestrator that ties everything together:

Learn More

Understand the Agent class and its capabilities

Advanced Systems

Beyond the five core pillars, Egregore provides advanced systems for sophisticated use cases:

MessageScheduler

Core rendering and episode management system that:
  • Advances context episodes (turns) automatically
  • Processes TTL expirations and lifecycle transitions
  • Manages the render lifecycle for dynamic components
  • Coordinates ODI depth shifting

Learn More

Deep dive into MessageScheduler and episode management

ContextHistory

Snapshot system for historical context access:
  • Create snapshots at any point in conversation
  • Access historical context states by episode number
  • PACT-compliant serialization for persistence
  • Query components using PACT selectors across snapshots

Learn More

Explore ContextHistory and snapshot management

How It All Fits Together

Typical Flow

  1. User sends message → Agent receives via messaging system
  2. MessageScheduler → Advances episode, processes TTL expirations
  3. Context updates → Message added to PACT tree at d0,0,0
  4. ODI triggers → Previous messages shift to d1,0,0, d2,0,0, etc.
  5. Hooks fire → Observe or modify context changes
  6. Scaffolds render → Update persistent memory based on changes
  7. Provider call → Formatted message sent to AI model
  8. Response processed → Added to context, cycle repeats

What’s Next?

PACT Architecture

Learn about coordinates, positioning, and the ODI system

Context Management

Master context operations and component lifecycles

Agents

Understand the Agent class and its capabilities

Messaging

Explore ProviderThread and universal message handling