Documentation · v0.2

webelves docs

Everything you need to build with .elf, run Forge, and use the browser tools.

Overview

webelves is a suite of browser-native AI tools built around a single portable format: .elf. An .elf file is a self-contained HTML document bundling a knowledge corpus, a search index, optionally a language model, and a chat interface. Open it in any modern browser — offline, forever.

The stack has two layers:

Quickstart

Use a browser tool (no setup)

Navigate to any Open-tier tool and start immediately:

Open demo .elf artifacts

These are real static .elf files. Open them directly in the browser — no install, server, or API key.

wikiforge · Wikipedia · v0.2
Bayes Theorem
Grounded chat over posterior, likelihood ratio, and conjugate priors.
Open .elf →
Forge Phase 2 · reference · v0.2
Reference Demo
The canonical v0.2 artifact, fingerprint-verified against the open spec.
Open .elf →

Run Forge (Pro+)

pip install forge-elf
forge loop --seeds my-topics.yaml

.elf format — Spec v0.2 open

An .elf file is a valid HTML document. All data is embedded inline as <script> tags — no external files, no CDN dependencies for core functionality. The format is versioned; this describes v0.2.

Manifest

Every .elf has exactly one manifest block:

<script type="application/json" id="elf-manifest">
{
  "version": "0.2",
  "title": "Bayes Theorem",
  "fingerprint": "sha256:a3f9...",
  "resources": [
    { "id": "corpus-0", "role": "segment-set", "encoding": "base64" },
    { "id": "runtime",  "role": "runtime",     "encoding": "inline" }
  ]
}
</script>

The manifest is serialized using RFC 8785 JCS (JSON Canonicalization Scheme) before hashing. Key ordering is lexicographic, no insignificant whitespace.

Corpus

The corpus is a JSON array of passage objects, base64-encoded, embedded in a resource script block:

<script type="application/octet-stream" id="corpus-0">
  <!-- base64-encoded JSON array -->
</script>

Each passage object:

FieldTypeDescription
idstringUnique passage identifier
textstringThe passage text
sourcestringSource document title or URL
embeddingnumber[]Pre-computed embedding vector (optional)

Runtime

The runtime is a self-contained JavaScript module inlined into the HTML. Two implementations ship:

If no model is present, the runtime falls back to BM25 keyword search over the corpus — still fully functional, no AI inference required.

Fingerprinting

Identity is derived from content, not file path or timestamp:

fingerprint = "sha256:" + hex(SHA256(JCS(manifest)))

The same artifact — same title, same passages, same resources — always produces the same fingerprint. This makes .elf files content-addressable and auditable without a server.

Changing any field in the manifest (title, a resource ID, a passage) changes the fingerprint. The fingerprint shown in the Forge toolbar is live-computed.

Forge CLI Pro+

Forge is a Python package. Python 3.10+ required. No Node.js dependencies.

pip install forge-elf

# verify
forge --version
Forge is in active development. The CLI is functional for Phase 1–2 (pipeline scaffold + .elf builder). Phase 3 (quality judge) is partial. Check about → Forge roadmap for current status.

seeds.yaml

A seeds file is a YAML list of topics to synthesize. Each entry can be a bare string or a structured object:

# Simple list
topics:
  - Bayes Theorem
  - Kalman Filter
  - PageRank algorithm

# Structured (with hints)
topics:
  - title: Bayes Theorem
    hints:
      - posterior probability
      - likelihood ratio
      - conjugate priors
    depth: thorough          # brief | standard | thorough
    lang: en

Commands

CommandWhat it does
forge loopRun the full generate → judge → refine → package loop
forge buildBuild a single .elf from an existing article JSON
forge judgeRun the discriminator on a candidate article
forge statusShow pipeline status for a seeds file run
# Full pipeline (cloud key)
forge loop --seeds topics.yaml --workers 4

# Fully offline (local SmolLM2 or Mistral)
forge loop --offline --seeds topics.yaml

