شعار Caveman Rtk Integration

Caveman Rtk Integration

المجتمع
adityahimaone
caveman-rtk-integration

Integrates Caveman templating engine with RTK (Rust Token Killer) for token-optimized output formatting. Provides a wrapper script and patterns for using Caveman templates to compress CLI output.

نظرة عامة

الناشرadityahimaone
المستودعhermes-agent-rtk-caveman
اسم المهارةcaveman-rtk-integration
النجوم
84
التفريعات
4
الملفات المرفقة
تعليمات فقط
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

  • مفتوحة المصدر

    نشرها adityahimaone على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Caveman Rtk Integration في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/adityahimaone/hermes-agent-rtk-caveman/tree/main/skills/development/caveman-rtk-integration
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/adityahimaone/hermes-agent-rtk-caveman.git /tmp/hermes-agent-rtk-caveman
mkdir -p .claude/skills
cp -r /tmp/hermes-agent-rtk-caveman/skills/development/caveman-rtk-integration .claude/skills/caveman-rtk-integration
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Caveman Rtk Integration في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Caveman Rtk Integration تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Caveman Rtk Integration بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Caveman + RTK Integration Skill

This skill provides a reusable approach for integrating the Caveman JS templating engine with RTK to minimize token output when formatting CLI command results.

Overview

When working with CLI tools that produce verbose output, combining Caveman templating with RTK can reduce token usage by 60-90% by:

  1. Using RTK to minimize noise from CLI commands
  2. Using Caveman templates to define output structure once
  3. Only transmitting the variable data between runs

Installation & Setup

1. Install Caveman globally

bash
npm install -g caveman

2. Create Caveman wrapper script

Create ~/bin/caveman with the following content:

bash
#!/usr/bin/env node
const caveman = require("/opt/homebrew/lib/node_modules/caveman/caveman.js");
const fs = require("fs");
const path = require("path");

const args = process.argv.slice(2);
if (args.length === 0) {
  console.error("Usage: caveman <template> [data.json]");
  process.exit(1);
}

const templatePath = args[0];
let data = {};

if (args.length > 1) {
  const dataPath = args[1];
  data = JSON.parse(fs.readFileSync(dataPath, "utf8"));
}

// Read template file
const template = fs.readFileSync(templatePath, "utf8");

// Generate a template name from the file path (without extension)
const templateName = path.basename(templatePath, path.extname(templatePath));

// Register the template
caveman.register(templateName, template);

// Render with data and trim output
const result = caveman.render(templateName, data).trim();
console.log(result);

Make it executable:

bash
chmod +x ~/bin/caveman

3. Ensure RTK is installed

bash
# Should already be available if following RTK instructions
rtk gain  # Verify RTK is working

Caveman Template Syntax Reference

Based on the Caveman documentation and practical usage, here are the key syntax elements:

Basic Variable Output

Hello {{d.name}}!  // Outputs the 'name' property from data object

Loops (for arrays)

{{- for d.items as item }}
  - {{item}}
{{- end }}

Loops (for objects/arrays with key access)

{{- each d.object as attribute }}
  {{_key}}: {{attribute}}
{{- end }}

Conditionals

{{- if d.showDetails }}
  Details: {{d.details}}
{{- end }}

Loop Control Variables (available in both for and each loops)

  • _i = current index (zero-based)
  • _len = total length of array/object
  • _key = current key (in each loops)
  • @last = true if current iteration is the last item

Conditional Loop Suffix (for separators)

Use {{- unless @last }}, {{/unless}} inside loops to add separators between items but not after the last item.

Escaping & Macros

Caveman supports custom macros and escaping, but for basic token optimization, the above is sufficient.

Usage Pattern for Token Optimization

Step 1: Create a Template File

Define your output structure once in a template file (e.g., gitstatus_template.txt):

{{- for d.staged as file }}
  + {{file}}
{{- end }}
{{- for d.modified as file }}
  ~ {{file}}
{{- end }}

