# RLM: Divide and Conquer
# Handle inputs 100x beyond context limits

input corpus: "Large corpus to analyze"
input query: "What to find or compute"

agent chunker:
  model: haiku
  prompt: "Split at semantic boundaries into 4-8 chunks."

agent analyzer:
  model: sonnet
  prompt: "Extract information relevant to the query."

agent synthesizer:
  model: opus
  prompt: "Combine partial results. Reconcile conflicts."

block process(data, depth):
  if **data under 50k characters** or depth <= 0:
    output session: analyzer
      prompt: "{query}"
      context: data

  let chunks = session: chunker
    prompt: "Split this corpus"
    context: data

  let partials = []
  parallel for chunk in chunks:
    let result = do process(chunk, depth - 1)
    partials = partials + [result]

  output session: synthesizer
    prompt: "Synthesize for: {query}"
    context: partials

output answer = do process(corpus, 4)
