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/implement-dead-letter-queues)<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/implement-dead-letter-queues"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/implement-dead-letter-queues/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/implement-dead-letter-queues"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/implement-dead-letter-queues.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.01548 | $0.01548 |
| Opus 5.5 | $0.00619 | $0.00619 |
| Sonnet 5.5 | $0.00310 | $0.00310 |
| Haiku 4.5 | $0.00155 | $0.00155 |
Grade A, and why
implement-dead-letter-queues 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 2mo 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 — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Capture failed items with context for debugging and retry instead of losing them. globs: "**/*.ts" alwaysApply: true
Implement Dead Letter Queues
Rule: Capture failed items with context for debugging and retry instead of losing them.
Example
import { Effect, Stream, Queue, Chunk, Ref, Data } from "effect"
// ============================================
// 1. Define DLQ types
// ============================================
interface DeadLetterItem<T> {
readonly item: T
readonly error: unknown
readonly timestamp: Date
readonly attempts: number
readonly context: Record<string, unknown>
}
interface ProcessingResult<T, R> {
readonly _tag: "Success" | "Failure"
}
class Success<T, R> implements ProcessingResult<T, R> {
readonly _tag = "Success"
constructor(
readonly item: T,
readonly result: R
) {}
}
class Failure<T> implements ProcessingResult<T, never> {
readonly _tag = "Failure"
constructor(
readonly item: T,
readonly error: unknown,
readonly attempts: number
) {}
}
// ============================================
// 2. Create a DLQ service
// ============================================
const makeDLQ = <T>() =>
Effect.gen(function* () {
const queue = yield* Queue.unbounded<DeadLetterItem<T>>()
const countRef = yield* Ref.make(0)
return {
send: (item: T, error: unknown, attempts: number, context: Record<string, unknown> = {}) =>
Effect.gen(function* () {
yield* Queue.offer(queue, {
item,
error,
timestamp: new Date(),
attempts,
context,
})
yield* Ref.update(countRef, (n) => n + 1)
yield* Effect.log(`DLQ: Added item (total: ${(yield* Ref.get(countRef))})`)
}),
getAll: () =>
Effect.gen(function* () {
const items: DeadLetterItem<T>[] = []
while (!(yield* Queue.isEmpty(queue))) {
const item = yield* Queue.poll(queue)
if (item._tag === "Some") {
items.push(item.value)
}
}
return items
}),
count: () => Ref.get(countRef),
queue,
}
})
// ============================================
// 3. Process with DLQ
// ============================================
interface Order {
id: string
amount: number
}
const processOrder = (order: Order): Effect.Effect<string, Error> =>
Effect.gen(function* () {
// Simulate random failures
if (order.amount < 0) {
return yield* Effect.fail(new Error("Invalid amount"))
}
if (order.id === "fail") {
return yield* Effect.fail(new Error("Processing failed"))
}
yield* Effect.sleep("10 millis")
return `Processed order ${order.id}: $${order.amount}`
})
const processWithRetryAndDLQ = (
orders: Stream.Stream<Order>,
maxRetries: number = 3
) =>
Effect.gen(function* () {
const dlq = yield* makeDLQ<Order>()
const results = yield* orders.pipe(
Stream.mapEffect((order) =>
Effect.gen(function* () {
let lastError: unknown
for (let attempt = 1; attempt <= maxRetries; attempt++) {
const result = yield* processOrder(order).pipe(
Effect.map((r) => new Success(order, r)),
Effect.catchAll((error) =>
Effect.gen(function* () {
yield* Effect.log(`Attempt ${attempt}/${maxRetries} failed for ${order.id}`)
lastError = error
if (attempt < maxRetries) {
yield* Effect.sleep("100 millis") // Backoff
}
return new Failure(order, error, attempt) as ProcessingResult<Order, string>
})
)
)
if (result._tag === "Success") {
return result
}
}
// All retries exhausted - send to DLQ
yield* dlq.send(order, lastError, maxRetries, { orderId: order.id })
return new Failure(order, lastError, maxRetries)
})
),
Stream.runCollect
)
const successful = Chunk.filter(results, (r): r is Success<Order, string> => r._tag === "Success")
const failed = Chunk.filter(results, (r): r is Failure<Order> => r._tag === "Failure")
yield* Effect.log(`\nResults: ${Chunk.size(successful)} success, ${Chunk.size(failed)} failed`)
// Get DLQ contents
const dlqItems = yield* dlq.getAll()
if (dlqItems.length > 0) {
yield* Effect.log("\n=== Dead Letter Queue Contents ===")
for (const item of dlqItems) {
yield* Effect.log(
`- Order ${item.item.id}: ${item.error} (attempts: ${item.attempts})`
)
}
}
return { successful, failed, dlqItems }
})
// ============================================
// 4. DLQ reprocessing
// ============================================
const reprocessDLQ = <T>(
dlqItems: DeadLetterItem<T>[],
processor: (item: T) => Effect.Effect<void, Error>
) =>
Effect.gen(function* () {
yield* Effect.log(`Reprocessing ${dlqItems.length} DLQ items...`)
for (const dlqItem of dlqItems) {
const result = yield* processor(dlqItem.item).pipe(
Effect.map(() => "success" as const),
Effect.catchAll(() => Effect.succeed("failed" as const))
)
yield* Effect.log(
`Reprocess ${JSON.stringify(dlqItem.item)}: ${result}`
)
}
})
// ============================================
// 5. Run example
// ============================================
const program = Effect.gen(function* () {
const orders: Order[] = [
{ id: "1", amount: 100 },
{ id: "2", amount: 200 },
{ id: "fail", amount: 50 }, // Will fail all retries
{ id: "3", amount: 300 },
{ id: "4", amount: -10 }, // Invalid amount
{ id: "5", amount: 150 },
]
yield* Effect.log("=== Processing Orders ===\n")
const { dlqItems } = yield* processWithRetryAndDLQ(Stream.fromIterable(orders), 3)
if (dlqItems.length > 0) {
yield* Effect.log("\n=== Attempting DLQ Reprocessing ===")
yield* reprocessDLQ(dlqItems, (order) =>
Effect.gen(function* () {
yield* Effect.log(`Manual fix for order ${order.id}`)
})
)
}
})
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.
- 2mo ago First seen · 228 lines · 1,548 tokens per session scan A 5daee5ac21ef
implement-dead-letter-queues is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (807 stars, last pushed 5mo ago), licensed MIT. It adds 1,548 tokens to every session, about $0.0062 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.
implement-dead-letter-queues compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| implement-dead-letter-queuesPaulJPhilp/EffectPatterns | Cursor rule | 807 | 5mo ago | MIT | A | 1,548 | Cursor |
| workflowWebDevPeterGriffin/The-VibeCode-Bible | Cursor rule | 42 | 26d ago | none | A | 0 | Cursor |
| activitiesWebDevPeterGriffin/The-VibeCode-Bible | Cursor rule | 42 | 26d ago | none | A | 0 | Cursor |
| go-api-development-general-rulesWebDevPeterGriffin/The-VibeCode-Bible | Cursor rule | 42 | 26d ago | none | A | 0 | Cursor |
| backend-general-expertWebDevPeterGriffin/The-VibeCode-Bible | Cursor rule | 42 | 26d ago | none | A | 349 | Cursor |
| service-class-conventionsWebDevPeterGriffin/The-VibeCode-Bible | Cursor rule | 42 | 26d ago | none | A | 172 | Cursor |
| repository-class-conventionsWebDevPeterGriffin/The-VibeCode-Bible | Cursor rule | 42 | 26d ago | none | A | 149 | Cursor |