The CCO template improves over time - new commands, bug fixes, cross-platform support. But if you set it up weeks or months ago by cloning or having Claude build it, you’re probably running old versions of everything.

The /update command solves this going forward: run it whenever you want, it pulls the latest commands and scripts without touching your CLAUDE.md or vault content. The problem is you need /update itself to exist first.

The instructions below are a one-time bootstrap. Paste them into Claude Code, it figures out your current state, gets you current, and from then on just run /update.

Bootstrap instructions: paste into Claude Code

Context

The user has a Claude Code + Obsidian (CCO) vault that was set up from the template at some point in the past. They may have:

  • Cloned the repo directly (origin points to template)
  • Had Claude Code set it up ad-hoc (may not even be a git repo)
  • Copied files manually
  • Any combination of the above

The goal is to get their .claude/commands/ and .claude/scripts/ directories up to date with the latest template, set up a git remote for future updates, and ensure /update works going forward.

The template repository is: https://github.com/OpenCairn/OpenCairn.git

Safety: NEVER modify the user’s CLAUDE.md, vault content (01-07 folders), or .claude/settings*. Only .claude/commands/ and .claude/scripts/ should be touched.

Step 1: Detect Current State

Run these diagnostic commands and analyse the results:

# Are we in a git repo?
git rev-parse --is-inside-work-tree 2>/dev/null && echo "IS_GIT_REPO=true" || echo "IS_GIT_REPO=false"

# What remotes exist?
git remote -v 2>/dev/null || echo "NO_REMOTES"

# Does .claude/commands/ exist?
ls .claude/commands/ 2>/dev/null | head -5 || echo "NO_COMMANDS_DIR"

# Does CLAUDE.md exist?
test -f CLAUDE.md && echo "HAS_CLAUDE_MD=true" || echo "HAS_CLAUDE_MD=false"

# What OS?
uname -s

Based on results, determine which of these states applies:

StateGit repo?Template remote?Action needed
ANoN/AInit repo, add remote, fetch, checkout commands
BYesNo remote points to templateAdd remote, fetch, checkout commands
CYesRemote exists (any name)Fetch, checkout commands

Step 2: Ensure Git Repository

If not a git repo (State A):

git init

Tell the user: “Your vault wasn’t a git repository. I’ve initialised one - this is needed for the update system to work.”

Step 3: Ensure Template Remote

Check if any existing remote URL contains OpenCairn:

git remote -v 2>/dev/null | grep -q "OpenCairn" && echo "HAS_TEMPLATE_REMOTE" || echo "NO_TEMPLATE_REMOTE"

If no remote points to the template (States A or B):

First check if origin exists and what it points to:

git remote get-url origin 2>/dev/null || echo "NO_ORIGIN"
  • If origin doesn’t exist โ†’ git remote add origin https://github.com/OpenCairn/OpenCairn.git
  • If origin exists but points elsewhere โ†’ git remote add template https://github.com/OpenCairn/OpenCairn.git (use template as remote name to avoid conflicts)
  • If origin already points to the template โ†’ use origin

Store the remote name as $REMOTE (either origin, template, or whatever name contains the template URL).

If a remote already points to the template, identify its name:

git remote -v | grep "OpenCairn" | head -1 | awk '{print $1}'

Step 4: Fetch and Detect Branch

git fetch $REMOTE 2>&1

If fetch fails, tell the user to check their internet connection and try again.

Detect the default branch:

git rev-parse --verify $REMOTE/main 2>/dev/null && echo "BRANCH=main" || {
  git rev-parse --verify $REMOTE/master 2>/dev/null && echo "BRANCH=master" || echo "BRANCH_NOT_FOUND"
}

Store as $BRANCH.

Step 5: Preview and Apply Updates

Show the user what will change:

# What files exist in the template?
git ls-tree -r --name-only $REMOTE/$BRANCH -- .claude/commands/ .claude/scripts/

Tell the user how many commands and scripts will be installed/updated.

Apply the update:

# Checkout latest commands and scripts from template
git checkout $REMOTE/$BRANCH -- .claude/commands/ .claude/scripts/

# Ensure scripts are executable
chmod +x .claude/scripts/*.sh 2>/dev/null

# Stage everything
git add .claude/commands/ .claude/scripts/

Step 6: Set Up VAULT_PATH

Check if VAULT_PATH is set:

echo "VAULT_PATH=${VAULT_PATH:-NOT_SET}"

If VAULT_PATH is not set, determine the user’s vault path (it’s the current working directory) and provide OS-appropriate instructions:

Linux:

Add this to your ~/.bashrc (or ~/.zshrc if using zsh):

  export VAULT_PATH="/path/to/your/vault"

Then restart your terminal or run: source ~/.bashrc

macOS:

Add this to your ~/.zshrc:

  export VAULT_PATH="/path/to/your/vault"

Then restart your terminal or run: source ~/.zshrc

Windows (Git Bash / MINGW / MSYS):

Run this in PowerShell (one-time):

  [Environment]::SetEnvironmentVariable("VAULT_PATH", "C:\Users\YourName\path\to\vault", "User")

Then restart your terminal.

Replace the path with the user’s actual vault location (use pwd to determine it).

Step 7: Commit the Bootstrap

# Get template hash for traceability
TEMPLATE_HASH=$(git rev-parse --short $REMOTE/$BRANCH)

# Commit (files were already staged in Step 5)
git commit -m "Bootstrap CCO commands from template ($TEMPLATE_HASH)"

If nothing to commit (already up to date), that’s fine.

Step 8: Verify and Report

Confirm the update worked:

# Verify /update command exists
test -f .claude/commands/update.md && echo "UPDATE_EXISTS=true" || echo "UPDATE_EXISTS=false"

# Count installed commands and scripts
ls .claude/commands/*.md 2>/dev/null | wc -l
ls .claude/scripts/*.sh 2>/dev/null | wc -l

Display a summary to the user:

Bootstrap complete!

  Commands: N installed
  Scripts:  M installed
  Template: $REMOTE ($TEMPLATE_HASH)

  Your CLAUDE.md and vault content were not touched.

What's new:
  /update - run this anytime to pull the latest commands
  (You'll never need to paste bootstrap instructions again)

  Restart Claude Code to use the new commands.
  (Just type /exit and relaunch)

Edge Cases to Handle

  • Checkout fails on dirty files: If git checkout complains about local changes, stage or stash them first (git stash -- .claude/commands/ .claude/scripts/), then retry. Template commands should always win over local modifications.
  • Dirty working tree in other files: Don’t touch anything outside .claude/commands/ and .claude/scripts/. The user may have uncommitted work elsewhere.
  • No CLAUDE.md: If the user doesn’t have a CLAUDE.md, mention they should create one for their vault context, but don’t create it automatically - that’s personalisation, not infrastructure.
  • Windows line endings: Git may convert line endings. This is fine - the commands are markdown and the scripts use #!/usr/bin/env bash.