Using jj workspaces

From edmundmiller/dotfiles · View interactive version

Using jj workspaces is an AI agent skill from the GitHub repository edmundmiller/dotfiles. Creates or records isolated jj agent workspaces. Use when starting jj task work, entering a Rex or Herdr workspace, or handling an agent-created Git worktree boundary.

How to use this skill

Skill file

Using jj workspaces

Choose one workspace owner; never create a second workspace for the same task.

Start

First confirm the current checkout is a jj repository:

jj root --ignore-working-copy

Inside Rex

Use the version-control skill's workspaces reference. Rex's rex-jj

helper owns creation and receipts. In a Rex-created task, read

.jj/rex-session.json and reuse its receiptPath instead of creating another

workspace. Keep Herdr's bindings and bootstrap out of Rex sessions.

Inside Herdr

Native Herdr opens existing checkouts but does not provide the retired jj lifecycle bindings. If this is already a task workspace, record it without --workspace:

hey agent-start \
  --repo "$PWD" \
  --task my-task \
  --runtime "$AGENT"

Otherwise use the deterministic launcher below, then open that checkout with herdr-dev open /path/to/workspace. Do not create another workspace from the new agent session. Native Herdr does not replace guarded jj cleanup; preserve the receipt and defer unsupported lifecycle operations.

Create a workspace

Use the deterministic launcher to create and record the workspace:

hey agent-start \
  --repo "$PWD" \
  --workspace "../workspaces/my-task" \
  --base 'trunk()' \
  --task my-task \
  --runtime "$AGENT"

Both forms print one JSON receipt. Save its receiptPath for done. Without --workspace, the launcher records the current workspace.

The launcher:

Git worktree boundary

Agent runtimes such as Codex Desktop can create Git worktrees before the agent starts. Do not run jj git init --colocate inside one: nested metadata would not safely convert the primary repository. Finish that task with Git. Initialize jj once from the primary checkout in a separate task; later agents can use jj workspaces from that repository.

Workspace model

Stay on one task per workspace. Read other changes with jj diff -r, jj file show -r, and jj log -r; do not use jj edit merely to inspect.

Verify

jj workspace list
jj status
jj log -r '@-::@ | trunk()'

Run the repository's baseline checks before editing. If they fail, record the failure in the receipt/worklog and do not attribute it to the task.

Finish

Use the global done skill. It shapes the task, rebases only its explicit range, publishes the task workspace's explicit bookmark, proves remote equality, records the receipt, and cleans this workspace last.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.