Agent skill

Lattice

by yogthos in yogthos/Matryoshka

Analyze large files (500 lines) using handle-based Nucleus queries for 97% token savings.

Apache-2.0Auto-check passedAgent Workflows

Install Lattice

skills CLI
$ npx skills add yogthos/Matryoshka --skill lattice -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yogthos/Matryoshka lattice --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yogthos/Matryoshka.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/lattice .claude/skills/lattice && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
lattice
GitHub stars
150
Token cost
~1.1k tokens
SKILL.md length
375 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
Apache-2.0

At a glance

Analyze large files (500 lines) using handle-based Nucleus queries for 97% token savings.

  • Works in 4 steps: lattice_load — Open the file (starts a… → lattice_query — Run Nucleus S-expression… → lattice_expand — Inspect actual data… → …
  • You need to search
  • SKILL.md covers When to Use, Core Workflow, Nucleus Command Reference and Variable Bindings, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Lattice is an agent skill from yogthos/Matryoshka. 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.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering MCP servers. It works with Model Context Protocol. The repository describes itself as: MCP server for token-efficient large document analysis via the use of REPL state. The licence is Apache-2.0.

When your agent uses it

  • You need to search
  • Explore documents too large for direct context

Example prompts

  • “/lattice”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. lattice_load — Open the file (starts a session)
  2. lattice_query — Run Nucleus S-expression commands (returns handle stubs like $res1)
  3. lattice_expand — Inspect actual data from a handle when you need to see contents
  4. lattice_close — End the session when done

What it can do on your machine

Read from SKILL.md and the folder at commit ccf3ca0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are scheme).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Lattice loads about 1.1k tokens when it runs. Until then it costs about 49 tokens; SKILL.md has 375 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~49
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from yogthos/Matryoshka at commit ccf3ca0, republished under its Apache-2.0 licence (© yogthos). 375 words, ~1,118 tokens.

