AST-Aware Context Window & Source Code Skeleton Pruner
prune_context_skeletonCompresses large source files, logs, or transcripts by 50–80% to fit an LLM context budget while preserving 100% of function/class/type signatures, imports, error frames, and query-matched lines. Use when shrinking oversized source files or logs before feeding them into an LLM prompt; for counting BPE tokens across prompt segments and calculating multi-model inference costs without altering text, use plan_context_token_budget instead. Read-only edge call (32 KB, 60 RPM): accepts 'content' (with enum defaults), uses '?demo=true' or L402 (50 sats); HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Raw source code, document, or multi-turn transcript to compress. | |
| focus_query | No | Optional symbol or keyword query whose matching lines receive maximum retention priority. | |
| pruning_mode | No | Salience weighting preset; defaults to 'ast_signatures_first' when omitted. | |
| target_ratio | No | Target token retention ratio between 0.15 and 0.85; defaults to 0.45 when omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tokens_saved | Yes | Net BPE tokens eliminated. | |
| preserved_symbols | Yes | Function, class, interface, and struct identifiers retained. | |
| compressed_content | Yes | Pruned text with elision markers where low-salience lines were removed. | |
| original_tokens_est | Yes | Estimated BPE token count of the unpruned input. | |
| compressed_tokens_est | Yes | Estimated BPE token count after structural pruning. |