SEMAPRAX development documentation

September 19, 2026 · View on GitHub

Status: living internal contributor documentation.

Audience: compiler contributors, maintainers, reviewers, and coding agents.

This page is the internal documentation entry point. Public users should start with the documentation overview. Versioned specifications remain publicly readable, but documents marked private, proof-only, or internal do not describe supported product surfaces.

New contributors and coding agents should read first contribution alongside this page. It states no rule of its own: it supplies the concrete, ordered commands for a single change against the read order and change protocol this page owns.

Read before changing semantics

Read only the documents that own the facts relevant to the change:

  1. RFC 0001 for the long-term language and toolchain contract.
  2. Completion matrix for the affected product rows and their remaining completion gates.
  3. Architecture for stage ownership and trust boundaries.
  4. Quality gates for baseline and change-specific checks.
  5. The exact versioned specification that owns the changed syntax, protocol, ABI, report, or target profile.

Use the roadmap for sequencing only. Use the changelog for history only. Neither is implementation evidence.

Additional required references:

Change areaOwning references
Optional workflow stage instrumentation and observation campaignsWorkflow Profiling v1
First-class function values and indirect invocationFunction Values v1, Function Values v2, Scalar Snapshot Closures v1, Generic and Loop Closures v2, RFC 0004
Generic argument inferenceArgument Inference v1, Argument Inference v2, Argument Inference v3
Records, variants, generics, matching, Option, ResultRFC 0002
Standard-library packages under std/, their catalogs, tiers, and gatesStandard Library v1, Project Manifest v1
Source-authored std.format Writer append operationsFormat Writer v1, Standard Library v1, IO Cursors v1, RFC 0003
Source-authored std.log structured JSON-lines WriterLog Writer v1, Standard Library v1, Format Writer v1, JSON Cursors v1, IO Cursors v1
Source-authored std.io Reader/Writer cursorsIO Cursors v1, IO Lines v1, Standard Library v1, RFC 0003
Source-authored std.io.lines line processingIO Lines v1, IO Cursors v1, Standard Library v1
Padded Base64 encoding in std.encoding.base64Base64 v1, Standard Library v1
Decoded JSON string-token comparisonJSON Cursors v1, Bounded JSON Scanner v1
Source-authored std.test byte assertions and failure-bit helpersTest Byte Assertions v1, Standard Library v1, IO Cursors v1
Explicit bounded environment snapshots or source-authored std.env wrappersBounded Environment I/O v1, Bounded Language Command I/O v1, Capability Manifest v1, Standard Library v1
Bounded process execution, explicit tool registries, or std.processBounded Process I/O v1, Project Manifest v18: Process I/O, Bounded Environment I/O v1, Bounded Language Command I/O v1, Capability Manifest v1, Standard Library v1
JSON Reader/Writer adaptersJSON Cursors v1, Bounded JSON Scanner v1, IO Cursors v1, Project Manifest v16
Source-authored typed std.path.value Path recordsTyped Path v1, Standard Library v1, IO Cursors v1, RFC 0003
Lexical std.path.normalize path normalizationPath Normalization v1, Typed Path v1, Standard Library v1
Filesystem I/O, std.fs, explicit file providers, or the Project filesystem command profileFilesystem I/O v1, Filesystem I/O v2, Host Operation Outcome v1, Project Manifest v19, Standard Library v1, Project Manifest v1, Typed Path v1, IO Cursors v1, RFC 0003
Owned bounded-vector operations or source for traversalOwned Bounded Vec v1, Owned Bounded Vec v2, Owned Bounded Vec For Traversal v1, While Loops v1
Consuming scalar Iter<T> / IterStep<T> operations, owning iterator payloads, generic iterator operations, for own traversal, and same-owner renewalOwning Iterators v1, Owning Iterator Payloads v2, Owning Iterator Loops v1, Owning Iterator Renewal v1, Generic Iterator Helpers v1, Generic Iterator Operations v1, RFC 0003
Compiler-owned Box allocation or authenticated std.mem wrappersOwned Bounded Box v1, RFC 0003, Standard Library v1
Generic owned Result propagationGeneric Owned Result v1, Owned Byte Variant Algebra v1, Concrete Generic Owned-Byte Records v1
Cleanup, resource ownership, callable settlementRFC 0003, RFC 0004
Immutable borrowing, loan provenance, or path-sensitive loan edgesShared Loan Plan v1, Projected Owned-Byte Field Shared Borrow v1, RFC 0002, RFC 0003
Single-file semantic changesPatch v2, Impact, Review, and the relevant evidence version
Managed multi-file publicationWorkspace Transaction v1, Workspace Patch Evidence v1
Cross-file semantic analysis or changeWorkspace overview, graph, analysis, change, operations
Canonical Project-derived semantic workspace revisionCanonical Semantic Workspace Revision v1, Project Manifest v1, Semantic Workspace Image v1
Workspace execution association and retained-generation runtime bindingWorkspace Execution Association v1, Persistent Incremental Semantic Workspace Service v1, ProgramRoot v1, Agent Runtime v2
Workspace execution migration across retained generationsWorkspace Execution Migration v1, Workspace Execution Association v1, Agent State Migration v3, Agent Runtime v2
Durable Agent state migration or recovered seeded executionState Migration v2, Durable State Migration v3, Operation Checkpoint v2, Direct Runtime v2
Checked source-mode migration across retained Projects and source checkpointsSource Live Migration v3, Source Live Journal v2, Project Linked Agent Lifecycle v1, State Migration v2
Cumulative source provider I/O limits and migration carrySource Live I/O v5, Source Live Journal v2, Source Live Migration v3
Private durable source CLI and physical checkpoint hostSource Live CLI v1, Source Live Journal v2, Source Live Migration v3
Segmented ProgramRoot projection or runtime-root relationshipProgramRoot v1, Canonical Semantic Workspace Revision v1, Architecture
ProgramRoot interface/artifact facts or exact Project Lock associationInterface and artifact facts v1, ProgramRoot Dependency Lock Association v1, Project Lock v1, ProgramRoot v1
Versioned exact ProgramRoot context or selectorProgramRoot v2, ProgramRoot v3, Exact Program Context v1, Exact Program Context v2, ProgramRoot v1, Persistent Incremental Semantic Workspace Service v1
Universal semantic transaction kernel or typed operationUniversal Semantic Transaction v1, Universal Semantic Transaction v2, Canonical Semantic Workspace Revision v1, Project Candidates v1
Universal semantic structural diff, transaction rebase, or ordered mergeUniversal Semantic Transaction Composition v1, Universal Semantic Transaction v1, Project Candidate Rebase v1, Project Candidate Semantic Delta v1
Canonical revision-bound semantic query core or operation catalogueUniversal Semantic Query v1, Persistent Incremental Semantic Workspace Service v1, Semantic Workspace Image v1, Workspace Analysis v1, Universal Semantic Transaction v1
Process-resident incremental semantic workspace service corePersistent Incremental Semantic Workspace Service v1, Canonical Semantic Workspace Revision v1, Universal Semantic Transaction v1, Frontend Cache v1
Persistent semantic service JSON-lines/MCP transport or service CLIPersistent Semantic Workspace Service Transport v1, Persistent Semantic Workspace Service MCP v1, Persistent Incremental Semantic Workspace Service v1, Universal Semantic Query v1, Universal Semantic Transaction v1
One-shot universal semantic query or change-preview CLIUniversal Semantic Workflow CLI v1, Universal Semantic Query v1, Universal Semantic Transaction v1, Universal Semantic Transaction v2, Persistent Incremental Semantic Workspace Service v1, CLI Help v4
Installed agent guidance, skill selector, or query capability catalogueInstalled Agent Guidance v1, Universal Semantic Query v1, Standard Library v1, Guided CLI Help v4
Installed diagnostic catalogue, explanation, source-token scanner, or explain CLIInstalled Diagnostics v1, Human Diagnostic Locations v1, Guided CLI Help v4
Installed or exact-current-source fix planning and fix --planInstalled Fix Plan v1, Bounded Diagnostic Repair v1, Installed Diagnostics v1, Guided CLI Help v4
Agent Proposal grammar or generated Runtime v1 final-message compatibilityLanguage-native Agent Object v1, Agent Proposal to Runtime v1 Compatibility v1, Bounded Native Agent Runtime v1
Source-authored std.agent helpers and linked Project Agent lifecycleProject Linked Agent Lifecycle v1, Direct Agent Runtime v2, Agent iterative lifecycle v2
Linked Project Agent state migration and durable recoveryProject Linked Agent Migration v1, Agent State Migration v2, Durable Agent State Migration v3, Project Linked Agent Lifecycle v1
Project daemon rename/workflowProject Transport v2, Rename Transaction v1, Workflow v1
semaprax.toml layout, tables, or loweringPackage Manifest v1 and the frozen Project Manifest v1 profile it lowers to
semaprax.lock render or verificationProject Lock v1
Resolving manifest [dependencies] against a cacheProject Dependency Resolution v1, Offline Resolver v2
Linking exact SEMAPRAX subjects or exposing exact Rust cratesProject Dependencies v1, Package Manifest v1, Native Rust Interoperability v1
Native Rust SDK or host integrationNative Rust Interoperability v1, Project Manifest v1
Deterministic OCI Image Layout / container-deployable-artifact emissionOCI Deployable Artifact v1, Project Manifest v1
Authenticated Project input persistenceProject Revision Store v1, Project Manifest v1, and the additive manifest profile selected by the subject
Project-wide authenticated assurance evidence or architecture-law obligationsProject Assurance Manifest v1, Assurance Manifest v1, Architecture Claims v1, and Canonical Semantic Workspace Revision v1
Offline semantic lock snapshot or fixed-inventory publicationPublished Semantic Lock Snapshot v1, Offline Resolver v1, and Offline Semantic Lock v2

