Skip to content

Instantly share code, notes, and snippets.

@bhagyeshsp
Created April 1, 2026 10:34
Show Gist options
  • Select an option

  • Save bhagyeshsp/b2728f41ef96d14fff76f52607aca684 to your computer and use it in GitHub Desktop.

Select an option

Save bhagyeshsp/b2728f41ef96d14fff76f52607aca684 to your computer and use it in GitHub Desktop.
Universal prompt distillation prompts

Two prompts for distillation

First: carry out the distillation

You are a Context Distillation Engineer. Compress the file below by 60–80% for LLM injection while preserving 100% behavioral and factual fidelity.

KEEP (compressed):
- Domain facts the model cannot infer from training
- Behavioral rules, safety constraints, procedures
- Unique examples, relationships, edge cases
- All non-string data (numbers, IDs, structured values)

CUT:
- Prose scaffolding ("This section explains…", "It is important to note…")
- Introductions, transitions, summaries, repetition
- Any content fully reconstructable from a label + context

COMPRESSION RULES:
- One-liner facts: `core: essence + key constraint`
- Flags: `!always:` / `!caution:` / `!note:` for behavioral/safety rules
- Lists: pipe-delimited on one line → `prompts: q1?|q2?|q3?`
- Field labels: short and consistent (`kw:`, `ctx:`, `rules:`, `role:`)
- Repeated structures: define schema once at top, apply uniformly across all entries
- Data tables or repeated objects: convert to TOON (key: value, one per line, no brackets or quotes unless needed)
- Define reusable styles/templates once at top (`StyleX: friendly|concise|no-jargon`), then reference inline (`use:StyleX`)
- Use XML section tags for major blocks if the file has distinct sections

DO NOT compress:
- First-use role/system blocks (keep minimal prose for behavioral grounding)
- Safety-critical distinctions that require exact wording
- Programmatic/structured data that must stay machine-readable

Before outputting, do a quick self-audit per section: structural (keep), behavioral (keep + flag), decorative (cut), duplicate (cut all but one).

Output ONLY the compressed file in its original format. No commentary.

FILE:
[PASTE HERE]

Second: validate the compression

Compare the two context versions below for the given task. Identify any behavioral or factual differences in how an LLM would respond using each. Flag only what materially changes output — ignore style differences.

TASK: [describe what the LLM using this context needs to do]

ORIGINAL:
[paste]

COMPRESSED:
[paste]

Output:
1. Fidelity verdict (pass / partial / fail)
2. Any lost nuance (quote it)
3. Minimal fix if needed (one line per issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment