Every card that changes code builds in its own git worktree on its own branch, cut from your checkout the moment you approve the plan. Your checkout stays on the branch you left it on, and nothing an agent does reaches it until the card lands.
Two agents on one checkout would overwrite each other's files, and a half-finished build would sit in your working copy while you review something else. A worktree gives each card a private copy of the repository that shares the object store with your checkout, so it costs seconds to make and no extra clone to keep. Grid uses git's own worktree mechanism, nothing of its own.
| Stage | Where the agent works |
|---|---|
| Inbox and Prepare | In your checkout, read-only. Prepare is research and planning, so it runs in place and records which repositories the card will touch and the commit it started from. |
| Prepare to Doing | The arrow that approves the plan cuts the tree: one per repository the card touches, on a branch named after the card, at the recorded base commit. Grid fetches the base branch first when the repository has a remote; offline, or without one, it cuts from what you have. The prepare session cannot follow the card into the tree, so it ends and a fresh one starts inside, told where it now stands; the chat does not carry over, and the plan is on the card. |
| Doing, Review, Verify | Everything happens inside the tree. The session's terminal opens there, the Code view diffs the branch against its base, and the project's verify command runs in it. |
| Closed | The branch lands, the tree is removed, and the branch is pruned unless the project's delivery mode put the branch itself on origin, where it outlives the tree. A session that is still alive is moved back to your checkout. |
Prepare can decline a tree for one card. isolatable: no in the card's front matter runs it in the shared checkout even on a project that isolates; yes, partly and no answer at all each cut one.
The trees live under the workspace state folder, one directory per card and one tree per repository inside it:
~/.grid/<workspace>/worktrees/<card-slug>/<repo>/
The branch is grid/<card-slug>. A card that touches three repositories gets three trees and three branches with the same name, and the cut is all or nothing: if one repository cannot be cut, none are, and the move into Doing is refused with the reason on the tile.
A worktree starts as a clean checkout of the base commit plus the files a clone would not have. Grid copies the seed files from your checkout into the tree: .env and .env.*, *.pem and *.key certificates, and .claude/settings.local.json. A directory is never a seed. A repository can name its own list with the seed key in its grid.toml section. Grid also installs its hooks and marks the folder trusted for the agent's CLI, so the first prompt runs without a permission dialog.
Dependencies are deliberately not installed. Grid does not guess a package manager, and a tree that needs pnpm install or npm install says so in the agent's first prompt. The agent runs it, in the tree, reaching whatever its own agent settings let it reach: Grid mediates no network access of its own.
| Card | Base of the branch |
|---|---|
| An ordinary card | The repository's default branch, freshly fetched. A project can name another base per repository in its Settings under Code. |
| A follow-up of an open card | That card's branch, so the follow-up builds on work that has not landed yet. Once the parent is closed, the default branch: the work is already merged. |
A card with a base_ref |
The ref pinned in the card's front matter before the plan was approved. |
The base commit is recorded on the card when the tree is cut, and the review shows the diff against exactly that commit.
Closing a card lands its branch, and what landing means is the project's delivery mode. Where Grid merges, it merges the card branch into the base branch in your checkout with a merge commit instead of a rebase.
| Delivery mode | What happens on close |
|---|---|
| Push the branch | The card branch is pushed to origin with its upstream set, and that is all. Nothing is merged and nothing is opened, and the branch is not pruned when the tree goes: the branch is the deliverable. |
| Push the branch, open a PR | The branch is pushed and a pull request is opened, titled from the card and noting the base commit it branched from. |
| Push the branch, open an MR | The same with a merge request on GitLab. The engine accepts this mode; the settings chip for it is still to come. |
| Merge, don't push | The merge stays in your checkout. Nothing leaves the machine. |
| Merge, then push | The same merge, and then the base branch is pushed. |
| No commits | Nothing is committed for you. The work stays in the tree and you commit it yourself. |
Delivery mode is set per project under Delivery, with an override per repository. Whether the agent asks before it commits is a separate switch on the same page.
Grid never resolves a conflict and never overwrites your work. The close is refused, and the card stays in its stage with the reason on the tile, when:
node_modules, .pnpm-store, .turbo, .next, .nuxt, __pycache__, .pytest_cache, .mypy_cache and .ruff_cache as a first path segment,A conflict is handed back to the card's own agent. Grid tells the session which files conflict and how to fix it: merge the base into the card's branch in the card's own worktree, keep both sides because the base holds other cards' landed work, commit the merge. Grid then lands the branch itself. If no agent is live and the card is still in Deliver, Grid starts one with that as its first message.
Otherwise, fix the cause and close the card again, or land it from the terminal with grid card land <ref>. Force-closing a card from the board skips landing and leaves the branch and the tree in place.
A background sweep reads every closed card's branch and marks the ones that never merged with a "branch not merged" chip on the closed tile, so a force-close or an agent that closed its own card cannot lose work quietly. The tree is still there, listed by grid worktree ls, until you land or remove it. The sweep skips projects that deliver by putting the card branch on origin (Push the branch, and the PR and MR modes) because a branch that stays unmerged is the intended result there.
The branchPerCard setting decides the blast radius. The workspace default sits in Settings under General, in the Safety section, and a project or a single repository can override it.
| Mode | Behaviour |
|---|---|
| worktree | The default. A tree and a branch per card, landed on close. |
| in-place | A branch per card, checked out in your own checkout. One card at a time per repository, and your checkout follows the card. |
| none | Agents work on whatever your checkout has checked out. Nothing is cut and nothing lands. |
A project with no folder, or a folder that is not a git repository, always runs in place. Every session is told in its first prompt whether it is isolated, partly isolated or working in your checkout, so an agent never assumes a safety it does not have.
grid worktree ls
grid worktree gc [--force]
grid worktree rm <card> [--force]
grid card land <ref>
The list shows each tree with its card and its size on disk. Garbage collection removes orphans, trees whose card is closed or gone, and refuses a tree with uncommitted work unless forced. The daemon has to be running for any of these to write.
Worktrees are local to the machine. Grid does not sync them, and a second machine or a teammate sees only what was pushed.