Documentation classes

Every document has one primary role:

ClassOwnsMust not own
Public guideConcepts, supported workflows, examples, user-facing limitsCI run history, module-level implementation narration
Versioned referenceExact syntax, schema, ABI, diagnostics, admission, compatibility, non-claimsProject-wide status or roadmap priority
Internal architectureStage ownership, data flow, trust and authority boundariesFeature history or exhaustive test commands
Completion matrixCurrent status and the condition for a row to become completeHistorical milestone narration or protocol details
Quality gatesBaseline profiles and how to select required evidenceProduct marketing or roadmap sequencing
RoadmapOrdered outcomes and exit conditionsClaims that an outcome is already implemented
ChangelogHistorical repository changesCurrent status authority
Private/proof contractExact experimental or hosted-test boundaryPublic API, stability, or production-support claims

Stable specification paths remain flat under docs/ to preserve citations. Audience separation is expressed through this guide and the book structure, not by moving every established path.

Change protocol

  1. Identify the completion-matrix rows and semantic invariants affected.
  2. Update or add the owning specification before broad implementation prose.
  3. Add a success case and a stable diagnostic regression before or with the implementation.
  4. When syntax carries runtime meaning, update parser, canonical formatter, resolver/HIR, verifier, graph, native backend, and Wasm backend together.
  5. Exercise both projections: canonical source round-trip and semantic graph assertions.
  6. Run the baseline gate plus the owning specification's focused evidence.
  7. Update the completion matrix only if the row's stated gate changes status; record implementation history in the changelog.

