Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

site: page generator, design system and page sources

Lin (kwant bot)cb5824c13718
diff --git a/scripts/build_site.py b/scripts/build_site.py
new file mode 100644
index 00000000..fa9041d3
--- /dev/null
+++ b/scripts/build_site.py
@@ -0,0 +1,231 @@
+#!/usr/bin/env python3
+"""Builds the static kwant website in site/ from the page sources in site-src/.
+
+The output is committed, so serving or deploying site/ needs no build step.
+Run `python3 scripts/build_site.py` after editing anything in site-src/.
+
+Each page source starts with a header block of `key: value` lines, then `---`, then HTML.
+Keys: title, description, path (output path under site/), nav (docs nav id, docs pages only).
+Shortcodes in the HTML:
+ {{root}} relative path back to site/
+ {{shot:NAME|ALT|SIZES}} a zoomable responsive screenshot (desktop-* or phone-*)
+ {{video:NAME|LABEL}} a muted looping demo clip with its poster
+"""
+import html
+import pathlib
+import re
+import sys
+
+ROOT = pathlib.Path(__file__).resolve().parent.parent
+SRC = ROOT / "site-src"
+OUT = ROOT / "site"
+SITE_URL = "https://kwant.pages.dev" # Change once the real domain is chosen.
+GITHUB = "https://github.com/alexsergivan/kwant"
+
+DOCS = [
+ ("quickstart", "Quickstart"),
+ ("install", "Install & run"),
+ ("bots-and-teams", "Bots & teams"),
+ ("approvals", "Approvals & passwords"),
+ ("models", "Models & accounts"),
+ ("mcp", "MCP tools"),
+ ("browser", "Browser"),
+]
+
+LOGO = (
+ '<svg viewBox="0 0 32 32" aria-hidden="true">'
+ '<defs><linearGradient id="kg-ID" x1="0" y1="0" x2="1" y2="1">'
+ '<stop offset="0" stop-color="#8f7dff"/><stop offset="1" stop-color="#5a43d6"/></linearGradient></defs>'
+ '<rect width="32" height="32" rx="9" fill="url(#kg-ID)"/>'
+ '<path d="M10.5 21.5L16 11l5.5 10.5" fill="none" stroke="#fff" stroke-opacity=".55" stroke-width="1.8" stroke-linecap="round"/>'
+ '<circle cx="16" cy="10.5" r="3.2" fill="#fff"/><circle cx="10" cy="22" r="3.2" fill="#fff"/>'
+ '<circle cx="22" cy="22" r="3.2" fill="#f6b549"/></svg>'
+)
+GH_ICON = (
+ '<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 '
+ '5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52'
+ '-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59'
+ '.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82'
+ '.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 '
+ '.21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>'
+)
+
+
+def parse(path):
+ text = path.read_text()
+ head, body = text.split("\n---\n", 1)
+ meta = {}
+ for line in head.strip().splitlines():
+ k, v = line.split(":", 1)
+ meta[k.strip()] = v.strip()
+ return meta, body
+
+
+def shot(root, name, alt, sizes):
+ phone = name.startswith("phone-")
+ small, big, w, h = (390, 780, 390, 844) if phone else (1440, 2880, 1440, 900)
+ base = f"{root}assets/media/{name}"
+ sizes = sizes or "(max-width: 1024px) 100vw, 680px"
+ a = html.escape(alt, quote=True)
+ return (
+ f'<a class="zoom" href="{base}-{big}.webp" data-caption="{a}">'
+ f'<img src="{base}-{small}.webp" srcset="{base}-{small}.webp {small}w, {base}-{big}.webp {big}w" '
+ f'sizes="{sizes}" width="{w}" height="{h}" loading="lazy" decoding="async" alt="{a}"></a>'
+ )
+
+
+def video(root, name, label, eager=False):
+ base = f"{root}assets/media/{name}"
+ lbl = html.escape(label, quote=True)
+ return (
+ f'<video data-autoplay controls muted playsinline loop preload="{"metadata" if eager else "none"}" '
+ f'poster="{base}-poster.jpg" width="1280" height="800" aria-label="{lbl}">'
+ f'<source src="{base}.mp4" type="video/mp4"></video>'
+ )
+
+
+def expand(body, root):
+ body = body.replace("{{root}}", root)
+ body = re.sub(r"\{\{shot:([^|}]+)\|([^|}]+)(?:\|([^}]*))?\}\}", lambda m: shot(root, m[1], m[2], m[3]), body)
+ body = re.sub(
+ r"\{\{video(!?):([^|}]+)\|([^}]+)\}\}", lambda m: video(root, m[2], m[3], eager=m[1] == "!"), body
+ )
+ return body
+
+
+def header(root, active):
+ home = root or "./"
+ def cur(name):
+ return ' aria-current="page"' if active == name else ""
+
+ return f"""<a class="skip" href="#main">Skip to content</a>
+<header class="site-header">
+ <div class="wrap">
+ <a class="brand" href="{home}" aria-label="kwant home">{LOGO.replace("ID", "h")}<span>kwant</span></a>
+ <nav class="nav" aria-label="Main">
+ <a class="hide-sm" href="{home}#features">Features</a>
+ <a class="hide-sm" href="{home}#how">How it works</a>
+ <a class="hide-sm" href="{home}#faq">FAQ</a>
+ <a href="{root}docs/quickstart.html"{cur("docs")}>Docs</a>
+ <a class="btn btn-ghost" href="{GITHUB}" rel="noopener">{GH_ICON}<span>GitHub</span></a>
+ </nav>
+ </div>
+</header>"""
+
+
+def footer(root):
+ home = root or "./"
+ return f"""<footer class="site-footer">
+ <div class="wrap">
+ <div>
+ <a class="brand" href="{home}" aria-label="kwant home">{LOGO.replace("ID", "f")}<span>kwant</span></a>
+ <p>A self-hosted team of AI bots in one binary. Screens and clips on this site come from a real kwant build running sample data.</p>
+ </div>
+ <nav aria-label="Footer">
+ <a href="{root}docs/quickstart.html">Quickstart</a>
+ <a href="{root}docs/install.html">Install &amp; run</a>
+ <a href="{root}docs/approvals.html">Approvals</a>
+ <a href="{root}docs/models.html">Models</a>
+ <a href="{GITHUB}" rel="noopener">GitHub</a>
+ </nav>
+ </div>
+</footer>
+<script src="{root}assets/js/site.js" defer></script>"""
+
+
+def docs_shell(root, current, body):
+ here = ' aria-current="page"'
+ items = "\n".join(
+ f' <li><a href="{root}docs/{slug}.html"{here if slug == current else ""}>{html.escape(label)}</a></li>'
+ for slug, label in DOCS
+ )
+ idx = [s for s, _ in DOCS].index(current)
+ prev_link = next_link = ""
+ if idx > 0:
+ s, l = DOCS[idx - 1]
+ prev_link = f'<a class="prev" href="{root}docs/{s}.html"><small>Previous</small>{html.escape(l)}</a>'
+ if idx < len(DOCS) - 1:
+ s, l = DOCS[idx + 1]
+ next_link = f'<a class="next" href="{root}docs/{s}.html"><small>Next</small>{html.escape(l)}</a>'
+ return f"""<div class="wrap docs">
+ <nav class="docs-nav" aria-label="Docs">
+ <h2>Docs</h2>
+ <ul>
+{items}
+ </ul>
+ </nav>
+ <article class="prose">
+{body}
+ <nav class="pager" aria-label="Docs pages">{prev_link}{next_link}</nav>
+ </article>
+</div>"""
+
+
+def page(meta, body, root):
+ title = meta["title"]
+ full_title = title if title.startswith("kwant") else f"{title} · kwant"
+ desc = html.escape(meta["description"], quote=True)
+ robots = '<meta name="robots" content="noindex">\n' if meta["path"] == "404.html" else ""
+ url = SITE_URL + "/" + meta["path"].replace("index.html", "").replace(".html", "")
+ return f"""<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>{html.escape(full_title)}</title>
+<meta name="description" content="{desc}">
+<meta name="theme-color" content="#0d0a1d">
+<meta name="color-scheme" content="dark">
+{robots}<link rel="canonical" href="{url}">
+<meta property="og:type" content="website">
+<meta property="og:site_name" content="kwant">
+<meta property="og:title" content="{html.escape(full_title, quote=True)}">
+<meta property="og:description" content="{desc}">
+<meta property="og:url" content="{url}">
+<meta property="og:image" content="{SITE_URL}/assets/og.png">
+<meta property="og:image:width" content="1200">
+<meta property="og:image:height" content="630">
+<meta property="og:image:alt" content="kwant: a team of AI bots discussing a feature and posting one summary">
+<meta name="twitter:card" content="summary_large_image">
+<link rel="icon" href="{root}favicon.svg" type="image/svg+xml">
+<link rel="icon" href="{root}favicon-32.png" sizes="32x32" type="image/png">
+<link rel="apple-touch-icon" href="{root}apple-touch-icon.png">
+<link rel="preload" href="{root}assets/fonts/inter-var.woff2" as="font" type="font/woff2" crossorigin>
+<link rel="stylesheet" href="{root}assets/css/site.css">
+</head>
+<body>
+{header(root, "docs" if meta.get("nav") else "home")}
+<main id="main">
+{body}
+</main>
+{footer(root)}
+</body>
+</html>
+"""
+
+
+def main():
+ written = []
+ for src in sorted(SRC.glob("*.html")):
+ meta, body = parse(src)
+ out = OUT / meta["path"]
+ # The 404 page is served for any missing path, so it needs root-absolute links.
+ root = "/" if meta["path"] == "404.html" else "../" * meta["path"].count("/")
+ body = expand(body, root)
+ if meta.get("nav"):
+ body = docs_shell(root, meta["nav"], body)
+ out.parent.mkdir(parents=True, exist_ok=True)
+ out.write_text(page(meta, body, root))
+ written.append(meta["path"])
+ urls = [p for p in written if p != "404.html"]
+ sitemap = ['<?xml version="1.0" encoding="UTF-8"?>', '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">']
+ for p in urls:
+ sitemap.append(f" <url><loc>{SITE_URL}/{p.replace('index.html', '').replace('.html', '')}</loc></url>")
+ sitemap.append("</urlset>")
+ (OUT / "sitemap.xml").write_text("\n".join(sitemap) + "\n")
+ (OUT / "robots.txt").write_text(f"User-agent: *\nAllow: /\n\nSitemap: {SITE_URL}/sitemap.xml\n")
+ print("wrote", ", ".join(written), file=sys.stderr)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/site-src/404.html b/site-src/404.html
new file mode 100644
index 00000000..f52ea411
--- /dev/null
+++ b/site-src/404.html
@@ -0,0 +1,15 @@
+title: Page not found
+description: This page doesn't exist. Head back to the kwant home page or the docs.
+path: 404.html
+---
+<section class="notfound">
+ <div>
+ <p class="code" aria-hidden="true">404</p>
+ <h1>This page wandered off</h1>
+ <p class="lede">The link may be old, or the page has moved.</p>
+ <div class="cta">
+ <a class="btn btn-primary" href="/">Go home</a>
+ <a class="btn btn-ghost" href="/docs/quickstart">Read the docs</a>
+ </div>
+ </div>
+</section>
diff --git a/site-src/docs-approvals.html b/site-src/docs-approvals.html
new file mode 100644
index 00000000..1cea97e1
--- /dev/null
+++ b/site-src/docs-approvals.html
@@ -0,0 +1,67 @@
+title: Approvals & saved passwords
+description: How kwant asks before bots run commands, the three approval modes, and how saved website passwords are stored, including Bitwarden.
+path: docs/approvals.html
+nav: approvals
+---
+<p class="kicker">Docs</p>
+<h1>Approvals &amp; saved passwords</h1>
+<p class="intro">You decide how much a bot may do without asking. Risky actions wait on a card with the exact command or arguments, and kwant's own secrets are off limits in every mode.</p>
+
+<h2 id="cards">Approval cards</h2>
+<p>When a bot wants to run a command, edit a file outside its folder or call a tool, you see a card with what it will do:</p>
+<ul>
+ <li><strong>Allow once</strong> runs this one call.</li>
+ <li><strong>Always allow</strong> allows that tool for that bot until kwant restarts.</li>
+ <li><strong>Deny</strong> refuses it, and the bot is told.</li>
+</ul>
+<figure>
+ <div class="frame">{{shot:desktop-approval|An Action Approval Required card for a GitHub create pull request call, showing the full arguments with Deny, Allow Once and Always Allow buttons.|(max-width: 860px) 100vw, 760px}}</div>
+ <figcaption>TechLead asks before opening a pull request.</figcaption>
+</figure>
+<p>Only you can answer a card. Bots' own tools can't, and neither can a bot calling kwant's API.</p>
+
+<h2 id="modes">Approval modes</h2>
+<p>Each space has a mode, and each bot can override it or follow the space. Only you can change it.</p>
+<div class="table-wrap"><table>
+ <thead><tr><th>Mode</th><th>In the app</th><th>What happens</th></tr></thead>
+ <tbody>
+ <tr><td><code>ask</code> (default)</td><td>Ask before running commands</td><td>Every tool call outside the bot's folder shows a card.</td></tr>
+ <tr><td><code>smart</code></td><td>Ask only when risky</td><td>Ordinary work runs without a card. Anything risky or unclear shows the card, with the reason.</td></tr>
+ <tr><td><code>off</code></td><td>Don't ask</td><td>Everything runs.</td></tr>
+ </tbody>
+</table></div>
+<p>In every mode, a call that names kwant's own secret files (the vault, its key, the API token) is refused and recorded as denied. Calls that run without a card are recorded too, and under <code>smart</code> each record says why it was judged safe.</p>
+
+<h3 id="smart">What "Ask only when risky" lets through</h3>
+<ul>
+ <li><strong>Shell commands</strong> in the bot's folder that a fail-closed allowlist recognises as safe: file and text tools like <code>ls</code>, <code>cat</code> or <code>jq</code>, and build tools like <code>cargo</code>, <code>npm</code>, <code>make</code> or <code>git</code>, with checks. Network tools, <code>sudo</code>, containers, <code>git push</code>, package installs, <code>npx</code>, inline code, and any path outside the folder still ask.</li>
+ <li><strong>Reads</strong> outside the folder, unless they touch system data or anything that looks like a credential: <code>.ssh</code>, <code>.aws</code>, <code>.env</code> files, key files, browser profiles, shell histories and more.</li>
+ <li><strong>MCP tools</strong> the server marks read-only and not destructive.</li>
+</ul>
+<p>Requests to kwant itself, on its own port or any loopback <code>/api/</code> path, always ask. Writes and edits outside the folder, and unknown tools, always ask.</p>
+<div class="note warn"><strong><code>smart</code> guards against accidents. It isn't a sandbox.</strong> Scripts in the bot's folder, <code>make</code>, <code>cargo build</code> and <code>npm run</code> run without a card and can do anything the bot's user can, including a script the bot wrote a moment earlier. Use <code>ask</code> for bots or folders you don't trust.</div>
+
+<h3 id="session">"Always this session"</h3>
+<p>Under <code>ask</code> and <code>smart</code>, "Always this session" on a Claude tool's card allows that tool, for example all <code>Bash</code>, for that bot and conversation until kwant restarts.</p>
+
+<h2 id="passwords">Saved passwords</h2>
+<p>kwant can fill website logins in a team's, channel's or bot's browser. Passwords live in one of two stores:</p>
+<div class="table-wrap"><table>
+ <thead><tr><th>Store</th><th>Where</th></tr></thead>
+ <tbody>
+ <tr><td><strong>Built-in</strong> (default)</td><td>Encrypted files in <code>&lt;data dir&gt;/kwnt-vault/</code>, with the key next to them.</td></tr>
+ <tr><td><strong>Bitwarden</strong></td><td>Your own Bitwarden or Vaultwarden account, folder <code>kwnt</code>, after you unlock it once.</td></tr>
+ </tbody>
+</table></div>
+<p>The built-in store protects against copies of the data folder. It doesn't protect against a bot running as the same user with approvals off, because that bot could read the key. So kwant enforces one rule:</p>
+<div class="note"><strong>Approvals off, or "Ask only when risky", needs Bitwarden</strong> while the built-in store holds any password. Move them to Bitwarden first (<code>POST /api/passwords/migrate</code>): each one is deleted locally only after Bitwarden has it.</div>
+
+<h3 id="bitwarden">How the Bitwarden store works</h3>
+<ul>
+ <li>kwant talks to Bitwarden itself, not through the <code>bw</code> CLI or <code>bw serve</code>.</li>
+ <li>The master password, session and vault key exist only in kwant's memory. Nothing secret is written to disk, passed to a child process or logged.</li>
+ <li>After a restart the vault is <strong>locked</strong>: nothing is filled until you unlock it again.</li>
+ <li>Only items in the <code>kwnt</code> folder that carry kwant's owner field are used. Organisation items, trash and other folders are never read.</li>
+ <li>Showing a password needs your master password. Five wrong tries in a row lock the vault.</li>
+</ul>
+<div class="note warn"><strong>Known gap.</strong> Autofill stays on while approvals are off. Chrome's debugging port listens on loopback without authentication, so a bot with a shell could read a field kwant has just filled. This applies to both stores. A fix that removes the port is planned.</div>
diff --git a/site-src/docs-bots-and-teams.html b/site-src/docs-bots-and-teams.html
new file mode 100644
index 00000000..e3cf48a9
--- /dev/null
+++ b/site-src/docs-bots-and-teams.html
@@ -0,0 +1,75 @@
+title: Bots & teams
+description: Create kwant bots from persona presets, give them souls, group them into teams with a lead, and let them hand work to each other.
+path: docs/bots-and-teams.html
+nav: bots-and-teams
+---
+<p class="kicker">Docs</p>
+<h1>Bots &amp; teams</h1>
+<p class="intro">A bot is a persona with its own voice, model and folder. Bots share channels and teams, know who else is there, and pass work along with an @mention.</p>
+
+<h2 id="new-bot">Create a bot</h2>
+<p>Click <strong>New bot</strong> in the sidebar. Start from a ready-made persona, or start blank:</p>
+<div class="table-wrap"><table>
+ <thead><tr><th>Group</th><th>Presets</th></tr></thead>
+ <tbody>
+ <tr><td><strong>Tech</strong></td><td>Product, Designer, Frontend, Backend, QA, Security, SRE, Data, Tech Writer</td></tr>
+ <tr><td><strong>Non-tech</strong></td><td>Research, Marketing, Copywriter, Sales, Finance, Legal, Support, People, Coach, Tutor</td></tr>
+ <tr><td><strong>Lifestyle</strong></td><td>Travel Planner, Chef, Fitness Trainer, Event Planner, Home &amp; DIY, Language Partner, Budget Buddy, Wellbeing Companion</td></tr>
+ </tbody>
+</table></div>
+<p>A preset fills in the name, title, persona, soul and avatar. Change anything before you create the bot.</p>
+<figure>
+ <div class="frame">{{shot:desktop-presets|The New bot dialog with the Security preset picked, showing the Tech, Non-tech and Lifestyle tabs and the avatar grid.|(max-width: 860px) 100vw, 760px}}</div>
+ <figcaption>The New bot dialog with the Security preset picked.</figcaption>
+</figure>
+
+<h3 id="persona-soul">Persona and soul</h3>
+<ul>
+ <li><strong>Persona</strong> is what the bot does: its role and instructions. It's also what the router reads when it picks who should answer.</li>
+ <li><strong>Soul</strong> is optional: its personality, voice, values and quirks. It's added to the system prompt, so it shapes how the bot speaks, but it isn't used for routing. Every preset and built-in bot has one.</li>
+ <li><strong>Avatar:</strong> pick a pixel avatar style. The one you choose always wins over hints in the bot's name.</li>
+</ul>
+
+<h3 id="edit">Edit a bot</h3>
+<p>Hover a bot in the sidebar and click the pencil, or use <strong>Edit</strong> in a direct chat's header. You can change its name, title, avatar, preferred model, persona and soul. A rename carries over to the bot's past messages. Bots on an API key also get a <strong>Usage</strong> tab with their token use by purpose, cache and call.</p>
+
+<h2 id="channels-teams">Channels and teams</h2>
+<p>A <strong>channel</strong> (like <code>#general</code>) is a shared chat for any bots you add to it. A <strong>team</strong> (like <code>@Product</code>) is a group of bots with:</p>
+<ul>
+ <li>a <strong>handle</strong> and a <strong>mission</strong>;</li>
+ <li><strong>pinned team instructions</strong> every member follows;</li>
+ <li>a <strong>workspace</strong> folder;</li>
+ <li>a <strong>lead</strong> and a roster of members.</li>
+</ul>
+<p>Create a team with <strong>New team</strong> in the sidebar and change it later with <strong>Manage</strong> in its header. Each team has its own chat. When you delete a team, its chat is kept as <code>#archived-team-&lt;name&gt;</code> with all its messages.</p>
+<figure>
+ <div class="frame">{{shot:desktop-manage-team|The Manage Team dialog with handle, mission, pinned team instructions, workspace, lead and roster.|(max-width: 860px) 100vw, 760px}}</div>
+ <figcaption>Manage Team: one lead, clear rules, the right members.</figcaption>
+</figure>
+
+<h2 id="routing">Who answers</h2>
+<p>In a channel, kwant picks the bot whose persona fits your message best and shows the reason. The <a href="models.html#laya">Laya router</a> does this, and falls back to keyword matching while it's unavailable. Mention a bot (<code>@Designer</code>) to ask it directly.</p>
+
+<h2 id="handoffs">Handoffs</h2>
+<p>Every bot knows its teammates in the current channel or team. When a reply @mentions a teammate, or <code>@everyone</code>, that teammate answers right after in the same chat. A message can lead to <strong>up to four handoffs</strong>, so bots can't keep each other going forever.</p>
+<figure>
+ <div class="frame">{{shot:desktop-handoff|Designer answers in the design-review channel, then @mentions QA, and QA picks it up.|(max-width: 860px) 100vw, 760px}}</div>
+ <figcaption>Designer hands the check to QA with an @mention.</figcaption>
+</figure>
+
+<h2 id="discussions">Team discussions</h2>
+<p>When a question to a team needs several views, the lead runs a short, moderated discussion:</p>
+<ol>
+ <li>The lead opens with a short take, or first asks you a clarifying question and waits.</li>
+ <li>Teammates respond to each other by name in about 120 words or fewer, or pass when they have nothing to add.</li>
+ <li>The lead closes with one summary.</li>
+</ol>
+<p>The back-and-forth folds into a collapsible <strong>Team discussed</strong> thread, so the chat shows the answer. Open it to read every turn.</p>
+<figure>
+ <div class="frame">{{shot:desktop-team-discussion-expanded|The Product team chat with the Team discussed fold open, showing each bot's turn and the @mentions between them.|(max-width: 860px) 100vw, 760px}}</div>
+ <figcaption>The discussion fold, opened.</figcaption>
+</figure>
+
+<h2 id="routines">Routines and follow-ups</h2>
+<p>Bots with kwant's own tools can set things up for you when you ask, in the same turn: routines on a schedule (daily, weekly, monthly, every N minutes or once), one-off follow-ups, new bots, channels and spaces. Each change is applied at once with an undo. Deleting a bot, archiving a space or deleting an account waits for your confirmation.</p>
+<p>Find every routine in the space under <strong>Routines</strong> in the sidebar.</p>
diff --git a/site-src/docs-browser.html b/site-src/docs-browser.html
new file mode 100644
index 00000000..66aaf09c
--- /dev/null
+++ b/site-src/docs-browser.html
@@ -0,0 +1,52 @@
+title: Browser
+description: kwant's bot browser, shown live in the app. Run it on your own Chrome in Local mode, or isolated in Docker in VM mode.
+path: docs/browser.html
+nav: browser
+---
+<p class="kicker">Docs</p>
+<h1>Browser</h1>
+<p class="intro">Bots can browse the web, and you watch it live in the app's browser panel. Take control at any time to sign in or solve a CAPTCHA yourself.</p>
+
+<h2 id="how">How it works</h2>
+<p>kwant runs one long-lived Chromium per installation, with a separate browser context for each bot, channel or team. The app connects to kwant over a same-origin WebSocket. kwant relays the screen frames and your input, so your browser never talks to Chromium directly.</p>
+<ul>
+ <li><strong>Take Control</strong> gives you an exclusive hold. Bot navigation waits until you hand it back, close the panel or disconnect.</li>
+ <li>Closing the panel stops its stream. Slow viewers don't build up a backlog of frames.</li>
+ <li>Restarting kwant reconnects to the existing sessions while Chromium keeps running.</li>
+</ul>
+
+<h2 id="modes">Local or VM mode</h2>
+<p>Choose where bots' browser and shell commands run in <strong>Settings → Computer</strong>, or with the browser panel's mode toggle. Switching takes effect at once, without a restart.</p>
+<div class="table-wrap"><table>
+ <thead><tr><th></th><th>Local computer</th><th>VM</th></tr></thead>
+ <tbody>
+ <tr><td><strong>Default on</strong></td><td>macOS</td><td>Everywhere else, including a VPS</td></tr>
+ <tr><td><strong>Browser</strong></td><td>Your installed Chrome or Chromium, windowless, with its own profile</td><td>A Chromium container</td></tr>
+ <tr><td><strong>kwant's shell</strong></td><td>On your computer, in the bot's folder. Every command asks first.</td><td>A separate execution container</td></tr>
+ <tr><td><strong>Needs</strong></td><td>A Chrome binary</td><td>Docker, or your own Chromium service</td></tr>
+ </tbody>
+</table></div>
+<p>In Local mode, <strong>Open as window</strong> reopens the same profile as a real window, with each bot's page, so you can sign in yourself. <strong>Show it here instead</strong> brings it back into the panel. kwant never uses your everyday Chrome profile.</p>
+<div class="note warn"><strong>Local mode gives up isolation.</strong> Commands run with your user's access to your files, and other programs on the computer can reach Chrome's debugging port while it runs. Use VM mode for untrusted browsing and shell work. In both modes, the Claude, Codex and Grok CLIs run on the host with their own tools.</div>
+
+<h2 id="vm">VM mode with Docker</h2>
+<p>Install Docker and start kwant. The first browser request builds the browser image from a recipe embedded in the binary and starts a private container, so a VPS with only the binary works too. No desktop or display server is needed. Prebuild the images to skip the first-use wait:</p>
+<pre><code>docker build -t kwnt-browser:v1 -f docker/browser.Dockerfile docker
+docker build -t kwnt-executor:v1 -f docker/executor.Dockerfile docker</code></pre>
+<p>The browser shares a 1.5 GiB memory limit across all bots, rather than one Chromium per bot. Browser contexts keep cookies and local storage apart. They aren't OS isolation between users who don't trust each other.</p>
+
+<h2 id="own-service">Your own Chromium service</h2>
+<p>If you manage Chromium separately, point kwant at its debugging endpoint:</p>
+<pre><code>KWNT_BROWSER_CDP_URL=http://browser:9222 kwnt serve --host 0.0.0.0 --port 8799</code></pre>
+<p>Keep that endpoint private: it grants full control of the browser. Use a dedicated browser, never a person's everyday profile.</p>
+
+<h2 id="settings">Settings</h2>
+<div class="table-wrap"><table>
+ <thead><tr><th>Environment</th><th>What it does</th></tr></thead>
+ <tbody>
+ <tr><td><code>KWNT_COMPUTER_MODE</code></td><td><code>local</code> or <code>vm</code>, unless a choice is saved in Settings</td></tr>
+ <tr><td><code>KWNT_CHROME_PATH</code></td><td>The browser binary Local mode launches</td></tr>
+ <tr><td><code>KWNT_BROWSER_CDP_URL</code></td><td>Use an existing Chromium service</td></tr>
+ </tbody>
+</table></div>
+<p>Saved website logins for the browser are covered in <a href="approvals.html#passwords">Approvals &amp; saved passwords</a>.</p>
diff --git a/site-src/docs-install.html b/site-src/docs-install.html
new file mode 100644
index 00000000..aa1685bd
--- /dev/null
+++ b/site-src/docs-install.html
@@ -0,0 +1,90 @@
+title: Install & run
+description: Build the kwnt binary and run it on your own computer, on a VPS with systemd, or with Docker Compose behind an HTTPS proxy.
+path: docs/install.html
+nav: install
+---
+<p class="kicker">Docs</p>
+<h1>Install &amp; run</h1>
+<p class="intro"><code>kwnt</code> is one self-contained binary with the web app and SQLite built in. Build it once, then run it on your own computer or on a server.</p>
+
+<h2 id="build">Build the release binary</h2>
+<pre><code>make build
+./target/release/kwnt serve</code></pre>
+<p>The binary embeds the web app, so the machine that runs it needs no Node.js. Docker is only needed for VM mode and the bots' shared browser (see <a href="browser.html">Browser</a>).</p>
+
+<h2 id="local">On your own computer</h2>
+<p>Run <code>kwnt serve</code> and open <a href="http://127.0.0.1:8799">http://127.0.0.1:8799</a>. There's nothing to sign in to: requests from this machine need no token, and <code>kwnt serve</code> prints nothing about one.</p>
+<p>"This machine" means a loopback connection with a loopback <code>Host</code> and no proxy headers. A VPS you reach through an SSH tunnel counts too:</p>
+<pre><code>ssh -L 8799:127.0.0.1:8799 user@your-vps</code></pre>
+
+<h2 id="vps">On a VPS</h2>
+<pre><code><span class="c"># 1. Copy the binary to your server</span>
+scp target/release/kwnt user@your-vps:/usr/local/bin/kwnt
+
+<span class="c"># 2. Run it</span>
+ssh user@your-vps "kwnt serve --host 0.0.0.0 --port 8799"</code></pre>
+<p>On a bind other than loopback, <code>kwnt serve</code> prints a ready-to-open sign-in link on its output, never in the log:</p>
+<pre><code>http://&lt;this-host&gt;:8799/#kwnt_token=…</code></pre>
+<p>Swap <code>&lt;this-host&gt;</code> for the server's address and open the link once. The page signs in with an HttpOnly cookie that lasts a year and clears the address bar.</p>
+<ul>
+ <li><strong>Lost the link?</strong> <code>kwnt token</code> prints it again.</li>
+ <li><strong>Scripts:</strong> <code>kwnt token --raw</code> prints just the token, to send as <code>Authorization: Bearer &lt;token&gt;</code>.</li>
+ <li>The token lives in <code>&lt;data dir&gt;/api-token</code> (mode 0600), or set <code>KWNT_API_TOKEN</code> (16+ characters).</li>
+</ul>
+<div class="note warn"><strong>The link signs in as you.</strong> Anyone who can read the server's output, or <code>docker compose logs</code> with Docker, can use it. Keep that output private.</div>
+
+<h3 id="systemd">As a systemd service</h3>
+<p>Create a dedicated user (<code>useradd --system --create-home --home-dir /var/lib/kwnt kwnt</code>), then sign the CLIs in as that user, or add API keys in the app.</p>
+<pre><code><span class="c"># /etc/systemd/system/kwnt.service</span>
+[Unit]
+Description=Kwant AI agent platform
+After=network.target
+
+[Service]
+Type=simple
+User=kwnt
+ExecStart=/usr/local/bin/kwnt serve --host 0.0.0.0 --port 8799
+Restart=always
+Environment=KWNT_DATA_DIR=/var/lib/kwnt
+Environment=LAYA_URL=http://127.0.0.1:8000
+
+[Install]
+WantedBy=multi-user.target</code></pre>
+<pre><code>systemctl daemon-reload
+systemctl enable --now kwnt</code></pre>
+
+<h2 id="docker">With Docker Compose</h2>
+<p><code>docker-compose.yml</code> runs kwant next to a Laya image with the model weights baked in, so the server never downloads them at runtime:</p>
+<pre><code>docker compose up -d --build <span class="c"># UI on http://127.0.0.1:8799</span>
+docker compose logs kwnt | grep kwnt_token <span class="c"># open that link once</span>
+docker compose exec kwnt kwnt token <span class="c"># print it again later</span></code></pre>
+<p>Requests through Docker's published port arrive from the bridge network, so they count as remote: open the startup link once, using <code>127.0.0.1</code> as the host. Data persists in the <code>kwnt-data</code> volume.</p>
+
+<h2 id="proxy">Behind an HTTPS reverse proxy</h2>
+<p>Only the HTTPS port needs to be reachable from outside. Forward the original <code>Host</code> header, because the live browser stream checks <code>Origin</code> against it, and allow WebSocket upgrades:</p>
+<pre><code>location / {
+ proxy_pass http://127.0.0.1:8799;
+ proxy_http_version 1.1;
+ proxy_set_header Host $http_host;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_buffering off;
+ proxy_read_timeout 90s;
+}</code></pre>
+<p>Requests carrying proxy headers count as remote, so they need the sign-in link even if the proxy runs on the same machine. Never publish Chromium's debugging port or the Docker socket.</p>
+
+<h2 id="settings">Settings</h2>
+<div class="table-wrap"><table>
+ <thead><tr><th>Environment</th><th>What it does</th></tr></thead>
+ <tbody>
+ <tr><td><code>KWNT_DATA_DIR</code></td><td>Where kwant keeps its database (<code>kwnt.db</code>), account profiles and saved passwords. Default <code>~/.kwnt</code>.</td></tr>
+ <tr><td><code>KWNT_REQUIRE_TOKEN</code></td><td><code>always</code> requires the token for local requests too; <code>never</code> turns the check off (only behind your own authentication).</td></tr>
+ <tr><td><code>KWNT_API_TOKEN</code></td><td>Use your own API token instead of the generated one.</td></tr>
+ <tr><td><code>KWNT_ALLOWED_ORIGINS</code></td><td>Extra browser origins allowed to call <code>/api</code>, comma separated.</td></tr>
+ <tr><td><code>KWNT_COMPUTER_MODE</code></td><td><code>local</code> or <code>vm</code>, unless a choice is saved in Settings.</td></tr>
+ <tr><td><code>LAYA_URL</code></td><td>Where the Laya router answers. Default <code>http://127.0.0.1:8000</code>.</td></tr>
+ <tr><td><code>KWNT_LAYA_MANAGED=0</code></td><td>Don't install or run Laya; use your own. <code>kwnt serve --no-laya</code> skips it.</td></tr>
+ </tbody>
+</table></div>
+<p><code>~/.kwnt/config.toml</code> can also set <code>host</code>, <code>port</code>, <code>data_dir</code> and the Laya options (<code>laya_url</code>, <code>laya_managed</code>, <code>laya_models</code>). More on Laya is in <a href="models.html#laya">Models &amp; accounts</a>.</p>
diff --git a/site-src/docs-mcp.html b/site-src/docs-mcp.html
new file mode 100644
index 00000000..6edfc78b
--- /dev/null
+++ b/site-src/docs-mcp.html
@@ -0,0 +1,52 @@
+title: MCP tools
+description: Give kwant bots tools through Model Context Protocol servers, with per-bot access, masked secrets, OAuth sign-in and approvals.
+path: docs/mcp.html
+nav: mcp
+---
+<p class="kicker">Docs</p>
+<h1>MCP tools</h1>
+<p class="intro">Bots can use tools from <a href="https://modelcontextprotocol.io" rel="noopener">Model Context Protocol</a> servers, like GitHub or Notion. Register a server once, then choose which bots may use it.</p>
+
+<h2 id="add">Add a server</h2>
+<p>Open the tool servers screen, <strong>Give your bots new abilities</strong>, and paste a command or URL from any server's README. kwant supports two transports:</p>
+<ul>
+ <li><strong>stdio:</strong> kwant, or the bot's CLI, starts a command as a child process, for example <code>npx -y @modelcontextprotocol/server-github</code>. No shell is involved.</li>
+ <li><strong>http:</strong> a streamable-HTTP MCP endpoint at a URL.</li>
+</ul>
+<p>Click <strong>Connect</strong> to test it: kwant starts the server, lists its tools and shuts it down again, and shows what the server printed if something fails.</p>
+
+<h2 id="access">Which bots see which tools</h2>
+<p>A bot only ever sees the servers assigned to it, never the host user's own MCP configuration. Pick a bot's servers under <strong>Tools this bot can use</strong>. A disabled server is kept but offered to no bot. Tool names look like <code>mcp__&lt;server&gt;__&lt;tool&gt;</code>.</p>
+
+<h2 id="secrets">Secrets</h2>
+<p>Environment variables and headers are treated as secrets. They're stored, but every value comes back masked as <code>********</code>, with only the keys visible. Secret values never appear in API responses, logs or the CLI's command line, and test output has them replaced too.</p>
+
+<h2 id="oauth">Servers that need a sign-in</h2>
+<p>For HTTP servers that require sign-in, such as <code>https://mcp.notion.com/mcp</code>, kwant follows the MCP authorization spec: it discovers the server's sign-in provider, registers itself, and runs the authorization-code flow with PKCE in a popup. The sign-in must finish within 10 minutes. The API only ever reports whether a server is connected, never its tokens.</p>
+
+<h2 id="suggestions">Bots can suggest servers</h2>
+<p>Bots can search the official MCP Registry and post a suggestion card in the chat. A suggestion installs nothing: you install it, with one click, and only exact versions from the default npm and PyPI registries, Docker images or HTTPS endpoints qualify. Cards for servers that would run on your computer say so.</p>
+
+<h2 id="approvals">Approvals for tools</h2>
+<p>MCP tool calls follow the bot's <a href="approvals.html#modes">approval mode</a>. Under "Ask only when risky", tools the server marks read-only and not destructive run without a card. That's the server's own claim, and if kwant can't check it, the call asks. Every call a bot makes is recorded on its reply.</p>
+
+<h2 id="api">HTTP API</h2>
+<div class="table-wrap"><table>
+ <thead><tr><th>Route</th><th>What it does</th></tr></thead>
+ <tbody>
+ <tr><td><code>GET /api/mcp/servers</code></td><td>List servers, by name</td></tr>
+ <tr><td><code>POST /api/mcp/servers</code></td><td>Register a server</td></tr>
+ <tr><td><code>PUT /api/mcp/servers/:id</code></td><td>Update one. A masked value keeps the stored secret.</td></tr>
+ <tr><td><code>DELETE /api/mcp/servers/:id</code></td><td>Delete it and remove it from every bot</td></tr>
+ <tr><td><code>POST /api/mcp/servers/:id/test</code></td><td>Initialize, list tools, shut down</td></tr>
+ <tr><td><code>POST /api/mcp/servers/:id/oauth/start</code></td><td>Start a sign-in; returns the URL to open</td></tr>
+ <tr><td><code>GET</code> / <code>PUT /api/kwants/:id/mcp-servers</code></td><td>Read or set a bot's servers</td></tr>
+ </tbody>
+</table></div>
+<pre><code><span class="c"># Register the GitHub server</span>
+curl -X POST http://127.0.0.1:8799/api/mcp/servers \
+ -H 'Content-Type: application/json' \
+ -d '{"name":"github","transport":"stdio","command":"npx",
+ "args":["-y","@modelcontextprotocol/server-github"],
+ "env":{"GITHUB_TOKEN":"…"}}'</code></pre>
+<p>The full contract, including the server object and error codes, is in <a href="https://github.com/alexsergivan/kwant/blob/main/docs/mcp-api.md" rel="noopener">docs/mcp-api.md</a>.</p>
diff --git a/site-src/docs-models.html b/site-src/docs-models.html
new file mode 100644
index 00000000..2732a52d
--- /dev/null
+++ b/site-src/docs-models.html
@@ -0,0 +1,63 @@
+title: Models & accounts
+description: The engines kwant runs on, account profiles with automatic failover, custom OpenAI- or Anthropic-compatible servers, and the Laya model router.
+path: docs/models.html
+nav: models
+---
+<p class="kicker">Docs</p>
+<h1>Models &amp; accounts</h1>
+<p class="intro">Bots run on the CLIs you already use or on API keys. Add several accounts per engine, and kwant moves a turn to the next one when an account runs out of usage.</p>
+
+<h2 id="engines">Engines</h2>
+<ul>
+ <li><strong>Host CLIs:</strong> <code>claude</code>, <code>codex</code> and <code>grok</code>, supervised by kwant, with their own file and shell tools.</li>
+ <li><strong>Provider APIs:</strong> Anthropic, OpenAI and xAI keys.</li>
+ <li><strong>Custom API:</strong> any server that speaks the OpenAI chat API (OpenRouter, LM Studio and others) or the Anthropic Messages API.</li>
+</ul>
+<p>Each bot has a preferred model. Set it to <strong>auto</strong> and kwant picks the model and effort for every message.</p>
+
+<h2 id="profiles">Account profiles</h2>
+<p>A profile is one account for an engine, for example a work Claude subscription and a personal one. Every engine starts with a <strong>This machine</strong> profile, which uses the CLI's own login, or the key from Settings or the environment.</p>
+<div class="table-wrap"><table>
+ <thead><tr><th>Kind</th><th>Runs with</th><th>Signed in by</th></tr></thead>
+ <tbody>
+ <tr><td><code>system</code></td><td>The CLI's default config folder, or the Settings or environment key</td><td>Whatever you did on the host</td></tr>
+ <tr><td><code>cli_home</code></td><td>Its own config folder; host credential variables are removed</td><td>The in-app sign-in, or your own folder</td></tr>
+ <tr><td><code>api_key</code></td><td>The provider's API, with only the profile's key</td><td>The key you paste</td></tr>
+ <tr><td><code>custom_api</code></td><td>Your own server, with its key if it has one</td><td>A check of the server's model list</td></tr>
+ </tbody>
+</table></div>
+<p>Keys are write-only: no API response ever contains one, only whether it's set.</p>
+
+<h3 id="sign-in">Signing in a CLI profile</h3>
+<p>kwant runs the CLI's own login with the profile's folder. For Claude, open the link and paste the code shown back into kwant. For Codex and Grok, open the link and enter the code. A sign-in expires after 10 minutes.</p>
+
+<h3 id="failover">Failover</h3>
+<p>A bot can be pinned to a profile; otherwise the engine's default profile runs. When that profile is out of usage or signed out, and nothing has been shown or done yet in the turn, kwant moves the turn to the engine's next enabled profile by priority, up to 3 attempts, and the chat says so. A profile that ran out is skipped until its reset time. Overloads and rate limits are retried, not failed over. Turn failover off for a bot to keep it on its profile.</p>
+
+<h2 id="custom">Custom API accounts</h2>
+<p>Add an account with the server's base URL and, if needed, a key. kwant checks the server's model list when you save it and shows whether it's ready, unreachable or rejected the key. A space can have several custom accounts, and they belong to that space only.</p>
+<ul>
+ <li>Paste the base URL with or without <code>/chat/completions</code> or <code>/messages</code>: kwant trims it to the API root.</li>
+ <li>MCP tools are offered on OpenAI-chat servers. Anthropic-Messages servers run without tools and say so.</li>
+ <li>Custom API never falls back to the host's accounts.</li>
+</ul>
+
+<h2 id="laya">The Laya router</h2>
+<p><a href="https://huggingface.co/convaiinnovations/laya" rel="noopener">Laya</a> picks which bot answers in a channel, and which model and effort a bot set to auto uses. It's a small Python service, and <code>kwnt serve</code> manages it for you:</p>
+<ol>
+ <li>On first run it installs <code>laya[serve]</code> into <code>~/.kwnt/laya/venv</code>, with <code>uv</code> when present or <code>python3 -m venv</code> otherwise.</li>
+ <li>It starts <code>laya-serve</code> and downloads the English checkpoint (about 420 MB) on first start.</li>
+ <li>It restarts Laya if it exits, and stops it when kwant shuts down.</li>
+</ol>
+<p>The header shows the router's status: green online, amber installing or loading, red offline. While Laya is unavailable, kwant routes by keyword and says so on the routing card.</p>
+<div class="table-wrap"><table>
+ <thead><tr><th>Setting</th><th><code>config.toml</code></th><th>Environment</th><th>Default</th></tr></thead>
+ <tbody>
+ <tr><td>Laya URL</td><td><code>laya_url</code></td><td><code>LAYA_URL</code></td><td><code>http://127.0.0.1:8000</code></td></tr>
+ <tr><td>Manage a local Laya</td><td><code>laya_managed</code></td><td><code>KWNT_LAYA_MANAGED=0</code> or <code>--no-laya</code> to disable</td><td>on</td></tr>
+ <tr><td>Checkpoints to preload</td><td><code>laya_models</code></td><td><code>KWNT_LAYA_MODELS</code></td><td><code>english</code></td></tr>
+ <tr><td>Existing <code>laya-serve</code></td><td></td><td><code>KWNT_LAYA_SERVE_BIN</code></td><td></td></tr>
+ </tbody>
+</table></div>
+<p>kwant only starts Laya for loopback URLs. If Laya already answers, for example from Docker, kwant uses it as is.</p>
+<div class="note"><strong>Behind a proxy that blocks Hugging Face?</strong> Start kwant once on an open network, or copy an existing <code>~/.kwnt/laya/hf</code> from another machine. After that, Laya starts offline.</div>
diff --git a/site-src/docs-quickstart.html b/site-src/docs-quickstart.html
new file mode 100644
index 00000000..21f282ff
--- /dev/null
+++ b/site-src/docs-quickstart.html
@@ -0,0 +1,66 @@
+title: Quickstart
+description: Build kwant from a fresh clone, add an account and ask your first team of bots a question.
+path: docs/quickstart.html
+nav: quickstart
+---
+<p class="kicker">Docs</p>
+<h1>Quickstart</h1>
+<p class="intro">Go from a fresh clone to a team of bots answering in your browser. On most machines it takes a few minutes, plus a one-time model download in the background.</p>
+
+<h2 id="requirements">What you need</h2>
+<ul>
+ <li><strong>Rust</strong> (stable), installed with <a href="https://rustup.rs" rel="noopener">rustup</a>.</li>
+ <li><strong>Node.js 20 or newer</strong> with npm, to build the web app. The finished binary doesn't need it.</li>
+ <li><strong>At least one AI account</strong> for your bots. Any one of these is enough:
+ <ul>
+ <li>the <a href="https://docs.anthropic.com/en/docs/claude-code" rel="noopener"><code>claude</code> CLI</a>, installed. You don't need to sign it in first, because kwant has a <strong>Sign in with Claude</strong> button;</li>
+ <li>the <code>codex</code> or <code>grok</code> CLI, signed in on the same machine (<code>codex login</code>, <code>grok login</code>);</li>
+ <li>an Anthropic, OpenAI or xAI API key, which you add in the app under <strong>Space settings → Accounts</strong>.</li>
+ </ul>
+ </li>
+ <li>Optional: <strong>Docker</strong> for VM mode and the bots' shared browser, and <a href="https://docs.astral.sh/uv/" rel="noopener"><code>uv</code></a> or <code>python3</code> for the Laya router.</li>
+</ul>
+
+<h2 id="run">1. Run from a fresh clone</h2>
+<pre><code>git clone https://github.com/alexsergivan/kwant.git
+cd kwant
+make run <span class="c"># builds the web app, then runs `cargo run -- serve`</span></code></pre>
+<p>Open <strong><a href="http://127.0.0.1:8799">http://127.0.0.1:8799</a></strong>. On your own computer there's nothing to sign in to. If no account works yet, kwant shows a <strong>Get ready</strong> banner with an <strong>Add an account</strong> button.</p>
+<div class="note"><strong>The first start takes a few minutes.</strong> kwant installs its Laya router and downloads its model (about 420 MB) in the background. Bots answer in the meantime, picked by keyword. To skip Laya, run <code>cargo run -- serve --no-laya</code>.</div>
+<p><code>cargo run -- serve</code> on its own works only once <code>frontend/dist</code> exists, because the binary embeds the web app. After the first <code>make run</code> (or <code>make frontend</code>) you can use either.</p>
+
+<h2 id="account">2. Add an account</h2>
+<p>Pick whichever you have:</p>
+<ul>
+ <li><strong>Claude:</strong> click <strong>Sign in with Claude</strong>, open the link and paste the code shown back into kwant.</li>
+ <li><strong>Codex or Grok:</strong> sign the CLI in on this machine, and kwant uses it as is.</li>
+ <li><strong>API key:</strong> open <strong>Space settings → Accounts</strong> and add an Anthropic, OpenAI or xAI key. Keys are write-only: the app never shows them again.</li>
+</ul>
+<p>You can add several accounts per engine, such as a work and a personal one. See <a href="models.html">Models &amp; accounts</a>.</p>
+
+<h2 id="first-question">3. Ask your first question</h2>
+<p>A fresh install's Default space starts with three bots in <strong>#general</strong>, on the <code>@core-engineering</code> team:</p>
+<div class="table-wrap"><table>
+ <thead><tr><th>Bot</th><th>Title</th><th>Good at</th></tr></thead>
+ <tbody>
+ <tr><td><strong>Architect</strong></td><td>Systems Architect</td><td>Architecture, software design, multi-file engineering</td></tr>
+ <tr><td><strong>TechLead</strong></td><td>Staff Engineer &amp; Prototyper</td><td>Fast reasoning, prototyping, clear explanations</td></tr>
+ <tr><td><strong>DevOps</strong></td><td>Systems &amp; Security Engineer</td><td>Shell, servers, containers, security</td></tr>
+ </tbody>
+</table></div>
+<p>Type a question in #general. kwant picks the bot that fits best and shows why. Mention a bot by name (<code>@Architect</code>) to ask it directly, or ask in the team's chat (<code>@core-engineering</code>): when a question needs several views, the lead runs a short discussion and posts one summary.</p>
+<figure>
+ <div class="frame">{{shot:desktop-reasoning|A question in the general channel routed to Architect, with the routing reason and the model and effort used.|(max-width: 860px) 100vw, 760px}}</div>
+ <figcaption>kwant shows which bot it picked and why. Screens on this site come from a sample space.</figcaption>
+</figure>
+
+<h2 id="next">Next steps</h2>
+<ul>
+ <li><a href="bots-and-teams.html">Create bots and teams</a> from ready-made personas.</li>
+ <li><a href="approvals.html">Choose how often bots ask</a> before running commands.</li>
+ <li><a href="install.html">Run kwant on a server</a> with systemd or Docker Compose.</li>
+ <li><a href="mcp.html">Give bots tools</a> like GitHub or Notion through MCP.</li>
+</ul>
+<h2 id="tests">Running the tests</h2>
+<pre><code>cargo test <span class="c"># Rust tests (run `make frontend` first: they need frontend/dist)</span>
+cd frontend &amp;&amp; npm test <span class="c"># web app tests</span></code></pre>
diff --git a/site-src/index.html b/site-src/index.html
new file mode 100644
index 00000000..6ca2619e
--- /dev/null
+++ b/site-src/index.html
@@ -0,0 +1,244 @@
+title: kwant: your own team of AI bots, in one binary
+description: kwant is a self-hosted team of AI bots. They run on the Claude, Codex or Grok CLIs or your API keys, hand work to each other, and ask before anything risky. One binary, on your laptop or a VPS.
+path: index.html
+---
+<section class="hero">
+ <div class="wrap">
+ <div class="hero-copy">
+ <p class="eyebrow"><span class="dot" aria-hidden="true"></span>Self-hosted · one binary · your data</p>
+ <h1>Your own team of <span class="grad">AI bots</span>, working together.</h1>
+ <p class="lede">kwant gives you a team of bots that share chats, hand work to each other with an @mention and wait for your OK before anything risky. Run it on your laptop or a server, with the Claude, Codex or Grok CLI you already use, or your own API keys.</p>
+ <div class="cta">
+ <a class="btn btn-primary" href="docs/quickstart.html">Get started
+ <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10h12M11 5l5 5-5 5"/></svg></a>
+ <a class="btn btn-ghost" href="https://github.com/alexsergivan/kwant" rel="noopener"><svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>View on GitHub</a>
+ </div>
+ <p class="install-line"><span class="p" aria-hidden="true">$</span><code>git clone https://github.com/alexsergivan/kwant.git &amp;&amp; cd kwant &amp;&amp; make run</code></p>
+ </div>
+ <figure class="hero-media">
+ <div class="frame">
+ <div class="frame-bar" aria-hidden="true"><i></i><i></i><i></i><span>127.0.0.1:8799</span></div>
+ {{video!:clip-handoff|Demo: a question in the design-review channel. Designer answers, then hands it to QA with an @mention, and QA replies with a checklist.}}
+ </div>
+ <figcaption class="media-caption">Ask once. Designer answers, then hands the check to QA with an @mention.</figcaption>
+ </figure>
+ </div>
+</section>
+
+<section id="benefits" class="alt">
+ <div class="wrap">
+ <div class="section-head center">
+ <p class="kicker">Why kwant</p>
+ <h2>A real team, not another chat tab</h2>
+ <p>Each bot has its own role, voice and model. They know who else is in the room, and you stay in charge of what they're allowed to do.</p>
+ </div>
+ <div class="benefits">
+ <article class="benefit">
+ <span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 8l-9-5-9 5 9 5 9-5z"/><path d="M3 8v8l9 5 9-5V8"/><path d="M12 13v8"/></svg></span>
+ <h3>One binary</h3>
+ <p><code>kwnt</code> is a single program with the web app and an SQLite database built in. No Node.js at runtime and no database server to set up.</p>
+ </article>
+ <article class="benefit">
+ <span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg></span>
+ <h3>Your laptop or a VPS</h3>
+ <p>On your own computer there's nothing to sign in to. On a server, open the link it prints at startup once. Docker Compose and a systemd unit are included.</p>
+ </article>
+ <article class="benefit">
+ <span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 17l6-6-6-6"/><path d="M12 19h8"/></svg></span>
+ <h3>Any model, any CLI</h3>
+ <p>Use the <code>claude</code>, <code>codex</code> or <code>grok</code> CLI, Anthropic, OpenAI or xAI API keys, or any OpenAI-compatible server like OpenRouter or LM Studio.</p>
+ </article>
+ <article class="benefit">
+ <span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="8" r="3"/><circle cx="17" cy="16" r="3"/><path d="M10.5 10.5l4 4"/><path d="M17 5v4M15 7h4"/></svg></span>
+ <h3>Bots that hand off</h3>
+ <p>When a reply @mentions a teammate, that teammate answers next in the same chat. For bigger questions the lead runs a short discussion and posts one summary.</p>
+ </article>
+ <article class="benefit">
+ <span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6l8-3z"/><path d="M9 12l2 2 4-4"/></svg></span>
+ <h3>You approve risky actions</h3>
+ <p>Commands and edits outside a bot's own folder wait for Allow once, Always allow or Deny. Or let kwant ask only when something looks risky.</p>
+ </article>
+ <article class="benefit">
+ <span class="icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 018 0v3"/></svg></span>
+ <h3>Your data stays yours</h3>
+ <p>Chats, bots and settings live in kwant's data folder on your machine. Saved website logins can live in your own Bitwarden.</p>
+ </article>
+ </div>
+ </div>
+</section>
+
+<section id="features">
+ <div class="wrap">
+ <div class="section-head">
+ <p class="kicker">Features</p>
+ <h2>Everything a small team needs</h2>
+ <p>These are real screens from kwant, running a sample space called Trailhead with a four-bot product team.</p>
+ </div>
+
+ <div class="showcase">
+ <div class="row">
+ <div class="row-copy">
+ <h3>Ask the team. Get one answer.</h3>
+ <p>Ask a team a question that needs several views and the lead takes it from there. It opens with a short take, or asks you first if something's unclear. Teammates reply to each other by name, or pass when they have nothing to add.</p>
+ <ul class="checks">
+ <li>The back-and-forth folds into a <strong>Team discussed</strong> thread</li>
+ <li>The chat shows the lead's summary, with who said what</li>
+ <li>Open the fold to read every turn</li>
+ </ul>
+ </div>
+ <div class="frame">{{shot:desktop-team-discussion|The Product team chat. A question about adding a trip waitlist, a collapsed "Team discussed, 4 turns" fold, and TechLead's summary covering flow, backend, hold length, UI and the release gate.}}</div>
+ </div>
+
+ <div class="row flip">
+ <div class="row-copy">
+ <h3>Nothing risky runs without your OK</h3>
+ <p>When a bot wants to run a command, edit a file outside its folder or call a tool like GitHub, you see exactly what it will do, arguments and all.</p>
+ <ul class="checks">
+ <li><strong>Allow once</strong>, <strong>Always allow</strong> or <strong>Deny</strong>, per action</li>
+ <li>Three modes per space or bot: ask every time, ask only when risky, or don't ask</li>
+ <li>kwant's own secret files are refused in every mode</li>
+ </ul>
+ </div>
+ <div class="frame">{{video:clip-approval|Demo: TechLead asks to create a GitHub pull request. An approval card shows the full arguments, the user clicks Allow Once, and the reply confirms pull request 482 is open.}}</div>
+ </div>
+
+ <div class="row">
+ <div class="row-copy">
+ <h3>A new teammate in seconds</h3>
+ <p>Start from a ready-made persona: Tech roles like Security, QA or SRE, non-tech ones like Research, Legal or Support, or lifestyle helpers like Travel Planner and Chef. Or start blank.</p>
+ <ul class="checks">
+ <li>Name, role and avatar fill in for you</li>
+ <li>Every preset comes with a <strong>Soul</strong>: its voice, values and quirks</li>
+ <li>Pick a model, or let kwant choose one per message</li>
+ </ul>
+ </div>
+ <div class="frame">{{video:clip-new-bot|Demo: New bot, the Security preset is picked, the name, role and avatar fill in, and the new SecurityAuditor bot opens ready to chat.}}</div>
+ </div>
+ </div>
+ </div>
+</section>
+
+<section class="alt" aria-labelledby="more-title">
+ <div class="wrap">
+ <div class="section-head">
+ <p class="kicker">And more</p>
+ <h2 id="more-title">Built for day-to-day work</h2>
+ </div>
+ <div class="grid">
+ <article class="card">
+ <span class="shot">{{shot:desktop-handoff|The design-review channel. Designer answers a question about empty states, then @mentions QA, and QA checks it on a 360 pixel screen.|(max-width: 720px) 100vw, (max-width: 1024px) 50vw, 370px}}</span>
+ <div class="card-body"><h3>Handoffs with an @mention</h3><p>Mention a teammate, or <code>@everyone</code>, and they pick it up right after, up to four handoffs per message.</p></div>
+ </article>
+ <article class="card">
+ <span class="shot">{{shot:desktop-reasoning|The general channel. kwant routes a Postgres or queue question to Architect and shows why, plus the model and effort it used.|(max-width: 720px) 100vw, (max-width: 1024px) 50vw, 370px}}</span>
+ <div class="card-body"><h3>The right bot and model</h3><p>The Laya router picks who answers in a channel, and the model and effort for bots set to auto. If it's offline, kwant routes by keyword.</p></div>
+ </article>
+ <article class="card">
+ <span class="shot">{{shot:desktop-manage-team|The Manage Team dialog with the team handle, mission, pinned team instructions, workspace, lead and roster.|(max-width: 720px) 100vw, (max-width: 1024px) 50vw, 370px}}</span>
+ <div class="card-body"><h3>Teams with a lead</h3><p>Give a team a mission, pinned instructions every member follows, a lead and a shared workspace.</p></div>
+ </article>
+ <article class="card">
+ <span class="shot">{{shot:desktop-usage|A bot's Usage tab showing calls, cache share, fresh, cached and output tokens, a breakdown by purpose and recent calls.|(max-width: 720px) 100vw, (max-width: 1024px) 50vw, 370px}}</span>
+ <div class="card-body"><h3>See what each bot uses</h3><p>For API-key bots, a Usage tab breaks tokens down by purpose, cache and call.</p></div>
+ </article>
+ <article class="card">
+ <span class="shot">{{shot:desktop-approval-done|After Allow Once, TechLead reports that pull request 482 is open, with a receipt: used 1 tool, create pull request, done.|(max-width: 720px) 100vw, (max-width: 1024px) 50vw, 370px}}</span>
+ <div class="card-body"><h3>A receipt for every tool</h3><p>Replies list the tools a bot used and how each call ended, so nothing happens out of sight.</p></div>
+ </article>
+ <article class="card">
+ <span class="shot">{{shot:desktop-presets|The New bot dialog with the Security preset picked, showing Tech, Non-tech and Lifestyle tabs and the avatar grid.|(max-width: 720px) 100vw, (max-width: 1024px) 50vw, 370px}}</span>
+ <div class="card-body"><h3>Personas and souls</h3><p>Every bot has a persona for what it does, a soul for how it speaks, and a pixel avatar.</p></div>
+ </article>
+ </div>
+ </div>
+</section>
+
+<section aria-labelledby="phone-title">
+ <div class="wrap phones">
+ <div class="section-head">
+ <p class="kicker">Anywhere</p>
+ <h2 id="phone-title">Check in from your phone</h2>
+ <p>The web app works on a phone, so you can read the team's summary or approve an action while you're away from your desk.</p>
+ </div>
+ <div class="phone">{{shot:phone-team-chat|The Product team summary on a phone screen.|260px}}</div>
+ <div class="phone lift">{{shot:phone-approval|The approval card for a GitHub pull request on a phone screen.|260px}}</div>
+ </div>
+</section>
+
+<section id="how" class="alt">
+ <div class="wrap">
+ <div class="section-head center">
+ <p class="kicker">How it works</p>
+ <h2>Running in three steps</h2>
+ </div>
+ <div class="steps">
+ <article class="step">
+ <h3>Build and run</h3>
+ <p>You need Rust and Node.js 20+ to build. The finished binary needs neither.</p>
+<pre><code>git clone https://github.com/alexsergivan/kwant.git
+cd kwant
+make run</code></pre>
+ </article>
+ <article class="step">
+ <h3>Add an account</h3>
+ <p>Use the <strong>Sign in with Claude</strong> button, a signed-in <code>codex</code> or <code>grok</code> CLI, or add an API key under <strong>Space settings → Accounts</strong>.</p>
+ </article>
+ <article class="step">
+ <h3>Ask your team</h3>
+ <p>Open <code>http://127.0.0.1:8799</code>. Architect, TechLead and DevOps are already in #general. Ask them something, or create your own team.</p>
+ </article>
+ </div>
+ </div>
+</section>
+
+<section id="faq">
+ <div class="wrap">
+ <div class="section-head center">
+ <p class="kicker">FAQ</p>
+ <h2>Questions, answered</h2>
+ </div>
+ <div class="faq">
+ <details>
+ <summary>Do I need an API key?</summary>
+ <div><p>No. Any one account is enough: the <code>claude</code> CLI (kwant has a Sign in with Claude button), the <code>codex</code> or <code>grok</code> CLI signed in on the same machine, or an Anthropic, OpenAI or xAI API key.</p></div>
+ </details>
+ <details>
+ <summary>Where does my data live?</summary>
+ <div><p>In kwant's data folder, <code>~/.kwnt</code> by default, or wherever <code>KWNT_DATA_DIR</code> points. Chats, bots and settings are in an SQLite database there. The models themselves run wherever your chosen CLI or API runs them.</p></div>
+ </details>
+ <details>
+ <summary>Can a bot run commands on my computer?</summary>
+ <div><p>Only within the limits you set. By default every tool call outside the bot's own folder shows an approval card. You can switch a space or a single bot to "Ask only when risky" or "Don't ask". In any mode, calls that name kwant's own secret files are refused.</p></div>
+ </details>
+ <details>
+ <summary>Can I run it on a server?</summary>
+ <div><p>Yes. Copy the binary to a VPS and run <code>kwnt serve --host 0.0.0.0</code>, or use the included Docker Compose file. Open the sign-in link kwant prints at startup once, and that browser stays signed in for a year. Put an HTTPS reverse proxy in front of it.</p></div>
+ </details>
+ <details>
+ <summary>Do I need Docker?</summary>
+ <div><p>Only for VM mode, which runs the bots' shared browser and kwant's built-in shell in containers. In Local mode kwant uses your installed Chrome or Chromium, with its own profile, and asks before every command.</p></div>
+ </details>
+ <details>
+ <summary>What is Laya?</summary>
+ <div><p>A small routing model (<a href="https://huggingface.co/convaiinnovations/laya" rel="noopener">convaiinnovations/laya</a>) that picks which bot answers in a channel, and which model and effort a bot set to auto uses. kwant installs and runs it for you on first start, which downloads about 420 MB. Skip it with <code>--no-laya</code>, and kwant routes by keyword.</p></div>
+ </details>
+ <details>
+ <summary>Can bots use other tools, like GitHub or Notion?</summary>
+ <div><p>Yes, through MCP servers. Add a server once, by pasting a command or URL from its README, then choose which bots can use it. A bot only ever sees the servers you gave it. Servers that need a sign-in use OAuth.</p></div>
+ </details>
+ </div>
+ </div>
+</section>
+
+<section class="tight-top" aria-labelledby="closing-title">
+ <div class="wrap">
+ <div class="closing">
+ <h2 id="closing-title">Put your team to work</h2>
+ <p>Clone it, run <code>make run</code> and ask your first question in a few minutes.</p>
+ <div class="cta">
+ <a class="btn btn-primary" href="docs/quickstart.html">Read the quickstart</a>
+ <a class="btn btn-ghost" href="docs/install.html">Run it on a server</a>
+ </div>
+ </div>
+ </div>
+</section>
diff --git a/site/assets/css/site.css b/site/assets/css/site.css
new file mode 100644
index 00000000..56c09ed6
--- /dev/null
+++ b/site/assets/css/site.css
@@ -0,0 +1,400 @@
+/* kwant site. Colours are sampled from the product UI (frontend, main 69089c2). */
+@font-face {
+ font-family: "Inter";
+ src: url("../fonts/inter-var.woff2") format("woff2");
+ font-weight: 100 900;
+ font-style: normal;
+ font-display: swap;
+}
+@font-face {
+ font-family: "JetBrains Mono";
+ src: url("../fonts/jetbrains-mono-var.woff2") format("woff2");
+ font-weight: 100 800;
+ font-style: normal;
+ font-display: swap;
+}
+
+:root {
+ --bg: #0d0a1d;
+ --bg-2: #120d26;
+ --surface: #171332;
+ --surface-2: #1c173d;
+ --line: #2c2552;
+ --line-soft: #221c45;
+ --text: #ecebfa;
+ --muted: #b3afd3;
+ --dim: #8c86b3;
+ --accent: #6c58e0;
+ --accent-hi: #7d6bea;
+ --accent-text: #ada2ff;
+ --radius: 14px;
+ --radius-sm: 10px;
+ --wrap: 1160px;
+ --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
+ --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
+ color-scheme: dark;
+}
+
+*, *::before, *::after { box-sizing: border-box; }
+html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--text);
+ font: 400 16px/1.65 var(--sans);
+ font-feature-settings: "cv11", "ss01";
+ -webkit-font-smoothing: antialiased;
+ text-rendering: optimizeLegibility;
+}
+img, video { display: block; max-width: 100%; height: auto; }
+a { color: var(--accent-text); text-decoration: none; }
+a:hover { text-decoration: underline; text-underline-offset: 3px; }
+:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 6px; }
+code, pre, kbd { font-family: var(--mono); font-size: 0.875em; }
+::selection { background: rgba(108, 88, 224, 0.45); }
+
+.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
+.skip {
+ position: absolute; left: 16px; top: -48px; z-index: 100;
+ background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px;
+}
+.skip:focus { top: 12px; }
+.sr-only {
+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
+ overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
+}
+
+/* ---------- Header ---------- */
+.site-header {
+ position: sticky; top: 0; z-index: 50;
+ background: rgba(13, 10, 29, 0.82);
+ -webkit-backdrop-filter: saturate(140%) blur(12px);
+ backdrop-filter: saturate(140%) blur(12px);
+ border-bottom: 1px solid var(--line-soft);
+}
+.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
+.brand {
+ display: inline-flex; align-items: center; gap: 10px;
+ color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
+}
+.brand:hover { text-decoration: none; }
+.brand svg { width: 28px; height: 28px; flex: none; }
+.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
+.nav a {
+ color: var(--muted); font-size: 15px; font-weight: 500;
+ padding: 8px 12px; border-radius: 8px;
+}
+.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface); text-decoration: none; }
+.nav .btn { margin-left: 8px; }
+
+/* ---------- Buttons ---------- */
+.btn {
+ display: inline-flex; align-items: center; justify-content: center; gap: 8px;
+ min-height: 44px; padding: 10px 20px; border-radius: 10px;
+ font: 600 15px/1.2 var(--sans); white-space: nowrap;
+ border: 1px solid transparent; cursor: pointer;
+ transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
+}
+.btn:hover { text-decoration: none; }
+.btn svg { width: 18px; height: 18px; flex: none; }
+.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 24px -8px rgba(108, 88, 224, 0.7); }
+.btn-primary:hover { background: var(--accent-hi); }
+.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
+.btn-ghost:hover { background: var(--surface-2); border-color: #3a3268; }
+.nav .btn { min-height: 38px; padding: 8px 14px; font-size: 14px; }
+.nav .btn-ghost { color: var(--text); }
+
+/* ---------- Hero ---------- */
+.hero { position: relative; padding: 64px 0 40px; overflow: hidden; }
+.hero::before {
+ content: ""; position: absolute; inset: -20% -10% auto; height: 760px; z-index: -1;
+ background:
+ radial-gradient(48% 52% at 50% 0%, rgba(108, 88, 224, 0.28), transparent 70%),
+ radial-gradient(30% 40% at 82% 18%, rgba(244, 157, 10, 0.08), transparent 70%);
+}
+.hero-copy { max-width: 780px; margin: 0 auto; text-align: center; }
+.eyebrow {
+ display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px;
+ padding: 6px 14px; border-radius: 999px;
+ background: rgba(28, 23, 61, 0.8); border: 1px solid var(--line);
+ color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0.01em;
+}
+.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
+h1, h2, h3 { letter-spacing: -0.025em; line-height: 1.15; margin: 0; }
+.hero h1 { font-size: clamp(38px, 6.2vw, 68px); font-weight: 750; letter-spacing: -0.035em; line-height: 1.04; }
+.grad {
+ background: linear-gradient(92deg, #c9c1ff 0%, #8f7dff 45%, #f3b54a 100%);
+ -webkit-background-clip: text; background-clip: text; color: transparent;
+}
+.lede { margin: 24px auto 0; max-width: 640px; color: var(--muted); font-size: clamp(17px, 2vw, 19px); line-height: 1.6; }
+.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 34px; }
+.install-line {
+ display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; max-width: 100%;
+ padding: 10px 10px 10px 16px; border-radius: 10px;
+ background: var(--bg-2); border: 1px solid var(--line-soft);
+ font: 500 13.5px/1.4 var(--mono); color: var(--muted);
+}
+.install-line code { font-size: inherit; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
+.install-line code::-webkit-scrollbar { display: none; }
+.install-line .p { color: var(--dim); user-select: none; }
+
+/* Window frame around product media */
+.frame {
+ position: relative; border-radius: var(--radius); overflow: hidden;
+ background: var(--bg-2); border: 1px solid var(--line);
+ box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
+}
+.frame-bar {
+ display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
+ background: #100c22; border-bottom: 1px solid var(--line-soft);
+}
+.frame-bar i { width: 11px; height: 11px; border-radius: 50%; background: #2c2552; }
+.frame-bar span { margin-left: 10px; color: var(--dim); font: 500 12px/1 var(--mono); }
+.frame video, .frame img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; background: var(--surface); }
+.hero-media { margin: 44px auto 0; max-width: 1060px; }
+.media-caption { margin: 14px 0 0; text-align: center; color: var(--dim); font-size: 14px; }
+
+/* ---------- Sections ---------- */
+section { padding: 96px 0; }
+.section-head { max-width: 680px; margin: 0 0 48px; }
+.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
+.kicker { margin: 0 0 12px; color: var(--accent-text); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
+h2 { font-size: clamp(30px, 4vw, 44px); font-weight: 720; }
+.section-head p:not(.kicker) { margin: 16px 0 0; color: var(--muted); font-size: 18px; }
+.alt { background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-top: 1px solid var(--line-soft); }
+
+/* Benefits */
+.benefits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
+.benefit {
+ padding: 26px; border-radius: var(--radius);
+ background: var(--surface); border: 1px solid var(--line-soft);
+}
+.benefit h3 { font-size: 18px; font-weight: 650; margin-top: 18px; letter-spacing: -0.01em; }
+.benefit p { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; }
+.icon {
+ display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
+ background: rgba(108, 88, 224, 0.16); border: 1px solid rgba(125, 107, 234, 0.35); color: #c3b9ff;
+}
+.icon svg { width: 22px; height: 22px; }
+
+/* Showcase rows */
+.showcase { display: grid; gap: 112px; }
+.row { display: grid; grid-template-columns: 5fr 7fr; gap: 56px; align-items: center; }
+.row.flip { grid-template-columns: 7fr 5fr; }
+.row.flip .row-copy { order: 2; }
+.row-copy h3 { font-size: clamp(26px, 3vw, 34px); font-weight: 700; }
+.row-copy > p { margin: 16px 0 0; color: var(--muted); font-size: 17px; }
+.checks { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
+.checks li { position: relative; padding-left: 30px; color: var(--text); font-size: 15.5px; }
+.checks li::before {
+ content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%;
+ background: rgba(108, 88, 224, 0.2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23c3b9ff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 10.5l3 3 6-7'/%3E%3C/svg%3E") center / 14px no-repeat;
+}
+.checks code, .row-copy code, .card p code, .faq code {
+ padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-soft); color: #d9d4ff;
+}
+
+/* Feature grid */
+.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
+.card {
+ display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius);
+ background: var(--surface); border: 1px solid var(--line-soft);
+ transition: border-color .2s ease, transform .2s ease;
+}
+.card:hover { border-color: var(--line); transform: translateY(-2px); }
+.card .shot { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--line-soft); background: var(--bg-2); }
+.card .shot img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 0%); }
+.card-body { padding: 20px 22px 24px; }
+.card h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
+.card p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
+
+/* Phones */
+.phones { display: grid; grid-template-columns: 1fr auto auto; gap: 40px; align-items: center; }
+.phone {
+ width: 260px; border-radius: 34px; padding: 10px; background: #0a0818;
+ border: 1px solid var(--line); box-shadow: 0 40px 70px -30px rgba(0, 0, 0, 0.9);
+}
+.phone img { border-radius: 25px; width: 100%; aspect-ratio: 390 / 844; object-fit: cover; }
+.phone.lift { transform: translateY(-28px); }
+
+/* How it works */
+.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: step; }
+.step {
+ position: relative; padding: 28px 26px 26px; border-radius: var(--radius);
+ background: var(--surface); border: 1px solid var(--line-soft);
+}
+.step::before {
+ counter-increment: step; content: counter(step);
+ display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
+ background: var(--accent); color: #fff; font-weight: 700; font-size: 15px;
+}
+.step h3 { margin-top: 18px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
+.step p { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; }
+.step pre { margin: 16px 0 0; }
+
+/* Code */
+pre {
+ position: relative; margin: 20px 0; padding: 16px 18px; overflow-x: auto;
+ border-radius: var(--radius-sm); background: #0a0818; border: 1px solid var(--line-soft);
+ color: #dcd8f5; line-height: 1.6; font-size: 13.5px; tab-size: 2;
+}
+pre code { font-size: inherit; }
+pre .c { color: var(--dim); }
+.copy {
+ position: absolute; top: 8px; right: 8px; padding: 4px 10px; border-radius: 7px;
+ background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
+ font: 500 12px/1.5 var(--sans); cursor: pointer; opacity: 0; transition: opacity .15s ease;
+}
+pre:hover .copy, .copy:focus-visible { opacity: 1; }
+@media (hover: none) { .copy { opacity: 1; } }
+
+/* FAQ */
+.faq { max-width: 820px; margin: 0 auto; display: grid; gap: 12px; }
+.faq details { border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line-soft); }
+.faq details[open] { border-color: var(--line); }
+.faq summary {
+ display: flex; align-items: center; justify-content: space-between; gap: 16px;
+ padding: 18px 22px; cursor: pointer; list-style: none; font-weight: 600; font-size: 16.5px;
+}
+.faq summary::-webkit-details-marker { display: none; }
+.faq summary::after {
+ content: ""; flex: none; width: 10px; height: 10px; margin-top: -4px;
+ border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(45deg);
+ transition: transform .2s ease;
+}
+.faq details[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
+.faq details > div { padding: 0 22px 20px; color: var(--muted); }
+.faq details > div p { margin: 0 0 10px; }
+.faq details > div p:last-child { margin: 0; }
+
+/* Closing CTA */
+.closing {
+ text-align: center; padding: 64px 32px; border-radius: 22px;
+ background: radial-gradient(70% 120% at 50% 0%, rgba(108, 88, 224, 0.32), transparent 70%), var(--surface);
+ border: 1px solid var(--line);
+}
+.closing h2 { font-size: clamp(28px, 3.6vw, 40px); }
+.closing p { margin: 14px auto 0; max-width: 560px; color: var(--muted); font-size: 17px; }
+
+/* Footer */
+.site-footer { border-top: 1px solid var(--line-soft); padding: 40px 0 48px; color: var(--dim); font-size: 14px; }
+.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 24px; }
+.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
+.site-footer nav a { color: var(--muted); }
+.site-footer p { margin: 8px 0 0; max-width: 440px; }
+
+/* Lightbox */
+.zoom { cursor: zoom-in; }
+dialog.lightbox {
+ width: min(1400px, 96vw); max-width: none; max-height: 94vh; padding: 0; border: 1px solid var(--line);
+ border-radius: var(--radius); background: var(--bg-2); color: var(--text); overflow: hidden;
+}
+dialog.lightbox::backdrop { background: rgba(6, 4, 15, 0.86); }
+dialog.lightbox img { width: 100%; max-height: calc(94vh - 52px); object-fit: contain; }
+dialog.lightbox .lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 18px; font-size: 14px; color: var(--muted); }
+dialog.lightbox button { min-height: 32px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 500 13px var(--sans); cursor: pointer; }
+
+/* ---------- Docs ---------- */
+.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; padding: 48px 24px 96px; }
+.docs-nav { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; }
+.docs-nav h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 0 0 10px 12px; }
+.docs-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
+.docs-nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 15px; font-weight: 500; }
+.docs-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
+.docs-nav a[aria-current="page"] { background: rgba(108, 88, 224, 0.16); color: #e4e0ff; box-shadow: inset 2px 0 0 var(--accent-hi); }
+.prose { max-width: 760px; }
+.prose .kicker { margin-bottom: 10px; }
+.prose h1 { font-size: clamp(32px, 4.2vw, 44px); font-weight: 740; letter-spacing: -0.03em; }
+.prose .intro { margin: 16px 0 8px; color: var(--muted); font-size: 18.5px; }
+.prose h2 { font-size: 25px; font-weight: 680; margin: 52px 0 0; padding-top: 4px; letter-spacing: -0.02em; }
+.prose h3 { font-size: 18.5px; font-weight: 650; margin: 32px 0 0; letter-spacing: -0.01em; }
+.prose p, .prose ul, .prose ol { margin: 14px 0 0; color: #d6d3ee; }
+.prose ul, .prose ol { padding-left: 22px; }
+.prose li { margin: 6px 0; }
+.prose li::marker { color: var(--dim); }
+.prose strong { color: var(--text); font-weight: 620; }
+.prose :not(pre) > code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-soft); color: #dcd7ff; overflow-wrap: anywhere; }
+.prose h2 a.anchor, .prose h3 a.anchor { color: inherit; }
+.prose figure { margin: 28px 0; }
+.prose figure .frame img { aspect-ratio: auto; }
+.prose figcaption { margin-top: 10px; color: var(--dim); font-size: 14px; }
+.table-wrap { margin: 20px 0 0; overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); }
+.table-wrap table { min-width: 560px; }
+.table-wrap:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
+table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
+th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
+th { background: var(--surface); color: var(--text); font-weight: 600; white-space: nowrap; }
+td { color: #d6d3ee; }
+tr:last-child td { border-bottom: 0; }
+td code { white-space: nowrap; }
+.note {
+ margin: 22px 0 0; padding: 14px 18px; border-radius: var(--radius-sm);
+ background: rgba(108, 88, 224, 0.1); border: 1px solid rgba(125, 107, 234, 0.3); color: #dcd8f5;
+}
+.note.warn { background: rgba(244, 157, 10, 0.08); border-color: rgba(244, 157, 10, 0.32); }
+.note strong:first-child { color: var(--text); }
+.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 64px; }
+.pager a {
+ display: block; padding: 16px 18px; border-radius: var(--radius-sm);
+ background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); font-weight: 600;
+}
+.pager a:hover { border-color: var(--line); text-decoration: none; }
+.pager small { display: block; color: var(--dim); font-weight: 500; font-size: 13px; margin-bottom: 2px; }
+.pager .next { text-align: right; grid-column: 2; }
+.source { margin-top: 40px; color: var(--dim); font-size: 14px; }
+
+/* 404 */
+.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 24px; }
+.notfound .code { font: 700 96px/1 var(--mono); color: var(--line); letter-spacing: -0.04em; }
+
+/* ---------- Responsive ---------- */
+@media (max-width: 1024px) {
+ .benefits, .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ .row, .row.flip { grid-template-columns: minmax(0, 1fr); gap: 32px; }
+ .row.flip .row-copy { order: 0; }
+ .phones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ .phones .section-head { grid-column: 1 / -1; margin-bottom: 0; }
+ .phone { justify-self: center; }
+ .phone.lift { transform: none; }
+}
+@media (max-width: 860px) {
+ .docs { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 20px; }
+ .docs-nav { position: static; max-height: none; margin: 0 -24px; padding: 0 24px 12px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
+ .docs-nav h2 { display: none; }
+ .docs-nav ul { display: flex; gap: 6px; width: max-content; }
+ .docs-nav a { white-space: nowrap; padding: 7px 12px; border: 1px solid var(--line-soft); font-size: 14px; }
+ .docs-nav a[aria-current="page"] { box-shadow: none; border-color: rgba(125, 107, 234, 0.5); }
+ .steps { grid-template-columns: minmax(0, 1fr); }
+}
+@media (max-width: 720px) {
+ .nav .hide-sm { display: none; }
+ section { padding: 72px 0; }
+ .hero { padding-top: 56px; }
+ .benefits, .grid { grid-template-columns: minmax(0, 1fr); }
+ .showcase { gap: 80px; }
+ .frame-bar { height: 28px; }
+ .frame-bar i { width: 9px; height: 9px; }
+ .frame-bar span { display: none; }
+ .phone { width: 100%; max-width: 230px; border-radius: 28px; padding: 8px; }
+ .phone img { border-radius: 21px; }
+ .pager { grid-template-columns: minmax(0, 1fr); }
+ .pager .next { grid-column: 1; }
+}
+@media (max-width: 420px) {
+ .wrap { padding: 0 18px; }
+ .site-header .wrap { gap: 10px; }
+ .nav a { padding: 8px 9px; }
+ .nav .btn { margin-left: 2px; padding: 8px 11px; }
+ .cta .btn { flex: 1 1 100%; }
+ .install-line { font-size: 12.5px; }
+ .phones { gap: 16px; }
+ .phone { border-radius: 22px; padding: 6px; }
+ .phone img { border-radius: 17px; }
+ .docs { padding-left: 18px; padding-right: 18px; }
+ .docs-nav { margin: 0 -18px; padding: 0 18px 12px; }
+}
+@media (prefers-reduced-motion: reduce) {
+ *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
+ .card:hover { transform: none; }
+}
+.tight-top { padding-top: 0; }
diff --git a/site/assets/js/site.js b/site/assets/js/site.js
new file mode 100644
index 00000000..87ef8db0
--- /dev/null
+++ b/site/assets/js/site.js
@@ -0,0 +1,82 @@
+// kwant site: small progressive enhancements. Everything works without this file.
+(function () {
+ "use strict";
+ var reduce = window.matchMedia("(prefers-reduced-motion: reduce)");
+
+ // Demo videos play while on screen, unless the visitor prefers reduced motion.
+ var videos = document.querySelectorAll("video[data-autoplay]");
+ if (videos.length && "IntersectionObserver" in window) {
+ var io = new IntersectionObserver(function (entries) {
+ entries.forEach(function (e) {
+ var v = e.target;
+ if (e.isIntersecting && !reduce.matches) {
+ if (v.preload === "none") v.preload = "auto";
+ var p = v.play();
+ if (p && p.catch) p.catch(function () { v.controls = true; });
+ } else {
+ v.pause();
+ }
+ });
+ }, { threshold: 0.2 });
+ videos.forEach(function (v) {
+ v.controls = reduce.matches;
+ io.observe(v);
+ });
+ }
+
+ // On small screens the docs nav is a sideways strip: keep the current page's tab in view.
+ var current = document.querySelector(".docs-nav a[aria-current]");
+ if (current) {
+ var strip = current.closest(".docs-nav");
+ if (strip.scrollWidth > strip.clientWidth) strip.scrollLeft = current.offsetLeft - strip.offsetLeft - 18;
+ }
+
+ // Scrollable tables can be reached and scrolled with the keyboard.
+ document.querySelectorAll(".table-wrap").forEach(function (w) {
+ if (w.scrollWidth > w.clientWidth) {
+ w.tabIndex = 0;
+ w.setAttribute("role", "region");
+ w.setAttribute("aria-label", "Table, scrolls sideways");
+ }
+ });
+
+ // Copy buttons on code blocks.
+ document.querySelectorAll("pre > code").forEach(function (code) {
+ if (!navigator.clipboard) return;
+ var btn = document.createElement("button");
+ btn.type = "button";
+ btn.className = "copy";
+ btn.textContent = "Copy";
+ btn.addEventListener("click", function () {
+ var text = code.innerText.replace(/\n$/, "");
+ navigator.clipboard.writeText(text).then(function () {
+ btn.textContent = "Copied";
+ setTimeout(function () { btn.textContent = "Copy"; }, 1600);
+ });
+ });
+ code.parentNode.appendChild(btn);
+ });
+
+ // Screenshot lightbox. Links still open the full-size image without JS.
+ var dlg = document.createElement("dialog");
+ if (typeof dlg.showModal !== "function") return;
+ dlg.className = "lightbox";
+ dlg.innerHTML = '<img alt=""><div class="lb-bar"><span></span><button type="button">Close</button></div>';
+ document.body.appendChild(dlg);
+ var img = dlg.querySelector("img");
+ var cap = dlg.querySelector("span");
+ dlg.querySelector("button").addEventListener("click", function () { dlg.close(); });
+ dlg.addEventListener("click", function (e) { if (e.target === dlg) dlg.close(); });
+ dlg.addEventListener("close", function () { img.removeAttribute("src"); });
+ document.querySelectorAll("a.zoom").forEach(function (a) {
+ a.addEventListener("click", function (e) {
+ if (e.metaKey || e.ctrlKey || e.shiftKey) return;
+ e.preventDefault();
+ var inner = a.querySelector("img");
+ img.src = a.getAttribute("href");
+ img.alt = inner ? inner.alt : "";
+ cap.textContent = a.getAttribute("data-caption") || img.alt;
+ dlg.showModal();
+ });
+ });
+})();