1 agents

aiad-backup-manager

aiad-backup-manager

Overview

The AIAD Backup Manager operates as an L4 domain specialist agent within the Infrastructure domain of the Prismatic Platform. This agent is responsible for maintaining versioned backups of all AIAD agent specifications, command definitions, pipeline configurations, and policy documents. In a platform with over 400 autonomous agents, the ability to restore any agent specification to a known-good state is a critical infrastructure capability that prevents configuration drift from causing cascading failures.

The backup strategy extends beyond simple file copying. The AIAD Backup Manager maintains a versioned history of agent specifications with semantic diff tracking, enabling operators to understand exactly what changed between versions and why. When an agent specification update causes unexpected behavior, the backup manager provides instant rollback to any previous version with full provenance tracking of who made the change and which session context was active at the time.

The disaster recovery dimension of this agent addresses a scenario unique to autonomous agent ecosystems: the possibility that an evolution cycle introduces a specification mutation that passes validation but causes operational degradation. Because the AIAD Auto-Evolution Supreme can modify agent specifications autonomously, the Backup Manager serves as the safety net that ensures any autonomous modification can be fully reversed. This creates a bounded-risk environment where evolution can operate with confidence, knowing that the backup layer provides guaranteed reversibility.

Operational Domain

The Infrastructure domain encompasses all operational concerns for the Prismatic Platform including deployment, storage, monitoring, and disaster recovery. The AIAD Backup Manager specifically focuses on the persistence and recoverability of the AIAD ecosystem's configuration layer, ensuring that the platform's agent intelligence can survive hardware failures, misconfigurations, and accidental deletions.

The operational scope covers three backup tiers: specification-level backups (individual .agent.md, .cmd.md, and .policy.md files), ecosystem-level snapshots (the complete .aiad/ directory at a point in time), and cross-environment replication (synchronizing backup state between development, staging, and production).

Key Capabilities

  • Versioned specification backup with semantic diff tracking that captures every change to agent specifications, command definitions, and policy documents with full provenance metadata including session context, triggering agent, and change rationale
  • Point-in-time recovery enabling restoration of any individual agent specification or the entire AIAD ecosystem to a specific timestamp, with dependency resolution to ensure consistency across interconnected specifications
  • Incremental backup strategies that minimize storage overhead by capturing only changed specifications while maintaining fast full-restore capability through snapshot layering with deduplication
  • Backup integrity verification with cryptographic checksums (SHA-256) and periodic restore testing that validates backup completeness without requiring actual disaster recovery activation
  • Cross-environment synchronization supporting backup replication across development, staging, and production environments with environment-specific configuration masking to prevent credential leakage
  • Automated pre-operation backup triggers creating backup checkpoints before any potentially destructive operation: deployment, hot reload, specification evolution, or ecosystem-wide updates

Technical Architecture

The Backup Manager is implemented as a GenServer process within the prismatic_agents supervision tree. It maintains an in-memory index of backup metadata in ETS and stores backup artifacts on the filesystem with optional replication to external storage.

defmodule PrismaticAgents.BackupManager do
  use GenServer

  @backup_base_path ".aiad/backups"
  @retention_days 90
  @integrity_check_interval_ms :timer.hours(4)

  def create_backup(scope, opts \\ []) do
    GenServer.call(__MODULE__, {:backup, scope, opts})
  end

  def restore(backup_id, opts \\ []) do
    GenServer.call(__MODULE__, {:restore, backup_id, opts}, :timer.minutes(5))
  end

  def verify_integrity(backup_id) do
    GenServer.call(__MODULE__, {:verify, backup_id})
  end

  @impl true
  def handle_call({:backup, scope, opts}, _from, state) do
    files = resolve_backup_scope(scope)
    checksums = compute_checksums(files)
    backup_id = store_backup(files, checksums, opts)
    emit_telemetry(:backup_created, %{id: backup_id, files: length(files)})
    {:reply, {:ok, backup_id}, update_index(state, backup_id)}
  end
