loading experience

AI

Caveman

Latest update 1.0.3: Self-Contained & Ultra-Lightweight Engine: The runtime is now fully self-contained, eliminating the need for heavy external NLP models and removing the old dependency on Catalyst. The total footprint has been drastically reduced, going from ~68 MB of raw data to an assembly of just ~13 MB compiled into Brotli artifacts.

Caveman

πŸš€ Caveman v1.0.3


Caveman is an ultra-lightweight, fully self-contained .NET library designed to optimize text for Large Language Models (LLMs), drastically reducing token consumption and associated costs while preserving the semantic integrity of the message.


✨ What's New and Key Features (v1.0.3) - June 2026

  1. Up to 70% token reduction: Cut API costs across LLM channels and speed up local inference by reducing prompt length.
  2. Fully Self-Contained Engine: No external NLP models and no runtime dependency on Catalyst. The only package dependency (purely optional and intended for plugins) is Microsoft.SemanticKernel.
  3. Ultra-Compact Format (~13 MB): Language data is compiled into Brotli artifacts (*.yaml.br) with a compact detection index (_index.br). The assembly now weighs just ~13 MB compared to the old ~68 MB of raw data.
  4. High-Performance Custom Parser: The runtime dependency on YamlDotNet has been completely removed and replaced with a proprietary streaming word-data parser.
  5. Over 50 Languages with Full Vocabulary: Lemmas, verb forms and a proper-noun dictionary (gazetteer) derived directly from the Universal Dependencies project.
  6. Proper Noun Preservation: Proper nouns (e.g. Rome, Milan, MΓΌnchen, Termini) are recognized and kept unchanged (verbatim) instead of being incorrectly compressed or turned into common words. This feature is active at the start of a sentence, mid-text, and even in German.
  7. Standalone Language Detection: Introduces CavemanLanguageDetector, usable in standalone mode without needing to compress text, capable of analyzing input and returning ISO 639-3 codes even for very short texts (one or two words).
  8. True Async Support: The CompressAsync and CompressBatchAsync methods no longer use fake-async mechanisms; cancellation and failed tasks are now correctly propagated at the system level.


πŸ› οΈ Installation

Due to the modular architecture, the main NLP compression library must be installed separately from other modules (such as the Privacy Guard module):

Bash


dotnet add package Caveman --version 1.0.3
πŸ“„ License & Transparency: Released under the Caveman License (MIT + mandatory attribution clause). Any commercial or private use must explicitly mention the use of Caveman developed by Passaro Francesco Paolo β€” Digitalsolutions.it.


⚑ Quick Start

C#


using Caveman;
using System;
using System.Threading;
using System.Threading.Tasks;

var compressor = new CavemanCompressionService();
string input = "Vorrei sapere se Γ¨ possibile ricevere informazioni su ristoranti economici a Roma.";

// πŸ” NEW v1.0.3: Fast standalone language detection
string languageCode = CavemanCompressionService.DetectLanguage(input); // Output: "ita"

// Compress the text (now with true Async and CancellationToken support)
var result = await compressor.CompressAsync(input, CavemanCompressionLevel.Semantic, CancellationToken.None);

Console.WriteLine($"Compressed: {result.CompressedText}");
Console.WriteLine($"Efficiency: {result.EfficiencyPercentage:F1}%");
Console.WriteLine($"🌿 Energy saved: {result.EstimatedEnergySavedMWh:F3} mWh");


🌿 Sustainability: Why it matters


Every token generated or processed by an LLM has an environmental cost. Caveman introduces a built-in estimator based on industry averages:

  1. Energy consumption: Estimated at 5 mWh per token.
  2. Carbon footprint: Estimated at 0.4 mg of COβ‚‚ per mWh.


By compressing a prompt from 1000 to 400 tokens, about 3 mWh of energy is saved. At the scale of millions of requests, Caveman contributes tangibly to building a sustainable AI ecosystem.


πŸ“Š NLP compression levels (Updated v1.0.3)


LevelApplied logicProper Noun & Verb HandlingAverage Savings
LightRemoval of traditional stopwords.Known capitalized tokens preserved.~25–30%
SemanticSelection of key content (Nouns, Verbs, Adjectives, Adverbs).Keeps proper nouns verbatim.~50%
AggressiveTotal lemmatization and verb-driven compression.Every conjugated form collapses to the base verb; nouns remain intact.~70%


πŸ” Technical Infrastructure Detail (Universal Dependencies)


The old Catalyst mapping tags have been replaced by the native Universal Dependencies dictionary. During compression:

  1. The system reads an ultra-compact index (_index.br) to determine the language.
  2. Decompresses on the fly and caches only the data relating to the detected language.
  3. Applies verb-driven compression and screens out noisy lemmas or false positives on proper nouns.


πŸ’‘ Transformation Example

StatePrompt textTokens / Characters
Original"I would like to know if it is possible to have a margherita pizza immediately."100% (78 ch)
Light"like know possible have margherita pizza immediately"~70% (54 ch)
Semantic"know possible have margherita pizza immediately"~55% (48 ch)
Aggressive"know possible have margherita pizza" (Proper nouns like Margherita or Roma are not altered)~40% (38 ch)


πŸ’‘ Native Integration: Caveman.Wiki

Purpose

Automatically generate AI-optimized Markdown documentation for any software project, leveraging Caveman v1.0.3's new ultra-compact engine to semantically compress content and maximize the LLM prompt context window.

How it works

  1. Project analysis: Automatically detects the project type (.csproj, requirements.txt, package.json).
  2. Intelligent scanning: Excludes binary files, build folders and external dependency folders.
  3. Code and Text Compression: For files larger than 2KB, it invokes the new CavemanCompressionService (Semantic or Aggressive level) leveraging fast single-language cache loading.
  4. Clean Output: Returns a complete Markdown file with YAML metadata, tree view and syntax highlighting.

Usage example with the new engine

C#


// Wiki initialization (leverages the assembly reduced to ~13MB)
var wiki = new CavemanWiki();
string context = await wiki.GenerateAsync(@"C:\Users\Dev\MyAwesomeProject");
await File.WriteAllTextAsync("AI_CONTEXT.md", context);

// Direct integration into the LLM prompt
var prompt = $@"You are an expert assistant for the project described below.
<project_context>
{context}
</project_context>

Answer questions based SOLELY on this context.";

🀝 Contributing

Pull requests are welcome! For major changes to the Universal Dependencies-based compression architecture or the streaming parser, please open a discussion issue first.

Technologies
.net ai
Resources