Persistent or ephemeral? Choosing a workspace lifecycle
The best workspace is not always the cleanest one. Match its lifetime to the feedback loop your agent needs.
Workspace lifecycle is a product decision, not just an infrastructure toggle. Ephemeral environments make reset and reproducibility easy. Persistent environments preserve caches, services, and project context. Agent workflows often need a considered mix of both.
Ephemeral favors certainty
A fresh workspace removes hidden state. Builds begin from known inputs, experiments do not contaminate the next task, and replacing the environment becomes the normal recovery path.
The tradeoff is repeated setup. Large dependencies, language toolchains, and datasets can make a perfectly clean start too expensive for an interactive agent loop.
Persistence favors continuity
A persistent workspace can keep dependency caches warm, retain a checked-out repository, and host supporting services between sessions. That continuity shortens the distance between an instruction and a useful result.
It also accumulates state. Teams need a clear reset path and a way to understand what belongs to source control, what belongs to configuration, and what can be discarded.
Use layers instead of one lifetime
A practical design can persist the repository and selected caches while replacing short-lived execution layers. Secrets can expire faster than the machine, and task branches can disappear faster than shared base images.
Thinking in layers lets the workspace keep what accelerates the loop without making every artifact permanent.