/sync
Two-way sync between Nemp Memory and CLAUDE.md
> /plugin marketplace add SukinShetty/Nemp-memory > /plugin install nemp@nemp-memory
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/sync
Context preview
What this command does when you run it.
Two-way sync between Nemp Memory and CLAUDE.md
Command definition
sync.mddescription: "Two-way sync between Nemp Memory and CLAUDE.md"
argument-hint: "[--import-only | --export-only | --check]"
/nemp:sync
Two-way bridge between Nemp Memory and CLAUDE.md. Import user-written context from CLAUDE.md into Nemp, detect conflicts with actual project state, and update the Nemp section.
Usage
/nemp:sync # Full two-way sync
/nemp:sync --import-only # Only read from CLAUDE.md into Nemp, don't write back
/nemp:sync --export-only # Same as /nemp:export
/nemp:sync --check # Only detect conflicts, don't change anything
Arguments
- `--import-only` (optional): Only import from CLAUDE.md to Nemp memories, skip export
- `--export-only` (optional): Only export Nemp memories to CLAUDE.md (same as /nemp:export)
- `--check` (optional): Dry run - detect conflicts without making any changes
Instructions
When the user invokes `/nemp:sync`, follow these steps:
Step 1: Parse Arguments
Extract the mode from arguments:
- No arguments → full sync (import + conflict check + export)
- `--import-only` → only import from CLAUDE.md
- `--export-only` → only export to CLAUDE.md
- `--check` → only detect conflicts, no changes
Step 2: Read CLAUDE.md
Check if CLAUDE.md exists and read its contents:
[ -f "CLAUDE.md" ] && cat CLAUDE.md || echo "CLAUDE_MD_NOT_FOUND"
If CLAUDE.md doesn't exist:
⚠️ No CLAUDE.md found.
Nothing to import. You can:
/nemp:export - Create CLAUDE.md from Nemp memories
/nemp:init - Auto-detect project stack first
Step 3: Parse CLAUDE.md Content
Split CLAUDE.md into two parts:
**Nemp Section (SKIP):**
- Starts with: `## Project Context (via Nemp Memory)`
- Ends at: next `## ` heading, or `---` on its own line, or end of file
- This is Nemp's own output — do NOT re-import it
**User Content (IMPORT):**
- Everything OUTSIDE the Nemp section
- This includes manually written context, rules, preferences, architecture notes
Step 4: Extract Importable Context
Scan the user content for importable information. Look for patterns like:
| Pattern | Memory Key | |---------|------------| | "Tech stack:", "Stack:", "We use" | `stack` | | "Framework:", "Built with" | `framework` | | "Database:", "DB:", "ORM:" | `database` | | "Auth:", "Authentication:" | `auth` | | "Styling:", "CSS:", "UI:" | `styling` | | "Testing:", "Tests:" | `testing` | | "Package manager:", "Use npm/pnpm/yarn/bun" | `package-manager` | | "Architecture:", "Structure:" | `architecture` | | "Rules:", "Conventions:", "Preferences:" | `conventions` | | "API:", "Endpoints:" | `api` | | Bullet points under headings | Extract as relevant memory |
**Parsing strategies:** 1. Look for markdown headings (`##`, `###`) and extract content under them 2. Look for bold labels (`**key:**`) followed by values 3. Look for bullet lists that describe project aspects 4. Look for code blocks with configuration hints
Step 5: Load Existing Nemp Memories
[ -f ".nemp/memories.json" ] && cat .nemp/memories.json || echo "{}"Step 6: Import New Memories
For each piece of context extracted from CLAUDE.md:
1. **Check for duplicates**: If a memory with the same key already exists in `.nemp/memories.json`, SKIP it 2. **Create new memory**: If the key doesn't exist, create it with:
{
"key": "<extracted-key>",
"value": "<extracted-value>",
"created": "<ISO-8601-timestamp>",
"updated": "<ISO-8601-timestamp>",
"tags": ["from-claude-md"],
"source": "CLAUDE.md"
}Track what was imported for the summary.
Step 7: Read Project Config Files
Scan the actual project state by reading configuration files:
# Check for package.json
[ -f "package.json" ] && cat package.json
# Check for tsconfig
[ -f "tsconfig.json" ] && echo "TYPESCRIPT: true"
# Check for common configs
[ -f "next.config.js" ] || [ -f "next.config.mjs" ] || [ -f "next.config.ts" ] && echo "NEXTJS: true"
[ -f "vite.config.ts" ] || [ -f "vite.config.js" ] && echo "VITE: true"
[ -f "tailwind.config.js" ] || [ -f "tailwind.config.ts" ] && echo "TAILWIND: true"
Extract actual values from package.json:
- `dependencies` and `devDependencies` for frameworks, ORMs, auth libraries
- `name` for project name
- `scripts` for available commands
Step 8: Detect Conflicts
Compare three sources for conflicts: 1. **CLAUDE.md content** (user-written) 2. **Nemp memories** (stored in .nemp/memories.json) 3. **Actual project state** (from package.json, config files)
**Conflict detection rules:**
| Check | Conflict Example | |-------|------------------| | ORM mismatch | CLAUDE.md says "Prisma" but package.json has `drizzle-orm` | | Framework mismatch | Memory says "React 18" but package.json has `react: ^19.0.0` | | Auth mismatch | CLAUDE.md says "Clerk" but package.json has `next-auth` | | Database mismatch | Memory says "MongoDB" but dependencies show `pg` | | Package manager mismatch | CLAUDE.md says "yarn" but `pnpm-lock.yaml` exists | | Styling mismatch | Memory says "styled-components" but `tailwindcss` is installed |
**Conflict output format:**
⚠️ Conflicts Detected
┌─────────────────────────────────────────────────────────────┐
│ CONFLICT 1: Database/ORM │
├─────────────────────────────────────────────────────────────┤
│ CLAUDE.md says: Prisma ORM │
│ package.json shows: drizzle-orm ^0.30.0 │
│ │
│ Action needed: Update CLAUDE.md or Nemp memory │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ CONFLICT 2: React Version │
├─────────────────────────────────────────────────────────────┤
│ Nemp memory says: React 18 │
│ package.json shows: react ^19.0.0 │
│
Read more
description: "Two-way sync between Nemp Memory and CLAUDE.md" argument-hint: "[--import-only | --export-only | --check]"
/nemp:sync
Two-way bridge between Nemp Memory and CLAUDE.md. Import user-written context from CLAUDE.md into Nemp, detect conflicts with actual project state, and update the Nemp section.
Usage
/nemp:sync # Full two-way sync /nemp:sync --import-only # Only read from CLAUDE.md into Nemp, don't write back /nemp:sync --export-only # Same as /nemp:export /nemp:sync --check # Only detect conflicts, don't change anything
Arguments
- `--import-only` (optional): Only import from CLAUDE.md to Nemp memories, skip export
- `--export-only` (optional): Only export Nemp memories to CLAUDE.md (same as /nemp:export)
- `--check` (optional): Dry run - detect conflicts without making any changes
Instructions
When the user invokes `/nemp:sync`, follow these steps:
Step 1: Parse Arguments
Extract the mode from arguments:
- No arguments → full sync (import + conflict check + export)
- `--import-only` → only import from CLAUDE.md
- `--export-only` → only export to CLAUDE.md
- `--check` → only detect conflicts, no changes
Step 2: Read CLAUDE.md
Check if CLAUDE.md exists and read its contents:
[ -f "CLAUDE.md" ] && cat CLAUDE.md || echo "CLAUDE_MD_NOT_FOUND"
If CLAUDE.md doesn't exist:
⚠️ No CLAUDE.md found. Nothing to import. You can: /nemp:export - Create CLAUDE.md from Nemp memories /nemp:init - Auto-detect project stack first
Step 3: Parse CLAUDE.md Content
Split CLAUDE.md into two parts:
**Nemp Section (SKIP):**
- Starts with: `## Project Context (via Nemp Memory)`
- Ends at: next `## ` heading, or `---` on its own line, or end of file
- This is Nemp's own output — do NOT re-import it
**User Content (IMPORT):**
- Everything OUTSIDE the Nemp section
- This includes manually written context, rules, preferences, architecture notes
Step 4: Extract Importable Context
Scan the user content for importable information. Look for patterns like:
| Pattern | Memory Key | |---------|------------| | "Tech stack:", "Stack:", "We use" | `stack` | | "Framework:", "Built with" | `framework` | | "Database:", "DB:", "ORM:" | `database` | | "Auth:", "Authentication:" | `auth` | | "Styling:", "CSS:", "UI:" | `styling` | | "Testing:", "Tests:" | `testing` | | "Package manager:", "Use npm/pnpm/yarn/bun" | `package-manager` | | "Architecture:", "Structure:" | `architecture` | | "Rules:", "Conventions:", "Preferences:" | `conventions` | | "API:", "Endpoints:" | `api` | | Bullet points under headings | Extract as relevant memory |
**Parsing strategies:** 1. Look for markdown headings (`##`, `###`) and extract content under them 2. Look for bold labels (`**key:**`) followed by values 3. Look for bullet lists that describe project aspects 4. Look for code blocks with configuration hints
Step 5: Load Existing Nemp Memories
[ -f ".nemp/memories.json" ] && cat .nemp/memories.json || echo "{}"Step 6: Import New Memories
For each piece of context extracted from CLAUDE.md:
1. **Check for duplicates**: If a memory with the same key already exists in `.nemp/memories.json`, SKIP it 2. **Create new memory**: If the key doesn't exist, create it with:
{
"key": "<extracted-key>",
"value": "<extracted-value>",
"created": "<ISO-8601-timestamp>",
"updated": "<ISO-8601-timestamp>",
"tags": ["from-claude-md"],
"source": "CLAUDE.md"
}Track what was imported for the summary.
Step 7: Read Project Config Files
Scan the actual project state by reading configuration files:
# Check for package.json [ -f "package.json" ] && cat package.json # Check for tsconfig [ -f "tsconfig.json" ] && echo "TYPESCRIPT: true" # Check for common configs [ -f "next.config.js" ] || [ -f "next.config.mjs" ] || [ -f "next.config.ts" ] && echo "NEXTJS: true" [ -f "vite.config.ts" ] || [ -f "vite.config.js" ] && echo "VITE: true" [ -f "tailwind.config.js" ] || [ -f "tailwind.config.ts" ] && echo "TAILWIND: true"
Extract actual values from package.json:
- `dependencies` and `devDependencies` for frameworks, ORMs, auth libraries
- `name` for project name
- `scripts` for available commands
Step 8: Detect Conflicts
Compare three sources for conflicts: 1. **CLAUDE.md content** (user-written) 2. **Nemp memories** (stored in .nemp/memories.json) 3. **Actual project state** (from package.json, config files)
**Conflict detection rules:**
| Check | Conflict Example | |-------|------------------| | ORM mismatch | CLAUDE.md says "Prisma" but package.json has `drizzle-orm` | | Framework mismatch | Memory says "React 18" but package.json has `react: ^19.0.0` | | Auth mismatch | CLAUDE.md says "Clerk" but package.json has `next-auth` | | Database mismatch | Memory says "MongoDB" but dependencies show `pg` | | Package manager mismatch | CLAUDE.md says "yarn" but `pnpm-lock.yaml` exists | | Styling mismatch | Memory says "styled-components" but `tailwindcss` is installed |
**Conflict output format:**
⚠️ Conflicts Detected ┌─────────────────────────────────────────────────────────────┐ │ CONFLICT 1: Database/ORM │ ├─────────────────────────────────────────────────────────────┤ │ CLAUDE.md says: Prisma ORM │ │ package.json shows: drizzle-orm ^0.30.0 │ │ │ │ Action needed: Update CLAUDE.md or Nemp memory │ └─────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────┐ │ CONFLICT 2: React Version │ ├─────────────────────────────────────────────────────────────┤ │ Nemp memory says: React 18 │ │ package.json shows: react ^19.0.0 │ │
Nemp - The memory plugin for Claude Code that remembers everything.
Other commands on nemp.
auto-export
Experimental: Enable or disable automatic cross-provider memory export

