Updated Hooks for auto sync
This commit is contained in:
@@ -32,18 +32,31 @@ AI/
|
||||
|
||||
### Claude Code (Automatic)
|
||||
|
||||
Claude Code automatically reads `CLAUDE.md` from the root of any project it's working in.
|
||||
Claude Code automatically reads `~/.claude/CLAUDE.md` globally, and any `CLAUDE.md` in a project root. Global preferences apply everywhere; project-level adds on top.
|
||||
|
||||
**Option A — Per project:** Copy `CLAUDE.md` into the root of any project repo. Claude Code will pick it up automatically every session.
|
||||
**Recommended setup (symlinks + auto-pull across machines):**
|
||||
|
||||
**Option B — Global (recommended):** Place `CLAUDE.md` in your Claude global config folder so it applies to *every* project without copying:
|
||||
Clone this repo locally and symlink `CLAUDE.md` and `preferences/` into `~/.claude/`. From that point on, `git pull` is the only sync step — and the auto-pull hook in `preferences/hooks-setup.md` handles that automatically on every session.
|
||||
|
||||
```
|
||||
# Windows
|
||||
Copy-Item "CLAUDE.md" "$env:USERPROFILE\.claude\CLAUDE.md"
|
||||
**Linux (one-time setup per machine):**
|
||||
|
||||
```bash
|
||||
git clone https://git.chns.tech/CHNS/AI ~/repos/AI
|
||||
ln -sf ~/repos/AI/CLAUDE.md ~/.claude/CLAUDE.md
|
||||
ln -sf ~/repos/AI/preferences ~/.claude/preferences
|
||||
```
|
||||
|
||||
> Note: If a project also has its own `CLAUDE.md`, Claude Code merges both — global preferences apply everywhere, project-specific ones add on top.
|
||||
**Windows (one-time setup — requires Developer Mode or run PowerShell as Administrator):**
|
||||
|
||||
```powershell
|
||||
git clone https://git.chns.tech/CHNS/AI C:\repos\AI
|
||||
Remove-Item "$env:USERPROFILE\.claude\CLAUDE.md" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item "$env:USERPROFILE\.claude\preferences" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.claude\CLAUDE.md" -Target "C:\repos\AI\CLAUDE.md"
|
||||
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.claude\preferences" -Target "C:\repos\AI\preferences"
|
||||
```
|
||||
|
||||
After symlinking, configure hooks from `preferences/hooks-setup.md` — the auto-pull hook will keep preferences current automatically.
|
||||
|
||||
---
|
||||
|
||||
@@ -115,16 +128,10 @@ Preferences should evolve as your stack and habits change. Treat this repo like
|
||||
|
||||
### After Updating
|
||||
|
||||
**If you're using the global Claude Code setup**, sync your changes by running these two commands from the repo root:
|
||||
**If you're using the symlink setup**, no manual copy step is needed. Edit the repo files directly — the symlinks mean `~/.claude/` always reflects the latest committed content. The auto-pull hook fetches remote changes automatically at the start of each session.
|
||||
|
||||
```powershell
|
||||
Copy-Item "CLAUDE.md" "$env:USERPROFILE\.claude\CLAUDE.md" -Force
|
||||
Copy-Item -Path "preferences" -Destination "$env:USERPROFILE\.claude\preferences" -Recurse -Force
|
||||
```
|
||||
> **Hooks are not synced automatically.** `~/.claude/settings.json` is machine-local and not part of this repo. After cloning and symlinking on a new machine, set up hooks by telling Claude Code: *"Read preferences/hooks-setup.md and configure my ~/.claude/settings.json with the required hooks."*
|
||||
|
||||
> **Hooks are not synced automatically.** `~/.claude/settings.json` is machine-local and not part of this repo. After syncing preferences on a new machine, set up hooks by telling Claude Code: *"Read preferences/hooks-setup.md and configure my ~/.claude/settings.json with the required hooks."*
|
||||
|
||||
- If you've **copied** `CLAUDE.md` into other project repos, re-copy the updated version to those projects
|
||||
- If you're using **ChatGPT/Claude.ai** manually, you'll be pasting the updated file next time
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user