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:777genius Agent teams ai Team Configuration

From Leeroopedia
Knowledge Sources
Domains Configuration, Team_Management
Last Updated 2026-10-22 00:00 GMT

Overview

Pattern for persisting and retrieving team configuration data from the filesystem with caching, invalidation, and generation-based staleness detection.

Description

Team Configuration is the practice of storing multi-agent team definitions (members, roles, provider settings, model selections) as JSON files on disk, then reading them with a multi-layer cache that avoids redundant I/O while remaining correct under concurrent file mutations. The pattern solves the tension between low-latency reads (needed for responsive UI) and correctness (needed when launches depend on up-to-date config).

The key challenges addressed are:

  • Concurrent reads: Multiple IPC callers may request the same config simultaneously; in-flight deduplication prevents duplicate disk reads.
  • Cache invalidation: File watchers fire multiple events for a single logical change; generation counters ensure stale in-flight results are not cached after invalidation.
  • Staleness tolerance: Some callers need verified (latest) config, others can accept a cached snapshot.

Usage

Use this principle when designing any system that reads configuration files that may change at runtime and must serve multiple concurrent consumers. It is particularly relevant for Electron apps where the main process serves the renderer via IPC, and for any system where file watchers create invalidation storms.

Theoretical Basis

The configuration reader implements a generation-based cache invalidation strategy:

# Abstract algorithm (NOT real implementation)
class ConfigReader:
    cache = {}
    in_flight = {}
    generation_by_path = {}

    async def get_config(team_name):
        path = resolve_path(team_name)
        if path in self.in_flight:
            return await self.in_flight[path]  # Deduplicate concurrent reads

        gen = self.generation_by_path.get(path, 0)
        promise = self.read_from_disk(path, gen)
        self.in_flight[path] = promise
        try:
            return await promise
        finally:
            del self.in_flight[path]

    def invalidate(path):
        self.cache.pop(path, None)
        self.generation_by_path[path] += 1  # Stale in-flight results rejected

The generation counter ensures that a read started before an invalidation is not written to the cache after the invalidation, preventing stale data from surviving a cache flush.

Related Pages

Implemented By

Uses Heuristic

Page Connections

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