Back to Directory
multi-site-swarm-mapper

multi-site-swarm-mapper

Orchestrate parallel Python eval agent swarms to extract and map data across multiple site directories using JSON schemas.

When tasked with extracting, mapping, or summarizing configurations or data from multiple local directories, projects, or sites simultaneously:

  1. Locate Targets: Use bash (e.g., find) to locate all target sites/configurations.
  2. Define Extraction Schema: In a Python eval block, define a strict JSON dictionary schema (e.g., SCHEMA = {"type": "object", "properties": {"plugins": {"type": "string"}}}).
  3. Create Mapping Function: Write a Python function that uses the sandbox read() helper to read a target's files, and calls res = agent(prompt, agent="quick_task", schema=SCHEMA). Always extract defensively using res.get("data", res).
  4. Execute Parallel Swarm: Run the mapper over all targets using the parallel() array helper: mapped_data = parallel([lambda t=t: map_site(t) for t in SITES]).
  5. Synthesize: Pass json.dumps(mapped_data) to an oracle or task agent to synthesize a unified report or SSOT cheat sheet.