Skip to content
Agent Orchestration
Skill

/drift-detection

Detect configuration drift — manual changes that exist outside NixOS management. Offer to bring imperative changes into declarative config.

BOOST
From plugin
os-moda
11920 skills1 agent
Install
$ npx -y skills add bolivian-peru/os-moda --skill drift-detection --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/drift-detection

Context preview

The summary Claude sees to decide when to auto-load this skill.

Detect configuration drift — manual changes that exist outside NixOS management. Offer to bring imperative changes into declarative config.

SKILL.md

drift-detection.SKILL.md
name: drift-detection
description: >
  Detect configuration drift — manual changes that exist outside NixOS management.
  Offer to bring imperative changes into declarative config.
tools:
  - shell_exec
  - file_read
  - file_write
  - memory_store
  - memory_recall
activation: auto

Configuration Drift Detection

NixOS is declarative — the config should be the single source of truth. But reality drifts: manual edits, imperative installs, ad-hoc cron jobs. Detect and reconcile.

Checks

1. Imperatively installed packages

shell_exec({ command: "nix-env -q 2>/dev/null || echo 'none'" })

If packages found: offer to add them to `environment.systemPackages` in NixOS config.

2. Manual files outside NixOS

shell_exec({ command: "find /etc -newer /etc/NIXOS -not -path '/etc/nixos/*' -not -path '/etc/resolv.conf' -type f 2>/dev/null | head -20" })

Files modified after last NixOS rebuild may be manual edits.

3. Manual cron jobs

shell_exec({ command: "ls /etc/cron.d/ /var/spool/cron/crontabs/ 2>/dev/null" })

Offer to convert to systemd timers in NixOS config.

4. Stale NixOS generations

shell_exec({ command: "nixos-rebuild list-generations 2>/dev/null | wc -l" })

More than 20 generations → suggest cleanup.

5. Orphaned systemd units

shell_exec({ command: "systemctl list-units --state=failed --no-pager" })

Remediation

For each drift finding, offer to bring it into NixOS:

Drift Report:

⚠️ 3 packages installed via nix-env: htop, ncdu, tree
   → Add to environment.systemPackages? [Y/n]

⚠️ /etc/cron.d/backup exists outside NixOS
   → Convert to systemd timer in NixOS config? [Y/n]

⚠️ 47 old NixOS generations (using 18GB)
   → Keep current + last 5, remove rest? [Y/n]

✅ No unauthorized file changes in /etc/nixos/
✅ All systemd services match NixOS config

Why This Matters

On Ubuntu, configuration drift is invisible and irreversible. On NixOS with osModa, you can: 1. **Detect** that something was changed manually 2. **Reconcile** by adding it to the declarative config 3. **Prove** with the audit ledger that nothing unauthorized happened 4. **Reproduce** the exact system state on new hardware

This is useful supporting evidence for compliance programs (SOC 2, etc.) — though not by itself proof of regulatory readiness.

Read more
Ships withos-moda

An operating system built for AI agents — talk to your NixOS server instead of SSH-ing in. Typed, audited tool access with atomic rollback on every change. Research-grade; run it on a disposable box, not production.

Get the whole plugin

Other skills on os-moda.