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.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
// Wording (Spaces IA §5): visible text says "kwant bots" in headings and "bot" in sentences,
// never a bare "kwant", "kwnt" or "agent". Scans string literals and JSX text in src/ with the
// TypeScript parser; comments, imports, ids, keys and other single lowercase words are skipped.
import assert from 'node:assert/strict';
import test from 'node:test';
import { readdirSync, readFileSync } from 'node:fs';
import { join, relative } from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
const root = fileURLToPath(new URL('..', import.meta.url));
const src = join(root, 'src');
const files = (dir) =>
readdirSync(dir, { withFileTypes: true }).flatMap((e) =>
e.isDirectory() ? files(join(dir, e.name)) : /\.tsx?$/.test(e.name) && !e.name.endsWith('.d.ts') ? [join(dir, e.name)] : [],
);
const BAD = /\b(kwants?|kwnt|agents?)\b/i;
// The product term (headings, tagline), the CLI commands and token file shown on the sign-in screen, and
// Agent Maestro, the VS Code extension's own name (a Custom API preset), and "coding agent", what
// Claude Code, Codex and Cursor are called in Settings → Coding agents (0.7.4).
// 0.9.8 first screen (Mira, first-screen F): the product's own name in the welcome and the claude.ai step.
const ALLOWED = /\bWelcome to kwant\b|\ballow kwant\.|\bkwant bots?\b|\bcoding agents?\b|\b(?:exec kwnt )?kwnt (?:token|signin-link)\b|~\/\.kwnt\/api-token/gi;
const MAESTRO = /\bAgent Maestro\b|\bHermes Agent\b/g;
// T/D preview sheet (0.7.7): Mira's review-396-397 must-fix 7 and Ada's deviation-4 ruling keep "kwant"
// as the subject in these three sentences only.
// Run Claude inside the VM (0.7.7): Mira's ui-check-450 must-fix 2 names kwant, the program on the computer,
// in these settings and chat-notice sentences ("Restart kwant" is what a person on a phone has to do).
// Import from this computer, a folder or a GitHub link (0.8.0 A4): Mira's a4-import.md names kwant, the program
// that looks and fetches, in these sentences. A4 follow-ups: Mira's ui-check-459 Later 4 ("kwant can’t download it") and
// the https-only reason ("kwant only downloads from github.com").
// Worktrees tab (0.9.0 H1): Mira's h1-worktrees.md names kwant, the program that makes and cleans the folders, in its
// status and inline-error copy.
// Done-check card (0.9.8): Mira's done-check/design.md keeps kwant as the subject of the server's `how` 'kwant compared the reply with what you asked for'.
// Allowed without asking (0.9.22 25e): Mira's design-check-768 fix 4 says whose restart, in the docs' words ("also after kwant restarts").
const RULED = /\bafter kwant restarts\b|\bkwant compared the reply with what you asked for\b|\bkwant (?:can remove it|won’t delete it|won’t write into it|suggests one from the task|cleans build output)\b|\bmade outside kwant\b|\bso kwant can read\b|\bmanifests kwant knows\b|\bnames kwant knows\b|\bkwant’s (?:browser|log|own data|tools)\b|\bkwant (?:adds it|couldn’t|won’t share|keeps|is running as root|can’t pass|can’t fetch|can’t download|only downloads)\b|\b[Rr]estart kwant\b|\bStart kwant as\b|\bkwant (?:looked|never follows|downloads it|found nothing|doesn’t fetch)\b|\bNothing kwant can bring\b|\bwhere kwant looked\b|\bsent kwant somewhere\b/g;
// Connect Home Assistant (0.9.21 26e): Mira's connect-home-assistant/design.md (plain-words check) names kwant, the
// program that connects, in the sheet's helper, token, MCP Server off and can't-reach copy and the Tested sticker's title.
const RULED_HA = /\bkwant (?:will connect to|reached Home Assistant|can’t reach|runs on another computer)\b|\blets kwant (?:into|control)\b|\bapps like kwant\b/g;
/** Whether a literal reads like text a person sees (a sentence, or a capitalised word). */
const looksVisible = (text, node) => {
const p = node.parent;
if (ts.isJsxText(node)) return true;
if (p && ts.isJsxAttribute(p)) return /^(placeholder|title|aria-label|alt|label|description|hint)$/.test(p.name.getText());
if (p && (ts.isImportDeclaration(p) || ts.isExportDeclaration(p) || ts.isLiteralTypeNode(p))) return false;
if (p && ts.isPropertyAssignment(p) && p.name === node) return false;
if (p && ts.isElementAccessExpression(p)) return false;
// console.* and test-only ids
for (let a = p; a; a = a.parent) {
if (ts.isCallExpression(a) && /^console\./.test(a.expression.getText())) return false;
if (ts.isCallExpression(a) && /^(localStorage|sessionStorage)\./.test(a.expression.getText())) return false;
}
return /\s/.test(text.trim()) || /^[A-Z]/.test(text);
};
export function findBareWording() {
const hits = [];
for (const file of files(src)) {
const text = readFileSync(file, 'utf8');
const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, file.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
const visit = (node) => {
let s = null;
if (ts.isJsxText(node)) s = node.text;
else if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) s = node.text;
else if (ts.isTemplateHead(node) || ts.isTemplateMiddle(node) || ts.isTemplateTail(node)) s = node.text;
if (s !== null) {
const stripped = s.replace(MAESTRO, '').replace(RULED, '').replace(RULED_HA, '').replace(ALLOWED, '');
// URLs, paths, event names and storage keys (kwnt:..., kwant.x) are not prose.
// Example paths a person reads (~/dev/x) stay in.
const prose = stripped.replace(/(?<!\S)(?!~)\S*(?:[:./_#=]\w)\S*/g, (w) => (/^[A-Za-z]+[.,;:!?)]?$/.test(w) ? w : ''));
const at = ts.isTemplateLiteralToken(node) ? node.parent.parent ?? node : node;
if (BAD.test(prose) && looksVisible(s, at)) {
const { line } = sf.getLineAndCharacterOfPosition(node.getStart());
hits.push(`${relative(root, file)}:${line + 1}: ${s.trim().replace(/\s+/g, ' ').slice(0, 120)}`);
}
}
ts.forEachChild(node, visit);
};
visit(sf);
}
return hits;
}
test('no visible text says a bare "kwant", "kwnt" or "agent"', () => {
assert.deepEqual(findBareWording(), []);
});
test('the page title says "kwant bots"', () => {
const title = readFileSync(join(root, 'index.html'), 'utf8').match(/<title>([^<]*)<\/title>/)?.[1] ?? '';
assert.match(title, /kwant bots/);
assert.doesNotMatch(title.replace(/\bkwant bots?\b/gi, ''), BAD);
});
if (process.argv.includes('--list')) console.log(findBareWording().join('\n'));