python-performance

A performance review agent for Python payment-processing code, with checks for speed, memory use, and service targets.

In plain words
What is it for?
Benchmarking XML generation and CSV or SQLite loading, checking long-running memory use, and flagging slowdowns above the stated baseline.
Why use it?
It helps detect slowdowns, memory leaks, and missed processing-time limits when payment code changes.

Agent

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 agents/sebastienrousseau/pain001/python-performance
Clone the repo
git clone --depth 1 https://github.com/sebastienrousseau/pain001
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,486 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.00000 $0.01486
Opus 5 $0.00000 $0.00743
Sonnet 5 $0.00000 $0.00297
Haiku 4.5 $0.00000 $0.00149

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

Security

Grade A, and why

python-performance 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 2d 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.

.github/agents/python-performance.md · 199 lines

How it starts

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

Python Performance Tollgate

Mission

Enforce SLO compliance and prevent performance regressions in payment processing.

Tollgate Objectives

  • Enforce XML generation < 500ms for 1000 transactions
  • Enforce test suite < 60s execution time
  • Enforce no memory leaks in long-running operations
  • Detect performance regressions > 10% slowdown

When This Tollgate Applies

  • Modifying pain001/core/core.py (orchestration)
  • Modifying pain001/xml/generate_xml.py (XML generation)
  • Modifying pain001/data/loader.py (data loading)
  • Adding new features that process large datasets

Tollgate Checks

1. Benchmark XML Generation (MANDATORY)

# Run performance benchmark
poetry run pytest tests/test_performance.py --benchmark-only

# Expected output:
# test_xml_generation_1000_transactions: < 500ms (mean)
# test_csv_loading_10000_rows: < 200ms (mean)
# test_db_loading_10000_rows: < 150ms (mean)

Success Criteria:

  • XML generation: < 500ms for 1000 transactions
  • CSV loading: < 200ms for 10,000 rows
  • SQLite loading: < 150ms for 10,000 rows
  • No regression > 10% from baseline

2. Memory Profiling (For Large Dataset Changes)

# Profile memory usage
poetry run python -m memory_profiler scripts/profile_memory.py

# Check for leaks:
grep -i "leak\|growing\|increase" memory_profile.log

Success Criteria:

  • Peak memory < 500MB for 10,000 transactions
  • No memory growth in repeated runs
  • Proper cleanup of file handles and connections

3. Test Suite Performance (MANDATORY)

# Time full test suite
time poetry run pytest

# Must complete in < 60s

Success Criteria:

  • Total test time: < 60 seconds
  • Individual test: < 5 seconds (except integration tests)
  • No tests marked slow without justification

4. Cyclomatic Complexity (Code Maintainability)

# Check complexity scores
poetry run radon cc pain001/ -a -nb

# Flag functions with complexity > 10
poetry run radon cc pain001/ -n C

Success Criteria:

  • Average complexity: < 5 (A grade)
  • No functions > 15 complexity (refuse D/F grades)
  • Refactor complex functions into smaller units

Read the full file on GitHub · 199 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. 2d ago First seen · 199 lines · 0 tokens per session scan A 72e94485b650

Subscribe to this mod's changes

python-performance is an agent published in the GitHub repository sebastienrousseau/pain001 (49 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,486 tokens. 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.

Related

Other agents, from other repositories

policy-analyst

Use when the user asks to analyze policy questions that combine local tabular data with US government sources — jurisdiction comparisons, fiscal-impact analysis, demographic/employment/crime context, or "is policy X working?" questions referencing Census, BLS, FBI Crime Data, or Wikidata. Prefer data-analyst for plain…

dathere/qsv · 77 tokens

gxp-validator

Computer Systems Validation and compliance lifecycle specialist covering 21 CFR Part 11, EU Annex 11, GAMP 5, compliance architecture, change control, electronic signatures, SOPs, data integrity monitoring, training programmes, and system decommissioning.

pjt222/agent-almanac · 53 tokens

data-wrangler

Use when the user asks to clean, transform, reshape, dedupe, join, concatenate, sort, replace, or convert tabular data and produce new output files — e.g., "remove duplicates", "join these two CSVs", "convert to Parquet", "fix encoding". Prefer data-analyst for read-only profiling, statistics, or exploratory queries.

dathere/qsv · 79 tokens

perf-reviewer

Use this agent to audit qsv code changes for performance regressions and optimization opportunities — wasteful allocations/clones, inefficient iterator and I/O patterns, in-loop regex compilation, and missed parallelism. It reports findings with impact estimates and suggested alternatives but does NOT apply fixes.…

dathere/qsv · 76 tokens

security-reviewer

Use this agent to audit qsv code changes for security issues — unsafe-code misuse, input-validation gaps, command injection, resource exhaustion, and information disclosure. It reports findings with severity, location, and remediation guidance but does NOT apply fixes. Trigger before merging changes to network-facing…

dathere/qsv · 78 tokens

mp-integration-expert

Use when implementing, reviewing, or debugging any Mercado Pago payment integration. Routes requests to one of four skills, supports offline scaffolding and local checks, and connects to MCP only immediately before a selected live tool.

mercadopago/mercadopago-claude-marketplace · 48 tokens