Personal · self-hosted · developed live

A self-hosted AI assistant built from a team of agents

Balabash runs on its owner’s server as one Node.js process over an append-only event log. A supervisor agent answers in the main thread and delegates larger tasks to specialist agents — engineer, architect, designer, browser operator — each in its own thread. Interfaces: a web console, a Telegram forum group and the Claude app.

github.com/loysagienn/balabashTypeScript · Node.js · PostgreSQL · MIT license
How it works

How tasks are delegated

Each delegated task runs in a separate thread with its own context. The user can follow it, write into it, stop or cancel it.

1

Request in the main thread

The supervisor answers directly, operates tools itself, or decides the job deserves a specialist and starts one with a brief.

2

A child thread for the specialist

In the console it is a live thread — the stream, every tool call, plans, files, context use. In Telegram it is a forum topic. You talk to the specialist there directly.

3

Completion and report

The parent gets the summary and the result files, never the inner work. The topic is renamed after the work, closed and kept as the archive.

Agents

The agent catalog

Each agent is a declaration — its model backend, prompt, tools and the agents it may start. The platform supplies the sessions, live tool delivery and the thread lifecycle.

SsupervisorOpenAI · Anthropic

Owns the main thread — the one you talk to. Answers directly, operates tools itself, starts every other agent with a brief and receives their reports; acts on scheduled notes.

MmanagerClaude

General-purpose executor over the connected integrations; drives the browser and the image generator through sub-agents.

CcodexCodex

The manager's brief on OpenAI Codex: the same tools and workbench, run as a Codex session.

EengineerClaude

Software engineering on the host — shell, files, git — in any repository, Balabash's own included, where it builds and requests its own restart.

AarchitectClaude

Architectural reasoning and audits at maximum reasoning effort. Advises, never implements.

DdesignerClaude

Design canvases, design systems and decks in Claude Design; checks its renders in its own browser with a fresh-eyes verifier.

GgardenerClaude

One care pass over a project library: drains the inbox into the settled files and the journal, reports every removal.

AauthClaude

Connects and re-authorizes integrations. Sends links only — credential values never pass through it.

BbrowserClaude

Drives a real Chromium through Playwright, headful on a virtual display, so you can watch and take over a login or a CAPTCHA.

Uuser_browserClaude

Drives your own Chrome — your logins, your open tabs — through the Balabash extension, in a tab group of its own.

Iimage_generatorCodex

Makes and edits raster images with Codex's built-in image generation; the results arrive as stored files.

Model backends

The supervisor runs on OpenAI's Responses API, a compatible gateway or Anthropic's Messages API. The other agents run on the Claude Agent SDK or the Codex SDK, on the host's own Claude and ChatGPT logins. An agent picks its backend with a one-line declaration.

Remote agents

A session in an external system can join the catalog, mirrored as a thread: its replies and tool calls appear there, what you send reaches the session, and its questions — an approval, a sign-in — wait for you.

Capabilities

Tools and integrations

One capability catalog behind every agent, opened through MCP or the model's own API — each agent gets only the branches its declaration grants.

Integrations

Gmail, Google Drive, Notion and Perplexity out of the box, on per-user OAuth. Installation MCP servers and claude.ai connectors join the same catalog.

Real browsers

A persistent Chromium profile per user for anything without an API — and your own Chrome, through the extension you link in the console.

A data workbench

A private SQLite database, a file area and a script runner per workspace. Bulk data moves disk to disk; the model sees short summaries.

Projects

Long-lived work contexts: a folder with AGENTS.md as the entry point, an inbox for new facts and a journal the gardener keeps.

Files

One storage behind an S3-compatible or local-disk driver. Files cross every boundary as ids; a background indexer describes each one.

Self-extension

The engineer changes Balabash's own code and requests a restart. A watchdog process (supervisor.js) waits for a safe window and rolls back a bundle that crash-loops.

Mini-apps

Small web apps over the workspace database

Agents build small interactive tools — trackers, dashboards, checklists — as mini-apps that Balabash serves itself.

Format

A workspace folder with a balabash-app.json manifest and .tsx sources. No npm, no build step — the platform runs it in the browser at its own address.

Data access

The manifest declares SQL endpoints; through them the app reads and writes the workspace SQLite — the same database the agents fill.

Access and publishing

Owner pages stay behind the console sign-in. Publish an app and it is public at its own slug on the apps domain — here, balabash.app/<slug>.

