python-env

python-env is a cursor rule for Cursor from AI-Learning-Gems/AI-Learning-Gems.github.io. It costs 386 tokens per session, scanned C, original, MIT.

A project rule that requires Python and package commands to run in the ai-learning-gems conda environment, an isolated setup for project dependencies.

In plain words
What is it for?
Use it whenever project workflows or scripts need Python, pip, or related package commands.
Why use it?
It reduces errors caused by using the wrong Python installation or missing packages.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions subagents.

Good fit Use it whenever project workflows or scripts need Python, pip, or related package commands.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ai-learning-gems/ai-learning-gems.github.io/python-env
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.

Clone the repo
git clone --depth 1 https://github.com/AI-Learning-Gems/AI-Learning-Gems.github.io

Made for: Cursor.

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 python-env

README.md
[![agentmods](https://agentmods.dev/badge/rules/ai-learning-gems/ai-learning-gems.github.io/python-env/github.svg)](https://agentmods.dev/rules/ai-learning-gems/ai-learning-gems.github.io/python-env)
Your own site
<a href="https://agentmods.dev/rules/ai-learning-gems/ai-learning-gems.github.io/python-env"><img src="https://agentmods.dev/badge/rules/ai-learning-gems/ai-learning-gems.github.io/python-env/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.

agentmods 80×15 button for python-env

Your own site · 80×15
<a href="https://agentmods.dev/rules/ai-learning-gems/ai-learning-gems.github.io/python-env"><img src="https://agentmods.dev/badge/rules/ai-learning-gems/ai-learning-gems.github.io/python-env.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 386 This file is loaded in full into every session.
When invoked 386 The same file — it is already loaded in full.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00386 $0.00386
Opus 5.5 $0.00154 $0.00154
Sonnet 5.5 $0.00077 $0.00077
Haiku 4.5 $0.00039 $0.00039

Measured 1mo ago against content hash 3ee296eb6869, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

python-env scanned grade C 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 1mo 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **ALWAYS** double-quote file paths in `rm` commands to prevent word-splitting on spaces, e.g. `rm -rf "/path/to/folder/"`.
.cursor/rules/python-env.mdc · 33 lines

What it actually says

Python Environment

This project uses a conda environment named ai-learning-gems.

Terminal Commands

PREFERRED: Use the full path to the Python executable. This works reliably in all contexts (interactive shells, IDE subprocesses, subagents, non-interactive scripts):

$(conda info --base)/envs/ai-learning-gems/bin/python script.py

FALLBACK: If you are in an interactive terminal where conda has been initialized, you can activate the env:

conda activate ai-learning-gems

WHY: conda activate requires shell hooks from conda init which are loaded by .zshrc/.bashrc. IDE-spawned subshells (Cursor, Antigravity, Windsurf) often don't source these files, causing CondaError: Run 'conda init' before 'conda activate'. The full path approach bypasses this entirely.

Rules

  • ALWAYS use $(conda info --base)/envs/ai-learning-gems/bin/python when running Python in terminal commands, especially in workflows and subagents.
  • For pip and uv pip, use: $(conda info --base)/envs/ai-learning-gems/bin/pip or activate first if in an interactive shell.
  • NEVER use bare python or pip without the env path or activation.
  • NEVER use the base conda env or system Python.
  • ALWAYS double-quote file paths in rm commands to prevent word-splitting on spaces, e.g. rm -rf "/path/to/folder/".
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. 1mo ago First seen · 33 lines · 386 tokens per session scan C 3ee296eb6869

Subscribe to this mod's changes

python-env is a cursor rule published in the GitHub repository AI-Learning-Gems/AI-Learning-Gems.github.io (23 stars, last pushed 4mo ago), licensed MIT. It adds 386 tokens to every session, about $0.0015 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.