source dump of claude code
at main 82 lines 4.2 kB view raw
1import { isAutoMemoryEnabled } from '../../memdir/paths.js' 2import { registerBundledSkill } from '../bundledSkills.js' 3 4export function registerRememberSkill(): void { 5 if (process.env.USER_TYPE !== 'ant') { 6 return 7 } 8 9 const SKILL_PROMPT = `# Memory Review 10 11## Goal 12Review the user's memory landscape and produce a clear report of proposed changes, grouped by action type. Do NOT apply changes — present proposals for user approval. 13 14## Steps 15 16### 1. Gather all memory layers 17Read CLAUDE.md and CLAUDE.local.md from the project root (if they exist). Your auto-memory content is already in your system prompt — review it there. Note which team memory sections exist, if any. 18 19**Success criteria**: You have the contents of all memory layers and can compare them. 20 21### 2. Classify each auto-memory entry 22For each substantive entry in auto-memory, determine the best destination: 23 24| Destination | What belongs there | Examples | 25|---|---|---| 26| **CLAUDE.md** | Project conventions and instructions for Claude that all contributors should follow | "use bun not npm", "API routes use kebab-case", "test command is bun test", "prefer functional style" | 27| **CLAUDE.local.md** | Personal instructions for Claude specific to this user, not applicable to other contributors | "I prefer concise responses", "always explain trade-offs", "don't auto-commit", "run tests before committing" | 28| **Team memory** | Org-wide knowledge that applies across repositories (only if team memory is configured) | "deploy PRs go through #deploy-queue", "staging is at staging.internal", "platform team owns infra" | 29| **Stay in auto-memory** | Working notes, temporary context, or entries that don't clearly fit elsewhere | Session-specific observations, uncertain patterns | 30 31**Important distinctions:** 32- CLAUDE.md and CLAUDE.local.md contain instructions for Claude, not user preferences for external tools (editor theme, IDE keybindings, etc. don't belong in either) 33- Workflow practices (PR conventions, merge strategies, branch naming) are ambiguous — ask the user whether they're personal or team-wide 34- When unsure, ask rather than guess 35 36**Success criteria**: Each entry has a proposed destination or is flagged as ambiguous. 37 38### 3. Identify cleanup opportunities 39Scan across all layers for: 40- **Duplicates**: Auto-memory entries already captured in CLAUDE.md or CLAUDE.local.md → propose removing from auto-memory 41- **Outdated**: CLAUDE.md or CLAUDE.local.md entries contradicted by newer auto-memory entries → propose updating the older layer 42- **Conflicts**: Contradictions between any two layers → propose resolution, noting which is more recent 43 44**Success criteria**: All cross-layer issues identified. 45 46### 4. Present the report 47Output a structured report grouped by action type: 481. **Promotions** — entries to move, with destination and rationale 492. **Cleanup** — duplicates, outdated entries, conflicts to resolve 503. **Ambiguous** — entries where you need the user's input on destination 514. **No action needed** — brief note on entries that should stay put 52 53If auto-memory is empty, say so and offer to review CLAUDE.md for cleanup. 54 55**Success criteria**: User can review and approve/reject each proposal individually. 56 57## Rules 58- Present ALL proposals before making any changes 59- Do NOT modify files without explicit user approval 60- Do NOT create new files unless the target doesn't exist yet 61- Ask about ambiguous entries — don't guess 62` 63 64 registerBundledSkill({ 65 name: 'remember', 66 description: 67 'Review auto-memory entries and propose promotions to CLAUDE.md, CLAUDE.local.md, or shared memory. Also detects outdated, conflicting, and duplicate entries across memory layers.', 68 whenToUse: 69 'Use when the user wants to review, organize, or promote their auto-memory entries. Also useful for cleaning up outdated or conflicting entries across CLAUDE.md, CLAUDE.local.md, and auto-memory.', 70 userInvocable: true, 71 isEnabled: () => isAutoMemoryEnabled(), 72 async getPromptForCommand(args) { 73 let prompt = SKILL_PROMPT 74 75 if (args) { 76 prompt += `\n## Additional context from user\n\n${args}` 77 } 78 79 return [{ type: 'text', text: prompt }] 80 }, 81 }) 82}