end

The backup storage format uses a layered snapshot approach. A full snapshot captures the complete .aiad/ directory tree with checksums for every file. Subsequent incremental snapshots capture only modified files, referencing the parent snapshot for unchanged content. Restoration reassembles the complete state from the snapshot chain, validating checksums at each layer. This approach reduces storage requirements by approximately 90% compared to full snapshots while maintaining the ability to restore any point-in-time state.

Decision Framework

Trigger EventBackup TypeScopeRetention
Scheduled interval (every 4 hours)IncrementalChanged files only90 days
Pre-deploymentFull snapshotEntire .aiad/ directory180 days
Pre-evolution cycleFull snapshotAffected specifications90 days
Manual requestConfigurableUser-specifiedUser-specified
Integrity check failureEmergency fullEntire .aiad/ directoryIndefinite

Restoration decisions follow the principle of minimum blast radius. When restoring a single specification, the Backup Manager resolves dependencies to identify which other specifications may need to be co-restored to maintain consistency. If an agent specification references other agents in its coordination table, restoring only the target specification while its coordination partners have evolved forward may create inconsistencies. The dependency resolution algorithm identifies the minimum set of specifications that must be co-restored and presents this to the operator for confirmation.

Authority Level

L4 - Domain Specialist. The Backup Manager holds focused domain authority for backup and recovery operations within the AIAD Infrastructure domain. This authority permits creating, storing, verifying, and restoring backup artifacts without requiring approval from higher-authority agents. The L4 designation constrains the agent to its specialization -- it manages backup state but does not make deployment decisions, evolution choices, or quality gate determinations.

The authority scope includes read access to all .aiad/ specification files for backup purposes and write access to the backup storage location. Restoration operations that modify live specification files require explicit invocation rather than autonomous triggering, ensuring that the backup manager does not inadvertently overwrite intended changes.

Coordination

AgentRelationshipPurpose
aiad-deployment-engineDeployment PartnerTriggers pre-deployment backups and validates rollback readiness
aiad-verification-engineVerification PartnerVerifies backup integrity and validates restored specifications
alert-management-specialistAlert RouterReceives backup failure notifications for escalation
aiad-auto-evolution-supremeEvolution SafetyPre-evolution backups ensure reversibility of autonomous changes
aiad-hot-reload-coordinatorReload SafetyPre-reload backups protect against hot code loading failures

Performance Characteristics

MetricCurrentTargetDescription
Incremental backup time< 5s< 10sTime for incremental backup of changed specifications
Full snapshot time< 30s< 60sTime for complete .aiad/ directory backup
Single spec restore< 2s< 5sTime to restore one specification with dependency check
Full ecosystem restore< 2min< 5minTime for complete .aiad/ ecosystem restoration
Integrity check< 10s< 30sTime for full checksum verification of backup archive
Storage efficiency> 90% dedup> 85%Reduction vs full snapshots through incremental layering

Enforcement

All backup operations are governed by the NO MERCY, NO DOUBTS doctrine. No deployment may proceed without a verified backup of the current state. Backup integrity checks run on a continuous schedule (every 4 hours) and any checksum mismatch triggers immediate investigation. Backup retention policies are enforced without exception -- 90-day minimum retention for standard backups, 180-day for pre-deployment snapshots. Backup storage capacity is monitored with proactive alerting at 80% utilization, well before space exhaustion can compromise recovery capability. Every backup and restoration operation is recorded in the immutable audit trail with complete provenance metadata.

Command Interface

CommandDescriptionAuthority
mix aiad.backup createCreate backup of specified scope (spec, ecosystem, full)L4
mix aiad.backup restoreRestore from backup ID with dependency resolutionL4
mix aiad.backup verifyVerify integrity of backup archive via checksumsL4
mix aiad.backup listList available backup snapshots with metadataL4
mix aiad.backup statusDisplay backup health status and storage utilizationL4

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL