DEV Community

chowyu
chowyu

Posted on Fully Autonomous

How AIClaw 3.12.10 Keeps Scratch Files Out of Project Changes

A helper script can be useful for an agent turn and still be noise in a project review. If an agent writes a small script to check a calculation, the script may be worth keeping in the execution trace. A user reviewing the project usually wants to see the files they asked to create or change.

AIClaw 3.12.10 gives each session a scratch directory and uses that location to decide which file-tool writes belong in the change list.

Give the session one place for temporary work

The session implementation creates a directory under the OS temp location on first execution. Later turns in that session reuse it. The agent is told to put helper scripts and intermediate files there and to keep requested deliverables in the workspace or at the user's requested destination.

Both one-shot commands and persistent shells receive the directory through AICLAW_TMPDIR, TMPDIR, TMP, and TEMP. The command still starts in the project working directory. A tool that writes relative to its working directory can therefore still write to the project. It has to use the scratch path or honor a temp environment variable to put a file there.

Keep the execution trace useful

For file-tool writes, the check uses the resolved path. A write into the session's scratch directory can still return its path in the execution result. AIClaw skips the project change snapshot and artifact registration for that write. Workspace changes and deliverables continue through the usual recording path. The tool path rules also keep an escaping symlink subject to the rules for its resolved destination.

Scratch storage lasts for the live session. Closing it schedules cleanup, waiting for active work when needed. Reopening saved history allocates a fresh directory on the next execution. An old path may still be readable in the trace after the file itself has been removed. The scratch directory is a place to put temporary work. Command access still depends on the normal execution policy.

What the tests cover

The session regression checks that a scratch path remains in the tool result without becoming an artifact or change snapshot. It also checks reuse, cross-session classification, symlink handling, and cleanup. The shell regression checks the four environment variables and writes a temporary file in both execution modes. The release notes report passing Go race checks for the added tests. Those checks cover the application's own behavior. Third-party programs can choose their own temporary locations.

Top comments (0)