Universal BiDi (RTL/LTR) Formatting Standard & Typography for AI Coding Agents
Zero-token bloat, native Markdown preservation, and isolated LTR code blocks for Persian, Arabic, Urdu, and Hebrew.
English • 🇮🇷 راهنمای فارسی (Persian)
When AI coding assistants (like Google Antigravity, Cursor, Windsurf, Copilot, or Claude Code) generate responses in right-to-left (RTL) languages like Persian, Arabic, Urdu, or Hebrew, severe text-rendering bugs occur:
- Inverted Punctuation & Brackets: Parentheses
(), brackets[], and quotation marks get inverted and jump across lines. - Reversed Paths & URLs: File paths (
/var/log/...orC:\Users\...) and URLs get scrambled backward. - Broken Markdown Tables: Columns render in reversed order or get converted into ugly, bulky raw HTML.
- Token Bloat in Old Fixes: Older community workarounds forced hundreds of characters of inline CSS styling on every single paragraph, slowing down generation and consuming token quota.
Agent RTL Fix completely solves this using a lightweight, native BiDi wrapper architecture with zero token bloat.
You don't need to open a terminal to enable this. Simply copy and paste this single prompt directly into your AI agent's chat window (in Antigravity, Cursor, Windsurf, Claude Code, or Copilot):
Please read the universal BiDi formatting standard from:
https://raw.githubusercontent.com/dalroot/agent-rtl-fix/main/rules/AGENTS.md
and save it as an always-on rule in this workspace/environment.
Running the installer script automatically installs core Vazirmatn fonts, enables BiDi highlighting in your editor settings, and registers the global machine-wide rule:
irm https://raw.githubusercontent.com/dalroot/agent-rtl-fix/main/install.ps1 | iexcurl -fsSL https://raw.githubusercontent.com/dalroot/agent-rtl-fix/main/install.sh | bash- Download
agent-rtl-fix-v2.0.0.zipfrom the Latest Release. - Extract the archive and run
install.bat(Windows) orbash install.sh(Linux/macOS).
| AI Coding Agent | Configuration Location | Rule File in this Repo | Setup Action |
|---|---|---|---|
| Google Antigravity | ~/.gemini/config/rules/ |
rules/antigravity.md |
Installed automatically system-wide (trigger: always_on) |
| Cursor IDE | .cursor/rules/ or project root |
rules/cursor.mdc |
Copy to .cursor/rules/bidi.mdc or .cursorrules |
| Windsurf (Codeium) | Project root | rules/windsurf.rules |
Copy to .windsurfrules |
| GitHub Copilot | .github/ |
rules/copilot-instructions.md |
Copy to .github/copilot-instructions.md |
| Claude Code | Project root | rules/claude.md |
Append to CLAUDE.md |
| Cline / Roo Code | Project root | rules/cline.md |
Copy to .clinerules |
| Universal Standard | Any project root | rules/AGENTS.md |
Place AGENTS.md in repository root |
The standard universal instruction enforced across all agents:
- Whenever responding in RTL languages (Persian, Arabic, Urdu, Hebrew):
1. Wrap the complete response inside <div dir="rtl">...</div>.
2. Keep standard Markdown syntax for headings, bullet points, and tables.
3. Keep all code blocks, logs, terminal outputs, and file paths strictly LTR.
4. Never produce uncontained or left-aligned RTL text.agent-rtl-fix/
├── .github/
│ └── workflows/
│ └── release.yml # Automated release and zip packager
├── rules/ # Modular rules for every agent
│ ├── antigravity.md # Antigravity always_on global rule
│ ├── cursor.mdc # Cursor IDE rule
│ ├── windsurf.rules # Windsurf rules
│ ├── copilot-instructions.md # GitHub Copilot instructions
│ ├── claude.md # Claude Code instructions
│ ├── cline.md # Cline / Roo Code rules
│ └── AGENTS.md # Universal AI Agent specification
├── fonts/ # Core Vazirmatn typography (~500 KB)
│ └── Vazirmatn/
│ ├── Vazirmatn-Regular.ttf
│ ├── Vazirmatn-Medium.ttf
│ ├── Vazirmatn-SemiBold.ttf
│ └── Vazirmatn-Bold.ttf
├── scripts/
│ ├── install.ps1 # Modular Windows installer
│ ├── install.sh # Modular Linux/macOS installer
│ ├── uninstall.ps1 # Windows cleanup script
│ └── uninstall.sh # Linux/macOS cleanup script
├── install.bat # 1-Click Windows launcher
├── install.ps1 # Root PowerShell installer
├── install.sh # Root Bash installer
├── LICENSE # MIT License
├── README.md # English Documentation
└── README.fa.md # Persian Documentation
ai-agent-rtl • cursor-rules-rtl • antigravity-persian • vazirmatn-vscode • bidi-markdown • copilot-rtl • windsurf-rules • claude-code-persian • persian-arabic-urdu-hebrew • inverted-parentheses-fix • bidirectional-text-formatting
This project is licensed under the MIT License. Free for open-source and commercial use.