ephemeral-state-in-tmplisted
Install: claude install-skill amitkot/claude-code-tools
# Session-only state files belong in /tmp
When you need to write a state file whose lifetime equals or is shorter than the current session, cron job, or monitor task — write it under `/tmp/`, not `~/.claude/` or any other config dir.
## Why
The session/cron/task dies or expires; whatever you wrote stays. A file in `/tmp` self-cleans on reboot and matches the lifetime correctly. A file in `~/.claude/` becomes orphan state cluttering the user's settings dir with no automatic cleanup, and the user has to find and delete it manually.
## Examples
- Cron-loop cursor tracking the last observed run id → `/tmp/<feature>-state.json`, not `~/.claude/.<feature>-state.json`
- Monitor scratch tracker → `/tmp/<task>-progress.json`
- Polling-state file read/written by a recurring task → `/tmp/poll-cursor.json`
## When `~/.claude/` IS right
Only for state that should survive across sessions: durable preferences, memory entries indexed via `MEMORY.md`, settings that persist beyond the lifetime of any single task. If the file is read by a session-only cron, it's not durable — it goes in `/tmp`.