Imported from TheHappyHermit/Autognosia (
skills/cron-script-permanent/SKILL.md). Install upstream withnpx skills add TheHappyHermit/Autognosia --skill cron-script-permanent. Copyright stays with the author.
Cron Script Management
Use when creating or maintaining Hermes cron jobs that execute scripts. This covers both local cron jobs (~/.hermes/scripts/) and repo scripts (autognosia-repo/scripts/).
The Problem with Transient Scripts
Cron jobs that generate scripts at runtime (e.g., /tmp/hermes-verify-graphify-integrity.py) waste tokens and create stale artifacts:
- Each cron tick regenerates the script from scratch in the agent's prompt
- Temp files accumulate in
/tmp/and are rarely cleaned up - No version history or review capability
- Script logic is invisible until the cron job runs
The Right Way
-
Write the script to a permanent location:
- Local scripts:
~/.hermes/scripts/<name>.py - Repo scripts:
<repo>/scripts/<name>.py
- Local scripts:
-
Update the cron job to reference the permanent script:
# Update the cron job definition job['prompt'] = f"Run the verification script: python3 /home/home_user/.hermes/scripts/{name}.py" -
Test the script manually before relying on it:
python3 /home/home_user/.hermes/scripts/<name>.py 2>&1 -
Clean up any temp files from previous transient runs:
rm -f /tmp/hermes-verify-*.py /tmp/check_*.py /tmp/update_cron*.py -
Commit repo scripts and push, so the script is versioned and reviewed.
Pitfalls
- Cron jobs may error before the script is installed. If a cron job references a script that doesn't exist in
~/.hermes/scripts/, it fails silently. Always checklast_statusafter updating. - Heredoc quoting in execute_code is fragile. Use
write_file()instead of inline heredocs when creating scripts. Heredocs often fail due to Python string escaping issues. - Don't leave temp files. After converting a transient script to a permanent one, delete any
/tmp/remnants.
Workflow
- Identify the cron job creating transient scripts (check
~/.hermes/cron/output/for recent runs) - Extract the script logic from the cron job's prompt or temp files
- Write it as a permanent script
- Update the cron job definition
- Test manually
- Clean up temp files
- Commit to repo if appropriate
Related
- See
references/cron-verify-stack.mdfor the verify_stack.py pattern.