Tutorial

Video tutorial coming soon…

Cells are the basic building blocks of Calcish codebooks.

You can change the cell type from the cell actions menu by clicking on the cell icon, by clicking on Cell > Show Actions, or by pressing Command + . You can also quickly change the cell type using a cell-type-specific keyboard shortcut.

Code

Code cells are for JavaScript code that you can evaluate by pressing Shift + Return or by clicking on Run > Evaluate Cell.

The result of the evaluation is displayed below the code.

If the code produces undefined, in certain cases (for example, after defining a function) it is not displayed in the result for better readability.

Code cells are evaluated in the order they appear in the codebook, unless you re-evaluate them manually.

You can access the result of the previous cell using the $ variable. Note that this is not the last evaluated value, but the result of the cell above the current one.

Heading 1-3

Heading cells are used to structure the codebook.

You can collapse and expand the heading cells by clicking on the arrow icon on the right. All cells after the collapsed heading and down until the next heading of the same or higher lever will be hidden.

Text

Text cells are used to add text to the codebook. You can format text using the commands in the Format menu or with shortcuts:

You can also insert links by selecting text and pressing Command + K. To open the link, double-click on it or put the cursor on its text and click on the open icon in the cursor popup.

AI

AI cells are used to generate text using AI models.

To generate text, type a prompt and press Shift + Return or click on Run > Evaluate Cell. The generated text will be streamed to the cell as it is generated, and then appear in the result.

The generated texts is formatted with Markdown and supports KaTeX and code highlighting. You can switch to unformatted text by activating the cell actions menu and clicking on Source.

By default, an AI cell uses the cells above it (except Asset cells) for context: they are converted to a suitable format and prepended to the prompt. Depending on the input size of the model, the context may be truncated by excluding earlier cells. You disable this behavior by unchecking the Use previous cells for context of AI cells checkbox int he Codebook settings: in this case, the prompt will be constructed only from the text in the AI cell.

Due to the non-deterministic behavior of AI models, to avoid overwriting the results of previous evaluations, as well as to save resources, AI cells are not re-evaluated when re-evaluating many cells at once, such as when evaluating the whole codebook or pressing Shift+Command+Return. You can only re-evaluate individual AI cells manually.

Asset

Asset cells are used to add files to the codebook.

To select the file, after creating the Asset cell, click Choose File…. You can either copy the file into the codebook or insert an alias to it by toggling the Copy to codebook checkbox.

After selecting the file, you can change the asset name by editing the corresponding field.

You can access the contents of any asset in the codebook in Code cells by calling Asset(name) where name is the name you assigned to the asset. For example, if the asset is called “items.json”, you can access its text using Asset("items.json").text().