python-code-validator AGENTS.md

Project instructions for checking Python code with a validation service before it is presented.

In plain words
What is it for?
They help define examples, validate edited files, and execute finished functions in a temporary offline container to check their actual results.
Why use it?
They reduce the chance of shipping code that parses but has style, type, security, credential, or behavior problems.

Instructions file for CodexOpenCode

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 instructions/jkanselaar/python-code-validator/agents-md
Clone the repo
git clone --depth 1 https://github.com/jkanselaar/python-code-validator

Made for: Codex, OpenCode.

Per session 654 This file is loaded in full into every session.
When invoked 654 The same file — it is already loaded in full.
Security scan A 1 finding. 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.00654 $0.00654
Opus 5 $0.00327 $0.00327
Sonnet 5 $0.00131 $0.00131
Haiku 4.5 $0.00065 $0.00065

Measured yesterday against content hash e7a1ded3232c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-code-validator AGENTS.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 yesterday.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sf https://api.statemind.ai/v1/client -o validate.py
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

AGENTS.md · 58 lines

How it starts

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

Python you write here gets checked

Use this service the way a compiler is used: not once at the end, but at every step, and never present code that has not come back accepted.

Say what the code is for, before you write it

Turn the request into examples first — assert bitcount(127) == 7, or doctest lines — and pass them in options.examples on every call from then on. This is the only check that can fail code which parses, lints, type-checks and runs, and generated code almost never carries examples of its own: the agent that was asked knows what was asked, and nothing else does.

While you write

  • After every draft or edit of a file, call validate_python. It parses, lints (ruff), type-checks (mypy), applies an AST security policy and scans for credentials, without running anything.
  • When a function is finished, call execute_python with your examples. It runs the code in a throwaway container with no network and a read-only filesystem, and checks the examples against what it actually does. Call it again when what the code does has changed — not after renaming a variable, reformatting, or editing a comment, and never twice on the same source: the answer cannot differ, and running it costs the caller ten times what a check costs.
  • repair_python is the same repair without running anything: use it when the code is not meant to run, or when the checks alone already name the problem.

When something comes back wrong

  • Read fixed_code first. When it is filled in, the service already found and ran a program that satisfies your examples — take it. That is a proven fix, not a suggestion, and rewriting the algorithm yourself instead throws the proof away.
  • A null fixed_code means nothing could be proven, not that the call failed. Then rewrite it yourself, using the diagnostics as evidence: a python:example-mismatch says which example failed and what the code gave instead, which is the fact your next attempt has to account for.
  • Validate again after the rewrite. An unvalidated fix is a new draft.

Read the full file on GitHub · 58 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. yesterday First seen · 58 lines · 654 tokens per session scan A e7a1ded3232c

Subscribe to this mod's changes

python-code-validator AGENTS.md is an instructions file published in the GitHub repository jkanselaar/python-code-validator (0 stars, last pushed 15d ago), licensed MIT. It adds 654 tokens to every session, about $0.0033 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

logic-lens CLAUDE.md

Instructions for hyhmrright/logic-lens, covering logic-lens — developer guide (claude code), project layout, conventions, skill.md structure and guide files.

hyhmrright/logic-lens · 2,842 tokens

logic-lens AGENTS.md

Instructions for hyhmrright/logic-lens, covering logic-lens — developer guide (codex cli), invoking skills, project layout, key conventions and no hooks.

hyhmrright/logic-lens · 304 tokens

logic-lens GEMINI.md

Instructions for hyhmrright/logic-lens, covering logic-lens — developer guide (gemini cli), invoking skills, installation, project layout and key conventions.

hyhmrright/logic-lens · 285 tokens

horizon-shield GEMINI.md

Gemini CLI instructions for ogasurfproject-jpg/horizon-shield: You have the HORIZON SHIELD tools available. HORIZON SHIELD audits Japanese construction and renovation cost estimates against the open JCCDB dataset (95,403 line items) and returns fair-price references as tamper-evident, independently recomputable…

ogasurfproject-jpg/horizon-shield · 332 tokens

turnale GEMINI.md

Gemini CLI instructions for turnale-app/turnale: You can run recreational racket-sport tournaments (tennis, padel, pickleball, badminton, squash, table tennis) end to end through the turnale MCP server.

turnale-app/turnale · 226 tokens

mcp GEMINI.md

Gemini CLI instructions for Martini-Film/mcp: Martini is an AI video production tool for filmmakers. This extension connects Gemini CLI to Martini's hosted MCP server at https://www.martini.film/mcp.

Martini-Film/mcp · 344 tokens