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/automatically-retry-failed-operationsgit clone --depth 1 https://github.com/PaulJPhilp/EffectPatternsWhat 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 | $0.00949 | $0.00949 |
| Opus 5 | $0.00475 | $0.00475 |
| Sonnet 5 | $0.00190 | $0.00190 |
| Haiku 4.5 | $0.00095 | $0.00095 |
Grade A, and why
automatically-retry-failed-operations 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 2d 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 — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Compose a Stream with the .retry(Schedule) operator to automatically recover from transient failures. globs: "**/*.ts" alwaysApply: true
Automatically Retry Failed Operations
Rule: Compose a Stream with the .retry(Schedule) operator to automatically recover from transient failures.
Example
This example simulates an API that fails the first two times it's called. The stream processes a list of IDs, and the retry operator ensures that the failing operation for id: 2 is automatically retried until it succeeds.
import { Effect, Stream, Schedule } from "effect";
// A mock function that simulates a flaky API call
const processItem = (id: number): Effect.Effect<string, Error> =>
Effect.gen(function* () {
yield* Effect.log(`Attempting to process item ${id}...`);
// Item 2 fails on first attempt but succeeds on retry
if (id === 2) {
const random = Math.random();
if (random < 0.5) {
// 50% chance of failure for demonstration
yield* Effect.log(`Item ${id} failed, will retry...`);
return yield* Effect.fail(new Error("API is temporarily down"));
}
}
yield* Effect.log(`✅ Successfully processed item ${id}`);
return `Processed item ${id}`;
});
const ids = [1, 2, 3];
// Define a retry policy: 3 attempts with a fixed 100ms delay
const retryPolicy = Schedule.recurs(3).pipe(
Schedule.addDelay(() => "100 millis")
);
const program = Effect.gen(function* () {
yield* Effect.log("=== Stream Retry on Failure Demo ===");
yield* Effect.log(
"Processing items with retry policy (3 attempts, 100ms delay)"
);
// Process each item individually with retry
const results = yield* Effect.forEach(
ids,
(id) =>
processItem(id).pipe(
Effect.retry(retryPolicy),
Effect.catchAll((error) =>
Effect.gen(function* () {
yield* Effect.log(
`❌ Item ${id} failed after all retries: ${error.message}`
);
return `Failed: item ${id}`;
})
)
),
{ concurrency: 1 }
);
yield* Effect.log("=== Results ===");
for (let index = 0; index < results.length; index++) {
yield* Effect.log(`Item ${ids[index]}: ${results[index]}`);
}
yield* Effect.log("✅ Stream processing completed");
});
Effect.runPromise(program).catch((error) => {
Effect.runSync(Effect.logError("Unexpected error: " + error));
});
/*
Output:
... level=INFO msg="Attempting to process item 1..."
... level=INFO msg="Attempting to process item 2..."
... level=INFO msg="Item 2 failed, attempt 1."
... level=INFO msg="Attempting to process item 2..."
... level=INFO msg="Item 2 failed, attempt 2."
... level=INFO msg="Attempting to process item 2..."
... level=INFO msg="Attempting to process item 3..."
*/
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.
- 2d ago First seen · 98 lines · 949 tokens per session scan A ef64b811a466
automatically-retry-failed-operations is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (795 stars, last pushed 2mo ago), licensed MIT. It adds 949 tokens to every session, about $0.0047 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.
typescript-coding-style
Enforces code style and best practices for TypeScript files.
react-and-typescript-general-rules
General rules for React and TypeScript projects, focusing on code clarity and best practices.
astro-development-guidelines
Enforces specific development guidelines for Astro projects, including TypeScript strictness and TailwindCSS usage.
javascript-typescript-code-style
Rules for JavaScript and TypeScript code style, including modern features, functional patterns, and descriptive naming conventions.
typescript-usage-rules
Specific rules for TypeScript usage, including interfaces, union types, and type guards to enhance type safety.