Skip to content

croakingtoad/slash-cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

slash-cron

A /cron command for Claude Code that gives you a persistent, cross-session view of all scheduled cron jobs — including jobs created in other sessions and other directories. Also shows your system crontab alongside Claude Code jobs with /cron all.

The problem

Claude Code's /loop command is great for scheduling recurring work. But once you create a few jobs across different projects and sessions, you have no idea what's running. There's no built-in way to list them across sessions, no memory of what was scheduled after a session ends, and no way to modify a job without hunting down its ID.

/cron fixes all of that. And /cron all gives you the full picture — Claude Code jobs and system crontab entries in one view.

What it looks like

/cron — Claude Code jobs

Claude Code Jobs
──────────────────────────────────────────────────────────────────────────
#   ID        Schedule        Type        Repo / Prompt
──  ────────  ──────────────  ──────────  ──────────────────────────────────
1 🟢 a1b2c3  */5 * * * *     recurring   ~/repos/mission-control
                                           Check open PRs and post a summary
2 🟢 d4e5f6  */15 * * * *    recurring   ~/repos/deploy-bot
                                           Run smoke tests and alert on failure
3 🟡 789abc  0 9 * * 1-5     recurring   ~/repos/standup-helper
                                           Draft today's standup from git log
4 🔴 345678  0 0 * * *       one-shot    ~/repos/invoice-tool
                                           Generate and send monthly invoice
──────────────────────────────────────────────────────────────────────────
🟢 live · this session   🟡 unknown · may be active in another session   🔴 expired

/cron all — Claude Code jobs + system crontab

Same Claude Code jobs table as above, plus:

System Crontab
──────────────────────────────────────────────────────────────────────────
#   Schedule        Command
──  ──────────────  ──────────────────────────────────────────────────────
C1  0 9 * * 1       /usr/local/bin/claude -p "Run weekly status sweep"...
C2  */30 * * * *    /usr/local/bin/claude -p "Check build status and a...
──────────────────────────────────────────────────────────────────────────

Status dots (Claude Code jobs only):

  • 🟢 live — confirmed running in the current session
  • 🟡 unknown — not in current session, created < 3 days ago (may be active in another session)
  • 🔴 expired — not in current session, created > 3 days ago (past Claude Code's 3-day auto-expire window, definitely dead)

How it works

A PostToolUse hook intercepts every CronCreate, CronDelete, and CronList call and updates a local JSON registry at ~/.claude/cron-registry.json.

  • CronCreate → writes an entry with job ID, schedule, prompt, working directory, and session ID
  • CronDelete → removes the matching entry
  • CronList → auto-prunes any current-session entries that are no longer live (expired or deleted)

The /cron command reads both the live session state and the registry, merges them, and computes the status dot for each job based on age and presence in the live list. With all, it also reads crontab -l and appends system entries as a separate section.

Installation

1. Copy the hook script

mkdir -p ~/.claude/scripts
curl -o ~/.claude/scripts/cron-registry.py \
  https://raw.githubusercontent.com/croakingtoad/slash-cron/main/cron-registry.py
chmod +x ~/.claude/scripts/cron-registry.py

2. Copy the command

mkdir -p ~/.claude/commands
curl -o ~/.claude/commands/cron.md \
  https://raw.githubusercontent.com/croakingtoad/slash-cron/main/cron.md

3. Register the hook in ~/.claude/settings.json

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Cron(Create|Delete|List)",
        "hooks": [
          {
            "type": "command",
            "command": "python3 ~/.claude/scripts/cron-registry.py"
          }
        ]
      }
    ]
  }
}

If you already have a hooks.PostToolUse array, add the new entry alongside your existing ones.

That's it. The hook fires automatically from now on — no restart needed.

Usage

/cron

Shows Claude Code jobs only. Type an action when prompted:

  • terminate 1 — cancel job #1 (live jobs only)
  • update 2 — change job #2's prompt, keep its schedule
  • reschedule 3 — change job #3's schedule in plain English ("every hour") or cron syntax
  • replace 4 — change both prompt and schedule
  • cleanup — remove all 🔴 expired entries from the registry
  • done — exit without changes
/cron all

Shows Claude Code jobs AND system crontab entries. Additional actions:

  • remove crontab C1 — remove a system crontab entry (confirms before making changes)
  • edit crontab — open crontab -e to edit manually

Note: terminate, update, reschedule, and replace only apply to Claude Code jobs (#). System crontab entries (C#) can only be removed or edited via the crontab actions.

Registry

~/.claude/cron-registry.json is plain JSON — inspect or edit it directly if needed:

{
  "jobs": [
    {
      "id": "a1b2c3d4",
      "cron": "*/5 * * * *",
      "prompt": "Check open PRs and post a summary",
      "recurring": true,
      "created_at": "2026-03-16T09:00:00+00:00",
      "session_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "cwd": "/home/alice/repos/mission-control"
    }
  ]
}

Requirements

Notes

  • Claude Code cron jobs are session-only by design — they live in memory and are gone when the session ends. This tool tracks them persistently, but cannot revive them after a session closes.
  • Recurring jobs auto-expire after 3 days — this is a Claude Code platform limit.
  • Jobs created before installing this hook won't appear in the registry (the hook only fires on future calls).
  • The hook runs silently in the background and never blocks your workflow.

Contributors

License

MIT

About

Claude Code slash command (/cron) shows all active in-memory cron jobs running in Claude Code (even outside of the working directory you're in!). Uses hooks and a simple registry to keep track of what's running, and allows you to manage the crons easily.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages