I Taught a Sloth to Write Its Own Chores (Then Put It in a Cage)
Описание и применение
Слоты – локальный инструмент, использующий LLM для генерации скриптов, которые сортируют файлы в папке Downloads по типу или содержимому, показывая план действий и позволяя отменить изменения.
Задача
Managing a cluttered Downloads folder with many unrelated files is tedious and error‑prone.
Результат
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.
Рабочий процесс
- 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
yto apply the plan or any other key to cancel. - 6. Each applied run is added to an undo stack;
python sloth.py --undorestores the original state.
Доказательства
Sloth is a single Python file that does file chores from one sentence.
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.
Every applied run goes on an undo stack. --undo reverses it.
Everything runs locally through Ollama. No cloud, no API key, no per-run cost.
The cage is guardrails, not a fortress: RestrictedPython, a home-folder lock, blocked file-writing methods, and the fact that the script only plans.
- Дата записи: 2026-10-25T16:26:15.338Z