Actions

Actions are small automations that change the text of the note you're editing. Each one is a short piece of JavaScript. You can use the actions Zeti includes, or write your own. This guide explains how they work and how to build them, step by step.

Overview

An action performs three steps: it reads your note (or only the text you have selected), transforms that text, and writes the result back into the note. The change is applied as a single edit, so pressing ⌘Z once undoes it completely.

Every action runs inside a secure sandbox. It has no access to the internet and cannot read or write any files on your device. An action can only see and change the note that is currently open. If you choose to enable it, an action can also use Apple's on-device AI. There are three kinds of action:

  • Built-in actions are included with Zeti and ready to use.
  • AI actions use Apple's on-device model and keep everything private.
  • Your own actions are .js files that you create and add yourself.

Turning Actions on

Actions are turned off until you enable them. To turn them on:

  1. Open Settings, then select Extensions.
  2. Turn on Enable JavaScript actions.
  3. To use AI actions as well, turn on Enable AI actions. This option is available only on devices that support Apple Intelligence.

Running an action

Select the text you want to change first. A selection is optional, because many actions work on the whole note. Then run an action in one of three ways:

Command palette

Press ⌘K, type to search, move with ↑ and ↓, and press Return to run.

Actions menu

On Mac and iPad, choose an action from the Actions menu in the menu bar.

Toolbar button

On iPhone, tap the wand button in the toolbar to open the palette.

Built-in actions

These actions are included with Zeti and ready to use:

πŸ—“οΈ
Insert Date
Inserts today's date, in the format YYYY-MM-DD, at the cursor.
πŸ” 
Uppercase Selection / Lowercase Selection
Changes the selected text to all capitals, or all lowercase.
↕️
Sort Selected Lines
Reorders the selected lines into alphabetical order.
βœ‚οΈ
Trim Trailing Spaces
Removes any extra spaces at the end of each line in the note.

AI actions

AI actions send your selected text (or the whole note) to Apple's on-device model, then write the model's response back into your note. Everything happens on your device: your text is never uploaded, and there is no account or API key to set up. AI actions appear once you turn on Enable AI actions, on hardware that supports Apple Intelligence.

πŸ“
Summarize
Shortens the text into a few clear sentences.
✨
Improve Writing
Rewrites the text to read more clearly, keeping your meaning and Markdown formatting.
βœ…
Fix Spelling & Grammar
Corrects mistakes while leaving your wording and tone intact.
πŸ“‹
Extract Action Items
Finds the to-dos in your text and lists them as Markdown checkboxes.

Building your own

You can write your own actions in JavaScript. An action is a single .js file. The file's name becomes the action's name in the menu. For example, a file named Title Case.js appears as Title Case. All of your actions live in one folder, which every vault shares.

Step 1: Open the actions folder

  • On Mac: go to Settings β–Έ Extensions and click Open Actions Folder. The folder opens in Finder, where you can drop in .js files.
  • On iPhone and iPad: go to Settings β–Έ Extensions and tap Add Action… to import a .js file.

New actions usually appear right away, with no need to restart Zeti. If one doesn't show up, simply restart Zeti and it will be there.

Step 2: Write your first action

Create a file named Whisper.js containing a single line. It takes the selected text and makes it all lowercase:

editor.replaceSelection(editor.getSelectedText().toLowerCase());

Save the file in the actions folder, select some text in a note, then run Whisper from the ⌘K palette. That is a complete action.

API reference

Your script runs in a standard JavaScript engine. There is no web page involved, so browser features (such as the DOM) are not available. Two objects are provided: editor, which is always available, and Zeti.ai, which is available when AI actions are enabled. You can use console.log() while testing. Text positions are measured in characters (UTF-16 code units), the same units the editor uses.

editor

editor.getText()
Returns the entire note as a string.
editor.getSelectedText()
Returns the selected text. If nothing is selected, returns an empty string.
editor.getSelectedRange()
Returns the selection as a two-item array, [start, end].
editor.setText(text)
Replaces the entire note with text.
editor.replaceSelection(text)
Replaces the selected text with text. If nothing is selected, inserts text at the cursor.
editor.insert(text)
Inserts text at the cursor. (This is the same as replacing an empty selection.)

Zeti.ai AI actions

Zeti.ai.run(prompt)
Sends prompt to the on-device model and returns the model's reply as a string. It is available only when AI actions are enabled and supported. A call can take a few seconds; Zeti stays responsive while it runs.

Examples

Each example below is a complete action. Save it as a .js file in the actions folder and run it from the palette.

Title Case the selection

Capitalizes the first letter of each selected word.

const result = editor.getSelectedText().replace(/\w\S*/g, function (word) {
  return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
});
editor.replaceSelection(result);

Insert a dated heading

Adds a second-level heading with today's date at the cursor.

const today = new Date().toISOString().slice(0, 10);
editor.insert("## " + today + "\n\n");

Wrap the selection in a code block

Surrounds the selected text with Markdown code fences.

editor.replaceSelection("```\n" + editor.getSelectedText() + "\n```");

Add a one-line summary AI

Asks the on-device model to summarize the note, and adds the result at the top as a quote. (Requires AI actions.)

const summary = Zeti.ai.run(
  "Summarize this note in one sentence:\n\n" + editor.getText()
);
editor.insert("> **Summary:** " + summary + "\n\n");

Safety & privacy

Actions are designed to be safe to run:

  • No internet access. An action cannot make network requests. The usual web functions (fetch, XMLHttpRequest) and module loading (require) are not available.
  • No file access. An action can only see the note you are editing, not any other file on your device.
  • Always undoable. Every change an action makes is a single ⌘Z step.
  • Never freezes the app. Actions run in the background, and Zeti stops any action that takes too long.
  • Private AI. Zeti.ai.run uses Apple's on-device model, so prompts never leave your device.
Your responsibility

Actions are programs that you add yourself. Zeti runs them in a sandbox with no internet or file access, but they can still change the text of your notes. Only add and run actions that you wrote, or that come from a source you trust and whose code you can read and understand. You are responsible for the actions you install and run.