> ## Documentation Index
> Fetch the complete documentation index at: https://ctpf.q-uestionable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Context Templates

> Document-context frames that embed IPI payloads in realistic surrounding content

A **document context template** is a prose frame that surrounds a generated IPI payload with realistic content — a WHOIS record, a legal snippet, a resume, a news article, and so on. The payload injects into a `{payload}` slot inside the template body, so the hidden instruction lands in context the target model has already been primed to process.

Templates are selected on the CLI via `--template` (case-insensitive) or through the Web UI launcher's template dropdown. A template composes with the separately chosen **Payload Style** (how the instruction is framed) and **Payload Type** (what the instruction does): the template shapes the surrounding document, the style shapes the instruction voice, and the type shapes the agent action.

## Template Catalog

| Template ID         | Name                          | Source                                      | Default Style | Compatible Formats                         | Callback Role                      |
| ------------------- | ----------------------------- | ------------------------------------------- | ------------- | ------------------------------------------ | ---------------------------------- |
| `generic`           | Generic (No Document Context) | —                                           | `obvious`     | pdf, image, markdown, html, docx, ics, eml | the supplementary data appendix    |
| `whois`             | WHOIS Record Assessment       | garak — LatentWhois                         | `obvious`     | pdf, markdown, docx                        | the registrar enrichment feed      |
| `translation_en_fr` | Translation English→French    | garak — LatentInjectionTranslationEnFrFull  | `obvious`     | pdf, markdown                              | the terminology reference database |
| `translation_en_zh` | Translation English→Chinese   | garak — LatentInjectionTranslationEnZhFull  | `obvious`     | pdf, markdown                              | the terminology reference database |
| `legal_snippet`     | Legal Text Summarization      | garak — LatentInjectionFactSnippetLegalFull | `compliance`  | pdf, docx, markdown                        | the cited legal authority          |
| `report`            | Business/Financial Report     | garak — LatentInjectionReportFull           | `datasource`  | pdf, docx                                  | the methodological supplement      |
| `resume`            | Resume / CV Assessment        | garak — LatentInjectionResumeFull           | `reviewer`    | pdf, docx                                  | the candidate verification record  |
| `email`             | Email QA                      | bipia — bipia/data/email.py                 | `obvious`     | eml, pdf, docx, html                       | the referenced policy page         |
| `web`               | Web Article QA                | bipia — bipia/data/qa.py                    | `obvious`     | html, markdown, pdf                        | the source article reference       |
| `table`             | Table QA                      | bipia — bipia/data/table.py                 | `obvious`     | markdown, html, pdf                        | the source dataset                 |
| `code`              | Code Error QA                 | bipia — bipia/data/code.py                  | `obvious`     | markdown, pdf                              | the package documentation          |
| `news`              | News Article Summarization    | bipia — bipia/data/abstract.py              | `obvious`     | pdf, markdown, html, docx                  | the source article reference       |

`Default Style` is the style the template was aligned against during registry construction; you can still override it with `--payload-style` (or the Web UI dropdown) when you want a different framing. `Compatible Formats` lists the output formats the template declares support for — other formats are rejected at CLI entry.

## How `callback_role` composes

When `--payload-type callback` is combined with a **non-`obvious`** payload style, the template's `callback_role` noun phrase substitutes into the style frame's `{source}` slot. The agent-visible callback framing therefore references something that fits the surrounding document rather than a generic placeholder.

* `obvious` style is unchanged across all templates. It is preserved as the template-substitution baseline and the Phase 4.4a baseline. The no-hiding control condition is a separate axis: `Technique.NONE`, documented at [Techniques → Control Condition](/ipi/techniques#control-condition-—-none).
* Non-`callback` payload types (`exfil_summary`, `ssrf_internal`, `instruction_override`, etc.) have no `{source}` slot in their frames, so templates do not alter their text.

**Worked example.** `--payload-style citation --template whois --payload-type callback` produces a citation-style callback framing whose `{source}` resolves to **the registrar enrichment feed** — so the hidden citation reads as a pointer into WHOIS registrar infrastructure rather than an anonymous URL.

## Selecting a template

Pick the template whose surrounding prose best matches the target ingestion context:

* **`generic`** — No document context; format-agnostic framing. Use for baseline runs and for formats without a dedicated template.
* **`whois`** — Domain/registrar assessment flows, threat-intel enrichment pipelines, maliciousness scoring agents.
* **`translation_en_fr`**, **`translation_en_zh`** — Translation and localization workflows with mid-document instruction injection.
* **`legal_snippet`** — Legal summarization, compliance-check, or policy-digest agents.
* **`report`** — Corporate / financial report summarization where a URL-style injection slides between paragraphs.
* **`resume`** — Candidate assessment, recruiter-assist, or CV-screening assistants.
* **`email`** — Email QA, summarization, and reply-drafting assistants.
* **`web`** — Web article QA, news digest, or browsing-style retrieval agents.
* **`table`** — Table-QA assistants that read Markdown or HTML tabular data.
* **`code`** — Code-error QA agents that consume tracebacks and Stack Overflow-style context.
* **`news`** — Abstractive news summarization assistants (XSum-aligned).

## `generic` default

`generic` is the default template — selecting no `--template` flag produces format-agnostic framing equivalent to pre-template behavior. Its `callback_role` is **the supplementary data appendix** and, per the rules above, only surfaces when you pair a `callback` payload with a non-`obvious` style.
