Skip to main content

Mnemom Gateway

The Mnemom Gateway is a transparent AI gateway that sits between your application and any LLM provider. It provides the full Mnemom trust stack out of the box: Your prompts and responses pass through unchanged. Your API keys never leave your machine.
1

Install the CLI

npm install -g @mnemom/mnemom
2

Authenticate

Log in to your Mnemom account:
mnemom login
This opens a browser-based login flow and stores your auth token in ~/.mnemom/auth.json.
Your provider API keys are not sent to Mnemom. Only SHA-256 hashes are used to identify your agent. The hash cannot be reversed to recover your key.
3

Make an API call

Use the gateway URL instead of the provider’s direct URL. Include the x-mnemom-agent header to name your agent — it will be auto-created on first call in the Mnemom Sandbox with no owner. Before the read commands (mnemom status, logs, integrity, card show) can resolve it, you must claim the agent to your account (next step). Use -i to print response headers so you can capture the X-Mnemom-Agent id you’ll need for the claim.
# Instead of https://api.anthropic.com/v1/messages
curl -i https://gateway.mnemom.ai/anthropic/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "x-mnemom-agent: my-agent" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
The gateway supports all three providers at their standard paths:
ProviderGateway PathDirect Equivalent
Anthropicgateway.mnemom.ai/anthropic/*api.anthropic.com/*
OpenAIgateway.mnemom.ai/openai/*api.openai.com/*
Geminigateway.mnemom.ai/gemini/*generativelanguage.googleapis.com/*
Most SDKs and frameworks let you override the base URL. Set it to the gateway path for your provider and everything else works unchanged.
4

What you'll want to read on the way back

The gateway adds response headers that carry the Safe House verdict, support-correlation metadata, and advisory entries. A compliant integration should parse and observe these — at minimum surface them when something goes wrong.
HeaderWhen emittedWhat to do with it
X-Mnemom-Request-IdAlwaysUUIDv4 per request. Always log this. Paste into a support ticket and we can pull every log line for the request.
X-Mnemom-VerdictAlways (gateway)Structured front=…; autonomy=…; integrity=…; back=… with each value in {pass | observed | nudged | enforced}. Parse it; the four-checkpoint state tells you what Safe House observed (front+back), what CLPI did on tool calls (autonomy), and what AIP did on reasoning (integrity).
X-Mnemom-AdvisoryWhen the gateway has advisoriesCompact JSON [{source, text, severity?, id?}, …]. Surface entries to your operator UI / logs. Omitted entirely when empty.
X-Mnemom-AgentWhen the request is bound to a named agentThe agent identifier the gateway resolved your request to (e.g., mnm-a1b2c3d4…). Useful for cross-referencing dashboard rows.
X-Mnemom-SessionOn multi-turn sessionsStable session correlation token. Echo it back on the next turn to maintain session continuity.
Retry-AfterOn 429 and some 503Seconds to wait before retrying. Honor it.
Quick parse:
const v = response.headers.get('X-Mnemom-Verdict')!;
const checkpoints = Object.fromEntries(v.split(';').map(s => s.trim().split('=')));
// checkpoints.front, checkpoints.autonomy, checkpoints.integrity, checkpoints.back

if (checkpoints.integrity === 'enforced') {
  // Same-turn AIP replacement happened — surface that in your UI.
}
See the Headers reference for the full canonical set + per-language parsers, and the Errors reference for the verdict-to-status mapping (when enforced becomes a 422 quarantine or 403 block).
5

Claim your agent

The gateway created your agent in the shared Mnemom Sandbox (no owner). Claiming it proves you hold the provider key and moves it into your account so all read commands can resolve it.Copy the X-Mnemom-Agent value from the response headers above, then run:
mnemom agents claim mnm-550e8400-e29b-41d4-a716-446655440000 --name my-agent --key $ANTHROPIC_API_KEY
Replace mnm-550e8400-e29b-41d4-a716-446655440000 with the actual id from your X-Mnemom-Agent header.
  • Pass --name matching the x-mnemom-agent value you sent on the gateway call (omit --name if you made that call without the header). If the id, --name, or --key don’t resolve to a real agent, the claim returns 404 — re-check the X-Mnemom-Agent id and that --name/--key match the gateway call.
  • The key is hashed locally (SHA-256) and never sent to Mnemom.
  • The agent lands in your personal org by default; pass --org <slug> to claim into a shared org.
  • The operation is idempotent — safe to run more than once.
A 503 response means your personal org is still being provisioned. Wait a few seconds and retry. For 403 cross-tenant or not-a-member errors, see the Agent claim flow guide.
6

Check status

Verify the gateway is reachable and your agent is connected:
mnemom status --agent my-agent
Output
Agent:    my-agent (mnm-550e8400-e29b-41d4-a716-446655440000)
Gateway:  https://gateway.mnemom.ai (healthy)
Status:   Connected
Providers: anthropic, openai
Last seen: just now
7

View traces

After making API calls through the gateway, view what was traced:
mnemom logs --agent my-agent
Output
2026-02-17T10:30:00Z  tr-abc123  recommend  bounded   verified  0.82
2026-02-17T10:30:05Z  tr-abc124  search     bounded   verified  0.76
2026-02-17T10:30:12Z  tr-abc125  respond    bounded   verified  0.91
Use mnemom logs --agent my-agent -l 20 to show more entries.
8

Check integrity

View AIP integrity scores for your agent’s recent activity:
mnemom integrity --agent my-agent
Output
Agent: mnm-550e8400-e29b-41d4-a716-446655440000
Checkpoints: 12
Verdicts:
  clear: 11
  review_needed: 1
  boundary_violation: 0
Integrity score: 0.94
Drift: none detected
9

View your alignment card

See the alignment card assigned to your agent:
mnemom card show --agent my-agent
Customize it by publishing your own card:
mnemom card publish my-card.yaml --agent my-agent
10

Explore the dashboard

Your agent’s data is available at mnemom.ai/dashboard once you are logged in. The dashboard shows:
  • Conscience timeline — A chronological view of every trace, integrity checkpoint, and enforcement action
  • Alignment card — Your agent’s declared values and boundaries
  • Integrity scores — AIP verdict history and trend analysis
  • Drift alerts — Notifications when behavior diverges from declared alignment
  • Enforcement log — Records of nudges and blocks (if enforcement is enabled)

Named agents

If you run multiple agents behind the same API key, use the x-mnemom-agent header to give each one a distinct identity. The provider path stays unchanged — the gateway hashes SHA256(apiKey + '|' + agentName) to derive a unique agent ID. See Agent Identity for the full ID derivation, the auto-create vs programmatic registration paths, and how key rotation interacts with agent identity.
curl https://gateway.mnemom.ai/anthropic/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "x-mnemom-agent: my-coder" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
Each named agent gets its own trace history, integrity scores, and drift detection — even though they share an API key. Agents are auto-created on first API call; claim once (see the claim step above) to bind the agent to your account.
You can also create agents programmatically via the Agent CRUD API if you want to pre-create agents with metadata before they make their first request.

Supported providers

ProviderModelsThinking / AIP SupportAuth Header
AnthropicClaude Opus 4.7, Sonnet 4.6, Haiku 4.5Full (thinking blocks analyzed directly)x-api-key
OpenAIGPT-5.2, GPT-5.2 Pro, GPT-5Via reasoning summaries (reduced confidence)Authorization: Bearer
GeminiGemini 2.5 Pro, Gemini 3 ProFull (thought parts analyzed directly)x-goog-api-key

AIP compatibility

Provider / ModelAIP SupportMethod
Anthropic reasoning models (Opus, Sonnet)FullThinking blocks analyzed directly
OpenAI GPT-5 Thinking seriesPartialReasoning summaries (reduced confidence)
Gemini 2.5/3 with thinkingFullThought parts analyzed directly
Non-reasoning modelsTracing onlySynthetic clear verdict
Legacy OpenAI (o3/o4-mini)UnsupportedReasoning encrypted
Thinking elements in proxied responses. Safe House / AIP enables extended thinking to analyze the agent’s reasoning in real time. Proxied responses therefore include a thinking content element in the content array alongside the standard text block. Clients that assume text-only content arrays should be updated to handle or ignore thinking blocks. Thinking output tokens are billed as standard output tokens — this behavior is intentional and cannot be disabled.

What gets traced

The Mnemom Gateway builds AP-Traces that record:
  • Action — What the agent did (type, name, category)
  • Decision — What alternatives were considered and why one was selected
  • Escalation — Whether the agent escalated to a human and why
  • Verification — Whether the trace is consistent with the agent’s declared Alignment Card
  • Integrity — Real-time AIP analysis of thinking blocks, with verdict (clear / review_needed / boundary_violation)

What is NOT stored

Your prompts, responses, and API keys are never stored by Mnemom. The gateway processes requests in memory and forwards them to the provider. Only structured trace metadata (actions, decisions, verdicts) and thinking block analysis results are persisted.

Enforcement modes

The Mnemom Gateway supports three enforcement modes when an integrity violation is detected:
ModeBehavior
observeDetect violations, record them, take no action (default)
nudgeDetect violations, inject feedback into the agent’s next request via system prompt. The agent sees it and can self-correct.
enforceHard block with HTTP 403 for non-streaming requests. Falls back to nudge for streaming.
Set enforcement mode by updating the agent’s alignment card. integrity_mode and autonomy_mode are top-level fields on the alignment card; the legacy /v1/agents/{id}/enforcement endpoint was retired 2026-05-14. Three paths, pick the one that fits your workflow:
  • Dashboard: open https://mnemom.ai/dashboard/agents/{your-agent-id}/card, toggle integrity_mode, save. Easiest path.
  • CLI: mnemom card edit opens the current alignment-card YAML in $EDITOR; change integrity_mode: nudge, save, the CLI publishes + recomposes.
  • Programmatic: PUT /v1/alignment/agent/{agent_id} with the full canonical card. See the Card Management guide for the read-modify-write flow and the alignment-card schema for field requirements.

Next steps