Repository navigation

Use semantic tools before reconstructing program meaning from source text:

cargo run --locked -p semaprax -- graph <file>
cargo run --locked -p semaprax -- context <file> <stable-id> --depth 1

Use rg/rg --files for bounded source navigation. See ADR 0001 before adding another repository-wide graph index.

The architecture is the single repository module map. AGENTS.md contains operating invariants and routes contributors here instead of duplicating that map.

Before splitting a module, check whether a gate binds its text. rg the module's path across tests/ and crates/*/src for include_str! and path reads: a hit means a source-locked contract whose join must follow the code, or it will keep passing while covering less. tests/source_locked_contracts.rs fails when a reader binds a module root but not its submodules, and tests/module_size.rs fails when a module grows past its recorded size.

Windows checkouts

Archived evidence under docs/evidence/ nests a subject digest inside a commit digest, and twenty-four of those paths exceed the 260-character limit Windows applies by default — the longest reaches 279 characters once a CI runner's workspace prefix is added. Git refuses to create them with Filename too long and the checkout fails before any build starts.

Enable long paths before cloning on Windows:

git config --global core.longpaths true

CI does this for every job, guarded by runner.os == 'Windows', in a step that runs before actions/checkout; the setting has to exist before the clone, not after it. Keep new evidence paths short enough that this remains a safety net rather than a requirement.

