TokenLite Safe Context Compression Strategy
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md to install @user_a72d54a9/tokenlite
About this skill
Problem
When agents call tools, they often receive large non-code outputs: JSON logs, API responses, and batch results. Putting all of that into context consumes tokens, while naive truncation can discard failure states, exceptions, rare categories, schema variants, or numeric outliers that matter for later reasoning. The task is compression with an auditable retrieval path and hard safety boundaries.
How It Works
TokenLite treats the flow as evaluate, compress if safe, and retrieve only what is needed. tokenlite.py sense --input FILE --json returns a content field; if auto_compressed=true, the ccr_id enables later retrieval with retrieve using --grep, --line, or --field. Source code, user input, and short stack traces are protected: reason=protected:code returns byte-for-byte original content. For JSON arrays, TokenLite keeps visible records containing nested errors, failure states, rare categorical values, schema variants, and robust numeric outliers, then adds deterministic representative samples.
Boundaries
CCR is unencrypted local temporary storage, so it should not be used to cache secrets. Prefer --input over --text for multiline or large content to avoid shell-quoting corruption. Telemetry is off by default, and optional hooks modify user-level configuration, so they require explicit approval. Use it for shrinking large tool outputs, not for rewriting source code, persisting secrets, or automatic global hook installation.
Use Cases
- When debugging long JSON failure records from API responses, use JSON compression to keep errors, rare values, and outliers, then retrieve them.
- In agent sessions, shrink large log context while keeping source code uncompressed and short stack traces queryable as original text.
- When auditing recent compression decisions, use audit to inspect sense calls and cleanup to remove expired CCR entries.
- When handling multiline or large text, use --input with a file to avoid shell quoting corrupting --text arguments.
Best For
- Engineers building AI agents who need to shrink long tool outputs into controllable context without losing critical errors.
- Developers debugging multi-tool chains who need to retrieve original slices by grep, line range, or field after compression.
- LLM application maintainers focused on local privacy who need telemetry off by default and clear CCR temporary storage boundaries.
- Engineers writing agent evaluation scripts who need should or sense JSON output to decide whether compression is worthwhile.
Related Skills
Provides Claw with character-library selection, switching, saving, and global SOUL.md style sync for role-based conversation.
An AIONE Agentic AI Infrastructure SDK wrapper for building production AI agents with memory, skills, workflows, and hooks.
A Python/TypeScript SDK wrapper for the DeepSeek-Reasonix native AI coding agent, with prefix-cache support.
A browser automation tool for analysts, operators, and developers that locates elements, fills forms, extracts structured content, and supports no-code scheduling and export.