Typebulb FAQ

What's Typebulb?

Typebulb runs apps in markdown files called bulbs. To run bulbs:

You can create and edit bulbs either directly using the AI on typebulb.com or locally. The former uses BYOKs, the latter uses whatever agent you want, though we provide special support for Claude Code (CC). LLMs find the "markdown with code blocks" format intuitive, and given an example bulb, can effortlessly create a new bulb.

Bulbs standardize API calls that run in both typebulb.com's sandbox & locally. Most notably, they provide the ability to call agents at runtime.

How do I run bulbs locally?

Run bulbs locally via typebulb's agent mirror, which is included in the open-source Typebulb CLI:

What is the agent mirror?

The agent mirror is a GUI that mirrors your agent harness to provide a code scratchpad experience. Features:

Which harness works best with typebulb's agent mirror?

Pi is nicer because you can both prompt and read responses in the agent mirror. I seldom even need to touch Pi's CLI.

With Claude Code the mirror is strictly a read-only view, so you still need to prompt via CC. But CC lets you use your subscription key, so it's hard to resist the price advantage there.

CLI Features

By default the CLI runs bulbs sandboxed (no filesystem, AI, or server.ts), matching typebulb.com. Pass --trust to grant those to a bulb you've vetted.

You can re-import your bulbs into Typebulb. If they have a server.ts code block, you will be warned that this will be stripped out as it's only meaningful locally.

What's the tb.* API?

Bulbs implicitly have access to the tb const. This is useful when the client code needs to interact with the host, or access special features of Typebulb.

