Prompt transforms (retrievers)
Prompt transforms reshape the retriever search string after the retriever's own query: template is expanded (if any) and before retrieve() runs. They use your profile’s LLM with built-in instructions, so you usually do not write a custom system prompt.
Use them when the composed user message is too chatty for keyword/CQL/JQL backends, too specific (pod IDs, timestamps) for good recall, or when you want multiple query variants (multi-query / “rephrase”) before hitting web or vector search.
Full flow:
sources → compose user message → expand retriever query: (optional) → prompt_transform (optional) → retrieve() → enrich → agent
See also Retrievers for built-in providers (web_search, confluence_search, jira_search, slack_search) and custom retriever providers.
Quick start
Optional YAML keys on each standalone retrievers/*.yaml file (see Retrievers):
prompt_transform: a strategy name (llm_rewrite) or a list of at most two strategies ([step_back, multi_query]).prompt_transform_config: optional dict (defaults below). Keys include:prompts— a map of{ <strategy_name>: template }to override the built-in instruction for specific steps.model_id,temperature— model selection for transforms (profile still drives the main agent).num_variants,include_original—multi_query-specific controls.
# retrievers/web_context.yaml
name: web_context
type: web_search
prompt_transform: llm_rewrite
config:
max_results: 5
Save this as agents/investigator.md:
---
description: Investigates a support ticket
retrievers: [web_context]
---
Investigate the ticket, using web search for anything you don't already know.
Confluence / Jira (same atlassian credentials; use llm_rewrite so CQL/JQL text search gets keywords, not chatty task prose):
# retrievers/wiki.yaml
name: wiki
type: confluence_search
credentials: atlassian
prompt_transform: llm_rewrite
config:
max_results: 5
# retrievers/tickets.yaml
name: tickets
type: jira_search
credentials: atlassian
prompt_transform: [llm_rewrite, multi_query]
prompt_transform_config:
num_variants: 2
include_original: false
config:
max_results: 10
No prompt_transform → the resolved string is passed straight to retrieve().
Strategies
llm_rewrite
What: Turns the composed message into a short, search-oriented string (drops filler).
When: Default choice for Jira/Confluence-style text search, SQL-ish keywords, or any backend that prefers focused queries.
When not: Pure web search often works without it; DuckDuckGo tolerates natural language.
Config: prompts.llm_rewrite (optional) must include {query} if you override. num_variants / include_original are ignored for this strategy.
multi_query
What: Asks the LLM for N alternative search lines; the retriever runs once per distinct query; results are concatenated (duplicate payloads deduped).
When: You want higher recall (several phrasings of the same intent).
Config:
| Key | Default | Description |
|---|---|---|
num_variants |
3 |
How many lines to ask the model for |
include_original |
true |
Also run retrieval with the pre-transform string |
prompts.multi_query |
built-in | Must include {query} and {num_variants} if overridden |
hyde
What: Hypothetical document: the model writes a short passage as if from a reference doc answering the question; that text is what gets searched.
When: Vector / semantic retrieval where question embeddings misalign with document text.
When not: Keyword-only APIs unless you experiment.
step_back
What: Replaces a narrow question with a broader one (strips IDs, dates, codes where possible).
When: Incident / troubleshooting tasks (“why did pod xyz crash at 3am?” → general failure domain).
When not: Already broad questions (adds little).
Confluence, Jira, and similar backends
abt ships built-in web_search, confluence_search, jira_search, and slack_search retrievers (see Retrievers); Confluence and Jira appear here as the common pattern for any retriever whose retrieve() call turns a single string into an API request—e.g. Confluence CQL or REST “text search”, Jira JQL, or a SQL WHERE fragment. The same prompt-transform rules apply: you are shaping that string so the remote system returns useful hits.
What these systems dislike
- Long, conversational task prose (“Can you check if anyone documented…”) passed straight through as the search query.
- Incident-style text full of IDs, timestamps, and hostnames when the index is organized by product area or runbook title, not by that pod name.
- A single phrasing when your wording does not match how pages or tickets were written.
Which transform to use
| Situation | Good first choice | Why |
|---|---|---|
| Chatty agent prompt + Confluence / wiki / doc search | llm_rewrite |
Produces short, keyword-oriented text that matches how people title pages and how CQL/text search tends to work. |
| Chatty task + Jira (JQL or text search) | llm_rewrite |
Pulls out project/issue-type/status-like tokens and intent without the narrative wrapper. |
| Want higher recall (different keyword phrasings) | [llm_rewrite, multi_query] |
llm_rewrite compresses to keywords first, then multi_query fans out keyword variants. Sending multi_query variants without llm_rewrite still produces sentence-form queries — not useful for keyword backends. |
| Custom retriever uses embeddings over Confluence/Jira exports | hyde (or [hyde, multi_query]) |
HyDE helps when the indexed chunks read like documentation, not like user questions. |
query: template already emits a tight JQL/CQL string |
(none), or llm_rewrite only if {{ task() }} / inputs still add noise |
Transforms run after query: expansion—skip them if the string is already structured. |
Why not
step_backalone for Jira/Confluence?step_backturns a specific question into a broader question — still a sentence.jira_searchandconfluence_searchpass the query directly to JQL/CQLtext ~search, which needs keywords.llm_rewritecompresses the task into keywords;step_backdoes not.[step_back, llm_rewrite]as a chain is fine, though —llm_rewriteruns last and re-compresses whateverstep_backproduced back into keywords; it'sstep_backused alone (or last in the chain) that's the mismatch.
Rule of thumb: For keyword / CQL / JQL backends, always start with llm_rewrite. Add multi_query for higher recall. Reserve step_back for sentence-tolerant backends (e.g. semantic search, vector retrieval). Reserve hyde for embedding-based retrieval.
Examples
Both confluence_search and jira_search share a single atlassian credentials namespace — one block in profiles.yaml covers both:
# profiles.yaml
default:
target: dev
outputs:
dev:
credentials:
atlassian:
url: https://your-org.atlassian.net
username: your@email.com
api_token: "{{ env_var('ATLASSIAN_API_TOKEN') }}"
Confluence — general knowledge search (llm_rewrite compresses conversational task text into a CQL-friendly keyword query):
# retrievers/confluence_docs.yaml
name: confluence_docs
type: confluence_search
credentials: atlassian
prompt_transform: llm_rewrite
config:
max_results: 5
spaces: "ENG,OPS" # optional: restrict to specific spaces
Jira — find related issues (llm_rewrite strips narrative and surfaces intent tokens for JQL text search):
# retrievers/jira_issues.yaml
name: jira_issues
type: jira_search
credentials: atlassian
prompt_transform: llm_rewrite
config:
max_results: 10
projects: "ENG,PLAT" # optional: restrict to specific projects
Incident triage — keyword compression then fan out (llm_rewrite extracts search-ready keywords from the noisy task; multi_query then generates keyword variants to broaden recall):
# retrievers/confluence_runbooks.yaml
name: confluence_runbooks
type: confluence_search
credentials: atlassian
prompt_transform: [llm_rewrite, multi_query]
prompt_transform_config:
num_variants: 3
include_original: false # skip the raw verbose task sentence
config:
max_results: 5
Combined (both backends referenced by the same agent — the same prompt is transformed independently per retriever):
Save this as agents/investigator.md:
---
description: Investigates a support ticket
retrievers: [confluence_docs, jira_issues]
---
Investigate the ticket, using the wiki pages and issues you are given.
If you combine a structured query: (e.g. JQL built from {{ source('ticket') }}) with a noisy {{ task() }} stub, remember transforms see the fully expanded retriever string — design query: to preserve important structure, then let llm_rewrite trim only what comes from the task.
Chaining
prompt_transform may be a list of one or two strategies, applied left to right. The output of each step is a list of strings; the next step runs on that list (1:1 strategies map per item; multi_query flattens variants).
Valid examples:
[step_back, multi_query]— broaden, then diversify (for semantic/vector backends; NOT for keyword backends like Jira/Confluence).[llm_rewrite, multi_query]— clean up, then diversify.[hyde, multi_query]— hypothetical doc, then variants.
Compile-time rules (fail fast at abt compile):
- At most two steps.
- No duplicate strategy names in the chain.
multi_querymust be last if present — otherwise later steps would run once per variant (many extra LLM calls). The error text suggests swapping order (e.g. use[step_back, multi_query]not[multi_query, step_back]).
Decision guide (text)
Vector / embedding retriever?
yes → try hyde, or [hyde, multi_query] for broader recall
no →
Confluence / Jira / CQL / JQL / SQL-like string search?
yes → start with llm_rewrite (see table above)
Very specific query (IDs, timestamps, error codes)?
yes (keyword backend) → llm_rewrite, or [llm_rewrite, multi_query]
yes (semantic/vector backend) → step_back, or [step_back, multi_query]
no →
Want multiple phrasings?
yes → multi_query
no → llm_rewrite
Customising instructions (prompt overrides)
Each strategy ships with a built-in instruction template. Override any step via the prompts dict in prompt_transform_config. The key is the strategy name; the value is your template. Use {query} as the input placeholder (and also {num_variants} for multi_query).
Single strategy
prompt_transform: llm_rewrite
prompt_transform_config:
prompts:
llm_rewrite: |
Extract Jira-style keywords (project keys, issue types, status words) from the
following task. Return only the keywords, space-separated.
Task: {query}
Two chained strategies — per-step overrides
prompt_transform: [llm_rewrite, multi_query]
prompt_transform_config:
num_variants: 2
include_original: false
prompts:
llm_rewrite: |
Extract 3-5 keywords that capture the core topic of the following task.
Return only the keywords, comma-separated.
Task: {query}
multi_query: |
Generate {num_variants} different Confluence CQL search queries for: {query}
Return one query per line.
You can override only the steps you care about; omitted steps fall back to their built-in instruction:
prompt_transform: [step_back, multi_query]
prompt_transform_config:
num_variants: 3
include_original: true
prompts:
step_back: "Generalise the following incident to its failure category: {query}"
# multi_query uses its built-in instruction
Advanced
prompt_transform_config.model_id— use a smaller/cheaper model for transforms only (profile still drives the main agent).prompt_transform_config.temperature— passed tocreate_modelfor that transform model when set; otherwise inherits the profile temperature if configured.- Interaction with
query:— the static template is expanded first; transforms run on that string.
Dry-run
abt run -s <agent> -p "..." --dry-run does not call the LLM or any retriever, so prompt transforms never run and the plan does not list them. Use abt list --agent <agent> to see which retrievers an agent uses; the prompt_transform: itself lives in each retriever's file.