Caveman 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Caveman --version 1.0.1
                    
NuGet\Install-Package Caveman -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Caveman" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Caveman" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Caveman" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Caveman --version 1.0.1
                    
#r "nuget: Caveman, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Caveman@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Caveman&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Caveman&version=1.0.1
                    
Install as a Cake Tool

#ðŸĶī Caveman: Prompt Compressor for LLMs

<img width="1197" height="766" alt="caveman_splash" src="https://github.com/user-attachments/assets/4b534140-c519-423f-b918-e705565a039f" /> It is the version that is inspired by the token saving algorithm of Caveman plugin for Claude, but it was conceived without doing any porting from the original, it is a code born from scratch

Caveman is a C# library built on Catalyst that drastically reduces the number of tokens in your LLM prompts (such as Gemma 3, Llama, or GPT-4). It utilizes Natural Language Processing (NLP) techniques to remove grammatical "noise" (articles, prepositions, conjunctions) while keeping the semantic value intact.

"Why use many tokens when few tokens do trick?" — A caveman (and your wallet).

🚀 Features

  • Up to 70% Token Reduction: Slash API costs and speed up local inference.
  • Multilingual: Support for over 50 languages (English, Italian, French, etc.) via Catalyst models.
  • Compression Levels: Choose between Light, Semantic, or Aggressive (Lemmatization).
  • LLM Integration with Semantic Kernel: Optimized for next-gen models that perfectly understand contracted language.

🛠ïļ Installation

1. Base Package

Install the core library and the model manager:

dotnet add package Catalyst dotnet add package Mosaik.Core

2. Language Models

Install the packages for the languages you intend to support: dotnet add package Catalyst.Models.English dotnet add package Catalyst.Models.Italian

Alternatively, run the PowerShell script Install-CatalystModels.ps1 (it automatically updates all libraries in the project).

3. Quick Start

var compressor = new CavemanCompressionService();

string input = "Buongiorno, vorrei sapere se fosse possibile ricevere informazioni sui ristoranti a Roma.";

// Compresses the text by removing stopwords while maintaining meaning string compressed = await compressor.CompressAsync(input, Language.Italian, CompressionLevel.Semantic);

Console.WriteLine(compressed); // Output: "Buongiorno sapere possibile ricevere informazioni ristoranti Roma"

5. 📊 NLP Compression Levels

Level Applied Logic Removed POS Tags (Filters) Savings
Light Stopword Removal DET, ADP, CCONJ, SCONJ, PRON, PUNCT ~25-30%
Semantic Key Content Selection Keeps only NOUN, VERB, ADJ, PROPN, ADV ~50%
Aggressive Lemmatization Keeps only NOUN, VERB, PROPN (base form) ~70%

🔍 Technical Tag Detail (Catalyst Mapping)

POS Tag Category Examples (ENG/ITA) Treatment
DET Determiners the, a / il, lo Removed (from Light)
ADP Prepositions of, at / di, a Removed (from Light)
CCONJ Coord. Conjunctions and, or / e, o Removed (from Light)
SCONJ Subord. Conjunctions that, if / che, se Removed (from Light)
PRON Pronouns I, you / io, tu Removed (from Light)
NOUN Nouns house, pizza / casa, pizza Always Kept
VERB Verbs eat, runs / mangiare, corre Always Kept
ADV Adverbs not, quickly / non, molto Kept in Semantic

ðŸ’Ą Transformation Example

State Prompt Text Tokens / 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" ~40% (38 ch)

ðŸĪ Contributing Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

Caveman License Agreement v1.0 Copyright (c) 2026 Francesco Paolo Passaro

Permission is hereby granted to use, copy, and modify this software ("Caveman") exclusively for Open Source and NON-Commercial purposes, under the following conditions:

Attribution: The original author's name, Francesco Paolo Passaro, and references to the "Caveman Compression" project must be retained in every copy or substantial portion of the software.

Non-Commercial Use: Use of the software, its derivatives, or the results produced by it for profit, sale, or integration into paid commercial products is strictly prohibited without prior written agreement.

Prohibition of Public Redistribution: The software may not be uploaded to public repositories, mirrors, or distributed to third parties outside the original context without the express written consent of the author.

Open Source "As-Is": The software is provided "as is", without warranty of any kind. The author is not responsible for any damages arising from the use of the software.

Any violation of the points above will result in the immediate revocation of the license to use. For authorization requests regarding disclosure or commercial use, contact: passaroweb@gmail.com

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 52 5/3/2026
1.0.1 61 4/27/2026
1.0.0 70 4/27/2026