flatten-workflow-parallel-arrays-before-collecting

Diagnoses and fixes Workflow pipeline collectors that silently drop parallel() array results.

3|Updated May 8, 2026
One-click install
npx skills add https://github.com/wan-huiyan/agent-traffic-control --skill flatten-workflow-parallel-arrays-before-collecting-wan-huiyan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flatten-workflow-parallel-arrays-before-collecting
Source: https://github.com/wan-huiyan/agent-traffic-control/tree/main/plugins/agent-traffic-control/skills/flatten-workflow-parallel-arrays-before-collecting
Command: npx skills add https://github.com/wan-huiyan/agent-traffic-control --skill flatten-workflow-parallel-arrays-before-collecting-wan-huiyan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? In the Claude Code Workflow tool, a pipeline() stage that returns parallel([...]) resolves to a bare array while a sibling stage returning {dimension, verified: []} resolves to an object. A collector written only for the object shape silently drops every item from array-shaped stages, producing a false "0 confirmed / 0 refuted" all-clear even though verify agents actually ran and found candidates. ## Core Features & Use Cases - Bug Detection: Recognize the false all-clear signature — a workflow reports 0 findings while agentCount and the journal show verify agents both started and returned results. - Collector Fix: Handle both shapes in the collector with Array.isArray(p?.verified) ? p.verified : (Array.isArray(p) ? p : []), or normalize stage-2 to one consistent shape. - Cheap Recovery: Edit the collector line in the persisted script and resume with Workflow({scriptPath, resumeFromRunId}) so cached find/verify agents return instantly and only the fixed synthesis re-runs. - Use Case: A fan-out adversarial review workflow reports "0 confirmed / 0 refuted" but the journal at ~/.claude/projects/<proj>/<session>/subagents/workflows/wf_<id>/journal.jsonl shows verify agents ran — apply the two-shape collector fix and resume to recover the dropped verdicts. ## Quick Start Ask the agent to check whether my Workflow pipeline collector handles both the object shape and the bare array shape returned by parallel(), then fix and resume the run.

Frequently Asked Questions about flatten-workflow-parallel-arrays-before-collecting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Claude Code Workflow report 0 findings when agents clearly ran?▼

A pipeline stage returning parallel(...) resolves to a bare array, while sibling stages return objects. A collector checking only p.verified drops every array-shaped result, yielding a false 0 confirmed / 0 refuted even though verify agents ran.

How do I fix a Workflow pipeline collector that drops parallel() results?▼

Handle both shapes: per.flatMap(p => Array.isArray(p?.verified) ? p.verified : (Array.isArray(p) ? p : [])). Better still, make the stage return one consistent shape so the collector cannot diverge.

How can I confirm verify agents actually ran in a Workflow?▼

Check the completion summary's agentCount and the journal at ~/.claude/projects/<proj>/<session>/subagents/workflows/wf_<id>/journal.jsonl. Lines with type 'started' and 'result' for verify keys prove agents ran, contradicting a 0-findings report.

Can I recover dropped Workflow results without re-running all agents?▼

Yes. Edit the collector line in the persisted script under workflows/scripts/<name>-<runId>.js and resume with Workflow({scriptPath, resumeFromRunId}). Cached find and verify agents return instantly; only the fixed synthesis re-runs.

Does parallel() handle thunks that throw errors?▼

parallel() resolves a thrown thunk to null rather than rejecting. Always call .filter(Boolean) on the flattened array before using verdicts to avoid null entries corrupting downstream synthesis.