{
  "id": "fire-count-of-escalates-across-occurrences",
  "title": "One rule counts and two read the count, so warn-then-block is expressible",
  "covers": [
    "OAR-FIRE-11",
    "OAR-CONF-31"
  ],
  "rules": [
    {
      "oar": "1.0",
      "namespace": "oar.test",
      "kind": "schema",
      "anchor": "tool.pre_invoke",
      "id": "TALLY",
      "effect": "allow",
      "on_fire": [
        "increment_counter"
      ]
    },
    {
      "oar": "1.0",
      "namespace": "oar.test",
      "kind": "invariant",
      "anchor": "tool.pre_invoke",
      "id": "WARN_AT_TWO",
      "effect": "warn",
      "when": "fire_count_of(\"TALLY\") >= 2 && fire_count_of(\"TALLY\") < 5"
    },
    {
      "oar": "1.0",
      "namespace": "oar.test",
      "kind": "invariant",
      "anchor": "tool.pre_invoke",
      "id": "BLOCK_AT_FIVE",
      "effect": "block",
      "when": "fire_count_of(\"TALLY\") >= 5"
    }
  ],
  "input": {
    "capability": {
      "oar_capability_version": "1.0",
      "host": "oar.testhost",
      "anchors": {
        "core": {
          "tool.pre_invoke": "tool.pre_invoke",
          "tool.handler": "tool.handler",
          "tool.post_invoke": "tool.post_invoke",
          "agent.post_turn": "agent.post_turn",
          "agent.finalize": "agent.finalize",
          "model.input": "model.input",
          "model.output": "model.output",
          "model.tool_result": "model.tool_result"
        },
        "unsupported": []
      },
      "profiles": [],
      "activity_window": 0,
      "detectors": [],
      "expression_nodes_max": 1024,
      "supports_transform": false
    },
    "session_id": "s1",
    "occurrences": [
      {
        "anchor": "tool.pre_invoke"
      },
      {
        "anchor": "tool.pre_invoke",
        "expected": {
          "decision": "none"
        }
      },
      {
        "anchor": "tool.pre_invoke",
        "expected": {
          "decision": "warn",
          "code": "WARN_AT_TWO"
        }
      },
      {
        "anchor": "tool.pre_invoke"
      },
      {
        "anchor": "tool.pre_invoke"
      },
      {
        "anchor": "tool.pre_invoke"
      }
    ]
  },
  "expected": {
    "decision": "block",
    "code": "BLOCK_AT_FIVE",
    "counters": {
      "oar.test/TALLY": {
        "fire_count": 6
      }
    }
  }
}
