// PART 04
BASIC runtime
Why BASIC?
In 1964, John Kemeny and Thomas Kurtz created BASIC with a revolutionary idea: programming should be for everyone. Today, General Bots brings this philosophy to the AI era.
With BASIC + LLM, you write:
TALK "What's your name?"
HEAR name
poem = LLM "Create a heartfelt poem for " + name
TALK poem
Not 50 lines of boilerplate.
The core keywords
Seven keywords carry most dialogs:
| Keyword | Purpose | Example |
|---|---|---|
| TALK | Output | TALK "Hello!" |
| HEAR | Input | HEAR name |
| USE KB | Knowledge | USE KB "docs" |
| USE TOOL | Functions | USE TOOL "weather" |
| GET | Data | GET "api/users" |
| IF/THEN | Logic | IF age >= 18 THEN ... |
| FOR/NEXT | Loops | FOR i = 1 TO 10 ... |
The full inventory — 276 composite keyword registrations (257 distinct forms),
274 registered functions, 41 rewrite aliases and 14 compiler directives, per
the generated BASIC reference — lives in the keyword crates
(botbasic_core arrays/math/datetime/hearing/procedures, botbasic_data
database/tables/KB/CRM, botbasic_comms mail/SMS/social/webhooks,
botbasic_ai LLM/MCP/sandbox/orchestration, botbasic_system files,
scheduling, security).
How scripts are compiled and run
- Source —
.basfiles in{bot}.gbdialog/(for git-owned bots, a materialized copy of the bot’s ALM repository). - Compilation — the Drive monitor detects changes and the compiler
(
botbasic_compiler) produces.astartifacts;PARAM/DESCRIPTIONheaders become tool definitions in thebasic_toolstable. - Execution — the Rhai engine evaluates the AST inside the host;
keywords are
register_custom_syntax/register_fnregistrations that bridge into async Rust via channels. - Invocation — by the LLM (tool call), by
CALL "name", or directly viaTOOL_EXECfrom the UI.
The sandbox enforces limits so a script cannot take the server down: loop
iteration caps, script timeout, string and array size caps, API rate limits
(HTTP 429 with a retry hint) and file operations scoped to the bot’s
.gbdrive.
LLM-first style
The dialect is designed for the LLM era — you write tools and context setters, not conversation trees:
' load context, then let the model converse
resume = GET BOT MEMORY "announcements"
SET CONTEXT "announcements" AS resume
CLEAR SUGGESTIONS
ADD SUGGESTION "announcements" AS "Show me this week's updates"
TALK "What would you like to know?"
' a tool the LLM can call
PARAM topic AS STRING LIKE "Q4 Results" DESCRIPTION "Topic to summarize"
DESCRIPTION "Creates a summary of the requested topic"
data = GET BOT MEMORY topic
summary = LLM "Summarize this: " + data
TALK summary
| Traditional | LLM + BASIC |
|---|---|
| Parse user input manually | LLM understands naturally |
| Complex IF/ELSE trees | Tools with PARAMs |
| Validate every field | LLM handles validation |
| Design conversation flows | LLM manages conversation |
Execution modes
Scripts run in one of two modes, selected by a pragma:
| RUNTIME (default) | WORKFLOW (#workflow) |
|
|---|---|---|
| Engine | Rhai AST in a blocking thread | step engine + PostgreSQL rows |
| HEAR | blocks the thread (up to hear-timeout-secs) |
suspends to the database, zero threads |
| Restart | loses position | resumes at the exact step |
| Loops / procedures | ✅ | ❌ |
WORKFLOW mode is a planned feature (botserver/WORKFLOW_PLAN.md); today every
.bas without the pragma runs in RUNTIME mode, and a long HEAR holds its
thread until the timeout.
Everyone can program
You don’t need a computer science degree, years of experience, or algorithms — you need an idea, ten minutes of BASIC, and creativity:
| Time | Goal |
|---|---|
| Minute 1 | TALK "Hello, world!" |
| Minute 5 | Add HEAR and LLM |
| Day 1 | Production-ready bot |