Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:23blocks OS Ai maestro Agent Registry

From Leeroopedia
Knowledge Sources
Domains Agent_Orchestration, Persistence
Last Updated 2026-10-26 10:00 GMT

Overview

A registry pattern where agents are the core entity, persisted as a JSON file on disk with an in-memory cache, with names unique per host like email addresses.

Description

The agent registry is the single source of truth for agent data. Agents are the primary entity of the fleet; a tmux session is an optional property of one. An agent can exist without a session. The registry file (`~/.aimaestro/agents/registry.json`) is a JSON array of agent objects, read with an mtime-based cache to avoid redundant disk reads within the same tick.

The key design principle is that agent data is never derived from tmux. Sessions are discovered and linked to registry agents, not the other way round. Name uniqueness is per-host (like email: `auth@macbook` ≠ `auth@mac-mini`), enabling cross-host identification without a central authority.

Usage

Use this principle when designing any system that manages fleet entities across multiple hosts where:

  • The entity (agent) is the core unit, not its runtime container (tmux session)
  • Offline-first operation requires a file-based store with no external database
  • Names need to be unique per-host rather than globally unique
  • Soft-delete with restore capability is needed alongside permanent deletion

Theoretical Basis

The registry follows a file-as-database pattern:

registry.json = [ Agent, Agent, ... ]

Agent = {
  id: UUID,           // globally unique, caller-supplied or generated
  name: string,       // unique per-host (case-insensitive)
  hostId: string,     // canonical hostname
  sessions: [...],    // optional, linked not derived
  deletedAt?: string,  // soft-delete marker
}

The mtime cache avoids redundant disk reads: `loadAgents()` checks `stat.mtimeMs` against a cached value and returns the cached array if the file hasn't changed.

The per-host name uniqueness constraint is enforced at creation: `getAgentByName(name, hostId)` checks before insertion. This mirrors the email model — the same local part can exist on different hosts, but not twice on the same one.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment