mneme-ai

module
v3.91.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MIT

README ยถ

The Trust & Cost Layer for AI Agents

ฮผฮฝฮฎฮผฮท ยท NEE-meh ยท Greek for "memory." A local-first boundary every AI agent crosses: it verifies before it acts, keeps your code & secrets from leaking to the model (with a signed, offline-auditable proof), remembers across sessions & vendors, and meters the tokens it saves you.
Vendor-neutral ยท MIT ยท air-gap-ready.



npm MCP tools GAUNTLET TRUTH GATE license MIT


New here? โ†’ 60-second start (one line for your case) ยท or run mneme quickstart. Don't read the 988-tool list.



๐Ÿ›ฐ The Matrix Rail โ€” one local-first, signed, streaming pipe every AI agent crosses, reachable three ways (MCP ยท gRPC ยท CLI) over a single core. The honest "Visa of AI context": authorize โ†’ screen โ†’ clear, with a tamper-evident receipt, your code never leaving the box. architecture โ†’


๐ŸŽ– The Agent Run Certificate โ€” proof a giant can't issue for itself

A portable, signed certificate of an agent's whole run (audit trail + every human approval) that anyone verifies offline, whose summary re-derives from the evidence โ€” so it can't lie about its own run. Vendor-neutral, local-first. mneme agentcert build. over HTTP, any vendor + underwrite a run โ†’ ย ยทย  govern an agent in 5 lines โ†’ ย ยทย  prove where it ran โ†’

๐Ÿ’— THYMOS โ€” the first AI memory with a heart you can audit

A signed, measurable affective core (salience ยท valence ยท bond) that decays like a mind, an attractor that ranks inbound by resonance โ€” and, uniquely, can prove it forgot (an offline attestation for GDPR Art. 17). Not sentience โ€” a heart you can measure. thymosGauntlet=100 ยท mneme thymos. the affective core + Proof-of-Forgetting โ†’ ย ยทย  see it live โ†’

๐Ÿ›ฐ APHELION โ€” the agent brain that goes farther than the cloud

The first governance that doesn't assume a cloud: an agent (Mars ยท severed link ยท air-gapped) governs itself against a local charter and hands back one signed capsule proving charter-compliance for the whole offline window (a violation can't be hidden) โ€” verified offline by any vendor, bundled into a user-owned Accountability Dossier. aphelionGauntlet=100 ยท mneme aphelion. the brain beyond the cloud + the Accountability Dossier โ†’

๐Ÿฉป Try it live

Paste any public repo and get a signed, reproducible health X-Ray in seconds โ€” no install. xray.mneme-ai.space ย ยทย  how it works + self-host โ†’

๐Ÿ“Ÿ Cosmic Pager

Your AI works while you sleep. You approve it from your phone.

Close the lid and walk away. Your AI agent keeps working โ€” and the instant it needs a yes / no / a typed answer, it pings your Telegram in real time. Tap โœ… / โ›” (or type a reply) from anywhere on earth, and the agent picks up your answer and keeps going โ€” for real. No more babysitting a terminal.

โš ๏ธ One hard requirement (all OS): the laptop must stay AWAKE with the lid closed โ€” NOT asleep. A truly sleeping CPU is halted, so the agent pauses until it wakes (physics, not a bug). autosetup sets lid-close โ†’ "do nothing" for you. Windows / Linux: works on battery. macOS: the firmware sleeps on lid-close on battery regardless โ€” keep it on AC power (or an external display) for clamshell stay-awake.

How it's different from a hosted "remote control": there is no server, no public IP, no cloud session to keep alive. The brain stays on your machine โ€” only a one-line summary + hash ever leaves it (never your code), and every approval is a signed, court-admissible transfer of authority.

Setup is two steps โ€” your AI does the rest:

  1. In Telegram, message @BotFather โ†’ /newbot โ†’ copy the token.
  2. Tell your AI: "set up phone approvals, here's my token: โ€ฆ" โ€” it runs mneme pager autosetup, which finds your chat-id, wires the hook, sets lid-stay-awake, and starts paging automatically. You never type a Mneme command.

Full 60-second bot guide + spec โ†’ docs/COSMIC-PAGER.md

