Zero-Cat Native Inspection Protocol (view_file over Shell cat)
Overview
When inspecting a file on disk (e.g., src/services/billing.ts), naive agents frequently spawn terminal subprocesses to execute Unix or Windows print commands (run_command("cat src/services/billing.ts") or run_command("type file.ts")).
Using shell cat introduces four major operational failures:
- Zero Line-Number Indexing: Shell
catoutputs raw unnumbered text. The agent cannot accurately determineStartLineorEndLinefor downstreamreplace_file_contentedits, causing hallucinated line offsets. - Zero Slice Bounding:
catdumps the entire 2,000-line file into context, burning 15,000+ tokens when the agent only needed to check a 10-line function. - Subprocess Process Latency: Initializing a shell subprocess takes 400ms+, whereas native IDE filesystem APIs execute in sub-millisecond memory reads.
- Cross-Platform Incompatibility:
catfails or produces errors on Windowscmd.exeenvironments.
The Zero-Cat Native Inspection Protocol mandates using the native view_file tool, returning 1-indexed line numbers (42: code) with precise [StartLine, EndLine] slice controls.
Shell Subprocess cat vs. Native view_file Tool
┌─────────────────────────────────────────────────────────────┐
│ File Inspection Mechanics │
│ │
│ Shell Subprocess `cat file.ts` (600 Lines / 4,800 Tokens): │
│ import { db } from './db'; │
│ export function query() { ... } │
│ // [595 unindexed lines dumped into context] │
│ ↳ 4,800 tokens billed, 0 line numbers for editing! │
│ │
│ Native `view_file` Tool (30 Lines / 280 Tokens - 94.1% Cut):│
│ 40: export async function chargeCustomer(id: string) { │
│ 41: const customer = await getCustomer(id); │
│ 42: if (!customer) throw new NotFoundError(); │
│ ↳ 280 clean tokens, exact line numbers ready for patching │
└─────────────────────────────────────────────────────────────┘
The 4 Built-In Superpowers of view_file
┌───────────────────────────────────────────────────────────────────────────┐
│ 1. 1-INDEXED LINE NUMBERING: Every line prefixed with `<line_no>: ` │
│ 2. SURGICAL SLICE WINDOWING: `StartLine` and `EndLine` parameters │
│ 3. SUB-MILLISECOND VFS READS: Reads from IDE memory buffer without PTY │
│ 4. CROSS-PLATFORM DETERMINISM: 100% Identical on Windows, macOS, Linux │
└───────────────────────────────────────────────────────────────────────────┘
Tool Invocation Standard
When inspecting code in Antigravity IDE / Claude Code:
{
"AbsolutePath": "c:/Users/ASUS/Documents/Newfolder/Antigravity/Major AI Skills/src/services/billing.ts",
"StartLine": 40,
"EndLine": 75,
"toolAction": "Inspecting customer billing handler slice",
"toolSummary": "Surgical File View"
}
Benchmark Comparison
Inspecting and editing 50 target functions in full-stack repositories:
| Inspection Tool | Ingested Tokens / Inspection | Line Number Indexing | Subsequent Edit Success |
|---|---|---|---|
Shell cat / Get-Content |
4,200 tokens | ❌ None (Unnumbered) | 52% (Frequent line offset errors) |
Native view_file Tool |
310 tokens | ✅ Exact 1-Indexed | 98% (First-pass patch success) |
Agent Operational Directive
MANDATORY: Agents must NEVER run
cat,type,head,tail, orGet-Contentvia shell tools (run_command). Always call the dedicated nativeview_filetool with specificStartLineandEndLinearguments.