Preface¶
Long conversations, large context windows, and repeatedly stuffing materials into prompts directly drive up cloud model Token bills. Common practices involve feeding the entire original text to large models or manually writing summaries; the former is expensive, while the latter is labor-intensive. This article introduces the SkillHub community Skill “token秘书就一个字省token” (Token Secretary: Just One Word to Save Tokens). It encapsulates the process of “Local Knowledge Retrieval → Intelligence Compression → Cloud Refinement” into a mountable SKILL.md workflow. The goal is to reduce the word count sent to the cloud while ensuring answers remain grounded in local materials.
What is This¶
- Positioning: An
ai-agenttype Skill for AI Agents, coordinates@user_5b2fc4e3/token-sheng, current version 1.0.0, source is community, published by user_5b2fc4e3. - One-liner: The official tagline is “Save tokens with just one word”; the
SKILL.mdinside the package names it Token Secretary and describes it as a named encapsulation of the GLOBAL_RULES.md vFinal Agentic RAG Architecture, reusing existing scripts without duplicating logic. - API Key Dependency: The SkillHub tag is
requires_api_key=false(installing the Skill itself does not require key configuration; if the workflow calls cloud models, it depends on your local GLOBAL_RULES and model configuration).
SkillHub Page: https://www.skillhub.cn/skills/user_5b2fc4e3/token-sheng
API Entry: https://api.skillhub.cn/user_5b2fc4e3/token-sheng
(As of retrieval: Rating 100000, Downloads 973, Installs 0.)
Core Functions¶
The following details are derived from the SKILL.md and README.md within the Skill package. Since they have different focal points, they are explained together.
Agent Side: Five-Step RAG Flow (SKILL.md)¶
- Intent Classification: Directly reply to greetings; proceed to subsequent steps for technical/process/quotation inquiries (rules reference GLOBAL_RULES.md §2).
- Entity Extraction: Extract materials, processes, parameters, and problem types from the question using regular expressions.
- Dual-Path Knowledge Retrieval (Parallel): Fetch up to 10 results each via keyword query and semantic retrieval, merging and deduplicating to retain a maximum of 20 items. The example command paths provided in the document reflect the author’s environment (
knowledge_querier.py,rag_semantic_search.py); you need to change these to your own script paths when migrating. - Knowledge Intelligence Compression: Use
compress_knowledge.shwith a local small model (documented as llama3.2:1b, targeting ≤500 characters; if it times out at 60s, it degrades to truncating the first 3 original entries; also notes an approximate 15% impurity rate). - Cloud Refinement: Send “Local Intelligence Block + User Question + Task Instruction” to the cloud model (documented example is DeepSeek), requiring it to distinguish between “Based on local knowledge base” and “Based on cloud general knowledge,” and filter out impurity patterns in the intelligence block.
- Observability: The reply must begin with routing and retrieval statistics markers, such as
[Route: Token Secretary],[Local Knowledge: Retrieved X items | Compressed to Y chars | Took Zs],[Intelligence: K1, K2, K3].
Trigger Methods (Same file):
- Direct Mention:
@Token Secretary - Keywords:
情报压缩(Intelligence Compression),省token(Save Tokens),本地知识分析(Local Knowledge Analysis),RAG增强(RAG Enhancement) - If GLOBAL_RULES has set this flow as the default behavior for technical questions, explicit invocation is not required.
Degradation Strategy (Summary): If FAISS is corrupted, use only keyword retrieval; if Ollama is unavailable, skip compression; if compression times out, take the first 3 original entries; if retrieval yields no results, the intelligence block becomes “No local match” and proceeds with pure cloud reasoning.
Engineering Side: Local Compression Engine (README.md)¶
The README.md in the same directory describes Token Secretary as a “Local small model pre-processing engine”: before long inputs of 3000+ characters reach the cloud, it uses a ~1B level local model to compress them into structured summaries (README claims to save approx. 50%–80% inference Tokens and provides Token comparison tables for several scenarios). Configuration items are found in config/config.example.yaml (Ollama address, compression model, timeout, output format, etc.).
Note: The package currently pulled from SkillHub contains only SKILL.md, README.md, and config/config.example.yaml; it does not include scripts/compress_knowledge.sh shown in the README directory tree. The Python/Shell paths in SKILL.md point to the author’s local directories like ~/projects. You need to prepare your own scripts and knowledge base before implementation, or complete the implementation according to the GitHub project referenced in the README.
Installation and Activation¶
First, perform a CLI check, then install to the current Agent’s skills directory (installing to the wrong directory means the Agent will not load it).
1. Check SkillHub CLI
command -v skillhub && skillhub --version
If not installed, follow SkillHub official instructions (full install or CLI only):
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash
2. Install this Skill
The installation command in the search index is:
skillhub install token-sheng --namespace user_5b2fc4e3 --dir <your Agent skills directory>
Alternatively, use the page prompt to let the Agent install @user_5b2fc4e3/token-sheng by referring to https://skillhub.cn/install/skillhub.md.
3. Common skills directories (Excerpt from SkillHub installation docs)
- Cursor:
~/.cursor/skills/ - Claude Code:
~/.claude/skills/ - Codex:
~/.codex/skills/or.agents/skills/under the project
After installation, restart or refresh the Skill list according to your client’s requirements.
4. Local compression configuration (Optional)
If using the Ollama compression path described in the README, copy the config template and modify the model and timeout:
cp config/config.example.yaml config/config.yaml
Example fields include OLLAMA_BASE_URL, COMPRESS_MODEL (e.g., llama3.2:1b), MAX_INPUT_LENGTH, COMPRESS_RATIO, TIMEOUT_SECONDS, OUTPUT_FORMAT, etc.
Typical Usage¶
Triggering in Conversation (SKILL.md Example)¶
User Input:
@Token Secretary What clamping method is used for milling 6061 aluminum alloy thin-walled parts?
Expected System Output Form (Excerpt):
[Route: Token Secretary]
[Local Knowledge: Retrieved 8 items | Compressed to 213 chars | Took 18s]
[Intelligence: 6061 aluminum alloy, soft jaws, heat treatment]
Based on local knowledge base: 6061 aluminum alloy is a common thin-walled structural material...
Based on cloud general knowledge: Recommend full-wrap clamping with soft jaws, contact area ≥60%...
Reproduction depends on your deployed retrieval scripts, FAISS index, Ollama, and the regex/routing in GLOBAL_RULES.md, rather than standalone executables within the Skill package.
Relationship with Other Skills (SKILL.md)¶
The document states: quote-ptuning can embed into the quotation flow (Retrieve → Compress → Quote); step-factory can consume the compressed material process suggestions; it does not depend on orchestrator, and this Skill can execute independently.
Use Cases and Notes¶
Who is it for
- Teams already doing Local Knowledge Base + Cloud Inference in OpenClaw / Agent environments compatible with GLOBAL_RULES.
- Scenarios wanting to use extremely short trigger words or @Token Secretary to unify the “Retrieve—Compress—Upload to Cloud” pipeline, and denote local vs. cloud evidence in replies.
- Developers with Ollama or similar local small models willing to use the README approach for long-text pre-compression to control Tokens.
Limitations and Pitfalls
- The Skill package is process and convention, not a ready-to-use full-stack RAG product; paths, scripts, and GLOBAL_RULES need to be aligned by yourself.
SKILL.mdandREADME.mddescribe different facets of the same brand (Agentic RAG vs. General Long-text Compression); do not mix example commands with unmodified paths during deployment.- The actual ratios and time costs in the README come from the author’s documentation; your corpus and models will differ, resulting in varying outcomes.
- Compressed intelligence blocks may contain impurities. Although cloud instructions require discarding specific types of noise, manual spot-checking of key numbers and grades is still necessary.
Conclusion¶
“token秘书就一个字省token” integrates the goal of saving Tokens into an Agent Skill on SkillHub: it uses local retrieval and small model compression to thin out the context first, then lets the cloud model perform refinement, marking routing and intelligence sources with fixed prefixes. If you want to try it or view metadata, you can open the official page: https://www.skillhub.cn/skills/user_5b2fc4e3/token-sheng .