Feature·Interactive Notebook·Browser-based
Interactive Sema, cell by cell.
A Jupyter-inspired notebook built into the Sema toolchain. Write code in cells, evaluate them individually or all at once, and see results inline — including LLM outputs with timing and token usage. All in the browser, all backed by the same runtime.
Then: sema notebook serve my-notebook.sema-nb → http://localhost:8888
Sentiment Analysis
Classify text into positive, negative, or neutral using Sema's llm/extract primitive.
(define texts
["I love this product!"
"Terrible experience, would not recommend."
"It's okay, nothing special."])
(fn (text)
(llm/extract
{:sentiment {:type :string
:enum ["positive" "negative" "neutral"]}}
f"Classify the sentiment of: ${text}")))
Markdown cells
Document as you go.
Markdown cells render formatted text — headings, bold, italic, inline code, code blocks, lists — right alongside your code. Click to edit, press Shift+Enter to re-render. Build a narrative, not just a script.
- Rich formatting. Headings, lists, inline code, and code blocks for documentation that reads like a page, not a comment.
- Click to edit. Click rendered markdown to drop back into source. Shift+Enter to re-render.
Analysis Notes
The classify function uses llm/extract with a typed schema. Results come back as maps, not strings to re-parse.
- Positive: 1 text
- Negative: 1 text
- Neutral: 1 text
Undo & rollback
Mistakes don't stick.
After evaluating a cell, click Undo to roll back: the cell's outputs are restored to their previous state, the interpreter environment is rolled back to before the evaluation, and downstream stale markers are reverted. Useful when a cell modifies global state unexpectedly.
- Environment-level undo. Not just text — the runtime state itself is rewound.
- Inline undo on errors. Error outputs show an "Undo cell" button right where the failure happened.
- Stale marker cleanup. Downstream cells that were marked stale by the evaluation are reverted too.
Stale tracking
Know what's out of date.
When an upstream cell is re-evaluated, all downstream code cells with existing outputs are automatically marked stale. A dashed gold border and a [*] in the cell number tell you exactly which outputs might not reflect the current environment — until you re-run them.
- Visual indicator. Dashed gold left border +
[N*]cell number — unmistakable, not annoying. - Previous output preserved. Stale cells still show their last output, so you don't lose work — you just know it might be outdated.
- Automatic propagation. No manual tagging — the notebook tracks dependencies for you.
Headless & export
Run without a browser.
The same notebook you iterate on in the browser runs headless in CI. Evaluate all code cells, print stdout to the terminal, and export to Markdown for reports. No UI required — the notebook format is just JSON.
- CI validation.
sema notebook runevaluates every cell in order. Add it to a pipeline. - Selective execution. Run specific cells by index with
--cells 1,3,5. - Markdown export.
sema notebook exportproduces a clean .md with code, outputs, and errors.
REST API
Everything is scriptable.
The notebook server exposes a JSON HTTP API on the same port as the UI. Everything the browser does — creating cells, evaluating, reordering, saving — goes through these endpoints. They're stable enough to script against from external tools, CI, or a custom frontend.
- Full CRUD. Create, read, update, delete, and evaluate cells via
/api/cells. - Batch evaluation.
POST /api/eval-allruns every cell, with optional inline source overrides. - VFS included. Read, write, and list files alongside the notebook through
/vfs/*.
Keyboard-first
Hands stay on the keys.
The notebook is designed for a keyboard-first workflow. No mouse required for the common loop: edit, run, advance.
Start a notebook in seconds.
Create one, serve it, open the browser. That's the whole setup.