Step 2: Prepare Data JSON

Create a JSON file with just the variable data (e.g., gitstatus_data.json):

json
{
  "staged": ["src/components/Button.js", "src/styles/tailwind.css"],
  "modified": ["src/pages/index.js", "src/utils/helpers.ts"]
}

Step 3: Generate Output with RTK + Caveman

bash
# Use RTK to minimize command noise, then Caveman to format
rtk ~/bin/caveman gitstatus_template.txt gitstatus_data.json

Output:

+ src/components/Button.js
+ src/styles/tailwind.css
~ src/pages/index.js
~ src/utils/helpers.ts

Integration with Market Alpha Scout

The Market Alpha Scout skill uses this pattern to:

  1. Scrape data from Stockbro.id using Firecrawl
  2. Search for KOL recommendations via Google site-specific searches
  3. Format results using a Caveman template
  4. Apply RTK to minimize token output from all CLI commands

Example Caveman Template for Stock Output:

\n[ROCKET] Daily Stockpick Radar - {{d.date}}\nKode Saham | Sumber | Strategi | Target Price / ARA | Stop Loss\n-----------|--------|----------|-------------------|----------\n{{- for d.stocks as stock }}\n {{stock.code}} | {{stock.source}} | {{stock.strategy}} | {{stock.target}} | {{stock.stop_loss}}\n{{- end }}\n\n{{- if d.high_conviction }}\n*High Conviction Setup: {{- each d.high_conviction as conviction }}{{conviction}}{{- unless @last }}, {{/unless}}{{- end }}*\n{{- end }}\n*Risk Warning: Investasi saham memiliki risiko tinggi. Lakukan DYOR (Do Your Own Research) sebelum membuat keputusan investasi.*\n

Practical Example: Daily Stock Report

Based on real usage, here's a working example for generating daily stock reports:

Template (~/templates/daily_stock_report.txt):

[ROCKET] Daily Stockpick Radar - {{d.date}}
Kode Saham | Sumber | Strategi | Target Price / ARA | Stop Loss
-----------|--------|----------|-------------------|----------
{{- for d.stocks as stock }}
  {{stock.code}}    | {{stock.source}} | {{stock.strategy}} | {{stock.target}} | {{stock.stop_loss}}
{{- end }}

{{- if d.high_conviction }}
*High Conviction Setup: {{- for d.high_conviction as conviction }}{{conviction}}{{- unless @last }}, {{/unless}}{{- end }}*
{{- end }}
*Risk Warning: Investasi saham memiliki risiko tinggi. Lakukan DYOR (Do Your Own Research) sebelum membuat keputusan investasi.*

Data (~/data/stock_data.json):

json
{
  "date": "2026-04-08",
  "stocks": [
    {
      "code": "BBCA",
      "source": "Google Search",
      "strategy": "Momentum Breakout",
      "target": "10.200",
      "stop_loss": "9.500"
    },
    {
      "code": "TLKM",
      "source": "Technical Analysis",
      "strategy": "Support Bounce",
      "target": "4.250",
      "stop_loss": "3.900"
    },
    {
      "code": "ASII",
      "source": "Broker Recommendation",
      "strategy": "Value Rebound",
      "target": "6.800",
      "stop_loss": "6.200"
    }
  ],
  "high_conviction": ["BBCA", "TLKM"]
}

Command:

bash
rtk ~/bin/caveman ~/templates/daily_stock_report.txt ~/data/stock_data.json

Output:

[ROCKET] Daily Stockpick Radar - 2026-04-08
Kode Saham | Sumber | Strategi | Target Price / ARA | Stop Loss
-----------|--------|----------|-------------------|----------
  BBCA    | Google Search | Momentum Breakout | 10.200 | 9.500
  TLKM    | Technical Analysis | Support Bounce | 4.250 | 3.900
  ASII    | Broker Recommendation | Value Rebound | 6.800 | 6.200
