Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Semaprax Handbook

Ernesto, the official Semaprax mascot

Ernesto, the Semaprax mascot, guides you from one .spx file to a checked, tested project. This handbook matches Semaprax 0.9.0.

Semaprax is beta software. Syntax, protocols, and binary interfaces can change. Use it to experiment and prototype, not for production or safety-critical work.

Start here

  1. Install Semaprax. It has a one-command installer and a Homebrew formula.
  2. Write and run your first program.
  3. Create a project with modules and tests.

Prefer to watch first? See the recorded walkthrough.

What Semaprax is

Semaprax is a systems language where people and AI agents work on the same program. You write .spx source. The compiler checks it and exposes a semantic graph of declarations, types, contracts, effects, and calls.

IdeaWhat it means
Readable source in Git.spx files are the source of truth. One formatter, one layout.
Stable identitiesEach declaration has an @id("math.add") that survives renames.
Contracts and effectsrequires, ensures, and uses are checked by the compiler.
OwnershipThe compiler rejects use-after-move and data races.
One meaning, three enginesChecked code behaves the same in the interpreter, native C11, and WebAssembly.

The whole loop in one example

module examples.meaning;

@id("math.add")
fn add(left: i64, right: i64) -> i64
    requires left >= 0
    requires right >= 0
    ensures result == left + right
{
    left + right
}

@id("app.main")
fn main() -> i64
    ensures result == 42
{
    add(19, 23)
}
semaprax fmt meaning.spx     # canonical layout
semaprax check meaning.spx   # types, contracts, effects, ownership
semaprax run meaning.spx     # prints 42

What do you want to do?

GoalRead
InstallInstall
Run one fileFirst program
Build a multi-file projectFirst project → Modules
Learn the languageEssentials → Types → Ownership
Use functions, loops, collectionsFunctions · Loops · Collections
Model data and behaviorClasses · Matching · Contracts and effects · I/O · Resources
Prove propertiesLaws and proofs
Configure a project and pick a targetManifests → Profiles → Targets
Call Semaprax from Rust or JavaScriptIntegrations
Use VS CodeEditor setup
Let a coding agent edit your codeAgent workflow → Semantic explorer
Build an agent as a Semaprax programAgent programs → Budgets and recovery
Measure context sizeToken reports and caches
Test, debug, releaseTesting · Debugging · Shipping
Run the agent harness, check trust limits, find a specialist commandHarness · What Semaprax verifies · Specialist commands
Find a commandCommand reference
Look something upCheatsheet · Standard library · Built-ins · Cookbook · Glossary

For implementation details, use the source map and the specifications in docs/.

Get help from the compiler

semaprax help                     # commands you need first
semaprax help all                 # every command
semaprax help language topics     # language topics, one at a time
semaprax help diagnostic SPX-T208 # the fix for one error code