一键导入
beaver
Compress long text using BEAVER hierarchical prompt compression, then answer the question based on compressed context. Usage: /beaver <your question>
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Compress long text using BEAVER hierarchical prompt compression, then answer the question based on compressed context. Usage: /beaver <your question>
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | beaver |
| description | Compress long text using BEAVER hierarchical prompt compression, then answer the question based on compressed context. Usage: /beaver <your question> |
You are using the BEAVER prompt compression tool. When the user invokes /beaver, follow these steps:
The user's message after /beaver is the query. The context is the long text from the current conversation (previous messages, uploaded documents, or pasted text).
If no long context is available in the conversation, ask the user to provide the text they want to compress.
Use the exec tool to call the BEAVER compression API:
curl -s -X POST http://127.0.0.1:8765/compress \
-H "Content-Type: application/json" \
-d '{
"context": "<THE_LONG_TEXT>",
"query": "<THE_USER_QUERY>",
"page_size": 64,
"anchor_pages": 4,
"flow_window": 4,
"flash_top_k": 22,
"semantic_weight": 0.7,
"lexical_weight": 0.3
}'
The API returns JSON with these fields:
compressed_text: The compressed contextoriginal_tokens: Original token countcompressed_tokens: Compressed token countcompression_ratio: Compression ratiospeedup: Speedup factorAfter getting the compressed text, use it as context to answer the user's query. Format your response like this:
If the BEAVER API is not reachable, tell the user to start the server:
BEAVER 压缩服务未启动,请先运行:
cd /path/to/BEAVER && python beaver_server.py --model_path Qwen/Qwen3-0.6B --port 8765