tree-sitter-scope-extractor

Installation
SKILL.md

Tree-Sitter AST Scope Extraction Protocol (Surgical Block Ingestion)

Overview

When an agent is debugging a stack trace pointing to a specific line number (e.g., TypeError at src/services/order.ts:142), naive agents ingest the complete 800-line source file.

Full-file ingestion:

  1. Consumes 6,000+ Tokens: 90% of the file contains unrelated CRUD routes, database connection pools, and logging utilities.
  2. Dilutes Debugging Attention: The LLM's attention heads must filter through 750 lines of background code to focus on the 20 lines that actually caused the bug.
  3. Multiplies Turn Latency: Re-ingested on every follow-up diagnostic turn.

The Tree-Sitter AST Scope Extraction Protocol parses the file into an Abstract Syntax Tree in 2 milliseconds, extracting strictly the top-level imports and the immediate enclosing AST scope (function, method, or class block).


Full-File Dump vs. Tree-Sitter Enclosing Scope Slice

Installs
1
GitHub Stars
2
First Seen
Oct 24, 2026