The forward way to remember.
MemRails plugs into your agent and equips a future-proof knowledge socket that replaces context-stuffing with dense, auditable, and payable deliverables ad hoc.
$ npm install @memrails/memory $ memrails init knowledge/ → wrote knowledge/.memrails/config.yaml → indexed 0 keys · 0 claims · evidence layer ready $ memrails query "what does this agent know with evidence?" ◐ literal scan 2.1ms 141 candidates ◐ key lookup 0.4ms 8 topics ◐ semantic rank 18ms 3 survivors ◐ evidence filter 1.2ms 3 claims ≥ 0.75 confidence ◇ packet 612 tokens ← compressed
Every token you stuff is a token you pay for twice.
Agents burn 80% of every context window on stale history, summaries-of-summaries, and irrelevant turns. The cost compounds — once in tokens, once in degraded reasoning.
More tokens ≠ better thinking.
Endless embeddings, opaque graphs, vendor lock-in. Recall without trust. Tokens without signal.
Better structure = cheaper cognition.
Files, keys, claims, evidence, diffs. Compression at retrieval. Audit before action.
Memory that sharpens instead of bloating.
Drop-in retrieval API. memory.query() returns a ranked packet — fitted to your token budget — before any model call.
Every tool call leaves a paper trail. Memory packets cite the file, source, and confidence — auditable through MCP.
Improve memory. Get paid. Refactor agents propose cleaner claims, stronger evidence, better compression, and contradiction handling.
Cheap filters first. Expensive reasoning only when needed.
Memory as a typed primitive, not a vendor graph.
Every topic is a key. Every key resolves to a Markdown file with typed frontmatter: claims, evidence, confidence, contradictions, refactor history. Embeddings, summaries, and caches are derived artifacts — regeneratable, swappable, never the source of truth.
--- key: kv-cache aliases: [attention cache, transformer cache] confidence: 0.86 evidence_score: 0.79 related: [attention, inference-optimization] last_refactored: 2026-05-13 format_version: 0.1 --- # KV Cache Short-term model memory that avoids recomputing attention over prior tokens. ## Claims - Claim: KV cache reduces repeated attention computation during autoregressive inference. confidence: high evidence: source-a, source-b ## Contradictions None currently known. ## Refactor Notes Compressed explanation split from transformer-inference.md.
Memory improves.
MemRails treats memory maintenance like software maintenance.
- confidence: 0.72 + confidence: 0.86 - evidence: source-a + evidence: source-a, source-b contradictions: [] + refactor_notes: | + Added second independent source. + Promoted confidence after validator review.
Benchmark density, not just recall.
Current memory benchmarks ask: Did the system remember? MemRails asks the harder question: Did the system remember the smallest defensible version of the truth?
Tokens avoided per task
Whether returned claims are source-backed
Whether nuance survives compression
How quickly memory improves after new evidence
Retrieval + model spend per successful output
Whether stale claims are visibly demoted
Install it as a library. Keep it as a protocol.
No mandatory hosted service. No graph dependency. No SDK to deprecate around. MemRails runs inside your harness, writes to plain Markdown, and ships with first-class bindings for the runtimes you already use.
import { Memory } from "@memrails/memory";
const memory = new Memory({
root: "./knowledge",
retrieval: ["grep", "key", "semantic", "evidence", "compress"]
});
const packet = await memory.query({
q: "What do we know about KV cache optimization?",
minConfidence: 0.75,
maxTokens: 1200
});
console.log(packet.context);
console.log(packet.evidence);
Memory becomes a market when quality becomes measurable.
When memory is file-based, evidence-scored, and diffable, improvement can be measured. When improvement can be measured, refactoring becomes payable work. When refactoring becomes payable work, memory becomes an economic network.
confidence = evidence_weight + source_quality + validator_score + contributor_reputation + stake_weight
Memory quality should not depend on one opaque agent. It should emerge from competition, evidence, and review.
Not another memory API.
APIs make memory accessible. Protocols make memory durable.
Plug it in. Ship.
Models will change. Frameworks will fork. SDKs will deprecate. Compound your knowledge layer throughout.
The future of agent memory is in your hands.