Script toolbox
A script can use only what the kzx toolbox gives it. Everything else (the internet, files, keys,
storage) does not exist inside the script. How scripts work: Scripts.
The toolbox
| Part | What it does | When it takes effect |
|---|---|---|
Your collections (Habits, Workouts, …) |
read entries; create, set, tag, link, append to a Block page | collected; applied after the run, as one step |
Run (the input) |
the trigger’s details: the entry that changed, its old and new value, and now (fixed when the run starts) |
— |
ai.ask |
asks the AI a question; text in, text out, no tools | during the run |
agent.run |
starts an agent with its tools, as its own job under the agent’s rules | after the run succeeds (outside effect) |
web.get |
reads a website on the approved list | during the run (cannot be undone) |
web.post |
sends to a website on the approved list | after the run succeeds; during the run if the script needs the answer (cannot be undone) |
notify |
sends a notification | after the run succeeds (outside effect) |
toast |
shows a toast in the open app | after the run succeeds (outside effect) |
channel.send |
sends a message to your chat channel | after the run succeeds (outside effect) |
log |
writes a line into the run history | at once |
helpers |
dates and times in the automation’s time zone, numbers, text, groupCount, table |
— |
Not in the toolbox: fetch, files, timers outside the run, storage of its own, other users,
deleting, the Trash, privacy, sharing, plans, settings, signing in or out.
Your types
The app writes a types file for your account, kzx.d.ts. You never write it by hand.
| Your data | In a script |
|---|---|
| A collection “Habits” | the object Habits |
| A collection “Weekly reviews” | the object WeeklyReviews |
| A Number property “Streak” | habit.Streak, a number |
| A Checkbox property “Done” | habit.Done, yes or no |
| A Tags property “Status” | habit.Status, one of your tags |
| The built-in Title and Entry date | "@title", "@date" |
The naming rule
| Rule | Example |
|---|---|
| Spaces and symbols are dropped; words are joined | “Weekly reviews” → WeeklyReviews |
| Two names would become the same | use entry.prop("Name") |
| A name starts with a digit | use entry.prop("Name") |
A name is a toolbox word (create, entries) |
use entry.prop("Name") |
entry.prop("Name") is typed the same way. Under the names, a map at the top of the file holds
ids, so a rename rewrites the script and never breaks it.
Limits
The same on every device and in the cloud (Pro, part of Cloud Sync), so a script gives the same result everywhere.
| Limit | Value |
|---|---|
| Computing time per run (the script’s own work) | 5 seconds |
| Total time per run (with waiting for the AI and websites) | 2 minutes |
| Memory | 32 MB |
| Changes per run | 200; up to 5,000 with Allow big runs on that automation (still one undo step) |
| AI questions per run | 5 |
| Website calls per run | 20, each at most 30 seconds and 2 MB |
| Runs per hour, per automation | 60, except an approved batch |
| Cloud Sync computing per day | from your plan’s allowance |
| Run history kept | 30 days |
At a limit, the run stops. Nothing is applied and nothing is sent. The run history names the limit. After 5 failed runs in a row, the automation pauses and notifies you.
Where scripts live
Each automation is a file in your folder under Settings/Automations/: .json for everyday
actions, .ts for scripts. A file changed by another program stays off until you approve it in
the app.