Jump to: Why Smriti · What's new in 0.4 · Quickstart · How it works · Results · · ·
接入你的智能体
從發布者安裝。不是 PlugMCP 端點。
遠端 URL 還是本機指令? 兩種安裝方式的差異
來自發布者
Jump to: Why Smriti · What's new in 0.4 · Quickstart · How it works · Results · · ·
Zero-infrastructure, local-first memory for AI agents. One SQLite file — no Postgres, Neo4j, or cloud. Bi-temporal supersession (updates, never deletes), four-channel hybrid retrieval, and a drop-in MCP server. Runs offline on cheap models. Apache-2.0. Bring your own benchmark.
pip install and point it at a path. Memory
is a single SQLite file you can copy, back up or delete. Lite mode makes no
LLM calls at all.Full details and upgrade notes: RELEASE_NOTES.md.
git clone https://github.com/vn-envy/Smriti && cd Smriti
python -m pip install -e '.[dev,onnx]' # core + test tools + in-process ONNX embeddings
python -m pytest tests/ -q # offline: no network, no API keys
python examples/quickstart.py # supersession, live
[!NOTE] The package name is
smriti-agents(smriti-memoryis an unrelated project) and the import name issmriti. There is no PyPI release yet, so install from the repository.
Evidence with dates, fully offline with an in-process embedder (any folder
holding model.onnx and tokenizer.json, such as the ONNX export of
sentence-transformers/all-MiniLM-L6-v2):
from smriti import Smriti, OnnxEmbedder
mem = Smriti(path="memory.db", embedder=OnnxEmbedder("models/all-MiniLM-L6-v2"))
mem.add([{"role": "user", "content": "I went to a support group yesterday."}],
timestamp="2023-05-08T13:56:00Z", session_id="s1")
print(mem.context("When did I go to the support group?", now="2023-07-01"))
# (Current date: 2023-07-01 Sat)
# CONVERSATION EVIDENCE (grouped by session, oldest first; ...):
# [Session 2023-05-08 Mon]
# user: I went to a support group yesterday [2023-05-07].
Facts that change over time, with LLM extraction through any OpenAI-compatible endpoint (Ollama, vLLM, LM Studio, Groq, DeepSeek, OpenRouter or hosted):
from smriti import Smriti, LLM, OllamaEmbedder
mem = Smriti(path="memory.db",
embedder=OllamaEmbedder("nomic-embed-text"),
llm=LLM("qwen3:14b", provider="ollama"))
mem.add([{"role": "user", "content": "I live in Hyderabad."}], timestamp="2026-01-15T10:00:00Z")
mem.add([{"role": "user", "content": "I moved to Bengaluru on June 1st."}], timestamp="2026-06-02T10:00:00Z")
print(mem.context("where do I live?"))
# Illustrative output; extraction wording depends on the model.
# KNOWN FACTS (validity window; CURRENT = still true, SUPERSEDED = true then, later changed):
# - [2026-06-01 | CURRENT] The user lives in Bengaluru.
# - [2026-01-15 | SUPERSEDED on 2026-06-01] The user lives in Hyderabad.
smriti-doctor --db memory.db runs read-only integrity, schema, count, WAL
and embedding-dimension checks, and reports whether the embedder identity
is tracked.adopt_legacy_embedder=True once
(or smriti-mcp --adopt-legacy-embedder) after checking the embedder
matches.export_json() / import_json() round-trip the core schema, including
embeddings and supersession chains. For enterprise stores use
snapshot(), or build_pack() with verify_pack() / open_pack().flowchart LR
subgraph WRITE ["WRITE PATH — consolidation (anubhava → samskara)"]
S[session] --> E["episodic log · anubhava अनुभव<br/>append-only · embedded · FTS-indexed"]
S --> X["fact extraction · grahana ग्रहण<br/>1+ LLM calls / session (full mode)"]
X --> B{"conflict? · badha बाध"}
B -->|"single-valued (subject, predicate, scope) collision"| SUP["supersede · 0 tokens"]
B -->|semantic collision| ARB["1 tiny arbitration call"]
SUP --> F["fact store · samskara संस्कार<br/>valid_from · invalid_at · superseded_by"]
ARB --> F
end
Every turn is kept as an episode. In full mode, facts are extracted and
consolidated: a collision on a single-valued (subject, predicate, scope)
supersedes the old fact for zero tokens, and only semantic collisions pay one
small arbitration call. Nothing is overwritten; owner erasure is a separate
operation.
lite (alias laghu): no LLM at write time. Episodic ingest and hybrid
retrieval, fully offline.full (alias purna): adds fact extraction and consolidation, usually
one call per session, plus occasional arbitration, bounded scope correction
and provider retries.Facts may carry an applicability scope such as project:Atlas, so
project-specific values stay separate. Model-generated scopes are checked
against the source turns; an invalid scope triggers at most one correction
call, and the raw episode is always retained.
flowchart LR
subgraph READ ["READ PATH — evidence-first recall (smarana स्मरण)"]
Q["question + date"] --> L["BM25 · light-stem prefix terms"]
Q --> V["cosine · exact numpy scan"]
L & V --> F["score-level fusion<br/>turn → session roll-up"]
Q --> T["temporal grounding<br/>dates resolved · time-window prior"]
T --> F
F --> P["question-aware priors<br/>assistant · speaker · 'when' · X or Y"]
P --> J{"optional judge<br/>off by default"}
J --> K["budget-adaptive packing · prasanga प्रसंग<br/>whole turns · dated sessions · excerpts"]
end
yesterday [2023-05-07]), the question's time window becomes a soft prior, and
sessions carry dated headers.It is local and deterministic, and makes no LLM calls at query time.
Smriti(read_engine="fusion") keeps the 0.3.x read path: four channels
(lexical, semantic, entity, temporal) fused by reciprocal rank, with validity
annotation.
One store, several ways of looking at it. Profiles are named, per-query policies; the MCP tools expose them as a single enum.
mem.search("who mentors Rachel?", profile="relations")
mem.context("how many concerts did I attend?", profile="deep")
mem.search("db migration steps", channels={"lexical"}) # BM25 only, no embedding
from smriti import RetrievalProfile # custom profiles are data, not code
support = RetrievalProfile(channels={"lexical", "semantic"}, k=8)
mem.search(query, profile=support)
All figures are self-run on held-out splits with raw per-question results in the repository. LME-X is the LongMemEval questions with 48 cross-question distractor sessions each; it is not the official LongMemEval-S haystack, and none of these numbers is comparable with published leaderboard scores.
Against Mem0 the difference is +8.8 points on LME-X (bootstrap 95% CI
+1.7 to +15.4, sign test p = 0.07) and a statistical tie on LoCoMo (+2.8,
CI −1.8 to +7.2). Against the 0.3.x path it is +19.5 and +22.9 points
(p < 0.0001). Every system received the same turns, timestamps, MiniLM vectors
and 9,000-character budget, and was scored by the same blinded reader (Claude
Haiku) and strict judge (Claude Sonnet); Mem0 ran with infer=False over the
verbatim turns. Lab report, method and null results ·
2025–2026 research survey
The change came from reading a trained relevance judge's weights: its largest weight said the assistant's own replies are rarely the evidence. LoCoMo, which has no assistant turns, is unchanged.
Each judge re-ranks Smriti's top 20 memories on held-out LME-X, with settings fixed on dev before the test.
Hosted Jev helps out of the box. A small head trained on our labels over the official Laya encoder is a statistical tie with Jev and keeps everything local, but needs a GPU to be fast. CLM-8B as released does not beat Smriti's own ranking. At 9,000 characters no judge helps. Experiment record · X article
These were measured before the evidence-first engine, with real installed packages, retained configurations, raw per-question outputs and dataset hashes.
The QA samples show competitive, not superior, answer quality; the latency figures are warm retrieval only, not end-to-end answer speed. Hindsight 0.9.2 and Graphify 0.9.54 were installed and probed but not scored on answers. Full tables, cost-over-time scenarios and limits: benchmark methodology, verified results, cost and speed report, competitive review. Older within-system experiments are in BENCHMARKS.md.
python -m bench.lab.run --help # LLM-free evidence benchmark (bench/lab/README.md)
python -m bench.lab.qa --help # blinded reader/judge QA pipeline
bash bench/ab.sh # fixed-judge A/B on your own data
The GPU judges run from two Google Colab notebooks in
bench/lab/colab/.
Smriti's read path has no judge by default. If your context budget is tight,
you can add one: a "System One" decision model that answers "does this memory
help answer the question?" for each of Smriti's top candidates. Any endpoint
that speaks the TypeSafe /v1/systemone protocol works: hosted Jev, a local
laya-serve, or a clm-serve GPU host.
import os
from smriti import Smriti, PROFILES
from smriti.decision import SystemOneReranker
from smriti.recall import RecallConfig
# Hosted Jev: every candidate memory is sent to api.typesafe.ai
jev = SystemOneReranker(api_key=os.environ["TYPESAFE_API_KEY"], price_per_mtok=0.042)
mem = Smriti(path="memory.db", reranker=jev) # plus your embedder
judged = PROFILES["evidence"].with_overrides(
recall=RecallConfig(rerank_depth=20, rerank_weight=0.35)) # the blend tested above
print(mem.context("When did I go to the support group?", profile=judged))
print(jev.stats.as_dict(), f"${jev.cost_usd:.4f}")
SystemOneReranker(base_url="http://127.0.0.1:8000", model=None) points
at a local laya-serve; nothing leaves the machine.noul (one yes/no question per memory, default), fanout (groups of
memories per request), choice, and rank (the question as the
instruction, for contrastive models such as CLM-8B).LayaReranker runs Laya in process when the optional laya package is
installed.rerank_hits(query, hits) also sees Smriti's
score, rank and role for each candidate.local profile allows loopback only.smriti-mcp --db memory.db # or: python -m smriti.mcp_server --db memory.db
{ "mcpServers": { "smriti": { "command": "smriti-mcp", "args": ["--db", "memory.db"] } } }
Six typed tools return structured JSON: remember, recall, search,
facts_about, add_fact and stats. The read tools take profile,
channels and a now date (default today); with no profile they use the
evidence-first engine. The server is offline by default; set
SMRITI_LLM_MODEL, SMRITI_LLM_PROVIDER and SMRITI_API_KEY for full
extraction mode. erase_* operations are deliberately not exposed over MCP.
enterprise/ is a separate package,
smriti-enterprise, with zero edits to the core: tri-temporal as-of queries,
exact lineage, evidence receipts bound to the packed-context digest, retention
and legal holds, deployment profiles with egress checks, verified knowledge
packs and multi-store federation. Version 0.2.0 works with core 0.4.0 to
0.4.2.
Smriti's position is deliberately narrow: explicit temporal history and provenance in a portable SQLite core, with graph synthesis, hosting and connectors left to systems designed for them.
The vocabulary is not decoration. Indian epistemology worked out a precise language for memory long before vector databases, and the pipeline maps onto it closely:
invalid_at is set,
superseded_by points forward, history stays queryable.Code stays English, docs lead with the concept, and nothing gets a Sanskrit
name without an honest fit. Full lexicon: NOMENCLATURE.md.
smriti/ core library
memory.py public Smriti API (lite / full modes, read engines)
recall.py evidence-first read engine (default)
temporal.py deterministic date resolution and time-window priors
retrieval.py 0.3.x four-channel retrieval, RRF fusion, context packing
profiles.py named retrieval profiles and the zero-token router
store.py SQLite bi-temporal store (episodes, facts, FTS5, vectors)
extraction.py session → atomic facts
consolidation.py ADD / SUPERSEDE / SKIP conflict resolution
decision.py optional System One judges (Jev, laya-serve, clm-serve, Laya)
embedder.py Ollama / OpenAI-compatible / offline hash embedders
onnx_embedder.py in-process ONNX embeddings (optional extra)
llm.py OpenAI-compatible client and mock
mcp_server.py stdlib-only MCP server (six typed tools)
doctor.py read-only store checks (smriti-doctor)
bench/ LongMemEval and LoCoMo runners, judge, CLI, A/B harness
lab/ LLM-free evidence lab, blinded QA, judge trials, Colab notebooks
tests/ offline core test suite
enterprise/ optional governance package (separate install)
audit/ dated evidence: lab reports, raw results, reviews
examples/ runnable quickstart
site/ landing page source
Delivered in 0.4: evidence-first recall as the default read engine, in-process ONNX embeddings, the assistant-reply prior, optional System One judges and a public four-round trial of Jev, Laya and CLM-8B.
Next, driven by what the trials and lab showed:
The boundary. The core stays small enough to read in a sitting; LLM extraction, reranking, observations and the MCP server are replaceable modules. Reflection, graph traversal beyond two hops, dashboards, auth and multi-tenant machinery belong outside the core.
Issues and PRs are welcome. The bar for a retrieval change is the one we hold
ourselves to: run bash bench/ab.sh or the lab (python -m bench.lab.run) and
post the delta, including null results. Non-retrieval changes need the offline
test suite to pass.
Apache-2.0. Everything: the temporal model, the entity graph, the retrieval profiles and the benchmark harness.
@software{smriti2026,
title = {SMRITI: Structured Memory with Reflective Indexing and Temporal Inference},
year = {2026},
version = {0.4.2},
url = {https://github.com/vn-envy/Smriti},
note = {Zero-infrastructure, local-first, bi-temporal memory layer for AI agents}
}
Zero-infrastructure, local-first memory for AI agents. One SQLite file — no Postgres, Neo4j, or cloud. Bi-temporal supersession (updates, never deletes), four-channel hybrid retrieval, and a drop-in M
總覽
Zero-infrastructure, local-first memory for AI agents. One SQLite file — no Postgres, Neo4j, or cloud. Bi-temporal supersession (updates, never deletes), four-channel hybrid retrieval, and a drop-in MCP server. Runs offline on cheap models. Apache-2.0. Bring your own benchmark.
工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
Smriti 透過 stdio 在本機執行。
上次檢查時間:2026-10-28。 Zero-infrastructure, local-first memory for AI agents. One SQLite file — no Postgres, Neo4j, or cloud. Bi-temporal supersession (updates, never deletes), four-channel hybrid retrieval, and a drop-in MCP server. Runs offline on cheap models. Apache-2.0. Bring your own benchmark.