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

Implementation map and handbook maintenance

Use this page to connect a handbook explanation to the code behind it, and to keep the handbook complete when a release adds commands or features.

Source baseline

This edition describes Semaprax 0.9.0, tag v0.9.0. Implementation links below point at that tag. Topic guides link to the living specifications on main. When you reproduce a result, record the version and the commit.

Follow a source file through the compiler

.spx source → parse → resolve and check → checked HIR → cleanup plan
                                                ↓
                                  queries / interpreter / target build

Parsing reads structure. Resolution names declarations and types. HIR records the checked program. Cleanup planning decides how owned values and resources settle. Queries and execution routes read those results for their own jobs. A source program, a semantic report, an approved operation and an executable package are different objects: keep the producing command and revision with each.

Find the code for a topic

TopicCode and specHandbook page
Commands and flagsCLI catalog, dispatchCommand catalog
Single-file run and stdoutSource executionFirst program
Project creationProject creatorFirst project
Linked functions and profilesHIR linkerProfiles
Law declarations and proof bindingLaw parser, proof binding, example manifestLaws
Agent runtime, recovery, migrationRuntime v2, lifecycleAgent programs, Recovery
Rust API index and bindingsIndex, binding, builderIntegrations
Token reportsReport helper, measurementContext performance
Semantic cacheCache contractContext performance
Registry frontRegistry CLI, registry rulesShipping, Trust
Audit capsules and workflowsCapsule, workflow engineShipping, Trust
HarnessHarness crate, adaptersHarness
EditorExtension guideVS Code
Documentation testsHarness, examplesTesting

The architecture map has the full module map. The completion matrix and quality gates say what is implemented and how it is tested. Read a gate for its named subject and target; a module name does not prove a test result.

Write pages that stay true

  • Open each page with what the reader can do after it. Lead with a runnable example, then explain it.
  • Define a term at first use and link the glossary.
  • Give a runnable example a file name, a working directory, a command and its output. Keep command templates in their own block and say which parts to replace.
  • Label private, experimental, preview and main-only features as such.
  • When source changes, follow the change through the parser, the checker, the runner and the target. Never change compiler behavior to make an example fit.

Run the handbook checks

Python 3.10 or newer, from the repository root:

python3 scripts/test-check-handbook.py
python3 scripts/check-handbook.py --structure-only
python3 scripts/check-handbook.py --compiler /absolute/path/to/semaprax

The structure check validates local links, that every page has one SUMMARY entry, fence closure and example markers. The compiler-backed run also formats temporary copies of marked modules, checks and runs them, and compares the output. Only blocks marked handbook-smoke or handbook-project-file run. Shell fences never do. Marked examples must pass in the interpreter, so a program that needs --native stays unmarked.

Keep the handbook complete for each release

Run this audit before each release. A release is not documented until every public command and every user-visible feature has a page that is true for that version.

1. Commands. List what the binary accepts and find names no page mentions:

semaprax help all | grep '^semaprax ' | cut -d' ' -f2 | sort -u > commands.txt
for c in $(cat commands.txt); do
  grep -rqE "(^|[^a-z-])$c([^a-z-]|\$)" handbook --include='*.md' || echo "missing: $c"
done

The 0.9.0 audit lists 132 commands and no missing name. Command catalog spells every command in full, so a new command must be added there with its page. A hit in grep shows a mention, not an explanation; open the page. Also read crates/semaprax-harness/src/cli.rs for harness verbs, which help all does not list.

2. Features. Read the new rows and status changes in the completion matrix and the release section of the changelog. Give each user-visible item a row in the tables below.

3. Language and library. Compare semaprax help language and semaprax help library with Cheatsheet, Built-in functions and Standard library. std/catalog.json lists every package. Regenerate the package table in the standard-library page when it changes.

4. Diagnostics. Run semaprax help diagnostic codes and add new indexed codes to Diagnostics reference.

5. Examples. Run the compiler-backed check above.

Coverage by area (0.9.0)

“Page” is where a reader learns it. “Overview” means one section or a short entry with a link to the spec. “Not in the handbook” means private, internal or not shipped.

AreaPageDepth
Install by archive, Homebrew, release verifyInstall, ShippingFull for 0.8.0 archives. The 0.9.0 installers, five targets and WinGet are pending the post-release install rewrite.
First program, project, editor, Configure CompilerGetting started, VS CodeFull
Language: scalars, control flow, records, variants, classes, generics, closures, matching, loops, iterators, collections, BoxLanguage chaptersFull
Ownership, borrow, strings, bytes, resources, cleanup, unsafe, session protocols, lawsOwnership, Resources, Contracts and effects, LawsFull
Effects and I/O: stdout, args, stdin, files, TCPInput and outputFull
Effects and I/O: TLS, listeners, HTTPS, stdout_append, checked atomic writeBuilt-in functionsOverview
Projects, manifests, profiles, modules, targets (native, web, wasm, npm, oci, native-callable)Projects chaptersFull
Hot reload (dev)TargetsFull
Lock, resolve, add, fetch, packages, registry, audit, workflow, release verifyShipping, TrustFull
Semantic changes: preview, rebase, merge, patch, evidence, receipts, workspaces, candidates, imagesShipping, ExploreFull
Servers: serve, service, MCP, image protocols, host policy, semapraxdShipping, Specialist commandsFull
Query, context, graph, doc, compact, cacheAgents, Context performanceFull
Agent programs: declare, run, route, budgets, journals, checkpoints, migrationAgent programs, RecoveryFull
Agent harness, adapters, bridge, routingHarnessFull, labeled development tooling
C, C++, OpenAPI, Rust, freestandingIntegrationsFull
Capability manifest, protocol check, SIMD, region report, hygienic generation, plugin manifest, UI schemaSpecialist commandsOverview
WIT and componentsSpecialist commandsOverview, labeled not a product
Assurance policy, proofs, property testsShipping, Laws, TestingFull
Standard libraryStandard libraryAll 47 packages listed
Diagnostics and fixes, fix, repairDiagnostics, DebuggingFull
Doctor, version, quality planTargets, Specialist commandsFull
Retention metadata storesSpecialist commandsOverview
Structured concurrency (Rust scoped-thread runtime)std.async in Standard libraryNot in the handbook as a language feature
Java/Kotlin, Swift/Apple bridges, UI runtimes for iOS, Android, desktop, public generic signatures, ARC zonesNoneNot shipped; see the completion matrix
LAW16 campaigns, CI repairs, kernel and bootstrap documentsNoneInternal evidence

What 0.9.0 added

Changelog itemPage
One-command installers, version pinning, receipts, uninstallInstall, pending rewrite
aarch64-unknown-linux-gnu and x86_64-apple-darwin archives, glibc 2.35 baselineInstall, pending rewrite
Homebrew tap (covered), WinGet manifests (pending)Install
VS Code Configure Compiler and status itemVS Code
Hot-reload stdin and framing fixesTargets
Harness fixes and model routing (MR-00 to MR-15), choice-select/v1, harness status --routingHarness, Agent programs
New help: hints and diagnostics (SPX-U103, SPX-O116, SPX-T207, SPX-F102 and others)Diagnostics, Debugging
Native operand read order fix for let mut (#561)None; a bug fix