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-graceful-shutdown-for-your-application)<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/implement-graceful-shutdown-for-your-application"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/implement-graceful-shutdown-for-your-application.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.00702 | $0.00702 |
| Opus 5 | $0.00351 | $0.00351 |
| Sonnet 5 | $0.00140 | $0.00140 |
| Haiku 4.5 | $0.00070 | $0.00070 |
Grade A, and why
implement-graceful-shutdown-for-your-application 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 4d 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 — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Use Effect.runFork and OS signal listeners to implement graceful shutdown for long-running applications. globs: "**/*.ts" alwaysApply: true
Implement Graceful Shutdown for Your Application
Rule: Use Effect.runFork and OS signal listeners to implement graceful shutdown for long-running applications.
Example
This example creates a server with a "scoped" database connection. It uses runFork to start the server and sets up a SIGINT handler to interrupt the server fiber, which in turn guarantees the database finalizer is called.
import { Effect, Layer, Fiber, Context, Scope } from "effect";
import * as http from "http";
// 1. A service with a finalizer for cleanup
class Database extends Effect.Service<Database>()("Database", {
effect: Effect.gen(function* () {
yield* Effect.log("Acquiring DB connection");
return {
query: () => Effect.succeed("data"),
};
}),
}) {}
// 2. The main server logic
const server = Effect.gen(function* () {
const db = yield* Database;
// Create server with proper error handling
const httpServer = yield* Effect.sync(() => {
const server = http.createServer((_req, res) => {
Effect.runFork(
Effect.provide(
db.query().pipe(Effect.map((data) => res.end(data))),
Database.Default
)
);
});
return server;
});
// Add a finalizer to close the server
yield* Effect.addFinalizer(() =>
Effect.gen(function* () {
httpServer.close();
yield* Effect.log("Server closed");
})
);
// Start server with error handling
yield* Effect.async<void, Error>((resume) => {
httpServer.once("error", (err: Error) => {
resume(Effect.fail(new Error(`Failed to start server: ${err.message}`)));
});
httpServer.listen(3456, () => {
resume(Effect.succeed(void 0));
});
});
yield* Effect.log("Server started on port 3456. Press Ctrl+C to exit.");
// For testing purposes, we'll run for a short time instead of forever
yield* Effect.sleep("2 seconds");
yield* Effect.log("Shutting down gracefully...");
});
// 3. Provide the layer and launch with runFork
const app = Effect.provide(server.pipe(Effect.scoped), Database.Default);
// 4. Run the app and handle shutdown
Effect.runPromise(app).catch((error) => {
Effect.runSync(Effect.logError("Application error: " + error));
process.exit(1);
});
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.
- 4d ago First seen · 88 lines · 702 tokens per session scan A d5fb3a2a3d1e
implement-graceful-shutdown-for-your-application is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (796 stars, last pushed 2mo ago), licensed MIT. It adds 702 tokens to every session, about $0.0035 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-09-03.
Other cursor rules, from other repositories
fiber-logging-and-project-structure
Applies best practices for logging, project structure, and environment variable usage specifically to the main application file.
cloudflare-email-telegram-cursorrules-prompt-file
Cursor rules for setting up email-to-Telegram forwarding via Cloudflare Email Routing and Workers using the mail2tg CLI.
knative-istio-typesense-gpu-cursorrules-prompt-fil
Cursor rules for Knative development with Istio, Typesense, and GPU integration.
s3-presigned-urls-upload
S3 presigned URLs - upload flow, allowed types, security, key generation.
s3-presigned-urls-validation
S3 presigned URLs - post-upload validation, multipart upload for large files.
service-class-conventions
Defines the structure and implementation of service classes, enforcing the use of interfaces, ServiceImpl classes, DTOs for data transfer, and transactional management.