mnemopay-sdk: Cursor rule for Cursor

.cursorrules

cursorrules is a cursor rule for Cursor from mnemopay/mnemopay-sdk. It costs 1,024 tokens per session, scanned A, original, Apache-2.0.

A set of project rules for building a TypeScript and Node.js financial software library that works with AI agents. It emphasizes exact money calculations, preserving the public API, tests with Vitest, and successful TypeScript builds.

In plain words
What is it for?
Use it when editing the MnemoPay SDK, especially its scoring, fraud detection, commerce, behavioral-finance, integrity, and adaptive-system modules.
Why use it?
It gives the coding agent constraints for changing financial code safely, where rounding errors or broken exported functions can cause serious problems.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

This is mnemopay/mnemopay-sdk's own configuration. It tells Cursor how to work on mnemopay-sdk itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mnemopay-sdk configures →

Reuse

Borrowing it

Nothing to install: this file belongs to mnemopay/mnemopay-sdk. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/mnemopay/mnemopay-sdk/master/.cursorrules
Clone the repo
git clone --depth 1 https://github.com/mnemopay/mnemopay-sdk

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 cursorrules

README.md
[![agentmods](https://agentmods.dev/badge/rules/mnemopay/mnemopay-sdk/cursorrules/github.svg)](https://agentmods.dev/rules/mnemopay/mnemopay-sdk/cursorrules)
Your own site
<a href="https://agentmods.dev/rules/mnemopay/mnemopay-sdk/cursorrules"><img src="https://agentmods.dev/badge/rules/mnemopay/mnemopay-sdk/cursorrules/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 cursorrules

Your own site · 80×15
<a href="https://agentmods.dev/rules/mnemopay/mnemopay-sdk/cursorrules"><img src="https://agentmods.dev/badge/rules/mnemopay/mnemopay-sdk/cursorrules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,024 This file is loaded in full into every session.
When invoked 1,024 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.01024 $0.01024
Opus 5.5 $0.00410 $0.00410
Sonnet 5.5 $0.00205 $0.00205
Haiku 4.5 $0.00102 $0.00102

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

Security

Grade A, and why

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

.cursorrules · 77 lines

What it actually says

You are an expert in TypeScript, Node.js, MCP (Model Context Protocol), and AI agent financial infrastructure.

Core Rules

  • This is a financial SDK — correctness > cleverness. Never approximate money.
  • All amounts are numbers (not strings). Use penny-precise arithmetic where needed.
  • Never break the public API surface (exports from src/index.ts).
  • Tests run with vitest. Run npm test before any PR.
  • Build with npm run build (tsc). Fix type errors before committing.

Architecture

  • src/index.ts — Main SDK class (MnemoPay, MnemoPayLite, MnemoPayNetwork) + all type exports (~74KB)
  • src/fico.ts — Agent FICO credit scoring (300-850, 5 components)
  • src/behavioral.ts — Behavioral finance (prospect theory, hyperbolic discounting, cooling-off)
  • src/integrity.ts — Merkle tree memory integrity (SHA-256, tamper detection)
  • src/anomaly.ts — EWMA anomaly detection + BehaviorMonitor + CanarySystem
  • src/adaptive.ts — Adaptive engine (AIMD, anti-gaming, circuit breaker, PSI drift)
  • src/commerce.ts — CommerceEngine (autonomous shopping with mandates)
  • src/fraud.ts — Geo-enhanced fraud detection (country tracking, rapid-hop, currency mismatch)
  • src/fraud-ml.ts — ML fraud scoring
  • src/identity.ts — IdentityRegistry, AgentIdentity, CapabilityToken, KYA
  • src/ledger.ts — Double-entry ledger (always balances to zero)
  • src/network.ts — Multi-agent commerce network
  • src/client.ts — REST client for remote MnemoPay server
  • src/mcp/ — MCP server (24 tools, 2 prompts, SSE endpoint)
  • src/rails/ — Payment rails (Stripe, Paystack, Lightning, Mock)
  • src/recall/ — Recall engine (score, vector, hybrid strategies)
  • src/storage/ — Storage adapters (SQLite, in-memory)
  • src/middleware/ — OpenAI and Anthropic middleware
  • src/langgraph/ — LangGraph tool bindings
  • src/cli/ — CLI tools (setup, dashboard)

Two Modes

  • MnemoPay.quick("id") → zero infra, in-memory (dev/testing)
  • MnemoPay.create({...}) → full config (production)

Key Patterns

  • EventEmitter for lifecycle events (charge, settle, refund, fraud-alert, etc.)
  • All payment operations: charge → settle/refund (two-phase commit)
  • Agent FICO: payment history 35%, utilization 20%, age 15%, diversity 15%, fraud 15%
  • Fee tiers based on FICO: 1.0% (800+), 1.3% (740+), 1.5% (670+), 1.9% (580+), 2.5% (<580)
  • Merkle proofs for memory tamper detection
  • EWMA for streaming anomaly detection

Testing

  • 672+ tests across 12 test files in tests/
  • Use vitest: npm test (run all), npm run test:watch (dev mode)
  • Test files mirror src/ structure: tests/index.test.ts, tests/fico.test.ts, etc.
  • Always test edge cases: zero amounts, negative values, overflow, concurrent access

MCP Server

  • 24 tools: remember, recall, forget, reinforce, consolidate, charge, settle, refund, balance, profile, logs, history, reputation, dispute, fraud_stats, shop_set_mandate, shop_search, shop_buy, shop_confirm_delivery, shop_orders, agent_fico_score, behavioral_analysis, memory_integrity_check, anomaly_check
  • 2 prompts: recall-and-decide, agent-status-report
  • Auth: Bearer token via MNEMOPAY_API_KEY (constant-time comparison)
  • Rate limiting: 60 calls/min, 500 calls/hour
  • Entry: src/mcp/server.ts

Dependencies

  • Runtime: @modelcontextprotocol/sdk, express
  • Peer (optional): openai, @anthropic-ai/sdk, @langchain/*, zod, stripe, better-sqlite3
  • Dev: typescript, vitest, @langchain/core

Common Mistakes

  • Forgetting to call settle() after charge() — leaves transactions pending forever
  • Using string amounts instead of numbers
  • Not handling the HITL (human-in-the-loop) flag from FICO scoring
  • Ignoring fraud risk assessments on cross-border transactions
  • Breaking EventEmitter contracts (listeners expect specific event shapes)

Deployment

  • npm: @mnemopay/sdk
  • PyPI: mnemopay (Python SDK, separate codebase)
  • MCP: Smithery registry
  • Landing: site/index.html
  • Fly.io: mnemopay-mcp.fly.dev

Docs: https://github.com/mnemopay/mnemopay-sdk

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. 1mo ago First seen · 77 lines · 1,024 tokens per session scan A 7912e48a5891

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository mnemopay/mnemopay-sdk (8 stars, last pushed 2d ago), licensed Apache-2.0. It adds 1,024 tokens to every session, about $0.0041 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-08-31.