branch
Create or switch branches with auto-generated context refs
Branch
Create or switch branches while maintaining context reference files in .ccs/branches/.
Steps
1. Detect intent
Parse input:
create <name> "<purpose>"→ create new branch<name>orswitch <name>→ switch to branchlist→ show all branches with ref statusclean→ remove stale refs for deleted branches
2. Load context
- Read
.ccs/file-index.mdfor dependency impact analysis - Glob
.ccs/branches/*.mdfor existing branch refs - Run
git branch -afor current branch state
3. Execute
Create:
- Record parent branch, then
git checkout -b <name> - Record merge-base:
git merge-base HEAD <parent> - Create
.ccs/branches/if needed - Generate
.ccs/branches/<name>.md: parent, created date, status, purpose, empty files/commits/deps sections
Switch:
- If
.ccs/branches/<name>.mdexists → read and display summary - If missing → generate from git state (
git log,git diff --statvs main) - Run
git checkout <name>
List:
git branch -a+ check each for.ccs/branches/<name>.md- Display: branch name, has ref (yes/no), last commit, status
Clean:
- Compare active branches (
git branch) with.ccs/branches/*.md - Delete refs where branch no longer exists
4. Log to .ccs/task.md
Append using template at .claude/skills/_ccs/templates/task-template.md: action, branch, parent, purpose, ref file path.
Rules
- Read branch ref FIRST before exploring source files
- Never re-scan codebase to understand a branch — the ref has context
- Keep branch refs under 100 lines
- Does not push → use
/ccs-sync push - Does not create PRs → use
/ccs-pr
Refs
- Branch refs:
.ccs/branches/ - File index:
.ccs/file-index.md - Task template:
.claude/skills/_ccs/templates/task-template.md
10x-Code v2.0.0