Persistence Patterns
Research Loop
Research Loop
A step with a retrieve block. The LLM sees a slate index, requests files via structured JSON, gets them injected, reasons, repeats up to maxRounds. The cold-start retrieval pattern.
Shape and when to use
Shape: a step declares a retrieve: block. The step sees a slate index in its fields, emits a JSON retrieval request, the engine injects the requested content as a new field, the step reasons and either requests more or produces a final answer.
When to use: cold-start retrieval. When you don't know at config time what specific memory is relevant, let the LLM discover it iteratively.
Cost: up to maxRounds LLM calls per step in the worst case. Typical case is 1 to 2 rounds: the LLM sees the index, requests the relevant files, produces a final answer.
Config sketch
See Add Persistent Memory tutorial for the full pattern.
- id: research
type: normal
fields:
- { name: Question, type: text, from: input.context }
- { name: FileIndex, type: slateRead, from: { slate: Knowledge, folder: docs, metatag: index } }
retrieve:
to: { slate: Knowledge, folder: docs }
as: RetrievedDocuments
maxRounds: 5
requestMatch:
type: object
required: [request]
properties:
request:
type: object
properties:
files: { type: array, items: { type: string } }
subfolders: { type: array, items: { type: string } }
metatag:
type: object
properties:
name: { type: string }
contains: { type: string }
glob: { type: string }The LLM is the retriever. It sees the index, reasons about what to fetch, emits a structured request, and the engine injects the requested content. This is interpretable (the retrieval reasoning is in the trace) and composes with structured metatags for deterministic queries.