What problem does it solve?
This skill solves the critical issue of broken LLM caching and cross-tenant data leakage that occurs when turn-local retrieved content (such as session memory, artifacts, and temporal facts) is mixed directly into the system prompt. This practice invalidates cacheable prefixes on every turn, wastes token budget, and exposes private tenant data to shared cache scopes.
Core Features & Use Cases
- Synthetic Preface Pattern: Keeps turn-local retrieved content out of the system prompt by wrapping it in a synthetic first user message, preserving cache efficiency and data isolation.
- Safe Rendering Helper: Includes the composePreface utility that automatically escapes malicious closing envelope tags in retrieved content to prevent injection attacks that would break out of the retrieved content wrapper.
- Production Use Cases: Used by Friday's chat supervisor and FSM type: llm actions to assemble per-turn LLM inputs, with built-in support for future on-demand mid-turn retrieval tools like web fetch and artifact parsing.
Quick Start
Import the composePreface helper from the @atlas/core/agent-context/compose-preface module, pass your list of preface entry records containing your retrieved content to it, and prepend the returned preface string as a synthetic user message to the start of your LLM prompt.