A repository for managing Claude Code settings — both global and home-level.
Syncs via file copy through a script — no symlinks.
| Repo Path | Local Path | Purpose |
|---|---|---|
CLAUDE.md |
~/.claude/CLAUDE.md |
Global behavior instructions (applied to all projects) |
settings.json |
~/.claude/settings.json |
Global model, permissions, hooks settings |
home/CLAUDE.md |
~/home/CLAUDE.md |
Home-level project instructions |
home/settings.json |
~/home/.claude/settings.json |
Home-level permissions |
home/*.md (auto) |
~/home/*.md |
Knowledge files (auto-discovered, excluding CLAUDE.md) |
git clone [email protected]:WoojinAhn/claude-config.git ~/path/to/claude-config
cd ~/path/to/claude-config
./sync.sh setupsetup will:
- Show diff between repo and local for each managed file
- Ask whether to overwrite each file (local file is backed up as
*.bak) - Create directories if needed (
~/home/.claude/, etc.) - Install
push-config.shinto~/.claude/(used by the auto-push hook)
# Show diff between repo and local
./sync.sh diff
# Pull: remote -> local (also reinstalls push-config.sh)
./sync.sh pull
# Push: local -> remote (manual)
./sync.sh push
# Check sync status
./sync.sh statussequenceDiagram
participant A as Machine A
participant R as GitHub Remote
participant B as Machine B
Note over A: Claude Code session<br/>(Write/Edit happens)
A->>A: PostToolUse hook triggers<br/>push-config.sh
A->>A: Detect changed files<br/>(diff local vs repo)
A->>R: git commit & push
Note over B: New Claude Code session starts
B->>R: SessionStart hook triggers<br/>sync.sh pull → git fetch
R->>B: Changes detected → git pull
B->>B: Copy repo files → local paths
On new session startup, the SessionStart hook runs sync.sh pull. It fetches from remote, pulls if there are new commits, and always copies repo files to local — so missing local files are restored even if git is already up to date.
flowchart TD
A([sync.sh pull]) --> B[git fetch]
B --> C{New commits?}
C -- Yes --> D[git pull --rebase]
C -- No --> E[Skip git pull]
D --> F[Build SYNC_PAIRS]
E --> F
F --> G[For each pair: repo file exists?]
G -- Yes --> H{Diff from local?}
H -- Changed / Missing --> I[cp repo → local]
H -- Same --> J[Skip]
G -- No --> J
I --> K([Done])
J --> K
The PostToolUse hook triggers ~/.claude/push-config.sh on every Write|Edit in Claude Code sessions. This script is generated by setup with the repo path baked in — no hardcoded paths in committed files. It also detects deleted home/*.md files and removes them from the repo.
flowchart TD
A([PostToolUse: Write/Edit]) --> B[push-config.sh]
B --> C[Build SYNC_PAIRS]
C --> D[For each pair: diff local vs repo]
D --> E{Changed?}
E -- Yes --> F[cp local → repo]
F --> G[git add]
E -- No --> H[Skip]
C --> D2[For each repo home/*.md]
D2 --> E2{Deleted locally?}
E2 -- Yes --> F2[git rm]
E2 -- No --> H
G --> I[git commit & push]
F2 --> I
H --> J([Done])
I --> J
flowchart LR
A[Static pairs\nCLAUDE.md, settings.json] --> D[SYNC_PAIRS]
B[~/home/*.md\nlocal files] --> C{Deduplicate}
E[repo/home/*.md\nrepo files] --> C
C --> D
~/home/*.md: Automatically discovered from both local (~/home/) and repo (home/) — files added to either side are picked up automatically.- Other files: Add entries to the
SYNC_PAIRSarray insync.sh:
SYNC_PAIRS=(
"$CLAUDE_DIR/CLAUDE.md|CLAUDE.md|[global] CLAUDE.md"
...
"$HOME_DIR/.claude/newfile.json|home/newfile.json|[home] newfile.json"
)