Workspaces
Workspaces provide isolated development environments for each issue, enabling multiple agents to work on different features simultaneously without conflicts.What Are Workspaces?
Workspaces are git worktrees - isolated working directories for each issue/feature. Each workspace:- Has its own feature branch (e.g.,
feature/min-123-add-login) - Shares git history with the main repo (no separate clone)
- Can run independently (separate node_modules, builds, containers)
- Is located at
{project}/workspaces/{issue-id}/
Why Workspaces?
Without workspaces:- Only one agent can work at a time (shared working directory)
- Branch switching disrupts running agents
- Can’t test multiple features simultaneously
- Risk of cross-contamination between issues
- Multiple agents work in parallel on different issues
- Each has its own branch, dependencies, and containers
- Complete isolation - no shared state
- Clean, predictable environment per issue
Architecture
Git Worktrees
Git worktrees allow multiple working directories to share a single git repository. Benefits: Efficiency:- No need to clone the repo multiple times
- Shared git history and objects (saves disk space)
- Fast branch switching (just create a new worktree)
- Each worktree has its own checked-out branch
- Changes in one worktree don’t affect others
- Can build/test multiple branches simultaneously
- Can’t accidentally checkout the same branch twice
- Main project stays on
mainbranch (protected) - Feature work isolated to dedicated worktrees
Workspace Structure
Planning Artifacts
⚠️ Note:When planning completes, the AI generates:.planning/is currently ephemeral (not tracked in git) The.planning/directory is listed in.gitignoreto prevent cross-contamination between issues. When branches merge, planning state from issue A could contaminate issue B’s workspace, causing agents to work on the wrong tasks. Current behavior: Planning state is local to your machine only. If you switch machines, you’ll need to re-run the planning session.
- STATE.md - Current understanding, decisions made, and implementation plan
- Beads tasks - Trackable sub-tasks with dependencies
- Feature PRD - Copied to
docs/prds/active/{issue}-plan.mdfor documentation
- Context recovery - STATE.md and beads preserve planning decisions
- Audit trail - See decisions made in STATE.md
- Beads tasks - Sub-tasks ARE persisted (beads uses label-based isolation)
Docker Integration
Workspaces can have independent Docker environments, allowing:- Isolated databases per feature
- Independent service configurations
- No port conflicts (unique project names)
Starting Containers with Workspaces
- Creates the workspace (git worktree)
- Looks for docker-compose files in workspace
- Runs
docker compose -p "{project}-feature-{issue}" up -d --build
- Format:
{project-name}-feature-{issue-id} - Example:
mind-your-now-feature-min-123 - Container names:
{project}-{service}-1
Dashboard Integration
The planning dialog includes a “Start Docker containers” checkbox:- Default: Enabled (containers start automatically)
- Preference saved: Your choice is remembered in browser localStorage
- Containers start warming up while you review the issue
- Environment ready when planning agent starts
- Can test assumptions during planning without waiting
Workspace Lifecycle
1. Creation
- Creates git worktree at
{project}/workspaces/feature-min-123/ - Checks out feature branch
feature/min-123-* - Optionally starts Docker containers
- Registers workspace in Panopticon registry
2. Usage
Agents work inside the workspace:- Planning agents - Explore codebase, create STATE.md and beads tasks
- Work agents - Implement features, run tests, commit changes
- Specialists - Review code, run tests, merge changes
3. Cleanup
- Stops and removes Docker containers (if any)
- Checks for uncommitted changes (unless —force)
- Removes git worktree
- Cleans up planning artifacts
- Unregisters from Panopticon
Main Project Branch Convention
CRITICAL: The main project directory must ALWAYS stay on the main branch. All feature work happens in workspaces.
Why this matters:
- Specialists (review-agent, test-agent) need a stable reference point
- Merge operations require a clean target
- Multiple agents won’t interfere with each other
Git Hooks for Branch Protection
Panopticon provides git hooks to enforce the main branch convention. These hooks are automatically installed:- On
pan project add- Hooks installed when registering project - On
pan sync- Hooks updated in all registered projects
- Agents & planning sessions: Automatically revert to
mainif they accidentally checkout a feature branch - Human users: Display prominent warning (no auto-revert by default)
Safeguards
Planning vs Work Agent Safeguard
The dashboard prevents starting a work agent (agent-<issue>) while a planning agent (planning-<issue>) is still running. This prevents conflicts where both agents try to modify the same workspace.
If you see “Planning agent is still running”:
- Complete planning - Use “Complete Planning” button
- Or abort - Use “Abort Planning” to discard
- Or kill manually -
tmux kill-session -t planning-<issue>
Specialist Agent Safeguards
All specialist agents (review-agent, test-agent, merge-agent) are configured to:- Run in workspaces only - Never in main project directory
- Never checkout branches - Work with branch already in workspace
- Create workspaces if needed - Use
pan workspace createinstead ofgit checkout
- Prompt instructions - Clear warnings in all specialist prompts
- Code enforcement - Specialists spawn with workspace as cwd
- Git hooks - Auto-revert if checkout detected in tmux sessions
Use Cases
Feature Development:Best Practices
Workspace Management:- Create workspace before starting work (don’t checkout in main project)
- One workspace per issue (don’t reuse for multiple issues)
- Clean up completed workspaces to free disk space
- Use
--dockerflag to warm up containers early
- Follow convention:
feature/{issue-id}-{description} - Example:
feature/min-123-add-login - Panopticon auto-generates appropriate names
- Use unique container names via project naming
- Clean up containers when destroying workspace
- Keep docker-compose.yml in workspace (not main project)
.planning/is ephemeral - don’t rely on it for cross-machine work- STATE.md and beads persist the important context
- Feature PRD goes to
docs/prds/active/for permanent storage
Troubleshooting
Workspace creation fails:Related Guides
- Workspace Commands - CLI reference
- Specialists - Specialist agent workspace usage
- Planning Session - Using workspaces for planning