instrument-and-observe-function-calls-with-effectfn

instrument-and-observe-function-calls-with-effectfn is a cursor rule for Cursor from PaulJPhilp/EffectPatterns. It costs 374 tokens per session, scanned A, original, MIT.

A TypeScript rule for wrapping function calls with Effect-based logging, metrics, or tracing so they can be observed within a workflow.

In plain words
What is it for?
Use it to observe selected functions, record their calls or results, and attach tracing spans or other monitoring data.
Why use it?
It makes function activity visible while keeping the instrumentation composable with the rest of the Effect program.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to observe selected functions, record their calls or results, and attach tracing spans or other monitoring data.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn
Install

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.

Clone the repo
git clone --depth 1 https://github.com/PaulJPhilp/EffectPatterns

Made for: Cursor.

Wrote 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.

agentmods badge for instrument-and-observe-function-calls-with-effectfn

README.md
[![agentmods](https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn/github.svg)](https://agentmods.dev/rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn)
Your own site
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn/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.

agentmods 80×15 button for instrument-and-observe-function-calls-with-effectfn

Your own site · 80×15
<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/instrument-and-observe-function-calls-with-effectfn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 374 This file is loaded in full into every session.
When invoked 374 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00374 $0.00374
Opus 5.5 $0.00150 $0.00150
Sonnet 5.5 $0.00075 $0.00075
Haiku 4.5 $0.00037 $0.00037

Measured 2mo ago against content hash e94f8d084d76, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

instrument-and-observe-function-calls-with-effectfn 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.

content/published/rules/cursor/instrument-and-observe-function-calls-with-effectfn.mdc · 44 lines

What it actually says

description: Use Effect.fn to wrap functions with effectful instrumentation, such as logging, metrics, or tracing, in a composable and type-safe way. globs: "**/*.ts" alwaysApply: true

Instrument and Observe Function Calls with Effect.fn

Rule: Use Effect.fn to wrap functions with effectful instrumentation, such as logging, metrics, or tracing, in a composable and type-safe way.

Example

import { Effect } from "effect";

// A simple function to instrument
function add(a: number, b: number): number {
  return a + b;
}

// Use Effect.fn to instrument the function with observability
const addWithLogging = Effect.fn("add")(add).pipe(
  Effect.withSpan("add", { attributes: { "fn.name": "add" } })
);

// Use the instrumented function in an Effect workflow
const program = Effect.gen(function* () {
  yield* Effect.logInfo("Calling add function");
  const sum = yield* addWithLogging(2, 3);
  yield* Effect.logInfo(`Sum is ${sum}`);
  return sum;
});

// Run the program
Effect.runPromise(program);

Explanation:

  • Effect.fn("name")(fn) wraps a function with instrumentation capabilities, enabling observability.
  • You can add tracing spans, logging, metrics, and other observability logic to function boundaries.
  • Keeps instrumentation separate from business logic and fully composable.
  • The wrapped function integrates seamlessly with Effect's observability and tracing infrastructure.

Explanation:
Instrumenting function calls is essential for observability, especially in complex or critical code paths.
Effect.fn lets you add effectful logic (logging, metrics, tracing, etc.) before, after, or around any function call, without changing the function’s core logic.

Changes

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.

  1. 2mo ago First seen · 44 lines · 374 tokens per session scan A e94f8d084d76

Subscribe to this mod's changes

instrument-and-observe-function-calls-with-effectfn is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (807 stars, last pushed 5mo ago), licensed MIT. It adds 374 tokens to every session, about $0.0015 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.

Related

instrument-and-observe-function-calls-with-effectfn compared with cursor rules from other repositories

instrument-and-observe-function-calls-with-effectfn next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
instrument-and-observe-function-calls-with-effectfnPaulJPhilp/EffectPatternsCursor rule8075mo agoMITA374Cursor
fastapi-components-and-validationWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA64Cursor
accessibilityWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA0Cursor
verify-information-ruleWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA46Cursor
new-user-experience-nux-flow-ruleWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA0Cursor
globalexceptionhandler-classWebDevPeterGriffin/The-VibeCode-BibleCursor rule4226d agononeA27Cursor
ponytailDietrichGebert/ponytailCursor rule201k8d agoMITA604Cursor