Automation Artifacts
Audience: collection authors declaring portable automation rules and tool authors interpreting them.
Authoritative for:
- governed automation rule artifacts
- event and schedule triggers, scope transitions, targeting predicates, and action vocabulary
See also:
- Collection Model: automation defaults, timezone, note-type mapping predicates, and shared path matching
- Managed Notes and Properties: automation execution and dependency propagation
- Field Definition Reference: field-value equality and tags
- Conformance and Roadmap: portable automation interchange
In path notation on this page, <metadata_directory> means the directory name declared by typedmark.md metadata_directory.
Automation Rules#
Automation rules declare portable reactions without embedding executable code. Each rule is a governed Markdown artifact under <metadata_directory>/automations/; its frontmatter identifies one trigger, optional targeting predicates, and an ordered action list, while its body explains the rule to humans and agents. Execution and propagation behavior are authoritative in Managed Notes and Properties.
specification_version: 0.1.0
automation: project-completed
description: Archive a project when its status becomes done.
priority: 100
trigger:
kind: event
event: note.updated
changed:
status:
to: done
scope:
note_types:
- project
when:
archived:
equals: false
actions:
- kind: set_field
field: review_needed
value: false
- kind: add_tag
tag: state/completed
- kind: archive_note
failure: abort
Rules:
- CM-240
<metadata_directory>/automations/MAY be omitted when the collection defines no automation rules. - CM-241 Every Markdown file directly under
<metadata_directory>/automations/defines exactly one automation rule. - CM-242 An automation file's basename without
.mdMUST equal its top-levelautomationvalue. - CM-243 An automation rule MUST physically contain
specification_version,automation,description,trigger, andactions. - CM-244
automationMUST be a slug that is unique across the collection's effective automation rules. - CM-245
descriptionMUST be a non-empty human-facing string. - CM-246
priorityMAY be omitted, and when omitted its effective value is0. - CM-247 Automation rules are ordered by descending effective
priority, with equal-priority rules ordered by exactautomationidentifier in ascending Unicode code-point order. - CM-248
trigger.kindMUST beeventorschedule. - CM-249 An event trigger MUST declare
eventas one ofnote.created,note.updated,note.moved,note.archived, ornote.deleted. - CM-250
trigger.changedMAY appear only on anote.updatedevent trigger. - CM-280
trigger.changedMUST map one or more top-level field names to a predicate containingfrom,to, or both. - CM-251 A
fromortochange predicate compares the corresponding parsed value in the event'schangesentry by exact field-value equality under Field Definition Reference. - CM-252
scopeMAY declarenote_types,path, or both. - CM-281 A target matches
scopeonly when every declared scope constraint matches. - CM-253 Each identifier in
scope.note_typesMUST resolve to exactly one concrete note type. - CM-254
scope.pathMUST declare exactly one ofequals,under, orregex. - CM-282
scope.pathuses the common Path Matching semantics. - CM-255
when, when present, MUST use the frontmatter predicate shape and semantics defined fornote_type_mappingsin Collection Model. - CM-256
trigger.scope_transitionMAY be omitted, and when omitted its effective value ismatches_after. - CM-257
trigger.scope_transitionMUST bematches_after,enters, orleaves. - CM-258
matches_afterevaluates the combinedscopeandwhentarget predicate against the event's after snapshot, except thatnote.deleteduses its before snapshot. - CM-259
entersmatches when the before snapshot does not satisfy the combined target predicate and the after snapshot does. - CM-260 An
entersorleavestrigger MUST consume an event that carries both before and after snapshots. - CM-261 A schedule trigger MUST declare exactly one daily, weekly, or monthly schedule with a wall-clock
atvalue inHH:mmform. - CM-262 A daily schedule is due on every local calendar day at
atin the collection timezone. - CM-263 A weekly schedule MUST declare a weekday.
- CM-284 A weekly schedule is due on its declared local weekday at
atin the collection timezone. - CM-264 A monthly schedule MUST declare a day from
1through31. - CM-285 A monthly schedule is not due in a local calendar month that lacks its declared day.
- CM-265 If a scheduled local time does not exist because of an offset transition, its occurrence is the first valid instant after the gap.
- CM-266 If a scheduled local time occurs twice because of an offset transition, its occurrence is the earlier instant.
- CM-267 A schedule executor MUST emit at most one
schedule.tickevent for each automation and scheduled instant. - CM-268
actionsMUST be a non-empty ordered list. - CM-269 Supported action kinds are
set_field,add_tag,remove_tag,move_note,archive_note,create_note,logical_delete_note, andhard_delete_note. - CM-270
set_fieldMUST declare a top-levelfieldname and a parsed YAMLvalue. - CM-271
add_tagandremove_tagMUST declare one tag satisfying the stored tag-entry grammar in Field Definition Reference. - CM-272
move_noteMUST declare a collection-relative Markdownpath. - CM-273
archive_note,logical_delete_note, andhard_delete_noteMUST NOT declare action operands. - CM-274
create_noteMUST declare a concretenote_type. - CM-283
create_noteMAY declare avaluesmapping keyed by top-level field name. - CM-275
failureMAY be omitted, and when omitted its effective value isabort. - CM-276 This specification version supports only
failure: abort. - CM-277 Automation rules MUST NOT declare arbitrary scripts, commands, prompts, network calls, or executable expressions as triggers or actions.
- CM-278 Every field, note type, path, tag, and other governed reference in an automation rule MUST be valid for every target on which its action can execute.
- CM-279 An automation artifact that violates its shape, resolution, or target-compatibility rules is an
invalid_automationfailure. - CM-292 A
trigger.changedfield absent from the event'schangesmapping does not match. - CM-293 An omitted
fromortomember places no constraint on that side of the field change. - CM-294
leavesmatches when the before snapshot satisfies the combined target predicate and the after snapshot does not. - CM-295 An
entersorleavestrigger MUST declarescope,when, or both. - CM-296 A schedule-triggered automation without
scopeorwhenMUST contain onlycreate_noteactions.
Automation Defaults#
automation_defaults holds collection-wide safety policy for automation execution. Its propagation limit bounds forward progress even when a cascade never repeats a state exactly.
automation_defaults:
max_propagation_waves: 100
Rules:
- CM-286
automation_defaultsMAY be omitted. - CM-287 An omitted
automation_defaultsvalue is equivalent to an empty mapping. - CM-288
automation_defaults.max_propagation_wavesMAY be omitted. - CM-289 The effective
max_propagation_wavesis100when it is omitted. - CM-290
max_propagation_wavesMUST be a positive integer. - CM-291
max_propagation_wavesMUST NOT exceed10000.
Collection Conformance#
These checks apply when the collection uses this optional contract.
Rules:
- CR-60 Every automation file under
<metadata_directory>/automations/, if present, is valid under Collection Model.
Diagnostic Categories#
These categories use the collection severity policy.
Rules:
- CM-543
invalid_automationapplies when an automation artifact violates Automation Artifacts.