Verification

The standalone semaprax registry package has no private-host dependency. The unpublished crates/semaprax-toolchain package builds semaprax-full using the same compiler and CLI driver. new and doctor are standalone routes; use the full toolchain for build --target rust; Windows revision-store persistence/loading live in its library. Source installs retain the distinct binary name. Tag archives package that binary as semaprax, alongside semapraxd.

Windows Project v8–v10 npm/Web publication also requires semaprax-full; standalone publication rejects before output effects. The private route requires an existing parent and uses held handles, not the legacy CLI parent helper. See Windows owned npm publication.

Do not add private crates to the root package's normal or optional dependency closure, including test-only dependencies. Private-host tests belong to the private toolchain package, whose path dependencies retain exact version pins. The package gate must verify the actual archive; disabling verification is not a packaging fix.

The quickstart, frame-payload product, and root owned-data/UTF-8 SDK tests share tests/support/full_toolchain.rs to build the unpublished CLI locked and offline. The helper selects the unique semaprax-full binary from Cargo's artifact messages, bound to the expected toolchain manifest and a non-test binary target. It requires successful Cargo exit and build-finished, then uses the reported absolute executable path rather than guessing target/debug. A configured Cargo target must not cause a stale binary at the guessed path to substitute for the reported output. Up-to-date (fresh: true) output remains valid under Cargo's own freshness decision; this is not independent artifact attestation or cross-compilation support.

tests/full_toolchain_artifact_v1.rs authors literal-message regressions with real pathname witnesses for configured-target output, stale guessed paths, duplicate/missing/foreign artifacts, malformed streams and unsuccessful or missing completion. The implemented release regression corpus is HOSTED GREEN; they neither compile nor execute a toolchain when eventually selected. The existing product tests separately own actual Cargo and CLI execution.

On Unix, run the complete gate with:

scripts/quality.sh full

For documentation-only changes, the routed gate still checks formatting, examples, rustdoc, and local links. See Quality gates for profiles and change-specific evidence ownership.

Nothing in the remote repository enforces these gates: main carries no branch protection and no ruleset, so a local run is the only thing standing between a change and main. Required CI checks records that configuration, the fail-closed Release gate aggregate, and the unapplied proposal that would require it.

When several worktrees build on one machine, give each its own target directory and keep debug data out of it:

export CARGO_TARGET_DIR="$PWD/target/private"
export CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0

CARGO_TARGET_DIR must stay under the worktree it serves; a target-dir shared with another checkout lets that checkout's build replace this one's binaries and fingerprints while its tests run. The full profile's --workspace --all-targets test build links several hundred integration binaries and needs well over 10 GB in that directory even with the variables above; a -p semaprax harness build needs roughly 1 GB. Remove the private directory when the work is done.

Documentation maintenance rules

  • Put every document's audience and status within its first 12 lines.
  • Link to the owner of a fact instead of copying its full explanation.
  • Keep exact commands and known-answer digests in the owning versioned reference or test, not in the roadmap or README.
  • Describe a boundary once, then use a short link elsewhere.
  • Use “implemented” only when the completion gate has executable evidence.
  • Describe local, hosted, private, public, and proof-only evidence explicitly; none implies another.
  • Keep local Markdown links resolvable and catalog every document in SUMMARY.md; tests/documentation.rs enforces links, metadata, and catalog coverage.