semantic-compress

semantic-compress is a skill for Claude Code, Codex from bjcoombs/ai-native-toolkit. It costs 176 tokens per session (5,028 once invoked), scanned A, original, Apache-2.0.

A method for shortening documents written for AI readers while preserving the behavior they produce. It replaces explanations of widely known concepts with short references and keeps project-specific facts explicit.

In plain words
What is it for?
It helps compress AI instructions, reference documents, and other model-facing text. It supports both a local span-by-span pass and a comparison-based process that checks whether the shorter version behaves like the original.
Why use it?
It reduces document length and token use without deleting information the AI needs to follow the instructions correctly. It also avoids assuming that a concept is active in the AI's reasoning just because it is familiar.

Skill for Claude CodeCodex

Part of the ai-native-toolkit plugin — 15 skills, 7 commands, 8 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/bjcoombs/ai-native-toolkit/semantic-compress
Any agent
npx skills add bjcoombs/ai-native-toolkit --skill semantic-compress
Clone the repo
git clone --depth 1 https://github.com/bjcoombs/ai-native-toolkit

Made for: Claude Code, Codex.

Or install ai-native-toolkit, the plugin that ships this one along with the rest of its 15 skills, 7 commands, 8 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for semantic-compress

README.md
[![agentmods](https://agentmods.dev/badge/skills/bjcoombs/ai-native-toolkit/semantic-compress.svg)](https://agentmods.dev/skills/bjcoombs/ai-native-toolkit/semantic-compress)
Your own site
<a href="https://agentmods.dev/skills/bjcoombs/ai-native-toolkit/semantic-compress"><img src="https://agentmods.dev/badge/skills/bjcoombs/ai-native-toolkit/semantic-compress.svg" alt="Measured on agentmods" height="20"></a>
Per session 176 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,028 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00176 $0.05028
Opus 5 $0.00088 $0.02514
Sonnet 5 $0.00035 $0.01006
Haiku 4.5 $0.00018 $0.00503

Measured 5d ago against content hash 6af22bf230a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

semantic-compress scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/semantic-compress/SKILL.md · 230 lines

How it starts

The opening of the file, as written. The whole thing — 230 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Semantic Compress

Make a document written for an LLM reader smaller while preserving what it does. The essence of an LLM-directed document is behavioural, not textual - the behaviour it induces in the reading model across the tasks it handles. Compression splits content into two kinds and treats each correctly:

  • Core knowledge - anything in the model's training (named concepts, standard definitions, common-domain background). Replace the explanation with a pointer: the bare concept name or a short cue that activates the right knowledge. A pointer costs a few tokens and reliably switches on the model's existing understanding; a full explanation is wasted tokens, and deleting the concept entirely gambles that it is already active in the model's reasoning - often it is not, and disambiguation suffers.
  • Project / bespoke knowledge - anything the model cannot know from training: specific facts, local decisions, constraints, and non-standard twists on a known concept. Keep these explicit and verbatim. The model has no other source for them.

Compression is therefore point at core, spell out bespoke. Pointing is not deletion and it is not full explanation; it is the minimum that both activates the right core knowledge and preserves every bespoke detail.

Mode Selection

This skill operates in one of two modes, selected deterministically:

Input Mode What happens
Short snippet with an obvious local swap, no behavioural surface Local Quick core->pointer pass, no A/B
Whole document / skill / system prompt Distill Full A/B-validated loop

Default to distill when:

  • The input is a skill, system prompt, or instruction document
  • Behaviour preservation matters
  • The user asks for "smaller but same behaviour"

Local is permitted only when all hold:

  • The input is a short span (< 500 chars)
  • There is an obvious single core->pointer swap
  • No downstream behaviour depends on it

Read the full file on GitHub · 230 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 230 lines · 176 tokens per session scan A 6af22bf230a5

Subscribe to this mod's changes

semantic-compress is a skill published in the GitHub repository bjcoombs/ai-native-toolkit (30 stars, last pushed yesterday), licensed Apache-2.0. It adds 176 tokens to every session and 5,028 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.