Download SKILL.mdSave it as .claude/skills/lattice/SKILL.md (or your agent's skills folder).
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

  1. lattice_load — Open the file (starts a session)
  2. lattice_query — Run Nucleus S-expression commands (returns handle stubs like $res1)
  3. lattice_expand — Inspect actual data from a handle when you need to see contents
  4. 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.
  • Only expand when needed: Handle stubs give you counts and previews — expand only when you need to see actual data for decision-making.
  • Prefer (count RESULTS) or (sum RESULTS) over expanding and counting client-side.

Nucleus Command Reference

scheme
(grep "pattern")              ; Regex search — returns handle to matching lines
(fuzzy_search "query" 10)     ; Fuzzy match — top N results by relevance
(lines 10 20)                 ; Get specific line range (start end)
Transform
scheme
(filter RESULTS (lambda x (match x "pattern" 0)))   ; Keep matching items
(map RESULTS (lambda x (match x "(\\d+)" 1)))       ; Extract regex group from each item
Aggregate
scheme
(count RESULTS)               ; Count items (returns scalar directly)
(sum RESULTS)                 ; Sum numeric values (auto-extracts numbers)
Extract
scheme
(match str "pattern" 1)       ; Extract regex capture group from a string
Code & Document Symbols (for .ts, .js, .py, .go, .rs, .md, etc.)
scheme
(list_symbols)                ; List all functions, classes, methods, headings, etc.
(list_symbols "function")     ; Filter by kind: "function", "class", "method", "interface", "type"
(get_symbol_body "funcName")  ; Get full source code of a symbol
(find_references "identifier"); Find all usages of an identifier
Show full SKILL.md (170 more words)Show less

Variable Bindings

  • RESULTS — Always points to the last array result. Use this in queries to chain operations.
  • _1, _2, _3, ... — Results from turn N. Use to reference older results in queries.
  • $res1, $res2, ... — Handle stubs. Use these ONLY with lattice_expand, NOT in queries.

Complete Workflow Example

Task: Find and count timeout errors in a log file

  1. Load the document:

    lattice_load("/path/to/server.log")

    → Loaded: 15,234 lines, 2.1 MB

  2. Search for errors:

    lattice_query('(grep "ERROR")')

    → $res1: Array(342) [2024-01-15 ERROR: Connection timeout...]

  3. Filter for timeouts:

    lattice_query('(filter RESULTS (lambda x (match x "timeout" 0)))')

    → $res2: Array(47) [2024-01-15 ERROR: Connection timeout...]

  4. Count them:

    lattice_query('(count RESULTS)')

    → Result: 47

  5. Inspect a sample if needed:

    lattice_expand("$res2", limit=5)

    → Shows first 5 actual timeout error lines

  6. Close when done:

    lattice_close()

Code Analysis Workflow

Task: Understand a large TypeScript file

  1. Load and list symbols:

    lattice_load("/path/to/large-module.ts")
    lattice_query('(list_symbols)')

    → $res1: Array(45) [function handleRequest, class Router, ...]

  2. Get a specific function:

    lattice_query('(get_symbol_body "handleRequest")')

    → Returns full source code of the function

  3. Find all references:

    lattice_query('(find_references "handleRequest")')

    → $res2: Array(8) [line 45: handleRequest(req), ...]

© yogthos, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/lattice of yogthos/Matryoshka.

Open the folder on GitHubat commit ccf3ca0

Compare with similar skills

Lattice next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Lattice compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Lattice this skillyogthos/Matryoshka150—~1.1kAutomated safety check: PassApache-2.0
MCP Server Builderanthropics/skills180k63 repos~2.3kAutomated safety check: PassApache-2.0
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
MCP Integration for Pluginsanthropics/claude-plugins-official38k11 repos~3.1kAutomated safety check: PassApache-2.0
Crush Configurationcharmbracelet/crush29k—~3.7kAutomated safety check: PassCustom licence
Context Mode Output Sandboxmksglu/context-mode26k—~4.1kAutomated safety check: PassCustom licence

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 63 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    38k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Context Mode Output Sandbox

    mksglu/context-mode

    Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.

    26k GitHub stars~4.1k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Migrates the compatible subset of settings and global file-based MCP servers from the Warp desktop app into Warp Agent CLI without exposing credentials or state.

    65k GitHub starsUsed in 1 repo~2.1k tokens
    Agent WorkflowsAuto-check passed

Categories

Questions about Lattice

What does Lattice do?

Analyze large files (500 lines) using handle-based Nucleus queries for 97% token savings. Lattice is an agent skill from yogthos/Matryoshka. Analyze large files (500 lines) using handle-based Nucleus queries for 97% token savings.

When should I use Lattice?

Lattice fits situations like: you need to search; explore documents too large for direct context.

How do I install Lattice in Claude Code?

Run `npx skills add yogthos/Matryoshka --skill lattice -a claude-code`. Or copy the skill folder (skills/lattice in yogthos/Matryoshka) into .claude/skills/lattice in your project. Claude Code loads it when a task matches its description.

How do I install Lattice in Codex?

Run `npx skills add yogthos/Matryoshka --skill lattice -a codex`. Or copy the skill folder (skills/lattice in yogthos/Matryoshka) into .agents/skills/lattice in your project. Codex loads it when a task matches its description.

Can I use Lattice in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yogthos/Matryoshka --skill lattice -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/lattice, .gemini/skills/lattice, .github/skills/lattice and .opencode/skills/lattice in your project.

What does Lattice need to run?

SKILL.md names no scripts, command-line tools or credentials: Lattice is instructions for the agent only.

Does Lattice access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Lattice safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Lattice use?

Lattice is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Lattice use?

About 1.1k tokens (SKILL.md is roughly 4.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Lattice?

Skills that share tags, products or a category with Lattice: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), MCP Integration for Plugins (anthropics/claude-plugins-official, 38k stars) and Crush Configuration (charmbracelet/crush, 29k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Lattice?

yogthos (a GitHub user) maintains it in yogthos/Matryoshka, which has 150 GitHub stars. The repository was last updated on May 17, 2026.

Source: yogthos/Matryoshka on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.