collect-all-results-into-a-list

collect-all-results-into-a-list is a cursor rule for Cursor from PaulJPhilp/EffectPatterns. It costs 536 tokens per session, scanned A, original, MIT.

A pattern for running an Effect-TS stream and gathering every emitted value into one list-like collection called a Chunk.

In plain words
What is it for?
Use it to filter, transform, and then collect stream output, such as building a list of matching records or values.
Why use it?
It avoids handling stream results one at a time when the whole result set is needed after processing finishes.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to filter, transform, and then collect stream output, such as building a list of matching records or values.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/pauljphilp/effectpatterns/collect-all-results-into-a-list
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/PaulJPhilp/EffectPatterns

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for collect-all-results-into-a-list

README.md
[![agentmods](https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/collect-all-results-into-a-list/github.svg)](https://agentmods.dev/rules/pauljphilp/effectpatterns/collect-all-results-into-a-list)
Your own site
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/collect-all-results-into-a-list"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/collect-all-results-into-a-list/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for collect-all-results-into-a-list

Your own site · 80×15
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/collect-all-results-into-a-list"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/collect-all-results-into-a-list.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 536 This file is loaded in full into every session.
When invoked 536 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00536 $0.00536
Opus 5 $0.00268 $0.00268
Sonnet 5 $0.00107 $0.00107
Haiku 4.5 $0.00054 $0.00054

Measured 9d ago against content hash 6ad8a1559ee5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

collect-all-results-into-a-list scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

content/published/rules/cursor/collect-all-results-into-a-list.mdc · 56 lines

How it starts

The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.

description: Use Stream.runCollect to execute a stream and collect all its emitted values into a Chunk. globs: "**/*.ts" alwaysApply: true

Collect All Results into a List

Rule: Use Stream.runCollect to execute a stream and collect all its emitted values into a Chunk.

Example

This example creates a stream of numbers, filters for only the even ones, transforms them into strings, and then uses runCollect to gather the final results into a Chunk.

import { Effect, Stream, Chunk } from "effect";

const program = Stream.range(1, 10).pipe(
  // Find all the even numbers
  Stream.filter((n) => n % 2 === 0),
  // Transform them into strings
  Stream.map((n) => `Even number: ${n}`),
  // Run the stream and collect the results
  Stream.runCollect
);

const programWithLogging = Effect.gen(function* () {
  const results = yield* program;
  yield* Effect.log(
    `Collected results: ${JSON.stringify(Chunk.toArray(results))}`
  );
  return results;
});

Effect.runPromise(programWithLogging);
/*
Output:
Collected results: [
  'Even number: 2',
  'Even number: 4',
  'Even number: 6',
  'Even number: 8',
  'Even number: 10'
]
*/

Explanation:
A "sink" is a terminal operator that consumes a stream and produces a final Effect. Stream.runCollect is the most fundamental sink. It provides the bridge from the lazy, pull-based world of Stream back to the familiar world of a single Effect that resolves with a standard data structure.

Using Stream.runCollect is essential when:

  1. You Need the Final Result: The goal of your pipeline is to produce a complete list of transformed items that you need to use in a subsequent step (e.g., to return as a single JSON array from an API).
  2. Simplicity is Key: It's the most straightforward way to "run" a stream and see its output. It declaratively states your intent: "execute this entire pipeline and give me all the results."
  3. The Dataset is Bounded: It's designed for streams where the total number of items is known to be finite and small enough to fit comfortably in memory.

Read the full file on GitHub · 56 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 56 lines · 536 tokens per session scan A 6ad8a1559ee5

Subscribe to this mod's changes

collect-all-results-into-a-list is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (796 stars, last pushed 2mo ago), licensed MIT. It adds 536 tokens to every session, about $0.0027 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.