# Map Reduce

> When it would yield better results to explore mulitple approaches to a problem, load this skill to orchestrate multiple agents using a diverge and converge strategy. Use when this capability is needed.

- Skill: `tomevault-io/map-reduce` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/map-reduce`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/map-reduce/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/map-reduce

---


## ::types::

TYPE Task = instructions for a sub-agent to execute
TYPE Strategy = "accumulate" | "independent"

### ::input::

$transform: Task
$validator: Task
$strategy: Strategy = "accumulate"
$maxIterations: Number = 5

## ::context::

$statusQuo: Link
$iteration: Number = 0

## ::workflow::

USE ~/skill/work-packages TO create master work package

DO
  Summarise status quo into $statusQuo
END

IF $strategy = "accumulate" THEN
  SPAWN ~/agent/general TO run accumulate prompt WITH #accumulate-prompt
ELSE
  SPAWN ~/agent/general TO run independent prompt WITH #independent-prompt
END

RETURN $statusQuo

## Accumulate Prompt

```mdz
WHILE $iteration < $maxIterations AND NOT diminishing returns DO
  AWAIT SPAWN ~/agent/general TO $transform WITH
    input: $statusQuo
    output: next candidate path
  AWAIT SPAWN ~/agent/general TO $validator WITH
    candidate: next candidate path
  IF validation passed THEN
    $statusQuo = next candidate path
  END
  $iteration = $iteration + 1
END

RETURN $statusQuo
```

## Independent Prompt

```mdz
WHILE $iteration < $maxIterations DO
  ASYNC SPAWN ~/agent/general TO $transform WITH
    iteration: $iteration
    output: candidate path
  $iteration = $iteration + 1
END

AWAIT SPAWN ~/agent/general TO $validator WITH
  candidates: candidate paths from async runs

RETURN winning candidate
```

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/djgrant) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

