Initialize context branch methodology on a new or existing repository
Sets up a bare repository with context branch methodology for AI-assisted development.
/plugin marketplace add iknite/claude-code-marketplace/plugin install worktree-context@iknite-cc-marketplacerepo-pathSet up the separation of concerns structure for AI context and project code.
Repository at: ${1:-.} (current directory if not specified)
All worktrees live inside a /root folder within the bare repository:
bare-repo/
└── root/
├── context/ # context branch (AI configuration)
│ ├── CLAUDE.md
│ ├── .claude/
│ ├── .gitignore # Contains: worktree/**/
│ └── worktree/ # All code worktrees here
│ └── feature/...
└── master/ # master/main branch (direct access)
If the repo is not bare:
# Clone as bare
git clone --bare <repo-url> <repo-name>
cd <repo-name>
mkdir -p root
# Detect default branch name
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || git branch -l main master 2>/dev/null | head -1 | tr -d '* ')
git worktree add root/$DEFAULT_BRANCH $DEFAULT_BRANCH
# Create orphan branch
git checkout --orphan context
git reset --hard
git commit --allow-empty -m "init: context branch for AI configuration"
# Add as worktree
git worktree add root/context context
In root/context/, create:
CLAUDE.md - Basic project instructions template.gitignore - With worktree/**/ to ignore nested worktrees.claude/ directory for commands, agents, skillsworktree/ directory for code worktreesgit worktree list
Expected output:
/path/to/bare-repo (bare)
/path/to/bare-repo/root/context [context]
/path/to/bare-repo/root/master [master]
Provide clear next steps:
cd root/context to work with AI configuration/wt-new feature/name to create feature worktreesroot/context/worktree/root/master/ directly - use worktrees instead