# Single topic, build only
forge build --topic "Bayes Theorem" --out bayes.elf.html

Quality rubrics

The discriminator scores each article against a YAML rubric. Default rubric ships with Forge; override per-domain:

# rubric.yaml
rubric:
  accuracy:
    weight: 0.4
    criteria: "Claims are factually correct and supported by sources"
  clarity:
    weight: 0.3
    criteria: "Explanation is understandable to a non-expert"
  depth:
    weight: 0.2
    criteria: "Topic is covered with sufficient detail"
  citations:
    weight: 0.1
    criteria: "At least 2 distinct sources referenced"

pass_threshold: 0.72
max_retries: 3
forge loop --seeds topics.yaml --rubric rubric.yaml

Guide: NotebookELF free

NotebookELF is a browser studio for building and chatting with knowledge bases, then exporting them as portable .elf files.

1. Add sources

From the notebook workspace, open the Sources panel (left). You can:

2. Chat

Ask anything in the Chat panel (center). Every answer includes structured citations — passage ID, source title, and the exact text span the answer drew from. Citations are machine-readable, not decoration.

3. Export as .elf

Hit Build in the toolbar. NotebookELF packages all sources, embeddings, and the chat runtime into one .elf.html file. Download it. Share it. Open it on any machine — offline.

All data lives in OPFS (Origin Private File System) — the browser's sandboxed local filesystem. Nothing is uploaded. Clear browser storage and the notebooks are gone — export a backup first.

Guide: Webelves Pro

Webelves is a browser-native local search engine — Perplexity-style grounded answers, all inference client-side.

First run — model download

On first load, Webelves downloads the default model (SmolLM2-360M-Instruct) and caches it in OPFS. Subsequent loads are instant — the model is already on disk, and inference runs fully offline.

Search

Type a question. Webelves:

SearXNG setup

Webelves requires a search backend. Options:

# Quick SearXNG with Docker
docker run -d -p 8080:8080 searxng/searxng

Guide: Codelves (Python IDE) free

Codelves is a browser-native Python IDE powered by Pyodide — the full CPython runtime compiled to WebAssembly.

Running code

Available packages

NumPy and Matplotlib are pre-installed. Install others at runtime:

import micropip
await micropip.install('scikit-learn')

from sklearn.linear_model import LinearRegression

Matplotlib output

Figures are captured and rendered as images inline in the output panel — no display server needed.

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2*np.pi, 100)
plt.plot(x, np.sin(x))
plt.title('sin(x)')
plt.show()   # renders inline

Tutorial: Build your own .elf

End-to-end walkthrough — from a topic list to an offline-ready .elf artifact.

This tutorial uses the Forge CLI (Pro+). If you don't have access yet, you can join the waitlist or use NotebookELF (Open tier) to build a .elf manually from your own sources.

1. Write a seeds file

# my-topics.yaml
topics:
  - title: Bayesian inference
    hints: [posterior, prior, likelihood, Bayes rule]
    depth: thorough
  - title: Kalman filter
    hints: [state estimation, prediction, update step]
    depth: standard

2. Run Forge

# with an API key (fastest)
export ELF_LLM_API_KEY=sk-ant-...
forge loop --seeds my-topics.yaml --workers 2

# fully offline (local model)
forge loop --offline --seeds my-topics.yaml

Forge writes progress to output/run-{timestamp}/:

output/
  run-20260519-143200/
    bayesian-inference.elf.html   ✓ accepted
    kalman-filter.elf.html        ✓ accepted
    run.log                       # full generate/judge/refine trace

3. Open the artifact

Serve the output directory with any static HTTP server (required for COEP headers if the .elf uses a GGUF model):

node website/server.mjs
# or
python -m http.server 8000

Navigate to output/run-.../bayesian-inference.elf.html. The chat interface loads. Ask it anything — all inference runs locally in your browser tab.

The file is self-contained. Copy it to a USB drive, email it, or drop it on another machine. As long as the recipient has a modern browser, it works — no internet, no account, no server.