How drift works
When a push arrives on a tracked branch, the API matches changed files against all workspace topics using glob pattern intersection. Any topic whose anchored patterns overlap with the changed files gets marked drifted with a human-readable reason. For example, if a push tomain changes src/auth/guard.ts and src/auth/service.ts, the auth-flow topic anchored to src/auth/** becomes:
Drifted: 3 files changed in commitabc1234:src/auth/guard.ts,src/auth/service.ts,src/auth/dto/login.dto.ts
Tracked branches
The default branch is always tracked. Additional branches can be added:Second drift source: local git (no GitHub App)
Drift normally comes from push webhooks, so a team without the GitHub App installed gets no signal. To close that gap, the CLI can report drift from your local checkout:--mark is opt-in and explicit. Plain --diff only displays, so work-in-progress never flips team state unless you ask. It’s idempotent (already-drifted topics are left alone).
A nudge, not an alarm
Drift is a nudge, not an error: “the code under this topic moved, worth a look.” It tolerates false positives by design: trust the code, and only update the topic if the change actually altered how the area works. A deleted anchor file produces a distinct nudge: “anchored file deleted: re-anchor or archive this topic.”Lifecycle
driftless syncsurfaces it to every team member- An agent or human reviews the change
- If the context still holds, add it to knowledge (
--status reviewed) to make it fresh again - If no repo claims the topic anymore, it becomes orphaned
Checking for drift
What triggers drift?
What triggers drift?
Only pushes to tracked branches. PRs do not trigger drift; they trigger PR observation instead (the match is recorded, and the Auditor, if configured, reviews and comments only when it has a finding). This distinction keeps drift meaningful: a push to
main or staging means the code has actually changed, while a PR is still under review and may not merge.Can I manually mark a topic as drifted?
Can I manually mark a topic as drifted?
Yes. Run
driftless context update <slug> --status draft to mark it for review, or update the content and set --status reviewed to clear drift. You can also let the next push naturally trigger a drift check.What happens if a topic's anchored files are deleted?
What happens if a topic's anchored files are deleted?
The topic becomes drifted on the next push. If the glob patterns no longer match any file in the repo,
context doctor flags it as a zombie, an anchor pointing at nothing. Fix the patterns or archive the topic.