Documentation
Last updated June 22, 2026
Quick start
Install Rhei, point it at a repo, and connect it to coding agents over MCP. Local mode works without an account: source, the local graph, reports, and memory stay on your machine.
Install
curl -fsS https://rhei.team/install | bashRequires macOS or Linux (Windows via WSL), git, and Bun, pnpm, or Node 18+ with npm. The installer fetches @rhei-team/rhei, registers detected MCP clients, runs the local smoke check, and starts indexing when available. Nothing about your code is sent during install.
Rhei is in closed beta. If package access is gated, the installer prints the account step after local setup.
First run
cd /path/to/your/repo
npx -y @rhei-team/rhei initRun this inside the repository you want Rhei to understand. The npx form always works, even when no global rhei binary is on your PATH. If you installed Rhei globally, rhei init is the same command.
Init does four things in one pass: registers detected MCP clients, verifies the MCP server can start, builds the local code map, and prints the exact next commands. Pro is separate and opt-in.
The command is intentionally repo-scoped. If you run it from your home folder, Documents, or another directory without .git or a project manifest, Rhei skips indexing and tells you to cd into the project.
rhei initMap the repo, build the local graph and index, connect MCP clients, run a smoke check.rhei statusLocal readiness: index state, graph coverage, configured launchers, version.rhei contextHuman-readable context scorecard: now, traces, memory, files, gaps, and connected work.rhei workspaceCross-index intelligence: register sibling repos, then search, reuse, and impact across all of them, locally.rhei doctorHealth-check MCP config, repo path, advertised tools, and local-mode invariants.rhei updateDry-run by default. Reports current vs. latest version and the exact next action.rhei update --yesApplies the update to allowlisted launcher config. Restart your MCP client after.rhei authOptional. Only needed for Pro features. Local mode never requires an account.If rhei is not on PATH, run the same commands as npx -y @rhei-team/rhei status, npx -y @rhei-team/rhei doctor, and so on.
How Rhei builds awareness
An agent decides what to do. Rhei gives it the awareness to do it right: the right code, the prior work, and the boundaries to stay inside.
Finds the right code
The right files and slices land in context, with the components worth reusing, not a pile of search hits.
Cleans as it goes
Dead code and duplication get flagged to remove. It is deterministic and local for TS and JS, and extends to your other languages on Pro.
Remembers and aligns
Prior fixes, decisions, and reusable work carry forward, so the next task starts aligned.
| An agent alone | On Rhei | |
|---|---|---|
| Find files | search hits | the right files and slices |
| The past | this session | git · goals · team memory · reuse |
| Boundaries | you hope | gates · receipts · checkpoints |
| Across repos | one at a time | cross-indexed |
The result: fewer tokens, fewer sub-agents, the right files faster, and a team moving in one direction.
Connect your agent
rhei init auto-registers Rhei with the MCP clients it finds, including Claude Code, Codex CLI, and Cursor. For any client it doesn't, point it at the CLI as a stdio MCP server:
# Claude Code
claude mcp add rhei -- rhei mcp
# any MCP client (stdio server config)
{ "command": "rhei", "args": ["mcp"] }After changing MCP config or updating Rhei, restart or reconnect the client. rhei doctor verifies the wiring end to end.
Then prompt your agent
Open your agent, point it at Rhei, and describe the change. The agent calls Rhei for context, edits, and proof:
Use the rhei MCP to find where upload rate limiting lives,
verify what is there, then add a limit to the upload route.Context CLI
rhei context is the shell view of what Rhei has learned locally. It does not send source anywhere and it does not replace MCP tool calls; it gives humans and shell agents a compact readout of the same loop: goal memory, context traces, validation refs, commits, PRs, and current git changes.
npx -y @rhei-team/rhei context
npx -y @rhei-team/rhei context graph
npx -y @rhei-team/rhei context statusline --plainUse it when you want to see what context Rhei would bring forward before asking an agent to act. Use rhei status for install and index readiness; use MCP tools like goal, context_builder, and read_file when the agent is doing the work.
rhei contextDefault Now card: current repo posture, recent work, memory, and context quality.rhei context changesShell-ready view of current git changes connected to recent goals, reads, and validation.rhei context graphConnected-work graph across goals, files, validation refs, commits, and PR evidence.rhei context filesFile-centric recall view: which files keep showing up, and where Rhei has evidence.rhei context gapsMissed-file view: files changed later that were not selected earlier.rhei context statusline --plainCompact hook-friendly line for prompts, terminals, and status bars.If rhei is on PATH, drop the npx -y @rhei-team/rhei prefix.
Analytics you can read from it
The scorecard is built from local traces and receipts. It answers practical questions a team asks after agents have worked in a repo: did the agent start with the right files, was the work checked, and which files keep being missed?
Example output
The default calendar is for humans: one glance at whether context quality is improving and whether proof is being recorded. The CLI renders a full 53-week year; the docs show a one-month excerpt so the pattern is readable on the page.
+ Rhei Context · 53w
* Recall 89% · 18 goals · 13 gaps
o Proof 12/18 validated · 8/18 measured
Jun
Mon . - + x #
Tue . - + x #
Wed . . + x #
Thu . - + + x
Fri . - + x #
Sat . . . . .
Sun . . . . -
. - + x # low->highThe file view is for follow-up work: it surfaces the files that repeatedly appear in goals, the misses attached to them, and the proof trail available for review.
Context Files · rhei · current
S Recall Gap Proof Goals Path
M #######- 2 3 2 route.ts
####---- 4 1 3 session.ts
?? -------- 1 0 1 uploads.md
recall = evidence projected onto files
source remains authorityThe output is advisory. Memory and traces can point Rhei toward useful files, but source, exact reads, validation, and receipts remain the authority for any code change.
Your first task
Once your agent is connected (see Connect your agent), give it a goal. Here is the loop it runs on a real change:
Gather context
Point the agent at a goal. Rhei selects the relevant files and slices, accounts for tokens, and reports what it left out. No blind whole-repo dump.
goal mode=context
goal: "add rate limiting to the upload route"→ context receipt · 6 files selected, 137 omitted
Verify before you touch
Prove what is and isn't there first. Verify runs scoped search and exact reads, then returns a coverage and absence-proof receipt, so the edit starts from evidence, not a guess.
goal mode=verify
query: "rate limit" scopePaths: ["src/upload"]→ absence proven · coverage high
Edit, gated
Edits preview by default and apply only when the write gates allow it, then Rhei reads the file back to confirm the change is durable.
apply_edits
path: src/upload/route.ts find: … replace: …→ applied_verified · durable readback · gated
Validate and keep the trail
Run the project's checks through the validation gate, then export the trail: what was selected, changed, and proven. The next session resumes from receipts, not a reconstructed transcript.
validate target: "bun run test"
goal mode=trail→ checks recorded · trail exported
Revert from receipts
Changed your mind? plan_revert reads the inverse edits the ledger captured at apply time — newest first — and hands back apply-ready ops. Feed them through the same write gate, so the revert is itself recorded; you can even revert a revert.
ledger op=plan_revert
goalId: "add rate limiting to the upload route"→ 2 ops ready · 0 skipped · report-only plan
Every step is one receipt in the run's trace. See Traces for what they hold and why.
Traces
Rhei records every flow as a trace: each tool call, goal, memory read, and edit, attributed and addressable by id. A receipt is one event; a trace is the whole run.
A trace is made of receipts. Here is one, from this page's own edit:
apply_edits applied_verified edit: applied 1/1 +14/-8 lines mode=search_replace readback: durable filesystem verified frontier gate: active (depth 3) authority: source writes / no production authority receipt: receipt:rhei-code-io:edit:c60dfb99313f
For the agent
It resumes from the trace instead of replaying a transcript. Fewer tokens, fewer sub-agents, and claims it can back.
For your team
A queryable record of every code-affecting decision: context seen, diff, validation, gate. Review and audit without re-reading.
For you
Check the pick, the diff, and the pass in seconds, instead of trusting a black box.
In local mode, traces stay on your machine, keyed by event id, so the record compounds: the next task resumes from it, reviews read it, and your own analytics and audits query it.
Memory
Agents usually forget everything when a session ends. Rhei carries the useful parts forward, so the next task starts where the last one left off. What it remembers stays useful without being mistaken for fact.
Remembers the work that matters
When a task gets solved, Rhei keeps the parts worth reusing: the goal, what changed, what was checked, and the decisions made along the way. It all stays searchable.
Brings it back at the right moment
Before an agent acts, it can pull up related past work. Memory comes back as a short, focused summary that shows where it came from and why it matched.
Leaves notes for next time
An agent can leave a quick note even when no files changed: a blocker it hit, a preference you stated, a follow-up task, or a decision worth keeping.
Warns without getting in the way
A note about something that went wrong warns future work about that one thing only. It never hides unrelated files or overrides good decisions.
Useful is never confused with true
Memory helps agents move faster, but on its own it is never treated as fact. Anything that becomes shared team knowledge, or changes your code, still goes through review and the same gates.
In local mode, memory stays private on your machine. On Pro, it can follow you across machines and repos, according to your team's data settings.
Tools
Agents see one consolidated public MCP surface instead of a pile of one-off utilities, grouped by intent:
read_fileExact file reads with line windows, token estimates, and baseline hashes.file_searchIndexed symbol, path, and literal search — tries the local SQL index first.get_file_treeBounded repo file tree for fast orientation.get_code_structurePer-file symbol and structure outline.graphStructural code graph: symbols and their relationships across the repo.goalOne stable entry point for an evolving task — context, verify, edit, trail, and continuity receipts, selected by mode.context_builderFast deterministic context pack: selected files and slices, token accounting, omitted candidates, and a ready-to-send brief.workspace_contextActive repo, process-local selection, recent context runs, and the next recommended call.connected_workBounded read-only recall of durable Chapter-connected work, prior evidence, and outcomes.manage_selectionProcess-local named refs and line slices with revision receipts; state expires on restart.apply_editsGated edits — apply by default when gates allow; use apply:false or previewOnly:true for preview, with durable readback after every write.file_actionsFile operations (create, move, delete) under the same write gates.gitWorking-tree status and diff, plus explicitly gated publish, revert, and PR creation flows.validateRun and record validation evidence; commands are skipped unless explicitly executed.indexIndex lifecycle and retrieval readiness.statusCurrent focus, next action, recent activity, and explicitly gated local updates.ledgerEvidence use, trust and symbol changes, history, and advisory revert plans.oracle_sendBuild and export oracle packets for an external, stronger model.oracle_utilsPassive oracle model and session helpers.Edits are gated and receipt-backed: previews by default, apply only when explicit gates allow it, and durable verification after every write.
How context is chosen
The same loop runs on every request: map, understand, retrieve, remember, prove.
- 1
It maps your repo
A live map of your code: files, symbols, and how they connect, across 20 languages, kept current as you work. Active code stays hot and close; quiet code stays cold and cheap.
- 2
It understands the ask
A symbol, an exact string, or a fuzzy intent. Rhei reads what you're after and looks the right way for each.
- 3
It brings the right files
Only the few that actually matter, with the tests that guard them and a read plan, packed to your token budget. Never a blind dump of the whole repo.
- 4
It remembers what works
Workspace memory learns from what your agents actually use: past fixes, decisions, and dead ends. The next task starts warmer, and useful is never confused with true.
- 5
It shows its work
Every answer comes with a receipt: what it picked, what it skipped, and why.
Local (Free) is tuned for codebases that fit your machine. Pro keeps the same understanding when they outgrow it.
| Local · Free | Pro | |
|---|---|---|
| Tuned for | repos that fit your machine | codebases that outgrow your laptop |
| Ranking | on-device | sharper when local can't decide |
| Search | names, patterns & local intent, across all repos | sharper, by meaning |
| Cleanup | TS & JS support only | Multi-language support (Python, Go, Rust & more) |
| Memory | private, on this machine | follows you across machines & repos |
| Footprint | many repos in a few GB of RAM | higher indexing limits, kept fast |
Local indexes many repos at once in a few GB of RAM. When one grows past what local search can separate cleanly, rhei status says so, with the reason, and Pro sharpens the cases it can't. You're nudged to upgrade only when you'd feel the difference, never before.
In practice, structural queries like callers, symbol lookup, and impact answer in milliseconds, often under one, even on a graph with 700k edges. Deeper analyses like dead code and reuse take around a tenth of a second, and barely grow as the codebase scales.
Data & updates
Local mode keeps source, the graph index, reports, and memory on your machine. Paid plans only send what your configured source-upload mode allows: never, metadata_only, or selected_slices. Rhei does not train models on customer code by default.
Full contracts: Data Use overview, Security, and Privacy Policy.
Updating
rhei update # dry-run: report current vs. latest
rhei update --yes # apply, then restart your MCP clientUpdate checks resolve against the published manifest at rhei.team/.well-known/rhei-mcp-update.json. Updates never touch your source.
Contact
Stuck or missing something? Email [email protected].
