Aesthetic Computer - Architecture Reference for LLMs #
Last Updated: 2025-12-07
Purpose: Comprehensive guide for AI assistants working with this codebase
๐ฏ Project Overview #
Aesthetic Computer (AC) is a creative coding platform that runs in the browser, featuring:
- A piece-based architecture (small interactive programs called "pieces")
- KidLisp - a Lisp-based visual programming language
- WebGPU rendering with 2D/3D graphics
- Real-time collaboration and multiplayer support
- Cross-platform deployment (web, iOS, Android, desktop)
๐๏ธ Core Architecture #
System Layers #
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VS Code / Emacs Frontend โ
โ (development environment) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ฉธ Artery (CDP) โ ๐ง Emacs MCP โ ๐ Browser (localhost:8888) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Aesthetic Computer Core โ
โ /system - Main web application (Netlify Functions) โ
โ /system/public - Static frontend assets โ
โ /kidlisp - KidLisp language runtime โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Infrastructure โ
โ Redis โ Session Server โ Stripe โ Cloudflare Tunnel โ Chat Bots โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Directory Structure #
Top-Level Directories #
| Directory | Purpose |
|---|---|
/system |
Main web app - Netlify dev server, functions, frontend |
/kidlisp |
KidLisp language: parser, interpreter, pieces |
/kidlisp.com |
KidLisp.com website (separate site) |
/artery |
๐ฉธ CDP-based control interface for AC |
/dotfiles |
Configuration files (Emacs, shell, etc.) |
/vscode-extension |
VS Code extension for AC panel |
/aesthetic-computer-vault |
Private pieces and secrets |
Key Files #
| File | Purpose |
|---|---|
/dotfiles/dot_config/emacs.el |
Emacs configuration with aesthetic-backend |
/.devcontainer/config.fish |
Fish shell with 50+ ac-* functions |
/artery/artery.mjs |
CDP connection library |
/artery/artery-tui.mjs |
Interactive TUI for AC control |
/artery/emacs-mcp.mjs |
MCP server for VS Code โ Emacs |
/.vscode/mcp.json |
MCP server configuration |
๐ง Emacs Integration #
The aesthetic-backend Function #
Located in /dotfiles/dot_config/emacs.el, this is the main entry point for the development environment:
(defun aesthetic-backend (target-tab)
"Creates the tabbed development environment with eat terminals"
...)
Creates tabs:
arteryโ ๐ฉธ-artery buffer (runsac-artery-dev)statusโ โก-url, ๐-tunnelstripeโ ๐ณ-stripe-print, ๐ซ-stripe-ticketchatโ ๐ค-chat-system, ๐ง -chat-sotce, โฐ-chat-clockweb 1/2โ ๐-site, ๐-sessionweb 2/2โ ๐ด-redis, ๐-bookmarks, ๐ฅ-oventestsโ ๐งช-kidlisp
Emoji to command mapping:
'(("artery" . "๐ฉธ") ("url" . "โก") ("tunnel" . "๐")
("stripe-print" . "๐ณ") ("stripe-ticket" . "๐ซ")
("chat-system" . "๐ค") ("chat-sotce" . "๐ง ") ("chat-clock" . "โฐ")
("site" . "๐") ("session" . "๐") ("redis" . "๐ด")
("bookmarks" . "๐") ("kidlisp" . "๐งช") ("oven" . "๐ฅ"))
Starting the Environment #
# From fish shell
aesthetic # Waits for config, starts Emacs daemon, opens aesthetic-backend
aesthetic-direct # Skips wait, goes straight to aesthetic-backend
platform # Quick reconnect to existing daemon
๐ฉธ Artery System #
What is Artery? #
Artery is a Chrome DevTools Protocol (CDP) bridge that allows controlling the AC browser instance programmatically. It connects to VS Code's embedded Chromium via port 9222/9224.
Architecture #
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VS Code (Electron) โโโโโโโโโโโโโโโ CDP Port 9222 โโโโโโโโโโโโโโโโโโโ
โ โ โ โ
โ โโโ Workbench (main page) โ โ
โ โโโ AC Panel (iframe) โโโโโโโโโโโโโโโโผโโโ Artery Connection โ
โ โโโ localhost:8888 โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
CLI Commands #
# Basic commands
artery # Show help
artery panel # Open AC sidebar panel
artery jump prompt # Navigate to piece
artery current # Show current piece
artery repl # Interactive REPL with console streaming
# Emacs integration
artery emacs # Check Emacs connection
artery emacs "(version)" # Execute elisp
artery emacs-buffers # List Emacs buffers
# Split/Multiplayer
artery frames # List all AC frames
artery player 1 # Connect to Player 1 (top split)
artery player 2 # Connect to Player 2 (bottom split)
# KidLisp.com
artery kidlisp # Open KidLisp.com window in VS Code
artery kidlisp-test # Run all 26 KidLisp tests
artery kidlisp-test basic # Run specific test suite
# Suites: basic, editor, playback, ui, console, examples, errors
# VS Code Utilities
artery close-editors # Close all VS Code editor tabs
# Testing
artery hiphop # Hip-hop beat generator test
artery 1v1 # Split-screen 1v1 test
artery perf 10 # Performance monitor (10 seconds)
๐ธ Poppy (Default Log Capture) #
Use Poppy when you need runtime console logs. It opens the AC panel, jumps to the piece, and streams logs until you stop it.
node artery/poppy.mjs <piece>
# Examples
node artery/poppy.mjs notepat
node artery/poppy.mjs prompt
Default behavior: Prefer Poppy for debugging instead of asking for manual copy/paste of logs.
TUI Mode (artery-tui.mjs) #
Interactive curses-style interface with:
[p]Open AC Panel[j]Jump to piece[r]Enter REPL[e]Emacs mode[t]Performance test[s]Split-screen mode
KidLisp Test Suite (test-kidlisp.mjs) #
Automated test harness for KidLisp.com with 26 tests using direct CDP connection:
artery kidlisp-test # Run all tests
artery kidlisp-test basic # Run basic suite only
artery kidlisp-test editor # Test editor operations
artery kidlisp-test playback # Test play/stop/clear
artery kidlisp-test ui # Test buttons and theme
artery kidlisp-test console # Test console output
artery kidlisp-test examples # Test loading examples
artery kidlisp-test errors # Test error handling
Test Categories:
| Suite | Tests |
|---|---|
| basic | Connection, disk state, API availability |
| editor | Code insertion, selection, clear operations |
| playback | Play, stop, clear, state transitions |
| ui | Theme toggle, example buttons, console visibility |
| console | Log output, clear console, display |
| examples | Loading spiral, bounce, ripple examples |
| errors | Syntax errors, undefined symbols, error recovery |
CDP Keyboard Simulation #
Artery uses Input.dispatchKeyEvent CDP method to simulate VS Code keyboard shortcuts:
// Example: Send Ctrl+K, W chord to close all editors
send('Input.dispatchKeyEvent', {
type: 'keyDown',
modifiers: 2, // Ctrl
key: 'k',
code: 'KeyK',
windowsVirtualKeyCode: 75
});
This allows invoking VS Code commands without needing an open webview.
๐ MCP (Model Context Protocol) Integration #
What is MCP? #
MCP allows VS Code Copilot Chat to call external tools. We have a custom Node.js MCP server that bridges Copilot โ Emacs.
Configuration (.vscode/mcp.json) #
{
"servers": {
"emacs": {
"type": "stdio",
"command": "node",
"args": ["/workspaces/aesthetic-computer/artery/emacs-mcp.mjs"],
"env": {
"EMACSCLIENT": "/usr/sbin/emacsclient"
}
}
}
}
Available MCP Tools #
| Tool | Description |
|---|---|
mcp_emacs_execute_emacs_lisp |
Execute arbitrary elisp code |
mcp_emacs_emacs_list_buffers |
List all open buffers |
mcp_emacs_emacs_switch_buffer |
Switch to a buffer |
mcp_emacs_emacs_send_keys |
Send keystrokes to eat terminal |
mcp_emacs_emacs_get_buffer_content |
Read buffer content |
How It Works #
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VS Code Copilot Chat โ
โ โ โ
โ โผ โ
โ mcp.json โ node emacs-mcp.mjs (stdio JSON-RPC) โ
โ โ โ
โ โผ โ
โ emacsclient --eval "(elisp code)" โ
โ โ โ
โ โผ โ
โ Emacs Daemon (eat terminals running fish โ ac-* commands) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Fish Shell Commands #
Core AC Commands #
| Command | Description |
|---|---|
ac |
cd to AC root, or ac piece-name to jump |
ac-site |
Start main dev server (Netlify + esbuild) |
ac-session |
Session server |
ac-url |
URL generation / shortening |
ac-tunnel |
Cloudflare tunnel for public access |
ac-artery |
Interactive artery TUI |
ac-artery-dev |
Artery TUI with hot reload |
Recording & Packaging #
| Command | Description |
|---|---|
ac-record $piece |
Record MP4/GIF of a piece |
ac-pack $piece |
Package for Teia (IPFS art platform) |
ac-keep $piece |
Create self-contained HTML bundle |
ac-ship |
Package as Electron desktop app |
Testing #
| Command | Description |
|---|---|
test-notepat |
Automated notepat testing |
test-line |
Line drawing test |
test-melody |
Music generation test |
KidLisp #
| Command | Description |
|---|---|
st $piece |
Show source tree for a piece |
kidlisp |
KidLisp probe for kidlisp.com |
๐ฎ Piece System #
What is a Piece? #
A "piece" is a self-contained interactive program. Each piece has:
- A main JavaScript/KidLisp file
- Optional boot, act, sim, paint, beat functions
- Access to the AC graphics/sound API
Piece Locations #
/system/public/aesthetic.computer/disks/ # Main pieces
/kidlisp/pieces/ # KidLisp pieces
/aesthetic-computer-vault/ # Private pieces
Key Pieces #
| Piece | Description |
|---|---|
prompt |
Default landing - command prompt interface |
notepat |
Music pattern sequencer |
line |
Drawing tool |
wand |
3D wand visualization |
bios |
System configuration |
๐ Development Server #
URLs #
| URL | Service |
|---|---|
https://localhost:8888 |
Main AC site |
https://localhost:8889 |
Jump/control API |
http://localhost:3000 |
Session server |
| Port 9222/9224 | CDP (Chrome DevTools Protocol) |
Starting Development #
# Option 1: Full environment via Emacs
aesthetic
# Option 2: Individual services
ac-site # Main server
ac-session # Session server
ac-tunnel # Public tunnel
ac-artery-dev # Artery with hot reload
๐ง Common Development Tasks #
Jump to a Piece #
# Via fish
ac prompt
ac notepat
# Via artery CLI
artery jump prompt
# Via artery TUI
ac-artery โ [j] โ type piece name
# Via MCP (from Copilot Chat)
# Use mcp_emacs_emacs_send_keys to send to artery buffer
Open AC Panel in VS Code #
# Via artery
artery panel
# Via TUI
ac-artery โ [p]
Monitor Console Logs #
# Via artery REPL (streams live)
artery repl
# Via TUI
ac-artery โ [r]
Control from Emacs #
;; Switch buffers
(switch-to-buffer "๐ฉธ-artery")
;; Send keys to eat terminal
(with-current-buffer "๐ฉธ-artery"
(eat-term-send-string eat-terminal "prompt\n"))
๐งช Testing #
Artery Tests #
artery hiphop # Music generation
artery trapwaltz # 3/4 time + trap
artery 1v1 # Split-screen multiplayer
Unit Tests #
# Via fish
test-notepat
test-line
test-melody
# These use artery internally to control AC
๐ Debugging Tips #
Check Emacs Daemon #
check-daemon # Status check
restart-daemon # Force restart
Check Artery Connection #
artery # Shows help if connected
artery frames # Lists all AC iframes
View Logs #
# Emacs debug log
cat /tmp/emacs-debug.log
# AC site logs
# Look in the ๐-site buffer in Emacs
CDP Issues #
If artery can't connect:
- Make sure AC panel is open in VS Code
- Check
host.docker.internalresolves (Docker Desktop) - On Linux, socat may need to forward port 9222โ9224
๐ Key Concepts #
eat Terminal #
Emacs Application Terminal - runs fish shell inside Emacs buffers. Each tab in aesthetic-backend is an eat terminal running an ac-* command.
CDP (Chrome DevTools Protocol) #
Protocol for browser automation. Artery uses it to:
- Find AC iframe targets
- Execute JavaScript in browser context
- Capture console logs
- Send input events
MCP (Model Context Protocol) #
Anthropic's protocol for AI tool calling. Our emacs-mcp.mjs server exposes Emacs operations to VS Code Copilot Chat via JSON-RPC over stdio.
๐ Quick Reference #
Start Development #
aesthetic # Full environment
Control AC #
artery repl # Interactive REPL
ac-artery # TUI interface
From VS Code Copilot #
# Available MCP tools:
- mcp_emacs_execute_emacs_lisp
- mcp_emacs_emacs_list_buffers
- mcp_emacs_emacs_switch_buffer
- mcp_emacs_emacs_send_keys
- mcp_emacs_emacs_get_buffer_content
๐ Notes for AI Assistants #
- Buffer Naming: Emacs buffers use emoji prefixes like
๐ฉธ-artery,๐-site - eat Terminals: Use
eat-term-send-stringto send commands to fish - Artery vs MCP: Artery controls AC browser; MCP controls Emacs
- Fish Shell: User's shell - no heredocs, use printf/echo instead
- Devcontainer: Running in Docker on Fedora Linux
- Port Mapping: CDP on 9222 (host) may map to 9224 (container via socat)
This document serves as an LLM-readable map of the Aesthetic Computer development environment.