agentleFS
flyer103flyer103/skills/jj-workspace/SKILL.md

jj-workspace

Skill1 starsChanged 5 months agoMITView on GitHub

Jujutsu (jj) workspace management for AI Agents — create, use, and clean up isolated working copies with immutable Change IDs and shared operation log. Use when working in jj repos or migrating from git worktree.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Solution: Use jj commands for change operations (jj new, jj describe), use git commands only for push/pull.

    line 186
  2. Very specific:

    Symptom: After jj workspace forget, Change ID still exists in the operation log.

    line 189
  3. Very specific:

    Symptom: After jj commit, @ moves to (empty) state.

    line 198

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Jujutsu Workspace — Agent Workspace Isolation

Agents use jj workspace to safely work in parallel within Jujutsu (jj) repositories. jj workspace eliminates branch binding, shares an operation log, and has immutable Change IDs for life — making it more suitable for agent operations than git worktree.

Triggers

  • Agent needs to work in parallel within a jj-managed repository
  • Agent needs stable commit references (unchanged across rebases)
  • Migrating from git worktree to jj workspace
  • Multiple agents share the same repository and need independent workspaces
  • User mentions "jj workspace", "jj working copy", "Change ID"

Requirements

  • jj >= 0.35.0 (recommended) — 0.6.0+ usable, 0.35+ includes per-workspace config and colocated conversion
  • Verify: jj --version
  • Git-compatible backend (automatic): jj manipulates Git objects via the Gitoxide library

Core Concepts

ConceptDescription
Change IDImmutable logical change identifier (e.g., poqntkqy), unchanged after rebase
Commit IDMutable commit identifier (similar to Git SHA)
Operation LogImmutable append-only record of all operations, supports jj undo for arbitrary rollback
Working-copy commit (@)The working copy is auto-tracked as a commit; no staging area

Lifecycle

1. Initialization (first-time jj usage)

# Initialize on top of an existing git repo (colocated = .jj/ + .git/ coexist)
jj git init --colocate

# Or pure jj repository
jj git init

2. Create Workspace

# Agent recommended pattern: name by task ID
jj workspace add --name "task-${TASK_ID}" "<path>"

# Create based on a specified revision
jj workspace add --name "feature-x" --revision main "@path"

# Specify sparse patterns
jj workspace add --name "sparse-ws" --sparse-patterns copy <path>

3. Use Workspace

cd <workspace-path>
# Create a new change
jj new -m "Implement feature"
# Edit files...
# Describe the change
jj describe -m "Complete feature implementation"
# Check status
jj st

4. List & Status

jj workspace list              # All workspaces
jj workspace root              # Root path of current workspace
jj workspace root --name <n>   # Root path of specified workspace

5. Stale Recovery

# When another workspace has modified the current workspace's working-copy
jj workspace update-stale
# Auto-snapshots current changes → updates to new commit → creates recovery commit (if needed)

6. Cleanup

# Forget workspace (repo stops tracking, files remain)
jj workspace forget <name>

# Delete disk files
rm -rf <workspace-path>

Recommended Patterns for Agents

Per-Task Workspace

TASK_ID="t_8894c1db"
WS_PATH="./workspace-${TASK_ID}"

# Create
jj workspace add --name "task-${TASK_ID}" "$WS_PATH"
cd "$WS_PATH"

# Work
jj new -m "Task ${TASK_ID}: research"
# ... edit ...
jj describe -m "Task ${TASK_ID}: complete"

# Clean up after completion
jj workspace forget "task-${TASK_ID}"
rm -rf "$WS_PATH"

Multi-Agent Parallel Pattern

# Agent 1: create workspace + independent work
jj workspace add --name agent-1 ./workspace-agent-1
cd ./workspace-agent-1
jj new -m "Agent 1 task"
# ... work ...

# Agent 2: create another workspace (parallel, no lock contention)
jj workspace add --name agent-2 ./workspace-agent-2
cd ./workspace-agent-2
jj new -m "Agent 2 task"
# ... work ...

# Agent 1 needs to sync Agent 2's changes
jj workspace update-stale  # Non-destructive sync

# Cross-workspace reference (Change ID unchanged)
jj edit <change-id-from-agent-2>

Migrating from Git Worktree

# Old way (git worktree)
git worktree add ../task-1 -b wt/task-1

# New way (jj workspace)
jj git init --colocate                    # One-time initialization
jj workspace add --name task-1 ../task-1  # Subsequent usage

Concurrency Safety

Featuregit worktreejj workspace
Branch bindingRequired (each worktree bound to unique branch)None (each workspace has independent @)
Lock mechanismgit worktree lockNo lock needed (op log append-only)
Conflict modelBlocks workspace (<<< === >>>)In-commit markers × (conflict), non-blocking
Stale detectionNo built-injj workspace update-stale
Rollbackgit reflog + reset --hard (destructive)jj op log + jj undo (redoable)

Cross-Workspace References

# Stable reference via Change ID (unchanged across rebases)
jj edit <change-id>        # Switch to specified change
jj new <change-id>         # Create new change based on specified change
jj diff --from <id1> --to <id2>  # Compare two changes

# View working-copy of all workspaces
jj log -r 'working_copies()'

Pitfalls

1. Stale Working Copy

Symptom: Command reports "working copy is stale" when run. Cause: Another workspace modified the current workspace's working-copy commit. Solution: jj workspace update-stale (non-destructive, automatically preserves uncommitted changes).

2. Colocated Mode Caveats

Symptom: jj and git commands behave differently in the same directory. Cause: In colocated mode, .jj/ and .git/ coexist; Git is unaware of jj's change model. Solution: Use jj commands for change operations (jj new, jj describe), use git commands only for push/pull.

3. Change ID Reference Lifecycle

Symptom: After jj workspace forget, Change ID still exists in the operation log. Cause: forget only removes workspace tracking, does not delete the commit. Solution: To fully delete, use jj abandon <change-id>.

4. Workspace Disk Leakage

Symptom: Abandoned workspace directories accumulate (100 MB–2 GB+ each). Solution: Implement a two-phase cleanup: jj workspace forget <name> && rm -rf <path>.

5. Empty Commit Causes @ Drift

Symptom: After jj commit, @ moves to (empty) state. Cause: jj's auto-snapshot has already captured all changes before the commit. Solution: jj bookmark set main -r <parent> --allow-backwards.

Quick Reference

OperationCommand
Create workspacejj workspace add --name <name> <path>
List workspacesjj workspace list
Renamejj workspace rename <new>
Forgetjj workspace forget <name>
Recover stalejj workspace update-stale
Root pathjj workspace root [--name <name>]
Create changejj new -m "<description>"
Edit changejj edit <change-id>
Describe changejj describe -m "<description>"
Check statusjj st
View logjj log
Undo operationjj undo
Push to Gitjj git push

Sources

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.