@scaledown/claude-plugin
v0.3.1
Published
Claude Code plugin for Scaledown AI context optimization
Downloads
385
Readme
Scaledown Claude Code Plugin
Optimize your Claude Code sessions with Scaledown — automatic context compression, conversation summarization, intent-aware tool routing, and named entity extraction.
What it does
Every time you submit a prompt, the plugin:
- Classifies your intent and prepends a one-line hint (e.g.
[Scaledown intent: file_read (87%)]) so Claude picks the right tool without guessing - Compresses large contexts automatically when you paste in a big codebase and ask a retrieval-style question — reducing token usage by 50–70% before the prompt reaches Claude
On top of that, Claude gains four new tools it can call on demand:
| Tool | What it does |
|---|---|
| sd_compress | Compress a large context block before a needle-in-a-haystack query |
| sd_summarize | Abstractively summarize text — useful for compacting long conversations |
| sd_classify | Classify text against custom labels (e.g. bug vs. feature vs. question) |
| sd_extract | Extract named entities or structured data from any text |
Requirements
- Node.js 18 or later
- A Scaledown API key — get one free at scaledown.ai/dashboard
- One of: Claude Code, Cursor, or OpenAI Codex CLI
Installation
Supported clients: Claude Code · Cursor · OpenAI Codex CLI
The MCP tools (
sd_compress,sd_summarize,sd_classify,sd_extract) work in all three clients. Automatic prompt hooks (UserPromptSubmit,PreCompact) are Claude Code-only — see the feature comparison below.
Claude Code
Option A: npm (recommended)
npm install -g @scaledown/claude-plugin
scaledown-claude setupThe setup wizard will:
- Open your browser to get an API key
- Ask you to paste the key
- Save it to your shell config (
~/.zshrc,~/.bashrc, etc.) - Register the MCP server with Claude Code
- Add the
UserPromptSubmithook to your project's.claude/settings.json
Restart Claude Code and you're done.
Option B: manual
1. Clone and build
git clone https://github.com/scaledown-team/scaledown-claude-plugin
cd scaledown-claude-plugin
npm install && npm run build2. Set your API key
export SCALEDOWN_API_KEY="your-key-here"
# Add the above line to ~/.zshrc or ~/.bashrc to persist it3. Register the MCP server
For personal use (stored in ~/.claude.json):
claude mcp add scaledown --transport stdio \
-- node /path/to/scaledown-claude-plugin/dist/src/index.jsTo share with your team (stored in .mcp.json, commit this file):
claude mcp add scaledown --transport stdio --scope project \
-- npx -y @scaledown/claude-plugin4. Add the hook
In .claude/settings.json at your project root (create if it doesn't exist):
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "scaledown-claude-hook"
}
]
}
]
}
}If you cloned the repo instead of installing globally, use the full path:
"command": "node /path/to/scaledown-claude-plugin/dist/hooks/user-prompt-submit.js"Cursor
1. Install the package
npm install -g @scaledown/claude-plugin2. Set your API key
export SCALEDOWN_API_KEY="your-key-here"
# Add the above line to ~/.zshrc or ~/.bashrc to persist it3. Add the MCP server
Create .cursor/mcp.json in your project root (or ~/.cursor/mcp.json for global use):
{
"mcpServers": {
"scaledown": {
"command": "npx",
"args": ["-y", "@scaledown/claude-plugin"],
"env": {
"SCALEDOWN_API_KEY": "your-key-here"
}
}
}
}4. Restart Cursor. The four Scaledown tools will be available in Agent mode.
Cursor does not support hooks, so automatic prompt compression and intent classification will not fire. Use the tools on demand.
OpenAI Codex CLI
1. Install the package
npm install -g @scaledown/claude-plugin2. Add the MCP server
codex mcp add scaledown --env SCALEDOWN_API_KEY=your-key-here -- npx -y @scaledown/claude-pluginThis writes to ~/.codex/config.toml. To verify:
[mcp_servers.scaledown]
command = "npx"
args = ["-y", "@scaledown/claude-plugin"]
[mcp_servers.scaledown.env]
SCALEDOWN_API_KEY = "your-key-here"Codex CLI does not support
UserPromptSubmitorPreCompacthooks. Use the tools on demand.
Feature comparison
| Feature | Claude Code | Cursor | Codex CLI |
|---|---|---|---|
| sd_compress tool | ✅ | ✅ | ✅ |
| sd_summarize tool | ✅ | ✅ | ✅ |
| sd_classify tool | ✅ | ✅ | ✅ |
| sd_extract tool | ✅ | ✅ | ✅ |
| Auto intent hints on every prompt | ✅ | ❌ | ❌ |
| Auto compression (large prompts) | ✅ | ❌ | ❌ |
| Auto summarization on compaction | ✅ | ❌ | ❌ |
Usage
Automatic (hook)
Nothing to do — the hook fires on every prompt. You'll see the intent hint in Claude's context, and large retrieval queries are silently compressed before they reach the model.
[Scaledown intent: search (82%)]
Find all places where we call the payments APIOn-demand tools
Ask Claude to use any of the four tools directly:
Compress a large context
Use sd_compress to compress this before searching through it: [paste large codebase]Summarize a long conversation
Use sd_summarize to condense this thread so we can keep working without hitting the context limitClassify text
Use sd_classify to categorize these GitHub issues as bug, feature, or questionExtract structured data
Use sd_extract to pull out all function names, file paths, and error codes from this stack traceConfiguration
Changing your API key
Re-run setup to replace the key automatically:
scaledown-claude setupOr edit your shell config directly:
# Open ~/.zshrc (or ~/.bashrc)
# Find and update:
export SCALEDOWN_API_KEY="sk-your-new-key"
# Reload
source ~/.zshrcEnvironment variables
Set these environment variables to tune behavior:
| Variable | Default | Description |
|---|---|---|
| SCALEDOWN_API_KEY | — | Required. Your Scaledown API key |
| SCALEDOWN_COMPRESS_THRESHOLD | 10000 | Token estimate above which auto-compression fires |
| SCALEDOWN_COMPRESS_RATE | 0.3 | How aggressively to compress (0.3 = keep 30% of tokens) |
| SCALEDOWN_NIAH_DISABLE | false | Set to true to compress all large prompts, not just retrieval-style ones |
Example — compress more aggressively, lower threshold:
export SCALEDOWN_COMPRESS_THRESHOLD=5000
export SCALEDOWN_COMPRESS_RATE=0.2How compression works
The plugin uses a local heuristic to detect "needle-in-a-haystack" queries — prompts that are both large and retrieval-intent (containing keywords like find, search, where, what does ... do, etc.).
When detected, the full prompt is sent to Scaledown's /compress/raw/ endpoint, which rewrites it into a semantically equivalent but much shorter form. The compressed version replaces the original before Claude sees it.
Conversational messages that happen to be long (e.g. a big code block you're asking Claude to write from scratch) are left alone.
Development
git clone https://github.com/scaledown-team/scaledown-claude-plugin
cd scaledown-claude-plugin
npm install
npm test # run unit tests
npm run build # compile TypeScriptTest the hook manually:
npm run build
echo '{"prompt":"find the function that handles auth"}' \
| SCALEDOWN_API_KEY=your-key node dist/hooks/user-prompt-submit.jsTest the MCP server starts:
SCALEDOWN_API_KEY=test echo '{}' | node dist/src/index.jsLicense
MIT
