unhardcoded
reference · format

policy_ir

The routing language for a single model call: a six-element sigma-pol/v2 term.

The routing language for a single model call. A policy is a six-element JSON array: the tag plus five operational slots: filter, rank, select, mutate, fallback. You author the filter, rank, and select; mutate and fallback have stable defaults.

policy.support.json
[
  "policy",
  ["and", ["meets_req"],                                 // filter
         ["not", ["is", "disabled"]],
         ["has_cap", "supports_tools"],
         ["cmp", "bench_intelligence", "ge", 0.5]],
  ["neg", ["normalize", ["field", "price_out"]]],     // rank: cheapest first
  ["argmax"],                                            // select: top survivor
  ["id"],                                                // mutate: pass through
  ["always", { "action": "next_candidate" }]            // fallback: next survivor
]

The five slots

There is no filter/rank/select wrapper keyword. The tag plus five slots, defined purely by array position. (sigma-pol/v2 dropped the old evidence slot; it never affected a decision.)

1 · "policy"
The tag. Stamped with the grammar version, sigma-pol/v2.
2 · filter Pred
The gate: which candidates are eligible. Pure predicates. Anything that fails is out, not silently downgraded. A policy can only narrow the host floor, never widen it.
3 · rank Scorer
Score the survivors. A pure scorer orders the models that cleared the floor: cheapest-first with ["neg", ["normalize", ["field", "price_out"]]], or by intelligence, latency, or any weighted blend.
4 · select Selector
Take the single top of the ranked list. argmax picks the highest-scoring survivor; the cheapest only when the scorer ranks by price.
5 · mutate Xform
id is the identity transform: prompt and params pass through; routing swaps the model, never your call.
6 · fallback FailPlan
A declarative table over a closed action vocabulary, never user code. On any failure, move to the next candidate; every hop is written to the trace.
← Back to docs