CControxity Docs
GuidesReferenceHTTP APIOpen Controxity
How to

Switches

Ship a change turned off, turn it on from Controxity for everyone or a share, and it turns itself off when it makes errors plainly worse.

A switch (a feature flag) lets a change ship without reaching anyone. That suits code an AI agent wrote: it goes out dark, a person turns it on, and if it hurts, it turns itself off within a minute without a release.

if (controxity.flag("new-checkout", { id: user.id })) {
  return newCheckout(cart);
}
return oldCheckout(cart);

Turning it on#

Once the code asks about a switch, it shows on the product's page under Switches, off. Turn it on for everyone or a share (50%, 25%, 10%, 1%), in production and on staging separately. The app hears within a minute.

WhoMay
A leadTurn a switch on in production; say it may never turn itself off
Anyone who can deployTurn one on on staging; turn one off anywhere

Each change is in the Activity record. With a share, pass a steady id (a user's or an account's), so each one gets the same answer every time. Only a hash of it is used, on your server; nothing is sent. Within one request a switch keeps its first answer.

Turning itself off#

The SDK counts, for each switch, how often it was on and off, and how many errors (and broken expectations) happened in requests where it was on or off. From the moment it's turned on, Controxity compares the two:

A worse switch turns off, by itself, for everyone. The product's people are told why (13% of uses had an error where it's on, 1.0% before it was turned on), and the page shows it in red. Fix it and turn it on again: it's judged afresh from then.

Errors outside a request (a job, a script) can't be tied to a switch, so they aren't counted for one.

When Controxity can't be reached#

A switch keeps the last answer it had. Before the first answer, after a restart, it gives the code's default, so a new switch stays off. A switch Controxity was never told about always gives the default.

From your coding agent#

With the Controxity MCP server, your agent reads a product's switches with get_flags: which are on, for what share, and how each is doing. Ask it to put new or risky code behind a flag("…"). It can't turn one on or off: that stays a person's step.

What's sent#

Each switch's name, and counts: how often on and off, and errors each way. Never who got it, and never the id.

Controxity 1.132.0These pages are in the repository: docs/site