Add LINE ยท Discord ยท WhatsApp ยท Slack โ€” send one code, no server, no config: (Telegram needs none of this โ€” it's already zero-server.)

  1. Point that bot's webhook to the Keryx relay โ€” one URL, once (in the app's developer console).
  2. Tell your AI "connect line" (or discord/whatsapp/slack) โ€” it runs mneme keryx connect <app> and shows you a code.
  3. Send that code to your bot from the app itself โ†’ it links this machine instantly. Approvals now reach you there too โ€” the first tap on any app wins, the rest fall quiet.

the relay URL + per-app webhook setup โ†’

๐ŸŒ Approve from anywhere โ€” your laptop lid can stay shut. You're on a train when your agent hits something that needs a human yes. One tap reaches you on Telegram, LINE, Slack, Discord, or WhatsApp โ€” all at once. The brain never leaves your machine; only a one-line summary + hash crosses, signed and replay-proof. Tap approve or reject on whichever app is already in your hand โ€” the first answer wins and the rest fall quiet, so you never decide twice. Just tell your AI which channels, in plain words (EN/Thai): "เธชเนˆเธ‡เน„เธ› line เธเธฑเธš whatsapp เธžเธญ" / "broadcast to all". A brand-new chat app joins the same web by simply declaring itself โ€” the core never changes. the architecture + per-provider setup โ†’

๐Ÿง  Busy? It won't hang โ€” and it won't recklessly proceed. The Deputy decides for you. If no tap lands within the window (default 60s, configurable), Mneme makes a signed, risk-calibrated decision from your own approval history instead of freezing or blanket-denying: read-only/low-impact โ†’ allow, a class you've already proven โ†’ allow, unproven โ†’ deny, and anything destructive/irreversible โ†’ kept safe (auto-deny) โ€” never auto-run unattended unless you explicitly opt in. The decision is broadcast to every surface and shown in your AI chat, so nothing is ever left silently waiting. mneme pager deputy --window 60 ยท graceful, safe autonomy when you're away.

๐Ÿ›ก Every tool-call your agent makes is gated, signed, and yours to prove. A risky command is judged by what it does โ€” not the words it uses โ€” then checked against your policy and the skill's signed provenance, so it runs, escalates to your phone, or is blocked. Every decision lands in a tamper-evident ledger anyone verifies offline (the arguments are hashed, never stored raw). Local-first, human-in-the-loop from anywhere โ€” a proof, not a trust-me database. how the gate works โ†’

๐Ÿงฉ Your agent's skills, measured โ€” not just listed. Install a skill/playbook and Mneme scans it for injection + secrets and content-pins it signed before your agent ever reads it (safe install). Then it does what a registry can't: it counts whether each skill actually helps โ€” was it in play when a real success followed? โ€” and ranks them by a Wilson lower-bound landing rate โ†’ PROVEN (trust it) ยท INEFFECTIVE (drop it) ยท UNPROVEN (too few uses to judge โ€” never branded bad). Keep the skills that are measured to make this agent better, here โ€” not the popular ones. Honest: a measured correlation with a confidence interval, not proof of causation. mneme skill rank ยท mneme skillscan <path>


One picture

You're already letting AI agents read your code, touch your machine, and call hosted models. Mneme is the local membrane every one of those actions crosses โ€” screened, gated, and signed โ€” so you can move at full speed and prove what happened, offline, without trusting the vendor.

flowchart LR
    AGENT["๐Ÿค– Any AI agent<br/>Grok ยท Claude ยท GPT ยท Gemini ยท Cursor ยท Cline"]:::agent

    subgraph MNEME["๐Ÿง  MNEME ยท the local membrane every action crosses"]
        direction TB
        IN["๐Ÿงฑ INBOUND<br/>Firewall โ€” neutralize prompt-injection"]:::gate
        OUT["๐Ÿ›ค OUTBOUND<br/>Rail โ€” blind secrets ยท policy-gate"]:::gate
        SH["๐Ÿบ SHELL<br/>Cerberus โ€” co-sign destructive cmds"]:::gate
        MEM["โ™พ MEMORY<br/>Cortex โ€” signed, cross-vendor recall"]:::gate
    end

    MODEL["โ˜๏ธ Hosted model"]:::ext
    MACHINE["๐Ÿ’ป Your code &amp; machine"]:::ext
    LEDGER["๐Ÿ“œ Offline-verifiable<br/>audit + value ledger"]:::ledger

    AGENT <--> MNEME
    MNEME <-->|screened| MODEL
    MNEME <-->|gated| MACHINE
    MNEME -->|signed receipt| LEDGER

    classDef agent fill:#0b1020,stroke:#00d4ff,color:#ffffff;
    classDef gate fill:#11182f,stroke:#c084fc,color:#e6e6f0;
    classDef ext fill:#0b1020,stroke:#2da44e,color:#ffffff;
    classDef ledger fill:#1a1206,stroke:#f0b429,color:#ffffff;