APIDescriptionRuns on
tb.data(n) / tb.json(n)Access data chunks from the Data tabBoth
tb.dump(...)Log lazy/device-backed tensor values to the consoleBoth
tb.copy(text)Copy to clipboardBoth
tb.url()Get the canonical bulb URLBoth
tb.proxy(url)Proxy CDN URL for Web Worker/WASM same-origin loadingBoth
tb.insight()Read the current Insight JSONBoth
tb.infer(data?)Call an LLM at runtime (uses Infer tab instructions)Both
tb.ai(options)General-purpose AI calls (chatbots, agents, experiments)Both
tb.server.log(...)Built-in: prints to CLI stdout, falls back to console.log on webBoth
tb.models()Available AI models (for dynamic model selectors)Both
tb.hasOwnKeys()Whether the user's own AI keys back tb.ai (false = courtesy model only — gate AI-heavy bulbs on it)Both
tb.themeGet/set the bulb's light/dark override; undefined follows the OSBoth
tb.modeRuntime mode: 'local', 'editor', 'published', or 'embedded' (in a sandboxed iframe — e.g. a bulb-in-a-bulb or the CLI's default launch; client-only)Both
tb.fs.read(path) / tb.fs.readBytes(path) / tb.fs.write(path, content)Local filesystem access (text or binary)CLI
tb.dirThe bulb's data folder (absolute path), where relative tb.fs paths landCLI
tb.server.<name>(...)Call exported server-side functions by nameCLI

What comprises a bulb?

Note: For the most part, you don't really need to know, as only the AI edits the bulb.

A bulb is composed of code blocks providing the minimum viable structure for sandboxed apps that may have runtime inference. Each block is optional, and maps to an editor tab on typebulb.com:

BlockPurposeAI editable
code.tsxApp logic and UI (TypeScript/TSX)Yes
styles.cssStylingYes
index.htmlUsually just an HTML stub or fragment, but can be whole page, or blank for console appsYes
data.txtData chunks for your code to process (JSON, CSV, XML, YAML, or plain text); multiple chunks separated by two blank linesNo
infer.mdPrompt for runtime LLM calls via tb.infer()Yes
insight.jsonOutput from tb.infer(), read via tb.insight()Yes
config.jsonDependencies, app description, inference modal settingsPartial
notes.mdPersistent context for the AI assistantNo
server.tsServer-side Node.js code (CLI only)N/A

What's the Data tab?

The Data tab is for content that your code processes, whether structured (JSON, CSV, XML, YAML) or unstructured (plain text). The AI gets a read-only, schema-aware truncated view. Multiple chunks are separated by two blank lines.

Why a separate tab instead of pasting data into chat or code?

  1. Runtime inference — Used by an LLM at runtime via the instructions in Infer to generate Insight.
  2. Context conservation — Typebulb auto-truncates for the LLM without losing structure. The LLM doesn't need every row of a CSV.
  3. Correctness & auditability — By forcing the LLM to write code that processes the data, you can verify the output. Pasting data directly into a prompt means praying the LLM doesn't introduce mistakes.

How does inference work?

Note: For general-purpose runtime AI calls, use tb.ai.

This feature is easiest to understand via an example, such as the bach bulb. The user clicks on "AI Compose" and it launches a dialog, where the user types the genre, e.g. "fugue", and then the AI generates a fugue. The AI assistant will write such a bulb for you, but how does this work?

Under The Hood

The Infer tab is a prompt for runtime LLM calls. When your code in code.tsx calls tb.infer(), the LLM receives: your inference instructions, an example output (from insight.json), your code.tsx (so it knows the expected JSON shape), and the data.txt to process. A modal shows the user what will be sent; confirm and the LLM streams its response.

The Insight tab holds JSON that serves as both a working example (showing the LLM what shape you expect) and the current output (updated after tb.infer() completes). Your code reads it via tb.insight(). There's no separate JSON Schema. The code IS the schema.

Access

Free tier users are rate limited. Users with their own API keys have no Typebulb-imposed limits (within reason). Runtime inference always uses the user's API keys, or Typebulb's courtesy models, never your API keys.

What's the Notes tab?

Persistent context for the AI, carried across conversations and clones. Useful for API docs, examples, or skills the LLM requires.

Typebulb.com AI Assistant

Typebulb's AI assistant is great for 1-shot bulbs. If you've got a more complex bulb, develop it locally with Claude Code or Codex, and run with the typebulb CLI. When it's ready you can import to typebulb.com.

What AI providers do you support?

OpenAI, Anthropic, Gemini and OpenRouter. Bring your own keys. Your keys are used for the AI assistant and tb.infer() calls that you make, but not anyone else who runs your bulb.

What are the chat modes?

ModeAI sees your bulbAI will editUse case
CodeYesYesDefault. Sees code, HTML, CSS, notes, truncated data, errors, and logs.
AskYesNoSame context as Code, but when you just want to discuss, not edit code.
ChatNoNoGeneral conversation, unrelated to your bulb.
RawNoNoNo system prompt. Good for prompt testing.

In Code mode, Typebulb will automatically reply to the AI if it makes a patch error or generates TypeScript errors, with precise details on how to fix them.

Can the AI assistant search the web?

Yes, with caveats. Web search is most reliable with native provider integrations (OpenAI/Anthropic/Gemini); OpenRouter support can be model-dependent and less consistent.

This is web search, not browsing. It works best for well-indexed topics (news, popular libraries, recent releases), and may not retrieve obscure npm or GitHub pages from a URL alone.

If you need the AI to use specific documentation, paste excerpts into the Notes tab; for structured data, use the Data tab.

How do I debug?

On typebulb.com

Add console.logs to your code, and logs are automatically fed back to the AI. You can even debug manually, as we automatically generate TypeScript source maps:

typebulb CLI

Add tb.server.log(...) calls to your code. Get your AI agent to run the bulb directly, and it will stream results to them. Use tb.fs.write(...) to write big files. For a bulb already running (e.g. one you launched from the UI), your agent can fetch its console with typebulb logs <file> — and drive the whole lifecycle from the terminal (typebulb logs / stop / trust), while you keep an eye on it in the UI.

Does Typebulb work on mobile?

Using Bulbs

Typebulb is heavily optimized for building responsive bulbs that work beautifully on both mobile and desktop. "alt-enter" toggles between a mobile-friendly portrait layout and full screen.

Developing Bulbs

For building bulbs, Typebulb works on mobile, but is heavily optimized for desktop usage. The mobile experience has one key feature: you can see the bulb's logs, which is useful for testing.

Why TypeScript?

Privacy & Sharing

Are my bulbs visible to others?

A bulb has 3 possible visibilities adjustable in the toolbar/menu:

When you share a bulb, the user will see any changes you make if you save the bulb and they refresh their browser. The user has a read-only view of your bulb; if they try to edit it, a clone is made.

How do you handle my data?

This is what we store:

We don't use your data for training or sell it to third parties. Your AI providers have their own data policies.

About

Who's behind the website?

Ben Albahari. I worked as a Program Manager at MSFT, and co-authored the C# in a Nutshell series (with my brother, Joe Albahari, the author of the popular LINQPad tool). It's very cheap to maintain, but if it ever got really popular, I'd seek investment.

Do you have a favorite bulb?

This changes all the time. Currently it's a transformer that runs in your browser. Also You're Absolutely Right!, a sycophancy benchmark written as a bulb, that automates hundreds of API calls. The bulb approach makes it easy for anyone to inspect or re-run the results.

← Back to Typebulb