Lean 4 Memories for Openclaw

A persistent memory skill for Lean 4 that learns successful proof patterns and avoids known dead-ends across formalization sessions.

wu-uk
v0.1.0
Apr 16, 2026
0
658
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install lean4-proof-lean4-memories

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install lean4-proof-lean4-memories using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Lean 4 Memories?

The Lean 4 Memories skill transforms stateless AI assistance into a continuous learning system by leveraging the Model Context Protocol (MCP). By integrating this capability into Openclaw Skills, developers can ensure their AI agents remember successful tactic sequences, project-specific naming conventions, and complex mathematical dependencies. This persistent layer bridges the gap between individual coding sessions, allowing the agent to adapt to your specific formalization style and project history.

At its core, this skill functions as a long-term knowledge repository. Instead of rediscovering the same helper lemmas or repeating the same infinite tactic loops, Openclaw Skills users benefit from a structured memory that grows more intelligent as the project progresses. This is particularly valuable for complex mathematical formalizations where context and historical attempts are critical for finding a valid proof path.

Lean 4 Memories Use Cases

  • Managing long-running formalization projects that span multiple weeks or months
  • Recalling successful tactic patterns for theorems with similar goal structures
  • Preventing the AI from repeating failed approaches like infinite loops or build timeouts
  • Maintaining consistent project conventions across large, multi-file codebases
  • Building a personalized domain-specific library of mathematical proof expertise

How Lean 4 Memories Works

  1. The skill scopes every memory entry by the absolute project path to prevent cross-project context contamination.
  2. When a proof is successfully completed, the agent captures the goal pattern, tactic sequence, and helper lemmas as a ProofPattern.
  3. If an approach fails due to errors or timeouts, it is stored as a FailedApproach to serve as a warning in future attempts.
  4. Upon starting a new session, the skill automatically retrieves project conventions and similar historical patterns from the memory server.
  5. During the proof process, the agent queries stored memories before suggesting tactics to prioritize strategies with high confidence scores.
  6. The system continuously refines its suggestions based on the frequency and success rates of various proof strategies.

Lean 4 Memories Setup

To utilize this skill, you must have the MCP memory server configured in your environment. Openclaw Skills work best when the memory server is properly linked in your configuration file:

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
"    }
  }
}

Once the server is running, the skill will automatically begin tracking and retrieving memories based on your project directory.

Lean 4 Memories Data Schema & Taxonomy

Information is organized into structured entity types to ensure high-speed retrieval and clarity within Openclaw Skills. Data is categorized as follows:

Entity Type Purpose Metadata Captured
ProofPattern Successful proof strategies goal_pattern, tactics, helper_lemmas, difficulty
FailedApproach Known dead-ends to avoid failed_tactic, error_description, suggested_alternative
ProjectConvention Code style and patterns naming_conventions, required_imports, tactic_preferences
UserPreference Workflow customization output_verbosity, tool_selection, confidence_thresholds
TheoremDependency Logical relationships helper_lemma_usage, theorem_hierarchy

Lean 4 Memories Advanced Features

  • Project-path scoping to ensure isolated memory environments for different Lean 4 repositories
  • Confidence scoring (0.0 to 1.0) to help the agent distinguish between hacky workarounds and robust proof patterns
  • Seamless integration with the lean4-theorem-proving skill for combined general knowledge and project-specific context
  • Memory hygiene tools for pruning outdated memories or updating patterns as the project evolves
  • Compatibility with external automation scripts to enhance proof scaffolding and tactic suggestions

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*