Kriya · architecture

Kriya One 0.4.11 · generated by scripts/arch-map.mjs

How Kriya is built, and how it works end to end

Kriya is a personal assistant you talk to in a browser: chat on the left, a canvas on the right. Behind it, one small server keeps an AI coding agent (the master) running in a terminal, gives it tools, lets it start helper agents (workers), and shows you what they made, asking before anything goes out. This page is a map of that code for someone opening the repository for the first time.

what you seeserver codeAI sessionsstored data, eventsKriya Hostoutside Kriya

The big picture

Four ideas explain most of the code:

  1. The agent is a real terminal program. Kriya doesn’t call an AI API itself. It runs an AI command-line tool (Claude Code, Codex, Antigravity or a local model) inside tmux, pastes your message in, and reads what it does.
  2. Everything for the agent goes through an inbox. Your messages, worker reports and approval decisions queue up; the master takes them one turn at a time, so nothing is lost if something restarts.
  3. The agent acts through “verbs”. Show a page, start a worker, ask for approval: each is a small, typed function the server offers to the session (over MCP).
  4. State is plain files. One folder (the “data home”) holds the conversation, the canvas pages, memory and settings. No database, no build step, no framework.
Kriya: the big pictureA browser panel talks to one Node server, which drives AI coding sessions in tmux and shows their work on a canvas.THE KRIYA SERVER: ONE NODE PROCESS (SERVER/)SESSIONS: ONE TERMINAL (TMUX) PER AI AGENTHTTP + live eventsWebSocket (audio)/api/one/*promptsbriefsverbs over MCPdials inControl panel (your browser)chat on the left, canvas on the right ·web/Phone appvoice sessions, paired by QRcodeSetup and SettingsKriya One · web/one.htmlFront doorserves the pages, the REST API, live events (SSE) and WebSocketshttp.tsbus.tsws.tspanelauth.tsbrand.tsThe master and its inboxqueues what you say, runs turnsmaster.tsinbox.tswatchdog.tsAgent API (“verbs”)what agents may ask the server to doverbs.tsmcp.tsguard.tsEnginesdrive each AI command-line toolharness.tssession.tstmux.tsCanvaspages, versions, approvalscanvas.tsapps.tsWorkershelpers the master startsworkers.tshostworkers.tsKriya Onesetup, settings, servicesone.tsoneservices.tsVoicespeech in, speech outvoice.tsvoicesession.tsMaster sessionClaude Code · Codex · Antigravity ·a local modelWorker sessions × Neach with a brief, a folder andchecks to passToolsan MCP server + a canvas app each ·tools/AI providersAnthropic, OpenAI, Google, or yourown model serverSpeech servicesspeech-to-text and text-to-speechservers (or models in the browser)Kriya Hosta small Go program on your othermachines: runs workers, desktopcontrol, the phone bridge, aclicker · host/Data home (files only)state.json, chat.jsonl, canvas/,skills/, memory, secrets · nodatabase neededstore.tsconfig.ts
The pieces and who talks to whom. Solid arrows are requests; dashed arrows are things the server reaches out to.

Kriya One: one person, one container

Kriya One is one Docker container per person. The installer (deploy/one/install.sh, or install.ps1 on Windows) makes it, updates it and changes its options, and stays on the machine as the kriya-one command; the control app, “Kriya One Server”, is buttons for that command. Inside the container the agent server runs with KRIYA_MODE=one: it has a first-run setup and a Settings page of its own, and keeps the vault, the task board and the machines joined with Kriya Host in the same process.

Kriya One: one person, one containerThe installer makes and manages one container; inside it the agent server does everything, with the engines pre-installed.ONE CONTAINERHTTP + live eventsdials inBrowserthe panel + /setup (Settings)Installer + kriya-onemakes, updates and configures thecontainer; Settings from a terminalinstall.shinstall.ps1Kriya One Serverthe control app: status andbuttons, runs kriya-onedeploy/one/panel/Kriya Hostjoins the agent directlyAI providers, speechor models on your own machinesThe agent server :8810 (canvas :8910)password sign-in; first-run setup; the Settings pageserver/one.tsweb/one.htmlweb/one/Built in, in this processvault, board, vocabulary, machines, phones, webhooks, HTTPSonevault.tsonework.tsonehosts.tsEngines pre-installedClaude Code, Codex and Antigravity, plus your local modelsengineregistry.ts
The container publishes its panel (8810) and canvas (8910) on 127.0.0.1 by default; other devices reach it over HTTPS (Tailscale, or a Caddy in front: deploy/one/reach.sh). Several Kriya Ones on one machine each get their own pair of ports, data folder and network.
Kriya One
Signing inone password, set at first run (onethismachine.ts: no setup code on this machine)
Settings live in/setup: web/one.html, web/one/, server/one*.ts; also from a terminal: kriya-one services | voice | vocab | brand | join-code
Vault, board, vocabularyin-process (onevault.ts, onework.ts, through localwork.ts)
Kriya Host machines jointhe agent itself (onehosts.ts runs server/hosts/)
EnginesClaude Code, Codex and Antigravity pre-installed, or a local model
Where it is defineddocker/one.Dockerfile (on top of the agent image), deploy/one/

The repository at a glance

166 files · TypeScript

server/

The agent server. Runs straight from TypeScript on Node 24: no build step. A flat folder; the groups below are how to read it.

133 modules · plain JS

web/

The control panel and the Settings page: hand-written ES modules and CSS, served as they are. web/kit/ holds the shared building blocks.

8 tools

tools/

Plug-ins the agent can use. Each is a folder with a manifest.json, an MCP server and usually a canvas app.

Go · 272 tests

host/

Kriya Host: one dependency-free binary for your other machines (Linux, macOS, Windows).

Docker, installers

docker/ · deploy/ · npm/

The images (agent, Kriya One), the entrypoint and firewall, the installers and the control app (deploy/one/), and the npx wrappers for Kriya Host.

183 files

test/ · scripts/

Tests for the agent (unit and real-browser), the fakes they use, and the scripts that run, lint and release.

tokens, logos

brands/ · templates/ · docs/

Design tokens (--ts-* colours, fonts) per brand pack, starter templates, and the guides.

The server, module by module

The server is one Node process. Its 166 files sit in one flat folder (and server/hosts/ for Kriya Host), but they fall into 15 groups. Read them in layers: entry points call features, features use the agent API and the engines, and everything stands on a small core.

The server in layers: who may call whomEntry pointsstart-up order and every URLmain.tshttp.tsone.ts (Kriya One routes)mcp.tsbrand.tsConversationthe master’s loop, its inbox, upkeepmaster.tsinbox.tswatchdog.tscompact.tsautocompact.tsmodelswitch.tsskills.tsupdates.tsWorkworkers, canvas, tools, automationsworkers.tshostworkers.tscanvas.tsapps.tstools.tstoolguard.tsautomations.tscron.tsPeople and devicesvoice, phones, desktop, clicker, mailvoice.tsvoicesession.tsdictate.tsphonerelay.tsdesk.tsmailbox.tsonephones.tsAgent API: the verbsevery action an agent can take, typed (zod) and checked by the guardverbs.tsguard.tsguardverbs.tsautomationverbs.tsonesettingsverbs.tsvault.tsotp.tsEngines and sessionsone AI CLI in a tmux terminal: start, paste, watch, stopharness.tssession.tstmux.tsscreen.tstranscript.tscodex.tsagy.tslocal.tsCore: imported by almost everything, imports almost nothingsettings from the environment, state on disk, events, a safe environment for child processesconfig.ts (69 importers)store.ts (44)bus.ts (28)safeenv.ts (17)localwork.tsservices.tsfiles.tspanelauth.tscsp.ts
Arrows point from the caller to what it uses. The core (bottom) is imported by almost every file and imports almost nothing back. Where two features need each other, the code breaks the loop with a lazy await import() or by passing a callback.
14 files

Core

Start-up, settings, storage, events and the front door. Everything else stands on these.

  • main.tsstart-up order
  • config.tssettings from the environment; the data home’s paths
  • store.tsstate.json + chat.jsonl, written atomically
  • bus.tsevents inside the server, relayed to browsers as SSE
  • http.tsevery URL: pages, REST, SSE, canvas, tool apps, files
  • files.tsuploads and which files a browser may load
+ 8 more
  • filelinks.tssigned download links
  • brand.tsbrand packs, the HTML pages’ placeholders
  • svgsafe.tscleans uploaded SVG logos
  • pngbadge.tsdraws the accent dot on app icons
  • about.tsSettings → About
  • help.tsthe in-app help
  • relogin.tsthe “signed out” notice
  • loginlimit.tsslows password guessing at sign-in
7 files

Sessions

One AI command-line tool running in a tmux terminal: start it, paste a prompt, watch it, know when it is done.

  • session.tsa Claude Code session: start/resume, runTurn, interrupt
  • tmux.tsnew session, paste + Enter, capture the screen
  • screen.tsreads the screen text: idle, working, needs attention
  • transcript.tsfollows the session’s transcript file for tool calls and text
  • apiretry.ts“continue” after a provider error
  • limits.tswaits for the plan’s usage window to reset
+ 1 more
  • usage.tsusage numbers from the status line
21 files

Engines

The same session idea for each AI CLI: Claude Code, Codex, Antigravity (agy) or a local model.

  • harness.tspicks the engine for a session
  • claudecode.tsthe pinned Claude Code version
  • local.tsClaude Code pointed at your own model server
  • localproto.tsthat server’s API details
  • codex.tsCodex: one `codex exec` per turn
  • codexproto.tsits config and event format
+ 15 more
  • agy.tsAntigravity: one `agy --print` per turn
  • agyproto.tsits config and event format
  • opencode.tsOpenCode: one headless `opencode run` per turn
  • opencodeproto.tsits config and event format
  • ossengines.tsopen-source engines: harness × your model endpoint
  • osssession.tsPi and Qwen Code: one headless run per turn
  • piproto.tsPi’s config and event format
  • qwenproto.tsQwen Code’s config and event format
  • instructions.tsa worker’s standing rules, per engine
  • engineregistry.tsKriya One: which engines are installed, signed in, their quota
  • enginelogin.tssign-in flows for each engine
  • claudelogin.ts`claude auth login` driven for you
  • engineinstall.tsinstalls Claude Code and agy on first use, at the tested version
  • harnesspins.tsthe harness versions Install puts on a joined machine
  • engineresolve.tsan engine name to its harness and model endpoint, for host workers
11 files

Master and inbox

The main assistant: everything meant for it waits in an inbox, and it handles the inbox one turn at a time.

  • master.tsthe loop: drain the inbox → one turn → reply
  • promptsetup.tsonly the instructions this setup needs
  • setupevents.tsa setup change rewrites them and tells the session
  • inbox.tsthe queue; who sent what (you, a worker, an approval)
  • stubmaster.tsa canned master for tests
  • compact.tscompacting a long conversation
+ 5 more
  • autocompact.tsdoing that automatically, carrying context over
  • modelswitch.tsswitching model mid-conversation
  • delegateguard.tsnudges the master to delegate long jobs
  • watchdog.tsperiodic check-ins on running work
  • skills.tsskills (SKILL.md): how recurring jobs are done
4 files

Agent API and workers

What an agent can ask the server to do (“verbs”), and the helpers the master starts.

  • verbs.tsthe table of verbs: input shape, who may call it
  • mcp.tsthe verbs as an MCP server for the sessions
  • workers.tsspawn, brief, follow, nudge, finish
  • hostworkers.tsworkers that run on a joined machine
9 files

Canvas and approvals

The right-hand pane: pages the assistant shows, their versions, and your yes/no.

  • canvas.tsitems, versions, shared state, approvals
  • canvasorigin.tscanvas pages get their own origin (port + 100) and tokens
  • canvasprune.tskeeps the newest versions
  • approvalsupersede.tswhich older approvals a new one replaces
  • apps.tsstarts a page’s backend (start.sh) and proxies it
  • review.tsPoint & say: screenshots with your pins
+ 3 more
  • csp.tswhat canvas content may load
  • framecheck.tscan this URL be shown in a frame?
  • panelauth.tsonly the panel itself may decide approvals
4 files

Tools

Plug-ins: an MCP server the agent calls plus an app the canvas shows.

  • tools.tsfinds tools, hands their MCP servers and secrets to sessions
  • toolguard.tseach tool in git; snapshot, start-up check, revert on failure
  • vscode.tsVS Code (code-server) on the canvas: started on demand, proxied, code_open / code_diff / code_run / code_state
  • vscodecmds.tswhich VS Code commands code_run may send (a denylist; terminal typing only when allowed)
19 files

Voice

Speech in and out: for the panel, the phone app and hands-free use.

  • voice.tstranscribe, speak, split a reply into what to say
  • voicesession.tsthe phone’s live voice session over a WebSocket
  • ws.tsa minimal WebSocket server
  • services.tswhich speech / model services are configured
  • vocab.tsyour vocabulary: names it should get right
  • vocabfix.tscorrects transcripts with it
+ 13 more
  • dictate.tssecure dictation into a page
  • dictategrammar.tsits spoken commands
  • audiorender.tsrendering audio files
  • voicemodels.tsmodel weights for speech in the browser
  • voicefocus.tsonly the agent in focus speaks
  • shortcuts.tsthe panel’s keyboard shortcuts, kept for every browser
  • unheard.tsreplies held until you can hear them
  • updates.tsbackground updates to read out
  • takes.tseach spoken take delivered once
  • devices.tsphone device tokens
  • voicewarn.tsthe title bar’s voice warning
  • asrclient.tsspeech-to-text over Kriya’s or the OpenAI-compatible protocol
  • voiceruntime.tsKokoro’s pronunciation runtime, fetched once at run time
11 files

Security and the guard

Keeps secrets out of sessions and stops text from the web steering the agent.

  • safeenv.tsthe only environment child processes get
  • guard.tsthe prompt-injection guard
  • guardverbs.tsits verbs
  • untrusted.tswraps outside text as “untrusted”
  • digest.tssummarises untrusted text with a tool-less model
  • vault.tsfills logins into pages without showing them to the agent
+ 5 more
  • vaultweb.tsHTTP auth and PDF unlock from the vault
  • otp.tsone-time codes
  • totp.tsauthenticator codes
  • browserhandoff.tshands a CAPTCHA or login to you
  • browsersettings.tsthe web browser tool’s settings
7 files

Work: board, playbooks, activity

The task board, playbooks and vocabulary, answered in this process; screen time and desktop incidents.

  • localwork.tsthe work services, in-process (onework.ts, onevault.ts)
  • apiutil.tsJSON route helpers; this agent’s identity
  • board.tsthe task board’s verbs
  • playbooks.tssite playbooks
  • activity.tsscreen time for break reminders
  • activitylog.tsits log
+ 1 more
  • deskincident.tsincident reports from a desktop
3 files

Mail

The Gmail tool’s server side.

  • mailbox.tsmailbox verbs and the panel’s view
  • imap.tsa minimal IMAP client
  • smtp.tsa minimal SMTP client
4 files

Automations

Things that run on a schedule or when something happens.

  • automations.tsruns them; the panel’s view
  • automationverbs.tsthe verbs to create and change them
  • autotriggers.tspolled triggers: files, board, a web page, email
  • cron.tsschedules in cron or plain words
14 files

Phone, desktop, Kriya Host

The server’s side of the devices it works with.

  • phonelink.tslink a phone; its live view
  • phonerelay.tsthe phone’s WebSocket relay
  • phonesnap.tsscreenshots when the video has no picture
  • phoneaction.tsactions on the phone
  • linkws.tsa WebSocket server for the relay
  • desk.tsdesktop actions through the panel
+ 8 more
  • desktoplink.tsdesktop control through Kriya Host
  • oneclicker.tsclicker buttons from Kriya Host
  • onedesktop.tspairing Kriya Desktop
  • onephones.tspairing phones by QR
  • telegram.tsthe Telegram channel: a paired chat, by long polling
  • onehostlink.tsthe registry of joined machines
  • onehosts.tsruns the Kriya Host link (server/hosts/) in-process
  • onecomputer.tsthe Computer control switch per machine
22 files

Kriya One

What makes the single-container product: first-run setup, every Settings card’s API, the service registry.

  • one.tssetup, sign-in, and the /api/one/* routes
  • oneservices.tsthe services registry: probe, test, health loop
  • onemodels.tswhat local models are used for
  • onenetwork.tsnetworking and reachability
  • onesettingsreg.tssettings the assistant may change
  • onesettingsverbs.tsthe verbs to change them (with approval)
+ 16 more
  • oneskills.tsskill switches
  • onecodetools.tsGraphviz and gortex
  • onefilesearch.tssearch your files by meaning
  • onehttps.tsHTTPS for other devices
  • qr.tsQR codes
  • appinstall.tsinstall-as-app: asked once, reported by the app
  • onecli.ts`kriya-one services`, `voice`, `vocab`, `brand`, `join-code`: the work
  • onecli-run.tstheir socket for the CLI
  • oneinstall.tsthe disk soft cap
  • oneversion.tsversion and update check
  • onevault.tsthe vault, in-process
  • onework.tsboard, playbooks, vocabulary, in-process
  • onehooks.tsincoming webhooks
  • onereach-cli.tsa CLI helper for the HTTPS script
  • onethismachine.tsno setup code on this machine; other devices need it
  • ownfile.tsis a .one file the server’s own (one rule, Mac file sharing too)
16 files

Kriya Host link · server/hosts/

Machines that join with one command and dial out to Kriya; the workers and task jobs it runs on them.

  • hosts/hostlink.tsjoin codes, /host/join, each machine’s outgoing WebSocket, folder copies, Update Kriya Host
  • hosts/hostworkers.tshost workers: start, turns, task jobs, /hw/mcp
  • hosts/enginehost.tsCodex, Antigravity and OpenCode workers on a joined machine
  • hosts/opencodehost.tsOpenCode there: its config on your model endpoint, its events
  • hosts/guard.tsthe guard of each joined machine: folders, network, allow-all, “guard pending” for machines joined before it; what Kriya Host gets with a start; what it blocked
  • hosts/codexhost.tsCodex turns as host workers
+ 10 more
  • hosts/agyhost.tsAntigravity turns as host workers
  • hosts/machines.tsthe machines workers can run on, and their health
  • hosts/hostclicker.tsa joined machine’s clicker buttons, cleaned
  • hosts/heal.tsthe autoheal report a machine sends
  • hosts/tar.tsfolder copies as tar, no links, no escaping
  • hosts/registry.tsthis agent’s record for the subsystem
  • hosts/users.tsthe owner; the audit log
  • hosts/usage.tsthe plan usage the master last reported
  • hosts/config.tsthe subsystem’s settings and state folder
  • hosts/bus.tsits events

The web UI

The browser side is plain JavaScript modules: the browser loads them directly from /ui/… (the web/ folder), so what you read is what runs. There are three pages, and a kit of shared pieces under them.

The panel · index.html → app.js

Chat, canvas, workers, memory, the terminal view. app.js is a thin entry; each feature is a module in web/app/ (chat, composer, canvas, workers, voice…). They share one store (state.js) and a paint scheduler (render.js): events mark what changed, and it is drawn once per frame.

Setup and Settings · one.html → one.js

Kriya One’s first-run steps and its Settings: a left nav of sections, cards in a grid, search. Each card is a module in web/one/cards/; the shell (routing, nav, search, inline feedback) is in web/one/.

The kit · web/kit/

Small functions that return real DOM elements: button, chip, toggle, tabs, card, formRow, status, dialog, toast… styled only with brand tokens, so light and dark just work. See them live at /kit.

Canvas pages · bridge.js

Pages on the canvas run in an iframe on their own origin. bridge.js is the small API they get (UPA.setState, UPA.send, UPA.decide) to talk to the panel safely.

The full module list with sizes is in web modules.

How it works: the main flows

Each diagram reads top to bottom. Columns are parts of the system; numbered arrows are what happens, in order.

1 · A chat turn

A chat turn, end to endFrom the message you type to the reply on screen.1POST /api/chat { text }2save to chat.jsonl, theninbox.enqueue("you")3master loop wakes: drains the wholeinbox into ONE prompt (your message,worker reports, approvals…)4runTurn(prompt)5paste into the terminal,press Enter6the transcript filegrows: tool calls, text(read every 400 ms)7activity events, the first sentence to say8live: “⚙ 3 tools · worker started”9Stop hook writesstop.json: the turn isover10postChat("assistant", reply)11the reply appears (and is spoken, if you asked by voice)Panelweb/app/Front doorhttp.tsInbox + masterinbox.ts · master.tsSessionsession.ts · tmux.tsEngine CLIe.g. Claude CodeEventsbus.ts → SSE
Why an inbox? If you send three messages while the master is busy, they wait and arrive together as one prompt. The reply is found by reading the engine’s own transcript file, and “done” is a small file written by a Stop hook, which is why Kriya works with a real, unmodified CLI.

2 · Master → workers

The master hands work to a worker1spawn_worker { task, how,verify, model, folder }2the guard checks it, thenspawnWorker()3writes brief.md, starts thesession, pastes the brief4progress("tests written…"): shown in the Workers view5ask_master("which branch?"): only when blocked6the question waits in the master’s inbox7message_worker(answer)8finish { status, summary, verification }9enqueue: worker "seo-audit" finished10the next turn starts with the reportMaster sessionthe main agentAgent APImcp.ts · verbs.tsWorkersworkers.tsWorker sessionits own tmuxInboxinbox.ts
The master writes a brief: the task, how to do it, and what must be verified before reporting back. Workers can only talk to the master through three verbs: progress, ask_master, finish.

3 · Canvas and approvals

Showing work on the canvas and asking for approval1canvas_show { html | folder |tool }2writes canvas/<id>/v<n>/: every updateis a new version3“canvas” event4a new tab, focused5asks for a short-lived token,loads/_c/<token>/canvas/<id>/v<n>/in an iframe6request_approval { item, title}7an approval bar under the page and a card in the chat8you tap Approve or Request changes (only a real tap counts:panelauth)9inbox: “approval a12 decided:APPROVED”, the master carriesonMaster sessionor a toolCanvascanvas.tsEventsbus.ts → SSEPanelweb/app/canvas.jsCanvas frameown origin: port + 100
Canvas pages are untrusted (the agent wrote them, maybe from web content), so they load from a different origin than the panel and can’t click “Approve” themselves. Outbound tools check with the server that an approval was really given.

4 · Voice in and out

Voice in, voice out1audio: POST/api/voice/transcribe, or aWebSocket /api/voice/session(phone)2the audio + your vocabulary ashints3text4vocabulary fixes (names it misheard),then “did you mean an approval?”5inbox.enqueue("you (spoken)")6the reply, with a short SAY: line to speak (the first sentence comesearly)7one request per sentence8audio (re-encoded with ffmpeg, cached)9played in parts; only the tabor phone that asked speaksMic + speakerweb/voice.js · phoneVoice servervoice.ts · voicesession.tsSpeech-to-textPOST /v1/transcribeMaster turnas in a chat turnText-to-speechPOST /v1/tts
In Kriya One the same flow can run with no speech servers at all: “In this browser” mode runs the speech models in a web worker (web/browservoice.js, web/voiceworker.js).

5 · Services (Settings → Models & services)

Settings → Models & services → Test1POST /api/one/services/<id>/test (cookie+ the page’s panel token)2GET /health, then a real check per kind(TTS: list voices, speak “Hello.”)3OK in 42 ms, or what went wrong4lastCheck saved on the entry5{ probe, service }6the result shows right next to the Testbutton (a status chip) and in a toast7every 5 minutes: the same check forevery enabled serviceSettings pageweb/one/cards/services.jsKriya One routesone.ts → oneservices.tsThe servicee.g. a TTS server on your LANRegistry file.one/registry.json
A “service” is anything Kriya talks to besides its engine: speech, local models, embeddings, image generation. You add one by its address; Kriya works out what it is.

6 · The Kriya Host link

Kriya Host: joining a machine and running a worker on it1Add a machine → a one-time join code(valid for an hour)2you run: kriya-host join <address> <code>3POST /host/join { code } → a machinekey, kept on that machine only4WebSocket /host/connect: the machinealways dials OUT (works behind NAT)5“hello” + what it can do (GPU, Docker,engines), refreshed every 30 s6call: prepare, syncin (folder as tar),start: from a fixed list of operations7starts the session with the brief8progress / ask_master / finish over POST /hw/mcp9syncout: results copied back; “Askbefore” settings can require yourapproval firstYouSettings → MachinesKriyaonehosts.ts → hosts/hostlink.tskriya-hostGo binary on that machineHost workeran AI CLI in tmux there
The joined machine keeps one outgoing connection, so it needs no open ports. Kriya can only ask for operations from a fixed list (host/ops.go), confined to the folders you allowed.

7 · Settings

Changing a setting: by you, or by the assistant with your approval1POST /api/one/voice { mode } (needs thecookie AND the page’s token)2written atomically3applied: e.g. a new engine restarts the master, voice rewrites services.json4the new state; the page shows “Saved”beside the control5settings_change { key, value }: “set the TTS voice to Leo”6each setting says whether it needs you:“none” applies now, “ask” waits(pending-changes.json)7an approval card: what will change, from→ to8Approve9applied and savedSettings pageweb/one/Kriya One routesone.ts · /api/one/*Settings files.one/*.json (0600)Master sessionthe assistant
Two doors to the same settings. The page’s changes need both the sign-in cookie and a per-page token, so a canvas page can’t change settings. The assistant’s changes go through onesettingsreg.ts, where each setting declares whether it needs your approval.

Tools

A tool is a folder: manifest.json names it, mcp.mjs is the processing the agent calls, and app/ is what the canvas shows. The agent can write new tools into its data home, so its toolbox grows; each of those is kept in git and rolled back if a change breaks it (toolguard.ts).

ToolWhat it does
tools/web-browserA persistent Chromium driven in plain words; vault fills, hand-offs to you, network capture
tools/android-deviceAn Android phone or emulator with a live view, macros and quick actions
tools/desktopYour Linux desktop, through Kriya Host
tools/gmailMail over IMAP/SMTP; sending needs your approval
tools/file-searchFinds your files by meaning (embeddings)
tools/file-downloaderA list of files to download from the canvas
tools/music-playerAn audio player the assistant can control
tools/vscodeVS Code in the browser on the canvas; the assistant opens folders, files and diffs in it, and drives it (debugger, any command)

Kriya Host (Go)

One small program, kriya-host, that you install on another computer to let Kriya work there: run workers on its GPU, control its desktop, bridge a phone plugged into it, or listen to a presenter clicker. It is written in Go with no dependencies, so it is a single file to download.

PartFiles (host/)What it does
The linkmain.go, ws.go, caps.go, selfstats.goJoins with a one-time code, then keeps one outgoing WebSocket open and answers calls.
Jobsops.go, jobs.go, jobd.go, tarsync.go, proc_*.go, vt.goA fixed list of operations: start a worker in tmux, copy a folder in or out, run a task script.
Enginesengines.go, claudetoken.goDetects which AI CLIs the machine has and whether they are signed in.
Desktop controldesk*.goPointer, keys, windows, a browser over CDP: for the desktop tool.
Phone bridgephonebridge.go, pb_*.go, u2/Drives an Android phone over adb + scrcpy for the android-device tool.
Clickerclicker*.goReads a presenter clicker’s buttons (Linux evdev, macOS IOKit, Windows Raw Input).
Serviceservice.go, lpheal*.go, tsserve.goInstalls itself as a user service (systemd, a LaunchAgent, a logon task); restarts a server it watches when it hangs; serves HTTPS through Tailscale.

The tests

Tests use the real server and a real browser wherever they can, and fakes only for what costs money or needs a login: a fake Claude that behaves like the terminal app, fake speech servers, a fake Docker.

How the tests runSCRIPTS/TEST.MJS: A POOL, ONE PROCESS GROUP PER FILEnpm testunit + browser + toolsnpm run test:changedonly files your diff reachesnpm run coveragethe same run, with V8 coverageunit filesnode --test, server modulesin-process or a real server on a freeporttest/*.test.tstest/injection/browser filesa real server + headless Chromium(Playwright)*-browser.test.ts*.browser.mjstool scriptseach tool tests its own MCP servertools/*/test/*-test.mjsFakes, not cloudsa fake Claude TUI, fake Codex / agy,fake Docker, fake speech serverstest/fixtures/test/harness.tsPer-file sandboxown TMPDIR, own data folder, reservedports, own tmux socket; leftovers arekilledReporta line per file, failures in full,slowest files, timings saved for thenext run (longest first)
Every file runs in its own process with its own temp folder, data folder, ports and tmux socket, so many can run at once and two checkouts can test at the same time.
KindWhereFilesWhat they check
Unittest/*.test.ts, test/injection/175server modules, alone or against a real server on a free port
Browsertest/*-browser.test.ts8the panel and Settings in headless Chromium: these are the UI’s contract
Toolstools/*/test/35 + 8 browsereach tool’s MCP server and app
Kriya Hosthost/*_test.go272 testsgo test ./... (also in the image build)
Image, end-to-endtest/image/, test/e2e/3 + 4the real Docker image; real containers (run by hand before a release)

Commands: npm test (everything but Docker), npm run test:changed (only what your branch touches), npm run coverage (one merged report for server and browser code), npm run lint. Details: CONTRIBUTING.md.

The web UI’s modules

Every module of web/ in this tree, by group: the panel and Settings are feature modules built on the kit, with a lint rule that forbids import cycles. Bars show each file’s length; amber marks files over 800 lines.

Now

133
JS modules
25,978
lines of JS
1,092
lines in the biggest (browservoicelib.js)
2
modules over 800 lines
195
lines per module on average
0
import cycles
kit/ 8 files · 1,921 lines · The building blocks: button, chip, toggle, tabs, cards, form rows, dialog, toast…
  • kit/kit.js693
  • kit/kit.css424
  • kit/live.js377
  • kit/gallery.js215
  • kit/theme.js68
  • kit/dom.js56
  • kit/gallery.html51
  • kit/bootguard.js37
app/ 31 files · 5,739 lines · The panel (chat + canvas), one module per feature
  • style.css1,246
  • app/workers.js567
  • app/canvas.js407
  • app/chat.js312
  • app/boot.js287
  • app/composer.js281
  • app/updates.js268
  • app/voice-ui.js217
  • app/review-mode.js214
  • app/voice-only.js180
  • app/master-status.js169
  • app/controls.js163
  • app/talk.js143
  • app/layout.js137
  • app/settings-menu.js136
  • app/cues.js135
  • index.html114
  • app.js98
  • app/dom.js88
  • app/render.js77
  • app/terminal.js66
  • app/memory.js64
  • app/timers.js58
  • app/state.js55
  • app/read-aloud.js54
  • app/status-dot.js46
  • app/idle.js39
  • app/wake.js39
  • app/tools.js32
  • app/approvals.js28
  • app/api.js19
one/ 35 files · 7,226 lines · Kriya One: first-run setup and Settings, one module per card
  • one/settings.css542
  • one/cards/engine.js500
  • onechrome.js483
  • one/cards/ossengines.js469
  • one/cards/engines.js435
  • onevoice.js411
  • one/shell.js379
  • one/cards/services.js331
  • one/cards/machines.js281
  • one.html234
  • one/cards/vault.js234
  • one/cards/machinedialog.js217
  • one/cards/voice.js215
  • one/cards/phone.js206
  • one/cards/codetools.js178
  • onechrome.css175
  • one/cards/machineguard.js169
  • one/setup.js164
  • one/cards/telegram.js151
  • one/cards/network.js140
  • one/feedback.js129
  • one/sections.js128
  • one/ui.js126
  • one/cards/work.js110
  • one/cards/system.js109
  • one/cards/desktop.js108
  • one/cards/vocab.js104
  • one/core.js98
  • one/cards/skills.js89
  • one/cards/https.js74
  • one/cards/brand.js58
  • one.js55
  • one/cards/security.js51
  • one/cards/vscodebridge.js40
  • one/state.js33
voice 24 files · 5,910 lines · Speech: recording, playing, models in the browser, hands-free
  • browservoicelib.js1,092
  • voice.js980
  • browservoice.js695
  • voiceworker.js532
  • dictate.js335
  • voicestatus.js318
  • voicefailed.js275
  • cue.js240
  • voicekeep.js214
  • voiceapprove.js177
  • wakelock.js129
  • voiceonly.css118
  • voicefocus.js111
  • audiorender.js109
  • miclevel.js87
  • voiceerror.js87
  • composermic.js81
  • voiceonlylib.js72
  • voicechip.js66
  • dictate.css61
  • voiceprefs.js47
  • voicefailed.css45
  • speakrule.js28
  • rec-worklet.js11
devices 16 files · 3,087 lines · Clicker, gamepad, phone keys, desktop
  • clicker.js710
  • gamepad.js582
  • clicker-map.js438
  • gamepad-map.js331
  • clickerplay.js177
  • phonekeys.js164
  • browserscroll.js133
  • gamepad.css95
  • canvaskeys.js90
  • clicker.css82
  • clickervolume.js63
  • desk.js62
  • padgate.js51
  • pagescroll.js45
  • deskdot.js37
  • onscreen.js27
canvas + review 7 files · 1,399 lines · The canvas frame, the page bridge, Point & say, approvals
  • review.js583
  • bridge.js519
  • canvasframe.js132
  • browserhandoff.js104
  • pendingapprovals.js36
  • chatcap.js18
  • browserhandoff.css7
help/ 7 files · 763 lines · The in-app guide
  • help/help.js331
  • help/helplib.js159
  • help/help.css146
  • help/steps.js91
  • help/index.html24
  • help/tagline.js7
  • help/page.js5
shell 35 files · 4,398 lines · Sign-in, PWA, icons, usage, small shared pieces
  • settings.js566
  • shortcuts-map.js325
  • shortcuts.js322
  • appinstall.js315
  • rumbleasr.js253
  • asrnets.js227
  • launchpad.js208
  • fonts/ibm-plex-sans-400-600.woff2182
  • board.html168
  • gpucheck.js153
  • shortcutsui.js140
  • panelauth.js125
  • modelmenu.js111
  • fonts/jetbrains-mono-400-600.woff2109
  • fonts/roboto-slab-300-800.woff2108
  • login.html98
  • icons.js89
  • activity.js80
  • vscodepicker.js79
  • imageview.html76
  • sw.js71
  • usage.js68
  • fonts/ibm-plex-mono-500.woff267
  • usagepace.js62
  • shortcuts.css59
  • usagepaceui.js57
  • usagepace.css51
  • fonts/ibm-plex-mono-400.woff250
  • fonts/chakra-petch-700.woff247
  • appupdate.js38
  • appinstall.css29
  • fonts/chakra-petch-500.woff229
  • vscodepicker.css17
  • fonts/fonts.css11
  • pwa.js8

No import cycles (checked by npm run lint).

Glossary

MasterThe main assistant session you chat with.
WorkerA helper session the master starts for one job, with a brief and checks to pass. A host worker runs on a joined machine.
Engine / harnessThe AI command-line tool a session runs: Claude Code, Codex, Antigravity (agy), or Claude Code on a local model.
VerbOne action the server offers to agents (canvas_show, spawn_worker…), defined in verbs.ts.
MCPModel Context Protocol: the standard way an AI tool calls outside functions. The server and every tool speak it.
CanvasThe right-hand pane. A canvas item is a page or a tool’s app; each update is a new version.
ApprovalThe assistant asks; nothing goes out (a post, an email, a setting that matters) until you say yes.
SSEServer-sent events: the one-way live stream (/api/events) that keeps the panel up to date.
tmuxA terminal multiplexer: lets the server keep terminal programs running and read their screens. You can attach to any agent yourself.
Data homeThe one folder with all state ($UPA_HOME). “UPA” is the project’s older name, still in many identifiers.
KitThe UI building blocks in web/kit/.