sandbox-file-discovery-and-validation
它能做什么
这项技能指导 AI 智能体在它实际能访问的文件夹中查找文件,并在之后确认其输出。它适合在有限或临时的环境中工作、常见文件夹可能不存在的人。
适用场景
- ✓当你需要智能体在陌生或临时的环境中找到输入文件的时候。
- ✓当系统中可能不存在桌面或文档等常见文件夹的时候。
- ✓当你需要证明输出文件已经生成,并符合你的要求的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/sandbox-file-discovery-and-validation/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请找到我在这个环境中上传的电子表格,制作一份摘要文件,并检查它是否已正确保存。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会从当前工作文件夹和其他已确认的工作区文件夹开始,在其中搜索所需的文件,并把输出保存到已知位置。随后,它会检查每个输出是否存在、能否读取,以及是否符合要求的形式。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Sandbox File Discovery and Validation
Use this skill when working in constrained or sandboxed shell environments where common folders like ~/Desktop, ~/Documents, or ~/Downloads may not exist, may be inaccessible, or may not be where task files are stored.
The goal is to:
- discover files from actual accessible roots,
- avoid brittle path assumptions,
- generate outputs in known locations, and
- explicitly validate that outputs were created and match expectations.
Core principles
- Do not assume GUI-era user folders exist.
- Start from the current working directory and other confirmed workspace roots.
- Use recursive search from known roots, not from
/unless necessary. - Prefer deterministic output paths you control.
- After creating an artifact, verify it exists, is readable, and matches the requested form.
When to use this
Use this pattern when:
- you need to locate input files in an unfamiliar sandbox,
- the environment may be ephemeral or nonstandard,
- you are producing files for the user,
- success depends on the actual contents or structure of the output.
Recommended workflow
1) Establish your real working roots
Begin by identifying where you are and what directories are actually available.
Example:
pwd
ls -la
find . -maxdepth 2 -type d | sort
If needed, inspect nearby likely roots:
ls -la /tmp
ls -la /workspace 2>/dev/null || true
ls -la /workspaces 2>/dev/null || true
ls -la /mnt/data 2>/dev/null || true
Treat only confirmed, readable directories as search roots.
2) Avoid assumed folders
Do not begin with paths like:
~/Desktop~/Documents~/Downloads
unless you have already confirmed they exist and are relevant.
Bad:
find ~/Desktop -name "*.xlsx"
Better:
find . -type f -name "*.xlsx"
or, if a root is confirmed:
find /workspace -type f -name "*.xlsx" 2>/dev/null
3) Search from known roots with bounded, focused queries
Prefer targeted searches over broad filesystem scans.
Useful patterns:
find . -type f | sort
find . -type f -iname "*report*"
find . -type f \( -iname "*.csv" -o -iname "*.xlsx" -o -iname "*.json" \)
If multiple roots are known:
find . /workspace /mnt/data -type f 2>/dev/null | sort
Guidelines:
- suppress permission noise with
2>/dev/nullwhen appropriate, - filter by extension or name fragment,
- sort output for stable inspection,
- keep searches bounded to known roots.
4) Choose a deterministic output location
When generating a file, write it somewhere explicit and easy to re-check.
Good patterns:
- current directory,
- a task-specific subdirectory like
./output, - a confirmed writable workspace directory.
Example:
mkdir -p output
python make_result.py --out output/final.xlsx
Avoid writing to guessed locations that may not exist.
5) Immediately validate the output artifact
Never assume generation succeeded just because a command exited successfully.
At minimum, confirm:
- the file exists,
- the path is the one you intended,
- the file is non-empty when applicable,
- the format or structure matches the task.
Basic checks:
ls -l output/final.xlsx
test -f output/final.xlsx && echo "exists"
test -s output/final.xlsx && echo "non-empty"
file output/final.xlsx
For text-like outputs:
head -n 20 output/result.csv
wc -l output/result.csv
For structured outputs, inspect with the relevant tool:
- CSV: preview headers and row counts
- JSON: parse and inspect keys
- ZIP-like formats such as
.xlsx: verify internal structure or open with a library - generated code/config: run syntax or schema checks if available
6) Validate against task requirements, not just file existence
A file existing is necessary but not sufficient.
Check the artifact against the requested deliverable:
- expected filename or location,
- expected sheet names, tabs, columns, or keys,
- expected formulas, calculations, or derived values,
- expected number of records,
- expected transformations or formatting.
Examples:
- If a workbook was requested, verify the workbook contains the required sheets.
- If formulas were required, verify formulas are present, not just pasted values.
- If a filtered dataset was requested, verify row counts and selected columns.
- If a renamed file was requested, verify the actual output name.
7) Report with evidence
When you finish, cite the exact artifact path and the validation you performed.
Good completion style:
- “Created
output/final.xlsx.” - “Verified it e
常见问题
为什么智能体避开桌面等文件夹?
这项技能指出,这些文件夹在沙箱中可能不存在,因此智能体从工作文件夹开始。
搜索的深度有多大?
这项技能建议从已知的根目录进行有限的搜索,而不是搜索整个系统,除非确有必要。
最后的检查包括什么?
它确认文件存在、可以读取,并且具有预期的形式。
详情
作者的原始描述
Use shell tools safely in sandboxed environments by discovering files from real workspace roots instead of assumed user folders, then explicitly verifying output artifacts after generation.
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12993
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。