tarikra1

Arabic Bidi Agent Guard — AI skill for Claude Code

AI community

Zero-dependency Python linter, Unicode sanitizer, and AGENTS.md / CLAUDE.md ruleset preventing Arabic RTL/LTR Markdown scrambling in AI coding agents.

How to install Arabic Bidi Agent Guard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open tarikra1/arabic-bidi-agent-guard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Arabic Bidi Agent Guard does

Zero-dependency Python linter, Unicode sanitizer, and AGENTS.md / CLAUDE.md ruleset preventing Arabic RTL/LTR Markdown scrambling in AI coding agents.

Alternatives in AI

  • Datafog Python — Offline PII firewall for AI agents and LLM apps: fast local detection and redaction, Claude Code hook, LiteLLM 69 ★
  • Natural Talk — 中文:让 AI 像人一样说话、创作的完整规则集 28 ★
  • Localization — AI agent skills for Hebrew, RTL, translation, and cultural adaptation 22 ★

README

arabic-bidi-agent-guard

[![CI](https://github.com/tarikra1/arabic-bidi-agent-guard/actions/workflows/ci.yml/badge.svg)](https://github.com/tarikra1/arabic-bidi-agent-guard/actions/workflows/ci.yml) [![Version](https://img.shields.io/badge/release-v1.1.0-0EA5E9.svg)](CHANGELOG.md) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-3776AB.svg)](pyproject.toml) [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-success.svg)](pyproject.toml)

**Prevent Arabic RTL / English LTR text scrambling in AI coding agents and Markdown interfaces—without injecting invisible Unicode watermarks.**

Most developer chat interfaces, IDE panels, and Markdown renderers (**Claude Code**, **Cursor**, **GitHub**, **VS Code**, **Antigravity**) render paragraph containers left-to-right (`LTR`) without automatic per-span `` isolation. When an LLM mixes Arabic prose with inline English identifiers, CLI flags, backtick spans, or parentheses on the same line, the Unicode Bidirectional Algorithm scrambles word order, flips parentheses, and jumps trailing punctuation across the line.

`arabic-bidi-agent-guard` solves this at both layers:

  1. Preventive Agent Rule (rules/AGENTS.md): Drop-in instruction file for CLAUDE.md, AGENTS.md, or .cursorrules that trains LLMs to keep Arabic sentences purely Arabic while isolating English identifiers into standalone bullets, code blocks, or dedicated Markdown table columns.
  2. Deterministic CLI Linter & Sanitizer (bidi-guard): Zero-dependency Python CLI and library for CI pipelines and post-generation agent hooks that catches BiDi collisions and strips hidden directional control characters (U+200E–U+2069).

Why Not Just Inject Unicode `RLM` / `LRI` Characters?

LLMs that try to "fix" Arabic alignment by emitting hidden characters (`U+200F`, `U+202B`, `U+2067`) silently break code copy-pasting, corrupt JSON/YAML parsers, tri