Five Workspace Anti-Patterns That Fake Agent Skill
说明与用途
文章描述了五种工作区反模式,导致代理看似成功。建议使用隔离工作树、路径门控、原子补丁应用、运行前快照和清理,以确保可靠安全的代理演示。
问题
Coding agents often appear successful because the workspace is not isolated, leading to hidden failures and security leaks.
结果
Implementing isolated worktrees, path gates, atomic patch application, and pre-run snapshots eliminates hidden failures, secures secrets, and ensures reproducible agent demos.
工作流
- Create a unique worktree or clone for the run
- Configure path gates to allow only safe prefixes and deny secrets
- Generate a unified diff patch from the agent
- Check the patch with git apply --check
- Apply the patch atomically if check passes
- Record HEAD and git status before the run
- Run gates.sh to validate changes
- If gates fail, perform git reset --hard to the recorded HEAD and git clean -fd
- Delete the temporary worktree or clone after the run
证据
Give every run a throwaway worktree. Apply patches only after a gate passes.
Deny by default. Allow one path prefix. Reject reads that match a deny list.
Stage one unified diff. Apply it atomically. Reject the whole patch when any gate fails.
Snapshot before tools. Revert on red. Record HEAD and git status --porcelain as first-class outputs.
One run, one directory, one wipe. Cold clone or a fresh worktree every time.
- 记录日期: 2026-09-16T16:45:22.916Z