agentleFS
bolivian-perubolivian-peru/os-moda/skills/predictive-resources/SKILL.md

predictive-resources

Skill118 starsChanged 6 months agoApache-2.0View on GitHub

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

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't wait for things to break.

    line 20
  2. Distinctive:

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

    line 24
  3. Distinctive:

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

    line 51
  4. Distinctive:

    Don't kill processes without permission.

    line 81
  5. Distinctive:

    After each alert, remember what the user chose:

    line 90
  6. Distinctive:

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

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

MetricWarningCriticalAction
Disk fills in < 7 daysAlert userAuto-cleannix-collect-garbage, logrotate
Memory avg > 80% for 1hrAlert userOOM riskIdentify top consumers
Swap usage growingMonitor> 50% usedRecommend more RAM or optimize
/nix/store > 30GBSuggest cleanup> 50GBAuto-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.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.