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])orprint(len(document_text))to peek.- Use slices,
re, oropen(path)oncontext_pathsto locate relevant sections. - Call
llm_query(snippet)orllm_query_batched([...])on focused excerpts — never the full document. - Finish with
SUBMIT(answer=...).
fleet-rlm auto-routing
execution_mode=autoroutes tolarge_context_rlmwhen estimated context ≥FLEET_RLM_LARGE_CONTEXT_THRESHOLD(default 32_000 chars).- Staged sandbox paths arrive as
context_pathsREPL variables withcontext_manifestmetadata. - Optional
sub_rlm(text)delegates to an isolated child sandbox for heavy map-reduce (seedelegationskill).
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_queryon an entire large variable; slice first. - Respect
max_llm_callsandmax_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_textwith Python search, then slice the typographic quote span verbatim. - Do not paraphrase, substitute heading text, or open host
context_pathsin the sandbox.