Lean Guard — AI skill for Claude Code
A policy layer for AI coding agents, written and proved in Lean 4. Every Claude Code tool call is checked by a decision function with machine-checked guarantees: no exfiltration after reading a secret.
How to install Lean Guard
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open singularityhacker/lean-guard and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Lean Guard does
A policy layer for AI coding agents, written and proved in Lean 4. Every Claude Code tool call is checked by a decision function with machine-checked guarantees: no exfiltration after reading a secret, workspace containment, deny-wins, default-deny, action budgets.
Alternatives in AI
- Cursor Talk To Figma MCP — TalkToFigma: MCP integration between AI Agent (Cursor, Claude Code, Codex) and Figma, allowing Agentic AI to c 7k ★
- ARIS Agent Guide — For AI agents reading this repo 6.2k ★
- System — You are YouClaw, a helpful AI assistant 684 ★
README
lean-guard
[](https://github.com/singularityhacker/lean-guard/actions/workflows/ci.yml)
A policy layer for coding agents, written and **proved** in Lean 4.
Every tool call Claude Code makes goes through a Claude Code `PreToolUse` hook to a native Lean binary. The binary decides **allow** (defer to Claude Code's normal permissions), **ask** (hand the call to a human) or **deny**, and keeps per-session state. The decision function comes with machine-checked proofs. It complements a VM or container: the VM limits what *can* happen, and the guard decides what *should*.
Claude Code ──PreToolUse JSON──► lean-guard ──► parse → Action (trusted, Guard/Hook.lean)
decide / step (proved, Guard/Core.lean)
◄── "" | ask | deny
What is proved
All theorems are in [`Guard/Theorems.lean`](Guard/Theorems.lean). They hold for **every** policy, state and action, not just test cases. `tests/Axioms.lean` checks that none of them uses `sorry`.
| Theorem | Guarantee |
|---|---|
deny_wins |
If a deny rule matches, the answer is deny, never ask or allow. |
unlisted_tool_not_allowed, unlisted_program_not_allowed, malformed_not_allowed |
Default deny: anything not on an allow-list, or anything the parser can't understand, never runs without a human. |
write_contained, exec_contained, read_contained |
Allowed writes, and allowed commands with every path they mention, are inside the workspace by component prefix (/ws-evil is not inside /ws). |
resolve_clean |
Path normalization leaves no ., .. or empty components. |
no_exfiltration |
In any session, once an action that may read a secret goes ahead, every later action that may send data off the machine is denied, whatever happened before or in between. |
budget_respected |
Across any t |
Related Skills
BulkheadScope
Sandbox policy reality-check and least-privilege minimizer for AI coding agents. Merges every permission layer
Memory Lean
A token-lean MCP memory server for AI coding agents: a knowledge graph your agent can search without reading t
Gestao De Projetos PM IA BSC DashBoard
🧭 Stop paying for AI in the dark. Turn ChatGPT/Claude/Copilot spend into auditable ROI: LLM observability → 7
Jev Ultrafast MCP
Hand the browser work off: an MCP server where a decision model drives the page for your agent, so a flow cost
Legible
Plain writing, a live canvas and local explainer videos for Claude Code, after Karpathy's post on reading LLM
Rollcage Guard
Free, open-source hook that stops AI coding agents (Claude Code, Codex, Cursor, Gemini CLI) from reading secre
Related Agents
Mod Builder
Creates and changes Claude Code mods — plugins of function hooks behind a pane, band, status line, slash comma
Fast Finder
The way into KNOWLEDGE.md, KNOWHOW.md and REFEREE.md. Call instead of reading any of them when you need what i
Kenaz
Audits the security of Claude Code plugins, MCP servers, and AI agents before installation. Analyzes executabl