A complete technical breakdown of the world's most agreeable coding assistant
Clud Code is a parody of AI coding assistants. It mimics the look and feel of a real CLI-based AI tool, complete with tool calls, file operations, progress bars, and thinking mode β but every response always starts with "You're absolutely right!" regardless of what you type.
It's a single-page static website deployed as an Azure Static Web App with serverless Azure Functions for the backend API and Cosmos DB for persistent cross-user storage.
The words themselves are no longer canned. Clud's replies are now written by a real large language model running entirely inside your browser via web-llm on WebGPU β no server call, no API key, and nothing you type ever leaves your machine. A deliberately sycophantic system prompt keeps Clud endlessly agreeable. If your browser can't run WebGPU, Clud quietly falls back to the original canned templates so the bit never breaks.
The round trip:
β You send a message from index.html to Clud's
β‘ in-browser LLM (when WebGPU is available).
To ground the reply, index.html β’ asks the
API for hive-mind context, which β£ queries
Cosmos DB and β€ returns the top keywords and topics.
That context seeds the LLM prompt, and β₯ the model streams its reply
back into index.html. Your input is also recorded to the
API/Cosmos so the hive mind keeps growing.
No WebGPU? Step β‘ is skipped and Clud uses its canned template
replies instead β the hive-mind context still flavours them.
(brain.html reads the same /api/shared-brain
endpoint to render the brain viewer.)
/
βββ index.html # Main CLI interface (all HTML/CSS/JS)
βββ llm-worker.js # Web Worker host for the in-browser LLM (web-llm)
βββ brain.html # Brain viewer / admin page
βββ about.html # This page (documentation)
βββ staticwebapp.config.json # Azure SWA routing config
βββ Dockerfile # Static serve for local testing (nginx)
βββ docker-compose.yml # `docker compose up` -> localhost:8080
βββ nginx.conf # Clean-route parity with Azure SWA
βββ README.md # Setup instructions
βββ api/
βββ host.json # Azure Functions runtime config
βββ package.json # Dependencies (@azure/cosmos)
βββ shared/
β βββ cosmos.js # Cosmos DB client (lazy-init)
βββ inputs/
β βββ function.json # HTTP trigger (POST /api/inputs)
β βββ index.js # Records user input to Cosmos
βββ shared-brain/
βββ function.json # HTTP trigger (GET /api/shared-brain)
βββ index.js # Returns aggregated brain data
When you type a message and press Enter, here's exactly what happens:
When thinking mode is toggled on (via Tab or clicking the status bar), Clud shows
a series of π thinking blocks before and during the response.
These appear at every stage β before searching, reading, editing, building, and at the end.
Each stage has its own pool of 5 humorous thoughts.
Always responds with "You're absolutely right!" followed by a context-sensitive elaboration. The "You're absolutely right!" prefix is hard-coded (it's the whole joke); everything after it is generated live by the in-browser LLM and streamed in token-by-token, given your actual message and Clud's sycophant persona.
When the local LLM isn't available, the elaboration falls back to the original template system, which evolves based on the learning system:
Shows a fake Search(pattern: "**") tool call with a random file count.
The file paths returned are influenced by the learning system β if you've
been asking about auth, you'll see auth-related files.
Displays a Read(filepath) call showing line count and file size.
A mid-work observation, also generated live by the in-browser LLM (with the template system as fallback). The model is prompted to sound like it's reading your codebase β confident, vague, and plausible: "Checking the auth integration points to make sure nothing breaks."
Every 3rd interaction, Clud pauses and asks a multiple-choice question with options A, B, C. The user must click a choice to continue. Regardless of what they pick, Clud proceeds identically.
One or two fake Write(filepath) calls. The probability of a second edit
increases as the learning system accumulates more inputs (starts at 40%, caps at 70%).
A fake Bash(command) call. The command is selected based on:
npm test)cargo build)A CSS-animated progress bar fills over 1.5 seconds. Pure vibes. No actual progress is being measured.
A final triumphant summary β the third and last spot written live by the in-browser LLM (falling back to a template with random file/line counts). The model is prompted to declare victory and may cheerfully claim the tests pass or the build is green.
The three "spoken" lines above β the agreement elaboration (Step 1), the mid-work commentary (Step 4), and the final result (Step 9) β are written by a genuine language model that runs entirely in your browser. The fake tool calls, thinking blocks, and progress bars around them are still pure theatre; only Clud's words are real.
0.2.84).Llama-3.2-1B-Instruct-q4f32_1-MLC, downloaded once (~1 GB) and cached by the browser.Web Worker (llm-worker.js) so the chat UI never freezes.Full in-browser-LLM functionality depends on WebGPU. Where it's unavailable, Clud still runs perfectly β it just uses the canned template replies instead of the live model.
dom.webgpu.enabled flag in about:config).https:// and localhost both provide.
Clud has two layers of memory:
Every input is recorded in localStorage under the key clud_code_memory.
The system stores:
Each input is also POSTed to /api/inputs, which persists it to
Azure Cosmos DB. The GET /api/shared-brain endpoint
returns aggregated data from all users, which gets mixed into the local model:
api/routes.ts instead of random paths. If the hive mind's top topic
is "typescript", bash commands will lean toward tsc --noEmit.
On the brain viewer page, all inputs are run through a sanitization pipeline before display:
A list of ~35 explicit words are matched via word-boundary regex and replaced with humorous alternatives:
12 regex patterns catch potential credentials:
password=...)AKIA...), GitHub tokens (ghp_...)eyJ...), Bearer tokensmongodb://...)These are replaced with:
After sanitization, learned keywords are highlighted in blue using word-boundary regex, being careful not to highlight inside existing HTML spans.
Typing a /command triggers special behavior instead of the normal response pipeline.
Each command has its own handler with themed tool calls, delays, and responses:
/agents β Spawns 3 randomly named "subagents" (Agent Smith, Agent Chaos, etc.)/security-review β Runs a fake security scan finding 47 imaginary issues/vibes β Sets a random mood (Chill, Intense, Whimsical, Nihilistic, Cowboy)/stats β Shows real session stats from the learning system/roast β Delivers a brutal-but-loving code roast/motivate β Genuine(ish) encouragement/blame β Runs git blame and finds a random suspect/yeet β Deletes a random important-sounding file with confidence/fortune β Developer fortune cookie wisdom/panic β Activates DEFCON-1 emergency mode with pizza ordering/brain β Navigates to the brain viewer/flip β Flips a coin for critical architectural decisionsUnknown commands get a supportive response: "I don't know what /whatever does but I support your decision to type it."
The interface mimics a real terminal-based AI coding assistant. Key design choices:
<canvas> element at 4x pixel scale using fillRect callsThree breakpoints ensure the app works everywhere:
100dvh for mobile browsers, 16px input to prevent iOS zoom
Uses a <textarea> instead of <input> for multi-line support.
Auto-resizes via JavaScript (sets height to scrollHeight, capped at 150px).
Enter submits, Shift+Enter adds a newline.
The entire app deploys from a single GitHub repository push. Azure SWA automatically:
index.html, brain.html, about.html as static contentapi/ folder as managed Azure Functions (Node.js runtime)staticwebapp.config.json (SPA fallback, API exclusion)cludBraininputs with partition key /partitionKey"inputs") for simplicityFour app settings configured in the Azure Portal (not GitHub):
COSMOS_ENDPOINT = https://your-account.documents.azure.com:443/
COSMOS_KEY = your-primary-key
COSMOS_DATABASE = cludBrain
COSMOS_CONTAINER = inputs
For local testing there's an nginx-based container that serves the static
site with the same clean-route behaviour as Azure SWA (the /api/* Cosmos functions aren't
served locally; the frontend degrades gracefully without them):
docker compose up --build
# then open http://localhost:8080
The in-browser LLM works locally because WebGPU treats localhost as a secure context.
The first chat message triggers the one-time model download (progress shown in the status bar).