DR Context Pipeline v1 (retrieval + compression + lint)
Use this skill to standardize how an agent loads memory into its prompt for correctness.
Prerequisites
- A file-based memory layout that includes
memory/always_on.md(policy header + topic catalog) and topic files undermemory/topics/. - Recommended: install dr-memory-foundation (or implement an equivalent structure).
Operating procedure (default)
- Load the always-on policy + topic catalog (your
memory/always_on.md). - Route the message deterministically (task type + caps) using
references/router.yml. - Retrieve top relevant snippets from your memory store; emit a Retrieval Bundle JSON (see schema).
- Compress Retrieval Bundle → Context Pack JSON using
references/compressor_prompt.txt.- IMPORTANT: Context Pack
sourcesMUST be snippet IDs only (S1,S2, …).
- IMPORTANT: Context Pack
- Lint the Context Pack. If lint fails, skip compression and fall back to raw retrieved snippets.
- Call the main reasoning model with: always-on policy header + Context Pack (+ raw snippets for high-stakes tasks) + user message.
What to read / use
- Router + caps:
references/router.yml - Compressor prompt:
references/compressor_prompt.txt - Retrieval Bundle schema:
references/schemas/retrieval_bundle.schema.json - Context Pack schema:
references/schemas/context_pack.schema.json - Golden tests starter suite:
references/tests/golden.json
Notes
- Keep “always-on policy header” tiny (invariants only). Put everything else behind retrieval.
- If you need deterministic snippet IDs, follow the stable ordering guidance in
references/deterministic_ids.md.