gpu-intern
by vladtarrow
README.md
**English** | [简体中文](README.zh-CN.md) | [Español](README.es.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Italiano](README.it.md) | [Português](README.pt-BR.md)
# gpu-intern
**Give your coding agent an intern that runs on your GPU.** A local model reads the big logs, test output, data dumps and docs, and hands your agent a short digest with line references, so the paid model never has to read them.
[](LICENSE)
[](https://github.com/vladtarrow/gpu-intern/actions/workflows/ci.yml)

*The picture is real gpu-intern output for a generated 5.4 MB, 59,969-line CI log (`node scripts/demo.mjs --mock`). The answer lines come from the mock model in the test suite, not from a real LLM; the line numbers, the coverage report and the token estimate are computed by gpu-intern. A real-model run will replace it.*
## Quick start
You need [Ollama](https://ollama.com/download) (or any OpenAI-compatible local server) and Node.js 18 or later on your `PATH`.
```bash
ollama pull qwen2.5-coder:7b
```
Then, inside Claude Code:
```text
/plugin marketplace add vladtarrow/gpu-intern
/plugin install gpu-intern@gpu-intern
```
Restart Claude Code and ask: *"Digest build.log: why did the build fail?"* The plugin adds the MCP server and a skill that tells the agent when to delegate (files over about 300 lines or 20 KB, noisy commands, "find every mention of X") and when not to (code edits, final decisions, security reasoning).
If you have more than one model, choose one before starting your agent:
| macOS / Linux | Windows PowerShell |
|---|---|
| `export INTERN_MODEL=qwen2.5-coder:7b` | `$env:INTERN_MODEL = "qwen2.5-coder:7b"` |
Try it without an agent:
```bash
npx -y github:vladtarrow/gpu-intern --check
npx -y github:vladtarrow/gpu-intern digest build.log "Why did the build fail?"
```
### Other agents
Any MCP client works. The most portable launch is `node` plus the bundled file, which needs no install step and no `npx` shim on Windows:
```bash
git clone https://github.com/vladtarrow/gpu-intern
```
Use the absolute path of `gpu-intern/dist/gpu-intern.mjs` below (forward slashes work on Windows too, e.g. `C:/Users/you/gpu-intern/dist/gpu-intern.mjs`). On macOS and Linux you can use `"command": "npx"` with `"args": ["-y", "github:vladtarrow/gpu-intern"]` instead. The skill installs separately with `npx skills add vladtarrow/gpu-intern` (needs Node 22.20 or later).
Raise the agent's tool timeout where the default is short: a digest of a large file can take minutes on a small GPU.
<details>
<summary><b>Codex CLI</b>: <code>~/.codex/config.toml</code></summary>
```toml
[mcp_servers.gpu-intern]
command = "node"
args = ["/path/to/gpu-intern/dist/gpu-intern.mjs"]
tool_timeout_sec = 300
[mcp_servers.gpu-intern.env]
INTERN_MODEL = "qwen2.5-coder:7b"
```
Or: `codex mcp add gpu-intern --env INTERN_MODEL=qwen2.5-coder:7b -- node /path/to/gpu-intern/dist/gpu-intern.mjs`, then add `tool_timeout_sec = 300` (the default is 60).
</details>
<details>
<summary><b>Gemini CLI</b>: <code>~/.gemini/settings.json</code></summary>
```json
{
"mcpServers": {
"gpu-intern": {
"command": "node",
"args": ["/path/to/gpu-intern/dist/gpu-intern.mjs"],
"env": { "INTERN_MODEL": "qwen2.5-coder:7b" }
}
}
}
```
Stdio servers connect only in trusted folders. Antigravity CLI reads the same `mcpServers` block from `~/.gemini/config/mcp_config.json`.
</details>
<details>
<summary><b>OpenCode</b>: <code>opencode.json</code></summary>
```json
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"gpu-intern": {
"type": "local",
"command": ["node", "/path/to/gpu-intern/dist/gpu-intern.mjs"],
"environment": { "INTERN_MODEL": "qwen2.5-coder:7b" }
}
}
}
}
```
This is the OpenCode 2 format. In the older format the server sits directly under `"mcp"` with `"enabled": true`.
</details>
<details>
<summary><b>Cursor</b>: <code>~/.cursor/mcp.json</code> or <code>.cursor/mcp.json</code></summary>
```json
{
"mcpServers": {
"gpu-intern": {
"type": "stdio",
"command": "node",
"args": ["/path/to/gpu-intern/dist/gpu-intern.mjs"],
"env": { "INTERN_MODEL": "qwen2.5-coder:7b" }
}
}
}
```
</details>
<details>
<summary><b>VS Code with GitHub Copilot, Copilot CLI</b>: <code>~/.copilot/mcp-config.json</code> or <code>.mcp.json</code></summary>
```json
{
"mcpServers": {
"gpu-intern": {
"type": "stdio",
"command": "node",
"args": ["/path/to/gpu-intern/dist/gpu-intern.mjs"],
"env": { "INTERN_MODEL": "qwen2.5-coder:7b" },
"tools": ["*"],
"timeout": 300000
}
}
}
```
The Copilot default timeout is 30 seconds, hence `"timeout"`.
</details>
<details>
<summary><b>Claude Code without the plugin</b></summary>
```bash
claude mcp add --env INTERN_MODEL=qwen2.5-coder:7b --transport stdio gpu-intern -- node /path/to/gpu-intern/dist/gpu-intern.mjs
npx skills add vladtarrow/gpu-intern
```
</details>
## Features
- **Reads the whole file, not the first screen.** The text is split into parts that fit your model's context, each part gets notes with line references, and the notes are merged into one answer of at most `max_words` words.
- **Exact counts you can trust.** Quote a string in the question (`find every "ECONNRESET"`) and gpu-intern itself counts every matching line and lists the first line numbers. This part does not come from the model.
- **Checked line references.** Every `L120` in the answer is checked: refs past the end of the file get `[bad ref]`, refs to lines the model never saw get `[?]`.
- **Less noise first.** Runs of similar log lines (same text once numbers and ids are masked) shrink to first line, count, last line before the model reads them. Lines with your quoted terms are never collapsed.
- **Honest coverage.** If a file has more parts than the per-call cap (`INTERN_MAX_CHUNKS`, default 24), gpu-intern reads the most promising parts first (question words, error-like lines, first and last part) and lists the line ranges it skipped.
- **A savings ledger, labelled as an estimate.** Each digest ends with the tokens a full read would have cost versus the tokens returned (characters / 4). `intern_status` keeps running totals.
- **Windows is first-class.** UTF-16 files from PowerShell 5.1 redirection, CRLF, Git Bash paths (`/c/Users/...`, `/tmp/...`) and junctions are handled; CI runs on Windows and Linux.
- **Safe by default.** Read-only, project folders only, secret-looking files refused, local endpoints only, no telemetry. See [SECURITY.md](SECURITY.md).
- **One file.** `dist/gpu-intern.mjs` runs on Node 18+ or bun with nothing to install.
### Tools
| Tool | What it does |
|---|---|
| `digest_file(path, question?, max_words?)` | Digest one file. Refs look like `L120-L135`. |
| `digest_files(paths? or glob?, question, max_words?)` | One question over several files (capped by `INTERN_MAX_FILES` and `INTERN_MAX_TOTAL_MB`). Refs look like `logs/a.log:L12`. |
| `local_ask(prompt, paths?, max_words?)` | Classify, extract, translate or reformat text or files. Big files are processed in parts. |
| `intern_status()` | Endpoint and model health, context size, allowed folders, limits, running totals. |
### Configuration
All settings are environment variables; empty values count as unset.
| Variable | Default | Meaning |
|---|---|---|
| `INTERN_BASE_URL` | `http://127.0.0.1:11434/v1` | OpenAI-compatible endpoint. Ollama's default; LM Studio uses `http://127.0.0.1:1234/v1`, llama.cpp `llama-server` `http://127.0.0.1:8080/v1`. |
| `INTERN_MODEL` | first chat model the endpoint lists | Model id, e.g. `qwen2.5-coder:7b`. |
| `INTERN_CONTEXT` | `4096` | Context the model runs with, in tokens. Keep it at or below the server's setting (Ollama: `OLLAMA_CONTEXT_LENGTH`). |
| `INTERN_ROOTS` | the agent's workspace roots, else `CLAUDE_PROJECT_DIR`, else the start folder | Allowed folders; `;`-separated on Windows, `:`-separated elsewhere. |
| `INTERN_ALLOW_REMOTE` | off | `1` allows an endpoint on another machine. File text will travel there. |
| `INTERN_API_KEY` | none | Sent as a bearer token, for servers that want one. |
| `INTERN_MAX_CHUNKS` | `24` | Most parts the model reads per call. |
| `INTERN_TIME_BUDGET_S` | `240` | Time budget per call; reading stops at 75% of it and the notes so far are merged. |
| `INTERN_TIMEOUT_S` | `180` | Timeout for one model request. |
| `INTERN_MAX_FILE_MB`, `INTERN_MAX_FILES`, `INTERN_MAX_TOTAL_MB` | `50`, `50`, `100` | Size caps. |
| `INTERN_CONCURRENCY` | `1` | Parallel requests. Raise only if your server runs several at once (Ollama: `OLLAMA_NUM_PARALLEL`). |
| `INTERN_TEMPERATURE` | `0.1` | Sampling temperature for the local model. |
| `INTERN_SCRATCH_DIR` | `%TEMP%\gpu-intern`, or `$TMPDIR/gpu-intern-<uid>` | Folder for redirected command output; always allowed. |
| `INTERN_DATA_DIR` | `${CLAUDE_PLUGIN_DATA}` as a plugin, else a per-user data folder | Where `stats.json` (the running totals) lives. |
## How it works
```mermaid
flowchart LR
A[Coding agent] -- "digest_file(path, question)" --> B[gpu-intern]
B --> C["Read and guard:<br/>allowed folders, no secrets,<br/>UTF-8 / UTF-16"]
C --> D["Number lines,<br/>collapse repeats,<br/>count exact terms"]
D --> E["Parts sized to<br/>the model's context"]
E --> F["Local model on your GPU:<br/>notes per part"]
F --> G["Merge notes,<br/>check every line ref"]
G -- "short digest + refs" --> A
```
1. The path is resolved and checked: it must be a regular text file inside the allowed folders after following symlinks, and must not look like a secret.
2. Lines are numbered the way `grep -n` numbers them. Blank lines are skipped; long lines are split; similar consecutive lines collapse.
3. Quoted terms are counted over every line. Those counts go into the answer as-is and are also given to the model as facts.
4. Lines are packed into parts that fit `INTERN_CONTEXT` with room for the reply (token counts are sized pessimistically, so number-heavy logs get smaller parts).
5. The model writes up to six bullet points with line refs per part, or `NONE`. Notes are merged in one or more rounds into the final answer.
6. Line refs are checked against the file and the parts actually read, the answer is cut to `max_words`, and the footer reports coverage and the token estimate.
The agent skill ([skills/gpu-intern/SKILL.md](skills/gpu-intern/SKILL.md)) tells the agent to spot-check the cited lines with a targeted read before acting on any digest.
## Comparison with alternatives
These projects inspired gpu-intern or solve nearby problems. Descriptions are from their READMEs as of November 2026.
| Project | What it does | How gpu-intern differs |
|---|---|---|
| [headroomlabs-ai/headroom](https://github.com/headroomlabs-ai/headroom) | Compresses tool output, logs, files and RAG chunks before they reach the LLM (library, proxy, MCP server). | The paid model never reads the file, compressed or not: a local model reads it and only the answer comes back. |
| [rtk-ai/rtk](https://github.com/rtk-ai/rtk) | CLI proxy that rewrites 100+ common dev commands to print compact output. | Complementary. rtk shrinks command output; gpu-intern answers a question about a file of any size. |
| [JuliusBrussee/caveman](https://github.com/JuliusBrussee/caveman) | Skill plus local proxy: terse answers, and a tiny local model that keeps only the lines relevant to a request. | gpu-intern writes an answer with line references and exact counts, as a plain MCP server for any agent. |
| [houtini-ai/houtini-lm](https://github.com/houtini-ai/houtini-lm) | MCP server that hands bounded tasks (code review, test stubs, commit messages) to local or cloud LLMs. | Built for bulk reading: files larger than the model's context are split and merged, with checked line refs. Its README describes no splitting of such files. |
| [alisorcorp/ask-local](https://github.com/alisorcorp/ask-local) | Claude Code command plus Python scripts that let an LM Studio model read, list and grep files. | gpu-intern reads whole files (ask-local truncates each to 12,000 characters) and works with any OpenAI-compatible server. |
| [BeehiveInnovations/pal-mcp-server](https://github.com/BeehiveInnovations/pal-mcp-server) | Lets your agent consult other models (Gemini, OpenAI, Ollama and more) for second opinions, reviews and consensus. | gpu-intern does not consult; it reads, so your main model keeps every decision. |
| [NadirRouter/NadirClaw](https://github.com/NadirRouter/NadirClaw) | Router proxy that sends simple prompts to cheap or local models and hard ones to premium models. | Nothing is rerouted: your agent keeps its model and delegates only the reading. |
| [nicedreamzapp/claude-code-local](https://github.com/nicedreamzapp/claude-code-local) | Runs Claude Code on a local model when your usage runs out. | gpu-intern keeps the main model and offloads only reading and triage. |
| [openai/codex-plugin-cc](https://github.com/openai/codex-plugin-cc) | Claude Code plugin that hands reviews and tasks to Codex. | Delegates to a free model on your own GPU, and only the reading. |
## FAQ
**Does my code or my logs leave my computer?**
No. File text goes only to `INTERN_BASE_URL`, and gpu-intern refuses any host other than this computer unless you set `INTERN_ALLOW_REMOTE=1`. The digest goes back to your agent, which sends it to its own model like any other tool result. No telemetry.
**Can I trust a digest?**
Treat it as a lead. The exact-match counts are computed by gpu-intern and are reliable; the rest comes from a small model that can miss or misread lines. Check the footer for skipped ranges and `[?]` refs, and read the cited lines before acting. The bundled skill tells agents to do exactly that.
**How much does it save?**
Every digest prints both numbers: the estimated tokens of a full read (characters / 4) and the estimated tokens of the digest. As an illustration only: for the 5.4 MB demo log that is about 1,406,759 versus about 231, but that run used the mock model, so it shows the size of the output, not the quality of a real answer. Real-model measurements are not published yet. `intern_status` keeps running totals for your own use.
**How fast is it?**
Untested on real hardware so far. Speed depends on your GPU, the model and the file. A call reads at most `INTERN_MAX_CHUNKS` parts (default 24) and stops at the time budget (default 240 s), then merges what it has and says what it skipped.
**Which model and GPU should I use?**
Quantized models of 3 to 8 billion parameters take roughly 2 to 5 GB of VRAM, plus room for the context. None of the settings below has been measured yet.
| VRAM | Models to try (Ollama tags) | `INTERN_CONTEXT` | Status |
|---|---|---|---|
| 6 GB (e.g. GTX 1660 Ti) | `qwen2.5-coder:7b`, `llama3.1:8b`, `gemma3:4b`, `qwen2.5:3b`, `llama3.2:3b` | `4096` | untested |
| 8 to 12 GB | `qwen2.5-coder:7b`, `llama3.1:8b` | `8192` (also set `OLLAMA_CONTEXT_LENGTH=8192`) | untested |
| CPU only | `qwen2.5:3b`, `llama3.2:3b` | `4096` | untested; slow |
Reasoning models that print `<think>` blocks work (the blocks are removed) but spend part of each reply on thinking.
**What is safe for it to read?**
Only text files inside the allowed folders and the scratch folder. It refuses `.env` files, private keys, certificates, credential files and anything under `.git`, `.ssh` or `.aws`. It never writes into your project. See [SECURITY.md](SECURITY.md).
**What about prompt injection?**
A log can contain text like "ignore your instructions". The local model is told to treat file text as data, but small models are easy to fool. Do not use digests for security decisions.
**Why do line numbers sometimes differ from my editor?**
gpu-intern counts lines like `grep -n` and `sed -n`: only `\n` ends a line. Editors that also break lines at a lone `\r` (progress bars) count more.
**How do I digest the output of a noisy command?**
Redirect it into the scratch folder, which is always allowed and is created when the server starts. Then digest that file; `intern_status` prints the exact folder.
| macOS / Linux | Windows PowerShell |
|---|---|
| `npm test > "${TMPDIR:-/tmp}/gpu-intern-$(id -u)/test.log" 2>&1` | `npm test *> "$env:TEMP\gpu-intern\test.log"` |
## Contributing
Issues and pull requests are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). The most useful report is a real run: your GPU, model, file size, time taken and the `gpu-intern --check` output.
## License
[MIT](LICENSE) © 2026 Vladyslav Tarasenko. The bundled `dist/gpu-intern.mjs` includes MIT, ISC and BSD-3-Clause packages; their notices are in [dist/THIRD-PARTY-NOTICES.md](dist/THIRD-PARTY-NOTICES.md).
## Credits
- Built on the [Model Context Protocol TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk), [zod](https://github.com/colinhacks/zod) and [tinyglobby](https://github.com/SuperchupuDev/tinyglobby).
- Runs on local servers such as [Ollama](https://github.com/ollama/ollama), [LM Studio](https://lmstudio.ai) and [llama.cpp](https://github.com/ggml-org/llama.cpp).
- The idea of saving tokens before they reach the paid model comes from [rtk](https://github.com/rtk-ai/rtk), [headroom](https://github.com/headroomlabs-ai/headroom) and [caveman](https://github.com/JuliusBrussee/caveman); delegating work to another agent from [codex-plugin-cc](https://github.com/openai/codex-plugin-cc).
This server cannot be deployed
Maintenance
ActivityNo data
ResponsivenessOutdated data