Lean Archive
Use this skill after a .lean file has been registered under
${DATA_DIR:-data}/raw_sources/<hash12>/.
This workflow has three phases. Each phase needs human confirmation before
proceeding.
Phase 1: Organize
- Locate the file:
```bash
find "${DATA_DIR:-data}/raw_sources" -maxdepth 2 -name "<filename.lean>" | head -1
```
- Read the full file.
- Build a structural map:
- declarations:
theorem,lemma,proposition,corollary,def,
abbrev, axiom, structure, class, instance
- declaration name and type signature
- preceding docstring
- proof status: proved, partial (
sorry), or axiom - namespaces and imports
- Propose thematic split:
```text
Raw file: <filename> (<n> declarations)
Proposed units:
[A] <ThematicName> (<n> declarations)
- <description>
Declarations: ...
```
- Wait for confirmation.
- Write confirmed units to
${DATA_DIR:-data}/lean/<ThematicName>.leanwith
an archive header preserving source path and date.
Phase 2: Index
For each organized file, create
${DATA_DIR:-data}/wiki/Lean_<ThematicName>.md:
---
tags: [lean, formal-proof]
date: YYYY-MM-DD
lean_file: $DATA_DIR/lean/<ThematicName>.lean
proof_status: proved | partial | mixed
source_count: 1
---
Include:
## Overview## Declarationstable## Connections
Update ${DATA_DIR:-data}/wiki/index.md:
- proved/mixed units under
## Formal Proofs - meaningful
sorrydeclarations under## Conjectures - relevant unresolved issues under
## Obstruction
Wait for confirmation before Phase 3.
Phase 3: Cross-Index
- Read
${DATA_DIR:-data}/wiki/index.md. - Match Lean cards to existing
Concept_*pages by declaration names, type
signatures, and docstrings.
- Add
## Formal Proofslinks to matched concept pages. - Fill
## Connectionsin each Lean card. - Move the raw source manifest entry to
## Ingested;Wiki pageshould list
all created [[Lean_*]] cards.
- Append
${DATA_DIR:-data}/wiki/log.md:
```markdown
## [YYYY-MM-DD] ingest-lean | <original filename>
- Organized into: <files>
- Created cards: <cards>
- Updated concepts: <concepts or "none">
- Proof status: <n proved>, <n partial>, <n axioms>
```
- Commit changed
${DATA_DIR:-data}/lean/,${DATA_DIR:-data}/wiki/, and
manifest files unless the human asks not to.