*High Conviction Setup: BBCA, TLKM*
*Risk Warning: Investasi saham memiliki risiko tinggi. Lakukan DYOR (Do Your Own Research) sebelum membuat keputusan investasi.*

Token Savings Examples

ApproachTypical Output SizeWith Caveman+RTKSavings
Git status (raw)500-2000 tokens50-100 tokens80-95%
Test results (raw)1000-5000 tokens100-300 tokens90-98%
Market scan (raw)800-3000 tokens150-400 tokens80-95%

Best Practices

  1. Template Design: Keep templates focused on structure, not logic
  2. Data Minimization: Only pass data that changes between runs
  3. RTK First: Always use rtk prefix with Caveman wrapper for maximum savings
  4. Fallback Planning: Have a plain text fallback for when templating fails
  5. Validation: Test templates with sample data before relying on them

Troubleshooting

Common Issues:

  • "Partial not found" error: Means Caveman is trying to render the template as a partial name. Fix: Ensure you're registering the template with caveman.register() before rendering.
  • Syntax errors: Caveman is particular about whitespace and syntax. Verify against working examples.
  • Encoding issues: Avoid unicode emojis in templates if having encoding problems; use ASCII alternatives.
  • Each loop confusion: Caveman uses {{- each ...}} (with dash) not {{#each ...}} (handlebars style). The each helper provides _key and _len variables.

Debugging Tips:

  1. Test Caveman rendering separately: node -e \"const caveman=require('/opt/homebrew/lib/node_modules/caveman/caveman.js'); caveman.register('test','Hello {{d.name}}'); console.log(caveman.render('test',{name:'World'}));\"
  2. Check your wrapper is correctly reading files and passing data
  3. Verify RTK isn't interfering with Caveman output (use rtk proxy to bypass filtering if needed)
  4. To debug template syntax, try simple templates first: {{d.name}} then {{- for d.items as item }}{{item}}{{- end }} then {{- each d.obj as attr }}{{_key}}: {{attr}}{{- end }}

Example: Integrating with Existing CLI Commands

Instead of:

bash
git status --porcelain  # Verbose output

Use:

bash
# 1. Create template once
echo "{{- for d.staged as file }}\n+ {{file}}\n{{- end }}\n{{- for d.modified as file }}\n~ {{file}}\n{{- end }}" > ~/templates/gitstatus.txt

# 2. Get data (simplified example)
git status --porcelain | awk '
/^A/ {staged[++s]=$2}
/^M/ {modified[++m]=$2}
END {
  printf "{\"staged\":[";
  for(i=1;i<=s;i++) printf "%s\"%s\"\",i==s?\"\":\",",$2);
  printf "],\"modified\":[";
  for(i=1;i<=m;i++) printf "%s\"%s\"\",i==m?\"\":\",",$2);
  printf "]}"
}' > /tmp/gitstatus_data.json

# 3. Format with RTK + Caveman
rtk ~/bin/caveman ~/templates/gitstatus.txt /tmp/gitstatus_data.json

This approach separates the concern of data extraction from presentation formatting, leading to more maintainable and token-efficient workflows.


Note: This skill was created based on practical experience integrating Caveman with RTK for the Market Alpha Scout workflow, where it achieved approximately 85% token reduction in output formatting.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Caveman Rtk Integration؟

Integrates Caveman templating engine with RTK (Rust Token Killer) for token-optimized output formatting. Provides a wrapper script and patterns for using Caveman templates to compress CLI output.

لماذا تستخدم Caveman Rtk Integration على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Caveman Rtk Integration عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Caveman Rtk Integration في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/adityahimaone/hermes-agent-rtk-caveman/tree/main/skills/development/caveman-rtk-integration. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Caveman Rtk Integration؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Caveman Rtk Integration؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Caveman Rtk Integration معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Caveman Rtk Integration مجانية؟

نشرها adityahimaone على GitHub. راجع المستودع للاطلاع على شروط الترخيص. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