Skip to content
Agent Orchestration
Skill

/predictive-resources

Predict resource exhaustion (disk, memory, swap) using trend analysis. Proactively alert and propose NixOS config fixes before things break.

BOOST
From plugin
os-moda
11920 skills1 agent
Install
$ npx -y skills add bolivian-peru/os-moda --skill predictive-resources --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/predictive-resources

Context preview

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

Predict resource exhaustion (disk, memory, swap) using trend analysis. Proactively alert and propose NixOS config fixes before things break.

SKILL.md

predictive-resources.SKILL.md
name: predictive-resources
description: >
  Predict resource exhaustion (disk, memory, swap) using trend analysis.
  Proactively alert and propose NixOS config fixes before things break.
tools:
  - system_health
  - shell_exec
  - memory_store
  - memory_recall
  - file_read
  - file_write
  - teach_patterns
  - teach_observations
activation: auto

Predictive Resource Exhaustion

Don't wait for things to break. Predict when they will and fix proactively.

teachd Trend Data

Before collecting your own data points, check teachd — it has been observing CPU, memory, and services every 30 seconds since boot:

teach_patterns({ type: "trend", min_confidence: 0.3 })
teach_observations({ source: "memory", limit: 100 })

teachd automatically detects monotonic memory increases over 6+ data points. If it has already flagged a trend, use that instead of re-deriving manually.

Disk Growth Analysis

Collect data points over time and project forward:

shell_exec({ command: "df -h --output=target,used,avail,pcent / /var /nix/store /tmp 2>/dev/null || df -h" })

Track in memory — store periodic snapshots:

memory_store({
  summary: "Disk snapshot: / 38% used, /nix/store 12GB",
  detail: "Full df output...",
  category: "system.config",
  tags: "disk,snapshot,predictive"
})

When you have 2+ data points, calculate growth rate:

  • Growth per day = (current_used - previous_used) / days_between
  • Days until 95% = (capacity * 0.95 - current_used) / growth_per_day

Thresholds & Alerts

| Metric | Warning | Critical | Action | |--------|---------|----------|--------| | Disk fills in < 7 days | Alert user | Auto-clean | `nix-collect-garbage`, logrotate | | Memory avg > 80% for 1hr | Alert user | OOM risk | Identify top consumers | | Swap usage growing | Monitor | > 50% used | Recommend more RAM or optimize | | /nix/store > 30GB | Suggest cleanup | > 50GB | Auto-GC old generations |

Remediation (NixOS-native)

Disk: Nix garbage collection

shell_exec({ command: "nix-collect-garbage --delete-older-than 14d" })

Disk: Log rotation via NixOS config

Propose adding to configuration.nix:

services.journald.extraConfig = "SystemMaxUse=500M";

Memory: Identify and advise

shell_exec({ command: "ps aux --sort=-%mem | head -15" })

Don't kill processes without permission. Advise the user.

Swap: NixOS swap config

swapDevices = [{ device = "/swapfile"; size = 4096; }];

User Preference Learning

After each alert, remember what the user chose:

memory_store({
  summary: "User prefers automatic log cleanup when disk > 80%",
  detail: "Approved automatic journalctl vacuum and nix-collect-garbage",
  category: "user_pattern",
  tags: "preference,disk,auto-remediation"
})

Next time, check memory before asking:

memory_recall({ query: "user preference disk cleanup auto" })

If they previously approved auto-remediation, do it and just notify.

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.