JJoeven

Reference/Agent patterns

Memory, traces, and scratchpads

Transcript vs side trace vs long-term memory. What to store, hash, and drop.

Three stores.

StoreLifetimeGoes to the model?
Transcriptthis runyes (trimmed)
Side tracethis runno (logs, billing)
Long-term memoryacross runsonly via retrieval

Transcript

List of events: user, assistant/tool, system parse errors. This is short-term memory.

Side trace

Hashes of files, token counts, approval digests, raw HTTP (redacted). Bigger than the prompt. Required for evals.

Long-term

If you "remember the user likes Oslo", write a note and retrieve it. Do not grow a system prompt of lore. Use the RAG project.

Scratchpad

A notes string the model may rewrite each turn. Cap length. It is still untrusted text.

Hashes

sha256(content)[:12] in traces instead of full source. Compare round 1 vs round 2 without logging secrets.

Drop first

Duplicate observations, thoughts, old 429s. Keep the goal, last errors, last successful tool result.

Tip:If you cannot replay a run from the side trace, you cannot improve a run.