long-context

star 48

Process documents and codebases exceeding a single context window using canonical dspy.RLM variable mode in the Daytona REPL.

Qredence By Qredence schedule Updated 6/8/2026

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:

  1. print(document_text[:2000]) or print(len(document_text)) to peek.
  2. Use slices, re, or open(path) on context_paths to locate relevant sections.
  3. Call llm_query(snippet) or llm_query_batched([...]) on focused excerpts — never the full document.
  4. 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.
Install via CLI
npx skills add https://github.com/Qredence/fleet-rlm --skill long-context
Repository Details
star Stars 48
call_split Forks 6
navigation Branch main
article Path SKILL.md
More from Creator