sdk
Use Headroom compression APIs, SharedContext, relevance and image helpers, and the TypeScript SDK in application code.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sdk
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Headroom compression APIs, SharedContext, relevance and image helpers, and the TypeScript SDK in application code.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md4.5 KB
- 参考文档references/troubleshooting.md3.9 KB
- 参考文档references/typescript-sdk.md2.2 KB
- 参考文档references/workflows.md3.5 KB
- 脚本scripts/compress_smoke.py3.5 KB
- 脚本scripts/tabular_compression_demo.py2.8 KB
03 SKILL.md 正文
Headroom SDK
Use this sub-skill when the user wants to call Headroom from Python or TypeScript code, embed compression in an application, or understand the SDK-level APIs that do not require operating the proxy or durable memory workflows.
Route here for
- Python direct compression:
compress,compress_spreadsheet,CompressConfig,CompressResult,HeadroomClient,ChatCompletions,Messages, andvalidate_setup/metrics helpers. SharedContextfor compressed inter-agent handoffs.- Relevance and image helpers:
headroom.relevance,headroom.image, and optional extras that affect those APIs. - TypeScript SDK usage from
sdk/typescript/, includingcompress,HeadroomClient,simulate,retrieve,SharedContext, hooks, format conversion, and path helpers. - App/framework recipes: OpenAI, Anthropic, LiteLLM, Vercel AI SDK, LangChain, MCP tool outputs, spreadsheet/tabular compression, and other local integration patterns.
Route elsewhere
- Proxy base URL,
headroom proxy, and agent wrapping/setup: use../proxy-wrap/SKILL.md. - Memory persistence, MCP registration, learn, and recovery: use
../memory/SKILL.md. - Install/update/deployment lifecycle and broad operator diagnostics: use
../ops/SKILL.md.
Fast start
Python local compression:
from headroom import compress
result = compress([
{"role": "user", "content": "Explain this file"},
], optimize=False)
Python configuration or app wrapper:
from headroom import CompressConfig
from headroom.client import HeadroomClient
TypeScript SDK:
import { compress, HeadroomClient, SharedContext } from "headroom-ai";
For a safe smoke check, read the bundled helper and run the small no-network validation it documents:
python scripts/compress_smoke.py --json
References and helpers
references/api-reference.mdcaptures the verified Python API shapes and important defaults.references/typescript-sdk.mdsummarizes the TS exports and app-facing examples.references/workflows.mdgives concrete Python and TypeScript application recipes.references/troubleshooting.mdcovers missing extras, proxy assumptions, ONNX/HF/image issues, and type/runtime mismatches.scripts/compress_smoke.pyruns a safe no-network Python compression smoke.scripts/tabular_compression_demo.pyis the bundled table/spreadsheet demo adapted from the repo example.
Safety rules
- Do not promise live proxy behavior when
optimize=Falseor when the user has not configured a running proxy. - Avoid claiming GPU or cloud behavior unless the user explicitly selected the required extras or backend and the environment was verified.
- Do not put private environment paths, tokens, or provider credentials in examples.
- If a feature depends on an optional extra, say so explicitly and show the smallest import path or smoke check that proves it.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).