Quickstart · Docs · Plugin protocol · Roadmap · Contributing · Changelog
Run the whole loop on the bundled fixture app →
Built from your code and your specs. Open source, one Rust binary.
Your specs say where the product should go. Your code says where it is. rahyab finds the way between them.
rahyab (راهیاب, rāh-yāb) is Persian for wayfinder, or path-finder. It reads your React + TypeScript frontend with tree-sitter and your Markdown journey specs, links the two, and keeps the result as a typed feature atlas in one SQLite file. From that atlas it answers three questions. What does the app actually ship? What do the specs promise that the code lacks, and the other way round? And what should this user, or this coding agent, do next?
It looks like a linter for your product. Under the hood: an AST-derived graph, anchor-first linking between docs and code, two small budget-capped LLM passes, and a planner that never calls a model.
Plan from the map, not from a guess.
| Step | Example | |
|---|---|---|
| 01 | Map the code | rahyab index → "12 files, 37 nodes, 40 edges in 74 ms. No model, no key." |
| 02 | Read the specs, link them | rahyab docs + rahyab reconcile → "22 spec ids, 6 test-id anchors. 170 pairs asked: 2 yes, 1 partial, 13 planned." |
| 03 | Find the way | rahyab next for a user, rahyab kickoff for a coding agent, rahyab check --ratchet for CI. |
Note
Status: pre-0.1, built in the open. Nothing is tagged or published yet: you build from source, and breaking changes will land until 0.1. Milestones M0 to M7 are done, M6's MCP server and Claude Code plugin among them. Each one is a spec in specs/, and all 87 of their executable acceptance gates passed at delivery. M9, a local web console, is specified and in delivery; M8 (a first host adapter, built in a host app's own repository) is planned. See the roadmap.
| Reads | React + TypeScript TSX · React Router v6 · data-testid |
Markdown specs frontmatter · spec ids · mermaid · test-id tables |
HTML through the example plugin |
| Asks | any OpenAI-compatible endpoint chat + embeddings · two offline passes and one opt-in · cached · budget-capped · optional |
||
| Extends with | Python | Node | Rust or anything that reads stdin |
| Feeds | your app card JSON · a TS union of node ids |
your CI gap report · ratchet exit codes |
your coding agents kickoff briefs · MCP tools · a Claude Code plugin |
If it reads a line of JSON and writes one back, it's a plugin.
Extractors for other frameworks, doc parsers for other spec formats, LLM providers, scorers and renderers plug in without touching the core. See the plugin protocol and the three example plugins.
- ✅ Your React app has outgrown anyone's head, and nobody can say for sure which specced features actually shipped
- ✅ You write journey specs in Markdown (requirement ids, flowcharts, test-id tables) and want them checked against the code instead of trusted
- ✅ Your frontend is React + TypeScript with React Router v6, and it puts
data-testidon things, or could - ✅ You run coding agents and want each one handed a precise brief (the one change, the
file:lineanchors, the acceptance) instead of a vague ticket - ✅ You want a "what should this user do next" card that never invents a step, with no LLM call at request time
- ✅ You want LLM spend that is estimated first, cached, and stopped by a hard USD cap, or no LLM at all
- ✅ You want CI to fail when the map goes stale
- ✅ Your stack is something else, and you are happy to write a plugin in the language you already use
A wayfinder needs four things: a map of the territory, the route someone meant to take, where the traveller stands, and directions they can act on. rahyab is built around those four.
| Pillar | Built for | What it covers |
|---|---|---|
| Atlas: what the code ships. Deterministic and file-complete. | Frontend developers | Routes (nested, index, pathless layouts, lazy() and dynamic import()) · redirects as navigates edges · nav gates · data-testids split into sections and actions · API calls with :param normalisation · the import graph · incremental re-index by content hash · every file parsed, or listed as unparsed with a reason |
| Journeys: what the specs promise. | Product owners and spec writers | Journey docs picked by a frontmatter marker · spec ids found by your own grammar · mermaid flowchart steps and edges · test-id tables as direct anchors · per-section fingerprints that report what changed and what was removed · anchor and LCEF linking · shipped / partial / undocumented classification · planned candidates for spec ids with no code |
| Wayfinding: where a user stands, and which way to go. | App developers | A state vector from a file or stdin · the frontier (shipped, unlocked, not yet done) · the shortest path to the journey goal · explainable score terms · hrefs bound from the user's own entity, never invented · card JSON · zero LLM |
| Agent briefs: every gap becomes a task an agent can finish. | Coding agents and their reviewers | Ten-section kickoffs with file:line anchors and BDD acceptance · the gap report in Markdown or JSON · check --ratchet for CI · a TypeScript union of node ids · nine MCP tools over stdio and HTTP · a Claude Code plugin with hooks, slash commands and a gap-fixer agent · installers for Codex, Cursor, a git hook and a GitHub Action |
Tree-sitter over your TSX: pages contain sections contain actions, plus links, API calls and gates. No LLM and no Node runtime, and your node_modules is never touched. Re-runs re-parse only what changed.
|
Markdown with frontmatter, spec ids in your own grammar, mermaid flowcharts and test-id tables become steps, edges and anchors. | A spec row that names a test id links to the code with no model at all, and the row is quoted verbatim as the evidence. |
| Where a model is needed, it answers yes, partial or no on one spec sentence against one small code slice. A "yes" whose quote is not in the spec is downgraded. |
rahyab estimate comes first and sends no request. Every call is cached by content hash, billed to a ledger, and stopped by a USD cap (exit 3).
|
Frontier, shortest path, and ranked candidates with their score terms and bound hrefs. Request time is pure graph work.
|
| One Markdown brief per node or planned candidate: goal, journey context, who is stuck, the one change, anchors, design guidance, constraints, BDD, smoke, done when. |
check --ratchet exits 2 when a literal test id in the .ts/.tsx sources names a section the atlas does not know, and 3 when the ledger is over budget. gaps --format json exits 2 on any gap.
|
export --ts writes an AtlasNodeId TypeScript union of every node, so a typo in a node id is a compile error in your app.
|
| Extractors, doc parsers, LLM providers, state sources, scorers, renderers: built in behind cargo features, or external over JSON-RPC on stdio, in any language. |
plugins scaffold writes a working skeleton in Python, Node or Rust. plugins doctor --conformance checks every reply against the protocol schema.
|
Every node records the plugin that made it and its file:line; every edge records its plugin. Every link records who decided it, anchor or LCEF, and the quote it rests on.
|
| Without rahyab | With rahyab |
|---|---|
| ❌ The specs say one thing, the code ships another, and nobody finds out until a user hits the gap. | ✅ rahyab gaps lists spec ids no code implements (planned_candidates), sections no spec mentions (undocumented_sections), and test ids a spec names that the code never renders (anchors_without_nodes). |
| ❌ You ask an LLM to "read the repo and map the features". It silently skips files and invents links. | ✅ Structure comes from the AST, and every file parses or is listed as unparsed. The model only answers yes, partial or no on one sentence against one slice, and it must quote the spec to say yes. |
| ❌ Onboarding nudges and "next step" hints are written by hand, and they rot as the product changes. | ✅ rahyab next derives them from the atlas and the user's done list: frontier, shortest path, ranked candidates. Re-index, and the nudges follow the code. |
| ❌ A coding agent gets "implement sharing" and spends its first hour rebuilding context. | ✅ rahyab kickoff writes the brief: the linked specs, what the step requires and what requires it, the predicate that proves it done, the page, the test ids, the file:line anchors, BDD acceptance and a smoke test. |
| ❌ An LLM pass over a large repo costs whatever it costs, and you find out afterwards. | ✅ rahyab estimate counts items and tokens before anything is sent. Every call is cached, billed to a ledger, and stopped by --budget-usd. |
| ❌ The map is right the day you draw it and stale a week later. | ✅ Indexing is incremental by content hash, and rahyab check --ratchet fails when the code names a section the atlas has not indexed. |
rahyab gets the boring parts exactly right.
| File-complete by construction. | Every file parses or is listed as unparsed with a reason (syntax_error, testid_shape, …). On one benchmark an LLM-built code graph missed 377 of 1,210 files that the AST graph found (arXiv 2601.08773); rahyab takes its structure from the AST. |
| Anchors before models. | A spec that names a test id links with no LLM. Every link cites an anchor that exists in the parsed graph, or it is a gap. |
| Quote-checked answers. | An LLM "yes" must carry a quote that appears in the spec text. An external filter downgrades it otherwise and records why. |
| No invented ids. | The planner binds /compose/:jobId to /compose/j1 from the user's entity. A route whose parameters the state cannot fill goes under unbound. |
| Explainable ranking. | Every card carries its score terms: impact, unblock, urgency, affinity, effort, fatigue. The weights live in your rahyab.toml. |
| Zero fallback. | A plugin reply that breaks the schema stops the run (exit 5, never retried). An invalid LLM answer is retried once, then recorded as a gap, never replaced by a default. |
| Plugins never write the store. | A plugin returns a batch; the core validates it and persists it with provenance. External plugins get a per-call timeout and a payload cap. |
| Domain-neutral core. | Nothing product-specific lives in crates/**. Your routes, id grammar, weights and guidance live in your rahyab.toml and your own plugins. |
The reasoning behind each choice, with the papers, is in docs/RESEARCH.md.
rahyab is a pipeline over plugins with a SQLite store in the middle, not a prompt wrapped around your repo.
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ your TSX │ │your specs │ │ a user's │ │ any LLM │
│ & routes │ │ Markdown │ │ state │ │ endpoint │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘
▼ ▼ ▼ ▼
┌──────────────────────────────────────────────────────────────┐
│ RAHYAB (one binary) │
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Atlas │ │ Journeys │ │ Anchor │ │ Classify │ │
│ │extract-ts │ │ docs-md │ │ linker │ │ & gaps │ │
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │Metered LLM│ │ LCEF │ │ Planner │ │ Renderers │ │
│ │cache · cap│ │ reconcile │ │ no LLM │ │ 6 kinds │ │
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Ratchet │ │ Store │ │ Plugin │ │MCP server │ │
│ │ check, CI │ │ SQLite │ │ host │ │stdio, HTTP│ │
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
└──────────────────────────────────────────────────────────────┘
▼ ▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ you │ │ CI │ │ your app │ │ coding │
│ gaps.md │ │ exit code │ │ card JSON │ │ agents │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
|
Atlas ( |
Journeys ( |
|
Anchor linker & classifier: runs after every |
Metered LLM ( |
|
LCEF reconciler ( |
Planner ( |
|
Renderers ( |
Ratchet & status: |
|
Store: one SQLite file per project at |
Plugin host: ten plugin kinds behind one registry. It loads the built-ins first, then the |
|
MCP server ( |
Integrations ( |
The ranking is explicit, so every card can explain itself:
score = (w1·impact + w2·unblock + w3·urgency) · affinity / (1 + α·effort) · exp(−λ·dismissals)
With the default weights (0.5, 0.3, 0.2, α = 0.5), the fixture's first card scores (0.5·1 + 0.3·1) · 1 / (1 + 0.5·4) = 0.267.
| Not a product-tour library. | rahyab renders nothing inside your app. next prints card JSON; your app decides what a card looks like. |
| Not an agent. | It does not run agents. It produces what agents run on: an atlas they can trust and a brief they can finish. |
| Not "ask an LLM about my repo". | The model never sees a whole file, never writes an id, and is never called when a user asks for the next step. |
| Not an analytics platform. | It collects no events. You hand it a user's state; it hands back candidates. |
| Not a graph database. | An atlas is thousands of nodes. SQLite and a few recursive queries are enough. |
| Not a test runner. | It reads your data-testids; it does not click them. A verify step that runs your own browser checks is planned. |
- Deterministic structure first; probabilistic reasoning only on small, pre-bound candidate sets.
- Every link between a spec and the code cites an anchor that exists in the parsed graph, or it is a gap.
- Nothing reaches an end user that the code does not ship. Planned candidates never become cards.
- Every LLM pass is estimated first, cached by content hash, and stopped by a budget.
- A domain-neutral core. Everything product-specific lives in the host repository's
rahyab.tomland its plugins.
Open source. Runs locally. No account, no service, and no API key for the tour. The first build takes a few minutes; after that, the whole loop on the bundled fixture app runs in seconds, with a deterministic local mock standing in for the model.
You need Rust 1.89 or newer and git.
git clone https://github.com/SourceShift/rahyab.git
cd rahyab
cargo install --path crates/cli --locked # puts the `rahyab` binary in ~/.cargo/bin
rahyab --version # rahyab 0.1.0Or install without a clone: cargo install --git https://github.com/SourceShift/rahyab rahyab-cli. You need the clone for the fixture app below. There is no crates.io release, prebuilt binary or Homebrew tap yet; they come with the first tagged release.
fixtures/react-app is a small React + React Router v6 app: 11 TypeScript and TSX files and one HTML page. It has test ids, a redirect, a gated nav and fetch calls, and two files that are broken on purpose. fixtures/specs holds three journey specs and one unstructured note.
The tour also needs Python 3, standard library only. It runs the fixture's example HTML plugin and the LLM mock. To skip the plugin, set RAHYAB_DISABLE_PLUGINS=html.
From the root of the clone:
cd fixtures/react-app
# 1 · structure: deterministic, no network, no key
rahyab index # files seen: 12 · nodes: 37 · edges: 40 · elapsed: 74 ms · 2 unparsed
rahyab docs # {"docs":4,"journey_docs":3,"specs":22,"spec_edges":15,"anchors":6,…}
rahyab predicates load predicates # {"loaded":3}: one SQL "done" check per node
# 2 · the two LLM passes, against the bundled OpenAI-shaped mock (optional)
python3 ../llm-mock/server.py 2>/dev/null & MOCK=$! # listens on 127.0.0.1:18791
export RAHYAB_MOCK_KEY=x # the fixture's rahyab.toml reads the key from this variable
rahyab estimate # items, tokens and USD of the next passes; sends nothing
rahyab summarize # {"sections":11,"called":11,…}: one purpose per section slice
rahyab reconcile # {"spec_ids":17,"pairs":170,…,"yes":2,"partial":1,"no":167,…,"planned_candidates":13,…}
# 3 · use the map
rahyab gaps # the gap report, in Markdown
rahyab next --state ../state/empty.json # a card for a user on /home who has done nothing
rahyab kickoff bookhq.share --state ../state/after-leads.json # → .rahyab/kickoff/bookhq.share.md
rahyab check --ratchet # ratchet ok
rahyab export --mermaid .rahyab/atlas.mmd --json .rahyab/atlas.json --ts .rahyab/atlasNodeIds.ts
kill $MOCK # stop the mockEvery number in the comments is real output of the current binary; timings vary by machine. The dollar figures come from the made-up prices in the fixture's rahyab.toml, and the mock itself costs nothing. Everything is written to fixtures/react-app/.rahyab/, which git ignores, so your clone stays clean. Delete that directory to start over.
Step 2 is optional. Skip it and step 3 still runs on the test-id anchors alone. The card then ranks two candidates instead of three, because only the model links home.hero to its spec.
The card next prints for the user who has done nothing (trimmed):
{
"page": "/home",
"candidates": [
{
"node_id": "bookhq.leads",
"route": "/book-hq",
"href": "/book-hq",
"path": ["bookhq.leads", "bookhq.share", "bookhq.publish", "settings.billing"],
"score": { "impact": 1.0, "unblock": 1.0, "urgency": 0.0, "affinity": 1.0,
"effort": 4.0, "fatigue": 1.0, "total": 0.26666666666666666 },
"evidence": { "links": [], "classification": "shipped" }
},
{ "node_id": "home.hero", "href": "/home",
"evidence": { "links": ["FX-01-R1"], "classification": "shipped" } },
{ "node_id": "compose.topic", "route": "/compose/:jobId", "href": "/compose/j1",
"params": { "jobId": "j1" } }
],
"unbound": []
}The path is the fixture's "first lead" journey, read straight from its mermaid flowchart. /compose/:jobId was bound to /compose/j1 from the user's own entity ("entity": {"jobId": "j1"}). Mark bookhq.leads as done (--state ../state/after-leads.json) and the top card moves to bookhq.share, scoring 0.42, on the page the user is already on.
What the other commands print
rahyab index builds the atlas without a model. No file is skipped silently: the two broken files are listed with a reason.
files seen: 12
files changed: 12
nodes: 37
edges: 40
api calls: 2
sections changed: 11
elapsed: 74 ms
unparsed: src/bad-testid.tsx (testid_shape)
unparsed: src/legacy/Broken.tsx (syntax_error)
rahyab reconcile asks 170 narrow questions: the 17 spec ids that have no link yet, each against the top k = 10 sections the embeddings rank closest. A spec id that already has a yes or partial link is never asked again, so a second run drops the three that the first run linked and asks about the other 14. The cache answers all 140 of those pairs:
{"spec_ids":14,"pairs":140,"called":0,"cached":140,"yes":0,"partial":0,"no":140,"filtered":0,"skipped_invalid":0,"skipped_http":0,"planned_candidates":13,"usd":0.0}rahyab gaps (excerpt) lists what does not line up. FX-03-R3 names a test id no code ships yet, so it is planned. landing.hero ships, but no spec describes it.
## planned_candidates
- FX-03-R3 · library-share-button · ../specs/fx-03-publish.md
- FX-01-AC1 · · ../specs/fx-01-discover.md
…
## undocumented_sections
- landing.hero
- legacy.broken
- stat.card
## anchors_without_nodes
- FX-03-R3 · library-share-button · ../specs/fx-03-publish.md
## requires_unresolved
- ../specs/fx-02-first-lead.md · FX_02_R5 · OUT1
- ../specs/fx-02-first-lead.md · IN1 · FX_02_R1rahyab kickoff bookhq.share writes a brief with ten fixed sections: Goal · Journey context · Who is stuck · The one change — do not deviate · Edits — anchors · Design guidance · Constraints · Acceptance (BDD) · Smoke · Done when. An excerpt:
## Journey context
- linked specs: FX-02-R3
- requires: bookhq.leads
- required by: bookhq.publish
## The one change — do not deviate
- page: `/book-hq`
- test ids: bookhq-share-copy-link
- api calls: /api/books
- api calls: /api/books/:id/publish
## Edits — anchors
- bookhq.leads — src/pages/BookHq.tsx:28
- bookhq.publish — src/pages/BookHq.tsx:44
- bookhq.share — src/pages/BookHq.tsx:38
…
## Done when
- the predicate of bookhq.share answers one row (book_shares.created_at)
- rahyab check --ratchet passes
- the atlas rebuild shows the node shippedThe goal line comes from a template; --llm-goal asks the metered model to write it. A spec id with no code gets a kickoff too, written from the spec alone: rahyab kickoff --candidate planned_candidate:FX-03-R3:library-share-button.
rahyab status --oneline fits in a prompt or a status bar: pages, sections and actions, links, open review rows, and the ledger.
rahyab: 11p/11s/15a · 8 links · 14 open · $0.1170034
cd your-app
rahyab init # writes rahyab.toml and .rahyab/, and adds .rahyab/ to .gitignorerahyab init writes only the project name. Tell rahyab where your code and specs are; the fixture's rahyab.toml is a complete working reference.
[project]
name = "my-app"
src = ["src"]
router = "react-router-v6"
routes_file = "src/App.tsx"
nav_config = { file = "src/nav.ts", symbol = "NAV_ITEMS", gate_field = "gate" } # optional
testid = { attr = "data-testid", separator = "-", levels = ["feature", "component", "element"] }
fetch_symbols = ["fetch"]
[docs]
globs = ["docs/journeys/*.md"]
journey_marker = { frontmatter = "tags", contains = "journey-spec" }
id_grammar = '\bJ-\d{2}-(R|AC)\d+\b'
testid_table_column = 1
[plan] # optional; these are the default weights
weights = { impact = 0.5, unblock = 0.3, urgency = 0.2, alpha = 0.5, lambda = 0.7 }
[llm] # only summarize, reconcile and kickoff --llm-goal use it
base_url = "https://api.example.com/v1" # any OpenAI-compatible endpoint
api_key_env = "MY_LLM_API_KEY" # the key is read from this variable, never stored
embeddings_model = "your-embedding-model"
[llm.passes]
section_purpose = "your-small-chat-model"
lcef_trace = "your-small-chat-model"
kickoff_goal = "your-small-chat-model"
[llm.prices.your-small-chat-model] # USD per million tokens: copy your provider's price table
input = 0.10
output = 0.40
[llm.prices.your-embedding-model]
input = 0.02
output = 0.0
[llm.budget]
init_usd = 5 # the cap when --budget-usd is not given
sync_usd = 1Model names and prices are placeholders. Every model a pass uses needs a price, so the ledger never holds a row without one; a missing price or cap is a configuration error (exit 4), not a guess. Every [project] key, including path aliases, lazy-route wrappers, redirect components and navigation hooks, is documented in docs/EXTRACT-TS-RULES.md, and docs/PLAN.md §10 has a full example. Then:
rahyab index && rahyab docs
rahyab estimate # what the passes will cost, before any request
rahyab summarize --budget-usd 1 # stops at the cap with exit 3 and keeps what it wrote
rahyab reconcile --budget-usd 2 --k 10
rahyab gaps
echo '{"user_id_hash":"u1","page":"/home","entity":{},"done":[],"blocked":[],"dismissed":{},"facts":{}}' \
| rahyab next --state - --k 3A journey spec is ordinary Markdown. A frontmatter tag marks it, your id grammar finds its requirement ids, a mermaid flowchart gives the order of the steps, and an optional test-id table links steps to code with no LLM. A shortened version of fixtures/specs/fx-02-first-lead.md:
---
tags: [journey-spec, fixture]
---
# FX-02 First lead
```mermaid
flowchart TD
FX_02_R1["Sign up and verify the email"]
FX_02_R3["Share the listing with the buyer"]
FX_02_R4["Publish a listing"]
FX_02_R1 --> FX_02_R3
FX_02_R3 --> FX_02_R4
```
- FX-02-R3 shares the listing of the seller with the buyer.
- FX-02-AC3 the seller shares a listing with a buyer.
| testid | requirement |
| --- | --- |
| `bookhq-share-copy-link` | FX-02-R3 |A user's state is a small JSON document that your backend or a script produces. No user data has to leave your systems: pass it as a file, or as - on standard input.
{ "user_id_hash": "u1", "page": "/book-hq", "entity": { "id": "b1", "jobId": "j1" },
"done": ["bookhq.leads"], "blocked": [], "dismissed": {}, "facts": {} }rahyab index && rahyab docs
rahyab check --ratchet # exit 2: a literal .ts/.tsx test id names a section the atlas does not know
# exit 3: the ledger is over budget
rahyab gaps --format json # exit 2 when any gap list has an entryEvery command uses the same exit codes:
| Code | Meaning |
|---|---|
0 |
ok |
1 |
any other failure, such as an I/O or SQLite error |
2 |
gaps found (gaps --format json), a stale atlas (check --ratchet), or a failed plugins doctor check |
3 |
budget exceeded |
4 |
configuration error, such as a missing key, price or cap |
5 |
plugin protocol error (never retried) |
64 |
the command is not implemented yet (watch, verify, and check without --ratchet) |
Write a plugin in Python, Node or Rust, and prove it against the protocol before rahyab ever runs it on your code:
cd your-app # a project with a rahyab.toml
rahyab plugins scaffold extractor my-extractor --lang python # writes plugins/my-extractor/main.py and registers it
rahyab plugins doctor my-extractor --conformance # calls every method of the kind, checks every reply
rahyab plugins list # the thirteen built-ins, then yoursmy-extractor
ok plugin.manifest protocol 1
ok my-extractor
ok extractor.supports
ok extractor.extract
The skeleton passes the conformance run of its kind as written, so you start from green and replace its answers with real ones. --lang takes rust, python or node, and --dir changes where the skeleton goes.
A plugin is a process that reads one JSON-RPC request per line on stdin and writes one answer per line on stdout. Its stderr is its own, for logs. Asked for its manifest, the example HTML plugin answers with this line:
{"jsonrpc":"2.0","id":1,"method":"plugin.manifest","params":{}}
{"jsonrpc": "2.0", "id": 1, "result": {"name": "html", "version": "0.1.0", "protocol_version": "1", "kinds": ["extractor"], "config_schema": null, "provenance_label": "html"}}- Register an executable you already have with
rahyab plugins add <name> --cmd "<argv>" --kinds extractor, or put it on yourPATHasrahyab-plugin-<name>.rahyab plugins remove <name>takes it out again and leaves the rest ofrahyab.tomlbyte for byte. - Schemas:
rahyab schemas export --out <dir>writes the JSON Schemas of the records and the protocol;schemas/conformance/holds the fixtures every plugin is tested against. - Trust: a plugin runs with your user's permissions. Treat adding one like adding a dependency.
The ten plugin kinds and their sixteen methods
| Kind | What it does | Built in today | Protocol methods |
|---|---|---|---|
extractor |
Source files become nodes, edges, API calls and slices | extract-ts |
extractor.supports · extractor.extract |
doc_parser |
Documents become spec ids, flow edges and anchors | docs-md |
doc_parser.supports · doc_parser.parse |
llm_provider |
Chat, embeddings and prices | llm-openai |
llm.chat · llm.embed · llm.price |
reconciler |
Links spec ids to nodes and classifies them | reconcile-lcef |
in process only |
state_source |
Produces one user's state vector | state-host |
state.state |
scorer |
Scores a candidate step | score-ev |
scorer.score |
renderer |
Writes artefacts: kickoffs, unions, atlas, cards, diagrams | render-all |
renderer.kinds · renderer.render |
verifier |
Checks navigates edges against the running app |
planned | verifier.verify |
integration |
Installs rahyab into an agent host | integ-claude · integ-codex · integ-cursor · integ-git · integ-gha |
integration.install |
server |
Serves the atlas over MCP and HTTP | mcp |
in process only |
Every external plugin also answers plugin.manifest, plugin.configure and plugin.doctor. The full reference is docs/PLUGIN-PROTOCOL.md (transport, handshake, methods, errors, discovery, conformance) and docs/PLUGIN-API-TYPES.md (the normative types).
Examples to copy:
| Example | Language | What it shows |
|---|---|---|
python-html-extractor |
Python, standard library only | An extractor for .html pages: sections, actions and navigates edges in under 300 lines. The fixture app uses it. |
node-echo-renderer |
Node 18+, no dependencies | A renderer of a new kind, echo-json, reached with rahyab export --kind echo-json --out echo.json |
rust-constant-scorer |
Rust, serde_json only |
A scorer that replaces score-ev |
bad-plugin |
Python | Six ways to break the protocol, and what the host does about each one |
The atlas is served to coding agents too: as a Claude Code plugin, as an MCP server any MCP client can start, and through installers for Codex, Cursor, a git hook and a GitHub Action. On your machine, each of them runs the rahyab binary on your PATH (see Install) and never downloads one.
Claude Code. Add this repository as a plugin marketplace, then install the plugin:
claude plugin marketplace add SourceShift/rahyab
claude plugin install rahyab@rahyabrahyab install claude runs those two commands for you (the install with -y, because the CLI blocks on a confirmation without a TTY), and --dry-run prints them without running them. The plugin brings:
- the
rahyabMCP server (rahyab serve --mcp) with the nine tools below; - three hooks:
UserPromptSubmitrunsrahyab prompt-hook,PostToolUseonEdit|Writerunsrahyab sync --quiet --hook, andSessionStartrunsrahyab status --onelineonly where arahyab.tomlexists; - five slash commands,
/rahyab:next,/rahyab:gaps,/rahyab:kickoff,/rahyab:syncand/rahyab:status, each telling Claude which tool to call with which arguments; - a
rahyabskill that knows which questions the atlas answers, and a gap-fixer agent that takes the path of one kickoff, implements it under your repository's rules and runs its smoke commands.
The plugin starts the rahyab on your PATH, or a binary you place at bin/rahyab inside the plugin; with neither, it exits 127 and prints the cargo install line. Outside a rahyab project all three hooks print nothing and exit 0.
Without the plugin system (--fallback, or on its own when the claude CLI is not on your PATH), rahyab install claude writes the wiring by hand: mcpServers.rahyab in ~/.claude.json, the three hooks in ~/.claude/settings.json, a short ~/.claude/RAHYAB.md of commands, and one @RAHYAB.md line in ~/.claude/CLAUDE.md. With --project <dir>, whether or not the CLI is present, it writes <dir>/.mcp.json and <dir>/.claude/settings.json instead of installing the plugin.
The hand-written prompt hook is plain rahyab prompt-hook, bounded by Claude Code's own "timeout": 5 on the hook, so it needs no coreutils. If you used the M6 fallback, delete its old timeout 5 rahyab prompt-hook 2>/dev/null || true and bare rahyab status --oneline entries from ~/.claude/settings.json and run rahyab install claude --fallback again: the installer adds the new hooks and never removes an old one.
The nine tools. Every tool answers one JSON object, and none of them calls a model.
| Tool | Arguments | Answers |
|---|---|---|
atlas_search |
query; optional kind, route, limit (20) |
{nodes}: the nodes whose id, title, route or test id contains query, in any case |
atlas_node |
id |
{node, edges, predicates, links, classification, witness} |
atlas_path |
from, to |
{path}: the shortest path over contains, navigates and requires edges |
atlas_gaps |
none | the rahyab gaps --format json report |
journey_next |
state_vector; optional page, k |
the rahyab next card |
kickoff_generate |
node_id; optional state_vector |
{file, markdown}, written under .rahyab/kickoff/, the same directory as rahyab kickoff |
atlas_sync |
optional paths |
the rahyab sync --json report |
atlas_status |
none | the rahyab status --json report |
plugins_list |
none | {plugins}, as rahyab plugins list --json prints them |
Any MCP client, or plain HTTP.
rahyab serve --mcp # MCP over stdio, for the project in the current directory
rahyab serve --mcp --cwd path/to/your-app # … or for the project in another directory
rahyab serve --http 127.0.0.1:7849 # streamable MCP at /mcp, a JSON mirror at POST /v1/<tool>, GET /healthThe mirror takes the arguments of the tool as the request body. With rahyab serve --http 127.0.0.1:7849 running in fixtures/react-app after the tour above:
curl -s -X POST http://127.0.0.1:7849/v1/atlas_path -H 'content-type: application/json' \
-d '{"from":"route:/book-hq","to":"bookhq.share.copy-link"}'{"path":[{"edge_kind":null,"node_id":"route:/book-hq"},{"edge_kind":"contains","node_id":"bookhq.share"},{"edge_kind":"contains","node_id":"bookhq.share.copy-link"}]}POST /v1/journey_next with {"state_vector": …} answers the same card as rahyab next. A failed call answers {"error": "…"} with 400 (arguments that do not fit), 404 (an unknown tool or node) or 500. A port that is already taken exits 4 with cannot bind.
The other installers.
| Target | Run | What it writes |
|---|---|---|
codex |
rahyab install codex |
[mcp_servers.rahyab] in ~/.codex/config.toml; with --project <dir>, a fenced rahyab block in <dir>/AGENTS.md instead |
cursor |
rahyab install cursor --project <dir> |
mcpServers.rahyab in <dir>/.cursor/mcp.json, and the rule <dir>/.cursor/rules/rahyab.mdc |
git-hook |
rahyab install git-hook --project <dir> |
rahyab check --ratchet in .husky/pre-commit when .husky/ exists, else in .git/hooks/pre-commit (created executable; an existing hook is made executable, and a mode that is executable already is kept) |
github-action |
rahyab install github-action --project <dir> |
.github/workflows/rahyab.yml, which calls the composite action/ on every pull request and every push to main. The action's steps are index, docs, summarize and reconcile --budget-usd when rahyab.toml has an [llm] table (otherwise each is skipped with one line), the gap report into the job summary and check --ratchet |
Every installer prints one line per step (created, appended, skipped or command); --json prints the report as JSON, and --dry-run prints it and writes nothing. A second run reports skipped for the work the first one did. Without --project, cursor, git-hook and github-action exit 4; an unknown target exits 4 and lists the five it knows.
The generated workflow pins uses: SourceShift/rahyab/action@v0, and nothing is tagged yet, so point it at a branch or a commit of this repository until the first release. The action runs cargo install when rahyab is not on the runner, and summarize and reconcile read their key from the variable your [llm].api_key_env names: set it from a secret.
The two hooks, by hand. Both read the JSON a Claude Code hook gets on stdin, and neither ever fails a prompt or an edit. On the fixture app:
printf '{"prompt":"what should the user do on /book-hq"}' | rahyab prompt-hookrahyab context:
bookhq.leads · /book-hq · shipped · Do it
bookhq.publish · /book-hq · shipped · Do it
bookhq.share · /book-hq · shipped · Do it
stat.card · /book-hq · undocumented · Do it
A route in the prompt names the sections of its page, and a node id, a test id or a spec id names its nodes: at most five lines of <node_id> · <route> · <classification> · <cta_key>. A prompt that names nothing, or input that is not JSON, prints nothing and exits 0.
rahyab sync --hook reads the PostToolUse input and re-reads only the edited file: index --paths <file> for a file under [project].src, docs --paths <file> for one that matches [docs].globs, and nothing for any other file. Plain rahyab sync is an incremental index and docs with no model call, printed as {"index": …, "docs": …}. rahyab docs --paths <file>… re-parses only the documents it names; a path no [docs].globs entry matches exits 4.
rahyab watch and rahyab verify are still stubs: they print not implemented yet and exit 64.
Q: Can I use this in production today?
A: Not yet. rahyab is pre-0.1: nothing is tagged, and the store, the config and the plugin API may still break. What exists is tested. Every finished milestone passed a spec of executable acceptance gates in specs/, and CI runs fmt, clippy, the test suite and cargo deny on every push to main and on every pull request. Try it, file issues, write a plugin.
Q: What does a typical setup look like?
A: One binary, run inside your app's repository. Run rahyab index on every merge (it only re-parses what changed), rahyab docs and rahyab reconcile when the specs change, rahyab check --ratchet in CI, and rahyab kickoff whenever someone, human or agent, picks up a gap. Your backend gets a card by piping a state vector into rahyab next --state -, or from rahyab serve --http, which answers the same card at POST /v1/journey_next and as the journey_next MCP tool. Coding agents reach the atlas through the Claude Code plugin or rahyab install <target>.
Q: Which frameworks does it read?
A: Today, TypeScript and TSX with React Router v6 JSX routes; any other router value is a configuration error. Anything else is a plugin away: the python-html-extractor example indexes plain .html files into the same atlas, with provenance. More routers are on the roadmap.
Q: Do I need an LLM?
A: No. index, docs, sync, gaps, next, kickoff (without --llm-goal), check, export, status, prompt-hook and every tool of serve make no model call, and specs with test-id tables link to the code with no model at all. summarize and reconcile add section purposes and links for the prose that anchors cannot reach. estimate reads the prices in your [llm] table but sends nothing. To try the model passes without a key, use the bundled mock. The GitHub Action runs its summarize and reconcile steps only when rahyab.toml has an [llm] table, and skips them otherwise.
Q: Does my code leave my machine?
A: Only if you run summarize, reconcile or kickoff --llm-goal. Those talk to the endpoint you configure, and they send small slices (labels, aria text, test ids, handler names, fetch paths) and spec sentences, never whole files. The API key is read from the environment variable your config names and is never stored. Details are in SECURITY.md.
Q: How fast is it, and what does the LLM part cost?
A: On a 3,470-file production React + TypeScript app, rahyab index built 10,752 nodes in about 9 s, and 1,830 sections were summarised for about $0.10 with a flash-lite model through an OpenAI-compatible endpoint. Run rahyab estimate first: it prints exact item counts and token estimates of the next run without sending anything. Re-runs only pay for what changed. The cost model is in docs/RESEARCH.md.
Q: How does rahyab know what a user has already done?
A: You tell it. next reads a state vector (page, entity, done, blocked, dismissed, facts) from a file or stdin, so no user data has to leave your backend. rahyab predicates load <dir> stores one SQL check per node (with -- node: and -- evidence: headers), and kickoffs quote it under "Who is stuck". Evaluating those predicates against your live database is planned for M8, the first host adapter.
Q: How is this different from asking Claude Code or Cursor to map my app?
A: Those agents are the consumers. Asked to map a repository, a model skips files and invents links; asked to act on its own, it over-triggers and drops parameters (the best end-to-end score in one study was 40 %, arXiv 2510.19771). rahyab gives agents a file-complete map derived from the AST and a precise brief, so they don't rebuild the structure every session or guess at links. Through the MCP server they query the atlas (atlas_search, atlas_node, atlas_gaps, journey_next) instead of reading files, and in Claude Code the prompt hook adds the nodes a prompt names to its context before the agent starts.
Q: Will there be a UI?
A: rahyab prints cards as JSON, and your app decides how to render them for its users. A local web console (React) for the people building the app is M9, now in delivery: rahyab ui serves it on loopback from your repository. It opens on an inbox of what needs a decision (links to review, gaps, budget alerts) and covers seventeen journeys, from a first init to the CI ratchet: browse the atlas and the journey maps, review spec-to-code links and planned candidates, preview next-step cards for any user state, run enrichment behind a cost gate, and open kickoffs. The spec is specs/m9/ and the design is docs/UI.md. Inside your app nothing changes: rahyab still renders no UI for your users.
Q: Why Rust, and why one binary?
A: Tree-sitter parses a large TSX codebase in seconds, a static binary needs no Node runtime in CI and never touches your node_modules, and SQLite and TLS are compiled in. Plugins still run in whatever language you like.
Q: Why "rahyab"?
A: راهیاب (rāh-yāb) is Persian for wayfinder or path-finder: rāh "path" + yāb "finder". A wayfinder tells a traveller two things: where they are, and which way to go. rahyab does the same for the people using your product and for the agents building it.
cargo build --workspace
cargo test --workspace # no network: fixtures and the deterministic LLM mock
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all --check
cargo deny check # licence, advisory and source policy (deny.toml)
make check # fmt + clippy + test: CI's first job (cargo deny is the second)
make tools # pinned TypeScript for the fixture's compile check (npm)A scale check you can reproduce. The generator writes a 120-page, 1,800-section app with its own rahyab.toml, which indexes into 3,722 nodes in about 0.7 s on a release build:
python3 fixtures/gen-large-app.py --out /tmp/big-app
cd /tmp/big-app && rahyab indexcrates/plugin-api plugin traits, typed records, JSON Schemas: the only public API
crates/core SQLite store, registry, config, metered LLM, linker, classifier, external-plugin host
crates/extract-ts built-in extractor (tree-sitter TS/TSX)
crates/docs-md built-in doc parser (Markdown specs)
crates/llm-openai built-in provider (any OpenAI-compatible endpoint)
crates/reconcile-lcef built-in reconciler
crates/plan state-host, score-ev and the planner
crates/render card-json, kickoff-md, gaps-md, atlas-json, ts-union, mermaid
crates/mcp the MCP server: nine tools over stdio and streamable HTTP, and the JSON mirror
crates/integrations install targets: claude, codex, cursor, git-hook, github-action
crates/cli the rahyab binary
plugins/claude-code/ the Claude Code plugin: MCP config, hooks, skill, slash commands, gap-fixer agent
.claude-plugin/ the marketplace manifest that lists the plugin
action/ the composite GitHub Action the github-action target points at
examples/plugins/ one external plugin each in Python, Node and Rust, plus a broken one
fixtures/ the React fixture app, journey specs, user states, the LLM mock, the large-app generator
schemas/ JSON Schemas of the plugin protocol and the conformance fixtures
specs/ one spec per milestone, with executable acceptance gates
Read next: docs/PLAN.md (architecture, commands, data model, milestones) · docs/PLUGIN-API-TYPES.md (normative types) · docs/PLUGIN-PROTOCOL.md (the wire protocol) · docs/EXTRACT-TS-RULES.md (extraction rules and every [project] key) · docs/RESEARCH.md (why deterministic-first, with arXiv sources and the cost model).
docs/PLAN.md is the v0.2 plan, written before delivery, and parts of it have drifted. Where it differs from a milestone spec, the spec is the contract: §9's integrations and MCP tool table, for example, are superseded by specs/m6/ and by this README.
- ✅ M0 · Plugin API, SQLite store, plugin registry, CLI skeleton,
init,status,schemas export - ✅ M1 ·
extract-ts: routes, redirects, nav gates, test ids, API calls, import graph, incrementalindex - ✅ M2 ·
docs-md: journey specs, id grammar, mermaid flowcharts, test-id tables, section fingerprints - ✅ M3 · Anchor linking, renderers,
gaps,check --ratchet,export - ✅ M4 · OpenAI-compatible provider, LCEF reconciliation, cache, ledger, budget cap,
estimate,summarize,reconcile - ✅ M5 · Planner,
next, card JSON,predicates load, agent kickoffs - ✅ M6 · MCP server (
serve --mcp,serve --httpwith a JSON mirror), the Claude Code plugin,installfor Claude Code, Codex, Cursor, a git hook and a GitHub Action,sync --hook,prompt-hook,docs --paths - ✅ M7 · External plugin protocol (JSON-RPC over stdio),
plugins add / remove / doctor / scaffold, three example plugins - ⚪ M8 · A first host adapter, built in a host app's own repository: its
rahyab.toml, a host state source that evaluates the SQL predicates against its database, a verify script and a CI job. Evaluating predicates moved here from M5; nothing in this repository changes. - 🟡 M9 · Local web console (
rahyab ui, React) for seventeen journeys: review inbox, atlas, journey maps, gaps, next-step cards, cost-gated enrichment, kickoffs (spec, design) - ⚪
verify: run your own browser checks overnavigatesedges, and classify what fails asbroken - ⚪
watch: re-index on every change - ⚪ More routers and frameworks as extractor plugins
- ⚪ First tagged release: prebuilt binaries, a Homebrew tap, crates.io
M0 to M8 are listed with their acceptance summaries in docs/PLAN.md §11, and M0 to M7 and M9 each have a spec with executable gates in specs/; verify, watch, more routers and the first tagged release are not specified yet. What changed and when is in CHANGELOG.md.
We welcome contributions: code, plugins, fixtures, docs and bug reports. rahyab is small, early and specified in the open, which makes this a good time to shape it. Read the contributing guide first. docs/PLAN.md is the map, the milestone specs in specs/ are the contract for each piece, and docs/PLUGIN-API-TYPES.md is the normative type reference.
The ground rules, in short:
- Everything is a plugin. A new capability lands as a plugin (built in behind a cargo feature, or external over the protocol), never as a special case in the core.
- Domain-neutral core. Would it help someone building a different product? If not, it belongs in your
rahyab.tomlor your own plugin. - Zero fallback. A function that cannot meet its contract returns an error; no silent defaults.
- No network in tests. Use the fixtures and the deterministic LLM mock.
Ways in, from the quickest:
- Run it on your app and report what it got wrong with the bug report template. It asks for the spec criterion or plan section the behaviour breaks.
- Write a plugin. You need no Rust and no change to the core, and the conformance run tells you when you are done.
- Wire the milestone gates into CI. CI runs fmt, clippy, the tests and
cargo deny; the bash gates at the end of each spec were run at delivery but are not part of CI yet. - Try the agent integrations. Install the Claude Code plugin, or run
rahyab installfor Codex, Cursor, a git hook or a GitHub Action, and report what your host did with it. The contract isspecs/m6/. - Pick up
watchorverify. Both are stubs that exit 64, and neither has a spec yet; propose one on an issue first. - Fix the docs. When the docs and the binary disagree, that is a bug.
Plugins we would love to see. None of these exist yet, and each is a self-contained project that needs no change to the core. Open a feature or plugin idea first, so two people don't build the same one.
- Extractors for Vue single-file components, Svelte, Angular templates, or a router
extract-tsdoes not read yet - Doc parsers for Gherkin features, AsciiDoc, or your wiki's export format
- LLM providers for native, non-OpenAI-shaped APIs or a local model server
- State sources that read a user's progress from your own data
- Renderers for your design system's card component, or your issue tracker's import format
- Verifiers that drive a browser and check that every
navigatesedge lands where the atlas says
The workflow: open or pick an issue, fork and branch, implement with tests, use conventional commit messages (feat(extract-ts): …, fix(core): …, docs: …), and open a pull request that links the spec or plan section it serves. The pull request template carries the checklist; CI enforces its fmt, clippy, test and cargo deny items, and reviewers check the rest.
- GitHub Issues: bugs, feature requests and plugin ideas, each with a template
- Pull requests: fixes, plugins, fixtures, docs
- Example plugins:
python-html-extractor,node-echo-rendererandrust-constant-scorer, each passing the conformance run - Code of Conduct: Contributor Covenant 2.1
- Security policy: report vulnerabilities privately through GitHub's "Report a vulnerability" on the Security tab, never in a public issue
Built a plugin? Open an issue so it can be listed here.
Dual-licensed under MIT OR Apache-2.0, at your option: see LICENSE-MIT and LICENSE-APACHE. Every dependency must carry a licence on the deny.toml allow-list, and CI enforces it. Contributions are accepted under the same terms, with no additional conditions.
MIT OR Apache-2.0 © 2026 SourceShift AI Labs and the rahyab contributors
Open source under MIT OR Apache-2.0. راهیاب: for teams who want their specs and their code to agree, and the next step found, not guessed.