# iRules command-context explainer

> Paste an iRule: every when block explained with the event's own reference one-liner, its commands inventoried and linked, the documented priority evaluation order, and a CMP audit that catches the constructs that demote your virtual server to a single TMM.

- Tool: https://ronutz.com/en/tools/f5-irules-command-context
- Family: Networking

---

# iRules command / context explainer

An iRule is Tcl with a contract: code runs when events fire, commands are valid in some events and not others, and a handful of constructs quietly cost you every CPU core but one. This tool reads the contract back.

Paste an iRule and every `when` block renders as a card. The event's identity comes from the Master List of iRule Events on clouddocs, condensed faithfully, with its module and a link to its reference page; events outside the curated BIG-IP LTM - Local Traffic Manager scope table still parse and are flagged rather than guessed at. The block's commands are inventoried, namespaced and bare alike, each linked directly to its reference page.

When an event appears in more than one block, the evaluation order renders per the priority command's documented rules: values 0 to 1000, default 500, lower runs first, same priority runs in insertion order, and across multiple iRules on one virtual the rule listing order breaks the remaining ties.

The CMP audit is the part that pays rent, and every finding is sourced to the CMP Compatibility page. Global variables are not CMP-compatible; the validator catches the global form as of v10 and the virtual server is demoted, which means every connection it carries lands on a single TMM. The documented alternative for shared statics is the `static::` namespace, and the tool says so on sight. Keys generated in RULE_INIT get one instance per TMM, so cross-TMM decryption fails; statistics profiles count per TMM instance. The audit names each of these where it sees them.

One honesty note, engineered in deliberately: per-command event-validity lists live on each command's own reference page and vary by version, so the tool links every command's page rather than reproducing validity tables it has not verified. A single event name renders its card; the word `events` renders the module-grouped catalogue.

The iRule is parsed and read, never executed. Everything runs locally; nothing you paste leaves the page.

## Standards and references

- [F5 iRules API Reference: Master List of iRule Events (event identities, module grouping)](https://clouddocs.f5.com/api/irules/Events.html) - the curated event table's names and one-line descriptions
- [F5 iRules API Reference: priority (evaluation order: 0-1000, default 500, lower first, insertion order breaks ties, rule listing order across iRules on a virtual)](https://clouddocs.f5.com/api/irules/priority.html) - the multi-block ordering analysis
- [F5 iRules API Reference: CMP Compatibility (global-variable demotion and the v10 validator, static:: alternative, RULE_INIT per-TMM keys, per-TMM statistics profiles)](https://clouddocs.f5.com/api/irules/CMPCompatibility.html) - every CMP finding this tool raises
- [F5 iRules API Reference: Master List of iRule Commands (module naming and per-command page links)](https://clouddocs.f5.com/api/irules/Commands.html) - the command-page URL pattern each inventory entry links

## Related reading

- [CMP: The Cores You Paid For, and the iRule Lines That Give Them Back](https://ronutz.com/en/learn/bigip-cmp-clustered-multiprocessing.md): Clustered multiprocessing runs one TMM per core and spreads flows across them. A demoted virtual server runs everything on TMM0. The demotion list is short and documented: global variables above all, with static:: as the cure, plus two per-TMM traps (RULE_INIT keys, statistics profiles) that do not demote but quietly break assumptions.
