Quick Start
Just ask the agent to set up an automation:Configuration File
Automations are defined inautomations.json at the workspace level:
Basic Structure
The
version field is optional. It’s reserved for future schema changes and currently defaults to version 2.Automation Matchers
Each event type can have multiple matchers. A matcher defines:| Field | Type | Description |
|---|---|---|
id | string | 6-character hex ID (auto-generated) |
name | string | Display name (optional) |
matcher | string | Regex pattern for event data |
cron | string | Cron expression (SchedulerTick only) |
timezone | string | IANA timezone (e.g., “Europe/Budapest”) |
permissionMode | string | Permission mode: safe, ask, or allow-all |
labels | string[] | Labels to apply to created sessions |
enabled | boolean | Enable/disable without removing (default: true) |
actions | array | List of actions to execute |
Example Matcher
Prompt Actions
Prompt actions create new agent sessions with a specified prompt.Basic Prompt
Prompt with Source References
Use
@sourceName to reference sources (like @github, @linear, @slack) and skills in your prompts.Prompt with LLM Configuration
| Field | Description |
|---|---|
llmConnection | LLM connection slug (falls back to workspace default) |
model | Model ID (falls back to provider default) |
Environment Variables
Automation prompts support environment variables that are automatically expanded:Core Variables
| Variable | Description |
|---|---|
$CRAFT_EVENT | The event type that triggered the automation |
$CRAFT_SESSION_ID | The session ID (if available) |
$CRAFT_SESSION_NAME | The session name (sanitized for shell safety) |
$CRAFT_WORKSPACE_ID | The workspace ID |
$CRAFT_EVENT_DATA | Full event payload as JSON |
Event-Specific Variables
Label Events
Label Events
$CRAFT_LABEL- The label that was added or removed
Permission Mode Events
Permission Mode Events
$CRAFT_OLD_MODE- Previous permission mode$CRAFT_NEW_MODE- New permission mode
Session Status Events
Session Status Events
$CRAFT_OLD_STATE- Previous status$CRAFT_NEW_STATE- New status
Flag Events
Flag Events
$CRAFT_IS_FLAGGED- Whether session is flagged (true/false)
Scheduler Events
Scheduler Events
$CRAFT_LOCAL_TIME- Local time (HH:MM format)$CRAFT_LOCAL_DATE- Local date (YYYY-MM-DD)
Example with Variables
Permission Modes
You can set the permission mode for sessions created by automations:| Mode | Display | Behavior |
|---|---|---|
safe | Explore | Read-only, blocks write operations |
ask | Ask to Edit | Prompts for approval (default) |
allow-all | Auto | Auto-approves all commands |
Use
allow-all with caution. It grants the agent full write access without prompts.Labels
Automations can apply labels to sessions they create:Enabling/Disabling Automations
Disable an automation without removing it:Disabled automations remain in the configuration but won’t execute. Set
enabled: true or remove the field to re-enable.History Logging
All automation executions are logged to:- Event type
- Timestamp
- Matcher ID
- Session ID
- Labels applied
- Execution result
Next Steps
Events Reference
Explore all supported events and their matchers
Automation Examples
Real-world automation recipes and patterns