Pattern
- Create one repository per generated app, site, package, or user project.
- Mount a writable workspace when an agent needs to change it.
- Snapshot during the run so work is durable and inspectable.
- Promote accepted changes back to the project branch.
- Use repository activity to see what agents created, updated, merged, or published.
Create Repositories at Product Scale
Create repositories from your control plane when users start new projects:- Python
- TypeScript
Why This Scales
A repository is the durable unit for a user project. A workspace is the temporary unit for one agent run. That separation keeps high-volume platforms simple: your control plane can create, list, fork, archive, and update repositories through the SDKs, while agents work in isolated mounted workspaces. Mounting does not copy the whole repository into the sandbox. File content is fetched as processes read it, and snapshots record incremental checkpoints instead of forcing every run to become one large final commit. Use branches for product states such asmain, preview, or release. Use workspaces for in-progress agent attempts.
Store Generated Files
When a backend process already has a generated worktree, push it directly:- Python
- TypeScript
push_worktree and pushWorktree create one commit from a local directory. They skip .git, honor .gitignore, preserve symlinks, and preserve executable bits on regular files.
Use this for generated code, app assets, docs, migrations, configuration, and deployment metadata:
Let Agents Work in a File System
When an agent is editing an existing project, mount a writable workspace:/work like a normal directory. Snapshot checkpoints as the run progresses:
app-7f3c2a1b:main, build systems that clone it, and developers who fetch it get the published version.
Update Existing Repositories Safely
Generated applications keep changing after the first version. Users ask agents to add pages, fix bugs, change copy, update dependencies, or regenerate docs. For backend pushes, passexpect_oid in Python or expectOid in TypeScript when the update should fail if the branch moved:
- Python
- TypeScript
Visibility for Agent Fleets
Every repository and workspace has activity you can inspect through the API and dashboard:- Which repositories exist for user projects.
- Which branches changed.
- Which workspaces are live, detached, or resumable.
- Which snapshots each agent created.
- Which paths changed in a snapshot.
- Which principal pushed, promoted, merged, or reconciled changes.
Scale Model
| Need | Use |
|---|---|
| New user app or project | Create a repository |
| Agent edits an existing app | Mount a writable workspace from main |
| Long-running generation | Snapshot as the agent reaches milestones |
| User accepts a result | Promote the workspace to the project branch |
| Backend writes generated code or docs | Repository SDK push_worktree |
| Prevent overwriting newer work | expect_oid / expectOid |
| Inspect what agents did | Workspace status, snapshots, operations, and branch activity |
| Build or deploy generated code | Ordinary git clone, git fetch, or a read-only mount |
Next Steps
Repository SDKs
Create repositories, push worktrees, merge branches, and inspect refs from application code.
Writable Workspaces
Mount, snapshot, and promote code generated by agents.
Merging Changes
Handle branches that moved while an agent was working.
Architecture
Understand snapshots, lazy content delivery, merge behavior, and observability.