<div align="center">
# gowork-local-llm
**Claude Code Skill — Save 90-99% Claude Tokens with Local LLM**
[](LICENSE)
[](https://github.com/go7th/gowork)
[English](#english) | [中文](#中文) | [日本語](#日本語)
</div>
---
<a id="english"></a>
## English
A Claude Code skill that offloads token-heavy preprocessing tasks to a local LLM, saving 90-99% of Claude API tokens.
**Requires [GoWork](https://github.com/go7th/gowork)** — a high-performance AI terminal assistant built in Rust.
### How It Works
```
Claude Code
│ "summarize this 2000-line file"
▼
GoWork CLI (Rust, 30ms startup) + --no-tools mode
│
▼
mlx_lm.server (local, free)
│
▼
Qwen3.5-4B model → summary (~100 words)
│
▼
Claude reads summary instead of 2000 lines → 93-99% tokens saved
```
### Token Savings (Tested)
| Task | Claude Direct | GoWork + Claude | Savings |
|------|--------------|-----------------|---------|
| Summarize 500-line file | ~7,000 tokens | ~500 tokens | **93%** |
| Extract functions (1,957 lines) | 18,550 tokens (truncated!) | ~80 tokens | **99%** |
| Scan 10 files overview | ~10,000 tokens | ~1,000 tokens | **90%** |
### Quick Start
1. **Install [GoWork](https://github.com/go7th/gowork)**
```bash
git clone https://github.com/go7th/gowork.git
cd gowork && cargo build --release
cp target/release/gowork ~/.cargo/bin/
```
2. **Start MLX backend**
```bash
pip install mlx-lm
mlx_lm.server --model mlx-community/Qwen3.5-4B-OptiQ-4bit --port 8080 \
--temp 0.1 --max-tokens 4096 --chat-template-args '{"enable_thinking":false}'
```
3. **Configure role presets** (recommended) — edit `~/.gowork/config.toml`:
```toml
base_url = "http://localhost:8080/v1"
model = "mlx-community/Qwen3.5-4B-OptiQ-4bit"
[roles.summarize]
description = "Fast preprocessing for Claude"
model = "mlx-community/Qwen3.5-4B-OptiQ-4bit"
no_tools = true
[roles.code]
description = "Deep code analysis"
model = "mlx-community/Qwen3-Coder-30B-A3B-Instruct-4bit"
```
4. **Install skill** — Copy `SKILL.md` to your Claude Code skills directory
5. **Use** — Claude will automatically delegate preprocessing to GoWork
```bash
# Preferred: role preset bundles model + --no-tools
gowork --role summarize --file large_file.go -p "list all functions"
gowork --role summarize --batch "src/*.rs" -p "one-line summary: {}"
# Heavy code analysis
gowork --role code --file module.rs -p "review this"
gowork --stats # check token savings
```
### Requirements
- Apple Silicon Mac (M1+) with 16GB+ RAM
- [GoWork](https://github.com/go7th/gowork) CLI installed
- `mlx_lm.server` running on port 8080
---
<a id="中文"></a>
## 中文
一个 Claude Code Skill,将 token 密集型预处理任务交给本地大模型,节省 90-99% 的 Claude API token。
**依赖 [GoWork](https://github.com/go7th/gowork)** — 用 Rust 构建的高性能 AI 终端助手。
### 工作原理
```
Claude Code
│ "总结这个 2000 行的文件"
▼
GoWork CLI (Rust, 30ms 启动) + --no-tools 模式
│
▼
mlx_lm.server (本地运行,免费)
│
▼
Qwen3.5-4B 模型 → 摘要 (~100 字)
│
▼
Claude 读摘要而非 2000 行原文 → 省 93-99% token
```
### Token 节省实测
| 场景 | Claude 直读 | GoWork + Claude | 节省 |
|------|-----------|-----------------|------|
| 摘要 500 行文件 | ~7,000 tokens | ~500 tokens | **93%** |
| 提取函数 (1,957 行) | 18,550 tokens (超限截断!) | ~80 tokens | **99%** |
| 扫描 10 个文件 | ~10,000 tokens | ~1,000 tokens | **90%** |
### 快速开始
1. **安装 [GoWork](https://github.com/go7th/gowork)**
```bash
git clone https://github.com/go7th/gowork.git
cd gowork && cargo build --release
cp target/release/gowork ~/.cargo/bin/
```
2. **启动 MLX 后端**
```bash
pip install mlx-lm
mlx_lm.server --model mlx-community/Qwen3.5-4B-OptiQ-4bit --port 8080 \
--temp 0.1 --max-tokens 4096 --chat-template-args '{"enable_thinking":false}'
```
3. **配置角色预设**(推荐)— 编辑 `~/.gowork/config.toml`:
```toml
base_url = "http://localhost:8080/v1"
model = "mlx-community/Qwen3.5-4B-OptiQ-4bit"
[roles.summarize]
description = "给 Claude 做预处理的快速摘要"
model = "mlx-community/Qwen3.5-4B-OptiQ-4bit"
no_tools = true
[roles.code]
description = "深度代码分析(MoE 大模型)"
model = "mlx-community/Qwen3-Coder-30B-A3B-Instruct-4bit"
```
4. **安装 Skill** — 将 `SKILL.md` 复制到 Claude Code skills 目录
5. **使用** — Claude 会自动将预处理任务委派给 GoWork
```bash
# 推荐:role 预设自动绑定模型 + --no-tools
gowork --role summarize --file large_file.go -p "列出所有函数"
gowork --role summarize --batch "src/*.rs" -p "一句话总结: {}"
# 深度代码分析
gowork --role code --file module.rs -p "审查这个模块"
gowork --stats # 查看省了多少 token
```
### 环境要求
- Apple Silicon Mac (M1+),16GB+ 内存
- 已安装 [GoWork](https://github.com/go7th/gowork) CLI
- `mlx_lm.server` 在 8080 端口运行
---
<a id="日本語"></a>
## 日本語
Claude Code Skill -- トークン集約型の前処理タスクをローカル LLM に委任し、Claude API トークンを 90-99% 節約します。
**[GoWork](https://github.com/go7th/gowork) が必要です** -- Rust で構築された高性能 AI ターミナルアシスタント。
### 仕組み
```
Claude Code
│ "この2000行のファイルを要約して"
▼
GoWork CLI (Rust, 30ms 起動) + --no-tools モード
│
▼
mlx_lm.server (ローカル、無料)
│
▼
Qwen3.5-4B モデル → 要約 (~100語)
│
▼
Claude は2000行ではなく要約を読む → 93-99% トークン節約
```
### トークン節約実績
| タスク | Claude 直接 | GoWork + Claude | 節約 |
|--------|-----------|-----------------|------|
| 500行ファイル要約 | ~7,000 tokens | ~500 tokens | **93%** |
| 関数抽出 (1,957行) | 18,550 tokens (切り捨て!) | ~80 tokens | **99%** |
| 10ファイル概要 | ~10,000 tokens | ~1,000 tokens | **90%** |
### クイックスタート
1. **[GoWork](https://github.com/go7th/gowork) をインストール**
```bash
git clone https://github.com/go7th/gowork.git
cd gowork && cargo build --release
cp target/release/gowork ~/.cargo/bin/
```
2. **MLX バックエンドを起動**
```bash
pip install mlx-lm
mlx_lm.server --model mlx-community/Qwen3.5-4B-OptiQ-4bit --port 8080 \
--temp 0.1 --max-tokens 4096 --chat-template-args '{"enable_thinking":false}'
```
3. **ロールプリセットを設定**(推奨)-- `~/.gowork/config.toml` を編集:
```toml
base_url = "http://localhost:8080/v1"
model = "mlx-community/Qwen3.5-4B-OptiQ-4bit"
[roles.summarize]
description = "Claude の前処理用の高速要約"
model = "mlx-community/Qwen3.5-4B-OptiQ-4bit"
no_tools = true
[roles.code]
description = "コード深度分析(MoE 大モデル)"
model = "mlx-community/Qwen3-Coder-30B-A3B-Instruct-4bit"
```
4. **Skill をインストール** -- `SKILL.md` を Claude Code skills ディレクトリにコピー
5. **使用** -- Claude が自動的に前処理を GoWork に委任します
```bash
# 推奨:ロールプリセットがモデルと --no-tools を自動設定
gowork --role summarize --file large_file.go -p "全関数をリスト"
gowork --role summarize --batch "src/*.rs" -p "一行要約: {}"
# コード深度分析
gowork --role code --file module.rs -p "このモジュールをレビュー"
gowork --stats # トークン節約量を確認
```
### 要件
- Apple Silicon Mac (M1+)、16GB+ RAM
- [GoWork](https://github.com/go7th/gowork) CLI インストール済み
- `mlx_lm.server` がポート 8080 で実行中
---
## Performance Benchmark
**Test date:** 2026-04-11 | **File:** `channel.go` (1,957 lines, 51KB, ~18,550 tokens) | **Hardware:** Apple M5 32GB
### End-to-End Response Time
| Task | Claude Direct | GoWork + Claude | Speed |
|------|--------------|-----------------|-------|
| File summary (500 lines) | ~3s | ~19s (GoWork 18.1s + Claude ~1s) | Slower |
| Extract functions | **Cannot complete** (truncated) | ~6s | **GoWork only** |
| API endpoints (200 lines) | ~2s | ~13s | Slower |
### Key Findings
- **Token savings: 90-99%** — the primary value
- **Breaks file size limits** — Claude truncates at 10K tokens; GoWork has no limit
- **Speed tradeoff** — 5-18s slower per call, but saves money
- **Quality is sufficient** — 4B model accurately extracts functions, summaries, and structure
> **GoWork is the engine behind this skill.** Get it at [github.com/go7th/gowork](https://github.com/go7th/gowork)
## License
MIT — See [LICENSE](LICENSE)