
skimread
io.github.avikchakraborty060-create由 GitHub 账号 avikchakraborty060-create 发布v0.1.1更新于 Oct 25, 2026
面向编码代理的无损上下文防护:命令摘要、文件大纲、行范围读取。
AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。
原文描述
Lossless context guard for coding agents: command digests, file outlines, line-range reads.
概览
skimread 的本地 MCP 服务;无需登录;STDIO。
暂无 AI 概览:以下信息来自注册中心条目和服务本身。
安装
在 SourceWeft 中
- 打开 控制台中的 skimread,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
skimread — skim before you read
A lossless context guard for AI coding agents. Zero dependencies, runs entirely on your machine, MIT licensed. Works with Claude Code out of the box, and with any other agent (Codex, Cursor, Aider, Copilot, your own) through a CLI and an MCP server.
What is it?
When you use an AI coding agent, you pay for every token it reads. Most of that money goes to two things the agent does not actually need:
- Reading big files whole. The agent wants one function and reads all 2,000 lines of the file to find it. Next session it does it again.
- Reading noisy command output.
pytest -vprints 1,500PASSEDlines to tell you about 2 failures.npm installprints 40 deprecation warnings.cargo buildlists every crate it compiled.
skimread sits between the agent and those two sources and hands the agent a skim first:
- For files: an outline instead of the file. When the agent is about to read a large file, skimread gives it a map of the file (functions, classes, headings, keys, each with its line range) and says "read only the slice you need". The agent then reads 60 lines instead of 2,000.
- For commands: a digest instead of the dump. Noisy commands run through skimread. The agent sees the errors, the failing tests, the stack frames in your code, and the summary line. The 1,500
PASSEDlines are folded into one line that says so.
The key word is lossless. Nothing is thrown away. Every command's full output is kept on your disk, and every digest ends with a handle (skimread show 42, skimread show 42 120-180, skimread show 42 --grep TypeError). Every outline tells the agent exactly which line range to read next. The agent is never stuck and never has to re-run a build to see what it missed.
Why not one of the existing output compressors?
Tools that compress shell output already exist (RTK, token-saver, condense). They share two limits. They cannot touch the agent's own file-reading tool, which is the bigger token sink. And they are lossy: when the compressor drops the one line the agent needed, the agent re-runs the command, and an independent benchmark found that this can cost more than not compressing at all. skimread guards file reads too, and keeps everything retrievable.
What it is not
- Not a cloud service. No network calls, no accounts, no telemetry.
~/.skimreadis the whole state. - Not an LLM. Everything is deterministic parsing and folding, so it runs in milliseconds and costs nothing.
- Not a summariser that guesses. It never rewrites a line; it only hides lines it can name and count, and tells you how to get them back.
Numbers
Measured on real tool output (fixtures in tests/fixtures, reproduce with python bench/bench.py). Token counts are estimates (chars / 3.6).
The last two rows are the point: when the output is already pure signal (a short build with two errors), skimread leaves it alone. Savings come from noise, never from hiding failures.
A 4,063-line Go file (net/http/server.go, ~36k tokens) becomes a ~600-token map of structs and methods with line ranges. skimread stats shows what it has saved you so far, in tokens and dollars.
How to use
1. Install (30 seconds)
Needs Python 3.9 or newer, nothing else.
Latest development version straight from GitHub: pipx install git+https://github.com/avikchakraborty060-create/The-top-innovation.
Everything skimread stores lives under ~/.skimread with owner-only permissions and is pruned after 7 days or 300 runs.
2. Claude Code: one command
Restart Claude Code. That is all. From then on:
- When Claude tries to
Reada file over 400 lines (or 16 KB) without a line range, it gets the outline and the instruction to read a range instead. A ranged read is always allowed. If Claude asks for the same whole file a second time in the session, it gets it, so it is never stuck. - When Claude runs a command known to be noisy (
npm,pytest,cargo,go,tsc,docker,git diff,find, and about 100 others) the command is rewritten to run throughskimread run. Claude sees the digest and the handle. The permission ruleBash(<path-to-skimread>:*)is added so this causes no extra prompts.
This is what Claude sees instead of a 2,014-line file:
And this is what Claude sees after pytest -v on a suite of 1,504 tests:
Tuning:
Safety: the Bash wrapper never touches commands that change shell state (cd at the end, export, source), redirect to files, run in the background, look interactive, or are destructive or privileged (rm, sudo, git push, git commit, curl | sh, and so on). Those run exactly as Claude wrote them, under your normal permission rules. A leading cd dir && … is kept outside the wrapper so the working directory still changes.
3. Codex, Cursor, Aider, Copilot, or your own agent
Any agent that can run shell commands can use skimread through the CLI. Put this in the agent's rules file (AGENTS.md, .cursorrules, a system prompt); skimread setup agents prints a ready-made snippet:
Agents that speak MCP can use it as a server instead. skimread mcp is a stdio MCP server with tools run, show, outline, read, list; skimread setup mcp prints the config block for mcpServers. Anything on stdin works too: cmd 2>&1 | skimread pipe --cmd "cmd".
4. See what it saved you
How it works
- Normalise. ANSI colours and cursor codes are stripped,
\rprogress bars resolve to their final state, backspaces are applied. - Format-aware reduction. Reducers for pytest, jest/vitest/mocha, cargo, go, npm/yarn/pnpm/bun, pip/uv/poetry, docker, tsc, git diff, and file/listing commands drop only what carries no decision value:
PASSEDlines,Compilinglines, deprecation warnings (counted), stdlib stack frames. Everything else stays. Unknown tools get the generic path: progress noise removed, exact duplicates counted (line (x5)), runs of near-identical lines folded (… 847 similar lines (159-1005) …). - Scoring and budget. Lines are scored (errors and stack frames high, summaries medium). If the reduced output still exceeds the budget, the head, the tail, and windows around the highest-scored lines are kept; every cut is replaced by
… [768 lines omitted (45-812) — skimread show 42 45-812] …. - Spool. The full normalised output is written to
~/.skimread/out/<id>.txtbefore the digest is produced, so the handle in the footer always works. - Outline. Python via the
astmodule (exact signatures and ranges); JS/TS, Go, Rust, Java/Kotlin/C#/Swift, C/C++, PHP, CSS via declaration regexes plus brace matching; Ruby/Elixir/Lua via indentation; Markdown headings; JSON/YAML/TOML keys; CSV shape; log files (time span, error line numbers); Makefiles, shell functions, SQL statements. Huge files fold members into their parents and truncate with a note rather than pretending to be complete.
Honest limitations
- Token counts are estimates (chars / 3.6), not tokenizer output. Ratios are what matter and they are unaffected.
- Outlines for brace languages are regex-based. They are meant for navigation, not correctness; a weird formatting style can miss a symbol. Grep still works.
- The Read guard costs one extra tool round-trip for files just over the threshold. The default (400 lines) is chosen so the outline plus a slice is still much cheaper than the file; raise it if your agent mostly needs whole files.
- The Bash wrapper runs the command through
bash -cin a child process. Shell functions and aliases defined in Claude Code's persistent shell are not visible to it (environment variables and the working directory are). - Only Claude Code has a hook that can intercept the agent's native Read. Other agents get the same capability through the CLI/MCP tools plus an instruction in their rules file.
Development
Add a format: write a reduce_<tool>() in skimread/formats.py that drops or folds noise lines and sets scores, register it in detect(), drop a real output sample into tests/fixtures, and add a row to tests/test_formats.py that states what must survive. Add a language: a pattern list in skimread/outline.py.
Contributions of real-world fixtures are the most valuable thing you can send: the reducers are only as good as the outputs they have seen.
License
MIT.
来源:README.md,提交 3f29672
工具
0版本历史
1- v0.1.1最新Oct 20, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分