# Khalas

> Arabic text summarization and token optimization

- **Type:** Skill
- **Install:** `agentstack add skill-moshe-ship-hurmoz-khalas`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Moshe-ship](https://agentstack.voostack.com/s/moshe-ship)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Moshe-ship](https://github.com/Moshe-ship)
- **Source:** https://github.com/Moshe-ship/hurmoz/tree/main/khalas

## Install

```sh
agentstack add skill-moshe-ship-hurmoz-khalas
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# khalas — محسّن التوكنات العربية

أداة لتقليل تكلفة البرومبتات العربية وتحليل كفاءة التوكنات.

## الأوامر

### مقارنة عربي vs إنجليزي
```bash
khalas compare "النص العربي هنا"
```

مثال عملي:
```bash
khalas compare "الذكاء الاصطناعي يغيّر طريقة عملنا في كل المجالات"
```

النتيجة المتوقعة:
```
╔══════════════════════════════════════════╗
║        khalas — Token Comparison         ║
╠═══════════════╦═════════╦════════════════╣
║               ║ Arabic  ║ English        ║
╠═══════════════╬═════════╬════════════════╣
║ Text          ║ الذكاء… ║ AI is chang…   ║
║ Characters    ║ 48      ║ 52             ║
║ Tokens (GPT4) ║ 28     ║ 11             ║
║ Tokens (Claude)║ 24    ║ 10             ║
║ Ratio         ║ 2.5x   ║ 1.0x           ║
║ Cost impact   ║ +150%  ║ baseline       ║
╚═══════════════╩═════════╩════════════════╝
```

### تحسين برومبت
```bash
khalas optimize "النص العربي الطويل هنا"
```

مثال عملي:
```bash
khalas optimize "أريد منك أن تقوم بكتابة مقالة طويلة ومفصّلة حول موضوع الذكاء الاصطناعي وتأثيره على سوق العمل في المملكة العربية السعودية"
```

النتيجة المتوقعة:
```
الأصلي:  38 tokens
المحسّن: 22 tokens (−42%)

النص المحسّن:
"اكتب مقالة مفصّلة عن تأثير الذكاء الاصطناعي على سوق العمل السعودي"

التحسينات:
  ✓ حذف "أريد منك أن تقوم بـ" → أمر مباشر
  ✓ حذف "طويلة و" → "مفصّلة" تكفي
  ✓ اختصار "المملكة العربية السعودية" → "السعودي"
```

### حساب التوفير
```bash
khalas savings "النص"
```

مثال — حساب التوفير لبرومبت كامل:
```bash
khalas savings "بناء على المعلومات المذكورة أعلاه، أريد منك أن تقوم بتلخيص النقاط الرئيسية مع التركيز على الجوانب المهمة"
```

النتيجة المتوقعة:
```
التوكنات الأصلية:  42
التوكنات بعد التحسين: 18
التوفير: 24 tokens (57%)
التوفير الشهري (10K requests): $2.40 → $1.03
```

### شرح مكان الهدر
```bash
khalas explain "النص"
```

مثال:
```bash
khalas explain "بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ"
```

النتيجة المتوقعة:
```
تحليل هدر التوكنات:
━━━━━━━━━━━━━━━━━━━━━━

مع التشكيل:   12 tokens
بدون تشكيل:    6 tokens
الهدر:         6 tokens (+100%)

مصادر الهدر:
  🔴 التشكيل (6 tokens): كل حركة تُحسب كتوكن منفصل
  🟡 حروف العطف: "الرَّحْمَنِ الرَّحِيمِ" = 6 tokens (الألف واللام منفصلة)

التوصية: احذف التشكيل إلا إذا كان ضروريا للمعنى
```

## دعم اللهجات

الأداة تفهم الفرق في كفاءة التوكنات بين:
- **الفصحى**: الأعلى كفاءة — مفردات مألوفة للنماذج
- **المصري**: كفاءة متوسطة — بعض المفردات معروفة
- **الخليجي**: كفاءة أقل — مفردات أقل في بيانات التدريب
- **المغاربي**: الأقل كفاءة — خلط فرنسي يزيد التوكنات

```bash
khalas compare --dialect khaliji "وش رايك نسوي كذا؟"
khalas compare --dialect masri "إيه رأيك نعمل كده؟"
khalas compare --dialect fusha "ما رأيك أن نفعل ذلك؟"
```

## متى تستخدم
- المستخدم يسأل "ليش العربي أغلى بالتوكنات؟"
- يريد تقليل تكلفة API
- يقارن أسعار بين مزوّدين مختلفين
- يريد يفهم تأثير التشكيل على التكلفة
- يبني تطبيق عربي ويحتاج يحسب الميزانية

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Moshe-ship](https://github.com/Moshe-ship)
- **Source:** [Moshe-ship/hurmoz](https://github.com/Moshe-ship/hurmoz)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-moshe-ship-hurmoz-khalas
- Seller: https://agentstack.voostack.com/s/moshe-ship
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
