anthropics / anthropics/claude-code

Scratchpad directory under /tmp is erased on reboot (systemd-tmpfiles); system prompt gives no volatility warning — a full day of pipeline output lost

未关闭
#92,166 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area:core bug data-loss platform:linux
主要语言
Python
星标
145k
派生
23.1k
PR 合并指标
PR 指标待抓取

描述

## Summary

The system prompt tells the model to use a session-specific scratchpad directory for **all** temporary files, and that directory lives under `/tmp`. On a standard Debian/Ubuntu-style system `systemd-tmpfiles` ships `D /tmp 1777 root root 30d`, which **erases `/tmp` on every boot**. Nothing in the system prompt or the docs warns that the scratchpad is volatile across reboots.

In a long-running session (data-generation pipeline for an LLM fine-tuning dataset, ~24 h of wall-clock work, tens of thousands of API calls across several paid providers), the host rebooted and the entire scratchpad was gone: all generated data, all review verdicts, all pipeline scripts, the Python venv, and every background job launched from it. Nothing was recoverable from inside the container.

## Environment

- Claude Code 2.1.260, Linux (LXC container, Proxmox host), bash
- Scratchpad path pattern: `/tmp/claude-0///scratchpad`
- `/usr/lib/tmpfiles.d/tmp.conf`: `D /tmp 1777 root root 30d`

## Steps to reproduce

1. Start a session; follow the system prompt's instruction to keep all working files in the scratchpad directory.
2. Run a multi-hour pipeline that writes its outputs there (and launches background workers with `setsid nohup`).
3. Reboot the host.
4. The scratchpad directory is recreated empty; all data and processes are gone.

## Expected

One or more of:

- The scratchpad should default to a location that survives reboots (e.g. under `~/.claude/` or `$XDG_STATE_HOME`), or Claude Code should create it with a `tmpfiles.d` exclusion (`x /tmp/claude-0`).
- At minimum, the system prompt should state explicitly that the scratchpad is **volatile and erased on reboot**, so that the model copies long-running outputs somewhere persistent. The current wording ("Use this directory for ALL temporary file needs … intermediate results … outputs") actively steers the model into keeping multi-hour work there.
- Optionally, a warning in the UI when a session's scratchpad exceeds some size or age.

## Impact

Loss of roughly one day of generation and review work and the associated provider credits. The model followed the system prompt's instruction; the instruction itself was the hazard.

No secrets, credentials, hostnames or proprietary content are included in this report. Session reference available on request.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Review the system prompt wording that directs all temporary files to the session scratchpad, along with /usr/lib/tmpfiles.d/tmp.conf and the documented /tmp/claude-0 path pattern. Determine whether the intended fix is a persistent default, a tmpfiles exclusion, or an explicit volatility warning; done means the chosen behavior is documented and a reboot no longer silently loses work or clearly warns users first.

由索引模型根据 Issue 内容生成。

评估

技术栈
bash, linux, python
领域
documentation, operating-systems, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。