Monty is a minimal Python interpreter written in Rust that runs AI-generated code in a restricted environment without direct filesystem, environment-variable, or network access. It is for AI agents that need to execute Python and type-checking tasks while allowing developers to control which host functions and objects the code can use, and the catalogue entries integrate it into agent workflows.
Borrowing it
Nothing to install: this file belongs to pydantic/monty. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/pydantic/monty/main/CLAUDE.mdgit clone --depth 1 https://github.com/pydantic/montyWrote 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.
[](https://agentmods.dev/instructions/pydantic/monty/claude-md)<a href="https://agentmods.dev/instructions/pydantic/monty/claude-md"><img src="https://agentmods.dev/badge/instructions/pydantic/monty/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/pydantic/monty/claude-md"><img src="https://agentmods.dev/badge/instructions/pydantic/monty/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.17073 | $0.17073 |
| Opus 5.5 | $0.06829 | $0.06829 |
| Sonnet 5.5 | $0.03415 | $0.03415 |
| Haiku 4.5 | $0.01707 | $0.01707 |
Grade A, and why
monty CLAUDE.md scanned grade A with 1 finding 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.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
- subprocess/shell execution - os.system, subprocess, etc. How it starts
The opening of the file, as written. The whole thing — 1,183 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
DON'T COMMIT UNLESS EXPLICITLY ASKED TO DO SO BY THE USER! Previous commit requests do not matter - don't commit unless you've just been explicitly asked to do so.
Project Overview
Monty is a sandboxed Python interpreter written in Rust. It parses Python code using Ruff's ruff_python_parser but implements its own runtime execution model for safety and performance. It supports a subset of Python features.
Project goals:
- Safety: Execute untrusted Python code safely without FFI or C dependencies, instead sandbox will call back to host to run foreign/external functions.
- Performance: Fast execution through compile-time optimizations and efficient memory layout
- Simplicity: Clean, understandable implementation focused on a Python subset
- Snapshotting and iteration: Plan is to allow code to be iteratively executed and snapshotted at each function call
- Cross-platform: Runs on Linux, macOS, and Windows (and any other OS that can run Rust)
- Targets the latest stable version of Python, currently Python 3.14
monty-types — shared boundary types
The public data types (the MontyGraph/MontyNode value graph and the MontyObject/CallArgs/NamedValues
built on it, MontyException/ExcType, OsFunctionCall +
its arg structs, ResourceLimits/ResourceTracker, PrintStream/PrintWriter,
CompileOptions, ExtFunctionResult, FileMode, ...) live in crates/monty-types,
which depends on no other monty crate except the monty-macros derives. monty
depends on monty-types but does not blanket re-export it — only a few types
are re-exported inline where they appear in monty's public API (e.g.
run::CompileOptions, run_progress::{ExtFunctionResult, NameLookupResult}).
Code needing MontyObject, MontyException, OsFunctionCall, etc. must
depend on monty-types directly.
Host-side crates (monty-fs, monty-pool, monty-proto without its worker
feature, monty-python, monty-js) MUST depend on monty-types, NOT monty —
this keeps the interpreter out of their binaries. Only the worker side
(monty-runtime, monty-wasm-runtime, monty-proto with worker) links the
interpreter. Don't add a monty dependency to a host-side crate; if it needs a
type, that type belongs in monty-types.
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.
- 3d ago Changed · +7 lines · +121 tokens per session 3d6a94b09f53
- 5d ago Changed · +6 lines · +151 tokens per session f8ad6fe1f9a5
- 8d ago Changed · +4 lines · +63 tokens per session a468ed4db1b3
- 9d ago Changed · +4 lines · +99 tokens per session 84c5e019ac18
- 11d ago Changed · +15 lines · +260 tokens per session 9282a957afe5
- 14d ago Changed · +2 lines · +29 tokens per session 7a02170b33a7
- 19d ago Changed · +1 lines · +40 tokens per session ddd8439c0f41
- 27d ago Changed · +12 tokens per session c835a1a41eab
- 1mo ago Changed · -90 lines · -1,160 tokens per session 2074453b55b2
- 1mo ago First seen · 1,234 lines · 17,458 tokens per session scan A a494a8c0c712
monty CLAUDE.md is an instructions file published in the GitHub repository pydantic/monty (8,801 stars, last pushed today), licensed MIT. It adds 17,073 tokens to every session, about $0.0683 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.