CLAUDE.md raw

CLAUDE.md

Language: Moxie

This project uses Moxie — a compiled systems language for domain-isolated programs. Moxie descends from TinyGo but is its own language with .mx source files, moxie.mod modules, and a restricted execution model.

Read [../moxie/REFERENCE.md](../moxie/REFERENCE.md) before writing any code.

Hard Rules

These are compile errors. Violating them wastes a build cycle.

Type System

Forbidden Constructs

ConstructCompile ErrorUse Instead
go f()No goroutinesChannels + select for dispatch, spawn for isolation
make(T, ...)RemovedLiteral syntax: []T{:n}, chan T{}, map[K]V{}
new(T)Removed&T{} or var x T; p := &x
"a" + "b"No + on text"a" \| "b" (pipe operator)
fallthroughRemovedcase A, B: comma-separated
complex64/128RemovedNot supported
uintptrRemovedExplicit pointers. Allowed with import "unsafe"
import "strings"Removedimport "bytes" (they're the same type)

Literal Syntax

MoxieDescription
[]T{:n}Slice with length n
[]T{:n:c}Slice with length n, capacity c
chan T{}Unbuffered channel
chan T{n}Buffered channel with capacity n
map[K]V{}Empty map

make() is a compile error in user code. Use literal syntax only.

Build

make build
# or directly:
MOXIEROOT=../moxie ../moxie/moxie build -o gitweb .

Architecture

gitweb is a single-file Moxie application (main.mx) that serves a git hosting frontend. It implements HTTP handling directly (raw TCP + manual HTTP parsing) because net/http is broken in Moxie's runtime. Deployed via Docker to git.smesh.lol.

Key details:

Known Moxie Bugs (work around, don't fix here)

Fix upstream in ../moxie first, then rebuild gitweb.

Dependencies

ALLOWED:

FORBIDDEN without approval:

Change Discipline

Code Style

What NOT To Do