Development Workspaces
Last reviewed September 9, 2026.
Development workspaces are durable, project-scoped Git branches and sibling worktrees that CPLai creates and reopens from Terminal. They keep implementation work isolated while preserving a stable branch, working directory, terminal profile, environment, preview ports, review evidence, and parent-child relationship across sessions.
They are different from Tab presets: a tab preset is a reusable one-tab launch preset, while a development workspace creates and tracks a real Git branch and worktree.
How do I create a development workspace?
- Open Terminal in the desktop app or web dashboard.
- Select an active project. The project must have a valid Git repository directory.
- Open the Terminal workspace panel with the layers button.
- Expand Development workspaces.
- Enter a workspace name and a Git base reference. The default base is
HEAD; you can use a branch or another revision that resolves to a commit. - Select Create durable branch and worktree.
CPLai derives a safe branch name and sibling worktree path on the server. It then creates a PowerShell terminal rooted in that worktree. The workspace record remains available after the terminal or app closes.
What does the workspace list show?
Each row shows the workspace name, branch, dirty-file count, status, and preview URL when a port is leased. Child rows are indented and also show review and CI status.
| Action | Result |
|---|---|
| Play / open | Reopens the tracked worktree in a terminal with its launch environment |
| Settings | Opens environment, port, child, review, and convergence controls |
| Archive | Archives CPLai metadata and releases active port leases; it keeps the branch and files |
| Refresh | Re-reads Git state and current workspace metadata |
If the branch is missing, the worktree is unavailable, or Git inspection fails, CPLai disables launch and shows the Git error instead of opening the wrong directory.
How do environment overlays work?
Open workspace settings and enter one KEY=value pair per line. CPLai validates and stores up to 64 string variables, then overlays them only when it launches that development workspace.
Port leases add generated variables to the launch environment:
PORTandCPL_PREVIEW_URLpoint to the first active lease.CPL_<SERVICE>_PORTandCPL_<SERVICE>_URLare created for every named service, with the service name normalized for an environment variable.
This keeps preview configuration attached to the workspace instead of requiring edits to the repository's shared .env file.
How do collision-free preview ports work?
- Open workspace settings.
- Enter a service name such as
web-preview. - Optionally enter a preferred port, or leave it blank for automatic selection.
- Select Lease.
CPLai checks both its active lease ledger and the local TCP port before assigning a port. It returns a preview URL such as http://127.0.0.1:4310 and injects that port into future terminal launches.
The Terminal panel heartbeats active leases every five minutes. Expired leases are marked stale and can be reused; releasing or archiving a workspace frees its leases. A preferred port is rejected when it is outside the allowed range or already in use, rather than colliding with another workspace.
Leasing a port reserves and injects the value. Your application still has to start its own development server and listen on that port.
How do parent and child workspaces work?
A root development workspace can create one-level child workspaces for parallel implementation, review, or delegated work.
- Commit or otherwise clean the parent worktree.
- Open the root workspace settings.
- Enter a child workspace name and select Create child.
- CPLai forks a clean child branch and sibling worktree from the parent's current branch.
- Do and commit the child work in its isolated terminal.
Nested children are intentionally not supported. This keeps convergence explicit: children flow back to one clean parent rather than forming an unbounded merge tree.
How do review and CI checkpoints work?
On a child workspace, settings include:
- Review status: Draft, Ready, Approved, or Changes requested.
- CI status: Not run, Pending, Passed, or Failed.
- Review summary: the human or agent review conclusion.
- CI evidence: the commands, checks, links, or receipts that support the CI status.
Selecting Save review checkpoint requires a clean child worktree and records the exact child HEAD that was reviewed. Editing or committing after that checkpoint changes HEAD, so the review and CI checkpoint must be refreshed before convergence.
How do I converge a child into its parent?
Convergence is guarded and owner-confirmed. It becomes available only when:
- the child review status is Approved;
- the child CI status is Passed;
- the explicit merge-approval checkbox is selected;
- the reviewed child HEAD has not changed;
- both parent and child worktrees are clean and on their expected branches.
Select Converge into parent to create a no-fast-forward merge commit on the parent branch. On success, CPLai records the merge commit, marks the child merged, archives it, and releases its port leases.
If the merge conflicts or the database cannot record the convergence, CPLai aborts or rolls the parent back to its pre-merge HEAD and reports the failure. It does not silently leave a half-recorded merge.
Current boundaries
- Development workspaces are project-scoped and require a valid local Git repository.
- Creating, configuring, reviewing, archiving, and converging workspaces requires owner access.
- CPLai creates branches and worktrees, but it does not push them or open a pull request automatically.
- Review and CI values are evidence checkpoints entered by the operator or workflow; CPLai does not claim it ran CI merely because Passed was selected.
- Archiving preserves branch and worktree files. Use normal Git/worktree maintenance when you intentionally want to remove them.
- Automatic worktree cleanup (see Git) never removes the folder of an active workspace, even after its branch is merged. Once a workspace is archived, cleanup may remove its folder when the branch is merged and the folder has no local changes.
- The current UI creates PowerShell-backed development workspaces. Existing API records can carry other supported shell types, with desktop falling back when a shell is not native there.