Skip to content

Basic Concepts

There are a few concepts that are core to Detent. Understanding them from the outset will make everything else much easier to follow.


A knob is a single named configuration value that a running process reads. Every knob holds one signed 64-bit integer: 0 or 1 for a feature flag or kill switch, any value for a limit, a size or a timeout. Knobs never hold strings, floats or structured data; that restriction keeps evaluation trivial and the read path allocation-free.

Every knob name has exactly two parts separated by one colon:

checkout:killswitch_new_path
└──┬───┘ └────────┬────────┘
knobset local name

Both parts use letters, digits, ., _, / and -, and the whole name is at most 200 bytes. The left part groups related knobs, usually by service or team. See Knobs and Names for the exact rules.

A definition describes how to evaluate a knob: a default plus two optional refinements, per-group overrides and a rollout percentage. A percentage comes with a rollout_value, the value callers inside it get.

{ "default": 25 }
{ "default": 0, "overrides": { "employees": 1, "beta": { "rollout_pct": 50 } },
"rollout_pct": 10, "rollout_value": 1 }

A definition is atomic. Publishing a knob always replaces its whole definition; there is no field-by-field merge.

A snapshot is a complete, immutable, validated map from knob names to definitions, stamped with a version number. The agent publishes each accepted snapshot as a new immutable generation on disk, and a reader switches to it on its next lookup, so no reader ever observes a half-applied change.

Every published snapshot carries a positive integer version, and each namespace’s generation carries its revision. A reader refuses a revision that goes backwards, so reordered, repeated or replayed updates are harmless.

Every read passes its own fallback: the value the caller gets when the knob can’t be read. There is no defaults file; the safe value lives next to the code that reads the knob.

A source is where live snapshots come from. Readers have one: the managed agent’s store directory, where detent-agent publishes durable immutable generations delivered from an authenticated authority. A reader opens the store with the uid the agent runs as and maps the generations read-only.

The durable authority, detent-authority --authority, is the server that publishers write to. It authenticates each publisher, applies atomic, per-namespace transactions, commits them through durable Raft consensus, and delivers the result to managed agents.

The agent, detent-agent, is a host-local daemon that receives authenticated deliveries from the authority and publishes immutable generations on disk. Shell scripts and programs in any language read knobs from them with detent get without talking to the network or to the daemon.

A group override lives in a knob’s definition and applies when the caller passes a matching group, the switch_value. It is published like any other part of a definition.