Scheduled tasks (routines) freeze cwd at creation time, with no way to update or migrate it
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
- Create a scheduled task while in
/path/A - Move the project to
/path/B(so/path/Ano longer exists, e.g. viamvor because you migrated out of OneDrive) - Routine fires on schedule →
lastRunAtupdates → sidebar shows green - 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
notifySessionif that session has moved - Routine errors visibly when its cwd no longer exists (red badge in sidebar, not silent green)
update_scheduled_taskMCP tool exposes acwdfield so it can be migrated in place- A
delete_scheduled_taskMCP 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.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