[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BX34N9SEKTD5GV9VDVTZKG":3,"skill-same:01M7BX34N9SEKTD5GV9VDVTZKG":57},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7BX34N9SEKTD5GV9VDVTZKG","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","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Flean4-proof-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Flean4-memories\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Flean4-proof-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Flean4-memories",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill lean4-memories",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill lean4-memories",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill lean4-memories","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Flean4-proof-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Flean4-memories\u002FSKILL.md",true,[45,51],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fmemory-patterns.md","REFERENCE","参考文档",17498,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Flean4-proof-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Flean4-memories\u002Freferences\u002Fmemory-patterns.md",{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"scripts\u002Fmemory_helper.py","SCRIPT","脚本",11978,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Flean4-proof-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Flean4-memories\u002Fscripts\u002Fmemory_helper.py",[58,65,72,79,84,89],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":80,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":85,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":90,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]