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.
git 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-5-broadcast-events-with-pubsub)<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/concurrency-pattern-5-broadcast-events-with-pubsub"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/concurrency-pattern-5-broadcast-events-with-pubsub/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.
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/concurrency-pattern-5-broadcast-events-with-pubsub"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/concurrency-pattern-5-broadcast-events-with-pubsub.svg" alt="Reviewed on agentmods" width="80" 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.01269 | $0.01269 |
| Opus 5.5 | $0.00508 | $0.00508 |
| Sonnet 5.5 | $0.00254 | $0.00254 |
| Haiku 4.5 | $0.00127 | $0.00127 |
Grade A, and why
concurrency-pattern-5-broadcast-events-with-pubsub 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 1mo 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 — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Use PubSub to broadcast events to multiple subscribers, enabling event-driven architectures where publishers and subscribers are loosely coupled. globs: "**/*.ts" alwaysApply: true
Concurrency Pattern 5: Broadcast Events with PubSub
Rule: Use PubSub to broadcast events to multiple subscribers, enabling event-driven architectures where publishers and subscribers are loosely coupled.
Example
This example demonstrates a multi-subscriber event broadcast system with independent handlers.
import { Effect, PubSub, Fiber, Ref } from "effect";
interface StateChangeEvent {
readonly id: string;
readonly oldValue: string;
readonly newValue: string;
readonly timestamp: number;
}
interface Subscriber {
readonly name: string;
readonly events: StateChangeEvent[];
}
// Create subscribers that react to events
const createSubscriber = (
name: string,
pubsub: PubSub.PubSub<StateChangeEvent>,
events: Ref.Ref<StateChangeEvent[]>
): Effect.Effect<void> =>
Effect.gen(function* () {
yield* Effect.log(`[${name}] ✓ Subscribed`);
// Get subscriber handle
const subscription = yield* PubSub.subscribe(pubsub);
// Listen for events indefinitely
while (true) {
const event = yield* subscription.take();
yield* Effect.log(
`[${name}] Received event: ${event.oldValue} → ${event.newValue}`
);
// Simulate processing
yield* Effect.sleep("50 millis");
// Store event (example action)
yield* Ref.update(events, (es) => [...es, event]);
yield* Effect.log(`[${name}] ✓ Processed event`);
}
});
// Publisher that broadcasts events
const publisher = (
pubsub: PubSub.PubSub<StateChangeEvent>,
eventCount: number
): Effect.Effect<void> =>
Effect.gen(function* () {
yield* Effect.log(`[PUBLISHER] Starting, publishing ${eventCount} events`);
for (let i = 1; i <= eventCount; i++) {
const event: StateChangeEvent = {
id: `event-${i}`,
oldValue: `state-${i - 1}`,
newValue: `state-${i}`,
timestamp: Date.now(),
};
// Publish to all subscribers
const size = yield* PubSub.publish(pubsub, event);
yield* Effect.log(
`[PUBLISHER] Published event to ${size} subscribers`
);
// Simulate delay between events
yield* Effect.sleep("200 millis");
}
yield* Effect.log(`[PUBLISHER] ✓ All events published`);
});
// Main: coordinate publisher and multiple subscribers
const program = Effect.gen(function* () {
// Create PubSub with bounded capacity
const pubsub = yield* PubSub.bounded<StateChangeEvent>(5);
// Create storage for each subscriber's events
const subscriber1Events = yield* Ref.make<StateChangeEvent[]>([]);
const subscriber2Events = yield* Ref.make<StateChangeEvent[]>([]);
const subscriber3Events = yield* Ref.make<StateChangeEvent[]>([]);
console.log(`\n[MAIN] Starting PubSub event broadcast system\n`);
// Subscribe 3 independent subscribers
const sub1Fiber = yield* createSubscriber(
"SUBSCRIBER-1",
pubsub,
subscriber1Events
).pipe(Effect.fork);
const sub2Fiber = yield* createSubscriber(
"SUBSCRIBER-2",
pubsub,
subscriber2Events
).pipe(Effect.fork);
const sub3Fiber = yield* createSubscriber(
"SUBSCRIBER-3",
pubsub,
subscriber3Events
).pipe(Effect.fork);
// Wait for subscriptions to establish
yield* Effect.sleep("100 millis");
// Start publisher
const publisherFiber = yield* publisher(pubsub, 5).pipe(Effect.fork);
// Wait for publisher to finish
yield* Fiber.join(publisherFiber);
// Wait a bit for subscribers to process last events
yield* Effect.sleep("1 second");
// Shut down
yield* PubSub.shutdown(pubsub);
yield* Fiber.join(sub1Fiber).pipe(Effect.catchAll(() => Effect.void));
yield* Fiber.join(sub2Fiber).pipe(Effect.catchAll(() => Effect.void));
yield* Fiber.join(sub3Fiber).pipe(Effect.catchAll(() => Effect.void));
// Print summary
const events1 = yield* Ref.get(subscriber1Events);
const events2 = yield* Ref.get(subscriber2Events);
const events3 = yield* Ref.get(subscriber3Events);
console.log(`\n[SUMMARY]`);
console.log(` Subscriber 1 received: ${events1.length} events`);
console.log(` Subscriber 2 received: ${events2.length} events`);
console.log(` Subscriber 3 received: ${events3.length} events`);
});
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.
- 1mo ago First seen · 178 lines · 1,269 tokens per session scan A ec86877c7925
concurrency-pattern-5-broadcast-events-with-pubsub is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (807 stars, last pushed 4mo ago), licensed MIT. It adds 1,269 tokens to every session, about $0.0051 per session on Opus 5.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-09-03.
Other cursor rules, from other repositories
django-python
Rules for writing Python services at PostHog (Python servers powered by the Django framework).
python--typescript-guide-cursorrules-prompt-file
Cursor rules for Python development with TypeScript guide integration.
standard-nestjs-module-hierarchy
Establish a consistent NestJS module structure in the API application where each resource is encapsulated in its own module with proper hierarchical organization to enhance maintainability, scalabilit... .
nestjs-best-practices
../../.claude/rules/nestjs-best-practices.md.
nestjs
This guide provides opinionated, actionable best practices for building robust, scalable, and maintainable NestJS applications using TypeScript, emphasizing modern patterns and common pitfalls.
nestjs
ContextOS rules for nestjs.