Aller au contenu

Intervention YAML Reference

Ce contenu n’est pas encore disponible dans votre langue.

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.

  • Location: afs/interventions/int_*.yaml
  • intervention_id must match the filename stem (e.g. int_foo.yaml requires intervention_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
FieldTypeRequiredDescription
intervention_idstringYesMust match filename stem. Pattern: ^int_[a-z0-9_]+$
versionstringYesSemver-shaped
suggestion_idstringNoThe sug_* this Intervention realises. Soft FK — recorded for audit, not enforced
typestringYesOne of the Intervention Types below
target_filestringYesAFS-relative path to the file the intervention edits or creates
changeslistYesAt least one entry. Shape varies by type — see below
deterministicbooleanYesTrue if applying produces the same output on identical input. Phase 2 only applies deterministic: true
reversiblebooleanYesTrue if an undo intervention could be derived from from/to. Informational today; useful when Phase 5 lands
descriptioni18n mappingNoAt least en recommended for the Compare UI tooltip
authormappingNoSee Author
modified_atstringNoISO 8601 timestamp

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.

ValueImplemented in Phase 2?Description
yaml_editYesChange values in a YAML artifact
artifact_addReservedAdd a new signal/thesis/verdict/smebit/notebook
artifact_removeReservedRemove an instrument
config_changeReservedModify tenant config
seed_editReservedModify 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.

For type: yaml_edit, each entry in changes is:

FieldTypeRequiredDescription
pathstringYesDotted YAML path. Supports list-index: severity_rules[0].severity
fromanyNoExpected current value. The apply refuses if the actual value differs (drift check). Omit to skip the check
toanyNoNew 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.

PathWalks to
thresholds.amount_chfdoc['thresholds']['amount_chf']
severity_rules[0].severitydoc['severity_rules'][0]['severity']
a.b[2].c[0].ddoc['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.

  • Both from and to set, file value matches from: apply to, increment change counter.
  • Both from and to set, file value differs from from: refuse with InterventionDriftError. The intervention was authored against a different baseline.
  • Only to set: blind-apply — write to without checking.
  • Only from set: pure verification — fail if from doesn’t match. No write. Useful as a precondition check at the start of a changes list.
  • Already-applied (from == to == current): noop. The file isn’t rewritten (mtime preserved).
FieldTypeRequiredDescription
namestringNoPerson or team name
rolestringNoTheir role (analyst, pack-author, …)
datestringNoISO date the intervention was authored
intervention_id: int_lower_revenue_threshold
version: '1'
suggestion_id: sug_tighten_revenue_leakage
type: yaml_edit
target_file: signals/signal_revenue_leakage.yaml
changes:
- path: thresholds.amount_chf
from: 10
to: 5
deterministic: true
reversible: true
description:
en: Lower the threshold to 5 CHF to catch smaller leakage cases.
author:
name: mig
role: analyst
date: 2026-05-22
modified_at: 2026-05-22T08:00:00Z
Terminal window
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_revenue
jazzisnow jinflow is a jazzisnow product
v0.64.7 · built 2026-09-20 19:48 UTC