Schedule

Recurring, one-shot and manual tasks

A persistent registry of named tasks. Agents create and edit them on request; the console lists every task and its run history.

Triggers

Recurring on cron, one-shot — “not before” a moment, consumed when it fires — or no trigger at all, run by hand.

Task types

A note is delivered to the supervisor in the main thread, who acts on it. A program is JavaScript stored in the task that calls the same capabilities the agents use — no model in the loop.

Run history

Each run keeps its outcome and console output. A returned value reaches the supervisor; returning null keeps a successful run silent.

Surfaces

Interfaces

The web console, a Telegram forum group and the Claude app show the same workspace and the same threads.

Web console

Every thread live — the stream, tool calls, files and the agent's state. The agent catalog, projects and files, mini-apps, the schedule and its runs, connections, plan limits of the Claude and Codex accounts, the system journal. Sign-in by a one-time code, no passwords; installs on a phone's home screen.

Telegram forum group

A group with Topics is a workspace. The supervisor answers in General; every agent it starts gets a topic, where you talk to the specialist directly. When the work ends, the topic is renamed after it, closed with a summary and the result files, and stays as the archive. Every member of the group is a user of the workspace.

Claude app

Every thread of a Claude-based agent is mirrored as a remote-control session of the operator's Claude app: the agent's live stream, the Stop button, messages from your phone.

Architecture

An append-only event log and its projections

A single Node.js process. Every message, tool call, spawned thread and completed task is an immutable row in PostgreSQL; the threads, the console and each agent's context are folds over it.

The log is the only source of truth

The threads table is a memoization rebuilt by a plain fold; cascade cancellations write one event per descendant, so replay is deterministic.

Threads form a tree with hard boundaries

A thread sees what it authored and what was addressed to it. A parent sees a child's lifecycle and summary, never its inner work — context management is a data invariant, not a prompt convention.

Runs are ephemeral, sessions durable

After a restart every thread with a saved session gets its run back; one without is tombstoned, and its mail goes to the main thread.

Agents are declarations

SDK, prompt, tools and spawn rights in one module. Prompts are assembled from a library of facts — one file per fact, imported, never retold.

Degrade loudly

A failed migration, a bad tool schema or a failing consumer is journaled and skipped; a broken agent declaration fails the boot where the watchdog can roll it back.

Security

Security model

How credentials, workspace boundaries and agent permissions are handled.

Credentials

API keys and OAuth secrets go from a one-time web form straight to the database. The chat, the model and the log never see them; OAuth tokens live in one table.

Workspace isolation

Another workspace's file or thread id reads the same as a missing one. The caller's identity comes from the platform, never from model-visible arguments.

Permissions

Each agent's passport lists the catalog branches it may open — connection management and restart included — and the agents it may start.

Audit log

Every tool call of every model loop is journaled: started, completed with the verbatim result, or failed. An expired token opens an auth thread on its own.

Built withTypeScriptNode.js 24PostgreSQL 16PrismaKoaReactReduxgrammYMCPClaude Agent SDKCodex SDKPlaywrightesbuild
Self-host

Installing your own instance

One Node.js process and a PostgreSQL database on your server, using the host's own model logins. Each installation is independent; there is no hosted service.

  • Linux host with Node.js ≥ 24, PostgreSQL 16 and python3
  • A domain for the console behind a TLS reverse proxy
  • An OpenAI or Anthropic API key for the supervisor
  • Host logins for the agents: Claude Code signed in (Claude agents), a ChatGPT login (codex, image_generator)
  • Optional: a Telegram bot and a forum group, an S3-compatible bucket, Chromium for the browser agent
Balabash is built for its operator’s own use and changes often, partly through its own engineer agent. Expect rough edges.
shell on your server
$ git clone \    https://github.com/loysagienn/balabash.git$ cd balabash && npm install$ cp .env.example .env  # DATABASE_URL, CONSOLE_DOMAIN, HTTP_PORT,  # SESSION_PEPPER, the supervisor's API key$ npx playwright install chromium$ npm run supervise  # build, migrate, run under the watchdog

Open https://<your domain>/login — the operator's sign-in code is printed to the server log. Integrations, OAuth clients and API keys are added later from the console's Connections page.

Author

Vladimir Afanasev

Full-stack engineer. Balabash is a personal project: designed, built and operated by one person on a private server; part of the code is written by its own engineer agent.