Skip to content
jj-workspace-experiments logo

Jj Workspace Experiments

jj-workspace-experiments

Create isolated jj workspaces for testing changes, running experiments in parallel, and exploring alternative implementations. Use when testing breaking changes, comparing different approaches, or running long-running operations without blocking other work. (project)

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

Jj Workspace Experiments

Overview

Create isolated jj workspaces in the work/ directory to test changes, run experiments concurrently, and explore alternative implementations without affecting the main workspace. All workspaces share the same repository history, enabling seamless switching and comparison between approaches.

When to Use

Use this skill when:

  • Testing breaking changes or refactors that might not work
  • Comparing multiple implementation approaches side-by-side
  • Running long-running tests or builds without blocking other work
  • Exploring alternative solutions to a problem concurrently
  • Testing changes that require extensive experimentation
  • Working on multiple independent features simultaneously

Core Workflows

Single Experiment Workspace

Create a workspace to test changes in isolation.

1. Create the Workspace
jj workspace add --name=<experiment-name> work/<directory-name>

Examples:

# Test a refactoring
jj workspace add --name=async-refactor work/​async-refactor

# Try a different architecture
jj workspace add --name=new-db-layer work/​new-db-layer

# Experiment with a breaking change
jj workspace add --name=api-v2 work/​api-v2

The workspace starts from the current commit (@) by default. To start from a different commit:

jj workspace add --name=<name> -r <revision> work/<directory>
2. Work in the Workspace

Navigate to the workspace and make changes:

cd work/<directory-name>

# Make changes, run tests, build
# Commits created here are isolated to this workspace

Changes are visible from the main workspace via jj log - all workspaces share the repository history.

3. Evaluate and Decide

After testing:

If successful: Merge the changes back to the main branch:

# From main workspace
jj rebase -s <experiment-name>@ -d @

If unsuccessful: Simply forget the workspace:

jj workspace forget <experiment-name>
rm -rf work/<directory-name>

The commits remain in the repository history but can be abandoned if needed.

Parallel Experiments

Test multiple approaches simultaneously by creating multiple workspaces.

1. Create Multiple Workspaces
# Create first approach workspace
jj workspace add --name=approach-a work/​approach-a

# Create second approach workspace
jj workspace add --name=approach-b work/​approach-b

# Create third approach workspace (optional)
jj workspace add --name=approach-c work/​approach-c

Each workspace starts from the same commit, creating parallel branches of development.

2. Implement Different Approaches

Work in each workspace independently:

# Terminal 1: Implement approach A
cd work/​approach-a
# Make changes...

# Terminal 2: Implement approach B
cd work/​approach-b
# Make changes...

# Terminal 3: Implement approach C
cd work/​approach-c
# Make changes...
3. Compare Results

From the main workspace, compare implementations:

# View all workspace changes
jj log -r 'working_copies()'

# Compare approach A to approach B
jj diff -r approach-a@ -r approach-b@

# View specific workspace state
jj show approach-a@
4. Choose Winner and Clean Up

Select the best approach and merge it:

# Merge winning approach
jj rebase -s approach-b@ -d @

# Forget the other workspaces
jj workspace forget approach-a
jj workspace forget approach-c

# Clean up directories
rm -rf work/​approach-a work/​approach-c

Long-Running Operations

Use a workspace to run long builds/​tests without blocking other work.

1. Create Workspace for Long Operation
jj workspace add --name=test-run work/​test-run
2. Start Long Operation
cd work/​test-run

# Start long-running operation
buck2 test //... &
3. Continue Work Elsewhere

While the operation runs, work normally in the main workspace:

cd $REPO_ROOT  # Back to main workspace
# Continue development normally
4. Check Results When Ready

Return to the test workspace to check results:

cd work/​test-run
# Check test results, build artifacts, etc.

Advanced Patterns

Testing Changes on Different Base Commits

Create workspaces from different commits to test compatibility:

# Test on current commit
jj workspace add --name=current-test work/​current-test

# Test on older commit
jj workspace add --name=backport-test -r @-- work/​backport-test

# Test on main branch
jj workspace add --name=main-test -r main work/​main-test

Darcs-Style Multiple Workspaces

Create a sparse main workspace with all real work in sub-workspaces:

# Make main workspace sparse (only work/ directory)
jj sparse set --clear --add work

# Create multiple workspaces for different tasks
jj workspace add work/​feature-a
jj workspace add work/​feature-b
jj workspace add work/​bugfix-123

Now the main workspace is empty, but work/ contains multiple full checkouts that all share the repository history.

Workspace as Scratch Space

Create temporary workspaces for quick experiments:

# Create scratch workspace
jj workspace add --name=scratch work/​scratch

cd work/​scratch
# Experiment freely without concern

# When done, forget it
jj workspace forget scratch
rm -rf work/​scratch

Best Practices

Naming Conventions

Use descriptive names that indicate purpose:

  • Experiments: sqlite-vs-postgres, algorithm-a, refactor-v2
  • Features: feature-auth, feature-search
  • Tests: test-integration, perf-benchmark
  • Scratch: scratch, temp-experiment

Workspace Lifecycle

  1. Create workspace with clear purpose
  2. Work in isolation until complete or failed
  3. Evaluate results and make decision
  4. Merge successful work or forget failed attempts
  5. Clean up directories after forgetting

Managing Multiple Workspaces

List active workspaces regularly:

jj workspace list

Keep track of workspace purposes in notes or commit messages.

Resource Considerations

Each workspace is a full working copy, consuming disk space. Clean up unused workspaces promptly.

Workspace Commands Reference

# Create workspace from current commit
jj workspace add --name=<name> work/<dir>

# Create workspace from specific revision
jj workspace add --name=<name> -r <rev> work/<dir>

# List all workspaces
jj workspace list

# Forget workspace (keeps commits, removes workspace reference)
jj workspace forget <name>

# View all workspace commits
jj log -r 'working_copies()'

# Reference a workspace's current commit
<workspace-name>@

Limitations

  • Disk space: Each workspace is a full working copy
  • Manual cleanup: Must remember to forget and remove old workspaces
  • Coordination: When working in multiple workspaces, ensure you're in the correct directory
  • Build artifacts: Each workspace has its own build outputs, which can consume significant space

Related Skills

  • jj-clone-third-party - For examining external repositories
  • jj-graft-third-party - For integrating third-party repository history

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View