read-cap

Reviewed at commit 7592a15

Stops Claude reading a file over 1,000 lines whole (with Read, cat or Get-Content) and gives it an outline tool (definitions with line numbers) so it reads…

Made by
Vedant Andhale
What we checked

Refuses the first attempt by Claude to read a text file over 1,000 lines whole, with Read, a plain cat or Get-Content, and points it to an outline tool and ranged reads instead. Repeating the same read goes through. It reads the files Claude asks for to count lines and build the outline, makes no network calls and shows a count in the status line.

Review details

Static review of the source at the pinned commit; not run. Registers session.start (registers an MCP-style tool 'outline' via $.tool.register) and tool.call handlers for that tool, for Read and for Bash/PowerShell. For a Read without offset, limit or pages, and for a command that is exactly one cat or Get-Content of a single file with only plain characters (no pipes, redirects, variables, globs), it calls $.fs.stat and $.fs.read on that path (skipped for images, PDFs, notebooks and files over 4 MiB), counts lines and, if over 1,000, denies once with a message and lets the identical retry through (state kept in memory, per agent). The outline tool takes a file_path from the model, reads the file with $.fs.read and returns up to 300 lines that look like definitions (functions, classes, headings, const declarations) with line numbers, each cut at 120 characters; it does not restrict the path, so it can read a file outside the project, but only returns definition-looking lines and the tool call goes through Claude Code's normal tool handling. Uses $.session.cwd to resolve relative paths and $.ui.status for a counter. No model calls, no network, no process execution, no writes. Commands it does not fully understand pass through untouched.

What it uses
  • Reads your prompts: no
  • Sees tool calls: yes
  • Blocks or changes tool calls: yes
  • Reads or writes files: yes
  • Runs programs on your machine: no
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: no
  • Shows something on screen: yes
Hooked events
Screenshot of read-cap

Stops Claude reading a file over 1,000 lines whole (with Read, cat or Get-Content) and gives it an outline tool (definitions with line numbers) so it reads only the range it needs. A retry still reads it whole.

Made this mod? Add a badge to your README

modsforClaude badge for read-cap

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/read-cap.svg)](https://modsforclaude.com/mods/read-cap/)

← All mods