Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

local-filter

A Claude Code plugin that uses a local llama.cpp LLM as a cheap pre-processing layer before cloud calls.

Three patterns:

Pattern When Saves
Pre-filter grep/search returns > 5 results Cloud reads only relevant hits
Summarize Reading > 3 files to answer a question Summaries enter context, not full files
Route Vague problem across 3+ modules Searches right module first

All patterns fail gracefully — if the local LLM is down, Claude proceeds normally.

Requirements

  • llama.cpp server running locally (or LM Studio with local server enabled)
  • A non-thinking / fast model loaded (e.g. any Qwen3 instruct without enable_thinking)
  • Claude Code ≥ 1.x

Install

1. Claude Code plugin

claude plugin marketplace add HermannsIT/local-filter
claude plugin install local-filter@local-filter

This installs the local-filter skill and adds the auto-trigger rules to your global CLAUDE.md.

2. MCP server setup (optional but recommended)

The plugin works standalone, but pairing it with the local-qwen-subagent MCP lets Claude call the local LLM without spawning a Python subprocess each time.

LLAMA_MODEL="your-model-id" bash setup-mcp.sh

To find your model ID:

curl -s http://127.0.0.1:8080/v1/models | python3 -c \
  "import json,sys; [print(m['id']) for m in json.load(sys.stdin)['data']]"

Custom server URL:

LLAMA_MODEL="Qwen3.6-35B-nonThinking" LLAMA_URL="http://127.0.0.1:8080" bash setup-mcp.sh

Restart Claude Desktop after running the script.

Disable per project

Add to a project's CLAUDE.md:

LOCAL_FILTER: disabled

Claude will skip all three patterns for that project.

How it works

Claude auto-invokes the skill when:

  • Search results exceed 5 items → local LLM picks the relevant ones
  • 3+ files need reading to answer a question → local LLM summarizes each first
  • Problem is vague across multiple modules → local LLM routes to the right one

The skill uses direct HTTP calls to http://127.0.0.1:8080/v1/chat/completions with temperature: 0 — fast, deterministic, cheap.

MCP patch explained

llama-mcp-server (npm) doesn't pass a model parameter in its API requests, so it always hits the server's default model. setup-mcp.sh patches two files in the global install:

  • config.js: adds LLAMA_MODEL env var → modelId
  • client.js: injects model: modelId into chat requests

The patch is idempotent — safe to re-run after npm upgrades.

License

MIT

About

Claude Code plugin: local LLM pre-processing to reduce cloud token usage

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages