Równoległe sekcje agentów z syntezą
Dzielisz szerokie zadanie na niezależne sekcje, każda dostaje własnego agenta, a synteza pokazuje, czego nikt nie sprawdził.
Orkiestracja, średni poziom. Opublikowano
Co robi
Agent dzieli zadanie na sekcje z twardą granicą: po plikach, domenach, źródłach, rodzajach ryzyka albo ścieżkach użytkownika. Wszystkich agentów sekcji wysyła w jednej wiadomości, więc pracują równolegle. Każdy zapisuje pełny raport do pliku i odsyła tylko ścieżkę ze streszczeniem. Raport zawiera mapę pokrycia, ustalenia z wagą i zależności między sekcjami. Na końcu synteza scala mapy, każde niepokryte miejsce zamienia w ustalenie z dodatkowym agentem i rozstrzyga sprzeczności.
Kiedy używać
Kiedy używać
- Przegląd, audyt albo budowa ma dwie lub więcej części, które nie potrzebują nawzajem swoich wyników.
- Jeden agent na szerokim zadaniu pomija fragmenty i nie mówi, których.
- Research z kilku źródeł, które da się czytać osobno.
- Zmiana obejmuje kilka podsystemów i chcesz osobnego recenzenta dla każdego.
Kiedy nie używać
- Zadanie to jedna komenda, jedna linijka albo sprawdzenie statusu.
- Kroki idą ściśle po kolei i każdy potrzebuje wyniku poprzedniego. To jest pipeline.
- Zadanie jest krótkie. Każda sekcja ładuje własny kontekst, więc płacisz kilka razy więcej tokenów.
Tabela decyzyjna
| Sytuacja | Co robi skill |
|---|---|
| Kilka niezależnych części | Tnie po szwach i wysyła agentów sekcji w jednej wiadomości |
| Praca widoczna dla użytkownika | Tnie po ścieżkach użytkownika, nie po zasobach |
| Wspólny plik między sekcjami | Daje prawo zapisu jednej sekcji, reszta tylko czyta |
| Raport bez mapy pokrycia | Odrzuca raport i wysyła sekcję ponownie z poprawionym promptem |
| Miejsce, którego nie objęła żadna sekcja | Zapisuje je jako ustalenie i wysyła dodatkowego agenta |
| Kroki zależne od siebie | Nie dzieli zadania, prowadzi je po kolei |
Szablon
Metoda: kiedy dzielić zadanie, jak ciąć po szwach, prompt sekcji, kontrakt odpowiedzi i obowiązkowa synteza.
---
name: sectioned-fan-out
description: Split a task with several independent parts into bounded sections, run one agent per section in parallel, and merge their reports in a mandatory synthesis pass. Use it when a review, audit, build or research task has two or more parts that do not depend on each other's output.
---
# Sectioned fan-out with synthesis
One agent working a task with five independent parts spreads one attention budget across all of them.
Nothing forces the fifth part to get the attention the first one got, and you never learn what it skipped.
This workflow gives each part its own agent with a hard boundary, makes every agent report what it
actually covered, and closes with a synthesis pass that turns every uncovered spot into a visible finding.
Read `CONTEXT.md` next to this file before you start. It holds the reader's model tiers, concurrency cap,
report folder and any project-specific seams.
If `CONTEXT.md` is missing, or a field you need is blank, stop and ask the user for it in the user's
language before you dispatch anything. Ask for one field at a time and name what it is for, for example:
EN "Add your concurrency cap: how many section agents may run at once on your machine?",
PL „Podaj limit równoległości: ilu agentów sekcji może działać naraz na Twoim komputerze?”.
Write the answer into `CONTEXT.md` so you do not ask again.
## Before you start / What you need
- **An AI coding agent that runs subagents in parallel** (required). Any of these works:
- Claude Code: install from https://code.claude.com/docs/en/setup, subagents at https://code.claude.com/docs/en/sub-agents
- Codex CLI: install from https://developers.openai.com/codex/cli, subagents at https://developers.openai.com/codex/subagents
- Cursor: install from https://cursor.com/downloads, subagents at https://cursor.com/docs/agent/subagents
Test it once: ask for two subagents that each list one folder, and check that both started before the
first one replied. If they run one after another, this workflow loses its point in your tool.
- **A report folder** the section agents can write to, named in `CONTEXT.md`.
- **A token budget** for several parallel contexts. Every section loads its own.
## 1. Decide whether to fan out
Fan out when you can name two or more chunks of the task that do not need each other's output.
Do NOT fan out when:
- **The task is trivial.** A single command, a one-line edit, a status lookup. Do it directly.
- **The work is indivisible.** One small surface with no independent seams gets one agent.
- **The steps are strictly sequential.** If each step needs the previous step's output, you have a pipeline, not a
fan-out. Run it in order.
- **The task is short.** Every section agent loads its own context, so a fan-out costs several times the
tokens of a single agent. It pays off on long, wide tasks and wastes budget on quick ones.
If none of these hold, fan out.
## 2. Cut along seams
List the sections before you dispatch anything. Pick the seam that matches the task:
| Seam | Cut by | Example |
|---|---|---|
| File or module | directory, package, file group | `checkout/`, `catalog/`, `accounts/` in a small online shop |
| Domain or subsystem | frontend, API, billing, auth, webhooks, migrations | one agent per subsystem of a small web app |
| Source | repos, documents, datasets, research angles | three competitor sites, two forums, one changelog |
| Concern | correctness, security, performance, data integrity, UX | four reviewers over the same diff |
| Feature slice | one feature end to end | "invite a teammate", "export invoices" |
For every section, write its boundary in one line: the exact files, folders, domain or question it owns.
**Keep boundaries disjoint.** Two agents editing the same file will overwrite each other. If a shared file
cannot be avoided, give exactly one section write access and make the others read-only on it.
### Connective tissue: the seams between the seams
Cutting by resource leaves the connections between resources unowned, so every section can report
green while the feature as a whole does not work.
- **User-facing work: cut by user journey.** A section is a path a person walks end to end ("reset a password and
log back in", "place an order and get the confirmation email"), through however many resources
it crosses.
- **If you must cut by resource, name the owner of every seam.** Write into the dispatch which section
owns each page, handler or file that sits between two sections. An unnamed seam is an unowned seam.
- **Resource-complete is not working.** A section can honestly finish its files while the feature stays
unusable. Each section verifies its own slice end to end before it reports green. For UI work that means
driving the real interface, not calling an endpoint and trusting the response.
## 3. Set concurrency and model tier
- **Concurrency:** read the cap from `CONTEXT.md`. If there are more sections than the cap allows, run them
in waves, each wave in one message. If the machine is short on memory, lower the cap before you start;
running out of memory mid-fan-out loses every section's work.
- **Model tier per section:** use the cheap tier from `CONTEXT.md` for mechanical sections (clear spec,
no judgment: renames, log extraction, checklist sweeps). Use the strongest tier for sections that need
judgment (architecture, security, taste, adversarial review). If a cheap-tier section returns weak work,
rerun it on a stronger tier if the "Escalation allowed" field in `CONTEXT.md` says yes, otherwise ask the human first.
## 4. Dispatch every section in ONE message
Send all section agents of a wave in a single message with multiple agent calls. Calls in one message run
in parallel. Calls spread over separate messages run one after another, and you lose the whole gain.
Every section prompt states four things: the boundary, the task, the exact output shape, and the stop
point. Use this shape:
```
You are the section agent for: [section name].
BOUNDARY: you work ONLY on [files / folders / domain / journey].
Nothing outside this boundary. If you see a problem next door, record it
as a cross-section dependency. Do not fix it.
[If this section owns a seam: you also own [seam]. Verify it end to end.]
TASK: [what to find, check or build]
Return exactly this (shape in section-report.template.md):
1. Coverage map: every file, flow or source you actually opened or exercised.
Anything not on this list counts as unchecked.
2. Findings: each with severity (CRITICAL / MAJOR / MINOR) and location.
3. Cross-section dependencies: anything in your section that touches another.
4. Verification: how you proved your slice works end to end.
REPLY CONTRACT: write the full report to [report folder]/[section-name].md.
Reply to me with ONLY the file path and a summary of at most [summary limit
from CONTEXT.md], written for a reader
who has seen none of your work: outcome first, then anything I must decide
or reconcile, in complete sentences. Do not paste the report into the reply.
STOP: finish after the report is written. Do not widen the scope.
```
## 5. Keep working while sections run
Dispatching is not a reason to stop. While the sections run:
- Do the parts that depend on nothing: read the seams yourself, prepare the synthesis frame (an empty
combined coverage map listing every surface of the task).
- Answer questions sections send back, from the original task and its constraints.
- Intervene in a section that has gone off track or lacks context it needed. Correct it, or stop it and
redispatch with a better prompt. Do not wait to discover the problem at synthesis.
## 6. The context-safety contract
Large reports stay on disk. A section that pastes its full report into its reply can overflow your
context mid-synthesis, and then all section work is lost. The rule for every section, with no exceptions:
- Substantial, durable or large output goes to a file in the report folder from `CONTEXT.md`.
- The reply is the path plus a short, selective summary: outcome first, then what the parent must decide.
- You read from each file only the part you need at the moment.
Keep the summary length limit from `CONTEXT.md` in every section prompt.
## 7. Gate each report
A section report fails, and gets redispatched with a corrected prompt, when:
- it has no coverage map,
- a finding has no severity or no location,
- the section claims green without saying how it verified end to end,
- the full report came back in the reply instead of in a file.
## 8. Synthesis pass (mandatory)
Never hand back N separate reports. Merge them into one result:
1. **Combine the coverage maps** into one map against the full task surface you listed in step 5.
2. **Name every uncovered spot.** A file, flow, domain or seam that appears on no map is a finding in its
own right. Dispatch a follow-up agent for it. The task is not closed while a blank spot remains.
3. **Walk the cross-section dependencies.** Each one either lands on a section that covered it, or it
becomes an uncovered seam under point 2.
4. **Reconcile conflicts.** When two sections disagree, decide which one is right and write why. Never
drop a finding silently.
5. **Order findings by severity**, not by the order reports arrived.
Return: the combined coverage map, the list of blank spots with the follow-up dispatched for each, the
reconciled conflicts, and the top actions in order.
Synthesis prompt, if a separate agent does it:
```
You have [N] section reports: [paths]. The full task surface is: [surface list].
1. Merge the coverage maps into one. List explicitly what NO section covered.
2. Check every cross-section dependency against the merged map.
3. Resolve conflicting findings and state why. Do not delete any silently.
4. Sort findings by severity, not by the sequence reports came in.
5. Return: merged coverage map, blank spots, resolved conflicts,
top actions in order. Write the full result to [path]; reply with path + summary.
```
## Failure modes
| Symptom | Cause | Fix |
|---|---|---|
| Parent context overflows during synthesis | sections pasted full reports into replies | reply contract in every prompt; reports on disk |
| Two agents overwrite the same file | overlapping boundaries | disjoint boundaries, or one writer and the rest read-only |
| Every section green, feature broken | sections cut by resource, seams unowned | cut by user journey, or name each seam's owner |
| A part of the task was never checked | no coverage map, or no synthesis | coverage map is mandatory; synthesis lists blank spots |
| Sections ran one by one | dispatched across several messages | one message per wave |
| Machine stalls or kills agents | too many sections at once | respect the concurrency cap; run waves |
Pozostałe pliki
CONTEXT.template.mdTwoje ustawienia: modele dla sekcji, limit równoległości, folder raportów, typowe szwy projektu.
# Sectioned fan-out: your context
Copy this file to CONTEXT.md next to SKILL.md and fill in every blank. Never put passwords, access keys or card numbers here.
## Agent tool
(How your agent spawns a sub-agent, and whether several calls in one message run in parallel in your tool.)
Example: The Agent/Task tool; several calls in one message run concurrently.
## Model tiers
(Which model handles mechanical sections and which handles judgment sections. Use the names your tool accepts.)
Cheap tier (mechanical, clear spec): ___
Strong tier (judgment, security, taste, review): ___
Example: Cheap tier: a small fast model. Strong tier: your most capable model.
## Escalation allowed
(May the agent rerun a weak cheap-tier section on a stronger tier without asking you first? Answer yes or no.)
Escalation allowed: ___
Example: yes, rerun once on the strong tier, then ask.
## Concurrency cap
(How many section agents may run at once. Derive it from your machine's free memory and your plan's rate limits: start low, raise it while nothing stalls, lower it when free memory is tight.)
Cap: ___
Lower the cap when: ___
Example: Cap 4. Drop to 2 when less than a third of memory is free; run one at a time below that.
## Report folder
(Where section agents write their full reports. A folder outside version control or one you clean up after each run.)
Example: ./tmp/fanout-reports/
## Reply summary limit
(The maximum length of the summary a section agent may put in its reply. Pick a size your parent session can take from every section at once with room to spare.)
Example: a short paragraph, at most a few hundred words.
## Usual seams in this project
(The cuts that fit your codebase or work. List subsystems, user journeys and shared files.)
Subsystems: ___
Main user journeys: ___
Shared files that need a single writer: ___
Example: Subsystems: storefront, checkout API, admin panel. Journeys: browse and buy; refund request. Shared: the database schema file.
## Verification per section
(How a section proves its slice works end to end: a test command, a browser run, a query.)
Example: run the journey in a real browser against the staging site and attach a screenshot path.
section-report.template.mdKształt raportu, który zwraca każdy agent sekcji: mapa pokrycia, ustalenia z wagą, zależności, weryfikacja.
# Section report: [section name]
Boundary: [exact files, folders, domain or journey this section owned]
Seams owned: [pages, handlers or files between sections that this section was named owner of, or "none"]
## Coverage map
(Every file, flow or source actually opened or exercised. Anything missing here counts as unchecked.)
- [path or flow] | [read / edited / exercised]
- ...
## Findings
| Severity | Location | Finding | Suggested fix |
|---|---|---|---|
| CRITICAL / MAJOR / MINOR | [file:line or flow step] | [what is wrong] | [what to do] |
## Cross-section dependencies
- [what in this section touches which other section, and what that section must check]
## Verification
(How this slice was proven to work end to end. For UI work: the real interface was driven, not only an endpoint called.)
- Method: [test command, browser run, query]
- Result: [pass / fail, with evidence path]
## Out of scope, noticed
- [problems seen outside the boundary, recorded, not fixed]
Czego potrzebujesz
An AI coding agent that runs subagents in parallel (Claude Code, Codex CLI or Cursor) (otwiera się w nowej karcie)
Workflow wysyła jednego pod-agenta na sekcję w jednej wiadomości, więc Twój agent musi umieć uruchamiać pod-agentów i puszczać ich równolegle.
- Claude Code: zainstaluj według https://code.claude.com/docs/en/setup (otwiera się w nowej karcie). Pod-agenci są opisani na stronie podlinkowanej wyżej.
- Codex CLI: zainstaluj według https://developers.openai.com/codex/cli (otwiera się w nowej karcie). Pod-agenci są opisani na https://developers.openai.com/codex/subagents (otwiera się w nowej karcie).
- Cursor: zainstaluj z https://cursor.com/downloads (otwiera się w nowej karcie). Pod-agenci są opisani na https://cursor.com/docs/agent/subagents (otwiera się w nowej karcie).
- Test: poproś agenta o dwóch pod-agentów, z których każdy wypisze zawartość jednego folderu, i sprawdź, że oba wystartowały, zanim pierwszy odpowiedział.
Instalacja
- Claude Code: skopiuj folder do .claude/skills/sectioned-fan-out/ w projekcie albo do ~/.claude/skills/sectioned-fan-out/ dla wszystkich projektów. Claude ładuje skill, gdy opis pasuje do zadania, albo gdy wpiszesz /sectioned-fan-out.
- Codex: wklej treść SKILL.md do AGENTS.md w katalogu repozytorium albo do globalnego ~/.codex/AGENTS.md.
- Cursor: dodaj SKILL.md jako regułę projektu albo wklej go do AGENTS.md.
- Inny agent: wklej SKILL.md do pliku instrukcji projektu albo promptu systemowego.
- Skopiuj CONTEXT.template.md jako CONTEXT.md obok SKILL.md i uzupełnij każde pole.
- Połóż section-report.template.md obok SKILL.md, żeby agenci sekcji mieli wzór raportu.
Działa, jeśli
- Zanim agent cokolwiek wyśle, wypisuje listę sekcji z granicą każdej w jednej linijce.
- Wszystkie wywołania agentów sekcji pojawiają się w jednej wiadomości, nie w kolejnych.
- W folderze raportów z CONTEXT.md pojawia się jeden plik na sekcję.
- Odpowiedź każdej sekcji to ścieżka pliku plus krótkie streszczenie, bez wklejonego raportu.
- Każdy raport ma mapę pokrycia, a ustalenia mają wagę i lokalizację.
- Wynik końcowy zawiera listę miejsc bez pokrycia albo wprost stwierdza, że takich nie ma.
Wymagania
- Agent, który potrafi uruchamiać sub-agentów i odpalać kilka wywołań równolegle.
- Folder na raporty, do którego agenci sekcji mogą pisać.
- Budżet tokenów na kilka równoległych kontekstów.
Pytania
Ilu agentów uruchamiać naraz?
Tylu, ile pozwala limit z CONTEXT.md. Zacznij nisko, podnoś, dopóki nic się nie zawiesza, i obniż, gdy brakuje wolnej pamięci. Nadmiarowe sekcje puszczaj falami, każdą falę w jednej wiadomości.
Po co mapa pokrycia, skoro agent i tak raportuje ustalenia?
Ustalenia mówią, co agent znalazł. Mapa pokrycia mówi, co w ogóle otworzył. Bez niej brak ustaleń wygląda tak samo jak brak sprawdzenia, a synteza nie ma z czego wyliczyć białych plam.
Dlaczego raport ma iść do pliku?
Kilka pełnych raportów wklejonych do odpowiedzi potrafi zapchać kontekst sesji nadrzędnej w połowie syntezy. Wtedy cała praca sekcji przepada. Plik na dysku plus krótkie streszczenie trzyma kontekst w ryzach.
Każda sekcja zgłasza sukces, a funkcja nie działa. Co poszło źle?
Najczęściej cięcie po zasobach zostawiło szwy bez właściciela, na przykład plik, którego dotykają dwie sekcje naraz. Tnij po ścieżkach użytkownika albo przypisz każdemu szwowi właściciela i wymagaj weryfikacji end to end w każdej sekcji.
Jakiego modelu użyć dla sekcji?
Taniego dla sekcji mechanicznych z jasną specyfikacją, najmocniejszego dla sekcji wymagających oceny: architektury, bezpieczeństwa, recenzji. Słabą odpowiedź taniego modelu powtórz na mocniejszym.
Gdzie to pasuje
Ten skill jest silnikiem wykonawczym dla innych workflow. Szablon orkiestratora decyduje, co zlecić, a fan-out rozkłada szerokie zlecenie na sekcje. Szablon recenzji adwersaryjnej używa tego samego wzoru: jeden recenzent na sekcję, a najgorszy werdykt decyduje. Przy budowie wyniki syntezy trafiają do szablonu build-through jako uporządkowana lista działań.
Wszystkie skilleŹródła
- Claude Code docs: skills (dostęp 2026-09-22)
- OpenAI Codex docs: AGENTS.md (dostęp 2026-09-22)
- Cursor docs: rules (dostęp 2026-09-22)
Pytania o wdrożenie zadajesz na Discordzie.Dołącz za darmo