sync
The `/sync` command detects files modified outside Claude Code using git and updates CLAUDE.md incrementally without full recalibration. Use this after making manual edits to project files to keep your memory file synchronized with actual changes, rather than rerunning the complete calibration process.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/severity1/claude-code-auto-memory/HEAD/commands/sync.md -o ~/.claude/commands/sync.mdsync.md
Detect files changed outside Claude Code and update CLAUDE.md incrementally.
Use this when you've edited files manually (outside Claude Code) and want to update CLAUDE.md without a full recalibration.
## Workflow
1. **Check if git repo**: Run `git rev-parse --is-inside-work-tree`
- If not a git repo: Report error and suggest `/auto-memory:calibrate` instead
2. **Detect changed files using git**:
```bash
git diff --name-only HEAD # Modified tracked files
git diff --cached --name-only # Staged files
git ls-files --others --exclude-standard # New untracked files
```
3. **Filter files** (exclude from processing):
- Files in `.claude/` directory
- Memory files: read `memoryFiles` from `.claude/auto-memory/config.json` (default `["CLAUDE.md"]`) and exclude any file whose name appears in that list
- Files outside project directory
4. **If no changes detected**: Report "Already in sync - no manual changes found"
5. **If changes found**:
- Convert paths to absolute paths
- Write to `.claude/auto-memory/dirty-files` (one path per line, or `dirty-files-{session_id}` if session_id is available from the environment)
- Use the Task tool to spawn the `memory-updater` agent with prompt:
"Update [active memory file] for manually changed files: [file list]" (use AGENTS.md or CLAUDE.md per the memoryFiles config)
6. **Report summary**: List files that were processed
## Notes
- Requires a git repository for change detection
- For non-git projects or full recalibration, use `/auto-memory:calibrate` instead
- The memory-updater agent handles the actual CLAUDE.md updatesOrchestrates CLAUDE.md updates for changed files
Force recalibration of all CLAUDE.md files
Initialize CLAUDE.md memory structure for project with interactive wizard
Show CLAUDE.md memory sync status
This skill should be used when the user asks to "initialize auto-memory", "create CLAUDE.md", "set up project memory", or runs the /auto-memory:init command. Analyzes codebase structure and generates CLAUDE.md files using the exact template format with AUTO-MANAGED markers.
Process file changes and update CLAUDE.md memory sections. Use when the memory-updater agent needs to analyze dirty files, update AUTO-MANAGED sections, verify content removal, or detect stale commands. Invoked after file edits to keep project memory in sync.