Elffuss BraidHub

utopia-ia/elffuss public

cfebc45fb327 · 11.7 KiBSourceRawPermalink

✳ Elffuss — core

The shared runtime behind three agents that run entirely in your browser.

No build step, no backend, no install — ES modules served exactly as written. Its centrepiece is the part that decides what an agent still remembers once the history stops fitting.

License No build Runs in

Claw · Code · Translator · elffuss.com


In this repository: architecture · the context manager · what was measured · what is honest about this · what is in core/


Every number below is reproducible with one command, against this repository's own source:

node bench/run.mjs --root core --ext .js --seeds 8

No API key, no model, no network, nothing to configure. That is the whole difference between this and a README full of figures nobody can check.


How it fits together

Architecture of Elffuss: one shared core, three products, everything inside the browser tab

Three products share one core, and the whole thing runs inside the tab. There is no server of ours in the picture — not because the traffic is encrypted, but because there is nothing to send anything to. The model runs on your GPU through WebGPU; your folders, your microphone and your files are reached through browser APIs, each behind an explicit permission.

The core is what the three have in common: the agent loop, the context manager, the tools behind permissions, skills that install from any public repo, and the pieces that decide what gets remembered and where it is kept. Each product vendors it into web/js/ so it stays clonable and openable with nothing installed.

(The diagram is docs/architecture.html — a page, not an image editor.)


The context manager

core/context.js selects the history by relevance to the live question rather than by recency:

Optionally, a semantic second opinion fused by rank (core/embed.js).

Agent sessions — fact recall, no LLM judge

The agent read a definition halfway through a real session; at the end it is asked for it. The benchmark asks one question: is that definition still in the packed context? Every condition gets the same token budget.

budgettailpackerfull (ceiling)
3,00048.4%93.8% · 1,596 tok100% · 29,732 tok
8,00070.3%95.3% · 2,965 tok100% · 29,732 tok

tail — keep the last messages until the budget is full, throw away the rest — is the bar that has to be cleared. It is there because four generations of this packer were each measured against the previous one, all of them winning, and none of them against tail. When tail was finally put in, one of those versions turned out to score below it.

Long-term dialogue — F1, with a real model answering, at ~8% of the context

F1
the full context, uncompressed22.56
tail truncation6.62
hand-written heuristics6.07
BM25 without IDF20.34
BM2523.59
embeddings23.95
rank fusion28.09

Retrieving well beats sending everything: 28.09 against 22.56, using 8% of the tokens. What is irrelevant is not neutral ballast — it distracts. That result is also why the packer stops when the evidence runs out instead of when the tokens run out: filling right up to the edge puts back by hand exactly what the compression came to remove.


What was measured, and not assumed


What is honest about this


What is in core/

Vanilla ES modules, no dependencies, no build:

ModuleWhat it does
context.jsThe context manager described above: BM25 with endogenous IDF, line granularity, redundancy control, a guaranteed token budget, staleness and date resolution at write time, and optional rank fusion with a semantic ranker.
embed.jsThe semantic side: a small multilingual embedding model in the browser, loaded lazily and only behind the flag, with a per-content session cache.
ceo.jsAutonomous "CEO brain": when the user is idle, several profiles think in parallel over the workspace and leave improvement proposals. It never modifies existing files, and it stops the moment the user comes back.
mind.jsThe Mind view: the brain's thinking rendered as a 3D world, with the project's real city underneath and a beam dropping onto each file as it is touched.
skills.jsClaude Code skills: installs SKILL.md from anthropics/skills, the official plugins, or any public repo, and injects them into the system prompt.
md.jsSafe markdown renderer for the chat — all HTML escaped first, then a bounded set of transformations.
humanize.jsTurns a tool call into a human sentence, so the user is never shown raw JSON — including mid-stream, before the JSON has closed.
splash-gl.jsWebGL particle galaxy for the splash screen: GL_POINTS and additive blending, computed entirely in the vertex shader.
telemetry.jsOpt-in error/feedback mailbox, off by default. Code and project content are never sent.
rlm.jsRecursive Language Models: work an input far larger than the window by chunking it, asking each chunk (map), merging the findings (reduce) and recursing when the merge still does not fit. Also the deliberating jury and the surgical patcher — in both, the model proposes and this code verifies against the source before anything is applied.
workspace.jsA working folder on disk: keeps sessions, skills and generated apps as ordinary files, with an inventory of what is stored, selective wipe, and a downloadable bundle for browsers without File System Access. The encrypted vault is never exported in the clear.
providers/api.jsGeneric provider for external APIs: OpenAI-compatible and Anthropic Messages, with SSE streaming, called directly from the user's browser so the key never passes through a server of ours.

Design rules

Using it

The products vendor the core into web/js/ (same file names) and keep it in sync with their own sync-core.sh, so each repository stays self-contained and can be cloned and opened with nothing installed.

The products

The full story, including what went wrong: https://bitacora.utopiaia.com/posts/16-beaten-by-doing-nothing.html

Licence

Apache License 2.0 — see LICENSE.


References

Robertson, S. E., Walker, S., Jones, S., Hancock-Beaulieu, M. M., & Gatford, M. (1994). Okapi at TREC-3. TREC-3.

Robertson, S. E., & Zaragoza, H. (2009). The Probabilistic Relevance Framework: BM25 and Beyond. Foundations and Trends in Information Retrieval, 3(4). https://doi.org/10.1561/1500000019

Spärck Jones, K. (1972). A Statistical Interpretation of Term Specificity and Its Application in Retrieval. Journal of Documentation, 28(1).

Carbonell, J., & Goldstein, J. (1998). The Use of MMR, Diversity-Based Reranking for Reordering Documents and Producing Summaries. SIGIR 1998.

Cormack, G. V., Clarke, C. L. A., & Buettcher, S. (2009). Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods. SIGIR 2009. https://doi.org/10.1145/1571941.1572114

Xiao, G., Tian, Y., Chen, B., Han, S., & Lewis, M. (2024). Efficient Streaming Language Models with Attention Sinks. ICLR 2024. https://arxiv.org/abs/2309.17453

Snodgrass, R., & Ahn, I. (1985). A Taxonomy of Time in Databases. SIGMOD 1985.