Key Takeaways
- AI coding agent files are the repos, configs, logs, patches, and artifacts an agent writes while working, not just its final output.
- Ephemeral sandboxes tie the file layer to compute, so a timeout or crash erases hours of agent work with no warning.
- Persistent filesystems decouple storage from the sandbox lifecycle, which lets a second runtime reopen the same workspace.
- No persistence model restores running processes, open sockets, or in-memory state. Only what reached disk survives.
- Files solve workspace continuity. Durable metadata, permissions, and workflow state still belong in a database.
An agent clones a repo, installs dependencies, reproduces a failing test, and gets three-quarters of the way through a fix. The sandbox hits its duration limit. The next run starts in an empty directory with the same task, the same prompt, and none of the evidence. Nothing crashed and nothing errored. The work was never anywhere durable.
AI coding agent files are the working artifacts an agent produces during a task: cloned repositories, edited source, dependency manifests, build and test output, logs, patches, and scratch notes. In an ephemeral sandbox, all of it sits on a local disk that dies with the session. Unless the file layer is decoupled from compute, that work disappears the moment the environment resets. This post covers what breaks, how persistent filesystems fix it, what they still cannot recover, and where a database has to carry the state files cannot.
What Are AI Coding Agent Files?
AI coding agent files are everything an agent reads and writes inside its workspace while completing a task, not only the diff it produces at the end. The working set spans source, dependencies, build output, and the notes the agent leaves for itself.
- Source and cloned repositories: the working tree, including uncommitted changes and untracked files.
- Dependency manifests and lock files:
package.json,requirements.txt,go.mod, and the resolved lock files that make a build reproducible. - Build and test output: compiled binaries, JUnit XML, coverage reports, failure logs.
- Generated artifacts: patches, migrations, diagrams, documentation, data extracts.
- Scratch files: task notes, plans, and intermediate reasoning the agent writes down to stay oriented.
Repos, Artifacts, and Logs Are Part of Agent State
Treating only the final diff as the output understates what the agent depends on. A failing test log is the evidence that justifies the next edit. A lock file is the reason the build reproduces. An intermediate patch is the fallback when the current approach stalls. Discard those and the agent loses its reasoning substrate, not just some files.
Files Are How Coding Agents Keep Working Between Steps
Coding agents use the filesystem as a native working medium, the same way a developer does. They grep for a symbol, open three files, edit one, run the test runner, read the failure, and try again. Each step leaves state the next step reads. That loop is what breaks when the workspace is disposable.
This is a question of workspace continuity, which is related to but distinct from agent memory. Memory holds what the agent learned and should carry forward. Files hold what it can reopen, re-read, and verify.
Why AI Coding Agent Files Disappear After Sandbox Resets
Files disappear because most agent execution environments are designed to be disposable, and the filesystem inherits that property. A sandbox starts in seconds, runs untrusted code in isolation, and gets destroyed when the run ends. Disposability is the right default for compute. It is the wrong default for the working set.
Ephemeral Compute Is Not Durable Workspace Storage
In a typical sandbox, the local disk is scoped to the container or microVM. When the run hits its duration limit, crashes, or gets killed by the orchestrator, that disk goes with it. So does everything expensive to produce: the npm install that took four minutes, the compiled output, the reproduction of a race condition that only appears after a specific sequence of commands.
None of this is a bug. It is a boundary. The execution environment and the durable state layer are different concerns, and a team that has not designed the second one does not have it.
Session Restarts Break File Continuity by Default
Continuity also breaks at ordinary boundaries, without a crash. A long task outlives one sandbox. A reviewer wants to inspect what the agent did. A second agent picks up a parallel branch of the work. A CI job needs the artifacts the agent produced. Each of these crosses a runtime boundary, and by default the files do not cross with it.
Teams running multi-step agents in production hit this first, because their tasks last hours rather than one prompt. That is the point where a persistence layer for AI agent progress files stops being an optimization and becomes a prerequisite.
How Persistent Filesystems Work for AI Agents
A persistent filesystem moves the file layer out of the sandbox lifecycle so any new runtime can reattach to the same workspace. Execution stays disposable. State does not. The workspace gains its own identity, addressed by a token or ID rather than by whichever machine currently holds it.
Compute Comes and Goes, Workspace State Stays
Picture two planes sharing one namespace. Above the line, sandboxes start, do work, and end. Below it, the workspace is addressed as a service. A sandbox mounts it, works normally, and exits. The workspace is unaffected.
Mounted Storage Lets One Sandbox Hand Off to Another
Implementations differ in mechanics but share that shape:
- Mounted drives and named volumes attach network-backed storage to a sandbox at a path, and survive the sandbox that mounted them.
- Server-side workspaces keep the authoritative copy remote and expose file operations over an API or CLI, so a client reads and writes without a full mount.
- Remote filesystem layers present a path-based namespace across environments, so the same workspace opens from a sandbox, a CI runner, or a laptop.
The practical test is a handoff. Write from one runtime, let it end, reopen from another, and confirm the second run continues rather than restarts.
Persistence Does Not Resume Live Processes
A persistent filesystem preserves bytes on disk. It does not preserve:
- Running processes: a dev server, a file watcher, a long-running test harness. All gone.
- Open sockets and connections: database sessions, SSH tunnels, port forwards.
- In-memory state: anything a process held but never flushed.
- Environment context: exported variables, shell history, in-flight background jobs.
A resumed workspace is a directory, not a suspended machine. Agents have to reconstruct their runtime from files, which in practice means writing down enough state (a task file, a progress log, a handoff note) that the next run can rehydrate itself.
Snapshots, Drives, and Persistent Sandboxes Are Not the Same
These three terms get used interchangeably and behave very differently under failure. A snapshot captures a moment, a drive holds a workspace with its own lifecycle, and a pause-resume sandbox suspends one specific machine. Only the second reliably supports handoff between runtimes.
Snapshots Capture a Moment in Time
A snapshot freezes the filesystem, and sometimes memory, at an instant so a team can restore or fork from it later. It works well for reproducible starting points such as a prepared environment with dependencies already installed. It works poorly as a live working surface, because every save is an explicit action and every restore produces a copy rather than a shared location.
Drives and Volumes Outlive the Sandbox
A mounted drive or volume is storage with its own lifecycle. The sandbox attaches, writes, and detaches. The data stays. This model supports genuine handoff, because the workspace has an identity independent of any runtime.
Pause and Resume Is Different From Full Workspace Portability
Pause-resume keeps one specific sandbox suspended so it can wake later, often with process state intact. That helps within a single continuous session. The workspace is still bound to that sandbox, so if it gets killed, or if a different runtime, a CI job, or a reviewer needs the same files, pause-resume does not help.
| Persistence model | What it saves | Best for | Main limitation |
|---|---|---|---|
| Snapshot | Filesystem, sometimes memory, at a point in time | Reproducible starting images, forking experiments | Explicit save points; restores a copy, not a shared workspace |
| Mounted drive or volume | Files written to the mount path | Handoff between runtimes, long-lived workspaces | Usually scoped to one cloud or platform; no process state |
| Pause-resume sandbox | The sandbox itself, often including memory | Resuming one interrupted session quickly | Tied to that sandbox; lost if it is killed or evicted |
| Object storage bucket | Uploaded objects, versioned | Artifacts, datasets, backups, archives | Not a live working directory; no path semantics for tools |
| Git remote | Committed history and branches | Source history, review, collaboration | Uncommitted work, build output, and logs are not covered |
| Networked agent filesystem | One path namespace across runtimes | Multi-runtime, multi-agent, multi-session work | Still no process state; network dependency on access |
What a Persistent Filesystem Must Support for Coding Agents
Durability alone is not enough. A workspace for coding agents needs path-based file semantics, isolation between attempts, concurrency controls, checkpoints with rollback, and access control that holds once files outlive a single run.
POSIX-Style File Access Keeps Developer Tools Working
Agents do not call a storage API. They run git status, grep -r, pytest, and npm ci, and those tools expect paths, directories, permissions, and file handles. A persistence layer that requires rewriting the toolchain gets routed around, because the agent’s advantage is precisely that it uses the tools a developer already uses. Check how closely a given system matches standard file semantics before assuming existing tooling works unchanged.
Isolation and Rollback Matter When Agents Branch Work
Agents fail, retry, and explore in parallel. That creates three requirements: isolated workspaces so one attempt cannot corrupt another, concurrency controls for when several agents legitimately share a repository, and checkpoints with rollback so a bad edit sequence reverts without rebuilding the environment. The same instinct drives database branching for AI agent state: cheap isolation, cheap reset.
Access Control Matters When Files Outlive One Session
Once files persist beyond a run, they become an asset with a security posture. That means tenant isolation between customers, encryption at rest and in transit, an audit trail of which agent wrote what, and scoped credentials for machine-to-machine handoff. A workspace that any agent in the account can open is an incident waiting for an occasion.
Where Teams Get Persistent Agent Files Wrong
Two assumptions cause most of the trouble: using Git as the entire persistence layer, and treating object storage as a live workspace. Both preserve something real, and neither preserves a working directory.
Git handles committed history well and handles everything else an agent produces badly: uncommitted work, build output, failure logs, half-finished patches. Committing that noise to keep it is a workaround, not a design.
Object storage is durable and cheap, and it is not a working directory. Buckets have no real paths, no in-place edits, and no tools that operate on them natively. Syncing a bucket to local disk at the start of every run reintroduces the setup cost that persistence was supposed to remove.
Each layer has a job. Object storage holds artifacts. Git holds committed history. A filesystem holds the live working set. A database holds structured, queryable state, which is what teams reach for once scaling AI agent persistent storage outgrows a file on a single box.
Checklist: Signs Your Coding Agent Workspace Is Still Fragile
- A sandbox timeout means the task restarts from a clean clone.
- Dependency installation runs on every attempt instead of once per workspace.
- Failing test output exists only in the logs of a container that no longer exists.
- A reviewer cannot open what the agent produced without re-running it.
- Two agents on the same repository need two full copies to avoid collisions.
- No mechanism rolls a workspace back to the state before the last edit sequence.
- Nobody can answer which agent wrote a given file, or when.
Three or more of these means the workspace is a byproduct of compute rather than a managed resource.
How File Persistence Fits the Broader AI Agent State Stack
Files are one persistence surface. A production agent system usually runs three: workspace files, memory, and database-backed state. Each answers a different question, and none of them substitutes for another.
Files, Memory, and Database State Solve Different Problems
Workspace files hold what the agent can reopen and verify: the tree, the diff, the logs. Memory holds what the agent learned and should carry forward, including summaries, extracted insights, and durable context. Database state holds what has to be queried, joined, and transacted: task records, run history, permissions, workflow status, tool outputs, and metadata about the files themselves.
A filesystem cannot answer “show me every task this agent failed on last week, grouped by repository.” A database makes a poor live working directory. Persistent memory for coding agents is a third thing again: compact and revisable, where files are literal and verbatim.
Durable Agent Systems Need More Than One Persistence Surface
A workable architecture keeps all three connected: a workspace the agent operates in, a memory layer it reads and updates, and a system of record that knows what happened. Most teams assemble these from three or four disconnected systems. That works, and it adds failure points and turns reconciliation (which run produced which file, under whose permission) into someone’s manual job.
Where TiDB Fits When Coding Agents Move Past Local Files
A persistent filesystem solves continuity of the working set. It does not provide a queryable system of record, and agents in production need one. TiDB covers that half: the transactional, high-concurrency state that surrounds the workspace.
Files Need a Durable System of Record Behind Them
Consider the state that should not live only on a disk: which task a workspace belongs to, which agent holds it, what step the workflow reached, which artifacts a reviewer approved, who has permission to open it, and how long any of it is retained. That data is relational, transactional, and written concurrently by many runs. Stored in a file, it becomes a parsing problem and a race condition.
TiDB Helps Persist the State Around the Workspace
TiDB is a distributed SQL database that speaks the MySQL wire protocol, which matters here for a practical reason: existing ORMs, migration tools, and SQL keep working, so the agent control plane does not become a new stack to learn. It scales horizontally for the write profile agent fleets produce, which is many small concurrent writes from many runs at once. TiDB Cloud Starter provisions a database in roughly one second, and Moonshot AI’s Kimi.ai uses that model to back AI-generated applications at internet scale.
A concrete pairing looks like this. The agent mounts a persistent workspace and works with normal file operations, while every run, step, artifact reference, and permission check gets written to a database for AI agents. The filesystem answers what the agent left behind. The database answers what happened, who did it, and what is true now. The same split applies to scaffolding files for AI coding agents: templates live in the workspace, and the record of what was generated lives in the database.
How PingCAP Supports Durable AI Agent Infrastructure
The architectural shift matters more than any feature comparison. Execution becomes disposable and state becomes a managed resource with its own lifecycle, identity, and access model. Teams that make that split early stop losing work to timeouts and stop paying the setup cost on every attempt.
TiDB Cloud Filesystem addresses the workspace half. It is a durable working directory for coding agents, currently in technical preview, that holds the source tree, git state, uncommitted work, test output, and artifacts, so the next runtime opens the same workspace instead of rebuilding it. It runs in production today behind Kimi Work, Moonshot AI’s desktop agent. TiDB addresses the other half: the durable, queryable state around the workspace, with the auditability and tenant isolation enterprise deployments require.
The evaluation is small enough to run this week. Write from one runtime, let it end, reopen the workspace from another, and confirm the second run continues from the first. Our database for AI agents documentation walks through that architecture end to end.
AI Coding Agent Files FAQs
What Happens to Files When an AI Sandbox Resets?
In a standard ephemeral sandbox, everything on local disk is destroyed, including cloned repos, installed dependencies, build output, and logs. Files survive only when they were written to storage with its own lifecycle, such as a mounted drive, a networked agent filesystem, or a snapshot taken before the reset.
Do Persistent Sandboxes Keep Installed Dependencies?
Often yes, because dependencies are files on disk. Separate disk state from process state, though: a resumed workspace may still hold node_modules while nothing is running. Some systems also exclude rebuildable directories from persistence to keep workspaces small, so confirm what a given platform actually stores.
What Is the Difference Between Agent Memory and Agent Files?
Files are the literal working set: the tree, the diff, the logs, and the artifacts the agent can reopen and verify. Memory is compact and revisable, holding summaries, extracted insights, preferences, and lessons carried between runs. Files answer what is here. Memory answers what the agent learned.
Can Multiple AI Agents Share the Same Filesystem?
Yes, and a shared workspace is often the point when several agents work one repository. It requires design: isolation between attempts, concurrency controls on shared paths, conflict handling when two agents edit the same file, and an audit trail recording which agent wrote what.
When Do Coding Agents Need a Database in Addition to Persistent Files?
As soon as state has to be queried, joined, or transacted. Run history, task status, permissions, artifact metadata, and workflow position all qualify. Filesystems provide path-based access to bytes, not answers to “which runs failed this week, by repository.” That question needs SQL.
Experience modern data infrastructure firsthand.
TiDB Cloud Dedicated
A fully-managed cloud DBaaS for predictable workloads
TiDB Cloud Starter
A fully-managed cloud DBaaS for auto-scaling workloads