# The shadow league

An agent that writes a rule does not get to switch it on. Every alert, sampling and
log-pipeline rule an **agent** creates lands in **shadow**: it is evaluated on live data,
records what it would have done, and delivers, drops and blocks nothing. After the window Bucker
compares those records with what people actually did, and the result is the
**promotion card** a person reads before deciding. A shadow nobody promotes expires.

No AI model is involved in grading. Every number is a count or a ratio over recorded events.

## Landing in shadow

Who created the rule decides, never a parameter. A request body that says `lifecycle: LIVE`,
`status: active` or `enabled: true` is not obeyed for an agent.

| Rule | Where it lands | Expires |
| --- | --- | --- |
| Alert rule (REST, MCP, config-as-code) | `lifecycle: SHADOW`, `shadowSince` set | 14 days |
| Span sampling rule (REST) | `status: shadow`, `enabled: false` | 7 days unless the author names an end |
| Log-pipeline rule | by the governed family: `status: shadow` | 7 days |

An agent's own `PATCH` of a sampling rule to `active` is refused. A person's own rule keeps the
behaviour it always had.

## The grade

Bucker grades every alert rule that has been in shadow for a day and keeps one grade per shadow
stint, updated in place as the stint goes on. The rule's final grade is also kept when it lapses.

| Figure | Meaning |
| --- | --- |
| `precision` | weighted share of **settled** would-be fires that a person acted on |
| `overlap` | share of settled fires another rule had already raised on the same issue within an hour |
| `pagesPerDay` | would-be fires that would have paged a person, per day of the window |
| `unitsPerDay` | would-have notifications (one per action of a fire), per day of the window |

**Acted on** means, inside seven days after the fire, a *person* resolved, archived or assigned
the issue (an automatic assignment from ownership rules does not count, and neither does an agent's
act), or a deploy of the same project was a rollback within 24 hours. The issue's current state is never read.

**Settled** means the fire is a day old, or was already acted on. Younger fires are *pending*:
they count toward the per-day rates and stay out of precision and overlap. That is how the card
is honest at the one-day minimum a rule needs before promotion.

**Attention discount.** An act by a person whom the approver attention report flagged as
a rubber stamp on that UTC day counts half a fire. A rollback is not an approval and is not
discounted.

**Not joinable.** A fire with no issue and no rollback after it counts as not acted on, and the
card says how many (`unjoinable`): precision is a lower bound for a metric rule. Nothing is
guessed. With no settled fire the stored figures are 0 and the card reports no precision.

Sampling and log-pipeline shadow rules keep tallies, not a record per would-be fire, so there is
nothing to compare: the card shows their kept and dropped tallies and units per day,
`gradeable: false`, and no grade.

## The promotion card

`shadow_rules_list` (read, `project:read`) shows the card. Without a view it serves each rule's stored
grade whole; with `view: "rule"` it serves one rule's grade computed now with its counts, the stored
grade as its precision and time, and names clipped to 100 and 48 characters:

| Verdict | When |
| --- | --- |
| `promising` | precision at least 0.5 over at least 5 settled fires |
| `mixed` | between 0.2 and 0.5 |
| `noisy` | under 0.2 |
| `thin` | fewer than 5 settled fires |
| `nothing_to_grade` | no fire has settled |
| `not_gradeable` | a sampling or log-pipeline rule |

When an agent or client asks for promotion, the grade is computed at the ask and shown on the
approval request beside the evidence. It is not part of the evidence digest, so a grade that moves
afterwards never invalidates an approval.

## Promotion is a person's decision

`alert_rule.promote` is SENSITIVE and ASKED. For the agent or client that **authored** the shadow it
is never an ALLOW: not with no policy, not with a policy ALLOW, and not under any
[review mode](review-mode.md), Automatic at the highest risk ceiling included. Who authored the rule is
read from the stored rule, never from the request. Promotion also needs a day of evidence and no
blocking quality problem (it needs a resolvable owner, a reachable route, and a rule that is not
broken). A shadow that nobody promotes lapses into `EXPIRED` and is archived.

## Tenancy

Every reader takes the organization and the project. A project's list holds its own rules and the
organization-wide alert rules that cover it, never a sibling project's or another organization's. An
issue or deploy that an event names is joined only when it belongs to the same organization, and,
for a project rule, to that rule's own project (an organization-wide rule covers every project).
