Repository navigation
Replies: 1 comment
|
Implementation plan is up as a docs PR, written for whoever implements it: #1376 (file: docs/CORPUS_HUB_V2_IMPLEMENTATION.md). It fixes what the discussion left open: a new Two defaults are encoded as proposed above (hosted off inside git repositories, automatic pull up to 50 MB); change them in the PR if you want different ones. |
Uh oh!
There was an error while loading. Please reload this page.
What we learned
We measured the hub the way an agent meets it: start from llms.txt, nothing installed. It works, every agent found and used it. But it costs about twice what a normal agent pays to
git cloneand grep, because the hub ships a JSON pointer and the laptop does the cloning and the indexing. Nine to twelve steps where grep needs two. Numbers at the end.Target experience
One line. No corpus names, no install steps, no indexing.
First time: answered through the hosted hub right away, while the pack for that corpus downloads in the background. Every time after: local, under a second, works offline. The corpus is never named in the question and always named in the answer.
For agents without a shell the same thing is one MCP tool call.
What ships
Not JSON manifests. Pre-indexed packs: the engine's own segment bundles with ranking, plus a definitions table, built once in CI per corpus, signed, pulled on demand, never re-indexed on the laptop. The registry stays a git branch of manifests, because that is what makes pins reviewable; the packs are built from it.
Development plan
Each step says what to build and when it is done. Do them in order.
Step 1. Hosted hub node and remote MCP
GET /api/v1/catalogue.jsonGET /api/v1/def/{slug}/{symbol}GET /api/v1/code/{slug}?q=&k=&max_tokens=GET /api/v1/search?q=&k=across all corpora, results grouped by corpuscorpus, pin_sha, pin_date, age_days, licence, file, line, text, value, score, truncated.xerj_hub_find,xerj_hub_def,xerj_hub_code.curlreturns file, line, value and pin for an exact symbol in any live corpus; the MCP tool list shows the three tools; p95 under 500 ms on the reference machine.Step 2. Packs
corpus addat the pin,corpus indexinto a builder node, export the index as the engine's bundle format (segments/*.bundle,snapshot.json,meta/with schema and mapping), extractdefs.jsonl,files.jsonl,sections.jsonl, writepack.json(slug, pin_sha, pin_date, builder_version, format_version 1, byte and record counts),SHA256SUMS, ed25519 signature.pack-<slug>-<pin8>.tar.zstwith the signature beside it. Same path pack-publish uses today.xerj corpus pull <slug>: read the catalogue, resolve the latest pin, download, verify signature and checksums before opening anything, hydrate into the data directory through the bundle hydrate path, register the corpus so queries see it.xerj corpus pull lz4then one def query gives the same answer as the hosted node, with no clone and nocorpus index; a pack with one changed byte is refused.Step 3. Definitions table
symbol, kind, lang, file, line, text, value(value for constants and macros). For prose corpora one line per section:heading, file, line_start, line_end.defendpoint and the local--defmode. A symbol found in several corpora returns all of them, each with its corpus and file.Step 4. Catalogue
slug, domain, topics, ask_for, pin_sha, pin_date, licence_class, pack_bytes, pack_url, sig_url, refresh_cadence, quality_grade, dependency_names[], term_sketch(Bloom filter over identifiers, base64). Signed.~/.xerj/hub/catalogue.json, refreshes with an ETag at most once a day and onxerj hub sync.Step 5. The router and
xerj "<question>"Cargo.lock,package.json,go.mod,requirements.txt,pyproject.toml→ dependency names →dependency_namesin the catalogue); then hosted federated search when online and allowed; then the local term sketches.xerj hub pull <slug>with the size; adapt-with-attribution pulls silently, approach-only pulls with a warning line, excluded never pulls; disk budget 4 GB, least recently used pruned.~/.xerj/hub/.--corpus,--offline,--no-fetch,--hosted=on|off|auto,--def,--how,--files,--max-tokens,--json.Step 6. Lockfile and freshness
xerj.lockin the project root records corpora and pins;xerj hub updateshows the diff; every answer records the pin it used.Step 7. Background sync, status, privacy
xerj hub syncon a user timer: refresh the catalogue, pull newer pins for cached packs, verify, prune to budget.xerj hub statuslists cached packs, sizes, ages, last sync, hosted on or off.Step 8. Docs, skill, MCP registration
xerj initinstalls the hub skill. Copy prompts on hub pages become the one line.Step 9. Measure before publishing anything
Do not
Where this saves tokens, from the measurement
Fifty questions, five corpora, same model, 2026-10-13:
Where the hub's cost went: each turn re-reads about 28,000 tokens of the agent's own context; the hub route took nine to twelve turns per session (read docs, install, start a node, fetch manifest, add, index, query, stop). The hub's answers themselves were about 600 tokens per session.
With the one-line design, as the agent: no docs to read (5,000 tokens gone), no install, node, add or index turns (seven turns gone), one call per question returning 50 to 300 tokens instead of raw grep output. Steady state is one turn per question. Against fetching web pages, where one page is thousands of tokens and may not load at all, the difference is larger. The one case it will not win is an exact symbol in a small public repo that a hosted regex search already answers in one call; the benchmark keeps that case as the honest control.
Two decisions
All reactions