| name | long-context |
| description | Process documents and codebases exceeding a single context window using canonical dspy.RLM variable mode in the Daytona REPL. |
Long-Context Processing (dspy.RLM)
Official references:
Core pattern (variable space vs token space)
dspy.RLM stores large inputs as REPL variables (document_text, context_paths, history, …). The model sees only metadata (name, type, length, preview) and explores with Python:
print(document_text[:2000]) or print(len(document_text)) to peek.
- Use slices,
re, or open(path) on context_paths to locate relevant sections.
- Call
llm_query(snippet) or llm_query_batched([...]) on focused excerpts — never the full document.
- Finish with
SUBMIT(answer=...).
fleet-rlm auto-routing
execution_mode=auto routes to large_context_rlm when estimated context ≥ FLEET_RLM_LARGE_CONTEXT_THRESHOLD (default 32_000 chars).
- Staged sandbox paths arrive as
context_paths REPL variables with context_manifest metadata.
- Optional
sub_rlm(text) delegates to an isolated child sandbox for heavy map-reduce (see delegation skill).
Optional pre-chunking
When semantic boundaries matter before delegation:
scripts/semantic_chunk.py — split by structure (markdown, logs, Python, JSON).
scripts/rank_chunks.py — rank chunks against the query.
Chunking complements dspy.RLM; it does not replace REPL inspection.
Guardrails
- Do not paste whole documents into the action prompt or assistant reply.
- Do not call
llm_query on an entire large variable; slice first.
- Respect
max_llm_calls and max_output_chars; print summaries, not raw dumps.
- Load this skill from the volume with
load_skill("long-context") when mounted at /home/daytona/memory/.
Exact quote retrieval
When the user asks for a verbatim quote or speaker attribution:
- Return exactly one quote block in
SUBMIT — not a numbered list of quotes.
- Locate the speaker in
document_text with Python search, then slice the typographic quote span verbatim.
- Do not paraphrase, substitute heading text, or open host
context_paths in the sandbox.