Recursive Language Model - Process documents larger than LLM context windows
Matryoshka RLM presents a specialized document analysis toolkit with 15 tools. Strengths: clear, verb-based naming (lattice_*, llm_query, batch_llm_query, grep, fuzzy_search); detailed parameter descriptions with usage guidance (e.g., 'fuzzy_search: single search term, NOT regex'); explicit warnings about expensive operations (llm_query, batch_llm_query). Weaknesses: output schemas are not documented in the visible source code, the rubric requires documented return types for A+ tools, and none are visible here. Several tools lack explanation of what data structure they return (lattice_expand, lattice_bindings, context.match). No error handling guidance visible (e.g., what happens if lattice_load fails? how should the agent recover?). Some parameter descriptions are good (context.match flags explanation) but inconsistent across tools. The tool composition is sound (each does one thing), but lack of output schema documentation and error recovery patterns prevents this from reaching 70+.
Execute multiple LLM queries in parallel. Much faster than sequential llm_query calls when you need to process multiple chunks or sections. All prompts are sent simultaneously.
Search context with a regular expression. Returns all matches.
Get a portion of the context by character indices. Use sparingly - prefer fuzzy_search to find relevant sections first.
Estimate the token count of text. Useful for checking if a section will fit in an LLM call. Uses word-based heuristics (most words = 1 token).
Find approximate keyword matches using fuzzy string matching. Returns matching lines with line numbers and match scores (lower score = better match). NOTE: Takes a single search term, NOT regex. For regex patterns use grep() instead.
Fast regex search with line numbers. More efficient than context.match for finding specific patterns. Returns matches with line numbers and character indices.
Output schemas not documented. No visible return type specifications for any tool. Rubric requires documented return types for A+ tools, LLMs need to know what fields to expect in responses so they can plan downstream calls and extract data correctly.
Error handling guidance missing. No descriptions of what errors tools can raise, what they mean, or what recovery steps the LLM should take. Rubric requires: 'Error responses must tell the LLM what to do next' and categorize errors as retryable, user-fixable, or fatal.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | D | 56 | <=2025-11-25 | v2 |
| 2026-03-09 | F | 40 | - | v1 |
Show current handle bindings.
Close the session and free memory.
Get full data from a handle stub. Use limit for large results. Supports pagination via offset.
Load a document for analysis. Use for files >500 lines. Returns line count and size. Session stays open until close.
Execute a Nucleus S-expression query on the loaded document. Array results return handle stubs; scalars return directly. Chain operations via RESULTS variable.
Get current session status.
Query a sub-LLM to process a chunk of text. Expensive operation - batch related information when possible to minimize calls. Use format: 'json' for structured data extraction.
Extract lines by line number (1-based). More precise than slice() for line-based navigation. Supports negative indices to count from end.
Get document metadata WITHOUT reading tokens: length, line count, and 5-line samples from start/middle/end. Use this first to understand document structure.
lattice_status and lattice_bindings have minimal descriptions (under 50 chars). Descriptions lack context for LLM selection, when should the agent call these instead of other tools? What actionable insight do they provide?
Inconsistent parameter naming conventions. Some tools use underscores (file_path, max_items), others use bare names (pattern, flags). Rubric requires clear, consistent suffixing (e.g., limit_items, offset_items) to avoid LLM confusion about units and constraints.
No pagination/limits explicitly returned. fuzzy_search accepts 'limit' parameter but unclear if response is always truncated or if total_count is returned. Rubric requires: tools returning lists should return total count or next_cursor to enable pagination.
Sampling feature enabled (sampling=true in FEATURES) but no integration visible in source code. Per 2026-07-28 spec, Sampling is deprecated, integrating directly with LLM provider API is now recommended. Applies -3 deduction.