Measured ยท Signed ยท MIT. Every claim below maps to a runnable command and a deterministic test. When Mneme can't prove something, it says UNKNOWN instead of guessing โ€” that discipline is the product.


Pick your lens

๐Ÿ‘” Executive

CEO ยท CTO ยท owner ยท CISO

AI adoption stops being a leap of faith. Speed and safety stop being a trade-off โ€” guardrails are automatic, and every agent action is provable after the fact. Your AI spend becomes a measured, value-based line item, and key-person knowledge risk becomes a number you can assign heirs to.

โ†’ The boardroom case

๐Ÿ‘ฉโ€๐Ÿ’ป Developer

you don't change how you code

mneme rail ingress hands your agent a payload that's policy-cleared, injection-safe, and name-blinded. mneme rail egress refuses to let a leaked secret or a broken patch touch your tree. Same flow โ€” a safe rail underneath, and every saved byte metered.

โ†’ What it does, in 5 min

๐Ÿค– AI agent

you install & run it yourself

One sentence from the user and you self-install from a 775-line deterministic contract, then call mneme boot to learn when to use each tool. Everything is signed so you can verify it offline.

โ†’ Jump to the agent contract


Why an executive cares

Your CISO, CFO, and GC are all asking one question: "Can we prove what crossed the wire, that it was safe, and what it cost โ€” after the fact, offline, without trusting the vendor?" Mneme makes the answer yes, with a signed receipt โ€” on a local, vendor-neutral, MIT boundary, so adopting it doesn't pick a side in the model wars.

The question Mneme's answer
๐Ÿš€ "Can agents move at full speed without betting the company?" Guardrails are automatic + on by default โ€” co-sign on destructive ops, injection neutralized, secrets blinded, everything signed. Velocity goes up.
๐Ÿ“ˆ "What is AI actually costing โ€” and saving โ€” us?" mneme savings โ€” a measured, signed ledger. Pay for tokens you provably didn't spend, at your vendor's price. Never an invented number.
๐Ÿ”’ "Do our code & secrets ever leak to the model?" No โ€” egress guard + context blinding: the provider only ever sees structurally-valid but meaningless code; the reverse map never leaves your machine.
๐Ÿบ "Can our agent be tricked into rm -rf or curl evil|bash?" CERBERUS decomposes every command to the worst capability reachable and fails closed to a human co-sign. The RCE-bypass class is closed.
๐Ÿงฌ "What happens to our knowledge when a key person leaves?" mneme bequest โ€” capture a departing expert's knowledge as a signed Succession Capsule, verify a successor inherited it, and surface orphaned knowledge with no living heir.

Like Visa for a card transaction, Mneme doesn't conjure value โ€” it authorizes, screens for fraud, and clears the transfer with a signed record. Every figure is measured + signed; USD uses your vendor's price. The pillars, the reframes, and what is not claimed โ†’ docs/ENTERPRISE.md ยท the honest security ceiling โ†’ docs/SECURITY.md


One measured number

Mneme cuts what your agent sends to the model by doing deterministic local work first โ€” then meters the measured saving into a signed ledger (mneme savings). The headline, measured on real files in this repo:

๐Ÿ”ญ Orient on a file's full structure for โˆ’95.9% tokens (skeleton instead of a raw read); a realistic single-edit (skeleton + one byte-exact slice) is still โˆ’48%.

See the measured benchmark (5 real files ยท node scripts/outline-bench.mjs)

โ‰ˆchars/4 INPUT-token estimate, labelled โ€” char reduction is exact; multi-language TS/JS/Python/Go/Rust.

