# Caveman Classical Chinese Wenyan Mode: Token Savings and Implementation

> Discover Caveman's wenyan mode which rewrites replies in Classical Chinese reducing output tokens by 70-85% while preserving code blocks and technical identifiers.

- Repository: [Julius Brussee/caveman](https://github.com/JuliusBrussee/caveman)
- Tags: deep-dive
- Published: 2026-07-08

---

**Caveman's wenyan mode rewrites assistant replies in Classical Chinese (文言文) to eliminate 70–85% of output tokens through syntactic compression while preserving code blocks and technical identifiers intact.**

The JuliusBrussee/caveman repository provides an AI assistant optimization tool that leverages the dense information density of Classical Chinese to minimize API costs. Unlike standard intensity modes that merely drop filler words, wenyan applies a grammatical transformation that dramatically reduces character count without losing semantic meaning.

## How Wenyan Mode Compresses Tokens

### Syntactic Transformation Pipeline

The wenyan mode applies three structural changes to natural language prose according to the implementation in [`skills/caveman/SKILL.md`](https://github.com/JuliusBrussee/caveman/blob/main/skills/caveman/SKILL.md):

1. **Eliminates redundant particles and pronouns** – Classical Chinese omits articles, pronouns, and filler words that English requires while maintaining clarity.
2. **Reorders sentences to verb-object structure** – Typical 文言文 syntax allows subjects and articles to be omitted safely, creating a terse grammatical flow.
3. **Preserves code and identifiers** – URLs, code blocks, and technical terms remain verbatim; the transformation only touches natural-language prose.

This approach differs fundamentally from the default *lite/full/ultra* modes that simply delete words rather than restructuring syntax.

### Character Density and Tokenization

LLM tokenization averages approximately one token per four characters in English. Wenyan-full achieves **80–90% character reduction**, which translates directly into proportional token savings because the model processes fewer total characters per response.

## Token Savings by Wenyan Intensity Level

The repository defines three compression levels in [`skills/caveman/SKILL.md`](https://github.com/JuliusBrussee/caveman/blob/main/skills/caveman/SKILL.md) (lines 39–41):

- **wenyan-lite**: Modest grammatical reduction that keeps modern structure while trimming particles, yielding **~30–40% fewer tokens**.
- **wenyan-full**: Full Classical Chinese transformation with 80–90% character reduction, delivering **≈ 70–80% token savings**.
- **wenyan-ultra**: Extreme abbreviation while retaining the Chinese character feel, reaching **up to ≈ 85% fewer tokens**.

By comparison, the standard `full` mode achieves approximately **65% output token reduction** according to benchmarks documented in [`README.md`](https://github.com/JuliusBrussee/caveman/blob/main/README.md) (lines 52–69). The wenyan modes push savings higher by exploiting linguistic compression rather than simple deletion.

## Activating Wenyan Mode

Users invoke the mode through slash commands that persist for the entire session until changed or disabled:

```bash

# Standard high compression (65% token reduction)

/caveman full

# Light Classical Chinese compression

/caveman wenyan-lite

# Example output: 組件頻重繪，以每繪新生對象參照故。以 useMemo 包之。

# Full Classical Chinese (~80-90% character reduction)

/caveman wenyan

# Example output: 每繪新生對象參照，故重繪；以 useMemo 包之則免。

# Ultra-terse Classical Chinese

/caveman wenyan-ultra

# Example output: 新參照則重繪。useMemo 包之。

```

Disable the mode with `/caveman off`.

## Implementation Architecture

The wenyan functionality spans several key files in the JuliusBrussee/caveman codebase:

- **[`skills/caveman/SKILL.md`](https://github.com/JuliusBrussee/caveman/blob/main/skills/caveman/SKILL.md)** – Defines intensity levels and documents the 80–90% character reduction metric for wenyan-full.
- **[`src/hooks/caveman-mode-tracker.js`](https://github.com/JuliusBrussee/caveman/blob/main/src/hooks/caveman-mode-tracker.js)** – Resolves canonical aliases (mapping `wenyan` to `wenyan-full`) and maintains the active mode in session state.
- **[`src/hooks/caveman-activate.js`](https://github.com/JuliusBrussee/caveman/blob/main/src/hooks/caveman-activate.js)** – Writes the selected mode flag (e.g., `wenyan-ultra`) to the session file.
- **[`skills/caveman-help/SKILL.md`](https://github.com/JuliusBrussee/caveman/blob/main/skills/caveman-help/SKILL.md)** – Exposes command documentation and usage examples to end users.
- **[`src/plugins/opencode/commands/caveman-help.md`](https://github.com/JuliusBrussee/caveman/blob/main/src/plugins/opencode/commands/caveman-help.md)** – Provides command palette descriptions for supported agents including Claude Code, Gemini, and Cursor.

## Summary

- Caveman's wenyan mode exploits Classical Chinese's inherent information density to achieve **70–85% token reduction** compared to standard English output.
- Three intensity levels provide graduated compression: **wenyan-lite**, **wenyan-full**, and **wenyan-ultra**.
- The transformation preserves code, URLs, and technical identifiers while compressing only natural language prose.
- Implementation resides in [`skills/caveman/SKILL.md`](https://github.com/JuliusBrussee/caveman/blob/main/skills/caveman/SKILL.md) with state management handled by [`caveman-mode-tracker.js`](https://github.com/JuliusBrussee/caveman/blob/main/caveman-mode-tracker.js) and [`caveman-activate.js`](https://github.com/JuliusBrussee/caveman/blob/main/caveman-activate.js).

## Frequently Asked Questions

### How does wenyan mode compare to Caveman's standard full mode?

Standard full mode reduces output tokens by approximately 65% through filler word elimination. Wenyan-full achieves **70–80% reduction** by applying syntactic transformation to Classical Chinese, pushing compression further through grammatical restructuring rather than simple deletion.

### Does wenyan mode affect code blocks or technical terms?

No. The transformation logic specifically preserves code blocks, URLs, and identifiers verbatim. Only natural language prose undergoes conversion to Classical Chinese, ensuring technical accuracy remains intact while reducing surrounding explanatory text.

### Which agents support Caveman's wenyan mode?

The mode works across all supported agents including Claude Code, Gemini, and Cursor. The canonical alias resolution in [`src/hooks/caveman-mode-tracker.js`](https://github.com/JuliusBrussee/caveman/blob/main/src/hooks/caveman-mode-tracker.js) ensures consistent behavior regardless of which agent executes the `/caveman` command.

### Why does Classical Chinese reduce token count more effectively than English abbreviations?

Classical Chinese (文言文) inherently omits articles, pronouns, and copulas that English requires. Combined with verb-object reordering that eliminates explicit subjects, this linguistic structure conveys equivalent meaning with 80–90% fewer characters. Since LLM tokenization roughly maps one token per four characters in English, this character-level compression directly translates to proportional token savings.