[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XEC47ME4CWK7EH0R1EN9Y2":3,"skill-same:01M6XEC47ME4CWK7EH0R1EN9Y2":81},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":13,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M6XEC47ME4CWK7EH0R1EN9Y2","lean4-memories",null,"This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences across sessions using MCP memory server integration","Waaaalnut\u002Fskillsbench","Waaaalnut","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F103995656?v=4","01M6XCS9K1V51EY3JMB7DGMX24","01M6XCS9Q4WPW88W62C55G1H44",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Flean4-proof\u002Fenvironment\u002Fskills\u002Flean4-memories\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"lean4 memories","lean4","memories","maintain","when","persistent memory","proof","project","across","conventions","MCP","patterns","lean","projects","preferences","server","integration","project conventions","sessions","memory","2026-11-10 10:12:30",false,"---\nname: lean4-memories\ndescription: This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences across sessions using MCP memory server integration\n---\n\n# Lean 4 Memories\n\n## Overview\n\nThis skill enables persistent learning and knowledge accumulation across Lean 4 formalization sessions by leveraging MCP (Model Context Protocol) memory servers. It transforms stateless proof assistance into a learning system that remembers successful patterns, avoids known dead-ends, and adapts to project-specific conventions.\n\n**Core principle:** Learn from each proof session and apply accumulated knowledge to accelerate future work.\n\n## When to Use This Skill\n\nThis skill applies when working on Lean 4 formalization projects, especially:\n- **Multi-session projects** - Long-running formalizations spanning days\u002Fweeks\u002Fmonths\n- **Repeated proof patterns** - Similar theorems requiring similar approaches\n- **Complex proofs** - Theorems with multiple attempted approaches\n- **Team projects** - Shared knowledge across multiple developers\n- **Learning workflows** - Building up domain-specific proof expertise\n\n**Especially important when:**\n- Starting a new session on an existing project\n- Encountering a proof pattern similar to previous work\n- Trying an approach that previously failed\n- Needing to recall project-specific conventions\n- Building on successful proof strategies from earlier sessions\n\n## How Memory Integration Works\n\n### Memory Scoping\n\nAll memories are scoped by:\n1. **Project path** - Prevents cross-project contamination\n2. **Skill context** - Memories tagged with `lean4-memories`\n3. **Entity type** - Structured by pattern type (ProofPattern, FailedApproach, etc.)\n\n**Example scoping:**\n```\nProject: \u002FUsers\u002Ffreer\u002Fwork\u002Fexch-repos\u002Fexchangeability-cursor\nSkill: lean4-memories\nEntity: ProofPattern:condExp_unique_pattern\n```\n\n### Memory Types\n\n**1. ProofPattern** - Successful proof strategies\n```\nStore when: Proof completes successfully after exploration\nRetrieve when: Similar goal pattern detected\n```\n\n**2. FailedApproach** - Known dead-ends to avoid\n```\nStore when: Approach attempted but failed\u002Flooped\u002Ferrored\nRetrieve when: About to try similar approach\n```\n\n**3. ProjectConvention** - Code style and patterns\n```\nStore when: Consistent pattern observed (naming, structure, tactics)\nRetrieve when: Creating new definitions\u002Ftheorems\n```\n\n**4. UserPreference** - Workflow customization\n```\nStore when: User expresses preference (verbose output, specific tools, etc.)\nRetrieve when: Choosing between options\n```\n\n**5. TheoremDependency** - Relationships between theorems\n```\nStore when: One theorem proves useful for proving another\nRetrieve when: Looking for helper lemmas\n```\n\n## Memory Workflows\n\n### Storing Memories\n\n**After successful proof:**\n```lean\n-- Just proved: exchangeable_iff_fullyExchangeable\n-- Store the successful pattern\n```\n\nStore:\n- Goal pattern: `exchangeable X ↔ fullyExchangeable X`\n- Successful tactics: `[apply measure_eq_of_fin_marginals_eq, intro, simp]`\n- Helper lemmas used: `[prefixCylinder_measurable, isPiSystem_prefixCylinders]`\n- Difficulty: medium (54 lines)\n- Confidence: high (proof clean, no warnings)\n\n**After failed approach:**\n```lean\n-- Attempted: simp only [condExp_indicator, mul_comm]\n-- Result: infinite loop, build timeout\n```\n\nStore:\n- Failed tactic: `simp only [condExp_indicator, mul_comm]`\n- Error: \"infinite simp loop\"\n- Context: conditional expectation with indicator\n- Recommendation: \"Use simp only [condExp_indicator] without mul_comm\"\n\n**Project conventions observed:**\n```lean\n-- Pattern: All measure theory proofs start with haveI\nhaveI : MeasurableSpace Ω := inferInstance\n```\n\nStore:\n- Convention: \"Measure theory proofs require explicit MeasurableSpace instance\"\n- Pattern: `haveI : MeasurableSpace Ω`\n- Frequency: 15 occurrences\n- Files: DeFinetti\u002FViaL2.lean, Core.lean, Contractability.lean\n\n### Retrieving Memories\n\n**Starting new proof session:**\n1. Load project-specific conventions\n2. Retrieve similar proof patterns from past work\n3. Surface any known issues with current file\u002Fmodule\n\n**Encountering similar goal:**\n```\n⊢ condExp μ m X =ᵐ[μ] condExp μ m Y\n\nMemory retrieved: \"Similar goals proved using condExp_unique\"\nPattern: \"Show ae_eq, verify measurability, apply condExp_unique\"\nSuccess rate: 3\u002F3 in this project\n```\n\n**Before trying a tactic:**\n```\nAbout to: simp only [condExp_indicator, mul_comm]\n\nMemory retrieved: ⚠️ WARNING - This combination causes infinite loop\nFailed in: ViaL2.lean:2830 (2025-10-17)\nAlternative: Use simp only [condExp_indicator], then ring\n```\n\n## Integration with lean4-theorem-proving Skill\n\nThe lean4-memories skill complements (doesn't replace) lean4-theorem-proving:\n\n**lean4-theorem-proving provides:**\n- General Lean 4 workflows (4-Phase approach)\n- mathlib search and tactics reference\n- Automation scripts\n- Domain-specific knowledge (measure theory, probability)\n\n**lean4-memories adds:**\n- Project-specific learned patterns\n- History of what worked\u002Ffailed in this project\n- Accumulated domain expertise from your proofs\n- Personalized workflow preferences\n\n**Use together:**\n1. lean4-theorem-proving guides general workflow\n2. lean4-memories provides project-specific context\n3. Memories inform tactics choices from lean4-theorem-proving\n\n## Memory Operations\n\n### Storing a Successful Proof Pattern\n\nAfter completing a proof, store the pattern using MCP memory:\n\n**What to capture:**\n- **Goal pattern** - Type\u002Fstructure of goal (equality, exists, forall, etc.)\n- **Tactics sequence** - Tactics that worked, in order\n- **Helper lemmas** - Key lemmas applied\n- **Difficulty** - Lines of proof, complexity estimate\n- **Confidence** - Clean proof vs sorries\u002Fwarnings\n- **Context** - File, module, theorem name\n\n**When to store:**\n- Proof completed successfully (no sorries)\n- Non-trivial (>10 lines or required exploration)\n- Likely to be useful again (similar theorems expected)\n\n**Storage format:**\n```\nEntity type: ProofPattern\nName: {descriptive_name}\nAttributes:\n  - project: {absolute_path}\n  - goal_pattern: {pattern_description}\n  - tactics: [list, of, tactics]\n  - helper_lemmas: [lemma1, lemma2]\n  - difficulty: {small|medium|large}\n  - confidence: {0.0-1.0}\n  - file: {filename}\n  - timestamp: {date}\n```\n\n### Storing a Failed Approach\n\nWhen an approach fails (error, loop, timeout), store to avoid repeating:\n\n**What to capture:**\n- **Failed tactic** - Exact tactic\u002Fsequence that failed\n- **Error type** - Loop, timeout, type error, etc.\n- **Context** - What was being proved\n- **Alternative** - What worked instead (if known)\n\n**When to store:**\n- Infinite simp loops\n- Tactics causing build timeouts\n- Type mismatches from subtle issues\n- Approaches that seemed promising but didn't work\n\n**Storage format:**\n```\nEntity type: FailedApproach\nName: {descriptive_name}\nAttributes:\n  - project: {absolute_path}\n  - failed_tactic: {tactic_text}\n  - error: {error_description}\n  - context: {what_was_being_proved}\n  - alternative: {what_worked}\n  - timestamp: {date}\n```\n\n### Storing Project Conventions\n\nTrack consistent patterns that emerge:\n\n**What to capture:**\n- **Naming conventions** - h_ for hypotheses, have_ for results\n- **Proof structure** - Standard opening moves (haveI, intro patterns)\n- **Import patterns** - Commonly used imports\n- **Tactic preferences** - measurability vs explicit proofs\n\n**When to store:**\n- Pattern observed 3+ times consistently\n- Convention affects multiple files\n- Style guide established\n\n### Retrieving Memories\n\n**Before starting proof:**\n```\n1. Query for similar goal patterns\n2. Surface successful tactics for this pattern\n3. Check for known issues with current context\n4. Suggest helper lemmas from similar proofs\n```\n\n**During proof:**\n```\n1. Before each major tactic, check for known failures\n2. When stuck, retrieve alternative approaches\n3. Suggest next tactics based on past success\n```\n\n**Query patterns:**\n```\n# Find similar proofs\nsearch_entities(\n  query=\"condExp equality goal\",\n  filters={\"project\": current_project, \"entity_type\": \"ProofPattern\"}\n)\n\n# Check for failures\nsearch_entities(\n  query=\"simp only condExp_indicator\",\n  filters={\"project\": current_project, \"entity_type\": \"FailedApproach\"}\n)\n\n# Get conventions\nsearch_entities(\n  query=\"naming conventions measure theory\",\n  filters={\"project\": current_project, \"entity_type\": \"ProjectConvention\"}\n)\n```\n\n## Best Practices\n\n### Memory Quality\n\n**DO store:**\n- ✅ Successful non-trivial proofs (>10 lines)\n- ✅ Failed approaches that wasted significant time\n- ✅ Consistent patterns observed multiple times\n- ✅ Project-specific insights\n\n**DON'T store:**\n- ❌ Trivial proofs (rfl, simp, exact)\n- ❌ One-off tactics unlikely to recur\n- ❌ General Lean knowledge (already in training\u002Fmathlib)\n- ❌ Temporary workarounds\n\n### Memory Hygiene\n\n**Confidence scoring:**\n- **High (0.8-1.0)** - Clean proof, no warnings, well-tested\n- **Medium (0.5-0.8)** - Works but has minor issues\n- **Low (0.0-0.5)** - Hacky solution, needs refinement\n\n**Aging:**\n- Recent memories (same session) = higher relevance\n- Older memories = verify still applicable\n- Patterns from many sessions = high confidence\n\n**Pruning:**\n- Remove memories for deleted theorems\n- Update when better approach found\n- Mark as outdated if project evolves\n\n### User Control\n\n**Users can:**\n- Toggle lean4-memories skill on\u002Foff independently\n- Clear project-specific memories\n- Review stored memories\n- Adjust confidence thresholds\n- Export\u002Fimport memories for sharing\n\n## Example Workflow\n\n**Session 1: First proof**\n```lean\n-- Proving: measure_eq_of_fin_marginals_eq\n-- No memories yet, explore from scratch\n-- [After 30 minutes of exploration]\n-- ✅ Success with π-system uniqueness approach\n\nStore: ProofPattern \"pi_system_uniqueness\"\n  - Works for: measure equality via finite marginals\n  - Tactics: [isPiSystem, generateFrom_eq, measure_eq_on_piSystem]\n  - Confidence: 0.9\n```\n\n**Session 2: Similar theorem (weeks later)**\n```lean\n-- Proving: fullyExchangeable_via_pathLaw\n-- Goal: Show two measures equal\n-- System: \"Similar to measure_eq_of_fin_marginals_eq\"\n--         Retrieve memory: pi_system_uniqueness pattern\n--         Suggestion: \"Try isPiSystem approach?\"\n\n-- ✅ Success in 5 minutes using remembered pattern\n```\n\n**Session 3: Avoiding failure**\n```lean\n-- Proving: condIndep_of_condExp_eq\n-- About to: simp only [condExp_indicator, mul_comm]\n-- ⚠️ Memory: This causes infinite loop (stored Session 1)\n--          Alternative: simp only [condExp_indicator], then ring\n\n-- Avoid 20-minute debugging session by using memory\n```\n\n## Configuration\n\n### Memory Server Setup\n\nEnsure MCP memory server is configured:\n\n```json\n\u002F\u002F In Claude Desktop config\n{\n  \"mcpServers\": {\n    \"memory\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@modelcontextprotocol\u002Fserver-memory\"]\n    }\n  }\n}\n```\n\n### Project-Specific Settings\n\nMemories are automatically scoped by project path. To work across multiple projects:\n\n**Same formalization, different repos:**\n```\n# Link memories using project aliases\n# (Future enhancement - not yet implemented)\n```\n\n**Sharing memories with team:**\n```\n# Export\u002Fimport functionality\n# (Future enhancement - not yet implemented)\n```\n\n## Integration with Automation Scripts\n\nMemories enhance script usage:\n\n**proof_templates.sh:**\n- Retrieve project-specific template preferences\n- Include common proof patterns in scaffolding\n\n**suggest_tactics.sh:**\n- Prioritize tactics that succeeded in this project\n- Warn about tactics with known issues\n\n**sorry_analyzer.py:**\n- Link sorries to similar completed proofs\n- Suggest approaches based on memory\n\n## Limitations and Caveats\n\n**What memories DON'T replace:**\n- Mathematical understanding\n- Lean type system knowledge\n- mathlib API documentation\n- Formal verification principles\n\n**Potential issues:**\n- Stale memories if project evolves significantly\n- Over-fitting to specific project patterns\n- Memory bloat if not maintained\n- Cross-project contamination if scoping fails\n\n**Mitigation:**\n- Regular review of stored memories\n- Confidence scoring and aging\n- Strict project-path scoping\n- User control over memory operations\n\n## Future Enhancements\n\n**Planned features:**\n- Memory visualization dashboard\n- Pattern mining across projects\n- Collaborative memory sharing\n- Automated memory pruning\n- Integration with git history\n- Cross-project pattern detection (with user consent)\n\n## See Also\n\n- **lean4-theorem-proving skill** - Core workflows and automation\n- **MCP memory server docs** - https:\u002F\u002Fmodelcontextprotocol.io\u002Fdocs\u002Fgetting-started\u002Fintro\n- **references\u002Fmemory-patterns.md** - Detailed memory operation examples\n","# Lean 4 Memories\n\n## Overview\n\nThis skill enables persistent learning and knowledge accumulation across Lean 4 formalization sessions by leveraging MCP (Model Context Protocol) memory servers. It transforms stateless proof assistance into a learning system that remembers successful patterns, avoids known dead-ends, and adapts to project-specific conventions.\n\n**Core principle:** Learn from each proof session and apply accumulated knowledge to accelerate future work.\n\n## When to Use This Skill\n\nThis skill applies when working on Lean 4 formalization projects, especially:\n- **Multi-session projects** - Long-running formalizations spanning days\u002Fweeks\u002Fmonths\n- **Repeated proof patterns** - Similar theorems requiring similar approaches\n- **Complex proofs** - Theorems with multiple attempted approaches\n- **Team projects** - Shared knowledge across multiple developers\n- **Learning workflows** - Building up domain-specific proof expertise\n\n**Especially important when:**\n- Starting a new session on an existing project\n- Encountering a proof pattern similar to previous work\n- Trying an approach that previously failed\n- Needing to recall project-specific conventions\n- Building on successful proof strategies from earlier sessions\n\n## How Memory Integration Works\n\n### Memory Scoping\n\nAll memories are scoped by:\n1. **Project path** - Prevents cross-project contamination\n2. **Skill context** - Memories tagged with `lean4-memories`\n3. **Entity type** - Structured by pattern type (ProofPattern, FailedApproach, etc.)\n\n**Example scoping:**\n```\nProject: \u002FUsers\u002Ffreer\u002Fwork\u002Fexch-repos\u002Fexchangeability-cursor\nSkill: lean4-memories\nEntity: ProofPattern:condExp_unique_pattern\n```\n\n### Memory Types\n\n**1. ProofPattern** - Successful proof strategies\n```\nStore when: Proof completes successfully after exploration\nRetrieve when: Similar goal pattern detected\n```\n\n**2. FailedApproach** - Known dead-ends to avoid\n```\nStore when: Approach attempted but failed\u002Flooped\u002Ferrored\nRetrieve when: About to try similar approach\n```\n\n**3. ProjectConvention** - Code style and patterns\n```\nStore when: Consistent pattern observed (naming, structure, tactics)\nRetrieve when: Creating new definitions\u002Ftheorems\n```\n\n**4. UserPreference** - Workflow customization\n```\nStore when: User expresses preference (verbose output, specific tools, etc.)\nRetrieve when: Choosing between options\n```\n\n**5. TheoremDependency** - Relationships between theorems\n```\nStore when: One theorem proves useful for proving another\nRetrieve when: Looking for helper lemmas\n```\n\n## Memory Workflows\n\n### Storing Memories\n\n**After successful proof:**\n```lean\n-- Just proved: exchangeable_iff_fullyExchangeable\n-- Store the successful pattern\n```\n\nStore:\n- Goal pattern: `exchangeable X ↔ fullyExchangeable X`\n- Successful tactics: `[apply measure_eq_of_fin_marginals_eq, intro, simp]`\n- Helper lemmas used: `[prefixCylinder_measurable, isPiSystem_prefixCylinders]`\n- Difficulty: medium (54 lines)\n- Confidence: high (proof clean, no warnings)\n\n**After failed approach:**\n```lean\n-- Attempted: simp only [condExp_indicator, mul_comm]\n-- Result: infinite loop, build timeout\n```\n\nStore:\n- Failed tactic: `simp only [condExp_indicator, mul_comm]`\n- Error: \"infinite simp loop\"\n- Context: conditional expectation with indicator\n- Recommendation: \"Use simp only [condExp_indicator] without mul_comm\"\n\n**Project conventions observed:**\n```lean\n-- Pattern: All measure theory proofs start with haveI\nhaveI : MeasurableSpace Ω := inferInstance\n```\n\nStore:\n- Convention: \"Measure theory proofs require explicit MeasurableSpace instance\"\n- Pattern: `haveI : MeasurableSpace Ω`\n- Frequency: 15 occurrences\n- Files: DeFinetti\u002FViaL2.lean, Core.lean, Contractability.lean\n\n### Retrieving Memories\n\n**Starting new proof session:**\n1. Load project-specific conventions\n2. Retrieve similar proof patterns from past work\n3. Surface any known issues with current file\u002Fmodule\n\n**Encountering similar goal:**\n```\n⊢ condExp μ m X =ᵐ[μ] condExp μ m Y\n\nMemory retrieved: \"Similar goals proved using condExp_unique\"\nPattern: \"Show ae_eq, verify measurability, apply condExp_unique\"\nSuccess rate: 3\u002F3 in this project\n```\n\n**Before trying a tactic:**\n```\nAbout to: simp only [condExp_indicator, mul_comm]\n\nMemory retrieved: ⚠️ WARNING - This combination causes infinite loop\nFailed in: ViaL2.lean:2830 (2025-10-17)\nAlternative: Use simp only [condExp_indicator], then ring\n```\n\n## Integration with lean4-theorem-proving Skill\n\nThe lean4-memories skill complements (doesn't replace) lean4-theorem-proving:\n\n**lean4-theorem-proving provides:**\n- General Lean 4 workflows (4-Phase approach)\n- mathlib search and tactics reference\n- Automation scripts\n- Domain-specific knowledge (measure theory, probability)\n\n**lean4-memories adds:**\n- Project-specific learned patterns\n- History of what worked\u002Ffailed in this project\n- Accumulated domain expertise from your proofs\n- Personalized workflow preferences\n\n**Use together:**\n1. lean4-theorem-proving guides general workflow\n2. lean4-memories provides project-specific context\n3. Memories inform tactics choices from lean4-theorem-proving\n\n## Memory Operations\n\n### Storing a Successful Proof Pattern\n\nAfter completing a proof, store the pattern using MCP memory:\n\n**What to capture:**\n- **Goal pattern** - Type\u002Fstructure of goal (equality, exists, forall, etc.)\n- **Tactics sequence** - Tactics that worked, in order\n- **Helper lemmas** - Key lemmas applied\n- **Difficulty** - Lines of proof, complexity estimate\n- **Confidence** - Clean proof vs sorries\u002Fwarnings\n- **Context** - File, module, theorem name\n\n**When to store:**\n- Proof completed successfully (no sorries)\n- Non-trivial (>10 lines or required exploration)\n- Likely to be useful again (similar theorems expected)\n\n**Storage format:**\n```\nEntity type: ProofPattern\nName: {descriptive_name}\nAttributes:\n  - project: {absolute_path}\n  - goal_pattern: {pattern_description}\n  - tactics: [list, of, tactics]\n  - helper_lemmas: [lemma1, lemma2]\n  - difficulty: {small|medium|large}\n  - confidence: {0.0-1.0}\n  - file: {filename}\n  - timestamp: {date}\n```\n\n### Storing a Failed Approach\n\nWhen an approach fails (error, loop, timeout), store to avoid repeating:\n\n**What to capture:**\n- **Failed tactic** - Exact tactic\u002Fsequence that failed\n- **Error type** - Loop, timeout, type error, etc.\n- **Context** - What was being proved\n- **Alternative** - What worked instead (if known)\n\n**When to store:**\n- Infinite simp loops\n- Tactics causing build timeouts\n- Type mismatches from subtle issues\n- Approaches that seemed promising but didn't work\n\n**Storage format:**\n```\nEntity type: FailedApproach\nName: {descriptive_name}\nAttributes:\n  - project: {absolute_path}\n  - failed_tactic: {tactic_text}\n  - error: {error_description}\n  - context: {what_was_being_proved}\n  - alternative: {what_worked}\n  - timestamp: {date}\n```\n\n### Storing Project Conventions\n\nTrack consistent patterns that emerge:\n\n**What to capture:**\n- **Naming conventions** - h_ for hypotheses, have_ for results\n- **Proof structure** - Standard opening moves (haveI, intro patterns)\n- **Import patterns** - Commonly used imports\n- **Tactic preferences** - measurability vs explicit proofs\n\n**When to store:**\n- Pattern observed 3+ times consistently\n- Convention affects multiple files\n- Style guide established\n\n### Retrieving Memories\n\n**Before starting proof:**\n```\n1. Query for similar goal patterns\n2. Surface successful tactics for this pattern\n3. Check for known issues with current context\n4. Suggest helper lemmas from similar proofs\n```\n\n**During proof:**\n```\n1. Before each major tactic, check for known failures\n2. When stuck, retrieve alternative approaches\n3. Suggest next tactics based on past success\n```\n\n**Query patterns:**\n```\n# Find similar proofs\nsearch_entities(\n  query=\"condExp equality goal\",\n  filters={\"project\": current_project, \"entity_type\": \"ProofPattern\"}\n)\n\n# Check for failures\nsearch_entities(\n  query=\"simp only condExp_indicator\",\n  filters={\"project\": current_project, \"entity_type\": \"FailedApproach\"}\n)\n\n# Get conventions\nsearch_entities(\n  query=\"naming conventions measure theory\",\n  filters={\"project\": current_project, \"entity_type\": \"ProjectConvention\"}\n)\n```\n\n## Best Practices\n\n### Memory Quality\n\n**DO store:**\n- ✅ Successful non-trivial proofs (>10 lines)\n- ✅ Failed approaches that wasted significant time\n- ✅ Consistent patterns observed multiple times\n- ✅ Project-specific insights\n\n**DON'T store:**\n- ❌ Trivial proofs (rfl, simp, exact)\n- ❌ One-off tactics unlikely to recur\n- ❌ General Lean knowledge (already in training\u002Fmathlib)\n- ❌ Temporary workarounds\n\n### Memory Hygiene\n\n**Confidence scoring:**\n- **High (0.8-1.0)** - Clean proof, no warnings, well-tested\n- **Medium (0.5-0.8)** - Works but has minor issues\n- **Low (0.0-0.5)** - Hacky solution, needs refinement\n\n**Aging:**\n- Recent memories (same session) = higher relevance\n- Older memories = verify still applicable\n- Patterns from many sessions = high confidence\n\n**Pruning:**\n- Remove memories for deleted theorems\n- Update when better approach found\n- Mark as outdated if project evolves\n\n### User Control\n\n**Users can:**\n- Toggle lean4-memories skill on\u002Foff independently\n- Clear project-specific memories\n- Review stored memories\n- Adjust confidence thresholds\n- Export\u002Fimport memories for sharing\n\n## Example Workflow\n\n**Session 1: First proof**\n```lean\n-- Proving: measure_eq_of_fin_marginals_eq\n-- No memories yet, explore from scratch\n-- [After 30 minutes of exploration]\n-- ✅ Success with π-system uniqueness approach\n\nStore: ProofPattern \"pi_system_uniqueness\"\n  - Works for: measure equality via finite marginals\n  - Tactics: [isPiSystem, generateFrom_eq, measure_eq_on_piSystem]\n  - Confidence: 0.9\n```\n\n**Session 2: Similar theorem (weeks later)**\n```lean\n-- Proving: fullyExchangeable_via_pathLaw\n-- Goal: Show two measures equal\n-- System: \"Similar to measure_eq_of_fin_marginals_eq\"\n--         Retrieve memory: pi_system_uniqueness pattern\n--         Suggestion: \"Try isPiSystem approach?\"\n\n-- ✅ Success in 5 minutes using remembered pattern\n```\n\n**Session 3: Avoiding failure**\n```lean\n-- Proving: condIndep_of_condExp_eq\n-- About to: simp only [condExp_indicator, mul_comm]\n-- ⚠️ Memory: This causes infinite loop (stored Session 1)\n--          Alternative: simp only [condExp_indicator], then ring\n\n-- Avoid 20-minute debugging session by using memory\n```\n\n## Configuration\n\n### Memory Server Setup\n\nEnsure MCP memory server is configured:\n\n```json\n\u002F\u002F In Claude Desktop config\n{\n  \"mcpServers\": {\n    \"memory\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@modelcontextprotocol\u002Fserver-memory\"]\n    }\n  }\n}\n```\n\n### Project-Specific Settings\n\nMemories are automatically scoped by project path. To work across multiple projects:\n\n**Same formalization, different repos:**\n```\n# Link memories using project aliases\n# (Future enhancement - not yet implemented)\n```\n\n**Sharing memories with team:**\n```\n# Export\u002Fimport functionality\n# (Future enhancement - not yet implemented)\n```\n\n## Integration with Automation Scripts\n\nMemories enhance script usage:\n\n**proof_templates.sh:**\n- Retrieve project-specific template preferences\n- Include common proof patterns in scaffolding\n\n**suggest_tactics.sh:**\n- Prioritize tactics that succeeded in this project\n- Warn about tactics with known issues\n\n**sorry_analyzer.py:**\n- Link sorries to similar completed proofs\n- Suggest approaches based on memory\n\n## Limitations and Caveats\n\n**What memories DON'T replace:**\n- Mathematical understanding\n- Lean type system knowledge\n- mathlib API documentation\n- Formal verification principles\n\n**Potential issues:**\n- Stale memories if project evolves significantly\n- Over-fitting to specific project patterns\n- Memory bloat if not maintained\n- Cross-project contamination if scoping fails\n\n**Mitigation:**\n- Regular review of stored memories\n- Confidence scoring and aging\n- Strict project-path scoping\n- User control over memory operations\n\n## Future Enhancements\n\n**Planned features:**\n- Memory visualization dashboard\n- Pattern mining across projects\n- Collaborative memory sharing\n- Automated memory pruning\n- Integration with git history\n- Cross-project pattern detection (with user consent)\n\n## See Also\n\n- **lean4-theorem-proving skill** - Core workflows and automation\n- **MCP memory server docs** - https:\u002F\u002Fmodelcontextprotocol.io\u002Fdocs\u002Fgetting-started\u002Fintro\n- **references\u002Fmemory-patterns.md** - Detailed memory operation examples\n",{"name":5,"description":7},"main","7eeb258ada72b7f58119b0e7a2c00ea89d9beedd","tasks\u002Flean4-proof\u002Fenvironment\u002Fskills\u002Flean4-memories","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench","https:\u002F\u002Fgithub.com\u002FWaaaalnut","student of Zhejiang University","2026-04-21 23:16:23",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add Waaaalnut\u002Fskillsbench --skill lean4-memories",{"tool":61,"command":62},"bunx","bunx skills add Waaaalnut\u002Fskillsbench --skill lean4-memories",{"tool":64,"command":65},"pnpm","pnpm dlx skills add Waaaalnut\u002Fskillsbench --skill lean4-memories","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Flean4-proof\u002Fenvironment\u002Fskills\u002Flean4-memories\u002FSKILL.md",true,[69,75],{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fmemory-patterns.md","REFERENCE","参考文档",17498,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Flean4-proof\u002Fenvironment\u002Fskills\u002Flean4-memories\u002Freferences\u002Fmemory-patterns.md",{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"scripts\u002Fmemory_helper.py","SCRIPT","脚本",11978,"https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Flean4-proof\u002Fenvironment\u002Fskills\u002Flean4-memories\u002Fscripts\u002Fmemory_helper.py",[82,96,111,136,158,177],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":92,"publishedAt":43},"01M6XEWMJ6VY3ZC53MPDCPG3GH","data-reconciliation","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fxlsx-recover-data\u002Fenvironment\u002Fskills\u002Fdata-reconciliation\u002FSKILL.md",[87],{"categoryNo":88,"categoryName":89,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[93,94,95],"data reconciliation","reconciliation","data",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":43},"01M6XEW8MNPMF1KRXV6ATGFRQF","speech-to-text","Transcribe video to timestamped text using Whisper tiny model (pre-installed).","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-tutorial-indexer\u002Fenvironment\u002Fskills\u002Fspeech-to-text\u002FSKILL.md",[],[103,104,105,106,107,108,109,110],"speech","text","speech to text","transcribe video","whisper","model","Video","transcribe",{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":120,"publishedAt":43},"01M6XEW3FQZP0T1RKQQJFXVY9T","video-processor","Process videos by removing segments and concatenating remaining parts. Use when you need to remove detected pauses\u002Fopenings from videos, create highlight reels, or batch process segment removals using ffmpeg filter_complex.","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Fvideo-processor\u002FSKILL.md",[117],{"categoryNo":118,"categoryName":119,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体",[109,121,122,123,124,125,27,126,127,128,129,130,131,132,133,134,135],"processor","video processor","batch","create","reels","parts","segments","process","videos","you","segment","filter","ffmpeg","use","remove",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":143,"publishedAt":43},"01M6XEVXJ5KZ0NTY3XZKRY4AS1","silence-detector","Detect initial silence segments in audio\u002Fvideo using energy-based analysis. Use when you need to find low-energy periods at the start of recordings (title slides, setup time, pre-roll silence).","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Fsilence-detector\u002FSKILL.md",[142],{"categoryNo":118,"categoryName":119,"taxonomyType":20,"taxonomyTypeDesc":21},[144,145,146,147,27,130,148,149,150,151,152,127,153,154,109,155,156,157,134],"detector","silence detector","title","slides","time","energy","at","recordings","detect","find","Audio","analysis","start","setup",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":43},"01M6XEVT3NGRN1FT7JPMAPXS6M","segment-combiner","Combine multiple segment detection results into a unified list. Use when you need to merge segments from different detectors, prepare removal lists for video processing, or consolidate detection outputs.","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Fsegment-combiner\u002FSKILL.md",[],[131,165,109,166,167,168,169,170,27,171,172,127,130,173,174,134,175,176],"segment combiner","detection","prepare","merge","video processing","for","outputs","combine","processing","consolidate","results","list",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":186,"publishedAt":43},"01M6XEVMPVASGS2KX86QK4FMT7","report-generator","Generate compression reports for video processing. Use when you need to create structured JSON reports with duration statistics, compression ratios, and segment details after video processing.","https:\u002F\u002Fgithub.com\u002FWaaaalnut\u002Fskillsbench\u002Fblob\u002Fmain\u002Ftasks\u002Fvideo-silence-remover\u002Fenvironment\u002Fskills\u002Freport-generator\u002FSKILL.md",[183],{"categoryNo":184,"categoryName":185,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000034","行政与办公人员",[187,188,189,131,27,170,130,190,173,191,192,193,134,169,194,109,195,196,124],"generator","report generator","report","with","statistics","structured","reports","json","compression","generate"]