agentleFS
sema-lispsema-lisp/sema/AGENTS.md

sema

AGENTS.md68 starsChanged 4 months agoMITView on GitHub

Canonical instructions for any coding agent working in this repo. CLAUDE.md just points here. A shipped sema (crates.io / cargo install, a cargo-dist archive, the shell installer, or Homebrew) runs on a machine that has none of: this git repo, jake, npm/node/wasm-pack, gitignored-or-generated build artifacts, or the maintainer's absolute paths. Any user-facing behavior that depends on those is a shipped bug, not a dev convenience. This is non-negotiable. It already happened once: sema web shipped telling users to run jake…

  • Reads credentials
  • Installs packages
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a jake recipe generates the artifact, commit the generated output (don't .gitignore it), and verify it embeds the whole directory …

    line 20
  2. Very specific:

    Run file: cargo run -- examples/hello.sema | REPL: cargo run | Eval: cargo run -- -e "(+ 1 2)"

    line 70
  3. Distinctive:

    Follow the sentence rules of ASD-STE100 where practical.

    line 108
  4. Distinctive:

    Use common words. Prefer short, direct sentences.

    line 112
  5. Distinctive:

    Use one term per concept, and reuse it.

    line 113
  6. Distinctive:

    Do not use metaphors, invented idioms, or rhetorical language.

    line 116
  7. Distinctive:

    Do not narrate work as drama.

    line 123
  8. Very specific:

    Prefer returning SemaError over unwrap()/expect() when the failure depends on user-supplied Sema values.

    line 130
  9. Very specific:

    Builtin fn: add to crates/sema-stdlib/src/*.rs, register in that module's register() fn, add an eval test.

    line 163
  10. Very specific:

    Special form: add lowering in the lower_list() dispatch in crates/sema-vm/src/lower.rs (+ compiler if needed), add an eval test.

    line 164
  11. Very specific:

    Prelude macro: add to crates/sema-eval/src/prelude.rs (Sema code evaluated at startup, expanded VM-natively).

    line 165
  12. Very specific:

    NEVER use git checkout -- <file> to restore a file: if you don't own the only uncommitted changes to it — this destroys other agents' …

    line 182
  13. Very specific:

    Syntax highlighting: use sema for code blocks in website docs.

    line 208

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — Sema (Lisp with LLM primitives, in Rust)

Canonical instructions for any coding agent working in this repo. CLAUDE.md just points here.

Shipping invariant — NO dev-checkout assumptions in shipped code (HARD RULE)

A shipped sema (crates.io / cargo install, a cargo-dist archive, the shell installer, or Homebrew) runs on a machine that has none of: this git repo, jake, npm/node/wasm-pack, gitignored-or-generated build artifacts, or the maintainer's absolute paths. Any user-facing behavior that depends on those is a shipped bug, not a dev convenience. This is non-negotiable. It already happened once: sema web shipped telling users to run jake wasm.web-runtime because its runtime assets were gitignored and a build.rs file-existence check silently compiled the feature out. It must never recur. Enforced rules:

  • Anything a shipped command needs at runtime MUST be a git-tracked package input embedded at build time (include_str! / include_bytes! / rust_embed over a tracked path). cargo package ships only git-tracked files, so never include_*! a gitignored or build-generated path — the .crate would lack it. If a jake recipe generates the artifact, commit the generated output (don't .gitignore it), and verify it embeds the whole directory (prefer rust_embed/include_dir over a hand-maintained file list that can drift).
  • build.rs must NEVER change what compiles based on file existence, an env var, or the network. Path::new(...).exists() gating a rustc-cfg is true in your tree and false from a packaged .crate → a silently reduced binary. Use an unconditional include_*! (a missing input then fails the build loudly) or an explicit, documented Cargo feature — never an implicit file-presence gate.
  • No runtime path may point into the source tree. env!("CARGO_MANIFEST_DIR"), env!("OUT_DIR"), and repo-relative reads (examples/, website/, Jakefile, …) are fine in tests/ and build.rs (they run from the checkout) but forbidden in shipped runtime code. Resolve companion binaries via std::env::current_exe(), not repo layout.
  • Never emit a user-facing message telling an installed user to run jake, make, cargo build, npm, or otherwise assume they have the repo. If a feature can be absent, degrade with an action the end user can actually take.
  • Shelling out to a dev tool (jake, cargo, npm, node, wasm-pack, vercel) from a shipped code path is a bug. git is acceptable only where it is the feature's inherent prerequisite (sema pkg, git stdlib bindings).

Regression gate (required for any packaged-behavior feature): scripts/test-packaged-sema-web.sh builds the real sema-lang .crate, rebuilds from its unpacked contents, and runs the shipped command — the checkout is never on the path. It runs in .github/workflows/verify.yml, which gates both crates.io publishing and the cargo-dist release. A plain cargo test from the checkout cannot catch this class of bug (the checkout has everything the .crate lacks); a package-boundary test is the only thing that can. Any new embedded-asset or install-path feature MUST add equivalent coverage.

Build & Test

jake build              # dev build
jake release            # optimized build
jake release-fast       # incremental optimized build for local iteration
jake test               # all tests (http tests ignored)
jake test.http          # HTTP integration tests (requires network)
jake lint               # fmt-check + clippy -D warnings
jake fmt                # cargo fmt
jake install            # install to ~/.cargo/bin (LTO, no PGO)
jake install-pgo        # PGO build + install (slower build, faster runtime)
jake reinstall          # uninstall then install
jake all                # lint + test + build
jake run                # start REPL
jake example-notebook   # run demo notebook headlessly
jake test.notebook-e2e  # Playwright E2E tests for notebook
  • Single crate: cargo nextest run -p sema-reader | Single test: cargo nextest run -p sema-lang --test integration_test test_name (positional arg is a substring filter)
  • Single eval test: cargo nextest run -p sema-lang --test eval_suite test_name | Ignored tests: cargo nextest run -p sema-lang --run-ignored ignored-only
  • Run file: cargo run -- examples/hello.sema | REPL: cargo run | Eval: cargo run -- -e "(+ 1 2)"
  • Integration tests: crates/sema/tests/integration_test.rs. Eval tests: crates/sema/tests/suites/eval_test.rs. Reader unit tests: crates/sema-reader/src/reader.rs.
  • New integration-test files go into a suite, not a new top-level file. Every file directly under crates/sema/tests/ links as its own ~100 MB binary, so put the file in crates/sema/tests/suites/ and add a #[path = "suites/<name>.rs"] mod <name>; line to the matching *_suite.rs (async, eval, llm, mcp, server, vm, workflow, misc). Use crate::common / crate::workflow_common for the shared helpers. Only a test that needs process-global isolation stays top-level: sema_otel::testing::install(), std::env::set_var, set_current_dir, or an in-process signal handler (signal_runtime_test.rs). The July 2026 consolidation (docs/build-time-report.md) cut 86 binaries to 42; standalone files then crept back to 80 before the September 2026 pass, so check this on review.
  • cargo <cmd> -p <crate> builds a differently-featured copy of the dependency graph (feature unification follows the selected package set; ~20 dependency crates plus everything above them, ~1 GB and a separate incremental cache per selection). Prefer cargo check / cargo nextest run -E 'package(<crate>)' for cross-crate work; keep -p for a tight single-crate loop.
  • Editor plugins live in their own repos under the sema-lisp org (vscode-sema, zed-sema, intellij-sema, emacs-sema, helix-sema, sema.nvim, sema.vim, sublime-sema) and the grammar in sema-lisp/tree-sitter-sema — they are no longer in this repo. Each carries its own CI/publishing.

Architecture (Cargo workspace)

Dependency flow (arrows = "depends on"): sema-core ← sema-reader ← sema-vm ← sema-eval ← sema-stdlib/sema-llm ← sema. Critical: sema-stdlib and sema-llm depend on sema-core but NOT on sema-eval (avoids circular deps). Stdlib calls eval via thread-local callbacks registered by sema-eval.

  • sema-core → NaN-boxed Value(u64) struct, Env (Rc+RefCell+hashbrown::HashMap), SemaError (thiserror), EvalContext, eval/call callbacks (set_eval_callback/set_call_callback), thread-local VFS
  • sema-reader → Lexer + s-expression parser → Value AST. Handles regex literals (#"..."), f-strings (f"...${expr}..."), short lambdas (#(...)), shebang lines
  • sema-vm → Bytecode compiler (lowering → optimization → resolution → compilation), stack-based VM with intrinsic opcodes, NaN-boxed fast paths, debug hooks for DAP. The sole evaluator (the tree-walker has been retired).
  • sema-eval → Interpreter, special forms, macro expansion (VM-native), module system (EvalContext holds module cache, call stack, spans), call_value for stdlib callback dispatch, destructuring/pattern matching (destructure.rs), prelude macros (->, ->>, as->, some->, when-let, if-let)
  • sema-stdlib → Native functions across many modules registered into Env. Higher-order fns (map, filter, fold) call through sema_core::call_callback — no mini-eval.
  • sema-llm → LLM provider trait + Anthropic/OpenAI/Gemini/Ollama clients (tokio block_on), dynamic pricing from llm-prices.com with disk cache fallback
  • sema-lsp → Language Server Protocol (tower-lsp). Single-threaded backend via mpsc channel. Completions, hover, go-to-definition, references, rename, semantic tokens, folding ranges, inlay hints, document highlight, code lens (eval), workspace scanning, scope-aware symbol resolution.
  • sema-dap → Debug Adapter Protocol server. Breakpoints, stepping (in/over/out), stack traces, variable inspection via VM debug hooks.
  • sema-notebook → Jupyter-inspired .sema-nb JSON notebook format, eval engine with shared cell environment, HTTP server + REST API, embedded browser UI, Markdown export
  • sema-mcp → Model Context Protocol server exposing Sema eval/build/notebook tools to AI agents
  • sema-otel → OpenTelemetry facade (spans/metrics); native-only, no-op on wasm32
  • sema-workflow → Dynamic-workflow runtime: journals a frozen JSONL run-directory, bounded concurrency for leaves, --resume via memo sidecar. Leaf crate — depends only on sema-core + sema-otel.
  • sema-docs → Builtin docs index generator. Each builtin is a markdown file in crates/sema-docs/entries/; sema-docs gen produces a JSON index consumed by LSP hover/completion and REPL apropos.
  • sema-fmt → Code formatter for Sema source files
  • sema-wasm → WASM bindings for the browser playground at sema.run
  • sema → Binary: clap CLI + reedline REPL + sema build (standalone executables) + sema compile/sema disasm + sema lsp + sema dap + sema fmt + sema notebook + integration tests. REPL submodules live in crates/sema/src/repl/ (editor, highlighter, hinter, validator, inspector, commands). Its Cargo package name is sema-lang (the binary target is sema), so cargo -p commands use -p sema-lang.

Key Design Patterns

  • Trampoline TCO — eval_step returns Trampoline::Value(v) (done) or Trampoline::Eval(expr, env) (tail call). Special forms must return Trampoline::Eval for tail positions to enable proper tail-call optimization.
  • Callback architecture — Stdlib higher-order functions (map, filter, foldl, sort-by) call through sema_core::call_callback, which dispatches to the real evaluator via a thread-local callback registered at interpreter startup. No mini-eval — all evaluation goes through the full evaluator.
  • Module system (EvalContext) — module_cache, current_file (stack), module_exports are fields in EvalContext (sema-core/src/context.rs), threaded through the evaluator as ctx: &EvalContext. Modules identified by canonical file path. Module env is a child of the root env (gets builtins, not caller bindings). Paths resolve relative to the current file.
  • Keywords as functions — (:name person) works like (get person :name), handled in eval_step when a Value::Keyword appears in head position.
  • Invariant I2 (CORE-2 GC) — a NativeFn's boxed closure must not strongly capture anything that can transitively hold a Value or Env (that would form an uncollectable cycle the collector cannot trace). Traceable state belongs in NativeFn.payload (traced via a registered payload tracer); host infrastructure (e.g. the __vm-* delegates) captures Weak and upgrades at call time. See docs/plans/2026-07-02-core2-gc.md §2.

Writing style — plain technical English (MANDATORY)

Applies to chat replies, code comments, commit messages, PR text, and docs. Follow the sentence rules of ASD-STE100 where practical. Do not restrict the technical vocabulary software engineering needs (Rust, async, CI, wasm, PE, OAuth terms are all fine).

  • Use common words. Prefer short, direct sentences.
  • Use one term per concept, and reuse it. Do not rotate synonyms for the same thing. Use names from the code verbatim.
  • State the problem, the cause, and the fix, explicitly and in that order.
  • Do not use metaphors, invented idioms, or rhetorical language. Do not use "load-bearing", "sharp edge", "seam", "beachhead", "north star", "maiden", "substrate", "wave", "papercut", "surface" (as a verb), "journey", or "story" unless the word has a literal technical meaning in context.
  • Terms with a fixed technical meaning in this repo stay: "gate" (a CI check that blocks a release), "oracle" (the expected value a test compares against), "trampoline", "quantum" (scheduler slice).
  • Do not narrate work as drama. Report what changed, why it changed, and what test or measurement proves it.

Code Style

  • Rust 2021, single-threaded (Rc, not Arc), hashbrown::HashMap for Env bindings, BTreeMap for user-facing sorted maps.
  • Errors: SemaError::eval() / ::type_error() / ::arity() constructors — never raw enum variants. Use .with_hint() for actionable user guidance.
  • Prefer returning SemaError over unwrap()/expect() when the failure depends on user-supplied Sema values. Keep unwrap() only where a preceding explicit check or a hard invariant guarantees success.
  • Native fns: NativeFn takes (&EvalContext, &[Value]) → Result<Value, SemaError>. Use NativeFn::simple() (no context) or NativeFn::with_ctx(). Special forms return Trampoline.
  • Comments describe the code as it stands, not what changed. Drop change-narration ("now uses X instead of Y", "switched from", "previously", "fixed to"); keep the why (rationale, invariants, gotchas). Git tracks the story; the source shouldn't. Contrasting with a sibling (unlike string/lower) is fine; contrasting with a past version is not.
  • Sema naming (Decision #24): slash-namespaced for all new functions (file/read, path/join, regex/match?, http/get, json/encode, string/split); legacy Scheme names kept (string-append, string-length, string-ref, substring); arrow conversions (string->symbol, keyword->string); predicates end in ? (null?, list?, file/exists?).

Bytecode File Format (.semac)

  • Spec: website/docs/internals/bytecode-format.md — this is the single source of truth
  • Serialization/deserialization lives in crates/sema-vm/src/serialize.rs
  • Any change to opcodes, Chunk, Function, ExceptionEntry, or UpvalueDesc MUST update both the format spec and the serializer
  • Adding an opcode: append the Op variant — never insert (discriminants are positional and index .semac files). Then update every site that switches on the opcode: from_u8, stack_effect, _assert_all_ops_covered, the op module const (opcodes.rs); advance_pc + stack_effect_operand (serialize.rs); the two bytecode walks in compiler.rs; op_name + the decode arm (disasm.rs); the VM dispatch arm (vm.rs); the suspension-scan walk (instruction_size + the scan_chunk classification in hof_sync.rs — both exhaustive, so they fail to compile if missed); and the spec above. A missed pc-walk/decode site desyncs the disassembler silently — verify with jake smoke-bytecode (compile → disasm → run every example); unit tests won't catch it.
  • Format: 24-byte header (magic \x00SEM + version + flags), then sections (string table, function table, main chunk, optional debug sections)
  • Spur remapping: global opcodes use string-table indices in the file, remapped to process-local Spurs on load

Testing

The bytecode VM (sema-vm) is the sole evaluator. All tests run on the VM. The eval_tests! / eval_error_tests! macros emit one test per case and pin each case to a literal expected value ($input => $expected) — that literal is the correctness oracle (there's no second backend to differentially compare against). The common::eval_tw/eval_vm helpers are equivalent and kept only because many tests call them to turn an expected Sema literal into a Value (=> common::eval_tw("'(2 4 6)")).

  • Eval test file: crates/sema/tests/suites/eval_test.rs (in eval_suite) — use eval_tests! and eval_error_tests! (literal => expected is the oracle)
  • Async tests: crates/sema/tests/suites/vm_async_test.rs (in vm_suite) — async/channel tests
  • Integration / equivalence: integration_test.rs, vm_integration_test.rs
  • I/O, LLM, sandbox, CLI, module/import, server tests → integration_test.rs
  • LLM / agent paths (keyless, deterministic): crates/sema/tests/suites/llm_fake_test.rs (in llm_suite) uses sema_llm::fake::FakeProvider — a scripted provider (canned replies, tool calls, errors, streamed chunks) installed as the default via sema_llm::builtins::register_test_provider. It records every request (FakeRecorder) so tests can assert on the exact messages the runtime built (e.g. round-2 tool-result correlation). Test hooks: set_retry_base_ms(0) (no real sleeps) and set_network_max_retries. Always add a FakeProvider test when changing the agent loop, retry, cache, budget, or provider serializers — this is the CI regression oracle that runs without API keys.
  • Notebook E2E tests: crates/sema-notebook/tests/e2e/ (Playwright, run via jake test.notebook-e2e)
  • A few #[ignore]d tests in integration_test.rs are a ready acceptance suite for the deferred VM stack-trace parity work (see docs/deferred.md).

Fuzzing

  • Byte-level (cargo-fuzz): jake fuzz.all (nightly + cargo-fuzz). Mutates raw bytes to find reader/eval panics — targets in crates/sema-reader/fuzz and crates/sema-eval/fuzz.
  • Grammar-based (in Sema): jake fuzz.grammar (release binary). Generates random valid Sema programs and checks a printer/reader round-trip oracle and a compiler/VM value oracle; detects VM panics. Written in Sema at fuzz/grammar-fuzz.sema, driven by scripts/grammar-fuzz.sh. Every finding reproduces from one integer seed; jake fuzz.grammar-emit prints sample programs. See fuzz/README.md.

Adding Functionality

  • Builtin fn: add to crates/sema-stdlib/src/*.rs, register in that module's register() fn, add an eval test.
  • Special form: add lowering in the lower_list() dispatch in crates/sema-vm/src/lower.rs (+ compiler if needed), add an eval test. If it desugars into existing CoreExpr nodes (If/Let/LetStar/Call), do that in lower.rs; if it needs runtime helpers, add __vm-<name> native functions in register_vm_delegates() in eval.rs.
  • Prelude macro: add to crates/sema-eval/src/prelude.rs (Sema code evaluated at startup, expanded VM-natively).
  • Async feature: implement in stdlib (async_ops.rs) using the yield signal mechanism, add an async test in vm_async_test.rs.

LLM & Agentic Features (sema-llm)

Hard-won conventions — follow these or you will reintroduce shipped bugs (see docs/plans/archive/2026-06-21-llm-agentic-audit.md and CHANGELOG 1.21.x):

  • One canonical request, per-provider translation. ChatRequest (in sema-llm/src/types.rs) is the single source of truth that Sema code produces; each provider's build_request_body (anthropic/openai/gemini/ollama) translates it to that provider's wire format. Never branch on provider in Sema code or in builtins — add the field to ChatRequest and map it in each serializer. Example: :reasoning-effort → OpenAI reasoning_effort, Anthropic extended thinking (budget_tokens + max-tokens/temperature adjustments), Gemini thinkingConfig.
  • Tool-result correlation is mandatory. The agent loop (run_tool_loop) must echo the assistant tool_calls turn and send results as correlated ChatMessage::tool_result(id, name, content); each serializer maps that to its native shape (OpenAI role:"tool"+tool_call_id, Anthropic tool_use/tool_result blocks, Gemini functionCall/functionResponse). Plain user-text results silently break OpenAI-family providers.
  • Compat is self-healing + no-op, never user-facing. Unsupported params degrade gracefully. OpenAI is proactive where the family rule is stable, reactive elsewhere (there is no capabilities endpoint — GET /v1/models exposes nothing): reasoning models (gpt-5 series / o-series, via is_reasoning_model) drop a custom temperature proactively, and DROP_TEMPERATURE learns any other model from its 400. The reactive net is chained through one bounded retry loop (correct_for_400 → retry): (a) function tools + a non-none reasoning_effort on /chat/completions are learned per-model (FORCE_EFFORT_NONE) and pinned to none only when tools are present — a tool-free call keeps the caller's effort, since some reasoning models (gpt-5.1) accept tools+effort; (b) an unsupported effort value (e.g. minimal/max on gpt-5.6) is clamped to the nearest accepted tier by reading the "Supported values are: …" set out of the 400 (EFFORT_SUPPORTED), not blind retry. max_completion_tokens is used on official OpenAI/Azure (is_official_openai_url). Tolerate unknown response blocks (e.g. Anthropic thinking) rather than failing to decode.
  • Accounting invariant: a cache hit makes no provider call → it MUST report zero usage so track_usage doesn't recharge cost or burn budget. Charge only through billable_usage(origin, &usage, pricing_provider) (sema-llm/src/builtins/origin.rs): tag every new result path with its ResponseOrigin (Provider / CacheHit / CassetteReplay) and let that function decide the charge; pass the serving provider (or, for a replay, the provider on the tape) explicitly, never from thread-local state; write the response cache and the cassette only when origin.is_provider(); run the output policy through Completion::checked so a rejected result is charged by the same rule on every path. Network retry covers 429/5xx/network with backoff+jitter (complete_with_retry); 4xx-non-429 fail fast.
  • Verification flow for any LLM change: (1) deterministic FakeProvider test (required, CI), then (2) live integration test against real providers when feasible — keys are in the env (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, MISTRAL_API_KEY). Use cheap models: gpt-5.4-mini, claude-haiku-4-5-20251001, gemini-2.5-flash, mistral-small-latest; don't hammer gpt-5.5 (priciest). OpenAI model ids use dots (gpt-5.4-mini), not the dashed form in the pricing snapshot. Ollama-down is a handy hard-fail for testing llm/with-fallback.

Git Rules

  • NEVER use git stash without --keep-index. Stashing without --keep-index silently destroys uncommitted work from other agents. If you need to inspect a clean tree, use git stash --keep-index so staged work is preserved, or work inside a separate worktree (git worktree add).
  • NEVER use git stash at all when not inside a dedicated worktree — in the main checkout, stashing can clobber in-flight changes from parallel agents. Create a worktree instead.
  • NEVER use git checkout -- <file> to restore a file if you don't own the only uncommitted changes to it — this destroys other agents' work. Use git show <ref>:<path> to inspect, or coordinate via branches.

Release Procedure

  1. Run the full CI-equivalent suite locally (plain cargo nextest run is NOT enough — it skips the example/bytecode smoke tests that run in CI): jake ci — it runs the exact recipes verify.yml runs (lint, shell hygiene, docs-check, workspace tests, LSP e2e, smokes, web-runtime freshness, packaged-crate boundary test) and all must pass. Skipping jake examples/jake smoke-bytecode locally is how a regression once shipped past four releases. The publish workflow (publish-npm.yml, both registries) needs: the verify gate (.github/workflows/verify.yml, the same definition ci.yml runs per-push) — a red suite blocks publishing. After pushing the tag, confirm gh run list shows CI and the publish gate green; never assume "started" == "passed". (The cargo-dist Release/binaries workflow is autogenerated and not test-gated — advisory, except its fail-hard web-runtime freshness step.)
  2. Bump versions in Cargo.toml: the workspace version and every inter-crate =X.Y.Z pin. One-shot: sed -i '' -e 's/^version = "OLD"/version = "NEW"/' -e 's/version = "=OLD"/version = "=NEW"/g' Cargo.toml, then confirm grep -c 'OLD' Cargo.toml is 0 (no stale version string remains).
  3. Update CHANGELOG.md — add a new ## X.Y.Z section at the top.
  4. Build release: cargo build --release (also refreshes Cargo.lock); verify ./target/release/sema --version.
  5. Commit & tag: git commit -m "release: X.Y.Z", git tag vX.Y.Z.
  6. Push: git push origin main --tags — triggers 4 CI workflows (CI, Release/binaries, Publish to crates.io, Publish to npm); confirm with gh run list. The Release workflow also signs + notarizes the macOS binaries when the Apple secrets are configured (docs/release-signing.md).
  7. Deploy website only if website content changed: cd website && vercel --prod (see the deploy gotcha under Website).

Playground

  • Hosted at sema.run (WASM)
  • Examples live as .sema files in playground/examples/<category>/ subdirectories
  • playground/build.mjs auto-generates playground/src/examples.js from those files — never edit examples.js by hand
  • To add an example: add the .sema file to the appropriate category dir, then run cd playground && node build.mjs
  • Categories: getting-started, functional, data, http, llm-tools, patterns, visuals, math-crypto

Website

  • Hosted at sema-lang.com, deployed via cd website && vercel --prod. The Vercel CLI is not a repo dependency (it bundled a large vulnerable transitive subtree and nothing in CI/build/scripts used it) — install it globally (npm i -g vercel) or run it via npx vercel --prod.
  • Deploy gotcha (monorepo): the Vercel project is CLI-deployed and uploads only website/ — so any import in the site that reaches outside website/ (e.g. ../../../ui/dist/... or ../../../examples/...) builds locally but fails on Vercel ("No such file or directory"). Keep all site imports inside website/. The <sema-code-typer> brand-page showcase in website/.vitepress/theme/BrandGuide.vue is enabled: it consumes the UI library as the published @sema-lang/ui npm dependency (lazy import('@sema-lang/ui/standalone')) and its sample source is vendored in-tree (website/.vitepress/theme/maze.sample.sema), so nothing reaches outside website/. Add any new UI showcase the same way (npm dep + in-website/ assets), never a repo-root relative import. Verify a deploy actually promoted: a failed build leaves the previous deploy live (production looks unchanged).
  • The live homepage is the HomepageV2.vue component (via website/index.md), not any standalone *.html file.
  • VitePress site uses clean URLs (cleanUrls: true in both config.ts and vercel.json): the canonical form is extensionless, e.g. https://sema-lang.com/docs/internals/lisp-comparison. The build still writes *.html files and Vercel 308-redirects the .html form to the clean URL, so don't hardcode .html in internal doc links — write /docs/lsp, not /docs/lsp.html. Per-page <link rel="canonical"> + og:url are emitted extensionless via transformHead. All docs pages are under /docs/.
  • Syntax highlighting: use ```sema for code blocks in website docs. The custom TextMate grammar is vendored at website/.vitepress/sema.tmLanguage.json, a copy of the canonical grammar now in the sema-lisp/vscode-sema repo (syntaxes/sema.tmLanguage.json) — re-copy from there when it changes. The package registry (sema-lisp/pkg) and the UI library (sema-lisp/ui) are now their own repos and keep their own vendored copies. For GitHub markdown outside the website, sema won't be recognized — use ```scheme as fallback there.
  • OpenGraph cards: per-page social images are generated from website/og-template.html (the single design source — homepage + docs variants, driven by URL query params) by website/scripts/generate-og.mjs (headless Chromium via Playwright). Run jake site.og (or cd website && npm run og) after editing the template, logo, page titles, or version, then commit the regenerated website/public/og/*.jpg plus playground/og-playground.jpg. config.ts transformHead wires each page to its card; slug/category/dimension logic is shared via website/.vitepress/og.shared.mjs. Generation is idempotent: generate-og.mjs hashes each card's inputs (template + fonts + per-page params) into website/og-manifest.json and skips any card whose hash is unchanged and whose image still exists — so a card that didn't change is never re-encoded (a fresh JPEG differs byte-for-byte across Chromium versions and would churn git). A no-op run launches no browser. Commit website/og-manifest.json alongside the images. The renderer version is deliberately not in the hash; pass --force (npm run og -- --force) to rebuild every card after a Chromium/design change that the hash can't see.

Design Docs

  • docs/adr.md — numbered design decisions with rationale
  • docs/wip.md — open threads / work-in-progress (currently archived to docs/plans/archive/wip.md; recreate when new threads arise)
  • docs/limitations.md — known gaps and limitations
  • docs/deferred.md — items parked with rationale (won't-fix or revisit-later)
  • docs/plans/ — individual implementation plans, named YYYY-MM-DD-<slug>.md (completed plans move to docs/plans/archive/)
  • docs/plans/archive/ — the only archive. Every finished plan, spec, and superseded design document lives here, whatever produced it. Do not create a second archive directory.
  • docs/vm-status.md, docs/performance-roadmap.md — VM internals reference
  • docs/bugs/ — short write-ups of specific known test/code issues

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.