rich

rich is a cursor rule for coding agents from sanjeed5/awesome-cursor-rules-mdc. It costs 1,749 tokens per session, scanned A, original, CC0-1.0.

A set of guidelines for building Python command-line applications with Rich, a library for formatted terminal output. It covers shared console setup, readable interfaces, and testable code organization.

In plain words
What is it for?
Use it when creating or reviewing Python terminal output, tables, progress displays, and interactive command-line interfaces.
Why use it?
It prevents inconsistent output and unnecessary console objects across a CLI application. The rules provide a common structure for displaying information in the terminal.

Cursor rule

About the project

awesome-cursor-rules-mdc is a generator that creates Cursor MDC rule files from structured library information, using semantic search and language models to gather and organize guidance. Developers use it to produce reusable rules for libraries in Cursor, and the catalogue includes 200 of those rules.

sanjeed5/awesome-cursor-rules-mdc · 3,571 stars · on GitHub

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 rules/sanjeed5/awesome-cursor-rules-mdc/rich
Clone the repo
git clone --depth 1 https://github.com/sanjeed5/awesome-cursor-rules-mdc

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 rich

README.md
[![agentmods](https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/rich.svg)](https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/rich)
Your own site
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/rich"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/rich.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,749 This file is loaded in full into every session.
When invoked 1,749 The same file — it is already loaded in full.
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.01749 $0.01749
Opus 5 $0.00874 $0.00874
Sonnet 5 $0.00350 $0.00350
Haiku 4.5 $0.00175 $0.00175

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

Security

Grade A, and why

rich 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 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.

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.

rules-mdc/rich.mdc · 225 lines

How it starts

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

rich Best Practices

rich transforms plain terminal output into engaging, readable interfaces. These rules ensure your rich applications are performant, testable, and follow modern Python best practices.

1. Code Organization: Centralize Console Management

Instantiate Console once per application run. Avoid creating new Console objects in every function or module, as this leads to inconsistent styling, performance overhead, and potential issues with interactive elements. Pass the Console instance explicitly or use a global singleton pattern for CLI applications.

❌ BAD: Repeated Console instantiation

# module_a.py
from rich.console import Console
def do_something():
    console = Console() # New console every time
    console.print("Doing something...")

# module_b.py
from rich.console import Console
def do_another_thing():
    console = Console() # Another new console
    console.print("Doing another thing...")

✅ GOOD: Single Console instance

# main.py
from rich.console import Console
from .module_a import do_something
from .module_b import do_another_thing

console = Console() # Instantiate once at the top-level

def main():
    console.print("[bold green]Starting application...[/bold green]")
    do_something(console)
    do_another_thing(console)
    console.print("[bold green]Application finished.[/bold green]")

if __name__ == "__main__":
    main()

# module_a.py
from rich.console import Console
def do_something(console: Console): # Pass console explicitly
    console.print("Doing something...")

# module_b.py
from rich.console import Console
def do_another_thing(console: Console): # Pass console explicitly
    console.print("Doing another thing...")

2. Output: Always Use console.print()

For any output intended to be styled or managed by rich, use console.print(). Mixing print() with console.print() can lead to unpredictable output order and styling issues, especially with interactive elements like progress bars or live displays.

Read the full file on GitHub · 225 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 · 225 lines · 1,749 tokens per session scan A d1dc0294a5de

Subscribe to this mod's changes

rich is a cursor rule published in the GitHub repository sanjeed5/awesome-cursor-rules-mdc (3,571 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 1,749 tokens to every session, about $0.0087 per session on Opus 5. 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-09-03.