Drift between convergences
Where the engine watches a workspace between convergences, a signal, a hint that an object changed outside Turf (a sweep’s read), is read and classified. What holds up becomes a drift notice: one entry per address, with its class, the changed attribute paths (never values), the source, and when it was first seen. An observation is not yet drift, and a notice is not yet a plan: only a round’s plan says what would change. status shows a workspace’s open notices under drift, its coverage line ending with the settings that explain them (settle, the sweep’s cycle or sweep off, and confirm off, under which every notice stays unconfirmed); watch waits for new ones. A sweep behind its cycle ends the line saying what limits it: the read budget’s rate, or the pacing (a swept batch reads only the tokens above the budget’s reserve, half the burst, one batch at a time). A longer cycle (drift with a larger sweep) fixes either; so does a higher rate for the first and a larger burst for the second, which are the engine operator’s settings (TURF_DRIFT_READ_RATE, TURF_DRIFT_READ_BURST), not a tool’s.
The loop
Section titled “The loop”watch({ workspace_alias }) → outcome: drift, drift: { counts, notices, coverage, note }, cursor, next: upup({ workspace_alias }) → awaiting_plan (the note says when notices are open)plan({ convergence_id, refresh_drift: true }) → awaiting_approval, refresh_scope: { addresses, count, from_drift, skipped }apply({ convergence_id, plan_digest }) → converged (the notices it committed clear)watch({ workspace_alias, cursor }) → waits for what is new since- The
upthat reverts drift is an ordinary one: nothing marks it. At its plan gate,planwithrefresh_drift: truereads only what drifted (below);nextis the whole plan, which reads everything. When notices are open, round 1’s plan gate note says so. The engine records which run cleared each notice. watchreturns when there is something new to act on: an open notice whose address, class and paths thecursorhas not reported. With no cursor, anything open is new and it returns at once: a catch-up, whose note says when the notices were already open before the call.cursor: "now"takes what is open as the call begins as reported and waits only for what opens after: use it when you have just readstatusand want only what comes next. A notice clearing wakes nobody, except past 256 open entries, where the cursor is approximate (the note says so) and a clearing can wake it. Pass the cursor exactly as the last result had it.- At the server’s deadline it returns
outcome: "waiting"with a new cursor, andnextis the same watch: call it again. Each such return costs you a turn and says nothing new; do not report it to the user. for(seconds) bounds the whole watch, across calls: past it with nothing new,outcome: "quiet",ended: true.outcome: "unwatched"means nothing watches the workspace, and its note says which: no state yet, an engine without drift detection, detection never turned on, or detection turned off (and when; a feed connected meanwhile is named, and reports nothing while it is off). Watch would never wake, so do not call it again there. It has nonext:watchonly observes. Tell the user; if they want detection, turn it on (below). Anup’s plan reads every object and is the drift report.wake_on: "confirmed"(the default) wakes on every class butunconfirmed, which the engine’s confirm settles, unless nothing will confirm it (no standing seal, or confirm turned off): then it wakes too.wake_on: "any"wakes on every class.
Turning drift on
Section titled “Turning drift on”drift({ workspace_alias, enabled: true, sweep: 86400 }) → configured, settings: { settle, sweep }, next: watchdrift({ workspace_alias, settle: 30 }) → stored while detection is off: no next, the note gives the call that enablesdrift({ workspace_alias, enabled: false }) → disabled: detection off, any open notices closed, settings standup({ workspace_alias, drift: { sweep: 86400 } }) → every result: drift: { sweep, state: "pending" }; at its end state: "enabled", "kept_off", "failed" or "not_applied"Drift detection is off until enabled, and turning it on or off is the user’s choice either way: call drift only on their words, or on their yes to an offer, never on your own. drift is the control: enabled turns detection on or off, and it changes the settings it names, the rest standing: settle (seconds an object marked as changed must be quiet before it is read; the sweep’s own reads do not wait for it; 0 takes the engine’s 30), sweep (seconds for one cycle over every managed object; 0 turns it off), confirm (false: no confirming read, so every notice stays unconfirmed and the sweep, which is that read on a cycle, does not run). Settings named while detection is off are stored, and take effect when it is turned on. enabled: false stands alone; settings stand while it is off, and turned on again the engine takes up what it had reported: each address is read again and its notice reopens if the change still stands (with confirm off, or no seal, it reopens unconfirmed, unread).
The sweep reads every managed object unattended against the provider’s API with the engine’s credentials. An unattended read also launches with the provider environment of the last converged up, which the engine keeps with the standing seal (references/credentials.md). The sweep is how the engine finds a change between runs, so one cycle a day (sweep: 86400) is the usual cadence; go shorter only when the user asks. Detection needs more than being on: the sweep for signals, and a standing seal for confirm (the engine takes it from the last converged round). When the user wants detection, turn it on with a sweep: drift({ workspace_alias, enabled: true, sweep: 86400 }); enabled: true alone turns it on with the sweep cycle already stored, when the settings a drift result shows hold one: do not overwrite a cycle the user chose. The result’s note says what is still missing.
When the user has asked for detection on a first deploy, where there is no state for drift to watch yet, pass their settings to the up as drift: { … } (the same settings, in the same units, e.g. drift: { sweep: 86400 }), and detection turns on when that run converges (where detection is already on, the run’s end applies the settings and says enabled). Every result of it carries drift with state: "pending", and its end says what came of it: enabled (call watch, unless the note says nothing signals a change), kept_off, failed (with error), or not_applied (the run did not converge, or a cancel was accepted on it before it did; a continuing up in next carries the ask unless detection was turned off in the meantime, and the note says when it does not; never add drift to a continuation yourself). A later drift({ enabled: false }), even before the run applies anything, wins over the pending up: it ends kept_off. up alone takes drift, never with plan_only. drift, and up with drift, are the full tier’s only.
Long watches
Section titled “Long watches”Each waiting return costs a turn: 3600/55 ≈ 65 turns an hour at the default 55 s deadline, 2 at 30 min. The waiting note says how long one call waits on this server; a call that carries a progress token gets a progress notification every 15 s while it waits, which keeps a client that resets its timeout on progress from giving up. The deadline is the operator’s, not a call’s: for a client that allows long tool calls, start the server with --watch-deadline 30m (or TURF_WATCH_DEADLINE=30m), under the client’s limit (Claude Code: MCP_TOOL_TIMEOUT, in milliseconds).
quiet_for
Section titled “quiet_for”quiet_for (seconds) holds new drift back until the open notices have been still that long: no new signal, no new read, by the engine’s clock. Use it when someone may be mid-change (an operator editing by hand: reverting under them starts a fight), or when changes come in bursts (a rollout touching many objects), so you plan once for the whole of it.
A scoped plan
Section titled “A scoped plan”plan({ convergence_id, refresh_drift: true }) reads only what the workspace’s open notices name, filled in by the server as the round plans, so anything that drifted since you looked is included. Every other row plans from its record, and one that then plans a change is read and planned again. refresh_addresses names addresses yourself (with refresh_drift, the union). The result’s refresh_scope says what was read, and skipped how many rows planned from their records unread (drift on them was not looked for; the round’s refresh_skipped is the same count). A scoped plan reads only what was signalled or swept: objects the coverage counts uncovered are not read, and the result says so. plan({ convergence_id }) with neither reads everything; use it when the coverage has gaps or a notice says signals were dropped. With nothing open, refresh_drift reads everything.
What each class asks
Section titled “What each class asks”gone(deleted outside Turf):upplans it back as a create; or, if the user means it gone, remove it from the configuration.configured(a setting the configuration makes was changed):upplans it back; or change the files to keep the change (ask: the files are the user’s), thenup.referenced(a computed value the configuration reads changed):upplans what depends on it.contended(another controller sets these paths again after every apply): anotherupwill not hold. The remedy islifecycle { ignore_changes = [...] }on those paths, or stopping the other controller: the user’s call. There is nonext.unconfirmed(nothing has read the object yet):upreads and plans it.uncovered(the engine cannot read the object between convergences):upreads and plans it.
Approving
Section titled “Approving”The rules do not change because the plan came from drift. An in-place update that reverts a setting to what the files say is low risk: approve it yourself. A replace, a delete, a create of something that held data, or a contended path goes to the user. While a convergence holds the workspace there is no next: finish or cancel it first. At a tier without up (read, apply) there is none either: report the drift; the up starts from the plan or full tier. A notice clears itself when a round commits the address or a later read finds the object as recorded.
Turf™ is a trademark of Turf LLC. Terraform® is a trademark of HashiCorp. Ansible® is a trademark of Red Hat, LLC, registered in the United States and other countries. Helm®, Kubernetes®, Prometheus® and OpenTelemetry® are registered trademarks, and Jaeger™ is a trademark, of the Linux Foundation. OpenTofu® and Model Context Protocol® are registered trademarks of LF Projects, LLC. All other trademarks are the property of their respective owners. Turf is not affiliated with, endorsed by, or sponsored by HashiCorp, IBM, Red Hat, the Linux Foundation, LF Projects or the OpenTofu project.
© 2026 Turf LLC. Free for individuals, education and small businesses within the Community limits, under the Turf Community Edition License 1.0. Government and larger organizations need a commerciallicense.turf.build · Discord ·GitHub