File Lines Raw read (~tok) Skeleton (~tok) Skeleton + 1 region (~tok)
cli/commands/demo.ts 901 13,688 296 (โˆ’97.8%) 5,807
core/squadron/acgv.ts 1,063 13,212 219 (โˆ’98.3%) 8,625
core/outline/index.ts 438 5,949 373 (โˆ’93.7%) 3,994
mcp/tools/_registry.ts 419 4,347 224 (โˆ’94.8%) 1,411
5-file total 41,473 1,704 (โˆ’95.9%) 21,573 (โˆ’48%)

The skeleton is honestly lossy (for orientation); the region fetch is byte-exact (for editing). It only helps when an agent chooses to outline instead of a raw read โ€” Mneme never hooks your agent's Read. The full business model โ†’ docs/BUSINESS-MODEL.md


Install in 60 seconds โ€” you never type a command

Say one sentence to any AI agent you already use:

"Install Mneme from https://github.com/patsa2561-art/mneme-ai per the AI agent contract."

The agent reads docs/AI_AGENT_CONTRACT.md and runs everything: env detect โ†’ npm install -g mneme-ai โ†’ mneme init โ†’ mneme mcp --install (auto-configures itself as your MCP client) โ†’ verify after restart โ†’ security auto-arms. You speak; the AI does the tooling. Need an update later? Say "update Mneme to the latest" โ€” and Mneme never upgrades itself behind your back.

โš ๏ธ One manual step: after mneme mcp --install, restart your AI tool once (quit & reopen) so it loads Mneme's MCP tools โ€” this is how MCP works in every client, not a Mneme quirk. The only prerequisite is Node.js + npm (needed for npm install -g).

Shell-native agents install it for you โ€” drop the sentence into any of these
๐Ÿš€ Grok CLI๐Ÿฆ‹ Claude Code๐ŸŸฆ Cursor๐ŸŸข Codex๐ŸŸฃ Continue
๐ŸŸก Clineโšก Zed๐Ÿค– Aider๐Ÿ’Ž Gemini CLI๐Ÿงฌ Windsurf

Browser-only AI (ChatGPT ยท Claude.ai ยท Gemini ยท Copilot ยท DeepSeek ยท Qwen ยท Grok web)? Say "set up Mneme browser polygraph for me" โ€” it lights up live truth-dots inline as the AI answers. Two browser clicks, no shell.

Prefer to type the commands yourself?
npm install -g mneme-ai
mneme init                  # one-time per repo
mneme mcp --install         # auto-detects Claude Code / Cursor / Codex / Continue / Cline / Gemini CLI / Grok CLI
# restart your AI tool; first MCP call: mneme.welcome
mneme polygraph autosetup   # browser truth-dots (optional)

What's inside

