Skip to main content
Flows are YAML-defined automations that react to events. When something happens in your project, flows trigger actions automatically.

Where they live

.tenet/flows/
├── self-driving.yaml      # autonomous improvement loop
├── cross-service.yaml     # multi-repo cascade
└── scripts/               # bash scripts for complex actions

Structure

flows:
  - name: auto-merge-on-improvement
    description: "Auto-merge PRs when eval score improves"
    enabled: true
    trigger:
      pattern: "eval:scored"
      condition: 'data.improved == "true"'
    gate:
      requires_approval: false
      cooldown_hours: 4
    actions:
      - type: log
        message: "Eval passed: {{data.agent}} delta={{data.delta}}"
      - type: command
        command: "gh pr merge {{data.pr_number}} --auto"
      - type: journal
        entry_type: milestone
        title: "Auto-merged PR #{{data.pr_number}}"

Triggers

PatternWhen it fires
eval:scoredAfter any eval completes
scope:impactCross-service impact detected
session:endedAgent or human session ends
cron:nightlyNightly schedule
cron:every-30-minutesEvery 30 min
custom:*Your own events via tenet events publish

Gates

Control when flows actually execute:
gate:
  requires_approval: true    # human must approve
  cooldown_hours: 4          # don't re-trigger within 4h
  max_iterations: 1          # only run once per trigger

Actions

TypeWhat it does
commandRun a shell command
journalWrite a journal entry
logLog a message
spawnSpawn an agent in a worktree

The Self-Driving Loop

The default self-driving.yaml closes the autonomous improvement loop:
Issue filed (tenet/backlog label)
  → PP picks up issue
  → Agent creates PR in worktree
  → Eval runs on PR
  → Score improves → auto-merge → close issue → tenet/done
  → Score regresses → revert → log → try different approach tomorrow

Commands

tenet flows list              # see all flows and their status
tenet flows enable <name>     # activate a flow
tenet flows disable <name>    # deactivate
tenet flows run <name>        # trigger manually
tenet events recent           # see recent events
tenet events publish custom:my-event  # emit your own

Cross-Service Cascade

When services declare produces and consumes scopes, flows detect impact:
- name: cascade-cross-service
  trigger:
    pattern: "scope:impact"
  actions:
    - type: spawn
      target: worktree
      command: tenet peter agent {{data.affected_agent}} -r 3
API changes automatically trigger evals in downstream consumers.