tidy
npx machina-cli add skill HartBrook/lookagain/tidy --openclawTidy Old Review Runs
You are cleaning up old review results from .lookagain/.
Parse arguments
The user may pass key=value pairs after the command name. The raw argument string is:
$ARGUMENTS
If the argument string is empty or blank, the user provided no overrides — use all defaults. Parse key=value pairs from the string. For any key not provided, use the default.
| Key | Default | Description |
|---|---|---|
keep | 1 | Keep runs from the last N days |
all | false | Remove all runs including today's (true or false) |
Process
-
Use Glob to list all directories under
.lookagain/matching the pattern.lookagain/????-??-??T??-??-??/. -
If no run directories exist, tell the user there's nothing to tidy and stop.
-
Determine which runs to remove:
- If the resolved
allvalue istrue, remove ALL run directories. - Otherwise, calculate the cutoff date by subtracting the resolved
keepvalue (in days) from today's date. Remove only run directories whose date portion (theYYYY-MM-DDprefix of the directory name) is strictly before the cutoff date.
- If the resolved
-
Before deleting, validate each directory name matches the exact pattern
YYYY-MM-DDTHH-MM-SS(all digits in the right positions). Skip any directory that doesn't match. -
For each validated run directory to remove, use Bash to delete it:
rm -rf .lookagain/<run-id> -
Report what was done:
## Tidy Complete
Removed N run(s): <list of run-ids removed>
Kept M run(s): <list of run-ids kept>
If nothing was removed, say so:
## Nothing to Tidy
All N run(s) are within the keep window.
Source
git clone https://github.com/HartBrook/lookagain/blob/main/src/skills/tidy/SKILL.mdView on GitHub Overview
Removes outdated lookagain review runs from .lookagain/ while preserving today’s results by default. It respects key=value overrides (keep and all) to determine which runs to delete and validates directory names before deletion to prevent accidental loss.
How This Skill Works
Parses optional key=value arguments after the command and uses Glob to list directories under .lookagain/ matching the pattern YYYY-MM-DDTHH-MM-SS. It validates each directory name against the exact pattern and, if all=true, deletes every run; otherwise it computes a cutoff date (today minus keep days) and removes only those with dates before the cutoff. Deletions are performed with rm -rf, and a final report lists removed and kept run IDs.
When to Use It
- Purge older lookagain runs while preserving today’s results.
- Keep a rolling window by setting keep to N days (default 1).
- Delete all runs, including today, with all=true.
- Ensure only properly named directories are deleted by relying on the exact YYYY-MM-DDTHH-MM-SS pattern.
- Gracefully handle missing or empty .lookagain by reporting Nothing to Tidy.
Quick Start
- Step 1: Run tidy with defaults (tidy) to see what will be kept.
- Step 2: Optionally adjust the window (e.g., tidy keep=7) or delete all (tidy all=true).
- Step 3: Review the final report (## Tidy Complete or ## Nothing to Tidy) to confirm what was removed and kept.
Best Practices
- Validate that there are matching run directories before deleting.
- Rely on the validation step to skip nonmatching folders.
- Be aware of the defaults: keep=1 and all=false.
- Review the final Tidy Complete report to confirm what was removed and kept.
- Use a safe test environment if uncertain about deletions.
Example Use Cases
- tidy keeps only today (default keep=1) and deletes older runs.
- tidy keep=7 removes runs older than 7 days, keeping the last 7 days.
- tidy all=true deletes all lookagain runs, including today.
- tidy keep=0 keeps only today’s results by deleting any earlier runs.
- If the .lookagain folder contains stray or nonmatching directories, tidy skips them and deletes only validated ones.