sema
AGENTS.md50 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 checking a change actually works.
Of the AGENTS.md files we read, the 11,773 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.
- CLAUDE.mdCLAUDE.md
- playground/llms.txtllms.txt
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
- Very specific: line 20
If a jake recipe generates the artifact, commit the generated output (don't .gitignore it), and verify it embeds the whole directory …
- Very specific: line 70
Run file: cargo run -- examples/hello.sema | REPL: cargo run | Eval: cargo run -- -e "(+ 1 2)"
- Distinctive: line 108
Follow the sentence rules of ASD-STE100 where practical.
- Distinctive: line 112
Use common words. Prefer short, direct sentences.
- Distinctive: line 113
Use one term per concept, and reuse it.
- Distinctive: line 116
Do not use metaphors, invented idioms, or rhetorical language.
- Distinctive: line 123
Do not narrate work as drama.
- Very specific: line 130
Prefer returning SemaError over unwrap()/expect() when the failure depends on user-supplied Sema values.
- Very specific: line 163
Builtin fn: add to crates/sema-stdlib/src/*.rs, register in that module's register() fn, add an eval test.
- Very specific: line 164
Special form: add lowering in the lower_list() dispatch in crates/sema-vm/src/lower.rs (+ compiler if needed), add an eval test.
- Very specific: line 165
Prelude macro: add to crates/sema-eval/src/prelude.rs (Sema code evaluated at startup, expanded VM-natively).
- Very specific: line 182
NEVER use
git checkout -- <file>to restore a file: if you don't own the only uncommitted changes to it — this destroys other agents' … - Very specific: line 208
Syntax highlighting: use
sema for code blocks in website docs.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.
Files
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_embedover a tracked path).cargo packageships only git-tracked files, so neverinclude_*!a gitignored or build-generated path — the.cratewould lack it. If ajakerecipe generates the artifact, commit the generated output (don't.gitignoreit), and verify it embeds the whole directory (preferrust_embed/include_dirover a hand-maintained file list that can drift). build.rsmust NEVER change what compiles based on file existence, an env var, or the network.Path::new(...).exists()gating arustc-cfgis true in your tree and false from a packaged.crate→ a silently reduced binary. Use an unconditionalinclude_*!(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 intests/andbuild.rs(they run from the checkout) but forbidden in shipped runtime code. Resolve companion binaries viastd::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.gitis 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 incrates/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). Usecrate::common/crate::workflow_commonfor 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). Prefercargo check/cargo nextest run -E 'package(<crate>)'for cross-crate work; keep-pfor a tight single-crate loop.- Editor plugins live in their own repos under the
sema-lisporg (vscode-sema,zed-sema,intellij-sema,emacs-sema,helix-sema,sema.nvim,sema.vim,sublime-sema) and the grammar insema-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 →
ValueAST. 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 (EvalContextholds module cache, call stack, spans),call_valuefor 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 throughsema_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-nbJSON 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,
--resumevia 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 genproduces 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 incrates/sema/src/repl/(editor, highlighter, hinter, validator, inspector, commands). Its Cargo package name issema-lang(the binary target issema), socargo -pcommands use-p sema-lang.
Key Design Patterns
- Trampoline TCO —
eval_stepreturnsTrampoline::Value(v)(done) orTrampoline::Eval(expr, env)(tail call). Special forms must returnTrampoline::Evalfor 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_exportsare fields inEvalContext(sema-core/src/context.rs), threaded through the evaluator asctx: &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 ineval_stepwhen aValue::Keywordappears in head position. - Invariant I2 (CORE-2 GC) — a
NativeFn's boxed closure must not strongly capture anything that can transitively hold aValueorEnv(that would form an uncollectable cycle the collector cannot trace). Traceable state belongs inNativeFn.payload(traced via a registered payload tracer); host infrastructure (e.g. the__vm-*delegates) capturesWeakand upgrades at call time. Seedocs/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, notArc),hashbrown::HashMapforEnvbindings,BTreeMapfor user-facing sorted maps. - Errors:
SemaError::eval()/::type_error()/::arity()constructors — never raw enum variants. Use.with_hint()for actionable user guidance. - Prefer returning
SemaErroroverunwrap()/expect()when the failure depends on user-supplied Sema values. Keepunwrap()only where a preceding explicit check or a hard invariant guarantees success. - Native fns:
NativeFntakes(&EvalContext, &[Value])→Result<Value, SemaError>. UseNativeFn::simple()(no context) orNativeFn::with_ctx(). Special forms returnTrampoline. - 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
Opvariant — never insert (discriminants are positional and index.semacfiles). Then update every site that switches on the opcode:from_u8,stack_effect,_assert_all_ops_covered, theopmodule const (opcodes.rs);advance_pc+stack_effect_operand(serialize.rs); the two bytecode walks incompiler.rs;op_name+ the decode arm (disasm.rs); the VM dispatch arm (vm.rs); the suspension-scan walk (instruction_size+ thescan_chunkclassification inhof_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 withjake 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(ineval_suite) — useeval_tests!andeval_error_tests!(literal=> expectedis the oracle) - Async tests:
crates/sema/tests/suites/vm_async_test.rs(invm_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(inllm_suite) usessema_llm::fake::FakeProvider— a scripted provider (canned replies, tool calls, errors, streamed chunks) installed as the default viasema_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) andset_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 viajake test.notebook-e2e) - A few
#[ignore]d tests inintegration_test.rsare a ready acceptance suite for the deferred VM stack-trace parity work (seedocs/deferred.md).
Fuzzing
- Byte-level (cargo-fuzz):
jake fuzz.all(nightly + cargo-fuzz). Mutates raw bytes to find reader/eval panics — targets incrates/sema-reader/fuzzandcrates/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 atfuzz/grammar-fuzz.sema, driven byscripts/grammar-fuzz.sh. Every finding reproduces from one integer seed;jake fuzz.grammar-emitprints sample programs. Seefuzz/README.md.
Adding Functionality
- Builtin fn: add to
crates/sema-stdlib/src/*.rs, register in that module'sregister()fn, add an eval test. - Special form: add lowering in the
lower_list()dispatch incrates/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 inregister_vm_delegates()ineval.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 invm_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(insema-llm/src/types.rs) is the single source of truth that Sema code produces; each provider'sbuild_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 toChatRequestand map it in each serializer. Example::reasoning-effort→ OpenAIreasoning_effort, Anthropic extended thinking (budget_tokens+ max-tokens/temperature adjustments), GeminithinkingConfig. - Tool-result correlation is mandatory. The agent loop (
run_tool_loop) must echo the assistanttool_callsturn and send results as correlatedChatMessage::tool_result(id, name, content); each serializer maps that to its native shape (OpenAIrole:"tool"+tool_call_id, Anthropictool_use/tool_resultblocks, GeminifunctionCall/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/modelsexposes nothing): reasoning models (gpt-5 series / o-series, viais_reasoning_model) drop a customtemperatureproactively, andDROP_TEMPERATURElearns 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-nonereasoning_efforton/chat/completionsare learned per-model (FORCE_EFFORT_NONE) and pinned tononeonly 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/maxon 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_tokensis used on official OpenAI/Azure (is_official_openai_url). Tolerate unknown response blocks (e.g. Anthropicthinking) rather than failing to decode. - Accounting invariant: a cache hit makes no provider call → it MUST report zero usage so
track_usagedoesn't recharge cost or burn budget. 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 hammergpt-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 testingllm/with-fallback.
Git Rules
- NEVER use
git stashwithout--keep-index. Stashing without--keep-indexsilently destroys uncommitted work from other agents. If you need to inspect a clean tree, usegit stash --keep-indexso staged work is preserved, or work inside a separate worktree (git worktree add). - NEVER use
git stashat 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. Usegit show <ref>:<path>to inspect, or coordinate via branches.
Release Procedure
- Run the full CI-equivalent suite locally (plain
cargo nextest runis 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. Skippingjake examples/jake smoke-bytecodelocally is how a regression once shipped past four releases. The publish workflow (publish-npm.yml, both registries)needs:theverifygate (.github/workflows/verify.yml, the same definition ci.yml runs per-push) — a red suite blocks publishing. After pushing the tag, confirmgh run listshows CI and the publish gate green; never assume "started" == "passed". (The cargo-distRelease/binaries workflow is autogenerated and not test-gated — advisory, except its fail-hard web-runtime freshness step.) - Bump versions in
Cargo.toml: the workspace version and every inter-crate=X.Y.Zpin. One-shot:sed -i '' -e 's/^version = "OLD"/version = "NEW"/' -e 's/version = "=OLD"/version = "=NEW"/g' Cargo.toml, then confirmgrep -c 'OLD' Cargo.tomlis0(no stale version string remains). - Update CHANGELOG.md — add a new
## X.Y.Zsection at the top. - Build release:
cargo build --release(also refreshesCargo.lock); verify./target/release/sema --version. - Commit & tag:
git commit -m "release: X.Y.Z",git tag vX.Y.Z. - Push:
git push origin main --tags— triggers 4 CI workflows (CI, Release/binaries, Publish to crates.io, Publish to npm); confirm withgh run list. The Release workflow also signs + notarizes the macOS binaries when the Apple secrets are configured (docs/release-signing.md). - 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
.semafiles inplayground/examples/<category>/subdirectories playground/build.mjsauto-generatesplayground/src/examples.jsfrom those files — never editexamples.jsby hand- To add an example: add the
.semafile to the appropriate category dir, then runcd 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 vianpx vercel --prod. - Deploy gotcha (monorepo): the Vercel project is CLI-deployed and uploads only
website/— so anyimportin the site that reaches outsidewebsite/(e.g.../../../ui/dist/...or../../../examples/...) builds locally but fails on Vercel ("No such file or directory"). Keep all site imports insidewebsite/. The<sema-code-typer>brand-page showcase inwebsite/.vitepress/theme/BrandGuide.vueis enabled: it consumes the UI library as the published@sema-lang/uinpm dependency (lazyimport('@sema-lang/ui/standalone')) and its sample source is vendored in-tree (website/.vitepress/theme/maze.sample.sema), so nothing reaches outsidewebsite/. 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.vuecomponent (viawebsite/index.md), not any standalone*.htmlfile. - VitePress site uses clean URLs (
cleanUrls: truein bothconfig.tsandvercel.json): the canonical form is extensionless, e.g.https://sema-lang.com/docs/internals/lisp-comparison. The build still writes*.htmlfiles and Vercel 308-redirects the.htmlform to the clean URL, so don't hardcode.htmlin internal doc links — write/docs/lsp, not/docs/lsp.html. Per-page<link rel="canonical">+og:urlare emitted extensionless viatransformHead. All docs pages are under/docs/. - Syntax highlighting: use
```semafor code blocks in website docs. The custom TextMate grammar is vendored atwebsite/.vitepress/sema.tmLanguage.json, a copy of the canonical grammar now in thesema-lisp/vscode-semarepo (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,semawon't be recognized — use```schemeas 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) bywebsite/scripts/generate-og.mjs(headless Chromium via Playwright). Runjake site.og(orcd website && npm run og) after editing the template, logo, page titles, or version, then commit the regeneratedwebsite/public/og/*.jpgplusplayground/og-playground.jpg.config.tstransformHeadwires each page to its card; slug/category/dimension logic is shared viawebsite/.vitepress/og.shared.mjs. Generation is idempotent:generate-og.mjshashes each card's inputs (template + fonts + per-page params) intowebsite/og-manifest.jsonand 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. Commitwebsite/og-manifest.jsonalongside 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 rationaledocs/wip.md— open threads / work-in-progress (currently archived todocs/plans/archive/wip.md; recreate when new threads arise)docs/limitations.md— known gaps and limitationsdocs/deferred.md— items parked with rationale (won't-fix or revisit-later)docs/plans/— individual implementation plans, namedYYYY-MM-DD-<slug>.md(completed plans move todocs/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 referencedocs/bugs/— short write-ups of specific known test/code issues
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
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.