๐Ÿง  What it does โ€” 15 primitives, each a story (what it is, who it's for, why it exists), with discrete pinned tests + offline verification. โ†’ All 15 primitives

โœจ What sets it apart โ€” NEMESIS anti-identity-lie engine, ร—11 ARGUS multimodal search, the Context Rail, the Activation Cortex, HMAC-chained everything, self-honest marketing (every claim binds to a probe). โ†’ The full breakdown

๐Ÿ› The Agent Governor โ€” set a Charter once; your AI agents run inside it 24/7 as a continuous auto-operation batch; you approve only the genuinely-irreversible escalations. The signed governance kernel that sits under any orchestrator (Claude Code ยท Cursor ยท Astra ยท AutoGen). โ†’ How a CEO uses it (commands + agent wiring)

๐Ÿ” One command โ€” a Codebase Accountability Report.

โ†‘ a real report on a sample app (graded D โ€” it has an authz gap + an untested keystone the tool caught). Try it live + see all 10 checks โ†’ ยท /review ยท animated

npm i -g mneme-ai then mneme review maps your repo across layers and prints, in one shot: ๐ŸŽฏ risk hotspots (the keystone single-points-of-failure to guard first) ยท ๐Ÿ”’ authz gaps (an endpoint that writes a sensitive table with no auth on the path) ยท ๐Ÿงช untested keystones (the scariest, line-coverage-hidden surface). On a PR: mneme review --base origin/main. Then drill in โ€” each is its own command and MCP tool your agent calls automatically:

command what it answers โ€” the question nothing else answered
mneme graph reverse <table> โ›” safe to drop this? everything that breaks if you remove it (SAFE/RISKY/CRITICAL)
mneme collision --branches a,b ๐Ÿ’ฅ will these agents/branches collide? across different files โ€” the conflict git is blind to
mneme scope verify ๐Ÿค did the agent stay in the scope it declared? a signed, cross-vendor fidelity record
mneme commit-check ๐Ÿท is this commit mislabeled? ("fix typo" that rewrites a payment keystone)
mneme testgap ยท mneme risk ยท mneme authz ๐Ÿงช๐ŸŽฏ๐Ÿ”’ untested keystones ยท ranked risk ยท unguarded sensitive writes

Deterministic ยท no LLM ยท signed ยท works on JS/TS/Python/Go/Rust. The cross-layer accountability layer the autonomous-agent era needs โ€” and a vendor can't issue for its own agent. honest: each is a candidate to inspect, not a proof of a runtime bug.

๐Ÿ•ธ Cross-Layer Graph โ€” and you can see it. Mneme links ๐Ÿ’ผ business rules โ†” ๐ŸŒ API endpoints โ†” โš™ code โ†” ๐Ÿ—„ database tables into one graph (deterministic, no LLM โ€” every edge derives from a real file) so before a change you see what breaks across layers: edit a function โ†’ which tables it writes and which routes reach it. See it as a ๐Ÿ›ฐ Impact Radar โ€” a view no tool has shipped before: your change sits at the center, the four layers fan out as sectors, concentric rings are blast hop-distance, an animated sweep + pulse ripple outward, and clicking any node re-centers the radar โ€” all in one offline, self-contained, signed HTML file (mneme graph view <name>).

Open the live Impact Radar ย โ†‘ click the image or button โ€” opens the interactive radar (click nodes to re-center) for a real 4-layer sample app ยท runs entirely in your browser, nothing to install

โ–ถ Get the report on any public repo, no install โ€” open xray.mneme-ai.space/review, paste a repo URL, and a graded Codebase Accountability Report (risk hotspots ยท authz gaps ยท untested keystones) renders in seconds โ€” or /radar for the Impact Radar. Paste a GitHub/GitLab/Bitbucket URL and it renders right there (the source is cloned to a temp dir, scanned, and deleted โ€” nothing persists). Direct link form: โ€ฆ/api/radar?gitUrl=<repo>. Or render it inline in your chat as a Mermaid flowchart (mneme graph mermaid <name>), or a tiered diagram (mneme graph view <name> --style lanes). Businessโ†’code links are anchored only on a real annotation or strong name match โ€” otherwise the rule stays ORPHAN/UNKNOWN, never a guessed link. The cross-layer join a single-layer code-graph can't draw. honest: reachable coupling to inspect, not a proven runtime break.

๐Ÿš€ @mneme-ai/sdk โ€” embed Mneme in-process, 30-80ร— faster than the CLI subprocess.

import { createMneme } from "@mneme-ai/sdk";
const mneme = createMneme();
await mneme.verify`Mneme is a CLI tool`;

โ†’ SDK index ยท Quick start

๐Ÿ†• Flagship โ€” the Architectural Regression Firewall: the gate for AI-generated change. Mines the contracts your repo upholds, proves which a change VIOLATES, weights each by how long it has stood (breaking a 2-year contract = BLOCK; a 3-day one = normal evolution), and fails CI / denies the agent with the offending symbol + the contract's history. mneme arch-firewall --baseline main. โ†’ How the firewall works ยท Mneme as SaaS for the AI multiverse ยท CHANGELOG

๐Ÿ“œ Every release (v2.18 โ†’ latest), with its honest DIAKRISIS verdict. โ†’ CHANGELOG


๐Ÿค– For AI agents โ€” read this first

You can self-discover and run everything. The user will NEVER type a command โ€” you execute on their behalf. That is the contract's non-negotiable MANDATE.

Your first three calls on any fresh session:

  1. mneme boot โ€” the Activation Cortex. Returns a structured task โ†’ tool decision table (about to read a big file โ†’ mneme.outline; sending code to a model โ†’ mneme.rail; reading untrusted content โ†’ mneme.firewall; stating a fact โ†’ mneme verify; โ€ฆ) so you know when to use each tool instead of leaving them idle.
  2. Read the manifest โ€” after install, your CLAUDE.md / AGENTS.md / GEMINI.md carries an auto-injected ## Mneme command manifest block: every shipped primitive + exactly when to call it, the machine-readable source of truth. Re-read it every session โ€” new commands land there within minutes of an upgrade. (Verify you hold the latest, complete surface in O(delta) tokens with mneme stele.)
  3. mneme verify "<claim>" before relaying any factual claim with specific entities (a version, a commit hash, an API signature) โ€” and escalate high-stakes claims to mneme.conclave.run for cross-vendor consensus.

Why this works at 100%: the decision table is also advertised on connect via the standardized MCP instructions field (the sanctioned surface Claude Code reads), and mneme boot --emit-hook-config enables an opt-in SessionStart hook for hands-free activation. The rows are signals, not commands โ€” reliable activation comes from the manifest + the hook, not from shouting "you MUST."

Deep dive: docs/AI_AGENT_CONTRACT.md โ€” 775 lines: env detect โ†’ install โ†’ MCP auto-configure โ†’ verify โ†’ security auto-arm โ†’ upgrade โ†’ discovery โ†’ tool naming โ†’ user-intent dispatch table.


The 30-second pitch

Other AI tools are goldfish. They forget every session, hallucinate files that don't exist, repeat last year's buried bugs, burn tokens re-pasting context, and can't follow you to another AI.

Mneme bolts an elephant brain on top. It cites every commit by SHA, refuses to relay claims it can't verify, carries memory across sessions and vendors, and โ€” uniquely โ€” runs the same claim through multiple vendors with Anti-Eval-Awareness rewriting so you catch the model that behaves differently when it knows it's being tested.


๐Ÿ‘ค Author & Contact

Shinnapat Phunsriphatchalakul

Shinnapat Phunsriphatchalakul

AI Software Engineer ยท AI Context Engineer ยท Truth-Infrastructure Architect

Designer + sole maintainer of Mneme โ€” the local-first, vendor-neutral truth-infrastructure layer that bolts an elephant brain onto every AI agent. Built solo ยท MIT ยท 20,000+ pinned tests ยท dual-100 GAUNTLET + TRUTH GATE ยท world-first cross-vendor Byzantine consensus + Anti-Eval-Awareness Engine + HMAC-chained audit receipts.

The bottleneck of every frontier-AI deployment is TRUST. In production AI โ€” autonomous systems, medical, financial compliance, regulated industries โ€” a hallucinated commit hash or a benchmark-aware behavior shift isn't a chat-glitch; it's a deployment risk. Mneme refuses to relay unverified claims, detects when a model's stance shifts under eval-shaped vs natural prompts, and emits HMAC-chained receipts an operator can re-verify offline weeks later. Open to collaboration ยท consulting ยท full-time on truth-infrastructure for production AI.

๐Ÿ’ฌ Channels
Channel Handle
patsa2561@gmail.com
@patsa2561-art
@mneme_npm
pat195 (username shinnapat)
+66 93 945 5645
@devson2561

Open to: truth-infrastructure / AI-safety / cross-vendor consensus collaboration ยท safety-critical AI consulting ยท vendor partnerships (embed Mneme inside Cursor / Continue / Cline / Claude Code / Grok CLI) ยท EU AI Act Article 50 compliance ยท full-time where the bottleneck is trust, not capability.


๐Ÿ“ฆ npm ยท ๐Ÿ’ป GitHub ยท ๐Ÿ“˜ Functions (EN) ยท ๐Ÿ“— เธŸเธฑเธ‡เธเนŒเธŠเธฑเนˆเธ™ (เน„เธ—เธข) ยท ๐Ÿค– AI Agent Contract ยท ๐Ÿ› Enterprise ยท ๐Ÿ“œ CHANGELOG ยท ๐Ÿ“ƒ MIT


Mneme is the diamond in the dirt nobody saw the value of โ€” cut and polished, it becomes the most valuable diamond in the world. That's the vision.

Made with care for every AI agent that wants to remember + verify + reason together.

Directories ยถ

Path Synopsis
packages
matrix/examples command
Matrix Rail โ€” Go quickstart.
Matrix Rail โ€” Go quickstart.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL