Workspace Commands
Create and manage isolated workspaces for agent work.Overview
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, etc.)
- Is located at
{project}/workspaces/{issue-id}/
pan workspace create
Create a new workspace (git worktree) without starting an agent:Docker Integration
The--docker flag automatically starts containers after workspace creation:
- Creates the workspace (git worktree or custom command)
- Looks for docker-compose files in:
{workspace}/docker-compose.yml{workspace}/docker-compose.yaml{workspace}/.devcontainer/docker-compose.yml{workspace}/.devcontainer/docker-compose.devcontainer.yml{workspace}/.devcontainer/compose.yml
- Runs
docker compose -p "{project}-feature-{issue}" -f {file} up -d --build
- Format:
{project-name}-feature-{issue-id}(e.g.,mind-your-now-feature-min-123) - The project name comes from
namein your~/.panopticon/projects.yaml - Container names follow:
{project}-{service}-1(e.g.,mind-your-now-feature-min-123-api-1)
- Containers start warming up while you review the issue
- Environment is ready when the planning agent starts asking questions
- You can test assumptions during planning without waiting for builds
- Default: Enabled (containers start automatically)
- Preference saved: Your choice is remembered in browser localStorage
- Key:
panopticon.planning.startDocker
pan workspace list
List all workspaces and their status:pan workspace destroy
Clean up and remove a workspace:Main Project Branch Convention
IMPORTANT: The main project directory should ALWAYS stay on themainbranch. All feature work happens in workspaces (git worktrees), never in the main project.This convention ensures:
- Main project: Always on
main- serves as the stable reference point- Workspaces: Each has its own feature branch checked out
- Want to check something? Create a worktree, don’t checkout in main
- Quick test? Create a worktree
- Emergency hotfix? Create a worktree
If you see a warning like “Main project is on branch ‘feature/xxx’ instead of ‘main’”, something has incorrectly checked out a feature branch in the main project. Fix it with
- Specialists (review-agent, test-agent) always find the correct code
- Merge operations have a clean target
- Multiple agents don’t interfere with each other
git checkout main.
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 are installed when registering a new project - On
pan sync- Hooks are updated in all registered projects
- Agents & planning sessions: Automatically revert to
mainif they accidentally checkout a feature branch - Human users: Display a prominent warning (no auto-revert by default)
Workspace Structure
Workspaces include planning artifacts stored inside the workspace directory:⚠️ Note:When the planning session 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. See #111 for the future enhancement to support cross-machine planning sync safely.
- STATE.md - Current understanding, decisions made, and implementation plan
- Beads tasks - Trackable sub-tasks with dependencies for the implementation
- Feature PRD - Copied to
docs/prds/active/{issue}-plan.mdfor documentation
- Context recovery - If Claude’s context compacts, STATE.md and beads preserve the planning decisions
- Audit trail - See decisions made in STATE.md
- Beads tasks - Sub-tasks created during planning ARE persisted (beads uses label-based isolation)
Safeguards
Planning vs Work Agent Safeguard
The dashboard prevents starting a work agent (agent-<issue>) while a planning agent (planning-<issue>) is still running for the same issue. This prevents conflicts where both agents try to modify the same workspace.
If you see “Planning agent is still running” when trying to start work:
- Complete the planning session - Use “Complete Planning” button
- Or abort planning - Use “Abort Planning” if you want to discard
- Or kill the session 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 the main project directory
- Never checkout branches - They work with the branch already in the workspace
- Create workspaces if needed - Use
pan workspace create <ISSUE-ID>instead 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