Intervention YAML Reference
Field-level specification for Intervention YAML definitions
(interventions/int_*.yaml).
Interventions are the how of the Sense 19 chain. A deterministic, machine-executable edit. Paired (optionally) with a Suggestion which carries the what.
File Convention
Section titled “File Convention”- Location:
afs/interventions/int_*.yaml intervention_idmust match the filename stem (e.g.int_foo.yamlrequiresintervention_id: int_foo)- Validator:
python3 scripts/interventioncheck.py - Contract:
contracts/intervention_contract.v1.json(JSON Schema) - Storage tier: B-tier — lives on whatever branch you authored it on. Each scenario branch carries its own intervention set
Top-Level Fields
Section titled “Top-Level Fields”| Field | Type | Required | Description |
|---|---|---|---|
intervention_id | string | Yes | Must match filename stem. Pattern: ^int_[a-z0-9_]+$ |
version | string | Yes | Semver-shaped |
suggestion_id | string | No | The sug_* this Intervention realises. Soft FK — recorded for audit, not enforced |
type | string | Yes | One of the Intervention Types below |
target_file | string | Yes | AFS-relative path to the file the intervention edits or creates |
changes | list | Yes | At least one entry. Shape varies by type — see below |
deterministic | boolean | Yes | True if applying produces the same output on identical input. Phase 2 only applies deterministic: true |
reversible | boolean | Yes | True if an undo intervention could be derived from from/to. Informational today; useful when Phase 5 lands |
description | i18n mapping | No | At least en recommended for the Compare UI tooltip |
author | mapping | No | See Author |
modified_at | string | No | ISO 8601 timestamp |
Security: target_file constraints
Section titled “Security: target_file constraints”The validator and the apply mechanism both refuse:
- Absolute paths (leading
/) — could write anywhere on disk ..segments — could escape the AFS root via symlink or traversal
A target_file like /etc/passwd or ../../../something fails
validation at author time AND refuses to apply at runtime. Defense
in depth: the verb that mutates files cannot reach outside the AFS.
Intervention Types
Section titled “Intervention Types”| Value | Implemented in Phase 2? | Description |
|---|---|---|
yaml_edit | Yes | Change values in a YAML artifact |
artifact_add | Reserved | Add a new signal/thesis/verdict/smebit/notebook |
artifact_remove | Reserved | Remove an instrument |
config_change | Reserved | Modify tenant config |
seed_edit | Reserved | Modify a seed CSV (e.g., update a reference table) |
Phase 2 only applies yaml_edit. The other types are valid in the
schema but the apply step refuses them — they’re forward-declared
for future phases.
yaml_edit — Changes Shape
Section titled “yaml_edit — Changes Shape”For type: yaml_edit, each entry in changes is:
| Field | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Dotted YAML path. Supports list-index: severity_rules[0].severity |
from | any | No | Expected current value. The apply refuses if the actual value differs (drift check). Omit to skip the check |
to | any | No | New value to set. null means delete the key. Omit to make this a pure drift-check (no mutation) |
Either from, to, or both must be present.
Path Syntax
Section titled “Path Syntax”| Path | Walks to |
|---|---|
thresholds.amount_chf | doc['thresholds']['amount_chf'] |
severity_rules[0].severity | doc['severity_rules'][0]['severity'] |
a.b[2].c[0].d | doc['a']['b'][2]['c'][0]['d'] |
The apply refuses to create missing keys — path: completely_new_field
errors out because the intervention can’t invent a top-level
field. That’s an artifact_add-shape change, not a yaml_edit.
Drift Check Semantics
Section titled “Drift Check Semantics”- Both
fromandtoset, file value matchesfrom: applyto, increment change counter. - Both
fromandtoset, file value differs fromfrom: refuse withInterventionDriftError. The intervention was authored against a different baseline. - Only
toset: blind-apply — writetowithout checking. - Only
fromset: pure verification — fail iffromdoesn’t match. No write. Useful as a precondition check at the start of achangeslist. - Already-applied (
from == to == current): noop. The file isn’t rewritten (mtime preserved).
Author
Section titled “Author”| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Person or team name |
role | string | No | Their role (analyst, pack-author, …) |
date | string | No | ISO date the intervention was authored |
Example
Section titled “Example”intervention_id: int_lower_revenue_thresholdversion: '1'suggestion_id: sug_tighten_revenue_leakagetype: yaml_edittarget_file: signals/signal_revenue_leakage.yamlchanges: - path: thresholds.amount_chf from: 10 to: 5deterministic: truereversible: truedescription: en: Lower the threshold to 5 CHF to catch smaller leakage cases.author: name: mig role: analyst date: 2026-05-22modified_at: 2026-05-22T08:00:00ZAfter Authoring
Section titled “After Authoring”python3 scripts/interventioncheck.py # validate against contract
# Create a scenario branch with this intervention applied:jin scenario create tighter_revenue int_lower_revenue_threshold
# Build the scenario KLS:jin scenario build tighter_revenueSee also
Section titled “See also”- Simulation guide — the full chain end-to-end.
- Suggestion YAML reference — the paired what shape.
- The Simulation — architecture — the apply mechanism’s safety properties, the A-tier / B-tier storage split, the commit-message-as-source-of-truth choice for scenario metadata.