checkpoint

checkpoint is a command for coding agents from cameronfreer/lean4-skills. It costs 9 tokens per session (2,230 once invoked), scanned A, original, MIT.

A checkpoint command that verifies Lean 4 files and the project, checks for custom axioms, and creates a Git commit. Git is a system for recording changes to code over time.

In plain words
What is it for?
Use it to run file and project builds, perform axiom checks, optionally run the mathlib root-file check, and commit the verified state.
Why use it?
It gives a saved, verified point in the project before further work. The checks can reveal broken files or unwanted assumptions before the checkpoint is recorded.

Command

Part of the lean4 plugin — 1 skill, 12 commands, 4 agents, 3 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/cameronfreer/lean4-skills/checkpoint
Clone the repo
git clone --depth 1 https://github.com/cameronfreer/lean4-skills

Or install lean4, the plugin that ships this one along with the rest of its 1 skill, 12 commands, 4 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for checkpoint

README.md
[![agentmods](https://agentmods.dev/badge/commands/cameronfreer/lean4-skills/checkpoint.svg)](https://agentmods.dev/commands/cameronfreer/lean4-skills/checkpoint)
Your own site
<a href="https://agentmods.dev/commands/cameronfreer/lean4-skills/checkpoint"><img src="https://agentmods.dev/badge/commands/cameronfreer/lean4-skills/checkpoint.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,230 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.02230
Opus 5 $0.00005 $0.01115
Sonnet 5 $0.00002 $0.00446
Haiku 4.5 $0.00001 $0.00223

Measured 3d ago against content hash 8744d6ae672c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

checkpoint scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/lean4/commands/checkpoint.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lean4 Checkpoint

Creates a checkpoint with per-file and project-wide build verification, axiom check, and commit.

Usage

/lean4:checkpoint
/lean4:checkpoint "optional custom message"
/lean4:checkpoint --mathlib-mk-all      # force the mk_all root-file gate
/lean4:checkpoint --no-mathlib-mk-all   # skip the mk_all root-file gate

Invocation Contract

Interpret this command's inputs per the Command Invocation Contract.

Primary path (hook-validated): If a validated-invocation block for this command appears in context, treat it as the authoritative interpretation of parser-decidable inputs and do not re-parse the raw invocation text for those inputs. Start by reading all parser-decided fields from the block. Emit the final Resolved Inputs summary from the block values. See Validated Invocation Block.

Fallback path (other hosts): If no validated-invocation block is present, parse the raw invocation text against this command's input table before acting.

Startup requirements:

  1. Emit a Resolved Inputs block with explicit values, defaults, ignored flags, and startup validation errors — including the effective mk_all-gate decision and its source (flag, the helper's intent.source, or helper-failure).
  2. Refuse to start on startup validation errors (e.g. both --mathlib-mk-all and --no-mathlib-mk-all).

Inputs

Arg Required Description
message No Custom commit message suffix
--mathlib-mk-all No Force the Generated Root Files gate on, overriding project-context detection. Mutually exclusive with --no-mathlib-mk-all.
--no-mathlib-mk-all No Force the Generated Root Files gate off, overriding project-context detection. Mutually exclusive with --mathlib-mk-all.

Actions

  1. Verify Touched Files - For each existing added/modified .lean file in the candidate set for this checkpoint — the files touched during this session that the Stage and Commit step will stage, determined independently of the current git index (staging happens later) — compile individually:
    lake env lean <path/to/File.lean>   # from project root
    
    If any file fails, stop and report the error before proceeding.
  2. Generated Root Files gate (mathlib) - See Generated Root Files below. Runs before the project build; skips entirely unless the gate fires.
  3. Verify Build - Run lake build for the project-wide gate (catches cross-file issues not visible in per-file compilation)
  4. Best-effort Axiom Scan - Scan for non-standard axioms in top-level declarations:
    lean4-skills-check-axioms-inline .
    
    Note: checks top-level unindented declarations across all namespaces in each file (nested, sibling, and dotted namespaces are tracked correctly; sections are handled without leaking into the qualified name). Recognizes theorem|lemma|def|instance|abbrev|example|structure|class|inductive|axiom|constant, optionally prefixed by noncomputable, unsafe, partial, or nonrec. Indented declarations and unicode-identifier decls are not matched — files whose decls all fall in those classes are surfaced as UNVERIFIED (exit 1, not a silent pass). The script temporarily edits files in place while running — only use on version-controlled files, and avoid concurrent editors or watchers.
  5. Count Sorries - Report current sorry count:
    lean4-skills-sorry-analyzer . --format=summary
    
  6. Stage and Commit - Stage only files touched during this session, then commit:
    git add <files touched during this session>
    git diff --cached --name-only   # print exact staged set
    git commit -m "checkpoint(lean4): [summary]"
    
    Never use git add -A or broad glob patterns.
  7. Report Status - Show what was saved

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 146 lines · 9 tokens per session scan A 8744d6ae672c

Subscribe to this mod's changes

checkpoint is a command published in the GitHub repository cameronfreer/lean4-skills (418 stars, last pushed 7d ago), licensed MIT. It adds 9 tokens to every session and 2,230 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.