axiom-eliminator
Remove nonconstructive axioms by refactoring proofs to structure (kernels, measurability,…
Strategic resolution of stubborn sorries; may refactor across files within the header fence. Use when fast pass fails or for complex proofs.
> /plugin marketplace add cameronfreer/lean4-skillsHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Strategic resolution of stubborn sorries; may refactor across files within the header fence. Use when fast pass fails or for complex proofs.
name: sorry-filler-deep description: Strategic resolution of stubborn sorries; may refactor across files within the header fence. Use when fast pass fails or for complex proofs. tools: Read, Grep, Glob, Edit, Bash, mcp__lean-lsp__lean_goal, mcp__lean-lsp__lean_local_search, mcp__lean-lsp__lean_leanfinder, mcp__lean-lsp__lean_leansearch, mcp__lean-lsp__lean_loogle, mcp__lean-lsp__lean_multi_attempt, mcp__lean-lsp__lean_diagnostic_messages, mcp__lean-lsp__lean_run_code model: opus
Consume the `run-contract/v1` [dispatch record](../skills/lean4/references/handoff-contract.md#dispatch-record-parent--worker) (`record == "dispatch"`): read `target`/`scope`, the `context` envelope (pre-collected LSP state — use it as the starting state when MCP is unavailable), and `owned_files` + `file_baseline` (fail closed on these — see below). Validate the envelope; a missing/malformed field is a `protocol-error` handoff, no mutation.
`parameters` shape for this worker: `{fast_pass_error: string, permission_level: string, deep_budget: {scope, max_files, max_lines}}` (why the fast pass failed, the refactor permission level, and the deep scope/diff budget).
1. **Understand why fast pass failed**:
> **MCP canary:** If both `lean_goal` and `lean_diagnostic_messages` are unavailable > (tool-not-found, missing from context, or otherwise inaccessible), emit > "⚠ Lean MCP tools unavailable in this subagent context" and proceed using > script fallback for search and `lake env lean` / `lake build` for validation. > > **No-MCP hygiene (if canary fails):** MCP tools are tool calls, not shell commands — never invoke them via Bash. Do not probe MCP availability via Bash (`which`, `env`, `ls`) — the canary is authoritative. Stop retrying MCP for this run. Use Read/Grep to inspect files (never write scripts or temp files just to view source). Temp `.lean` files only for real scratch compilation when `lean_run_code` is unavailable. Start from pre-collected context in the parent prompt.
2. **Outline plan FIRST** (~200-500 tokens):
## Sorry Filling Plan **Target:** [file:line] **Why it's hard:** [reasons] **Strategy:** [phases] **Safety checks:** [compile after each phase]
3. **Execute incrementally** with Lean-backed checks after each phase:
4. **Report progress** after each phase and final summary
At the return boundary, emit a complete `run-contract/v1` [handoff record](../skills/lean4/references/handoff-contract.md) — echo `target`/`scope`/`mode`; report `files_owned`/`files_changed` + the final adopted `file_baseline`; set `blocker_kind`/`blocker_class` only when blocker-driven (a deep-safety abort is `blocker_kind: safety-guard`, `blocker_class: null`); and `next_action`. The human-readable phase reports below are in addition to that record.
Phase reports (~300-500 tokens each):
## Phase N Complete **Actions:** [changes made] **Compile status:** ✓/✗ **Next phase:** [what's next]
Final summary (~200-300 tokens):
## Sorry Filled Successfully **Strategy:** compositional/structural/novel **Files changed:** N **Helpers added:** M **Axioms:** 0
Lean 4 workflow pack for AI coding agents. Gives your agent a structured prove/review/golf loop, mathlib search, axiom checking, and safety guardrails.
Remove nonconstructive axioms by refactoring proofs to structure (kernels, measurability,…
Golf Lean 4 proofs after they compile; improve proofs for directness, clarity, performance,…
Compiler-guided iterative proof repair with two-stage repair escalation (fast → strong). Use…