Scheduled tasks (routines) freeze cwd at creation time, with no way to update or migrate it

Resolved 💬 4 comments Opened Apr 27, 2026 by MaximilianWorthZeroMillion Closed Apr 30, 2026

Environment

  • Claude Code on macOS (Darwin 25.4.0)
  • Routines stored in ~/Library/Application Support/Claude/claude-code-sessions/<session-id>/scheduled-tasks.json

Repro

  1. Create a scheduled task while in /path/A
  2. Move the project to /path/B (so /path/A no longer exists, e.g. via mv or because you migrated out of OneDrive)
  3. Routine fires on schedule → lastRunAt updates → sidebar shows green
  4. But the spawned session has cwd: /path/A, which is gone, so the run can't actually do useful work

Observed

Three of my four routines silently failed to do real work for 3+ days after I migrated my project from ~/Library/CloudStorage/OneDrive-Persönlich/Claude/OneDrive/ to ~/Code/nibler/. The sidebar showed all of them as running successfully (lastRunAt updated each cron tick). Only the routine I created after the migration worked — because it picked up the new cwd at creation time.

Inspecting scheduled-tasks.json confirmed three routines had a stale cwd field pointing at the now-archived OneDrive path, while the fourth (created post-migration) had the correct one.

Expected — at least one of:

  • Routine inherits cwd from its notifySession if that session has moved
  • Routine errors visibly when its cwd no longer exists (red badge in sidebar, not silent green)
  • update_scheduled_task MCP tool exposes a cwd field so it can be migrated in place
  • A delete_scheduled_task MCP tool so a stale routine can be cleanly recreated

Workaround

Manually edit cwd in the scheduled-tasks.json storage file. Risky because Claude Code may cache the file and overwrite the edit on the next scheduler write — likely requires a Claude Code restart to take effect cleanly.

Severity

Silent data-pipeline failure. The sidebar lies — it shows green/healthy while no actual work is being done. For automation-heavy users this can sit broken for weeks before being noticed. The fact that nothing in the UI surfaces "your cwd no longer exists" is the dangerous part — a red error would make this a non-issue.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