Skip to content

RFC: Conditional Loopfiles (CONDITIONS Block) #3

Open

Description

@NickAltstein

Summary

Add a CONDITIONS block to Loopfiles that gates execution on external state — market regime, data thresholds, file state, etc. Inspired by classifier-free guidance in diffusion models.

Motivation

Today Loopfiles always execute their full step DAG. There is no way to express "only run this loop if the market is in crisis" or "skip step 3 if the input file is empty." Conditional execution makes Loopfiles adaptive.

Proposed API

CONDITIONS:
  - type: file_exists
    path: "data/signal.csv"
  - type: env_var
    name: MARKET_REGIME
    value: crisis
  - type: command_exit_zero
    command: "python scripts/check_threshold.py"

STEPS:
  - id: s1
    name: trade
    condition: env_var MARKET_REGIME == crisis
    action: execute_trade

Implementation sketch

  1. New CONDITIONS top-level block in schema
  2. Each condition is evaluated before loop execution
  3. Steps can optionally declare condition: referencing a named condition
  4. If a condition is false, the step is skipped (status: skipped in trace)

Open questions

  1. Should conditions be AND (all must pass) or can steps declare individual conditions?
  2. Should conditions support arbitrary shell commands or only predefined types?
  3. How do conditions interact with STOP_WHEN?

Activity

  1. added
    enhancement
    on Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions