Matryoshka

•
151
•

Analyzes large documents and codebases token-efficiently using symbolic reasoning and a logic engine, circumventing LLM context window limitations.

Matryoshka empowers large language models (LLMs) to analyze documents vastly exceeding their context windows without traditional RAG or chunking methods. It employs a Recursive Language Model (RLM) approach where the LLM reasons about a query and outputs constrained symbolic commands in the Nucleus DSL. These commands are then executed safely by the Lattice logic engine, which features a robust parser, type inference, and a miniKanren-based solver. A key innovation is its handle-based, in-memory SQLite storage, providing over 97% token savings by presenting LLMs with compact references instead of full data, making it exceptionally efficient for complex and voluminous analysis tasks.

Características Principales

0162 GitHub stars
02Recursive Language Model (RLM) Architecture: Processes documents far larger than LLM context windows using symbolic commands and a logic engine.
03Nucleus DSL for Safe Execution: Utilizes a constrained S-expression language for LLM outputs, ensuring parseable, type-checked, and safely executable commands.
04Structured Code Analysis: Integrates Tree-sitter for code-aware queries, enabling symbol listing, body extraction, and reference finding across 20+ languages.
05MCP Server for Agent Integration: Provides a Model Context Protocol server (`lattice-mcp`) allowing coding agents to perform efficient, chained document and code analysis.
06Token-Efficient Handle-Based Storage: Achieves 97%+ token savings by storing results in an in-memory SQLite and providing LLMs with compact data handles.

Casos de Uso

01Analyzing extensive reports, log files, or legal documents that exceed typical LLM context limits.
02Empowering AI coding agents to efficiently query and understand large codebases for tasks like refactoring or debugging.
03Performing complex data aggregation and filtering on large datasets without vector databases or manual chunking.