wasm-constraints

wasm-constraints is a skill for Claude Code, Codex from kreuzberg-dev/kreuzberg-lts. It costs 3 tokens per session (619 once invoked), scanned A, original, MIT.

A set of rules for building Kreuzberg’s WebAssembly target, which lets the document-extraction library run in web environments. It requires internal operations to be synchronous and limits HTML input to 2 MB.

In plain words
What is it for?
Use it when adding or changing extractors, feature flags, PDF setup, or other code compiled for the `crates/kreuzberg-wasm/` target.
Why use it?
It prevents code that depends on an unavailable background-task runtime or exceeds WebAssembly’s supported constraints.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or changing extractors, feature flags, PDF setup, or other code compiled for the crates/kreuzberg-wasm/ target.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints
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.

Any agent
npx skills add kreuzberg-dev/kreuzberg-lts --skill wasm-constraints
Clone the repo
git clone --depth 1 https://github.com/kreuzberg-dev/kreuzberg-lts

Made for: Claude Code, Codex.

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 wasm-constraints

README.md
[![agentmods](https://agentmods.dev/badge/skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints/github.svg)](https://agentmods.dev/skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints)
Your own site
<a href="https://agentmods.dev/skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints"><img src="https://agentmods.dev/badge/skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wasm-constraints

Your own site · 80×15
<a href="https://agentmods.dev/skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints"><img src="https://agentmods.dev/badge/skills/kreuzberg-dev/kreuzberg-lts/wasm-constraints.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 619 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00003 $0.00619
Opus 5 $0.00002 $0.00309
Sonnet 5 $0.00001 $0.00124
Haiku 4.5 $0.00000 $0.00062

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

Security

Grade A, and why

wasm-constraints 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 11d 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.

.ai-rulez/skills/wasm-constraints/SKILL.md · 92 lines

How it starts

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

priority: high

WASM Build Constraints

Overview

WASM target in crates/kreuzberg-wasm/. Uses wasm-bindgen with sync-only internal APIs.

Feature Flags

[features]
wasm-target = ["pdf", "html", "xml", "email", "language-detection", "chunking", "quality", "office"]
wasm-threads = ["dep:wasm-bindgen-rayon"]  # Optional

Critical Constraints

1. No Tokio Runtime

All operations must be synchronous internally. Use #[cfg(not(feature = "tokio-runtime"))] paths.

2. SyncExtractor Required

Every WASM-compatible extractor MUST implement SyncExtractor:

impl SyncExtractor for MyExtractor {
    fn extract_sync(&self, content: &[u8], mime_type: &str, config: &ExtractionConfig)
        -> Result<ExtractionResult> { /* sync implementation */ }
}

impl DocumentExtractor for MyExtractor {
    fn as_sync_extractor(&self) -> Option<&dyn SyncExtractor> {
        Some(self)  // MUST return Some for WASM
    }
}

3. HTML Size Limit

const MAX_HTML_SIZE: usize = 2 * 1024 * 1024;  // 2MB - stack constraint

4. PDFium Initialization (from JS)

import init, { initialize_pdfium_render } from './kreuzberg_wasm.js';
const wasm = await init();
const pdfium = await pdfiumModule();
initialize_pdfium_render(pdfium, wasm, false);  // REQUIRED for PDF

Build Config

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release.package.kreuzberg-wasm]
opt-level = "z"       # Size optimization
codegen-units = 1

API Pattern

#[wasm_bindgen]
pub async fn extract_from_bytes(content: Vec<u8>, config: JsValue) -> Result<JsValue, JsValue> {
    let config: ExtractionConfig = serde_wasm_bindgen::from_value(config)?;
    let result = extract_bytes_sync(&content, mime_type, &config)?;
    Ok(serde_wasm_bindgen::to_value(&result)?)
}

Functions can be async for JS compatibility, but internal extraction is sync.

Critical Rules

  1. No tokio — all operations synchronous
  2. Implement SyncExtractor for all WASM-compatible extractors
  3. HTML limited to 2MB due to stack constraints
  4. PDFium requires manual JS initialization
  5. Size optimization via opt-level = "z"
  6. Feature gate with #[cfg(target_arch = "wasm32")]

Read the full file on GitHub · 92 lines

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. 11d ago First seen · 92 lines · 3 tokens per session scan A e58f4bf58e5e

Subscribe to this mod's changes

wasm-constraints is a skill published in the GitHub repository kreuzberg-dev/kreuzberg-lts (15 stars, last pushed yesterday), licensed MIT. It adds 3 tokens to every session and 619 once invoked, about $0.0000 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.