Structure And Declarations
Last validated: 2026-05-14
This page defines top-level Scriptum file layout and declaration syntax.
Canonical File Order
Current parser order is:
- Leading annotations (
-- @...) beforescript script "Name"- Optional free-text description lines
- Optional
version - Zero or more
enumdeclarations - Optional
input - Optional
output - Optional
stream - Optional
import tools(or legacytools) - Optional
env - Optional legacy
secretsblock - Step body (
do,each,decide, etc.)
Recommended skeleton:
-- @accepts_content_type image/*, application/pdf
-- @accepts_extension .png, .jpg, pdf
script "My Workflow"
Optional human-readable description line.
Additional description lines are allowed.
version "0.1.0"
enum Mode = Fast | Balanced | Thorough
input
topic : text
output
result : object
stream
phase : text
payload : object
import tools
* from native
web_search from mcp("search-server")
env
LLM_API_KEY from "LLM_API_KEY"
LLM_MODEL = "gpt-4o"
### Main Flow ###
emit "Init"
phase = "start"Script Header And Description
script "Detect MIME"
version "0.1.0"version accepts quoted or bare numeric forms:
version "0.1.0"
version 0.1.0Description lines can appear directly after script and before declaration keywords.
script "My Script"
This line becomes script description.
Additional lines are concatenated.
version "0.1.0"Comments And Annotations
Line comments use --.
-- plain commentBefore script, the compiler recognizes:
@accepts_content_type@accepts_extension
Example:
-- @accepts_content_type image/*, video/*
-- @accepts_extension .png, .jpg, mp4
script "Media Pipeline"Section separators use ### and are parsed as section markers:
### Data Preparation ###Input, Output, Stream Blocks
input, output, and stream are declaration blocks with typed fields.
input
id : text
top_k : number range(1, 1000) = 10
output
status : text
records : list<object>
stream
item_id : text
score : numberUse stream when your script emits intermediate values via yield.
Tool Imports
Preferred syntax:
import tools
echo from native
web_search from mcp("search-server")
image_chunk from ignite("public")Also supported:
tools
echo from nativeSupported source clauses after from:
nativeigniteignite("org-name")mcp("server-name")
If from ... is omitted, source is auto resolution.
Aliases are supported with as:
import tools
vector_store_search as vbase_searchWildcard import is supported:
import tools
* from nativeEnv Block
env defines required/optional environment variables.
env
LLM_API_KEY from "LLM_API_KEY"
LLM_MODEL = "gpt-4o"
EMBED_DIM : integer min(1) = 1024Rules:
NAMEalone means required with no default.from "SOURCE_KEY"maps script name to stored key.= valueprovides default and marks variable non-required.- Optional type and constraints are allowed after
:.
Legacy secrets Block
The parser still accepts a top-level secrets block for backward compatibility, but current structured env handling should use env.
Indentation Rules
Scriptum structure is indentation-sensitive.
- Child step bodies must be indented deeper than parent step.
decidebranch labels must align to one branch column level.togetherlane grouping uses blank lines between lane groups.
Use consistent spaces for readability and stable parse behavior.
Unsupported Legacy Syntax To Avoid
Do not rely on script-file imports like:
import "lib/setup.scriptum" as setupCurrent parser supports tool imports (import tools) and run-target identifiers (run some_identifier), not direct script file imports.