Back to .md Directory

Aesthetic Computer - Architecture Reference for LLMs

Maps the entire Aesthetic Computer development environment for LLMs: architecture, directory layout, Emacs integration, Artery CDP system, MCP tools, and fish shell commands.

May 2, 2026
0 downloads
0 views
ai llm mcp
View source

What this file does

Maps the entire Aesthetic Computer development environment for LLMs: architecture, directory layout, Emacs integration, Artery CDP system, MCP tools, and fish shell commands.

When to use it

  • An LLM needs to understand the codebase before assisting with development
  • You are onboarding a new AI assistant to work on this project
  • Debugging issues with Artery, MCP, or Emacs integration
  • Setting up a development environment from scratch

Assumes this stack

JavaScriptNode.jsEmacs LispFish ShellChrome DevTools ProtocolModel Context Protocol

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

DirectoryPurpose
/systemMain web app - Netlify dev server, functions, frontend
/kidlispKidLisp language: parser, interpreter, pieces
/kidlisp.comKidLisp.com website (separate site)
/artery๐Ÿฉธ CDP-based control interface for AC
/dotfilesConfiguration files (Emacs, shell, etc.)
/vscode-extensionVS Code extension for AC panel
/aesthetic-computer-vaultPrivate pieces and secrets

Key Files

FilePurpose
/dotfiles/dot_config/emacs.elEmacs configuration with aesthetic-backend
/.devcontainer/config.fishFish shell with 50+ ac-* functions
/artery/artery.mjsCDP connection library
/artery/artery-tui.mjsInteractive TUI for AC control
/artery/emacs-mcp.mjsMCP server for VS Code โ†” Emacs
/.vscode/mcp.jsonMCP 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:

  1. artery โ†’ ๐Ÿฉธ-artery buffer (runs ac-artery-dev)
  2. status โ†’ โšก-url, ๐Ÿš‡-tunnel
  3. stripe โ†’ ๐Ÿ’ณ-stripe-print, ๐ŸŽซ-stripe-ticket
  4. chat โ†’ ๐Ÿค–-chat-system, ๐Ÿง -chat-sotce, โฐ-chat-clock
  5. web 1/2 โ†’ ๐ŸŒ-site, ๐Ÿ“‹-session
  6. web 2/2 โ†’ ๐Ÿ”ด-redis, ๐Ÿ”–-bookmarks, ๐Ÿ”ฅ-oven
  7. tests โ†’ ๐Ÿงช-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:

SuiteTests
basicConnection, disk state, API availability
editorCode insertion, selection, clear operations
playbackPlay, stop, clear, state transitions
uiTheme toggle, example buttons, console visibility
consoleLog output, clear console, display
examplesLoading spiral, bounce, ripple examples
errorsSyntax 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

ToolDescription
mcp_emacs_execute_emacs_lispExecute arbitrary elisp code
mcp_emacs_emacs_list_buffersList all open buffers
mcp_emacs_emacs_switch_bufferSwitch to a buffer
mcp_emacs_emacs_send_keysSend keystrokes to eat terminal
mcp_emacs_emacs_get_buffer_contentRead 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

CommandDescription
accd to AC root, or ac piece-name to jump
ac-siteStart main dev server (Netlify + esbuild)
ac-sessionSession server
ac-urlURL generation / shortening
ac-tunnelCloudflare tunnel for public access
ac-arteryInteractive artery TUI
ac-artery-devArtery TUI with hot reload

Recording & Packaging

CommandDescription
ac-record $pieceRecord MP4/GIF of a piece
ac-pack $piecePackage for Teia (IPFS art platform)
ac-keep $pieceCreate self-contained HTML bundle
ac-shipPackage as Electron desktop app

Testing

CommandDescription
test-notepatAutomated notepat testing
test-lineLine drawing test
test-melodyMusic generation test

KidLisp

CommandDescription
st $pieceShow source tree for a piece
kidlispKidLisp 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

PieceDescription
promptDefault landing - command prompt interface
notepatMusic pattern sequencer
lineDrawing tool
wand3D wand visualization
biosSystem configuration

๐ŸŒ Development Server

URLs

URLService
https://localhost:8888Main AC site
https://localhost:8889Jump/control API
http://localhost:3000Session server
Port 9222/9224CDP (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:

  1. Make sure AC panel is open in VS Code
  2. Check host.docker.internal resolves (Docker Desktop)
  3. 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

  1. Buffer Naming: Emacs buffers use emoji prefixes like ๐Ÿฉธ-artery, ๐ŸŒ-site
  2. eat Terminals: Use eat-term-send-string to send commands to fish
  3. Artery vs MCP: Artery controls AC browser; MCP controls Emacs
  4. Fish Shell: User's shell - no heredocs, use printf/echo instead
  5. Devcontainer: Running in Docker on Fedora Linux
  6. 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.

What's inside

13 sections covering project overview, core architecture, directory structure, Emacs integration, Artery system, MCP, fish commands, piece system, dev server, testing, debugging, key concepts, and quick reference

Change this for your project

  • Replace /workspaces/aesthetic-computer with your own project root in mcp.json
  • Replace whistlegraph/aesthetic-computer with your own repository name
  • Replace aesthetic-computer-vault with your own private pieces directory name

Where it goes

Save in docs/ or the repository root. Gives agents and new contributors a map of the codebase.

Worth borrowing

  • Using emoji prefixes for buffer names to make them visually distinct in Emacs
  • Exposing Emacs operations as MCP tools for AI assistants to call
  • Using CDP for browser automation instead of Puppeteer or Playwright

Related Documents