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.
npx agentmods add rules/pauljphilp/effectpatterns/concurrency-pattern-1-coordinate-async-operations-with-deferredgit clone --depth 1 https://github.com/PaulJPhilp/EffectPatternsWrote 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.
[](https://agentmods.dev/rules/pauljphilp/effectpatterns/concurrency-pattern-1-coordinate-async-operations-with-deferred)<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/concurrency-pattern-1-coordinate-async-operations-with-deferred"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/concurrency-pattern-1-coordinate-async-operations-with-deferred.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00984 | $0.00984 |
| Opus 5 | $0.00492 | $0.00492 |
| Sonnet 5 | $0.00197 | $0.00197 |
| Haiku 4.5 | $0.00098 | $0.00098 |
Grade A, and why
concurrency-pattern-1-coordinate-async-operations-with-deferred 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Use Deferred for one-time async coordination between fibers, enabling multiple consumers to wait for a single producer's result. globs: "**/*.ts" alwaysApply: true
Concurrency Pattern 1: Coordinate Async Operations with Deferred
Rule: Use Deferred for one-time async coordination between fibers, enabling multiple consumers to wait for a single producer's result.
Example
This example demonstrates a service startup pattern where multiple workers wait for initialization to complete before starting processing.
import { Effect, Deferred, Fiber } from "effect";
interface ServiceConfig {
readonly name: string;
readonly port: number;
}
interface Service {
readonly name: string;
readonly isReady: Deferred.Deferred<void>;
}
// Simulate a service that takes time to initialize
const createService = (config: ServiceConfig): Effect.Effect<Service> =>
Effect.gen(function* () {
const isReady = yield* Deferred.make<void>();
return { name: config.name, isReady };
});
// Initialize the service (runs in background)
const initializeService = (service: Service): Effect.Effect<void> =>
Effect.gen(function* () {
yield* Effect.log(`[${service.name}] Starting initialization...`);
// Simulate initialization work
yield* Effect.sleep("1 second");
yield* Effect.log(`[${service.name}] Initialization complete`);
// Signal that service is ready
yield* Deferred.succeed(service.isReady, undefined);
});
// A worker that waits for service to be ready before starting
const createWorker = (
id: number,
services: Service[]
): Effect.Effect<void> =>
Effect.gen(function* () {
yield* Effect.log(`[Worker ${id}] Starting, waiting for services...`);
// Wait for all services to be ready
yield* Effect.all(
services.map((service) =>
Deferred.await(service.isReady).pipe(
Effect.tapError((error) =>
Effect.log(
`[Worker ${id}] Error waiting for ${service.name}: ${error}`
)
)
)
)
);
yield* Effect.log(`[Worker ${id}] All services ready, starting work`);
// Simulate worker processing
for (let i = 0; i < 3; i++) {
yield* Effect.sleep("500 millis");
yield* Effect.log(`[Worker ${id}] Processing task ${i + 1}`);
}
yield* Effect.log(`[Worker ${id}] Complete`);
});
// Main program
const program = Effect.gen(function* () {
// Create services
const apiService = yield* createService({ name: "API", port: 3000 });
const dbService = yield* createService({ name: "Database", port: 5432 });
const cacheService = yield* createService({ name: "Cache", port: 6379 });
const services = [apiService, dbService, cacheService];
// Start initializing services in background
const initFibers = yield* Effect.all(
services.map((service) => initializeService(service).pipe(Effect.fork))
);
// Start workers that wait for services
const workerFibers = yield* Effect.all(
[1, 2, 3].map((id) => createWorker(id, services).pipe(Effect.fork))
);
// Wait for all workers to complete
yield* Effect.all(workerFibers.map((fiber) => Fiber.join(fiber)));
// Cancel initialization fibers (they're done anyway)
yield* Effect.all(initFibers.map((fiber) => Fiber.interrupt(fiber)));
yield* Effect.log(`\n[MAIN] All workers completed`);
});
Effect.runPromise(program);
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.
- 5d ago First seen · 142 lines · 984 tokens per session scan A 77361555e10a
concurrency-pattern-1-coordinate-async-operations-with-deferred is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (796 stars, last pushed 2mo ago), licensed MIT. It adds 984 tokens to every session, about $0.0049 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.
Other cursor rules, from other repositories
typescript-code-generation-rules
Rules for generating TypeScript code in Next.js 14 components, including component definition syntax, props definitions, and named/default exports.
react-and-typescript-general-rules
General rules for React and TypeScript projects, focusing on code clarity and best practices.
typescript-coding-style
Enforces code style and best practices for TypeScript files.
javascript-typescript-code-style
Rules for JavaScript and TypeScript code style, including modern features, functional patterns, and descriptive naming conventions.
code-style-and-improvements
This rule focuses on code style, refactoring suggestions, and leveraging the latest ES and Node.js features for JavaScript, TypeScript, and Python files.
key-conventions
Key coding conventions for Astro projects including style guide and typescript.