pi-cmux-clone

Clone the current Pi conversation branch into an independent session in a randomly colored cmux workspace without changing the original session or focus.

Packages

Package details

extension

Install pi-cmux-clone from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-cmux-clone
Package
pi-cmux-clone
Version
0.1.0
Published
Nov 17, 2026
Downloads
333/mo · 333/wk
Author
shengxiao04
License
MIT
Types
extension
Size
14.8 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/cmux-clone.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-cmux-clone

Current version: 0.1.0

Create an independent Pi session from the current active conversation branch in a new cmux workspace. This package is independent of pi-session-memory. It does not use memory configuration, transcript search, or historical Discussion.

Install and use

Requirements:

  • Run Pi inside a cmux terminal. The cmux interface is verified against version 0.65.2.
  • Make cmux and pi available on PATH.
  • Use Pi 0.85.1 or later with persistent session format v3. --no-session is not supported.

Install this local package when you want to enable the command:

pi install "/Users/I604724/My Project/pi-cmux-clone"

In your existing Pi session, run these commands separately:

/reload
/cmux-clone

/cmux-clone takes no arguments. You do not enter a task name or select a color. Each invocation generates a Clone · <short ID> name and randomly selects one of 16 cmux named colors. Colors can repeat.

The copy uses a new session ID and file. The original session ID, active leaf, entries, and source JSONL remain unchanged. The new workspace opens in the caller's window without a focus request. The child uses the current model and thinking level. It waits for your input and does not start a task automatically.

Agent tool

cmux_clone_current provides the equivalent capability with no parameters. Use it only when the user explicitly requests a parallel copy in cmux. It queues one copy until the agent run settles, so the snapshot includes complete tool results. A queued response confirms the request, not workspace creation or Pi startup.

Invocation relationship

extensions/cmux-clone.ts
├── /cmux-clone
│   └── Wait until the agent is idle
│       └── Clone into a workspace
├── cmux_clone_current
│   └── Queue the source session ID
└── agent_settled
    └── Consume the queued request
        └── Clone into a workspace
            ├── Validate the cmux caller and Pi CLI
            ├── Write the active branch to a new session JSONL
            └── Create a workspace with --focus false
                ├── Request Pi startup with the new session
                └── Set a randomly selected workspace color

The snapshot retains active-branch entries and compaction references. It adds the new name and any resolved label changes for active-branch entries. A sibling branch can change those labels, but its messages are not copied. The source session manager is read-only throughout the operation.

Limits and errors

Both sessions share the project directory. Session isolation does not isolate files or restore earlier project files. Use separate Git worktrees if you need file isolation. The child reloads its normal Pi configuration and extensions. This package does not copy transient extension state.

Unavailable CLIs, invalid caller context, unsupported session formats, and failed cmux actions raise errors without retries or fallback. Preflight failures do not write a snapshot. A failed workspace operation retains the new session file and reports its path and any returned workspace UUID.

The success notice confirms workspace creation and coloring. It does not confirm that the child Pi process is healthy. The package does not send terminal input, switch the original session, or select the new workspace.

Project structure

pi-cmux-clone/
├── extensions/cmux-clone.ts   Command, tool, snapshot, and cmux integration
├── tests/cmux-clone.test.ts   Session and execution tests
├── package.json              Independent Pi package manifest
├── package-lock.json         Local dependency versions
├── CHANGELOG.md              Native Pi Extension Updates notes
└── LICENSE

Development verification

npm ci --ignore-scripts
npm test
npm pack --dry-run

Tests use the real Pi session manager and extension loader, with mocked cmux execution. They cover active-branch isolation, resolved labels, compaction, deferred disk writes, shell quoting, colors, focus flags, queued tools, and explicit errors. Tests do not create real workspaces, clone your conversation, or send model requests. The package manifest publishes only the extension, documentation, and license. It contains no dependency on another local project.