diff --git a/.claude/commands/memory/load-skill-memory.md b/.claude/commands/memory/load-skill-memory.md index 3957c479..729c0e45 100644 --- a/.claude/commands/memory/load-skill-memory.md +++ b/.claude/commands/memory/load-skill-memory.md @@ -2,44 +2,32 @@ name: load-skill-memory description: Load SKILL package documentation with progressive levels based on task requirements argument-hint: " [--level 0|1|2|3] [task description]" -allowed-tools: Bash(*), Read(*), Glob(*) +allowed-tools: Bash(*), Read(*), Glob(*), Skill(*) examples: - - /memory:load-skill-memory hydro_generator_module "分析热模型实现" - - /memory:load-skill-memory workflow-system --level 2 "修改任务调度逻辑" - - /memory:load-skill-memory Claude_dms3 "学习文档生成流程" + - Skill(command: "hydro_generator_module") + - Skill(command: "Claude_dms3") + - Skill(command: "multiphysics_network") --- # Memory Load SKILL Command (/memory:load-skill-memory) ## 1. Overview -The `memory:load-skill-memory` command loads SKILL package documentation with **progressive levels** (0-3) based on task requirements. It validates SKILL existence and intelligently selects appropriate documentation depth. +The `memory:load-skill-memory` command **activates SKILL packages** generated by `/memory:skill-memory`. It validates SKILL existence and uses the `Skill()` tool to load comprehensive documentation context. **Core Philosophy**: -- **Two-Step Validation**: Check SKILL existence before loading -- **Progressive Loading**: Load only necessary documentation based on task complexity -- **Token Optimization**: Start with minimal context, expand as needed -- **Task-Driven Selection**: Automatically select level based on task description +- **Two-Step Process**: Validate SKILL existence → Activate via Skill tool +- **Automatic Context Loading**: SKILL system loads appropriate documentation automatically +- **No Manual Reading**: Use Skill tool instead of manual Read operations +- **Task-Driven Activation**: System automatically determines required context based on SKILL description triggers ## 2. Parameters -- `` (Required): Name of SKILL package to load +- `` (Required): Name of SKILL package to activate - Example: `hydro_generator_module` - Example: `Claude_dms3` - Example: `multiphysics_network` -- `--level <0|1|2|3>` (Optional): Force specific documentation level - - Level 0: Quick Start (~2K tokens) - Overview only - - Level 1: Core Modules (~10K tokens) - Key module APIs - - Level 2: Complete (~25K tokens) - All modules + architecture - - Level 3: Deep Dive (~40K tokens) - Everything including examples - - Default: Auto-select based on task description - -- `[task description]` (Optional): Task context for auto-level selection - - Example: "分析热模型实现" - - Example: "修改builder pattern" - - Example: "学习参数系统设计" - ## 3. Two-Step Execution Flow ### Step 1: Validate SKILL Existence @@ -61,161 +49,144 @@ bash(test -f .claude/skills/{skill_name}/SKILL.md && echo "exists" || echo "not_ ❌ SKILL '{skill_name}' not found. Available SKILLs: -- hydro_generator_module -- Claude_dms3 -- multiphysics_network +- hydro_generator_module (D:\dongdiankaifa9\hydro_generator_module) +- Claude_dms3 (D:\Claude_dms3) -Use: /memory:load-skill-memory [task description] +Use: Skill(command: "skill_name") +Generate new SKILL: /memory:skill-memory [path] ``` -### Step 2: Load Documentation by Level +### Step 2: Activate SKILL Package -**Level Selection Logic**: - -1. **Explicit Level** (--level specified): Use specified level directly -2. **Task-Based Auto-Selection**: - - **Level 0** (Quick Start): - - Keywords: "overview", "介绍", "what is", "概述", "快速了解" - - Use case: Initial exploration, understanding basic capabilities - - - **Level 1** (Core Modules): - - Keywords: "分析", "analyze", "review", "理解", "understand", "API" - - Use case: Deep analysis of specific modules, API review - - - **Level 2** (Complete): - - Keywords: "修改", "modify", "重构", "refactor", "设计", "architecture" - - Use case: Modifying code, understanding system design - - - **Level 3** (Deep Dive): - - Keywords: "实现", "implement", "开发", "develop", "示例", "example" - - Use case: New feature implementation, need complete context - -3. **Default**: Level 1 if no task description and no --level flag - -**Loading Implementation**: - -```bash -# Read SKILL.md to get documentation structure -Read(.claude/skills/{skill_name}/SKILL.md) - -# Based on selected level, read corresponding files -case $level in - 0) - Read(../../../.workflow/docs/{skill_name}/README.md) - ;; - 1) - Read(../../../.workflow/docs/{skill_name}/README.md) - # Read Core Module README.md files listed in SKILL.md Level 1 - ;; - 2) - # Load all Level 1 docs - Read(../../../.workflow/docs/{skill_name}/ARCHITECTURE.md) - # Read all module README.md + API.md files - ;; - 3) - # Load all Level 2 docs - Read(../../../.workflow/docs/{skill_name}/EXAMPLES.md) - # Read complete documentation set - ;; -esac +**Use Skill Tool to Activate**: +```javascript +Skill(command: "{skill_name}") ``` +**What Happens**: +1. Claude's SKILL system reads `.claude/skills/{skill_name}/SKILL.md` +2. Automatically loads appropriate documentation based on: + - SKILL description triggers (analyzing, modifying, learning) + - Current conversation context + - Memory gaps detection +3. Progressive loading levels (0-3) handled automatically by system +4. Context loaded directly into conversation memory + +**No Manual Reading Required**: The Skill tool handles all documentation loading automatically based on SKILL.md configuration. + ## 4. Output Format **Success Output**: ``` -✅ Loaded SKILL: {skill_name} (Level {level}) +✅ Activated SKILL: {skill_name} -📦 Documentation Loaded: -- README.md (~2K tokens) -[Level 1+] -- analysis/README.md -- builders/README.md -- params/README.md -[Level 2+] -- ARCHITECTURE.md -- Complete module APIs -[Level 3+] -- EXAMPLES.md +📦 SKILL Package Information: +- Location: {project_path} +- Description: {description from SKILL.md} +- Documentation: .workflow/docs/{skill_name}/ -💡 Token Budget: ~{token_count}K +💡 Context loaded automatically by SKILL system based on: +- Current task requirements +- Conversation memory gaps +- SKILL description triggers -🎯 Task Context: {task_description} +🎯 Ready for: analyzing, modifying, or learning about {domain_description} ``` ## 5. Usage Examples -### Example 1: Quick Overview +### Example 1: Activate Hydro Generator Module SKILL -```bash -/memory:load-skill-memory hydro_generator_module "快速了解模块功能" +**User Request**: "分析热模型builder pattern实现" + +**Command Execution**: +```javascript +// Step 1: Validate +bash(test -f .claude/skills/hydro_generator_module/SKILL.md && echo "exists") +// Output: exists + +// Step 2: Activate +Skill(command: "hydro_generator_module") ``` -**Auto-Selected Level**: 0 (keyword: "快速了解") +**SKILL Activation**: +- System reads `.claude/skills/hydro_generator_module/SKILL.md` +- Description triggers match: "analyzing" + "hydro-generator thermal modeling" +- Automatically loads appropriate documentation (Level 1-2) +- Context available for subsequent analysis -**Loaded Files**: -- `.workflow/docs/hydro_generator_module/README.md` +### Example 2: Activate Workflow System SKILL -**Token Budget**: ~2K +**User Request**: "修改文档生成workflow调度逻辑" -### Example 2: Module Analysis +**Command Execution**: +```javascript +// Step 1: Validate +bash(test -f .claude/skills/Claude_dms3/SKILL.md && echo "exists") +// Output: exists -```bash -/memory:load-skill-memory hydro_generator_module "分析builder pattern实现" +// Step 2: Activate +Skill(command: "Claude_dms3") ``` -**Auto-Selected Level**: 1 (keyword: "分析") +**SKILL Activation**: +- Description triggers match: "modifying" + "workflow management" +- System loads comprehensive documentation (Level 2-3) +- Ready for workflow modification tasks -**Loaded Files**: -- README.md -- builders/README.md -- builders/API.md -- interfaces/README.md -- params/README.md +### Example 3: Activate Multi-Physics Network SKILL -**Token Budget**: ~10K +**User Request**: "学习电磁域组件设计模式" -### Example 3: Code Modification +**Command Execution**: +```javascript +// Step 1: Validate +bash(test -f .claude/skills/multiphysics_network/SKILL.md && echo "exists") +// Output: exists -```bash -/memory:load-skill-memory Claude_dms3 --level 2 "修改文档生成workflow" +// Step 2: Activate +Skill(command: "multiphysics_network") ``` -**Explicit Level**: 2 +**SKILL Activation**: +- Description triggers match: "learning" + "multi-physics" +- System provides overview and core module docs (Level 0-1) +- Context available for exploration -**Loaded Files**: -- README.md -- All module README.md + API.md -- ARCHITECTURE.md +## 6. SKILL Trigger Mechanism -**Token Budget**: ~25K +**How SKILL System Determines Context Loading**: -### Example 4: New Feature Implementation +The SKILL.md description includes trigger patterns that automatically activate when: -```bash -/memory:load-skill-memory multiphysics_network "实现新的电磁耦合器" -``` +1. **Keyword Matching**: + - User mentions domain keywords (e.g., "热模型", "workflow", "多物理场") + - Description keywords match task requirements -**Auto-Selected Level**: 3 (keyword: "实现") +2. **Action Detection**: + - "analyzing" triggers for analysis tasks + - "modifying" triggers for code modification + - "learning" triggers for exploration -**Loaded Files**: -- Complete documentation set -- EXAMPLES.md with 20+ examples +3. **Memory Gap Detection**: + - "especially when no relevant context exists in memory" + - System prioritizes SKILL loading when conversation lacks context -**Token Budget**: ~40K +4. **Path-Based Triggering**: + - User mentions file paths matching SKILL location + - "files under this path" clause activates -## 6. Level Selection Matrix +**Progressive Loading (Automatic)**: +- Level 0: ~2K tokens (Quick overview) +- Level 1: ~10K tokens (Core modules) +- Level 2: ~25K tokens (Complete system) +- Level 3: ~40K tokens (Full documentation) -| Task Type | Keywords | Auto Level | Token Budget | -|-----------|----------|------------|--------------| -| **Explore** | overview, 介绍, what is, 概述 | 0 | ~2K | -| **Analyze** | 分析, analyze, review, 理解 | 1 | ~10K | -| **Modify** | 修改, modify, 重构, refactor | 2 | ~25K | -| **Implement** | 实现, implement, 开发, develop | 3 | ~40K | +System automatically selects appropriate level based on task complexity and context requirements. ## 7. Implementation Steps -**Pseudo-code**: +**Execution Logic**: ```javascript // Step 1: Validate SKILL existence @@ -225,30 +196,17 @@ if (!exists(skill_path)) { return error_message } -// Step 2: Determine level -if (--level specified) { - level = specified_level -} else if (task_description) { - level = auto_select_level(task_description) -} else { - level = 1 // Default -} +// Step 2: Activate SKILL +Skill(command: skill_name) -// Step 3: Read SKILL.md structure -skill_content = Read(skill_path) -doc_structure = parse_progressive_loading(skill_content) +// Step 3: System handles automatically +// - Reads SKILL.md description +// - Matches triggers with task context +// - Loads appropriate documentation level +// - Injects context into conversation memory -// Step 4: Load documentation by level -loaded_docs = [] -for (doc in doc_structure[level]) { - loaded_docs.push(Read(doc.path)) -} - -// Step 5: Calculate token count -token_count = estimate_tokens(loaded_docs) - -// Step 6: Output summary -output_success_message(skill_name, level, loaded_docs, token_count, task_description) +// Step 4: Confirm activation +output_success_message(skill_name, project_path, description) ``` ## 8. Error Handling @@ -261,6 +219,7 @@ Available SKILLs: - hydro_generator_module (D:\dongdiankaifa9\hydro_generator_module) - Claude_dms3 (D:\Claude_dms3) +Activate SKILL: Skill(command: "skill_name") Generate new SKILL: /memory:skill-memory [path] ``` @@ -274,59 +233,55 @@ Missing files: Regenerate documentation: /memory:skill-memory --regenerate ``` -### Invalid Level -``` -❌ Invalid level: 4 - -Valid levels: -- Level 0: Quick Start (~2K) -- Level 1: Core Modules (~10K) -- Level 2: Complete (~25K) -- Level 3: Deep Dive (~40K) -``` - ## 9. Integration with Other Commands **Workflow Integration**: -```bash -# 1. Load SKILL context -/memory:load-skill-memory hydro_generator_module "修改thermal template" +```javascript +// 1. Activate SKILL context +Skill(command: "hydro_generator_module") -# 2. Use loaded context for planning -/workflow:plan "增强thermal template支持动态阻抗" +// 2. Use loaded context for planning +SlashCommand(command: "/workflow:plan \"增强thermal template支持动态阻抗\"") -# 3. Execute implementation -/workflow:execute +// 3. Execute implementation +SlashCommand(command: "/workflow:execute") ``` -**Memory Refresh**: -```bash -# Load fresh context after code changes -/memory:load-skill-memory hydro_generator_module --level 2 "review recent changes" +**Memory Refresh Pattern**: +```javascript +// Refresh SKILL context after code changes +Skill(command: "hydro_generator_module") +// System automatically detects changes and loads updated documentation ``` ## 10. Token Optimization Strategy -**Progressive Loading Pattern**: -1. Start with Level 0 for exploration -2. Escalate to Level 1 for analysis -3. Load Level 2 for modification tasks -4. Use Level 3 only for complex implementations +**Automatic Progressive Loading**: +The SKILL system automatically handles token optimization: -**Token Budget Guidelines**: -- **Simple queries**: Level 0-1 (2-10K) -- **Code review**: Level 1-2 (10-25K) -- **Feature development**: Level 2-3 (25-40K) +1. **Initial Load**: Starts with minimum required context +2. **On-Demand Escalation**: Loads more documentation if needed +3. **Task-Driven**: Adjusts depth based on task complexity +4. **Memory-Aware**: Avoids loading redundant context -**Reload Strategy**: -- Reload with higher level if insufficient context -- Use explicit --level to override auto-selection +**Token Budget (Automatic)**: +- **Simple queries**: ~2-10K tokens +- **Code analysis**: ~10-25K tokens +- **Implementation**: ~25-40K tokens + +**Optimization Benefits**: +- No manual level selection required +- System learns from conversation context +- Efficient memory usage +- Automatic reload when context insufficient ## 11. Notes +- **Validation First**: Always checks SKILL existence before activation +- **Automatic Loading**: Skill tool handles all documentation reading +- **Session-Scoped**: Activated SKILL context valid for current session +- **Trigger-Based**: Description patterns drive automatic activation +- **Path-Aware**: Triggers on project path mentions +- **Memory-Smart**: Prioritizes loading when conversation lacks context - **Read-Only**: Does not modify SKILL files or documentation -- **Session-Scoped**: Loaded documentation valid for current session -- **Auto-Selection**: Keywords matched case-insensitively -- **Path Relative**: All documentation paths relative to SKILL.md location -- **Token Aware**: Automatically estimates token consumption -- **Fallback**: Defaults to Level 1 if auto-selection unclear +- **Reactivation**: Can re-activate SKILL to refresh context after changes