Primitivememory.retrieve()InferenceLocal · agent-sideKeysYours, never ours

Infer locally. Retrieve memory from the cloud.

MemRails is cloud-hosted memory infrastructure for locally inferred agents. The agent asks for memory, receives a governed context bundle, and runs the model on its own side. No key handling, no decryption, no local vector DB, no database to manage.

$ npx @memrails/wizard
Wire it via MCP →See pricing →
The loop

Retrieve in the cloud, reason on your side.

01

Ask for memory

memory.retrieve(task_context)

The local agent sends its task context and asks for memory. No keys to hand over, no database to manage, no embeddings to build — just the request.

02

Receive a governed bundle

→ ContextBundle

Scope → policy → MemoryIndex tree reasoning → ranking runs in the cloud and returns a compact, governed context bundle: the selected memories, why each was chosen, what was omitted, and the retrieval trace.

03

Infer locally

model.run(bundle, task)

Your model runs on your side against the bundle. MemRails never sees your inference, never holds your model key, and never decrypts your traffic. Memory is a protocol, not a black box.

Why local inference

Memory as a protocol, not a black box.

No key custody

MemRails serves memory. It never takes or stores your model provider key — you infer with whatever model you choose.

No decryption

The retrieval layer governs and ranks memory; it does not read or decrypt your inference traffic.

No local vector DB

No embeddings to build, no index to host, no DB to operate locally. Retrieval is a hosted, governed call.

Model-agnostic

Claude, OpenAI, or a local model — the context-bundle contract survives model swaps.

Governed & inspectable

Every bundle carries reason_selected, omitted, and a retrieval_trace. Nothing ships as anonymous context.

File-canonical & exportable

Memory stays Git-versioned and exportable. Read it, self-host it, or eject — no lock-in.

The contract

One primitive. Survives every model swap.

agent.ts
// The local agent asks for memory and infers on its own side.
const bundle = await memory.retrieve(taskContext);

// bundle: ContextBundle
//   .memories        selected, ranked, scoped
//   .reason_selected why each made the cut
//   .omitted         what was deliberately left out
//   .retrieval_trace scope → policy → MemoryIndex → ranking

const answer = await model.run({ context: bundle, task });
// MemRails never sees `answer`, never holds your key.
Simple API

One API. The retrieval stack, orchestrated for you.

task_contextscopepolicyMemoryIndex treerankingContextBundle

Integrate one endpoint and drop it into your existing agent loop — no SDK migration, no infra, no vector DB to stand up. Behind the single call, MemRails runs the whole retrieval stack for you — scope, policy, the MemoryIndex tree, and ranking — and returns a governed, evidence-graded context bundle with provenance (and optional packets) for your local model. It is read-only by default, cheap filters first and compression as last resort. You orchestrate nothing; it stays model-agnostic, inspectable, ~50 ms.

  • $0.002per retrieval ($2 / 1,000) — the one metered call
  • Freeretrieval credits to start — no card, no quota
  • $0for writes — you pay for retrieval, nothing else
  • Noseats, no infra, no keys to hand over
Request
curl -s https://memrails.dev/api/memory/retrieve \
  -H "Authorization: Bearer $MEMRAILS_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "task_context": "deploying the billing worker",
        "max_tokens": 1200 }'
200 · ContextBundle excerpt
{
  "retrieval_id": "ret_9f2a…",
  "memories": [
    { "memory_id": "mem_4c1…",
      "summary": "Billing worker runs on cron, not the request path",
      "reason_selected": "names the billing worker + deploy",
      "score": 8.4 }
  ],
  "omitted": [{ "memory_id": "mem_77b…", "reason": "below confidence floor" }],
  "tokens_returned": 240,
  "usage": { "billable_retrievals": 1, "credits_remaining": 2499 }
}

Keep inference local. Make memory governed.

Point your agent at MemRails, retrieve a governed context bundle, and infer with the model you already trust.