You are setting up Git worktrees with DevContainers for the cognitive-memory-mcp project. This creates 5 parallel development environments (dev, product, docs, operations, marketing) with isolated Docker containers sharing a Neo4j database.
Repository: https://github.com/harrymower/cognitive-memory-mcp
# Verify these are installed:
docker --version # Docker Desktop must be running
git --version # Must be 2.30+
code --version # VS Code with Dev Containers extension
gh --version # GitHub CLI# Set your root folder (adjust as needed)
ROOT_FOLDER="$HOME/CodingProjects" # Mac/Linux
# ROOT_FOLDER="D:\CodingProjects" # Windows
# Create directories
mkdir -p "$ROOT_FOLDER/cognitive-memory/cognitive-memory-main"
mkdir -p "$ROOT_FOLDER/cognitive-memory/cognitive-memory-worktrees"
# Clone repository
cd "$ROOT_FOLDER/cognitive-memory/cognitive-memory-main"
git clone https://github.com/harrymower/cognitive-memory-mcp .# Fetch and checkout all branches
git fetch --all
for branch in dev product docs operations marketing; do
git checkout $branch
done
git checkout main
# Create worktrees
for branch in dev product docs operations marketing; do
git worktree add "../cognitive-memory-worktrees/$branch" "$branch"
done
# Verify
git worktree list# Create .vscode/settings.json in main repo
mkdir -p .vscode
cat > .vscode/settings.json << 'EOF'
{
"actionButtons": {
"defaultColor": "#00D4FF",
"loadNpmCommands": false,
"reloadButton": "♻️",
"commands": [
{
"name": "🤖 Claude Regular",
"color": "#00D4FF",
"command": "claude-normal",
"tooltip": "Start Claude Code with permission prompts"
},
{
"name": "⚡ Claude DANGER",
"color": "#FF4444",
"command": "claude-danger",
"tooltip": "⚠️ Start Claude Code WITHOUT permission prompts!"
}
]
}
}
EOF# Copy devcontainer and vscode configs to all worktrees
for worktree in dev product docs operations marketing; do
cp -r .devcontainer "../cognitive-memory-worktrees/$worktree/"
cp -r .vscode "../cognitive-memory-worktrees/$worktree/"
done# Create .env in main repo
cat > .env << 'EOF'
# Neo4j Configuration
NEO4J_URI=bolt://localhost:7688
NEO4J_USER=neo4j
NEO4J_PASSWORD=cognitive123
# API Keys
ANTHROPIC_API_KEY=your_key_here
# MCP Server Configuration
MCP_SERVER_PORT=3000
MCP_LOG_LEVEL=info
EOF
# Copy to all worktrees
for worktree in dev product docs operations marketing; do
cp .env "../cognitive-memory-worktrees/$worktree/.env"
done# Add CLAUDE.md to .gitignore
echo "CLAUDE.md" >> .gitignore
git add .gitignore
git commit -m "Add CLAUDE.md to .gitignore for per-developer customization"# If project uses Neo4j
cd neo4j
docker-compose up -d
cd ..cat > scripts/setup-all.sh << 'SCRIPT'
#!/bin/bash
ROOT_FOLDER=${1:-~/CodingProjects}
cd "$ROOT_FOLDER/cognitive-memory/cognitive-memory-main"
# Fetch and create worktrees
git fetch --all
for branch in dev product docs operations marketing; do
git checkout $branch
git worktree add "../cognitive-memory-worktrees/$branch" "$branch" 2>/dev/null || true
done
git checkout main
# Deploy configs
for worktree in dev product docs operations marketing; do
cp -r .devcontainer "../cognitive-memory-worktrees/$worktree/"
cp -r .vscode "../cognitive-memory-worktrees/$worktree/"
[ -f .env ] && cp .env "../cognitive-memory-worktrees/$worktree/.env"
done
echo "Setup complete!"
git worktree list
SCRIPT
chmod +x scripts/setup-all.sh# 1. Check worktrees
git worktree list # Should show 6 entries (main + 5 worktrees)
# 2. Check Docker
docker ps # Docker should be running
# 3. Check Neo4j (if applicable)
docker ps | grep neo4j
# 4. Test DevContainer
cd "../cognitive-memory-worktrees/dev"
code .
# In VS Code: F1 -> "Dev Containers: Rebuild Container"Ensure these files exist in .devcontainer/:
devcontainer.jsondocker-compose.ymlDockerfilepostCreateCommand.shsmart-git-setup.shgit-main.shstart-claude-with-env.shstart-claude-dangerous.sh
- CLAUDE.md: Create your own in each worktree (it's gitignored)
- API Keys: Update .env with your actual ANTHROPIC_API_KEY
- Claude Desktop Mount: Optionally add to docker-compose.yml:
# Windows: Adjust username - C:\Users\YOUR_USERNAME\AppData\Roaming\Claude:/claude:ro # Mac - ~/Library/Application Support/Claude:/claude:ro
# Mac/Linux
curl -o setup.sh https://raw.githubusercontent.com/harrymower/cognitive-memory-mcp/main/scripts/setup-all.sh && bash setup.sh ~/CodingProjects
# Windows (PowerShell as Admin)
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/harrymower/cognitive-memory-mcp/main/scripts/setup-all.bat" -OutFile setup.bat; .\setup.bat D:\CodingProjects# If "not a git repository" error:
bash .devcontainer/smart-git-setup.sh
# For fetch/pull/push:
git-main fetch
git-main pull
git-main push# Fix npm permissions
sudo chown -R $(whoami) ~/.npm
# Fix docker permissions
sudo usermod -aG docker $USER
newgrp docker# Clean rebuild
docker-compose -f .devcontainer/docker-compose.yml down -v
docker-compose -f .devcontainer/docker-compose.yml build --no-cache- All 5 worktrees created
- DevContainers build without errors
- Git operations work in containers
- Action buttons appear in VS Code
- Claude Code runs successfully
- Open each worktree in VS Code
- Start DevContainer (F1 -> Reopen in Container)
- Create your personal CLAUDE.md
- Test Claude Code with action buttons
- Begin development!