prompt: strengthen scratch-directory ephemerality warning - #10
Merged
Conversation
The Environment Info section told the agent to run git clone / installs / builds under the scratch directory but only closed with a soft "Scratch is temporary — copy anything worth keeping" trailer. The model routinely drops that trailer once a clone succeeds, leaving user-facing deliverables stranded on the ephemeral fast disk. Replace the trailer with an explicit loss warning: scratch is wiped without warning whenever the worker restarts, the container is removed, or the sandbox is reset; anything left there is permanently lost; a deliverable must be copied into the workspace as soon as it is produced. Only the six Bash-capable roles that render the scratch section (main, generalist, localExplorer, coder, archivist, reviewer) change; the four Bash-less roles stay byte-identical. role-prompt snapshot hashes updated accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR strengthens the system-prompt guidance about using the scratch directory by replacing a soft “scratch is temporary” reminder with an explicit data-loss warning, aiming to reduce cases where agents leave deliverables in ephemeral storage.
Changes:
- Updated the “Environment Info” scratch guidance to clearly state scratch is wiped on worker/container lifecycle events and that deliverables must be copied into the workspace immediately.
- Updated role prompt snapshot hashes for the six Bash-capable roles impacted by the prompt text change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/prompt.ts | Rewrites the scratch-directory warning to be explicit about wipe conditions and required copy-back behavior. |
| src/agents/role-prompt.snapshot.test.ts | Updates SHA-256 snapshot hashes for the affected role prompts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Environment Info段会告诉 agent 把git clone/ 装依赖 / 构建放到 scratch 快速盘下做,但只在末尾补了一句软提醒 "Scratch is temporary — copy anything worth keeping into the workspace"。实测中 agent 克隆成功后基本会丢掉这句,把用户要的交付物(克隆下来的仓库、下载的文件)留在 ephemeral 的 scratch 盘上,worker 重启后丢失。api-log 实例:用户要求 clone 三个仓库,agent 把仓库克隆进
/scratch/repos/lightclaw后未拷回工作区。改动
把末尾那句软提醒换成明确的丢失警告:
前两句(scratch 定位 + "重 IO 放 scratch")保持不变。
影响范围
只有渲染 scratch 段的 6 个 Bash-capable role(
main/generalist/localExplorer/coder/archivist/reviewer)的 system prompt 变化;4 个无 Bash 的 role(webSearcher/feishuSecretary/memoryExtractor/memoryCurator)byte-identical 不变。role-prompt.snapshot.test.ts的 6 个对应 hash 已同步更新。验证
pnpm typecheck✅pnpm exec tsx --test src/agents/role-prompt.snapshot.test.ts✅pnpm exec tsx --test src/prompt.test.ts✅ (5/5)pnpm exec tsx --test src/tools/tool-description.snapshot.test.ts✅ (无关联,确认未受影响)🤖 Generated with Claude Code