# builder.planWorkspace

**Workspace Manager concept example** A working example of the core library. It can change without notice.

- **Module:** builder
- **Package:** @libtmux/workspace
- **Language:** TypeScript
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ts/blob/46cccfef2a546de55ce8b308249b8c76339089a0/packages/workspace/src/builder.ts#L231
- **Page:** https://libtmux.org/en/ts/latest/workspace/reference/builder-planworkspace/

```
async function planWorkspace(
  server: Server,
  workspaceInput: WorkspaceInput,
  options: PlanWorkspaceOptions = {},
): Promise<WorkspacePlan>
```

Plan session, window, and pane membership without changing tmux.

Reads the server once and answers from that capture, so it costs one snapshot
and changes nothing. It reports structural creation, removal, retention, and
window renames. It does not predict options, layouts, focus, or pane command
effects.

## Examples

```ts
const plan = await planWorkspace(server, workspace);
if (plan.removesWindows.length > 0) console.log("would remove", plan.removesWindows);
```

## Parameters

- `server` (`Server`)
- `workspaceInput` (`WorkspaceInput`)
- `options` (`PlanWorkspaceOptions`)
  Default: `{}`.

## Raises

- `ZodError`: when the workspace does not satisfy the strict config schema.
- [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError): when planning options are invalid.

## Guides

Pages that discuss `planWorkspace`.

- [TypeScript workspace internals](/en/ts/latest/workspace/internals/)
- [Use the TypeScript workspace builder](/en/ts/latest/workspace/internals/guides/)
- [TypeScript workspace builder behavior](/en/ts/latest/workspace/internals/topics/)
- [TypeScript workspace builder API](/en/ts/latest/workspace/reference/)
