# Ephemeral State In Tmp

> Use when about to write a state, cursor, marker, scratch, or progress file for a cron loop, monitor task, polling job, recurring schedule, or any session-scoped/ephemeral data — directs the file to /tmp/<name>.json instead of ~/.claude/ or other config dirs.

- Skill: `amitkot/ephemeral-state-in-tmp` (Agent Skill)
- Install (CLI): `npx skillmds@latest add amitkot/ephemeral-state-in-tmp`
- Raw SKILL.md: https://api.skillmd.com/api/skills/amitkot/ephemeral-state-in-tmp/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: amitkot (https://skillmd.com/u/amitkot)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/amitkot/ephemeral-state-in-tmp

---


# 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`.

