Skip to main content

Scaffolds Overview

Scaffolds are Egregore’s system for persistent agent memory and capabilities. They’re dynamic components that automatically render into context, provide tool operations, and maintain state across interactions.

What are Scaffolds?

Think of scaffolds as persistent plugins for your agent that:
  • Maintain state - Remember information across conversations
  • Provide tools - Expose operations the agent can use
  • React to changes - Automatically update when context changes
  • Communicate - Share state through formal IPC system
Scaffolds are like “smart memory” - they observe context, maintain persistent state, and provide capabilities the agent can access.

The Scaffold Pattern

Traditional approaches require manual state management:
Scaffolds solve this with automatic state management:

Built-in Scaffolds

Egregore includes three powerful built-in scaffolds:

1. InternalNotesScaffold

Automatic note-taking and memory:
Features:
  • Automatic note capture
  • Persistent storage across sessions
  • Search and retrieval operations
  • Category organization

2. FileManager

Track file operations and maintain file system context:
Features:
  • File operation tracking
  • Working directory awareness
  • Recent file history
  • File relationship mapping

3. ShellScaffold

Command execution history and environment tracking:
Features:
  • Command history tracking
  • Exit code monitoring
  • Environment variable awareness
  • Working directory tracking

Learn More

Complete guide to built-in scaffolds

Core Concepts

Scaffold State

Each scaffold maintains persistent state:
State characteristics:
  • Type-safe with Pydantic models
  • Persistent across interactions
  • Accessible to other scaffolds
  • Survives agent restarts (if serialized)

Operations

Scaffolds expose operations as tools:
Operation features:
  • Automatic tool generation
  • Type safety from annotations
  • Return values sent to agent
  • State changes trigger re-rendering

Learn More

Complete @operation decorator documentation

Reactive Rendering

Scaffolds automatically re-render when context changes:
Reactive features:
  • Automatic re-rendering on context changes
  • Selective re-rendering via should_rerender()
  • Minimal performance overhead
  • All scaffolds reactive by default

Scaffold IPC

Scaffolds communicate through formal IPC:

Learn More

Complete scaffold IPC documentation

Scaffold Lifecycle

Registration

Scaffolds are registered when creating an agent:

Initialization

Scaffolds initialize when first accessed:

Rendering

Scaffolds render into context automatically:
Rendering triggers:
  • Initial agent creation
  • Context changes (if reactive)
  • Manual scaffold.render() call
  • State changes via operations

State Persistence

Scaffold state can be serialized:

Use Cases

1. User Preferences

2. Task Management

3. Context Summarization

4. Memory Consolidation

Best Practices

Type-safe state with validation:
Each scaffold should have a single responsibility:
Expose state changes as operations:
Use TTL and selective re-rendering:

Performance Considerations

Rendering Overhead

Scaffolds add minimal overhead:

State Size

Keep state manageable:

Operation Complexity

Keep operations fast:

What’s Next?

Creating Scaffolds

Learn how to build custom scaffolds

Scaffold IPC

Formal communication between scaffolds

Built-in Scaffolds

Complete guide to InternalNotes, FileManager, Shell

Retention Management

Managing scaffold state and persistence