
Sdk
io.github.mnemopayPublished by GitHub account mnemopayv1.4.1Updated Oct 24, 2026
Memory + wallet for AI agents. Real payment rails, Agent FICO 300-850, Merkle audit, identity.
Overview
MnemoPay's local MCP server gives an AI assistant persistent memory plus a governed payment and audit layer for agent actions.
- What you can do
- Store and recall agent memories, with Merkle-tree integrity checks against tampering
- Charge, hold, settle and refund payments through rails such as Stripe, Paystack and Lightning, with budget enforcement
- Apply charters, policy checks and human-in-the-loop approvals before consequential actions
- Record actions in a hash-chained audit ledger and produce EU AI Act Article 12 audit bundles
- Score agent reputation on a 300-850 scale and run anomaly detection
- Run multi-agent swarms with per-agent budgets and shared audit chains
- When to use it
- Worth adding when an assistant must remember context across sessions and take consequential actions such as moving money or changing infrastructure, and you want budgets, approvals and tamper-evident audit evidence around those actions.
- Requirements
- Runs locally over stdio via npx from the npm package @mnemopay/sdk. Needs a MnemoPay API key in MNEMOPAY_API_KEY and a directory for the local ledger and memory store, set by MNEMOPAY_PERSIST_DIR (default ~/.mnemopay). Payment rails additionally need their own provider credentials, such as Stripe or Paystack keys.
Installation
In SourceWeft
- Open Sdk in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
MnemoPay
[npm version] [PyPI version] [smithery badge] [License]
The governance layer for AI agents that take consequential actions. Charter-driven mission scope, policy enforcement with human-in-the-loop approvals, FiscalGate budget enforcement, EU AI Act Article 12 audit bundles, Agent Reputation Scoring (300-850), and a tamper-evident MerkleAudit chain — whether the action moves money or changes infrastructure.
MnemoPay sits above the rail (Stripe, Paystack, Lightning, Stripe MPP, x402, Google AP2) and below the agent runtime (LangChain, CrewAI, Claude Agent SDK, your own loop). The rail moves money. The runtime decides. MnemoPay declares the rules, enforces the budget, and produces the evidence.
Payments are one kind of consequential action. The same charter, policy, approval and audit path governs operational tooling too — the primitives do not care whether the step settles a payment or drains a node.
New here? Start at
docs/QUICKSTART.md— 60 seconds, three steps, working code.Docs: Quickstart · Architecture · Permissions · Action ledger · Integrations (OpenAI/Anthropic/Gemini/Cohere/Mistral/LangGraph) · Recall · FiscalGate · Audit bundles (EU AI Act Art. 12) · Subpath import rule · Claude Agent SDK guide · Bundlers: Vite · Webpack · Bun
Community: LICENSE (Apache 2.0) · CHANGELOG · CONTRIBUTING · CODE_OF_CONDUCT · SECURITY · Discussions · Good first issues
Receipts: Trust hub (entity, KYB, Apple Team ID, Article 12 audit chain — verify in <5 min) · Benchmarks (1M ops, 100% adversarial detection, $0 ledger drift) · Python SDK on PyPI (Mock/Stripe/Paystack/Lightning rails, scoring and
AuditChain; Charter, FiscalGate and Article 12 are TypeScript-only so far)
Native Node ESM (
.mjsor"type": "module"): the package is CommonJS, so a default import yields the whole module object. Use the named export instead:import { MnemoPay, Charter } from "@mnemopay/sdk", thenMnemoPay.quick(...). The default-import form above works in TypeScript and bundlers.
14 modules. Hash-chained ledger. Charter / FiscalGate / Article 12 audit bundles. 6 payment rails. 200K-operation stress tested. Apache 2.0.
What MnemoPay is NOT: not a bank, not a money transmitter, not a Stripe replacement, not an agent framework, not a compliance platform. It's the rules-and-evidence layer between the rail and the runtime.
Governance latency (sub-second invariant)
"Sub-second governance" is a tested invariant, not marketing. The bench in tests/bench/governance-latency.bench.ts measures each governance hot path with vitest bench and emits a grep-able [gov-bench] summary line per scenario. Numbers below are steady-state percentiles from npm run bench:governance (run on the dev machine — your hardware will differ; the relative ordering is what matters).
Both per-event hot paths (evaluateAction, MerkleAudit.record) clear an entire EU AI Act policy gate and audit-chain write two orders of magnitude inside one millisecond. The end-to-end remember() path — including Ed25519 sign + sequence + chain emit — still sits comfortably inside the "sub-second governance" envelope with three decimal-orders of headroom.
A CI-enforced guard spec in tests/governance/latency-invariant.test.ts runs a degraded-mode sample on every npm test and fails if p95 for policy.evaluateAction regresses past 1 ms, or MerkleAudit.record past 5 ms. Bounds are sized to catch a ~10x regression, not flap on jitter.
How to reproduce: npm run bench:governance (full vitest.bench harness) or npm test -- latency-invariant (CI-bound check).
Native rails
Every rail ships with the same PaymentRail interface as StripeRail / PaystackRail / LightningRail:
Plus the Spatial governance fold — attachSpatialEvidence() co-signs the MerkleAudit chain with GridStamp proof-of-presence for embodied agents (drones, robots). Loose-coupled — no gridstamp runtime dependency.
Subpath imports for smaller, safer consumers
If you only need one MnemoPay module, import that subpath instead of the package root. This keeps MCP servers and other stdio tools quiet, avoids pulling unused middleware into bundles, and makes the dependency boundary obvious.
Use the root import when you want the full SDK surface. Use @mnemopay/sdk/mcp only when you are intentionally mounting the MnemoPay MCP server.
Swarm (stable — v1.11+)
@mnemopay/sdk/swarm is the missing piece that browse.sh shipped as a public skill catalog. Ours adds the bit they don't: every agent in the swarm carries a DID, every action is FiscalGate-prechecked against per-agent + total caps, every TaskResult is appended to a shared Article-12 audit chain, and every skill invocation is billable through the same hash-chained ledger the rest of the SDK already uses.
CLI: npx @mnemopay/swarm list · npx @mnemopay/swarm demo — see mnemopay-swarm.
When to use it. Any time you'd open N parallel browser sessions to attack a problem — multi-source research, cross-platform issue triage, A/B-style "ask three agents, take the majority answer" — but you want one audit bundle, one budget envelope, and one place where billing happens.
Three recombine strategies (plus your own).
first-success— returns the output of the firstok:truetask; perfect for race patterns where any answer is fine.majority-vote— returns the most-common output acrossok:truetasks; perfect for fact-extraction where consensus matters.merge-json— deep-merges everyok:trueobject output with sorted keys (deterministic across runs).concat— joins string outputs with\nin spawn order.- Or pass any
(results) => unknowncallback.
Skill catalog. Public listings live at mcp.mnemopay.com/skills. The catalog is intentionally small and honestly marked — verified-partner badges only show after a real partnership is signed. Everything else carries verified: false, status: 'pending-partner' so you know exactly what trust tier you're getting.
BrowserSwarm — native browser-session fan-out (stable since 1.11.0)
@mnemopay/sdk/swarm/browser extends Swarm with a typed step sequence (goto / act / extract / screenshot / wait) per task and a lazy wire to @mnemopay/browser (optional peer dep — installing the SDK does NOT pull Playwright). Each task gets its own browser session, every step appends a browser.step event to the shared audit chain, and a thrown step kills only that one task — sibling sessions keep running.
File issues at github.com/mnemopay/mnemopay-sdk.
Audit-only middleware — .audit(client) with streaming + on-disk chain (1.11.0-alpha.0)
For chat widgets and regulated pipelines where ANY prompt mutation is a violation but Article-12 telemetry is still required:
@mnemopay/sdk/middleware/openai-audit exposes the equivalent shape for OpenAI — chat.completions.create({ stream: true }) is intercepted automatically (pass stream_options: { include_usage: true } to capture the final usage block).
Building an MCP server? Start here.
If you're shipping an MCP server and want to charge per-call — even sub-cent amounts — MnemoPay is built for you.
- Sub-cent payments via Lightning rail (impossible on Stripe/Paystack due to fees)
- Per-tool metering with
agent.charge(amount, toolName)— two lines of code - Agent Reputation Scoring gates abusive callers automatically — 300-850 reputation score, free tier + paid tier
- Cryptographic receipts every user can audit — no "trust me bro" billing
- Free indefinitely for the first 10 MCP servers that adopt it, subject to 90 days' written notice of any future change (email with your repo)
Zero-config starter → production Lightning rail → Agent Reputation Scoring gating. Same API.
What Makes MnemoPay Different
$87M has been invested across 5 competitors. None have more than 3 of these 10 features:
Agent Reputation Scoring
A novel cross-session reputation scoring system for AI agents. Five-component scoring on a 300-850 range (familiar to developers from consumer credit; MnemoPay is not affiliated with Fair Isaac Corporation or any consumer credit bureau):
Behavioral Finance Engine
Peer-reviewed behavioral economics from Nobel laureate Daniel Kahneman and collaborators. Every parameter cited to published research.
Research sources: Tversky & Kahneman 1992, Laibson 1997, Thaler & Benartzi 2004, Barber & Odean 2000, Nunes & Dreze 2006, Shiller 2000.
Memory Integrity (Merkle Tree)
Tamper-evident memory. If anyone injects, modifies, or deletes an agent's memories, the Merkle root changes and you know.
Defends against: MemoryGraft injection, silent deletion, content tampering, replay attacks, reordering attacks.
Anomaly Detection (EWMA + Behavioral Fingerprinting + Canaries)
Three independent systems that catch compromised agents.
Math: mu_t = alpha * x_t + (1 - alpha) * mu_{t-1}, alert when |x_t - mu_t| > k * sigma_t (Roberts 1959, Lucas & Saccucci 1990).
Memory (Compounding Knowledge Base)
Not a traditional RAG lookup. MnemoPay memories compound — every transaction strengthens associated context, weak memories decay, strong ones consolidate. The same pattern Karpathy describes as "LLM Wiki" but applied to payments and trust.
- Ebbinghaus forgetting curve — memories decay naturally over time
- Hebbian reinforcement — successful transactions strengthen associated memories
- RL feedback loop —
rlFeedback(ids, reward)applies EWMA importance updates after agent actions - Consolidation — auto-prunes weak memories, keeps what matters
- Semantic recall — find memories by relevance, not just recency
- 100KB per memory — store rich context, not just strings
Choosing a persistence adapter
Recall is backed by a pluggable PersistenceAdapter. Pick by deployment shape:
PostgresAdapter and NeonAdapter are the same pgvector-backed implementation
— "Neon" is just hosted Postgres; use whichever name fits your infra.
The schema (a vector(384) column + HNSW cosine index) is auto-created on the
first write. To manage it with your own migration tool instead, run the DDL
from postgresMigrationSql(table?, dimensions?) and pass skipBootstrap: true.
Requires the optional peer dep: npm install pg.
Reputation Streaks & Badges
Agents earn trust over time. Consecutive successful settlements build streaks that unlock badges and reduce fees.
Streaks reset on refunds or disputes. Streak bonuses compound reputation up to +10%.
Hash-Chained Ledger
Every ledger entry links to the previous via SHA-256 hash chain. If any entry is modified, the chain breaks and verify() catches it instantly.
Combined with Merkle integrity on memories and HMAC on transactions, MnemoPay gives you three independent tamper-detection systems.
Payments (cent-precise double-entry)
- Double-entry bookkeeping — every debit has a credit, always balances to zero
- Escrow flow — charge -> hold -> settle -> refund (same shape as Stripe/Square)
- Volume-tiered fees — 1.9% / 1.5% / 1.0% based on cumulative volume
- 3 payment rails — Paystack (Africa), Stripe (global), Lightning (BTC)
- Cent-precise integer math — stress-tested with 200,000 transactions across 50 concurrent agents, zero drift
Identity (KYA Compliance)
- Cryptographic identity — HMAC-SHA256 keypairs, replay protection
- Capability tokens — scoped permissions with spend limits
- Counterparty whitelists — restrict who the agent can transact with
- Kill switch — revoke all tokens instantly
Fraud Detection (ML-grade)
- Velocity checks — per-minute/hour/day limits
- Isolation Forest — unsupervised ML anomaly detection
- Geo-enhanced — country tracking, rapid-hop detection, OFAC sanctions
- Adaptive engine — asymmetric AIMD, anti-gaming, circuit breaker, PSI drift detection
Multi-Agent Commerce
- CommerceEngine — autonomous shopping with mandates, escrow, approval callbacks
- MnemoPayNetwork — register agents, execute deals, shared memory context
- Supply chains — 10-step agent chains, 100-agent marketplaces, all tested
Claude Agent SDK integration
Two primitives built specifically for the Claude Agent SDK pattern where an Opus orchestrator spawns Sonnet/Haiku subagents.
1-hour prompt cache on recall results
When you feed MnemoPay recall into a Claude system prompt, use formatForClaudeCache() to emit a content block with cache_control: { type: "ephemeral", ttl: 3600 }. The Anthropic API caches that prefix for up to 1 hour; cache reads are billed at roughly 10% of the normal input rate. With stable recall prefixes and a warm 1h cache, users have observed savings in the typical range of 85-92% on the recall portion of input tokens — your actual results depend on call frequency and memory set stability.
The serialized text is sorted by memory id so identical memory sets produce byte-identical output — required for the cache prefix to hit on subsequent turns.
Per-subagent cost attribution
Track which subagent in a multi-agent pipeline spent how much — recorded as double-entry ledger pairs so it stays audit-clean.
Pricing table used: 2026 Anthropic list rates (Opus 4.7 $5/$25/M, Sonnet 4.6 $3/$15/M, Haiku 4.5 $1/$5/M; cache reads 0.1×, 1h writes 2×). Update MODEL_PRICING in src/subagent-cost.ts if rates change.
See docs/agent-sdk-guide.md for a full integration walkthrough.
Payment Rails
Every rail implements the same PaymentRail interface — createHold / capturePayment / reversePayment. Swap rails without touching agent code.
Stripe — real card charges with saved customers
End-to-end flow for charging a user's saved card without a browser handoff:
Paystack supports the same pattern via authorizationCode:
MCP Server
Default tool group: essentials (14 tools, ~1K tokens). One of the
lightest MCP servers you can install — MnemoPay only loads memory + wallet +
tx by default so it doesn't tax your agent's context budget.
memory:remember,recall,forget,reinforce,consolidatewallet:balance,profile,history,logstx:charge,settle,refund,dispute,receipt_get
Need more? Opt in explicitly:
Groups: memory, wallet, tx, commerce, hitl, payments, webhooks,
reputation, security, governance, identity, skills, spatial,
agent_os, organization_admin, operator. Aliases: essentials (default),
agent, all. Also settable via MNEMOPAY_TOOLS env var.
Breaking change in v1.3.0: default was
all, nowessentials. If you relied on commerce/hitl/webhooks/fico/security being available without a flag, pass--tools=allor--tools=agent. See CHANGELOG.
Middleware
Drop-in proxies that make recall invisible: every chat call auto-injects the
top memories as system context and stores the exchange afterward. Same
Middleware.wrap(client, agent) shape across every provider.
Architecture
Full stack diagram and module map: docs/architecture.md.
Module stability
MnemoPay follows semver. Stability tiers tell you how much a module's public API may shift before 2.0 — see VERSIONING.md for the full contract.
Testing
core.test.ts— memory, payments, lifecycle, reputation scoring, behavioral, Merkle, EWMA, canaries, streaks, badgesfraud.test.ts— velocity, anomaly, fees, disputes, replay detectiongeo-fraud.test.ts— geo signals, trust, sanctionsidentity.test.ts— KYA, tokens, permissionsproduction-100k.test.ts— 100K operations, 10 concurrent agents, hash-chain verification, zero driftstress-200k.test.ts— 200K real-world stress: 50 agents, burst traffic, race conditions, refund storms, memory leak detectionledger.test.ts— double-entry, reconciliationnetwork.test.ts— multi-agent, deals, supply chainspaystack.test.ts— rail, webhooks, transfersstress.test.ts— 1000-cycle precision, parallel opsrecall.test.ts— semantic search, decay, reinforcement
License
Apache License 2.0 — see LICENSE.
Copyright 2026 J&B Enterprise LLC.
Third-party attributions
The entity-observation write-path in src/recall/observations.ts (per-entity consolidated summaries, debounced regeneration, session-spanning rollups) is derived from vectorize-io/hindsight (MIT, Copyright (c) 2025 Vectorize AI, Inc.). The full upstream notice is preserved in NOTICE and in the header of the ported file.
Trademark and regulatory notices
Agent Reputation Scoring is a trustworthiness scoring system for autonomous software agents, not for consumer credit reporting. It does not produce a consumer report as defined by the Fair Credit Reporting Act (FCRA) and is not regulated under the FCRA. MnemoPay is not a consumer reporting agency.
MnemoPay is not a bank, money transmitter, or insurer, and does not hold customer deposits. Payments are settled through third-party payment rails (Stripe, Paystack, Lightning Network) — MnemoPay is software that connects to those rails on behalf of developers, not a financial institution.
"FICO" is a registered trademark of Fair Isaac Corporation. MnemoPay and its Agent Reputation Scoring module are not affiliated with, endorsed by, or derived from Fair Isaac Corporation. The AgentCreditScore and AgentFICO export names are deprecated aliases kept for backward compatibility with earlier beta releases and will be removed in a future major version.
Built by Jeremiah Omiagbo
Source: README.md at commit c91dc52
Tools
0Version history
1- v1.4.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts