| name | lattice |
| description | Analyze large files (>500 lines) using handle-based Nucleus queries for 97% token savings. Use when you need to search, filter, aggregate, or explore documents too large for direct context. |
Lattice - Large File Analysis
Use the Lattice MCP tools to analyze files that are too large to read directly. Lattice stores query results server-side and returns compact handle stubs, achieving 97%+ token savings.
When to Use
- File is larger than 500 lines (for smaller files, use Read directly)
- You need multiple searches on the same file
- You're extracting or aggregating structured data (counts, sums, patterns)
- You're doing exploratory analysis and don't know what you're looking for
- You want to avoid hallucination on factual queries about file contents
Core Workflow
The standard workflow is: load → query → expand → close
lattice_load — Open the file (starts a session)
lattice_query — Run Nucleus S-expression commands (returns handle stubs like $res1)
lattice_expand — Inspect actual data from a handle when you need to see contents
lattice_close — End the session when done
Efficiency Tips
- Chain operations in sequence rather than making many independent queries. Use
RESULTS to refer to the previous result and build a pipeline in a single query session.
- Start broad, then narrow:
grep first, then filter, then count/sum.
- : Handle stubs give you counts and previews — expand only when you need to see actual data for decision-making.