Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I Taught a Sloth to Write Its Own Chores (Then Put It in a Cage)

Description and use

Sloth is a local tool that uses an LLM to generate scripts that sort files in the Downloads folder by type or content, showing a preview plan and allowing undo.

Problem

Managing a cluttered Downloads folder with many unrelated files is tedious and error‑prone.

Outcome

Sloth automated sorting of a cluttered Downloads folder using a local LLM, sandboxed script execution, and offline file reading, achieving a clean folder structure with undo capability.

Workflow

  • 1. Run python sloth.py "sort everything in Downloads by file type"
  • 2. A local Ollama model generates a short Python script using helper functions.
  • 3. The script runs in a RestrictedPython cage and records intended actions without touching the disk.
  • 4. Sloth displays a preview table of planned moves.
  • 5. Press y to apply the plan or any other key to cancel.
  • 6. Each applied run is added to an undo stack; python sloth.py --undo restores the original state.

Evidence

Sloth is a single Python file that does file chores from one sentence.

Source

The model's script never touches the disk. It can only call a few helpers (sloth.ls, sloth.move, sloth.match, sloth.read) that record what it wants to do.

Source

Every applied run goes on an undo stack. --undo reverses it.

Source

Everything runs locally through Ollama. No cloud, no API key, no per-run cost.

Source

The cage is guardrails, not a fortress: RestrictedPython, a home-folder lock, blocked file-writing methods, and the fact that the script only plans.

Source

  • Record date: 2026-10-25T16:26:15.338Z