rein is a self-adaptive memory system for AI coding agents. It stores, recalls, and manages memories across sessions with embedding-based semantic dedup, data-driven decay (Kaplan-Meier survival curves), and a fully closed self-learning loop that replaces fixed parameters with learned values.
Multi-source cross-validated memory MCP server for AI agents (Rust, jieba CJK, local-first, AGPL)
Bintang
10
Tool
—
Uptime
—
Current release: v1.5.1 (2026-10-20) — maintenance patch from a whole-project review of v1.5.0; no schema or config change. Consolidation keeps the evidence inherited from earlier merges and, like rein upgrade and merge refinement, never replaces a memory edited while the model ran; refinement and group synthesis send the whole text or fall back instead of truncating; dedup and vector search never mix vectors from two embedding models; recall re-applies topic, time and tier filters after canonical collapse and fusion keeps tied candidates; the reranker learns per request; HNSW saves and reindex single-flight are crash-safe; the Stop hook ingests the newest turns of a long transcript; proxy extraction handles streamed Responses text, split UTF-8 and every WebSocket turn; doctor --fix respects running workers; rein init writes the shapes VS Code and OpenCode read; a plain-HTTP remote Gemini endpoint disables the embedder instead of sending the key. 2077 lib tests / 0 fail; clippy + fmt clean.
v1.4.1 (2026-10-10) — maintenance patch on the v1.4.0 runway automation line. Tantivy no longer leaves one segment per memory: the staged rebuild loads the corpus through a single writer with automatic merges disabled and compacts to one segment (a 10.6k-memory database rebuilds in 15 s instead of ~28 min; 10,651 segments → 1), and single inserts wait for their scheduled merges. Background warmup runs on a detached thread, so rein serve exits on SIGINT/SIGTERM during a rebuild instead of lingering until it finishes. The GUI's synthesis thumbs no longer show a vote as recorded when the server refused the write (auth = "public" with a public_url rejects every REST mutation) and show the refusal reason instead; the Connectors page explains the owner-only 401; the GUI's own doctor page no longer flags gui_runtime by probing itself; and #[op] validates literal REST paths at expansion time. 1900 lib tests / 0 fail; clippy + fmt clean; 2 codex review rounds (1 P2 closed, last round clean).
v1.4.0 (2026-09-04) — the runway automation line. The adaptive pipeline now records every stage in SQLite (adaptive_pipeline_last_run, surfaced by rein doctor, adaptive-status and rein gc); A12 publishes a Complete generation even when the store moved during a multi-hour calibration (activation stays fail-closed on the input epoch); the leave-one-out corpus build uses an inverted index with semantics identical to the pairwise reference (two hours down to eight seconds on a 9.7k-memory database, verified against the reference on real data); rein warmup backfills missing vec_memories rows and migrates the table atomically when the embedding model changes, with a vec_rows_provenance stamp that refuses mixed-model writes; and [hooks.claude] gives Claude Code prompt-time recall context that emits RecallComplete with a feedback id. config_version 4. 1887 lib tests / 0 fail; clippy + fmt clean; 26 adversarial review rounds (14 P1 + 43 P2 closed, last two rounds clean).
A12 recall-fusion weights can now calibrate without human feedback, fully fail-closed: structural leave-one-evidence-out families (canonical evidence / concept / episode), a SHA-256 family-disjoint split with a permanent activation holdout, a side-effect-free recall trace, paired-McNemar holdout gating, and a sealed parameter policy (schema 3) that steps recall_fusion:* adoption by at most 0.05 per refresh behind the judge structural trust gate. A SQLite schema-v4 input-epoch counter binds every calibration to the exact store state it was trained on; structural judge probes give zero-human-pair deployments an honest health gate; destructive dedup merges are floored at the static threshold with an exact false-merge safety bound. Released ≠ activated: everything ships shadow/fail-closed until live evidence passes the release gate. 1819 lib tests / 0 fail; clippy + fmt clean; 7 adversarial review rounds.
Recent releases (v0.33 → v0.35) — the eval-gate harness went from foundation to full: the dedup / admission / latency gates moved from NoData stubs to working scorers with committed baselines and 20-fixture corpora per gate (v0.33.0/.1, v0.35.0). Trust & Measurement Phase 3 landed its first slice — repair_advice + judge_drift_alert_total (v0.35.0); claude.ai remote-MCP polish added a sliding session cookie + metadata JSON (v0.35.0); and the bearer-auth migration progressed from a rein doctor WARN on the legacy loopback bool (v0.34.0) to its load-time removal (v0.35.0).
Trust & Measurement Phase 2 (v0.32.0) — the eval::gates module: GateScorecard / Gate trait / compare_scorecards (8-rule classification + paired McNemar non-inferiority), the recall gate over a hermetic 20-fixture corpus, the rein-eval gate {baseline,run,compare,status} CLI, rein_trust_measurement reading real scorecards, and rein doctor check_eval_gates.
core memory ops, knowledge graph, temporal recall, adaptive maintenance, ARS feedback (Cap A mirror, Cap B synthesis, Cap C archival summary), runtime LLM judge enqueue, ARS acceleration release-gate inspection, and Trust & Measurement reporting. All authored once via #[op] macro (v0.21+) and exposed through CLI / MCP / REST simultaneously.
Unified operation registry
One #[op] declaration drives CLI / MCP / REST surfaces (v0.21, A1). Inventory-based dispatch; zero hand-maintained lists.
Neural Wiki GUI
React + Tailwind web dashboard with Brain View, Adaptive Engine, Knowledge Graph, Timeline, and more
Self-adaptive engine
M1-M6: all learning loops closed — data drives fusion weights, decay curves, dedup thresholds, and tier boundaries
Counterfactual alpha learning
Replays past recalls to find optimal CC fusion weights — global, per-query-type, and per-cluster; bucket confidence accumulates across learning windows as a decay-weighted effective sample size (M2, v1.1)
Pure Rust semantic clustering with sampling for large datasets; churn-gated recluster cadence keeps cluster-scoped learning alive between runs (M4, v1.1)
LLM rewrites query into 2-3 variants (Gemini Flash Lite / OMLX); multi-query results merged before fusion
LLM reranker
Optional Gemini / OMLX reordering of top-N candidates via score-envelope-preserving permutation (only the LLM's order is used — existing scores are redistributed, zero scale constants, v1.1); strong-signal bypass skips LLM when confidence is already high
Maximal Marginal Relevance
MMR post-rerank diversity pass — balances relevance and variety in final result set
OMLX local embedding
Optional local embedding backend via EmbedderKind enum dispatch (Google / OMLX)
Dual-layer decay
LTM / STM layers with KM survival curves (data-driven) or Ebbinghaus (cold-start)
Other platforms (Intel Mac / Linux / Windows): the DXT bundle is
macOS Apple Silicon only. Use the
Claude Code plugin marketplace
path or cargo install instead.
The plugin registers the rein MCP server entry in Claude Code. You still
need the rein binary on your PATH:
# Latest master
cargo install --git https://github.com/lyr1cs/rein --locked rein
# Or pin to a specific release tag (recommended for reproducible installs)
cargo install --git https://github.com/lyr1cs/rein --tag v1.5.1 --locked rein
--locked is required. Without it, cargo install --git ignores
the committed Cargo.lock and re-resolves every transitive dependency
to the latest semver-compatible version on crates.io, which can pull
in C/SIMD code that requires a newer host toolchain than your machine
ships. See
docs/manual/02-installation.md → Remote Install.
This installs the default non-GUI binary. For the built-in OAuth
remote-connector flow, use the GUI-enabled source install in
Recipe E
so the owner approval pages are embedded.
Then set GEMINI_API_KEY in your shell environment or ~/.rein/config.toml.
See docs/manual/02-installation.md for
full configuration.
Install via Remote MCP (Cowork, claude.ai, mobile)
Claude Cowork (the agentic-work tab inside Claude Desktop), claude.ai
web, and the Claude mobile apps route MCP traffic through Anthropic's
cloud, not through your local stdio. They cannot use the DXT or
plugin marketplace paths above. They need a public HTTPS endpoint that
Anthropic's servers can reach.
rein already implements the Streamable HTTP transport (current MCP
standard) at /mcp on its built-in HTTP server. Three prerequisites
before exposing it:
Set [server].auth = "public" in ~/.rein/config.toml (loopback bind,
non-discoverable public hostname will forward through) OR
set REIN_HTTP_TOKEN to a strong secret and have your reverse
proxy inject Authorization: Bearer … upstream. The other policies
are "loopback_only" (strict local), "bearer_required" (token
required), and "oauth" (built-in OAuth provider, recommended for
multi-user remote MCP).
Add the public hostname to [server].allowed_hosts in
~/.rein/config.toml, e.g.,
allowed_hosts = ["rein.your-domain.com"]. Without this, rein
returns 403 Host header is not allowed for any request whose
Host: is not localhost / 127.0.0.1 / ::1, and your tunnel will
appear broken even when up.
Start the listener:
rein serve --sse # listens on 127.0.0.1:8680/mcp
Without one of the auth postures in step 1, rein serve --sse exits
immediately with REIN_HTTP_TOKEN must be set. Without step 2 the
listener starts but rejects every tunnel request.
Session lifetime. rmcp (rein's MCP transport layer) expires a Streamable
HTTP session after 300 s without a request. Since v1.4.2 that expiry is
invisible to clients: rein keeps each session's initialize parameters in
memory and in <db dir>/<db file name>.mcp-sessions-<bind>-<port>-<hash>.json, and a request that
carries an expired or pre-restart Mcp-Session-Id is served after rmcp
re-creates the session under the same id. Clients that never re-initialize
on 404 Session not found (several SDKs don't, e.g. typescript-sdk #1708)
keep working across idle gaps and rein serve restarts. A 404 still
happens when the client itself sent DELETE /mcp, when more than 1024
sessions were seen since that one (oldest is dropped), or when the sidecar
file was deleted or unreadable before a restart; in those cases the client
must re-initialize as the spec requires.
Expose the listener publicly via one of (no Tailscale or domain
required for the simpler ones):
Cloudflare Quick Tunnel — cloudflared tunnel --url http://localhost:8680. No account, no domain. Random
*.trycloudflare.com URL, ephemeral. Lowest friction; works on
most networks (use --protocol http2 if your network blocks QUIC).
ngrok — free account, no domain. URL ephemeral on free tier;
reserved domains on paid. Tends to work on networks where Quick
Tunnel can't.
Tailscale Funnel — free account, no domain. Permanent
*.ts.net URL. Most network-tolerant of the no-domain options.
Cloudflare Tunnel + own domain — permanent URL under your
domain, optional Cloudflare Access OIDC for real edge auth.
Caddy / nginx + Let's Encrypt — self-hosted on your own VPS.
Then in Claude: Customize → Connectors → "+" → Add custom connector,
paste your URL (e.g., https://rein.your-domain.com/mcp), optionally
add OAuth credentials.
Note: custom remote connectors require a Pro / Max / Team /
Enterprise Claude account. Free-plan users can use the local-stdio
paths (DXT, plugin marketplace) but not Cowork.
From source
git clone https://github.com/lyr1cs/rein.git
cd rein
# Standard build (CLI + MCP server only)
cargo install --path crates/rein --locked
# Full build with Neural Wiki GUI (recommended)
cd crates/rein/gui && npm ci && npm run build && cd ../../..
cargo install --path crates/rein --locked --features gui
Or use the install script:
./scripts/install.sh
The install script builds the embedded GUI by default when npm is available. Set REIN_INSTALL_GUI=0 for a CLI-only install.
Prerequisites
Rust toolchain (1.75+)
Node.js + npm (for GUI builds or the default install script path)
A Gemini API key (free tier: 1500 req/day)
GUI Service Management
# Start GUI server in background (listens on :8680)
rein gui on
# Stop GUI server
rein gui off
# Or run in foreground with MCP + GUI
rein serve --gui
# Open in browser
open http://localhost:8680
The GUI requires building with --features gui. Without it, the gui subcommand is available but serves no embedded assets.
Quick Start
# 1. Set your API key
export GEMINI_API_KEY="your-key-here"
# 2. Auto-configure all detected MCP clients
rein init
# 3. Start the MCP server (usually done by your client)
rein serve
CLI Reference
Command
Description
Example
serve
Start MCP server (stdio, SSE, proxy, or GUI)
rein serve [--compact] [--sse] [--proxy] [--gui]
store
Store a memory
rein store -t debug -c "OOM fix" -I high -k oom,memory
recall
Search memories
rein recall "connection pool" -t debug -l 5
forget
Delete a memory by ID
rein forget 01J...
update
Update memory content
rein update 01J... -c "new content" -I critical
topics
List all topics
rein topics
stats
Show store statistics
rein stats
health
Check topic health
rein health [topic]
consolidate
Merge one or many topics into consolidated memories
rein consolidate --pattern 'rmcp*' --merge-variants --dry-run
dedup
Scan / remove duplicates, optionally across topic variants
rein providers set judge --provider openrouter --model …
keys
Manage keys in ~/.rein/secrets.env (list, set, unset, probe)
rein keys set OPENAI_API_KEY --stdin
gui on/off
Start/stop GUI server in background
rein gui on
proxy on/off
Start/stop proxy in background
rein proxy on
How Cleanup Works (Provenance-Preserving)
rein's cleanup pipeline is provenance-preserving: it never hard-deletes information. The process has three stages:
Consolidation — Groups topic variants (e.g., Docker Deployment / docker-deployment) and merges all memories within each group into a single high-quality canonical memory. Source memories become evidence records in the memory_evidence table, preserving their original content, timestamps, and keywords.
Dedup — Scans for content-level duplicates within each topic group using lexical similarity (Jaccard + containment) and optionally embedding cosine similarity. Matches above threshold are merged into the winner; the loser's unique lines are appended with provenance markers ([merged from <id> on <date>]) and the loser is recorded as evidence.
Adaptive refresh — After consolidation and dedup, the adaptive engine (M1-M6) runs: HDBSCAN re-clusters, survival curves rebuild, tier boundaries update, and alpha/threshold learning processes new events.
Every merge decision is logged in the dedup_decisions append-only ledger with winner/loser IDs, scores, relation type, confidence, and operator. This is rein's equivalent of Git's reflog — you can always trace how a canonical memory was formed.
# Preview what cleanup would do (safe)
rein cleanup --all --dry-run
# Run cleanup on a specific topic
rein cleanup "docker-deployment"
# Full store cleanup
rein cleanup --all
# Run cleanup through the worker entrypoint
rein worker cleanup --all
consolidate keeps the old rein consolidate <topic> -s "summary" flow, but also supports:
--topics a,b,c to batch a named topic set
--pattern 'rmcp*' to batch by glob
--all to process every topic
--merge-variants to group case/space/hyphen variants such as Docker Deployment / docker-deployment
omitting --summary to let rein auto-generate a consolidated memory, using the configured LLM when available and a local fallback otherwise
Batch consolidation fans out LLM synthesis asynchronously and in parallel, then commits SQLite writes sequentially. Cleanup actions also emit adaptive feedback and refresh M1-M6 state after the batch completes.
Cleanup is now scoped-first:
rein cleanup X, rein cleanup --topics ..., or rein cleanup --pattern ... only deduplicates the selected groups
destructive full-store cleanup requires rein cleanup --all
rein cleanup --dry-run previews the scope
background-style cleanup is handled by rein worker cleanup ..., rein worker cleanup-queue, and the cleanup queue worker
Store-time gray-zone dedup now also uses a dedicated async queue:
hot-path store creates the new memory without blocking on remote LLM verdicts
a dedup-queue worker later resolves gray-zone pairs with structured LLM verdicts
you can drain it manually with rein worker dedup-queue
Recall is now evidence-aware:
canonical memories are ranked with support_count and source_diversity
recall output includes lightweight evidence_preview
rein evidence <canonical_id> or /api/memories/:id expands the full evidence list
lower-confidence / lower-corroboration results can use evidence second-stage rerank
Adaptive learning now sees richer canonical signals:
reranker learning uses support / diversity features
alpha optimization uses KG / episode / support / diversity-aware candidate scoring
character bigrams remain enabled as a fallback for CJK and mixed technical text
both token streams are combined before Jaccard / containment scoring
More detailed docs:
docs/guides/canonical-read-model.md
docs/guides/evidence-aware-recall.md
docs/reference/adaptive-learning-signals.md
Audit / handoff commit chain:
8b9e747
b358100
b861a4f
1b0765a
45de919
d92170a
d7200b3
Operator inspection commands:
rein canonicals shows canonical memories and their support/merge counters
rein evidence <canonical_id> shows absorbed evidence snapshots
rein dedup-log shows the recent dedup ledger
MCP Tools
When running as an MCP server (rein serve), Rein exposes 40 production MCP
tools through the operation inventory. The authoritative list is maintained in
docs/reference/mcp-tools.md, grouped as:
rein uses LLM (Gemini 3.1 Flash Lite or local models via OMLX) for structured memory extraction. The hook system automatically builds a knowledge graph from coding sessions.
Architecture:
hook_post — local pattern extraction (crash safety net) + buffer to session file
hook_compact — record compact context for async extraction
rein upgrade --dry-run # preview
rein upgrade # convert all old memories to knowledge graph
rein upgrade --topic debug # convert specific topic only
Configuration:
[extract]
provider = "google" # or a vendor name ("openai", "deepseek", "openrouter", …), "omlx", or "none"
[extract.google]
model = "gemini-3.1-flash-lite"
max_input_chars = 0 # 0 = no truncation (1M token model)
[extract.openai] # one table for every OpenAI-compatible vendor; "omlx" is an alias
endpoint = "http://localhost:11434/v1" # Ollama, LM Studio, vLLM, etc. — omitted for a named vendor
model = "default"
max_input_chars = 16000
Self-Learning Quality System (v0.3.0)
rein automatically learns which memories are useful and which are noise, without human parameter tuning.
How it works:
LLM assigns quality_confidence (0-1) at extraction time — zero extra API cost
System tracks recall-then-access patterns to classify memories as "good" (used) or "bad" (recalled but unused)
Feature weights auto-adjust from data: utility, novelty, connectivity, recency
Adaptive admission threshold rises when recent quality is low, relaxes when high
GC prunes low-quality concepts whose source memories are recalled 5+ times but never accessed
No manual tuning needed — cold-starts with LLM judgment, data gradually takes over.
Based on: ICLR 2026 Admission Control, PropMem (Prosus), FActScore, MACLA Bayesian posteriors.
Canonical-First Recall
rein now treats canonical memories as the default read model:
store-time dedup tries to merge gray-zone writes into an existing canonical when evidence already exists
admission/novelty scoring uses the current canonical view, not raw topic fragments
working-set and always-on surfaces are refreshed from persisted canonical memories
recall returns canonical memories by default, with evidence_preview for absorbed observations
detail endpoints and GUI panels expand the full supporting evidence on demand
For API compatibility, GET /api/memories/:id returns the legacy top-level memory fields and also includes:
memory: the canonical memory payload
evidence: supporting evidence snapshots
Temporal Knowledge Graph (v0.4.0)
rein now tracks when knowledge changes, not just what the current state is. Inspired by Zep/Graphiti 2025.
Capabilities:
Concept revision history — every refine_concept auto-snapshots the old state before overwriting
Episode nodes — each session creates an Episode linking to concepts and memories touched
Temporal link validity — ConceptLink has valid_from/valid_until windows; expired links are skipped in BFS
Contradiction detection — when a new definition differs significantly (sim < 0.3), old outgoing links are expired
Temporal recall — rein_recall supports from/to date params for time-range filtering
Concept history — rein_concept_history shows how a concept's definition evolved over time
Example queries enabled:
"What changed last week?" → rein_timeline --from 2026-03-19 --to 2026-03-26
"When did concept X change?" → rein_concept_history --memoir rust --name ownership
"What did I know about Y before March?" → rein_recall "Y" --to 2026-03-01
Autonomous Retrieval Routing (v0.4.0)
rein automatically classifies queries and routes them to the optimal search strategy — no configuration needed.
Query Type
Example
Strategy
Temporal
"when did the API change?"
BM25 bias (alpha=0.7), auto-inject time bounds
ExactKeyword
"SqliteStore", "fn recall"
Heavy BM25 (alpha=0.85)
Semantic
"memory management strategies"
Vector dominant (alpha=0.3)
Exploratory
"what do I know about rein?"
Balanced (alpha=0.5), 2x result limit
Classification is rule-based (zero LLM calls, sub-microsecond). MCP responses include [route: type] prefix for transparency. TA-Mem 2026 and MemR3 2025 are tracked as related memory-retrieval background, not as implemented retrieval controllers.
Adaptive Engine (v0.6.0+)
rein's core philosophy is to minimize fixed parameters through data-driven adaptation. Bootstrap defaults still exist for cold start and safety, but the adaptive engine moves fusion, decay, tiering, and threshold behavior toward observed feedback in the slow channel.
Pipeline: M4 → A1 → M3 → M5 → M2 → M6
Module
What it learns
How
M1 Event Sourcing
(foundation)
Append-only feedback log + per-consumer offsets
M2 Alpha Optimizer
CC fusion weights — global, per-query-type, and per-cluster
Provenance-preserving merge — temporal anchors and unique details never lost
Snapshot CAS — adaptive state saved with read-merge-write on version conflict
Recent releases
The v0.21 → v0.38.0 arc rebuilt rein around six axes: a unified operation registry, an adaptive read-side synthesis (ARS) stack with feedback-driven gates, secure remote MCP deployment for Claude clients, a reproducible eval-gate harness for Trust & Measurement, an algorithm + performance pass on the recall and dedup hot paths, and a schema-versioning foundation for safe forward migrations.
Version
Theme
Highlights
v1.5.1 (2026-10-20)
Maintenance
Data integrity: consolidation carries inherited evidence to the replacement; consolidation / rein upgrade / merge refinement / archive-summary refresh verify source snapshots before writing; refinement and synthesis send the whole input or fall back; dedup requires a matching vector-table stamp, Update verdicts let the replacement win; semantic edits re-flag for embedding; concept dedup bumps revisions and repoints episodes; session artifacts redact title / summary. Schema / index: legacy episodes tables open again; column groups migrate one column at a time; HNSW .usearch.saving marker, rebuild refuses foreign-model rows, vector search skips a foreign-model stamp. Recall: filters re-applied after canonical collapse; CC fusion keeps ties; recent() filters in SQL; rerank cache follows edits; temporal phrases at word boundaries, no panic on huge spans; oversized sentences split; MCP omission count exact. Extraction / proxy: Stop hook takes the newest turns; full-ULID episode names; tail fingerprints; [async_memory] budget; Responses string deltas, split UTF-8, per-turn WebSocket queries; intelligent_merge inherits from [query_expansion]. Adaptive: reranker learns per request and consumes settled feedback; snapshot merge keeps the advancing writer's calibration pairs; activation report applies the judge veto; judge parse errors length-only; cron honors max_input_chars; reindex flock. CLI / doctor / init: plain-HTTP remote Gemini endpoint disables the embedder; rein keys lock file; gui/proxy on report a dead child; doctor --fix respects live workers and rebuilds incomplete HNSW; rein init VS Code servers / OpenCode mcp. GUI: concept votes latch on success; canvases resize after cold load. Packaging: DXT stages Cargo's reported executable. 2077 lib tests / 0 fail; clippy + fmt clean.
v1.5.0 (2026-10-19)
Providers & keys
Vendor presets: provider = "<vendor>" for embeddings and every LLM surface (OpenAI, Perplexity, DeepSeek, OpenRouter, Groq, Mistral, xAI, Together, Fireworks, Voyage, Jina, Cohere, Anthropic, Azure, NVIDIA, Cerebras, Hugging Face, DashScope, Zhipu, SiliconFlow, Moonshot, Volcengine, Ollama, LM Studio, vLLM, omlx), each with endpoint / key env / auth header / embedding encoding / batch defaults; vendors without an embeddings API are rejected for [embedding]. Per-surface keys: api_key_env, auth_header, disable_thinking; [ars.llm_judge].provider lets the judge use its own vendor. Secrets file: ~/.rein/secrets.env (600) read after the environment; `rein keys list
v1.4.2 (2026-10-17)
Maintenance
Session restore (#4): expired (300 s idle) and pre-restart Streamable HTTP sessions are re-created from a persistent store instead of 404; sidecar <db file name>.mcp-sessions-<bind>-<port>-<hash>.json (0600; 1024 entries / 16 KiB each / 4 MiB total); doctor mcp_session_store. rmcp 1.8: idle expiry logged at DEBUG. Portable MCP schemas: no $ref / oneOf / const / format, nullability kept as [x, "null"]; arguments repaired only after a rejected decode. Content-free logs: provider bodies, LLM output, memory and query text kept out of WARN / INFO. Deps: h2 / quinn-proto / rustls / chacha20 / react-router advisories closed. 1938 lib tests / 0 fail; clippy + fmt clean; 5 codex rounds + independent diff review.
v1.4.1 (2026-10-10)
Maintenance
Tantivy compaction: the staged rebuild uses one writer with automatic merges off and an explicit final merge (10,651 segments → 1, 63,733 files → 7, rebuild ~28 min → 15 s on a 10.6k-memory database); single inserts wait for their scheduled merges. Clean shutdown: warmup runs on a detached thread, so rein serve exits on SIGINT/SIGTERM mid-rebuild instead of waiting for the blocking pool. GUI feedback honesty: synthesis thumbs latch only after the server accepts the vote and show the refusal reason otherwise; Connectors renders the owner-only 401 as guidance. Doctor: no self-probe when /api/doctor is served by the GUI process; 2 s probe timeout. #[op]: literal REST paths validated at expansion time (compile-fail snapshot now pinned to the macro's own error). 1900 lib tests / 0 fail; clippy + fmt clean; 2 codex review rounds.
v1.4.0 (2026-09-04)
Runway automation
Pipeline observability: every adaptive stage is timed and persisted (adaptive_pipeline_last_run), surfaced by rein doctor, adaptive-status and a rein gc summary line; a killed run stays visible as running. A12 publish-on-drift: a calibration whose store moved mid-run is published as Complete carrying its build fingerprint instead of being discarded — the live resolver still refuses a stale generation on the input epoch. A12 LOO exclusion index: hash + posting lists reproduce extract::dedup::similarity exactly (randomized property test + real-database equivalence run); corpus build 2 h → 8 s. Vector durability: rein warmup backfills missing vec_memories rows, migrates the table atomically on a model change (staged, revalidated at publish, rows that raced the swap flagged for re-embedding), and a vec_rows_provenance stamp refuses mixed-model writes (rein warmup --trust-existing-vectors attests a legacy table). Claude Code prompt recall: [hooks.claude] with prompt_context_source = "recall" runs a local fast recall, emits RecallComplete and appends a rein_feedback attribution line; doctor claude_hooks, vector_provenance and adaptive_pipeline_last_run checks. config_version 4. 1887 lib tests / 0 fail; clippy + fmt clean; 26 adversarial review rounds.
v1.3.0 (2026-07-15)
Self-supervised activation
#A12 recall-fusion activation infrastructure (default fail-closed, shadow until promoted): leave-one-evidence-out calibration from structural families (canonical evidence / concept / episode), SHA-256 family-disjoint 5-fold split with a permanent activation holdout fold, side-effect-free recall_loo_trace, family-equal optimizer + paired top-3 McNemar holdout gate, sealed versioned calibration state + durable a12_input_epoch coherence (schema v4, 21 triggers, per-recall re-verification). Judge structural calibration: 4 deterministic probe kinds, per-surface versioned state, [ars.llm_judge.structural_anchors] (off | monitor | enforce, default off); zero human pairs never fabricates a human κ. #C2 dedup calibration safety: destructive lexical merges floored at the static threshold, exact one-sided Clopper-Pearson false-merge bound (zero-failure 2% @ 95% needs ≥ 149 sealed negatives → current n = 10 reports NoData). config_version 3; ars_parameter_policy schema 3. 1819 lib tests / 0 fail; 27 workspace suites green; clippy + fmt clean; 7 adversarial review rounds.
v1.0.0 (2026-05-31)
The 1.0 freeze + #A5 triple persistence
Stable-surface freeze: baseline schema frozen behind the migration framework (baseline_schema_is_frozen), 40 MCP tool arg-schemas pinned (mcp_tool_arg_surface_is_frozen), MSRV pinned to Rust 1.86 (CI msrv job; three is_multiple_of/1.87 uses replaced with %), config_version key + load-time downgrade guard, and a /v1/* REST versioned alias (header-token authed; GUI session cookie stays Path=/api). Headline feature: #A5 durable triple persistence — first real forward migration (memory_triples at schema v2) behind the default-off [dedup].persist_triples flag; default path bit-identical. 96 config fields documented. 1470 lib tests / 0 fail; clippy + fmt clean; agent-team audit clean (PII / correctness / hygiene / docs).
v0.38.0 (2026-05-30)
Schema-versioning foundation
A single global PRAGMA user_version counter + a fail-loud, atomic forward-migration framework (BASELINE_SCHEMA_VERSION + Migration{version,name,up} + ascending MIGRATIONS, empty at landing) replace the additive-only probe-then-ALTER bring-up — unlocking rename/type-change/drop migrations (prerequisite for triple persistence, the fact-layer refactor, and a v1.0 schema freeze). Every legacy ADD COLUMN reachable from bring-up fails loud on real errors (tolerating only the benign duplicate-column race); downgrade guard + resurrection-safety gating + in-lock double-checked migration apply. No new MCP tools; default recall/algorithm path bit-identical. 1710 tests / 0 fail / 7 ignored.
v0.37.0 (2026-05-30)
Algorithm + hooks
#A18 explicit negative feedback: rein_feedbackhelpful: false trains the M2 alpha optimizer + multi-dimensional shadow weights as a parameter-free symmetric negative sample (accessed memories ranked up, explicitly-unhelpful ones ranked down); recall held non-inferior on the eval gate. Hooks ingestion de-dup: identical content surfaced by multiple agents / hook sources is collapsed at the queue. #C2 dedup-threshold sweep re-confirmed; production threshold held pending live-traffic calibration. 1702 tests / 0 fail / 7 ignored.
v0.36.0 (2026-05-29)
Algorithm + performance pass
#P1 recall strong-signal fast-path: skip the KG + Supermemory fallback channels when a dominant BM25 hit survives every drop-filter and the local index alone satisfies the requested limit — deterministic, recall held non-inferior on the eval gate. #C2rein-eval gate sweep --gate dedup: data-driven precision/recall/F1 threshold sweep reporting a merge-safe (precision = 1.0) optimum. #C3 admission gray-zone corpus 6 → 10 fixtures, ≥ 0.07 edge margin, drift-guard test. #ablationrein-eval ablate: multi-arm bootstrap-CI ablation with paired deltas + significance, reproducible (seeded PRNG). 1692 tests / 0 fail / 7 ignored.
v0.33 → v0.35 (2026-05-28)
Eval-gate harness: foundation → full
The dedup / admission / latency gates moved from NoData stubs to working scorers with committed baselines + 20-fixture corpora per gate (v0.33.0/.1, v0.35.0). Trust & Measurement Phase 3 first slice: repair_advice + judge_drift_alert_total (v0.35.0). claude.ai remote-MCP polish: sliding session cookie + metadata JSON (v0.35.0). Bearer-auth migration: rein doctor WARN on the legacy loopback bool (v0.34.0) → load-time removal (v0.35.0).
v0.32.0 (2026-05-18)
Trust & Measurement Phase 2 — eval-gate harness
New eval::gates module: GateScorecard / Gate trait / compare_scorecards 8-rule pipeline (presence / schema / identity / kind / freshness / stub / duplicate-id / strict id-set + paired McNemar non-inferiority). Recall gate ships full-impl over a 20-fixture corpus seeded into hermetic in-memory SqliteStore per fixture (deterministic, no live LLM/embedding). The dedup / admission / latency gates ship as NoData stubs here (taken to full in v0.33–v0.35). New rein-eval gate {baseline,run,compare,status} CLI subcommand; rein_trust_measurement reads real scorecards; rein doctor surfaces stale baselines / Bail / mis-wired / corrupt as WARN. Reference baseline at docs/eval-baselines/recall.json (score = 1.000). 1647 tests / 0 fail / 5 ignored.
v0.31.4 (2026-05-17)
Attribution metadata
All maintainer attribution (Cargo authors, LICENSE / README / CONTRIBUTING copyright, DXT / plugin / marketplace manifests, git config user.name) switched to the maintainer's GitHub handle. Metadata-only patch, no source / behavior / test change.
v0.30.0: explicit [server].auth policy (loopback_only / bearer_required / oauth / public) and a single-user OAuth provider for Claude Cowork / claude.ai / mobile remote MCP — Authorization Server metadata, Dynamic Client Registration, Authorization Code + PKCE S256, refresh rotation, revocation, SQLite-backed clients/grants/signing keys, owner approval GUI, Connectors management UI, OAuth GC, doctor checks. Validated end-to-end via Cloudflare Quick Tunnel. v0.30.1: every /mcp 4xx ships as a JSON-RPC 2.0 error envelope so claude.ai surfaces real rejection reasons instead of opaque "An unknown error occurred"; rein doctoroauth_provider WARN on auth_policy = "oauth" + clients registered + no active grants. v0.30.2: P0 recall launch-failure fix — warmup B1 (sync Tantivy rebuild blocking recall) / B2 (destructive remove_dir_all) / B4 (cold-start unconditional rebuild) / B5 (.rebuilding lifecycle without recovery) chain producing user-visible "rein won't start" despite process-level boot succeeding. 23 codex audit rounds; 5 corner-case deferrals to v0.31.x.
v0.28.8 (2026-05-04)
v0.28.7 follow-up audit
17 codex review rounds (R1–R17) reaching 2-consecutive-clean saturation. 15 P2 + 1 P3 closed; 0 P1 throughout. Headline: M-8 cluster-bucket alignment — learn-time bucket resolution now prefers memory-id-remap against current memory_clusters (R13 fix for the M4-then-M2 pipeline order that invalidated cluster_version_at_recall for every event in the common path). L6 fallback preservation — learned_shadow_fusion LRU restricted to cluster-scoped buckets ({query_type}:{cluster_id} shape via is_cluster_scoped_bucket predicate), so the global + per-query-type fallback chain stays intact under high cardinality. ars_parameter_policy schema robustness — schema_version peek before typed deserialize (R8 fix for Corrupt mis-classification on future schemas), CAS predicate uses schema-aware COALESCE default (R8), > rather than != for future-schema preservation (R15), and repair_corrupt_parameter_policy wraps load+delete in BEGIN IMMEDIATE (R10 race fix). M-1 persistence-side — 4 new per-surface ars_effective_scalars keys (judge_sample_rate_{cold_start,warm}_{synthesis,concept_summary}) with one-time legacy fallback so the per-surface split lands without breaking downgrade compat. M-5 / M-6 rollback static threshold anchoring + outer simplex↔legacy blend by runtime_adoption_weight. Plus L1 sanitize_bootstrap_priors cap, L4 auth-policy regression locks for /api/trust-measurement + /api/ars-acceleration-gate, L5 doctor recovery, L7 release-gate test coverage. 1462 tests / 0 fail / 3 ignored / 0 clippy / 0 fmt. Default-OFF behavior bit-identical to v0.28.7.
v0.28.7 (2026-05-02)
v0.28 audit hardening
Closes 4 HIGH + 4 MED items from the 2026-05-02 v0.28 audit. H0 reverts [ars.llm_judge] + [ars.llm_judge.nightly_cron] defaults from true (v0.28.6) back to false in code AND embedded default.toml per the v0.28 charter Non-Goal "Do not make LLM judge default-on" — runtime LLM judge stays opt-in until v0.29 surface-policy gating. [ars.acceleration] stays true. H1bootstrap_priors_from_replay replay consumer guarded against the placeholder signal_hint producer (real producer deferred to v0.29) — consumer never advances against an empty source. H2apply_local_fixes performs a drift-triggered canary→shadow rollback: when judge_calibration_state.judge_drift_alert* is positive while the policy is in Canary, doctor refreshes the row to flip back to Shadow with runtime_adoption_weight = 0. H3 shadow route_context buckets isolated in a separate CONCEPT_SUMMARY_BY_CLUSTER_SHADOW_CAP = 4096 LRU; recall via the shadow path cannot evict production cache entries. M-1JudgeSurface threaded through 5 helpers + handlers for per-surface drift visibility (Synthesis vs ConceptSummary). M-2bootstrap_priors_from_replay watermark cutoff uses state watermark (D3 replay-idempotence). M-9DrainStats per-reason counters + tracing::warn on dropped cap + doctor judge_call_ledger saturation check. M-4 docs-only. 1419 tests / 0 fail / 3 ignored / 3 codex review --uncommitted rounds. M-1 persistence-side residual + LOW/NIT items deferred to v0.29.
v0.28.6 (2026-05-02)
ARS default-on + Trust & Measurement
Enables [ars.acceleration], runtime LLM judge, and nightly calibration by default while keeping runtime adoption fail-closed behind ars_parameter_policy; adds scoped adoption weights for recall fusion/query/cluster and scalar surfaces, keeps SignalHint feedback active outside shadow mode, exposes scoped weights in release-gate output, and adds rein_trust_measurement / rein trust-measurement / /api/trust-measurement.
v0.28.5 (2026-05-01)
Gradual ARS runtime adoption
Adds runtime_adoption_weight to ars_parameter_policy, moves the adoption weight by at most 0.05 per durable snapshot, and gates recall fusion, synthesis/concept gates, judge sample rates, LLM feedback decay, and SignalHint-derived useful-rate priors through that weight.
v0.28.4 (2026-05-01)
ARS acceleration full pass
Wires SignalHint/bootstrap priors into useful-rate formulas, persists smoothed dynamic scalars, splits judge drift by surface, makes judge input caps configurable, folds Cap A GUI feedback into real recall-context buckets while preserving synthetic judge alignment, adds a read-only release/eval gate, and adds shadow GP+EI fusion proposals.
v0.28.3 (2026-05-01)
ARS dynamic scalar expansion
Extends policy-gated dynamic adoption beyond recall fusion: synthesis/concept cold-start and useful-rate thresholds can move from static values toward calibrated feedback, judge sample rates adapt under the same policy gate, shadow judge jobs carry deterministic signal_hint evidence, and shadow replay evaluates blended simplex candidates instead of one-hot-only weights.
v0.28.2 (2026-05-01)
ARS dynamic parameter policy
Adds ars_parameter_policy metadata activation, trust-weighted static-to-learned fusion adoption, κ/drift-gated LLM judge weight_decay_rate, /api/adaptive policy status, and rein doctor policy health checks.
Default-off, shadow-first acceleration controller. [ars.acceleration].enabled = false by default; /api/adaptive exposes ars_acceleration.shadow_fusion_replay with bounded enabled, shadow_only, status, replay_limit, eligible_samples, min_samples, global, by_query_type, and by_cluster preview fields. Production recall scoring and ARS behavior were unchanged in this release.
v0.27.6 (2026-04-30)
Codex hook parity + deployment hardening
Adds Codex session-start, pre, and permission hook commands alongside existing post, compact, prompt, and stop; emits official hookSpecificOutput.additionalContext for opted-in session/prompt context; applies conservative deny-only shell guardrails; teaches rein init and rein doctor to configure and validate all six Codex events. Deployed to Mac mini with launchd zsh -l -c wrappers and Homebrew Rust toolchain.
5-agent disjoint-slice fan-out closed 1 CRIT + 8 HIGH + 9 MED + 5 LOW from a v0.27.3 audit, then 10 codex rounds drove P1 to 0. Headline: C1[server,proxy].allow_unauthenticated_loopback default flipped true → false; E2 M5 strip post-COMMIT side-index discipline; D1+D2 SHA-256-prefix synthetic cluster_id for Cap A bucket alignment. 1265 tests.
v0.27.3 (2026-04-28)
full-audit remediation
Closes the v0.27.0/.1/.2 implementation audit. Released to GitHub.
v0.27.2 (2026-04-27)
judge ledger / cache reaper
judge_call_ledger daily-cap reservation shared across runtime + cron (R9-K1); judge cache reaper; judge_model_override extractor swap; doctor judge checks.
v0.27.1 (2026-04-27)
E direction — runtime LLM judge
Opt-in via [ars.llm_judge].enabled = false. Hooks at synthesis (Cap B) and concept-summary (Cap A) mint time so MCP-only deployments still produce adaptive feedback without GUI dwell/click. 7-invariant judge contract J1-J7 (stamp-time payload, atomic reserve_call, worker-pull, cache rehydration). New MCP tools rein_judge_synthesis + rein_judge_concept_summary. [llm] config inheritance with provider = "inherit" sentinel.
8 HIGH + 8 MEDIUM from a user-driven Codex audit on v0.26.1, plus 16 audit-cycle additions across 11 follow-up codex review rounds. Auth default-deny via http_request_needs_auth(method, path, gui_enabled). Recall correctness with status-aware SQL filters + canonical-first preservation of superseded rows. apply_evolution side-index discipline. Backend↔GUI synthesis bucket round-trip. update() archival lifecycle clears archival_summary cols on semantic content change. 1002 tests.
v0.26.1 (2026-04-25)
D direction wiring fix + cold_archive eval
v0.26.0 hardcoded query_type = "Semantic" made the per-cluster gate dead code for 5 of 6 query types; fixed by routing real QueryType::synthesis_bucket_label() through MCP/CLI/REST. [ars].synthesis_cold_start_n config (default 10). rein-eval cold_archive {baseline,run,compare} subcommand.
v0.26.0 (2026-04-25)
ARS Cap C + D direction full vertical
Cap C cold-tier archival summary (rein_archive_summary_refresh MCP tool, slow-channel worker with 5-way CAS + 3-invariant lossless contract). D direction event-sourced loop: SynthesisInteraction event → synthesis_feedback M1 consumer → per-query adaptive synthesis-decision gate (decide_synthesize) surfaced via REST/MCP/GUI.
v0.25.x (2026-04-24/25)
ARS Cap B + Synthesis Lab
Opt-in recall-time LLM narrative synthesis: rein_recall extended with synthesize=true (no new MCP tool added). rein-eval synthesis McNemar harness. Synthesis Lab GUI page (/synthesis-lab) with editable evidence + dwell/click telemetry. v0.25.2 hybrid hit-checker (Snowball Porter2 stem + Gemini cosine fallback). v0.25.3 LLM-judged hit checker (REIN_EVAL_JUDGE=llm).
v0.24.0 (2026-04-24)
ARS Cap A — concept living-summary
Per-concept rolling LLM summary refreshed via L3 adaptive policy (revision_p75 + age_p50) + L4 concurrent CAS. Cross-cutting peek+commit refactor across 5 consumer offsets. New MCP tools rein_concept_state + rein_concept_summary_refresh. 819 tests.
LLM-driven canonical recompression at the 10 KB MergeInto cap (replaces v0.21 keep-tail truncation). Atomic apply_resummerize with 5-way CAS + 3-strike exhaustion fuse + 5-minute stale-claim takeover. Paired rein-eval McNemar non-inferiority test. 750 tests.
v0.22.0 (2026-04-22)
KG pool + service wiring + try_get fast-path
675 tests / 7 codex audit rounds.
v0.21.0 (2026-04-20)
A1 Operation Registry
#[op] proc-macro: each operation authored once in source, dispatched via inventory to thin CLI / MCP / REST adapters. Eliminated three parallel hand-maintained registries. 625 tests.
v0.32.0 keeps the v0.28.7 / v0.28.8 default surface unchanged: only [ars.acceleration] ships default-on (still fail-closed — learned parameters do not affect runtime until a healthy ars_parameter_policy promotes a canary with positive scoped adoption weights). The runtime LLM judge ([ars.llm_judge]) and its nightly_cron remain default-off per the v0.28 charter Non-Goal — operators must explicitly opt in (incurs LLM API spend). ARS content-generation features ([ars].concept_summary_enabled, recall_synthesis_enabled, cold_archive_enabled) and [resummerize].enabled remain operator-controlled. The new [server].auth policy added in v0.30.0 stays the explicit gate for HTTP/SSE exposure — loopback_only is the default, and remote-MCP deployments require an explicit choice between bearer_required, oauth, or public.
Architecture Diagrams
Memory Storage Flow
flowchart TD
A[Input text / tool output] --> B[hook_post or rein_store]
B --> C[LLM Extraction\nGemini Flash Lite / OMLX]
C -->|LLM unavailable| D[Rule-based fallback\ntopic · summary · keywords · importance]
C --> D2[postprocess\ndate detection · preference tagging]
D --> D2
D2 --> E{store_with_dedup\nBEGIN IMMEDIATE}
E -->|sim ≥ cluster_threshold A1| F[Provenance-preserving merge\nloser → evidence record]
E -->|sim in gray-zone| G[LLM dedup verdict\nasync dedup-queue]
E -->|new memory| H[INSERT memories]
H --> I[auto_link\nbidirectional related_ids]
I --> J[evolve\nknowledge evolution]
J --> K[HNSW + Tantivy index update\nfire-and-forget]
K --> L[needs_vec_dedup flag\nfor GC slow-channel embedding dedup]
F --> M[dedup_decisions ledger]
G --> M
Recall Pipeline
flowchart TD
Q[Query] --> CL[Query Classifier\n6 strategies · rule-based · 0 LLM calls]
CL -->|strategy + alpha| EX[Query Expansion\nGemini / OMLX → 2-3 variants]
EX --> P1[Channel 1: Tantivy BM25\nlocal · <1ms]
EX --> P2[Channel 2: HNSW vector\nlocal ~5ms / Gemini API ~255ms]
EX --> P3[Channel 3: KG FTS + BFS\nconcept land-and-expand]
P1 --> FU[RRF / CC Fusion\nlearned alpha M2]
P2 --> FU
P3 --> FU
FU --> TF[M5 Tier Filter\nCold excluded for non-Exploratory]
TF --> SW[Strength Weighting\nper-cluster KM curve M3 → global prior → Ebbinghaus]
SW --> RF[Multi-feature Rerank\n8 features · learned weights]
RF -->|optional| LR[LLM Reranker\nGemini / OMLX · strong-signal bypass]
RF --> CC[Canonical-first collapse\nevidence_preview attached]
LR --> CC
CC --> CV[Cross-validate\nSupermemory + auto-memory files]
CV --> RES[Final results\nconfidence 95%/85%/62% by source count]
rein talks to two kinds of model APIs: Google Gemini (provider = "google") and any OpenAI-compatible endpoint (provider = "<vendor>"). A vendor name carries defaults for the endpoint, the key's environment variable, the auth header and request quirks; every default can be overridden per section. rein providers vendors prints the built-in list (OpenAI, Perplexity, DeepSeek, OpenRouter, Groq, Mistral, xAI, Together, Fireworks, Voyage, Jina, Cohere, Anthropic, Azure, NVIDIA, Cerebras, Hugging Face, DashScope, Zhipu, SiliconFlow, Moonshot, Volcengine, Ollama, LM Studio, vLLM, omlx) with the chat / embeddings support of each. Vendors without an embeddings API (DeepSeek, Groq, xAI, Anthropic, …) are rejected for [embedding] at load time.
Keys are read, in order, from the process environment, then from rein's own ~/.rein/secrets.env (mode 600, written by rein keys set), then from a plaintext api_key = "…" in config.toml (works, but rein providers flags it). The secrets file is what launchd services and the rein serve processes started by Claude Desktop or Codex see, so it is the recommended place.
rein providers vendors # what you can pick
rein providers set embedding --provider perplexity --model pplx-embed-v1-4b --dimensions 2560
rein keys set PERPLEXITY_API_KEY --stdin < key.txt # or interactive hidden prompt
rein providers status --probe # calls each provider once
rein warmup --reembed-all # embedding model changed → re-embed
rein providers set judge --provider openrouter --model anthropic/claude-sonnet-4.5
rein keys set OPENROUTER_API_KEY
The same wiring is shown by rein status, rein config, GET /api/providers and the GUI's AI Keys page, always with masked keys; the page can reveal a key behind an eye toggle for the owner session only.
Equivalent TOML:
[embedding]
provider = "perplexity" # google | <vendor> | none
dimensions = 2560
[embedding.openai] # table name is "openai" (alias "omlx") for every OpenAI-compatible vendor
model = "pplx-embed-v1-4b"
# api_key_env = "PERPLEXITY_API_KEY" # vendor default
# send_dimensions = true # Matryoshka models
# query_input_type = "query" # asymmetric models (Voyage, Jina, NVIDIA)
# document_input_type = "document"
[ars.llm_judge]
provider = "openrouter" # judge-only provider; other surfaces untouched
[ars.llm_judge.openai]
model = "anthropic/claude-sonnet-4.5"
One embedding model is active per database; switching re-embeds everything (rein warmup --reembed-all), and the vec_rows_provenance stamp refuses mixed-model writes meanwhile.
PostToolUse -- local pattern extraction (crash safety net) + buffers for session-end batch processing
PreCompact -- records compact context for the async memory pipeline
Stop -- queues full knowledge extraction: memories + concepts + links + episode summary via async worker
UserPromptSubmit -- optional prompt-time context. Off by default; enable it in ~/.rein/config.toml:
[hooks.claude]
inject_prompt_context = true
# "working_set" (hook buffers, no database recall) or "recall"
# (local fast recall over the memory database: FTS / KG / cached vectors,
# no LLM calls). "recall" emits a RecallComplete event and ends the injected
# context with a `rein_feedback: request_id=... memory_ids=...` line so the
# agent can report which memories it actually used.
prompt_context_source = "recall"
max_additional_context_chars = 1200
rein doctor reports which of these hooks are installed (claude_hooks).
Hook Setup for Codex CLI
Codex CLI hooks require hooks = true (Codex 0.129+) and either ~/.codex/hooks.json
or inline [hooks] tables in ~/.codex/config.toml.
rein init now configures the Codex MCP entry and installs the Rein hooks:
The Codex hook payload differs from Claude Code's payload. Rein understands the
official Codex fields (hook_event_name, tool_input, tool_response,
prompt, last_assistant_message, and transcript_path). PostToolUse and
Stop feed the same async memory pipeline used by Claude Code hooks.
PreToolUse and PermissionRequest are deny-only guardrails. SessionStart
and UserPromptSubmit can emit official Codex additionalContext JSON when
explicitly enabled:
rein can run as a transparent HTTP proxy that records LLM conversations without modifying requests. This works with any agent that supports base URL override.
Quick Start
# 1. Start the proxy (background)
rein serve --proxy &
# 2. Use with your agent
ANTHROPIC_BASE_URL=http://127.0.0.1:8690 claude # Claude Code
codex -c 'model_providers.rein_proxy={ name = "Rein Proxy", base_url = "http://127.0.0.1:8690/v1", env_key = "OPENAI_API_KEY", wire_api = "responses", supports_websockets = false, env_http_headers = { "x-rein-token" = "REIN_PROXY_TOKEN" } }' -c 'model_provider="rein_proxy"'
Then: rein-proxy to start, claudep, codexp, codexsubp, or codexsubpws to use. For ChatGPT-login Codex, codexsubp remains the recommended loopback entrypoint; smoke it with ./scripts/smoke_codexsubp.sh. For the websocket-enabled path, use codexsubpws or ./scripts/smoke_codexsubp_ws.sh.
The codexsubp/codexsubpws provider overrides are generated from scripts/codexsubp_provider.toml.tmpl, which is the single source of truth for requires_openai_auth = true.
Codex CLI Config (alternative)
Configure Codex CLI permanently in ~/.codex/config.toml using a custom provider:
codexsubpws shell function or ./scripts/smoke_codexsubp_ws.sh
Same first-party routes, but starts with websocket transport and relies on local 426 fallback when needed
Cursor
Settings > Override OpenAI Base URL
OpenAI /v1/chat/completions
Windsurf
Settings > Custom API Endpoint
OpenAI /v1/chat/completions
Any OpenAI-compatible
OPENAI_BASE_URL=http://127.0.0.1:8690
OpenAI /v1/chat/completions
Note: Codex subscription/OAuth login proxying is not the same as the API-key Responses API proxy above. For API-key Codex, keep using codexp. For ChatGPT-login Codex, codexsubp is still the recommended loopback entrypoint today: it keeps requires_openai_auth = true, points chatgpt_base_url at the local rein proxy, and disables websocket transport so the first-party backend stays on the local record-only path. rein now also has an experimental websocket-enabled path (codexsubpws / smoke_codexsubp_ws.sh) that starts with websocket transport and relies on local 426 Upgrade Required fallback when upstream websocket is unavailable.
For ChatGPT-login Codex on loopback, codexsubp is the practical path today. It uses a custom provider with requires_openai_auth = true so Codex still uses ChatGPT login, but the provider itself points to the local rein proxy and disables websocket transport. chatgpt_base_url is also pointed at the local proxy so helper/discovery traffic (/wham/*, /connectors/*, /v1/agent/register, etc.) follows the same path. This keeps the subscription-login flow working
R
Rein
lyr1cs·10 bintang·
Multi-source cross-validated memory MCP server for AI agents (Rust, jieba CJK, local-first, AGPL)
Belum ada daftar tool. Server remote mendapatkannya setelah pemeriksaan kesehatan pertama.
FAQ
Pertanyaan
Bagaimana cara menginstal Rein?
Salin konfigurasi stdio untuk Cursor, Claude Desktop, Claude Code, atau VS Code di halaman ini. Konfigurasi ini memakai instalasi dari penerbit, bukan proxy PlugMCP.
Apakah Rein memerlukan kunci API?
Tidak ada variabel lingkungan wajib yang tercantum di catatan ini.
Transport apa yang digunakan Rein?
Rein berjalan secara lokal melalui stdio.
Kapan Rein terakhir diperiksa?
Terakhir diperiksa 2026-10-28. Multi-source cross-validated memory MCP server for AI agents (Rust, jieba CJK, local-first, AGPL)