# LibTmux.Workspace\Get-TmuxWorkspacePlan

- **Package:** LibTmux.Workspace
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.Workspace.PowerShell/GetTmuxWorkspacePlanCommand.cs#L8
- **Page:** https://libtmux.org/en/powershell/latest/workspace/reference/libtmux-workspace-get-tmuxworkspaceplan/

```
Get-TmuxWorkspacePlan
    [-Workspace] <LibTmux.Workspace.WorkspaceFile>
    -Server <LibTmux.Server>
    [-ExistingSession <LibTmux.Workspace.WorkspaceExistingSession>]
    [-ServerStartup <LibTmux.Workspace.WorkspaceServerStartup>]
    [-Readiness <LibTmux.Workspace.WorkspaceReadiness>]
    [-ReadinessTimeout <System.Double>]
    [-CompensateOnFailure]
    [-AllowHostScripts]
    [-HostScriptTimeout <System.Double>]
    [-MaxHostOutputBytes <System.Int32>]
    [-CleanupTimeout <System.Double>]
    [<CommonParameters>]
```

Observe an explicit endpoint and prepare a workspace plan.

Validate the native declaration and policies, then inspect the supplied tmux
endpoint. Return one native WorkspacePlan containing ordered actions, native
requests and observed identity preconditions. Planning does not start a daemon,
create panes, send commands or execute the declaration's host script.

Resolve file-relative paths explicitly before planning. Host scripts require a
resolved document directory and AllowHostScripts when they will execute. The
plan freezes the chosen policies, host limits and command arguments. Review its
Actions and CompensationActions, then pass that same plan to
[`Invoke-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/). Changing a source file does not change an existing plan.

Error refuses a conflicting session. Reuse plans only reuse when that session
exists, skipping declaration effects and host execution. Append creates declared
windows while preserving local session settings and applying declared global
defaults. Global options can affect other sessions that inherit them and are
not restored by compensation. Replace selects the exact observed session for
replacement. A stale plan fails at application; it is not automatically
regenerated.

Observation spans tmux operations and is not a transaction. Native options,
layouts, hooks and configuration can still cause application failures.

### Notes

[`All`](/en/csharp/latest/reference/libtmux-unbindkeyrequest-all/) numeric timeout parameters use seconds. Policy validation occurs before
endpoint observation. Planning errors preserve the native exception with the
[`Tmux.WorkspacePlanFailed`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Get-TmuxWorkspacePlan.md#notes) identifier; invalid policy values use
[`Tmux.InvalidWorkspacePolicy`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Get-TmuxWorkspacePlan.md#notes).

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/workspace/reference/glossary/#cmdlet)
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Workspace.WorkspaceFile`: A parsed declaration, optionally resolved against an explicit document directory.
- **Outputs:** `LibTmux.Workspace.WorkspacePlan`

Related APIs:

- [`Invoke-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-invoke-tmuxworkspace/)
- [`Import-TmuxWorkspace`](/en/powershell/latest/workspace/reference/libtmux-workspace-import-tmuxworkspace/)

## Examples

Example 1

Plan a workspace at an explicit socket without creating its session.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux.Workspace/Get-TmuxWorkspacePlan.md).

```powershell
$endpoint = LibTmux\New-TmuxServer -SocketPath $SocketPath
LibTmux.Workspace\Import-TmuxWorkspace -Yaml @'
session_name: development
windows:
  - window_name: editor
'@ | LibTmux.Workspace\Get-TmuxWorkspacePlan -Server $endpoint
```

## Parameters

- `Workspace` (`LibTmux.Workspace.WorkspaceFile`): The immutable parsed declaration. Resolve paths explicitly before planning when they depend on a document directory.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Server` (`LibTmux.Server`): The explicit endpoint to inspect. Planning borrows its lifetime and never initializes an absent daemon.
  Required. Named parameter. Does not accept pipeline input. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `ExistingSession` (`LibTmux.Workspace.WorkspaceExistingSession`): Choose Error, Reuse, Append or Replace for a session with the same literal name. Replace is frozen into the plan; invocation uses normal PowerShell confirmation.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `Error`. [`ValidateSet(["Error","Reuse","Append","Replace"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `ServerStartup` (`LibTmux.Workspace.WorkspaceServerStartup`): CreateOrJoin allows later application to start or join an initially absent daemon. RequireExisting fails planning when no daemon is present. Neither choice grants daemon ownership.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `CreateOrJoin`. [`ValidateSet(["CreateOrJoin","RequireExisting"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `Readiness` (`LibTmux.Workspace.WorkspaceReadiness`): Immediate sends input without claiming shell readiness or command completion. Cooperative requires pane startup to signal the channel named by LIBTMUX_WORKSPACE_READY.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `Immediate`. [`ValidateSet(["Immediate","Cooperative"])`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatesetattribute?view=powershellsdk-7.4.0).
- `ReadinessTimeout` (`System.Double`): Each cooperative signal budget in seconds. Accepts finite values from 0.0000001 through 86400.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `10`.
- `CompensateOnFailure` (`System.Management.Automation.SwitchParameter`): Attempt cleanup of journal-proven creations after failure. Shell input and host-script effects are irreversible. Owned readiness channels and replacement keepalives have mandatory cleanup regardless of this switch.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Documented default: `False`.
- `AllowHostScripts` (`System.Management.Automation.SwitchParameter`): Allow a declared before_script to become a native RunHostScript action. Planning does not execute it. Reuse skips it when the existing session can be reused.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Documented default: `False`.
- `HostScriptTimeout` (`System.Double`): The host script deadline, including output collection, in seconds. Accepts finite values from 0.0000001 through 86400.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `30`.
- `MaxHostOutputBytes` (`System.Int32`): The positive combined stdout and stderr capture limit in UTF-8 bytes. Additional output is drained and its dropped byte count remains visible in the native host result.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `1048576`.
- `CleanupTimeout` (`System.Double`): The total failure-cleanup budget in seconds. Accepts finite values from 0.0000001 through 86400. Incomplete or uncertain cleanup remains visible in the native journal.
  Optional. Named parameter. Does not accept pipeline input. Documented default: `1`.
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.

## Returns

`LibTmux.Workspace.WorkspacePlan`: The native immutable plan with its endpoint and ordered actions.
