# Claudeshrink

> >

- **Type:** Skill
- **Install:** `agentstack add skill-g-akshay-claudeshrink-claudeshrink`
- **Verified:** Pending review
- **Seller:** [g-akshay](https://agentstack.voostack.com/s/g-akshay)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [g-akshay](https://github.com/g-akshay)
- **Source:** https://github.com/g-akshay/ClaudeShrink

## Install

```sh
agentstack add skill-g-akshay-claudeshrink-claudeshrink
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Overview

ClaudeShrink compresses large inputs using [LLMLingua](https://github.com/microsoft/LLMLingua) (gpt2) before you reason over them. This preserves semantic content while dramatically reducing token usage.

The compressor lives at: `~/.claude/skills/ClaudeShrink/scripts/compressor.py`
It runs inside an isolated venv at: `~/.claude/skills/ClaudeShrink/.venv`

---

## When to Use

- User pastes a large block of text, logs, or a document (>~8000 chars / ~2000 tokens)
- User asks to analyze, summarize, or reason over a large file on disk
- User's prompt is very long and would benefit from compression before reasoning
- User explicitly says "use ClaudeShrink" or "compress this"

---

## Instructions

Follow these steps in order every time this skill is triggered:

1. **Self-check: verify the environment is installed.** Run:
   ```bash
   test -f ~/.claude/skills/ClaudeShrink/.venv/bin/python && echo "ready" || echo "not_installed"
   ```
   - If output is `ready`, proceed to step 2.
   - If output is `not_installed`, run the installer first:
     ```bash
     bash ~/.claude/skills/ClaudeShrink/install.sh
     ```
     If `install.sh` is missing (skill was added without cloning), fetch and run it:
     ```bash
     curl -fsSL https://raw.githubusercontent.com/g-akshay/ClaudeShrink/main/install.sh | bash
     ```
     Wait for it to complete, then proceed to step 2.

2. **Identify the input source** — is it a file path, raw pasted text, or a prompt?

3. **Extract user intent** — look at the user's request and derive a `--question` flag that captures what they care about. Examples:
   - "find all errors" → `--question "What errors occurred?"`
   - "summarize payment failures" → `--question "What payment failures occurred?"`
   - "keep all WARNING and ERROR lines" → `--question "What warnings and errors occurred?"`
   - No specific focus → omit `--question` (blind compression)

4. **If it's a file on disk**, run:
   ```bash
   ~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py /absolute/path/to/file.txt --question "derived question here"
   ```

5. **If it's raw pasted text or a prompt (no file on disk)**, write to a uniquely-named temp file, compress, then delete:
   Write the actual input content into the heredoc (do not write a placeholder string):
   ```bash
   TMP=$(mktemp /tmp/cs_input.XXXXXX.txt)
   cat > "$TMP"  "Input compressed with ClaudeShrink (LLMLingua). Compression stats: [paste ratio from stderr if available]."

10. **Proceed with the user's original request** using the compressed context.

---

## Output Format

- Do not show the raw compressed text to the user unless they ask for it.
- Respond to the user's original request (summarize, analyze, explain, etc.) as normal.
- Optionally append a brief compression note: original size, compressed token target, ratio.

---

## Examples

**Example 1 — Large log file with intent:**
> User: "Find all payment failures in this log: /var/log/app.log"

```bash
~/.claude/skills/ClaudeShrink/.venv/bin/python ~/.claude/skills/ClaudeShrink/scripts/compressor.py /var/log/app.log --question "What payment failures occurred?"
```
Then analyze the compressed output.

**Example 2 — Pasted text with intent:**
> User: "Summarize the errors in this log" then pastes 800 lines.

```bash
TMP=$(mktemp /tmp/cs_input.XXXXXX.txt)
cat > "$TMP"  User: "Compress this before you read it: [long prompt]"

Omit `--question` — blind compression applies.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [g-akshay](https://github.com/g-akshay)
- **Source:** [g-akshay/ClaudeShrink](https://github.com/g-akshay/ClaudeShrink)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-g-akshay-claudeshrink-claudeshrink
- Seller: https://agentstack.voostack.com/s/g-akshay
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
