Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

Templating style as an authoring decision — retire prompting_target (#1104)

Louis Choquel60aa77f5826f
diff --git a/.claude/skills/add-model/SKILL.md b/.claude/skills/add-model/SKILL.md
index d6b05d8fe..633a11e5c 100644
--- a/.claude/skills/add-model/SKILL.md
+++ b/.claude/skills/add-model/SKILL.md
@@ -86,13 +86,18 @@ When adding a model to multiple backends, be aware of these differences:
`gpt-5.4-2026-03-01`). SDK is `azure_openai_responses`. Inputs typically use
`images` but not `pdf`. Image gen models use `azure_rest_img_gen` SDK and need
a `.rules` sub-table.
-- **Anthropic direct**: SDK is `anthropic`. Uses `prompting_target = "anthropic"`,
+- **Anthropic direct**: SDK is `anthropic`. Uses
`structure_method = "instructor/anthropic_tools"`. Often has `max_tokens` and
`max_prompt_images`.
-- **Bedrock**: SDK is `bedrock_converse`. Has its own `prompting_target`.
-- **Google direct**: SDK is `google`. Uses `prompting_target = "gemini"`,
+- **Bedrock**: SDK is `bedrock_converse`.
+- **Google direct**: SDK is `google`. Uses
`structure_method = "instructor/genai_tools"`.
+A model spec never declares how its prompts are formatted: templating style is an
+authoring decision on the pipe (`templating_style` on `PipeLLM`) with a single
+runtime default. Any key you write that the model-spec blueprint does not know is
+sent to the provider as an outbound HTTP header — so do not invent fields.
+
Each backend TOML has a `[defaults]` section — the model entry only needs to
specify fields that differ from those defaults. Read the defaults before writing
the entry so you include the minimum necessary fields.
diff --git a/.claude/skills/drift-review/SKILL.md b/.claude/skills/drift-review/SKILL.md
index 54b2224c9..9244f8526 100644
--- a/.claude/skills/drift-review/SKILL.md
+++ b/.claude/skills/drift-review/SKILL.md
@@ -35,7 +35,9 @@ Work from the trigger diff to the review targets:
- For each added/modified/removed trigger file, identify what a reader of the review targets could observe changing: new, renamed, or removed options, settings, defaults, commands, behaviors. Use `git diff` on the trigger files; the previous ack's rationale tells you what the last review already covered, so focus on what changed since.
- Grep the review targets for the changed names, settings, and symbols — then read the surrounding prose. A mention can be present but stale (wrong default, wrong behavior, incomplete), not just missing.
-- Fix what's stale, following the repo's doc rules: docs describe current reality, no hardcoded counts, MkDocs conventions (blank line before lists).
+- **Grep finds wrong mentions; it cannot find missing ones.** A claim that quantifies — *every*, *all*, *only*, *the sole exception*, *none*, or any count — is a claim about a **set**, and it rots by omission: the symbol that falsified it appears nowhere in the sentence that is now false, so searching the target for what changed will never surface it. Read the targets for their quantified claims and re-derive each set from the code. (Same root as the no-hardcoded-counts rule — "the three helpers" and "the sole exception" go stale identically.)
+- **Verify each claim against the artifact it is about, never against another document.** A claim about a test is checked by reading what the test *executes* — its calls, its parametrize lists — not its docstring; a claim about a module, by enumerating the module. A docstring, a sibling doc, or the previous ack is not evidence: prose drifts from the same edit that missed it, so two documents agreeing is agreement, not verification.
+- Fix what's stale, following the repo's doc rules: docs describe current reality, no hardcoded counts, MkDocs conventions (blank line before lists). When the fix is to a quantified claim, prefer converting the construct over correcting the value — name the class ("the deck-reading helpers") rather than restating a count that will rot again.
- "Nothing to update" is a legitimate verdict — but only after you actually opened and read the review targets. If you didn't open them, you haven't reviewed.
### 3. Stage, then ack
@@ -51,6 +53,7 @@ As an agent, always pass `BY` with your **own actual identity** — the model yo
**The rationale is the on-the-record review decision.** It must say what was reviewed and what the verdict was:
- Bad: `"docs fine"`, `"reviewed"`, `"re-ack after refactor"`
+- Bad: `"the page's claim still matches the test's stated exception"` — that is two documents agreeing. Name what you re-derived from the code, so a weak method is visible at write time rather than in the next merge.
- Good: `"Documented the new activity_queues setting in general-config.md; other config pages unaffected."`
- Good: `"CLI change is internal plumbing (renamed a private helper); no user-visible surface moved; cli docs and agent-CLI contract doc verified unchanged."`
diff --git a/.drift/acks/config-docs.toml b/.drift/acks/config-docs.toml
index 5ecd26500..21909e6af 100644
--- a/.drift/acks/config-docs.toml
+++ b/.drift/acks/config-docs.toml
@@ -1,19 +1,19 @@
contract = "config-docs"
-digest = "sha256:6559e8b12f68cc9b7edbb82cfcb78191add1fa8a555e58552a731d40da7ce4a1"
+digest = "sha256:f3a7f92e378ea8f12e9ff11e91b6f0f1e377f1d6a9f218f2e6de4d4668cb3d36"
reviewed_by = "Louis Choquel"
-reviewed_at = "2026-07-30T06:58:11Z"
-rationale = "Trigger is a docstring-only correction in config_loader.load_config: the config_dir Args entry still said 'project/global layering is bypassed and only this directory is read', which contradicts the same docstring's own summary six lines above and the body at line 313, where list_of_configs is seeded unconditionally with the package pipelex.toml. It is the exact wording this branch already corrected one file over in RuntimeHub.setup_config, and the sibling was missed. No config field, default, validator, TOML key, section name or loading behaviour changed — only prose. Reviewed docs/configuration/ against it: grepped every page for config_dir, 'only this directory', layering and --global. config_dir is not a user-facing concept and appears nowhere; the one layering hit (config-practical/telemetry-config.md:39) is about global-vs-project TOML precedence and is unaffected and correct. configuration/index.md:64-71 documents the default loading sequence and its step 1 ('Base configuration from the installed Pipelex package') is precisely the package-defaults-always-apply fact the corrected docstring now states, so the page already agreed with the truth the docstring was contradicting. Nothing to update."
+reviewed_at = "2026-08-14T09:24:56Z"
+rationale = "Trigger is Phase 1 of the templating-style plan: PromptingConfig became TemplatingConfig with a single default_templating_style field, mounted as pipelex.templating_config, and the per-target prompting_styles map was deleted from pipelex.toml. Reviewed docs/configuration/: no page documents the prompting_config section or the style map, so nothing there went stale. The one prompting_target hit (inference-backend-config.md default_prompting_target example) still matches the shipped backend TOMLs, which Phase 3 deletes. The user-facing styling page that does document the old config lives under docs/building-methods/ and is replaced in Phase 4. No configuration doc change needed."
[trigger_files]
-"pipelex/cogt/config_cogt.py" = "blob:3c10f6a2b809e38b9a1112ce24ffb8ea4c32b04b"
+"pipelex/cogt/config_cogt.py" = "blob:ee1ee2d0c1474dcef5e07690268de37ae3ff0987"
"pipelex/cogt/img_gen/img_gen_job_components.py" = "blob:084985080413fd8d6c3b1b9b0747020cb0161858"
-"pipelex/pipelex.toml" = "blob:e646e431b5db2e467bc962b738be7bc9f3b3ffb8"
+"pipelex/pipelex.toml" = "blob:abaf4f65f3096a4625dad8c6887431e952cc4734"
"pipelex/system/configuration/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"
"pipelex/system/configuration/config_check.py" = "blob:efa78599c08e5e003d975cc54978ea5d267214a0"
"pipelex/system/configuration/config_loader.py" = "blob:29fb321ef003c0fd725c87f560a791e8573b82f5"
"pipelex/system/configuration/config_model.py" = "blob:83b29dc6e93393c9b98c4353636caf0135c80339"
"pipelex/system/configuration/config_root.py" = "blob:c7d43851270912d17413cfc6a511247d3c7cc160"
-"pipelex/system/configuration/configs.py" = "blob:99c936343aab7bcd4dee78631164ef10a32ebfe9"
+"pipelex/system/configuration/configs.py" = "blob:90b3186c53b431e0c50b73a533685be92ccd94b0"
"pipelex/system/configuration/pipe_func_config.py" = "blob:df1cbd3698d51c96d8fa8a8c6fdf1c6be57e5771"
"pipelex/system/telemetry/telemetry_config.py" = "blob:b6912e8be8932b65213dab23ac66372b8b45ca58"
"pipelex/tools/aws/aws_config.py" = "blob:c1aeafeae08d3921464db33795f11a29ff3892ba"
diff --git a/.drift/acks/pipelex-kernel-docs.toml b/.drift/acks/pipelex-kernel-docs.toml
index 0e1328a1b..9813ea9be 100644
--- a/.drift/acks/pipelex-kernel-docs.toml
+++ b/.drift/acks/pipelex-kernel-docs.toml
@@ -1,12 +1,12 @@
contract = "pipelex-kernel-docs"
-digest = "sha256:b3bee1e27d8ffdbf02ce9a7323c43cce190e1a68368fd56833201eabc48edfae"
-reviewed_by = "Claude (Opus 5, 1M context)"
-reviewed_at = "2026-08-14T12:33:25Z"
-rationale = "Reopened with ZERO trigger-file changes: every blob in pipelex/kernel and test_kernel_boot_contract.py is byte-identical to the previous ack, so no kernel surface moved since Louis reviewed it; the contract definition digest is what shifted, across the dev merge. Reviewed docs/under-the-hood/pipelex-kernel.md anyway, both halves the contract names. Module table: diffed it against every public function AST-parsed out of pipelex/kernel/*.py and it is complete, concrete_llm_model_handle included; kernel.exceptions is absent from the table correctly, since it defines error classes and no entry point. Gates table: its claim that the boot-contract test covers every entry point except the three resolve_*_setting helpers, which read the deck, still matches that test's own stated exception. Nothing stale, no doc change needed."
+digest = "sha256:886b9c7bd23bc22fe9ecda51a962df1876b6fd221dc3f35c7fb53433d394ee78"
+reviewed_by = "Louis Choquel"
+reviewed_at = "2026-08-14T13:30:46Z"
+rationale = "Merge of dev into fix/Keyless-dry-run. The one trigger change is llm_ops.py taking on concrete_llm_model_handle from the per-node usage work, resolved against this branch having already deleted derive_templating_style; the conflict resolution kept both facts. Reviewed the page and found one real staleness, which dev's own ack had passed over: the Gates row claimed the boot-contract test runs every kernel entry point except the resolve_*_setting helpers, but concrete_llm_model_handle reads the deck too and has no arm in that test, so the stated sole exception was wrong the moment the function landed. Fixed the row to name the deck-reading helpers as a class rather than a count, and fixed the test docstring that row derives from, so the two agree. The module table now lists concrete_llm_model_handle and templating_style_ops with resolve_templating_style, checked against every public function in pipelex/kernel/. Nothing else on the page moved."
[trigger_files]
"pipelex/kernel/__init__.py" = "blob:c4f1b0fe2ccc17db9110733f71b612f4ac1ba4ce"
-"pipelex/kernel/compose_ops.py" = "blob:c824b8cc7e8dd7c3c98b797e326c2709c6ff1cb3"
+"pipelex/kernel/compose_ops.py" = "blob:d89a27422da1ec41685a93fc7e3e4ab53d2f72bc"
"pipelex/kernel/compose_results.py" = "blob:a837ae9680c7d4d0eb4dee37d4657c410e5b5cea"
"pipelex/kernel/exceptions.py" = "blob:45e9ad60c2699f7b57cad0a46c13f0b07b4cfbc9"
"pipelex/kernel/extract_ops.py" = "blob:cd596c03e45ab57eccca6fe1bf332e5977d1f2b2"
@@ -14,14 +14,15 @@ rationale = "Reopened with ZERO trigger-file changes: every blob in pipelex/kern
"pipelex/kernel/func_ops.py" = "blob:97c68c977ddc260c9b36b7eda5f4c7964e956a27"
"pipelex/kernel/func_results.py" = "blob:a7425a0ddc21571f23c53b92f5d7559ffdd08b71"
"pipelex/kernel/img_gen_ops.py" = "blob:b22869bee7dfbb624e3c406a0631969fc8695b7c"
-"pipelex/kernel/img_gen_prompt.py" = "blob:90c33eae95298aa76d036f256ffc7d6523249166"
+"pipelex/kernel/img_gen_prompt.py" = "blob:e4f72040561929aa0d96ad5f00b1c4af652d3f77"
"pipelex/kernel/img_gen_results.py" = "blob:46b4ca11c70d906ae6d58ce66461f9b3414f1bfa"
-"pipelex/kernel/llm_ops.py" = "blob:02bec74888ae6a586ceabaf313277706ba2a2036"
-"pipelex/kernel/llm_prompt_content.py" = "blob:26dfce734de582320c0ea7b9a09b01f2d1ca8627"
+"pipelex/kernel/llm_ops.py" = "blob:ea67c4083d4fef0587964d6f22e90d4f47394aa7"
+"pipelex/kernel/llm_prompt_content.py" = "blob:82c34283dacd2bfd9a2c263915e744736d399875"
"pipelex/kernel/llm_results.py" = "blob:6e3b8a2878b5bb284ece5fac10262fb59ac2029d"
"pipelex/kernel/memory_ops.py" = "blob:f6a5745e804ac08f19c70f1beb1f78baf50d51cd"
-"pipelex/kernel/pipelex_kernel.py" = "blob:fde22aedea2ad8ca41e12a4f1a67e2189dc3fbce"
+"pipelex/kernel/pipelex_kernel.py" = "blob:3264150e92940c97346f1fb5dd9313eff8825d50"
"pipelex/kernel/prompt_references.py" = "blob:03ec9ef67ae84f141d072ca2d2c3ef888549ccc0"
-"pipelex/kernel/search_ops.py" = "blob:01be4bef28f98342678cba16ac8c4b21fadcaae1"
+"pipelex/kernel/search_ops.py" = "blob:ed0a8c7953aca1e38de852d0ddef11731b819539"
"pipelex/kernel/search_results.py" = "blob:101b70dc96cc5ee1721c9f6b1cb725a5ca78ff70"
-"tests/unit/pipelex/kernel/test_kernel_boot_contract.py" = "blob:54910cb0569792d8ed654f183f0c2733abb1e88e"
+"pipelex/kernel/templating_style_ops.py" = "blob:9995afde9e1943d325fcaf85182d598ab944cff6"
+"tests/unit/pipelex/kernel/test_kernel_boot_contract.py" = "blob:2cbcb3924b1291d741133f8b1e9538622d06a721"
diff --git a/.pipelex/inference/backends/anthropic.toml b/.pipelex/inference/backends/anthropic.toml
index 41ec5e603..1e00088a1 100644
--- a/.pipelex/inference/backends/anthropic.toml
+++ b/.pipelex/inference/backends/anthropic.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "anthropic"
-prompting_target = "anthropic"
structure_method = "instructor/anthropic_tools"
thinking_mode = "manual"
diff --git a/.pipelex/inference/backends/azure_openai.toml b/.pipelex/inference/backends/azure_openai.toml
index 8e67a88c0..5258545b0 100644
--- a/.pipelex/inference/backends/azure_openai.toml
+++ b/.pipelex/inference/backends/azure_openai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "azure_openai_responses"
-prompting_target = "openai"
structure_method = "instructor/openai_responses_tools"
thinking_mode = "none"
diff --git a/.pipelex/inference/backends/bedrock.toml b/.pipelex/inference/backends/bedrock.toml
index a85d382b2..4a6ac6bf9 100644
--- a/.pipelex/inference/backends/bedrock.toml
+++ b/.pipelex/inference/backends/bedrock.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "bedrock_aioboto3"
-prompting_target = "anthropic"
thinking_mode = "none"
################################################################################
diff --git a/.pipelex/inference/backends/fal.toml b/.pipelex/inference/backends/fal.toml
index 2a4d03e12..d8dc03f68 100644
--- a/.pipelex/inference/backends/fal.toml
+++ b/.pipelex/inference/backends/fal.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "img_gen"
sdk = "fal"
-prompting_target = "fal"
thinking_mode = "none"
################################################################################
diff --git a/.pipelex/inference/backends/google.toml b/.pipelex/inference/backends/google.toml
index bfa5a5cc5..5c93038ac 100644
--- a/.pipelex/inference/backends/google.toml
+++ b/.pipelex/inference/backends/google.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "google"
-prompting_target = "gemini"
structure_method = "instructor/genai_tools"
thinking_mode = "manual"
diff --git a/.pipelex/inference/backends/minimax.toml b/.pipelex/inference/backends/minimax.toml
index 583380254..2f4998a8a 100644
--- a/.pipelex/inference/backends/minimax.toml
+++ b/.pipelex/inference/backends/minimax.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "anthropic"
-prompting_target = "anthropic"
structure_method = "instructor/anthropic_tools"
thinking_mode = "manual"
max_tokens = 16384
diff --git a/.pipelex/inference/backends/mistral.toml b/.pipelex/inference/backends/mistral.toml
index 1de55d3a5..f4866ac56 100644
--- a/.pipelex/inference/backends/mistral.toml
+++ b/.pipelex/inference/backends/mistral.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "mistral"
-prompting_target = "mistral"
structure_method = "instructor/mistral_tools"
thinking_mode = "none"
diff --git a/.pipelex/inference/backends/ollama.toml b/.pipelex/inference/backends/ollama.toml
index 3e020a84e..3828f43da 100644
--- a/.pipelex/inference/backends/ollama.toml
+++ b/.pipelex/inference/backends/ollama.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai"
-prompting_target = "anthropic"
structure_method = "instructor/openai_tools"
thinking_mode = "none"
diff --git a/.pipelex/inference/backends/openai.toml b/.pipelex/inference/backends/openai.toml
index b75142169..12684a75d 100644
--- a/.pipelex/inference/backends/openai.toml
+++ b/.pipelex/inference/backends/openai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai_responses"
-prompting_target = "openai"
structure_method = "instructor/openai_responses_tools"
thinking_mode = "none"
diff --git a/.pipelex/inference/backends/portkey.toml b/.pipelex/inference/backends/portkey.toml
index 796de3a90..e17965a09 100644
--- a/.pipelex/inference/backends/portkey.toml
+++ b/.pipelex/inference/backends/portkey.toml
@@ -23,7 +23,6 @@
model_type = "llm"
sdk = "portkey_completions"
structure_method = "instructor/openai_tools"
-prompting_target = "anthropic"
thinking_mode = "none"
################################################################################
@@ -265,7 +264,6 @@ outputs = ["text", "structured"]
max_prompt_images = 3000
costs = { input = 1.25, output = 10.0 }
thinking_mode = "manual"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-2.5-flash"]
@@ -274,7 +272,6 @@ inputs = ["text", "images", "pdf"]
outputs = ["text", "structured"]
costs = { input = 0.30, output = 2.50 }
thinking_mode = "manual"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-2.5-flash-lite"]
@@ -283,7 +280,6 @@ inputs = ["text", "images", "pdf"]
outputs = ["text", "structured"]
costs = { input = 0.10, output = 0.40 }
thinking_mode = "manual"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-3.1-pro"]
@@ -293,7 +289,6 @@ outputs = ["text", "structured"]
max_prompt_images = 3000
costs = { input = 2, output = 12.0 }
thinking_mode = "adaptive"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-3.0-flash"]
@@ -303,5 +298,4 @@ outputs = ["text", "structured"]
max_prompt_images = 3000
costs = { input = 0.5, output = 3.0 }
thinking_mode = "adaptive"
-prompting_target = "gemini"
x-portkey-provider = "@google"
diff --git a/.pipelex/inference/backends/vertexai.toml b/.pipelex/inference/backends/vertexai.toml
index fe89dc8ce..c65f76335 100644
--- a/.pipelex/inference/backends/vertexai.toml
+++ b/.pipelex/inference/backends/vertexai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai"
-prompting_target = "gemini"
structure_method = "instructor/vertexai_tools"
thinking_mode = "none"
diff --git a/.pipelex/inference/backends/xai.toml b/.pipelex/inference/backends/xai.toml
index a6348f202..402529979 100644
--- a/.pipelex/inference/backends/xai.toml
+++ b/.pipelex/inference/backends/xai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai"
-prompting_target = "anthropic"
structure_method = "instructor/openai_tools"
thinking_mode = "none"
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f766c3264..dd6afd7b0 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -10,10 +10,10 @@
},
"ruff.configuration": "--config=pyproject.toml",
"mypy.enabled": true,
- "mypy.runUsingActiveInterpreter": true,
+ "mypy.runUsingActiveInterpreter": true,
"search.exclude": {
".mypy_cache/*": true,
- "**/dev_context": true
+ "**/.test_durations": true
},
"files.exclude": {
"**/__pycache__": true,
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0541dd012..2c2b5f5d6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog
+## [Unreleased]
+
+### Changed
+
+- **Templating style is now an authoring decision (Breaking)**: How a pipe's inputs are tagged into a prompt is declared on the pipe — `templating_style` on `PipeLLM`, either a bare tag-style string (`"xml"`, `"ticks"`, `"square_brackets"`, `"no_tag"`) or a full `{ tag_style, text_format }` table — with a single runtime default for everything that declares nothing (`[pipelex.templating_config].default_templating_style`, shipped as `xml`). It is no longer derived from model metadata, so the same method renders the same prompt shape on every model. **Every prompt rendered for an OpenAI-family model changes shape, from back-tick fences to XML tags.** `PipelexKernel.llm_text` and `llm_object` take the same optional argument.
+- **Compose, image-generation, search and structuring prompts follow the same default (Breaking)**: These paths previously rendered style-less, which the Jinja2 filters silently absorbed as triple-backticks and plain text. They now resolve the same runtime default as the LLM path. Any template of yours that uses `| tag` — including `PipeCompose` templates and construct-mode template fields — changes shape accordingly, whichever model family you run on.
+- **Templating filters are strict**: The `tag`, `format` and `with_images` Jinja2 filters no longer fall back to a built-in style when the rendering context carries none; a missing tag style or text format raises `Jinja2ContextError`. Every prompt-rendering entry point now supplies a resolved style, so a missing one is a bug rather than a shape nobody chose. An explicit filter argument (`| format("markdown")`) is unaffected, and an unknown format name is now reported as a template error instead of a bare `ValueError`.
+- **Reasoning budgets are worker-owned**: The thinking-budget lookup is keyed by a family constant on the worker class rather than read from the model spec's `prompting_target`. Behavior is unchanged; the budget maps keep their `anthropic` and `gemini` keys.
+- **Remote inference config bumped to `pipelex_remote_config_12.json`**: The Pipelex Gateway model specs are fetched from a new versioned URL whose `defaults` no longer declare the removed field. Earlier releases stay pinned to `_11`, which is frozen. Unknown keys in the *remote* config's `defaults` are now pruned rather than rejected, so a gateway config written by a different release than the client reading it is version skew to tolerate; local backend files stay strict.
+
+### Removed
+
+- **`prompting_target` (Breaking)**: Gone from `LLMSetting`, `InferenceModelSpec`, `InferenceModelSpecBlueprint` and every backend TOML, along with the `PromptingTarget` enum and the per-target style map (`[pipelex.prompting_config]` and its `prompting_styles` sub-table, replaced by `[pipelex.templating_config]`). **Migration:** delete every `prompting_target` line from your own `.pipelex/inference/backends/*.toml` — backend files are read strictly, so a surviving one fails the boot. Check `portkey.toml` in particular: the key appears in `[defaults]` *and* on individual model entries, and an unknown per-model key is sent to the provider as an HTTP header rather than rejected.
+- **`LLMPromptTemplate` and friends**: Removed the unused prompt-template module along with `LLMPromptFactoryAbstract`, `LLMPromptTemplateInputs` and `LLMPromptTemplateInputsError`. Their hardcoded XML+Markdown style predated the configurable one and had no production consumer.
+
## [v0.45.0] - 2026-08-14
### Added
diff --git a/docs/building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md b/docs/building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md
deleted file mode 100644
index 03aaa1199..000000000
--- a/docs/building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-title: "LLM Prompting Style Configuration"
-description: "Adapt prompting styles for OpenAI, Anthropic, Mistral, and other LLM providers to get the best results from your Pipelex methods."
----
-
-# LLM Prompting Style Configuration
-
-The `PromptingConfig` class controls how Pipelex handles prompting styles for different LLM targets.
-
-## Configuration Options
-
-```python
-class PromptingConfig(ConfigModel):
- default_prompting_style: TemplatingStyle
- prompting_styles: dict[str, TemplatingStyle]
-```
-
-### Fields
-
-- `default_prompting_style`: The default prompting style to use when none is specified
-- `prompting_styles`: Dictionary mapping LLM targets to their specific prompting styles
-
-## Prompting Styles
-
-Each prompting style defines how prompts are formatted and presented to the LLM. The style can be customized per LLM target to optimize performance and ensure compatibility.
-
-## Example Configuration
-
-```toml
-[pipelex.prompting_config]
-default_prompting_style = { tag_style = "xml" }
-
-[pipelex.prompting_config.prompting_styles]
-openai = { tag_style = "ticks" }
-anthropic = { tag_style = "xml" }
-mistral = { tag_style = "square_brackets" }
-gemini = { tag_style = "xml" }
-```
-
-## Usage
-
-The configuration provides a method to get the appropriate prompting style:
-
-```python
-def get_prompting_style(self, prompting_target: PromptingTarget | None = None) -> TemplatingStyle | None:
- if prompting_target:
- return self.prompting_styles.get(prompting_target, self.default_prompting_style)
- return None
-```
-
-This allows for:
-
-- Target-specific prompting styles
-- Fallback to default style when no specific style is defined
-- Optional prompting when no target is specified
-
-## Best Practices
-
-- Define a sensible default prompting style
-- Configure specific styles for LLMs with unique requirements
-- Test prompting styles with each LLM target
-- Document any special formatting requirements
-
-## Related Documentation
-
-- [PipeLLM › Structuring Method](./pipes/pipe-operators/PipeLLM.md#structuring-method-preliminary-text) - Two-step text-then-structure via `structuring_method = "preliminary_text"`
-- [PipeStructure](./pipes/pipe-operators/PipeStructure.md) - Standalone operator that turns text into a structured concept
-- [PipeLLM](./pipes/pipe-operators/PipeLLM.md) - Pipe-level prompting and output controls
-- [LLM Integration](../features/llm-integration.md) - High-level LLM capability overview
diff --git a/docs/building-methods/pipes/pipe-operators/PipeCompose.md b/docs/building-methods/pipes/pipe-operators/PipeCompose.md
index 04fc9894a..8a6912810 100644
--- a/docs/building-methods/pipes/pipe-operators/PipeCompose.md
+++ b/docs/building-methods/pipes/pipe-operators/PipeCompose.md
@@ -44,7 +44,7 @@ The Jinja2 template has access to all the "stuffs" currently in the working memo
|--------------------|--------|----------------------------------------------------------------------------------|----------|
| `template` | string | The Jinja2 template string | Yes |
| `category` | string | Template category: `basic`, `markdown`, `html`, `mermaid` | Yes |
-| `templating_style` | table | Style options: `{ tag_style = "...", text_format = "..." }` | No |
+| `templating_style` | table | How `\| tag` and `\| format` render in this template: `{ tag_style = "...", text_format = "..." }`. Omit it to use the runtime default — see [Templating Style](../../templating-style.md) | No |
| `extra_context` | table | Additional key-value pairs merged into the template rendering context | No |
### Template Mode Examples
@@ -245,3 +245,4 @@ In this example:
- [Working Memory](../working-memory.md) - How pipes access and share data
- [Provide Inputs](../provide-inputs.md) - Passing inputs to pipes and pipelines
+- [Templating Style](../../templating-style.md) - Tag styles and text formats, and the runtime default
diff --git a/docs/building-methods/pipes/pipe-operators/PipeLLM.md b/docs/building-methods/pipes/pipe-operators/PipeLLM.md
index ae9ddfdb7..26d4e99b4 100644
--- a/docs/building-methods/pipes/pipe-operators/PipeLLM.md
+++ b/docs/building-methods/pipes/pipe-operators/PipeLLM.md
@@ -226,6 +226,7 @@ Analyze the document and explain how it relates to the context: $reference_doc
| `system_prompt` | string | A system-level prompt to guide the LLM's behavior (e.g., "You are a helpful assistant"). Supports the same variable syntax as `prompt`, including image and document references. | No |
| `prompt` | string | A template for the user prompt. Use `$` for inline variables (e.g., `$topic`). Use `@input_name` as a block sigil on its own line to insert the content of an entire input — inline `@var` raises `TemplateSigilSyntaxError` when `var` collides with a declared input. For a declared-optional input (`?`), use `@?input_name` — it inserts the content when present and renders nothing when absent, and counts as a guard for the optionality lint (a bare `$var`/`@var` reference to an optional input is rejected as `optional_input_unguarded`; see [Understanding Optionality](../understanding-optionality.md)). Image and document variables follow the same rules. Escape with `@@` or `$$` to emit a literal `@` or `$` (e.g., `@@font-face` inside a `<style>` block). | No |
| `structuring_method` | string | `"direct"` (default) generates the structured output in one LLM call. `"preliminary_text"` expands the pipe at load time into a `PipeLLM` (text) + [`PipeStructure`](./PipeStructure.md) sequence — two LLM calls. Cannot be combined with a `Text` output. | No |
+| `templating_style` | string or table | How this pipe's inputs are tagged into the prompt. A bare string is the tag style (`"xml"`, `"ticks"`, `"square_brackets"`, `"no_tag"`); a table sets both, `{ tag_style = "xml", text_format = "markdown" }`. Omit it to use the runtime default. See [Templating Style](../../templating-style.md). | No |
### LLM Setting Fields
diff --git a/docs/building-methods/templating-style.md b/docs/building-methods/templating-style.md
new file mode 100644
index 000000000..70e4d06f6
--- /dev/null
+++ b/docs/building-methods/templating-style.md
@@ -0,0 +1,152 @@
+---
+title: "Templating Style"
+description: "Declare how a pipe's inputs are tagged and formatted into its prompt with templating_style — XML tags, back-tick fences, square brackets, or no tag at all."
+---
+
+# Templating Style
+
+When you write `@article` in a prompt, Pipelex inserts the content of the `article` input — wrapped in a tag so the model can tell where your data starts and stops. **Templating style is what decides the shape of that wrapper.**
+
+It is an authoring decision, not a property of the model you happen to run on. You declare it on the pipe; the model never changes it.
+
+```toml
+[pipe.summarize_article]
+type = "PipeLLM"
+description = "Summarize an article"
+inputs = { article = "Text" }
+output = "Text"
+templating_style = "xml"
+prompt = """
+Summarize the article below.
+
+@article
+
+Keep it to one sentence.
+"""
+```
+
+renders as:
+
+```text
+Summarize the article below.
+
+<article>
+Bees pollinate a third of the food we eat.
+</article>
+
+Keep it to one sentence.
+```
+
+## Two levels, and that's all
+
+A prompt renders under exactly one style, resolved in two steps:
+
+1. **What the pipe declares** — the `templating_style` field on the pipe.
+2. **The runtime default** — when the pipe declares nothing.
+
+There is no third level. The style is never derived from the model, the provider, or the backend: a method that renders XML on one model renders XML on all of them.
+
+The shipped default is `xml` with `plain` text, set in `pipelex.toml`:
+
+```toml
+[pipelex.templating_config]
+default_templating_style = { tag_style = "xml" }
+```
+
+Override it in your project's `.pipelex/pipelex.toml` to change the house style for every pipe that doesn't declare one.
+
+## Two ways to write it
+
+**Bare string** — the common case. The string is the tag style; the text format stays `plain`.
+
+```toml
+templating_style = "square_brackets"
+```
+
+**Inline table** — when you also want to set the text format.
+
+```toml
+templating_style = { tag_style = "xml", text_format = "markdown" }
+```
+
+| Field | Type | Description | Required |
+|-------|------|-------------|----------|
+| `tag_style` | string | How `@variable` insertions are wrapped: `xml`, `ticks`, `square_brackets`, `no_tag` | Yes |
+| `text_format` | string | How values are rendered inside the prompt: `plain` (default), `markdown`, `html`, `json` | No |
+
+## The tag styles
+
+Each style below shows what `@article` produces for an input named `article`.
+
+### `xml`
+
+The default, and the best-supported shape across current models.
+
+```text
+<article>
+Bees pollinate a third of the food we eat.
+</article>
+```
+
+### `ticks`
+
+A fenced code block, prefixed with the variable name.
+
+````text
+article: ```
+Bees pollinate a third of the food we eat.
+```
+````
+
+### `square_brackets`
+
+BBCode-flavored delimiters.
+
+```text
+[article]
+Bees pollinate a third of the food we eat.
+[/article]
+```
+
+### `no_tag`
+
+The value, bare. Nothing is added — use it when your prompt already provides its own framing, or when a wrapper would confuse the task.
+
+```text
+Bees pollinate a third of the food we eat.
+```
+
+!!! note "Tag names come from the variable"
+ `@article` tags with `article`. A value with no name of its own — anything piped through `with_images`, for instance — falls back to `data` under `xml` and `square_brackets`. Under `ticks` it renders as a bare fence with no prefix, and `no_tag` adds nothing either way.
+
+## What the two sigils do
+
+The two insertion sigils are governed by different halves of the style:
+
+- **`@variable`** on its own line inserts the whole input, wrapped per `tag_style`.
+- **`$variable`** inline inserts the value formatted per `text_format`, with no wrapper.
+
+So a pipe with `templating_style = "no_tag"` and one with `$article` instead of `@article` produce similar-looking output for different reasons — the first chose not to wrap, the second never asked for a wrapper.
+
+## Beyond PipeLLM
+
+- **[`PipeCompose`](pipes/pipe-operators/PipeCompose.md)** takes `templating_style` on its `[pipe.name.template]` section, for templates that use the `tag` or `format` filters directly. A compose pipe that declares nothing renders under the same runtime default.
+- **`PipeImgGen` and `PipeSearch`** have no authored style of their own — their prompts render under the runtime default. Image and search prompts rarely benefit from tagging, but they do render under a real style rather than an invisible fallback.
+- **Construct-mode template fields** and the built-in structuring prompts likewise resolve a real style, so a template of yours that uses `| tag` behaves the same everywhere.
+
+!!! warning "A style is always required, and never invented"
+ The Jinja2 `tag` and `format` filters have no fallback of their own. Every prompt-rendering entry point resolves a real style before rendering, so a template using `| tag` always renders in a shape somebody chose. If you build prompts through the kernel API directly and omit the style, you get a loud error rather than a silent default.
+
+## Choosing a style
+
+- **Stay on `xml`** unless you have a reason. It is unambiguous, it nests, and every major model family handles it well.
+- **Reach for `no_tag`** when the input *is* the prompt — a single block of text that your instructions already introduce.
+- **Set `text_format = "markdown"`** when the model's output quality depends on seeing structured values (tables, nested objects) rather than flattened text.
+- **Declare the style on the pipe** when a specific pipe needs a shape the rest of your method doesn't; change the config default when your whole project wants a different house style.
+
+## Related Documentation
+
+- [PipeLLM](pipes/pipe-operators/PipeLLM.md) - The `templating_style` parameter in context
+- [PipeCompose](pipes/pipe-operators/PipeCompose.md) - Templating style on composed templates
+- [LLM Integration](../features/llm-integration.md) - High-level LLM capability overview
+- [Optimize Cost & Quality](configure-ai-llm-to-optimize-methods.md) - Model choice and presets
diff --git a/docs/configuration/config-technical/inference-backend-config.md b/docs/configuration/config-technical/inference-backend-config.md
index 8f7f6e358..a7b9ea2b8 100644
--- a/docs/configuration/config-technical/inference-backend-config.md
+++ b/docs/configuration/config-technical/inference-backend-config.md
@@ -296,7 +296,6 @@ Each backend has its own model specification file in `.pipelex/inference/backend
```toml
# openai.toml
default_sdk = "openai"
-default_prompting_target = "openai"
[gpt-4o-mini]
model_id = "gpt-4o-mini"
diff --git a/docs/contribute/drift-contracts.md b/docs/contribute/drift-contracts.md
index 5481ee24b..66ff70816 100644
--- a/docs/contribute/drift-contracts.md
+++ b/docs/contribute/drift-contracts.md
@@ -52,7 +52,7 @@ make drift-plan
It prints one Markdown packet per open contract: the description, exactly which trigger files were added/removed/modified since the last ack, the review targets, the verify commands, and the previous reviewer's rationale. To fulfill a contract:
-1. **Review the targets against the trigger changes.** Actually read them. Update whatever is stale. "Nothing to update" is a legitimate outcome — say so in the rationale.
+1. **Review the targets against the trigger changes.** Actually read them. Update whatever is stale. "Nothing to update" is a legitimate outcome — say so in the rationale. Two traps worth naming, because searching the target for what changed walks past both: a claim that quantifies (*every*, *only*, *the sole exception*, a count) rots by **omission**, so the symbol that falsified it is absent from the sentence and has to be found by re-deriving the set from the code; and a claim *about* another artifact — a test, a module — is verified against what that artifact does, never against its docstring or a sibling doc, which drift from the same edit that missed them.
2. **Stage the trigger files:** `git add` them (staging is enough; you don't need to commit first, and other unstaged changes elsewhere are fine). **The digest is computed from the git index, not the working tree** — an unstaged edit or an untracked file is invisible to the ack, and `drift ack` warns when it sees one that matches the triggers. For a contract with `verify_commands` that warning escalates to a hard error: the verify commands run on the working tree, so a matching unstaged edit or untracked file means they certify content the digest does not cover. This coverage check runs both **before** the verify commands (so an already-dirty tree fails fast) and **after** them (so a trigger the verify commands themselves format or generate is caught too, not silently left out of the digest).
3. **Record the ack:**
diff --git a/docs/errors/inference-and-providers.md b/docs/errors/inference-and-providers.md
index 26fbf48b3..630b00e80 100644
--- a/docs/errors/inference-and-providers.md
+++ b/docs/errors/inference-and-providers.md
@@ -46,7 +46,6 @@ own page. Classes are grouped by subsystem.
- [`LLMModelNotFoundError`](llm-model-not-found-error.md) — LLM model not found
- [`LLMPromptParameterError`](llm-prompt-parameter-error.md) — LLM prompt parameter
- [`LLMPromptSpecError`](llm-prompt-spec-error.md) — LLM prompt spec
-- [`LLMPromptTemplateInputsError`](llm-prompt-template-inputs-error.md) — LLM prompt template inputs
- [`LLMSettingsValidationError`](llm-settings-validation-error.md) — LLM settings validation
- [`ModelChoiceNotFoundError`](model-choice-not-found-error.md) — Model choice not found
- [`ModelDeckNotFoundError`](model-deck-not-found-error.md) — Model deck not found
diff --git a/docs/errors/llm-prompt-template-inputs-error.md b/docs/errors/llm-prompt-template-inputs-error.md
deleted file mode 100644
index f679960e3..000000000
--- a/docs/errors/llm-prompt-template-inputs-error.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-title: "LLM prompt template inputs"
-description: "Reference for the `LLMPromptTemplateInputsError` Pipelex error class."
----
-
-<!-- pipelex:generated -->
-
-# LLM prompt template inputs
-
-| Field | Value |
-|---|---|
-| `error_type` | `LLMPromptTemplateInputsError` |
-| `title` | LLM prompt template inputs |
-| `type_uri` | `https://docs.pipelex.com/latest/errors/llm-prompt-template-inputs-error/` |
-| `error_domain` | _(inherited from parent)_ |
-| Defined in | `pipelex.cogt.exceptions` |
-| Parent class | [`CogtError`](cogt-error.md) |
-
-[Back to Error Reference](index.md)
diff --git a/docs/features/index.md b/docs/features/index.md
index c387e8a81..ebf10d2c5 100644
--- a/docs/features/index.md
+++ b/docs/features/index.md
@@ -45,7 +45,7 @@ This section covers all Pipelex capabilities, organized by area.
- **[LLM Integration](llm-integration.md)**
- Text generation, structured outputs, vision language models, prompting styles, system prompt inheritance, and model presets.
+ Text generation, structured outputs, vision language models, templating styles, system prompt inheritance, and model presets.
- **[Document Extraction](document-extraction.md)**
diff --git a/docs/features/llm-integration.md b/docs/features/llm-integration.md
index 91cb658ff..f6a3d8047 100644
--- a/docs/features/llm-integration.md
+++ b/docs/features/llm-integration.md
@@ -1,6 +1,6 @@
---
title: "LLM Integration"
-description: "Pipelex LLM integration: text generation, structured outputs, vision models, prompting styles, and system prompt inheritance. Write once, run on any supported model."
+description: "Pipelex LLM integration: text generation, structured outputs, vision models, templating styles, and system prompt inheritance. Write once, run on any supported model."
---
# LLM Integration
@@ -24,11 +24,11 @@ See [`PipeStructure`](../building-methods/pipes/pipe-operators/PipeStructure.md)
Include images and PDFs directly in LLM prompts using `@variable` syntax. Support for single documents, multiple documents, and mixed content (text + images + PDFs). The runtime automatically handles document rendering and provider-specific vision API formats.
-## Prompting Styles
+## Templating Style
-Adapt prompts for different LLM families (OpenAI, Anthropic, Mistral) to get the best results from each provider. Pipelex applies provider-specific formatting, system prompt handling, and structured output instructions automatically.
+Choose how a pipe's inputs are tagged into its prompt — XML tags, back-tick fences, square brackets, or no tag at all. It is declared on the pipe (`templating_style`), with one runtime default for everything that declares nothing, so the same method renders the same prompt shape on every model.
-See [LLM Prompting Style](../building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md).
+See [Templating Style](../building-methods/templating-style.md).
## System Prompt Inheritance
diff --git a/docs/under-the-hood/pipelex-kernel.md b/docs/under-the-hood/pipelex-kernel.md
index 6063dd1b5..7aed7517c 100644
--- a/docs/under-the-hood/pipelex-kernel.md
+++ b/docs/under-the-hood/pipelex-kernel.md
@@ -7,7 +7,7 @@ description: "Operator semantics as importable functions — what pipelex/kernel
This page is for contributors working on Pipelex internals, and for anyone embedding the kernel directly rather than running `.mthds` methods. For how the operator classes above it fit into the whole, see [Architecture Overview](./architecture-overview.md).
-What a `PipeLLM` step actually *does* — resolve a model off the deck, derive a prompting style, assemble the prompt, generate, write the result into memory — used to be reachable only through a fully booted interpreter with a method loaded. [`pipelex/kernel/`](https://github.com/Pipelex/pipelex/tree/main/pipelex/kernel) holds that semantics as plain functions, so it has **one implementation with two kinds of caller**:
+What a `PipeLLM` step actually *does* — resolve a model off the deck, resolve the templating style, assemble the prompt, generate, write the result into memory — used to be reachable only through a fully booted interpreter with a method loaded. [`pipelex/kernel/`](https://github.com/Pipelex/pipelex/tree/main/pipelex/kernel) holds that semantics as plain functions, so it has **one implementation with two kinds of caller**:
- the interpreter's operator classes (`PipeLLM`, `PipeExtract`, `PipeImgGen`, `PipeSearch`, `PipeCompose`, `PipeFunc`), which resolve blueprints, validate inputs, wrap errors and trace, then call the kernel;
- any **programmatic caller** embedding the kernel, which calls the same functions on a process with zero `.mthds` loaded.
@@ -52,7 +52,7 @@ Four gates hold this, and each covers something the others miss — see [Hub Lay
| `pipelex-dev check-hub-layering` | No kernel *module* imports the interpreter hub |
| `tests/unit/pipelex/test_kernel_layer_import_closure.py` | A kernel entry point *imports* clean |
| `tests/unit/pipelex/test_kernel_layer_exceptions_aggregate_gate.py` | No kernel module reaches the exceptions aggregate — imports and bare strings alike |
-| `tests/unit/pipelex/kernel/test_kernel_boot_contract.py` | Every kernel entry point **runs** on a keyless boot, swept afterwards — except the three `resolve_*_setting` helpers, which read the model deck (a separate question from this one) |
+| `tests/unit/pipelex/kernel/test_kernel_boot_contract.py` | Every kernel entry point **runs** on a keyless boot, swept afterwards — except the deck-reading helpers (`resolve_*_setting`, `concrete_llm_model_handle`), which read the model deck (a separate question from this one) |
Only the last one can see a function-local interpreter import, and it is **per-function**: it catches one inside `run_search` only by calling `run_search`. Every new kernel entry point owes it an arm.
@@ -67,7 +67,8 @@ Both façade calls take the concept and the output class the caller wants, defau
| Module | Entry points |
|---|---|
| `pipelex.kernel.pipelex_kernel` | `PipelexKernel.make`, `.llm_text`, `.llm_object`, `.make_step_metadata` |
-| `pipelex.kernel.llm_ops` | `resolve_llm_setting_for_text` / `_for_object`, `concrete_llm_model_handle`, `derive_templating_style`, `derive_structure_prompt`, `generate_object_content`, `run_llm_text`, `run_llm_object` |
+| `pipelex.kernel.llm_ops` | `resolve_llm_setting_for_text` / `_for_object`, `concrete_llm_model_handle`, `derive_structure_prompt`, `generate_object_content`, `run_llm_text`, `run_llm_object` |
+| `pipelex.kernel.templating_style_ops` | `resolve_templating_style` |
| `pipelex.kernel.extract_ops` | `resolve_extract_setting`, `build_extract_job_params`, `run_extract` |
| `pipelex.kernel.img_gen_ops` | `resolve_img_gen_setting`, `resolve_default_size`, `build_img_gen_job_params`, `run_img_gen` |
| `pipelex.kernel.search_ops` | `resolve_search_setting`, `run_search` |
@@ -81,6 +82,8 @@ Both façade calls take the concept and the output class the caller wants, defau
The two `assemble_*` functions are there because `run_llm_text` and `run_img_gen` both take a *ready* prompt. A caller that could not build one would be holding an operator it cannot reach, which is what image generation was until `assemble_img_gen_prompt` existed: its only builder was an interpreter-layer blueprint. What they own is the part a caller must not re-derive — resolving `ImageReference` and `DocumentReference` out of working memory, and, on the image side, keeping the `[Image N]` tokens numbered from the same registry that orders `input_images`, since a mismatch mislabels which image the prompt is describing and nothing downstream can detect it.
+**Every entry point that renders a template takes a required `templating_style`** — `run_llm_text`, `run_llm_object`, `derive_structure_prompt`, `assemble_llm_prompt`, `assemble_img_gen_prompt`, `run_search`, `run_compose_template`. It is not nullable, and that is the contract: the Jinja2 filters that tag and format a value have no default of their own, so a call that omitted the style would render a prompt in a shape nobody chose. `resolve_templating_style(authored=...)` is what produces one — pass what the caller authored, or `None` to take the runtime default.
+
There are **no re-exports**: `pipelex/kernel/__init__.py` holds doctrine and nothing else, and every symbol is imported from the module that defines it. For this package that is a layering property rather than a style one — a module that re-exports across layers is a layer boundary with the sign filed off.
Every kernel function is **fully keyword-only**, with zero entries in `subject_grants.toml`. Call sites name every argument.
@@ -124,7 +127,7 @@ summaries = extract_main_content_as_list(memory=result.memory, item_type=Summary
- **`cogt_run_params`** — the execution-mode contract (`run_mode`, and the DRY-only `is_mock_usage` sub-flag) that every cogt leaf reads off the assignment it is handed.
- **`step_id_source`** — where each step's `pipe_run_id` comes from, defaulting to a fresh `uuid4`, which is what every in-process run wants. It exists for a kernel hosted inside a replay-based executor, where ids minted from a non-replay-safe source take different values each re-execution; such a host injects its own replay-safe source via `PipelexKernel.make(step_id_source=…)`. It is a seam, not state — the kernel never inspects what it returns.
-Nothing derived from config or the model deck is cached on the instance — resolved settings and prompting styles are computed per call, because cached derived state would shadow a later config or deck change and break per-call variation.
+Nothing derived from config or the model deck is cached on the instance — resolved settings and templating styles are computed per call, because cached derived state would shadow a later config or deck change and break per-call variation.
**Cost and usage reporting is the caller's lifecycle, not the kernel's.** The interpreter's run machinery opens a graph tracer, builds an event log, registers it on the report delegate and closes all three in a `finally`, because it has a run boundary to hang that on. A kernel call has no such boundary — it is one step, and a caller may make one or a thousand. So the kernel takes a `TraceContext` and does exactly one thing with it: stamp it onto every step's `JobMetadata`, which is what the cogt leaf reads to decide whether to emit a usage event.
diff --git a/docs/under-the-hood/reasoning-controls.md b/docs/under-the-hood/reasoning-controls.md
index 1a691e185..9a02104be 100644
--- a/docs/under-the-hood/reasoning-controls.md
+++ b/docs/under-the-hood/reasoning-controls.md
@@ -228,7 +228,7 @@ Both modes first check `anthropic_config.effort_to_level_map` to gate reasoning.
**ADAPTIVE mode** uses `{"type": "adaptive"}` with an `OutputConfigParam(effort=...)` where the effort value comes from the level map.
-**MANUAL mode** resolves effort to a token budget via the `effort_to_budget_maps` config (keyed by `prompting_target`), then sends `{"type": "enabled", "budget_tokens": N}`. The budget is capped to `min(budget, max_tokens - 1)` to satisfy Anthropic's API constraint.
+**MANUAL mode** resolves effort to a token budget via the `effort_to_budget_maps` config (keyed by the worker-owned reasoning family — `"anthropic"` for the Anthropic worker), then sends `{"type": "enabled", "budget_tokens": N}`. The budget is capped to `min(budget, max_tokens - 1)` to satisfy Anthropic's API constraint.
**`reasoning_budget`** (explicit) always uses `{"type": "enabled", "budget_tokens": N}` regardless of thinking mode. The same `min(budget, max_tokens - 1)` cap is applied.
@@ -360,7 +360,7 @@ xhigh = 32768
max = 65536
```
-The map is keyed by `prompting_target` (from the model spec). A validated mapping must contain entries for all `ReasoningEffort` values (including `none`, even though it is unreachable at runtime — the level map gates `NONE` as disabled before the budget lookup).
+The map is keyed by the reasoning family each worker owns (`reasoning_budget_family`, a class attribute: `"anthropic"` on the Anthropic worker, `"gemini"` on the Google worker) — the model spec plays no part in the lookup. A validated mapping must contain entries for all `ReasoningEffort` values (including `none`, even though it is unreachable at runtime — the level map gates `NONE` as disabled before the budget lookup).
The budget is resolved at runtime via `LLMConfig.get_reasoning_budget()` (`pipelex/cogt/config_cogt.py`).
diff --git a/mkdocs.yml b/mkdocs.yml
index fbf022e79..a04f19f66 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -118,7 +118,8 @@ plugins:
'setup/index.md': 'get-started/build-with-claude-code.md'
'setup/project-organization.md': 'get-started/build-with-claude-code.md'
'setup/configure-ai-providers.md': 'get-started/configure-ai-providers.md'
- 'home/6-build-reliable-ai-workflows/adapt-to-llm-prompting-style-openai-anthropic-mistral.md': 'building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md'
+ 'home/6-build-reliable-ai-workflows/adapt-to-llm-prompting-style-openai-anthropic-mistral.md': 'building-methods/templating-style.md'
+ 'building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md': 'building-methods/templating-style.md'
'home/6-build-reliable-ai-workflows/concepts/define_your_concepts.md': 'building-methods/concepts/define_your_concepts.md'
'home/6-build-reliable-ai-workflows/concepts/inline-structures.md': 'building-methods/concepts/inline-structures.md'
'home/6-build-reliable-ai-workflows/concepts/native-concepts.md': 'building-methods/concepts/native-concepts.md'
@@ -268,7 +269,7 @@ plugins:
- building-methods/pipes/pipe-controllers/PipeCondition.md: "PipeCondition"
- building-methods/pipes/signature-pipes.md: "Signature Pipes"
- building-methods/configure-ai-llm-to-optimize-methods.md: "Optimize Cost & Quality"
- - building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md: "LLM Prompting Style"
+ - building-methods/templating-style.md: "Templating Style"
Reference:
- tools/cli/index.md: "CLI Reference Overview"
- tools/cli/init.md: "CLI Init"
@@ -489,7 +490,7 @@ nav:
- PipeCondition: building-methods/pipes/pipe-controllers/PipeCondition.md
- Signature Pipes: building-methods/pipes/signature-pipes.md
- Optimize Cost & Quality: building-methods/configure-ai-llm-to-optimize-methods.md
- - LLM Prompting Style: building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md
+ - Templating Style: building-methods/templating-style.md
- Retries & Resilience:
- Overview: reliability/retries-and-resilience.md
- Automatic Retries: reliability/automatic-retries.md
diff --git a/pipelex/builder/pipe/pipe_llm_spec.py b/pipelex/builder/pipe/pipe_llm_spec.py
index 31f86e16e..8e222c22a 100644
--- a/pipelex/builder/pipe/pipe_llm_spec.py
+++ b/pipelex/builder/pipe/pipe_llm_spec.py
@@ -11,6 +11,7 @@ from typing_extensions import override
from pipelex.builder.pipe.pipe_spec import PipeSpec
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint, StructuringMethod
from pipelex.tools.misc.pretty import PrettyPrintable
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
class PipeLLMSpec(PipeSpec):
@@ -65,6 +66,16 @@ So, don't have to write a bullet-list of all the attributes definitions yourself
""",
)
+ templating_style: TagStyle | TemplatingStyle | None = Field(
+ default=None,
+ description=(
+ "How this pipe's inputs are tagged into the prompt. A bare string names the tag style "
+ "('xml', 'ticks', 'square_brackets', 'no_tag'); an inline table sets both tag style and "
+ 'text format, e.g. { tag_style = "xml", text_format = "markdown" }. Omit to use the '
+ "runtime default."
+ ),
+ )
+
@field_validator("model", mode="before")
@classmethod
def reject_empty_model(cls, value: str | None) -> str | None:
@@ -124,4 +135,5 @@ So, don't have to write a bullet-list of all the attributes definitions yourself
prompt=self.prompt,
model=self.model,
structuring_method=self.structuring_method,
+ templating_style=self.templating_style,
)
diff --git a/pipelex/cogt/config_cogt.py b/pipelex/cogt/config_cogt.py
index 3c10f6a2b..ee1ee2d0c 100644
--- a/pipelex/cogt/config_cogt.py
+++ b/pipelex/cogt/config_cogt.py
@@ -93,14 +93,14 @@ class LLMConfig(ConfigModel):
raise LLMConfigError(msg)
return template
- def get_reasoning_budget(self, prompting_target: str, *, effort: ReasoningEffort) -> int:
- effort_to_budget_map = self.effort_to_budget_maps.get(prompting_target)
+ def get_reasoning_budget(self, *, family: str, effort: ReasoningEffort) -> int:
+ effort_to_budget_map = self.effort_to_budget_maps.get(family)
if not effort_to_budget_map:
- msg = f"No effort-to-budget map found for prompting target '{prompting_target}'"
+ msg = f"No effort-to-budget map found for reasoning family '{family}'"
raise ConfigValidationError(msg)
budget = effort_to_budget_map.get(effort)
if budget is None:
- msg = f"No budget found for reasoning effort '{effort}' and prompting target '{prompting_target}'"
+ msg = f"No budget found for reasoning effort '{effort}' and reasoning family '{family}'"
raise ConfigValidationError(msg)
return budget
diff --git a/pipelex/cogt/exceptions.py b/pipelex/cogt/exceptions.py
index 577d37055..db67f1fca 100644
--- a/pipelex/cogt/exceptions.py
+++ b/pipelex/cogt/exceptions.py
@@ -316,10 +316,6 @@ class LLMPromptSpecError(CogtError):
error_category = InferenceErrorCategory.CONTENT
-class LLMPromptTemplateInputsError(CogtError):
- error_category = InferenceErrorCategory.CONTENT
-
-
class LLMPromptParameterError(CogtError):
error_category = InferenceErrorCategory.CONTENT
diff --git a/pipelex/cogt/llm/llm_prompt_factory_abstract.py b/pipelex/cogt/llm/llm_prompt_factory_abstract.py
deleted file mode 100644
index 319ed2657..000000000
--- a/pipelex/cogt/llm/llm_prompt_factory_abstract.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from abc import ABC, abstractmethod
-from typing import Any
-
-from pydantic import BaseModel
-
-from pipelex.cogt.llm.llm_prompt import LLMPrompt
-
-
-class LLMPromptFactoryAbstract(ABC, BaseModel):
- @abstractmethod
- async def make_llm_prompt_from_args(
- self,
- **prompt_arguments: Any,
- ) -> LLMPrompt:
- pass
diff --git a/pipelex/cogt/llm/llm_prompt_template.py b/pipelex/cogt/llm/llm_prompt_template.py
deleted file mode 100644
index b5ab1b43a..000000000
--- a/pipelex/cogt/llm/llm_prompt_template.py
+++ /dev/null
@@ -1,112 +0,0 @@
-from typing import Any
-
-from typing_extensions import override
-
-from pipelex import log
-from pipelex.cogt.exceptions import LLMPromptTemplateInputsError
-from pipelex.cogt.image.prompt_image import PromptImage
-from pipelex.cogt.llm.llm_prompt import LLMPrompt
-from pipelex.cogt.llm.llm_prompt_factory_abstract import LLMPromptFactoryAbstract
-from pipelex.cogt.llm.llm_prompt_template_inputs import LLMPromptTemplateInputs
-from pipelex.cogt.templating.template_rendering import render_template
-from pipelex.tools.jinja2.template_category import TemplateCategory
-from pipelex.tools.misc.string_utils import is_none_or_has_text
-from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
-from pipelex.tools.templating.text_format import TextFormat
-
-
-def make_empty_prompt() -> LLMPrompt:
- return LLMPrompt(
- system_text=None,
- user_text=None,
- user_images=[],
- )
-
-
-class LLMPromptTemplate(LLMPromptFactoryAbstract):
- proto_prompt: LLMPrompt = make_empty_prompt()
- base_template_inputs: LLMPromptTemplateInputs = LLMPromptTemplateInputs()
-
- @override
- async def make_llm_prompt_from_args(
- self,
- **prompt_arguments: Any,
- ) -> LLMPrompt:
- arguments_dict = prompt_arguments.copy()
-
- # pop the base fields and then use the templating method
- system_text: str | None = arguments_dict.pop("system_text", None)
- user_text: str | None = arguments_dict.pop("user_text", None)
- if not user_text:
- user_text = self.proto_prompt.user_text
- # user_images is Optional here: None means the template is not altering the user_images field
- user_images: list[PromptImage] | None = None
- if "user_images" in arguments_dict:
- user_images = arguments_dict.pop("user_images")
- elif "user_image" in arguments_dict:
- user_images = [arguments_dict.pop("user_image")]
- is_user_images_append: bool | None = arguments_dict.pop("is_user_images_append", None)
-
- return await self._make_llm_prompt(
- system_text=system_text,
- user_text=user_text,
- user_images=user_images,
- is_user_images_append=is_user_images_append,
- template_inputs=LLMPromptTemplateInputs(root=arguments_dict),
- )
-
- async def _make_llm_prompt(
- self,
- *,
- system_text: str | None = None,
- user_text: str | None = None,
- user_images: list[PromptImage] | None = None,
- is_user_images_append: bool | None = None,
- template_inputs: LLMPromptTemplateInputs | None = None,
- ) -> LLMPrompt:
- if not is_none_or_has_text(system_text):
- if system_text == "":
- log.warning(f"Prompt template system_text should be None or contain text. system_text = '{system_text}'")
- else:
- msg = f"Prompt template system_text should be None or contain text. system_text = '{system_text}'"
- raise LLMPromptTemplateInputsError(msg)
- if not is_none_or_has_text(user_text):
- msg = f"Prompt template user_text should be None or contain text. system_text = '{user_text}'"
- raise LLMPromptTemplateInputsError(msg)
-
- all_template_inputs = self.base_template_inputs.complemented_by(additional_template_inputs=template_inputs)
-
- # input variables can override prompt texts
-
- llm_prompt = self.proto_prompt.model_copy()
- if system_text:
- llm_prompt.system_text = system_text
- if user_text:
- llm_prompt.user_text = user_text
- if user_images:
- if is_user_images_append:
- llm_prompt.user_images.extend(user_images)
- else:
- llm_prompt.user_images = user_images
-
- # input variables can be applied to prompt texts used as templates
- llm_prompt_templating_style = TemplatingStyle(
- tag_style=TagStyle.XML,
- text_format=TextFormat.MARKDOWN,
- )
- if llm_prompt.system_text:
- llm_prompt.system_text = await render_template(
- template=llm_prompt.system_text,
- category=TemplateCategory.LLM_PROMPT,
- context=all_template_inputs.root,
- templating_style=llm_prompt_templating_style,
- )
- if llm_prompt.user_text:
- llm_prompt.user_text = await render_template(
- template=llm_prompt.user_text,
- category=TemplateCategory.LLM_PROMPT,
- context=all_template_inputs.root,
- templating_style=llm_prompt_templating_style,
- )
-
- return llm_prompt
diff --git a/pipelex/cogt/llm/llm_prompt_template_inputs.py b/pipelex/cogt/llm/llm_prompt_template_inputs.py
deleted file mode 100644
index 340788816..000000000
--- a/pipelex/cogt/llm/llm_prompt_template_inputs.py
+++ /dev/null
@@ -1,67 +0,0 @@
-from __future__ import annotations
-
-from typing import Any
-
-from pydantic import ConfigDict, Field, RootModel, model_validator
-from typing_extensions import TYPE_CHECKING, override
-
-from pipelex import log
-from pipelex.cogt.exceptions import LLMPromptTemplateInputsError
-from pipelex.system.runtime import ProblemReaction, runtime_manager
-from pipelex.tools.misc.json_utils import json_str
-from pipelex.tools.misc.string_utils import can_inject_text
-
-if TYPE_CHECKING:
- from collections.abc import ItemsView
- from typing import Self
-
-LLMPromptTemplateInputsDict = dict[str, Any]
-
-
-class LLMPromptTemplateInputs(RootModel[LLMPromptTemplateInputsDict]):
- root: LLMPromptTemplateInputsDict = Field(default_factory=dict)
-
- model_config = ConfigDict(validate_assignment=True)
-
- @model_validator(mode="after")
- def validate_template_inputs(self) -> Self:
- if not self.root:
- # It's important to exit this func before calling get_config() because empty template inputs
- # are created during imports (before Pipelex is fully initialized)
- return self
- template_inputs_reaction = runtime_manager.problem_reactions.template_inputs
- if template_inputs_reaction == ProblemReaction.NONE:
- return self
- for var_name, value in self.root.items():
- if not can_inject_text(value):
- error_msg = f"Template input '{var_name}' cannot inject text"
- if template_inputs_reaction == ProblemReaction.RAISE:
- raise LLMPromptTemplateInputsError(message=error_msg)
- log.error(error_msg)
- return self
-
- def items(self) -> ItemsView[str, Any]:
- return self.root.items()
-
- def list_keys(self) -> list[str]:
- return list(self.root.keys())
-
- def complemented_by(self, additional_template_inputs: LLMPromptTemplateInputs | None) -> LLMPromptTemplateInputs:
- all_template_inputs = self.root.copy()
- if additional_template_inputs:
- all_template_inputs.update(additional_template_inputs.root)
- return LLMPromptTemplateInputs(root=all_template_inputs)
-
- def complemented_by_dict(self, additional_inputs_dict: LLMPromptTemplateInputsDict | None) -> LLMPromptTemplateInputs:
- all_template_inputs = self.root.copy()
- if additional_inputs_dict:
- all_template_inputs.update(additional_inputs_dict)
- return LLMPromptTemplateInputs(root=all_template_inputs)
-
- @override
- def __str__(self) -> str:
- return json_str(self.root, title="llm_prompt_template_inputs", is_spaced=True)
-
- @staticmethod
- def from_args(**template_inputs: Any) -> LLMPromptTemplateInputs:
- return LLMPromptTemplateInputs(root=template_inputs)
diff --git a/pipelex/cogt/llm/llm_setting.py b/pipelex/cogt/llm/llm_setting.py
index c46fbcf6b..91cc63eb1 100644
--- a/pipelex/cogt/llm/llm_setting.py
+++ b/pipelex/cogt/llm/llm_setting.py
@@ -4,7 +4,6 @@ from pydantic import BeforeValidator, Field, WithJsonSchema, field_validator, mo
from pipelex.cogt.image.prompt_image import PromptImageDetail
from pipelex.cogt.llm.llm_job_components import LLMJobParams, ReasoningEffort
-from pipelex.cogt.model_backends.prompting_target import PromptingTarget
from pipelex.cogt.models.model_reference import ModelReference, parse_model_reference
from pipelex.system.configuration.config_model import ConfigModel
@@ -21,7 +20,6 @@ class LLMSetting(ConfigModel):
WithJsonSchema({"anyOf": [{"type": "integer"}, {"enum": ["auto"]}, {"type": "null"}], "default": None}),
] = None
image_detail: PromptImageDetail | None = Field(default=None, strict=False)
- prompting_target: PromptingTarget | None = Field(default=None, strict=False)
reasoning_effort: ReasoningEffort | None = Field(default=None, strict=False)
reasoning_budget: int | None = Field(default=None, gt=0)
description: str | None = None
@@ -59,7 +57,6 @@ class LLMSetting(ConfigModel):
f"LLMSetting(llm_handle={self.model}",
f"temperature={self.temperature}",
f"max_tokens={self.max_tokens}",
- f"prompting_target={self.prompting_target}",
]
if self.reasoning_effort is not None:
parts.append(f"reasoning_effort={self.reasoning_effort}")
diff --git a/pipelex/cogt/model_backends/backend_library.py b/pipelex/cogt/model_backends/backend_library.py
index 9154f7358..b9828ff26 100644
--- a/pipelex/cogt/model_backends/backend_library.py
+++ b/pipelex/cogt/model_backends/backend_library.py
@@ -18,7 +18,7 @@ from pipelex.cogt.model_backends.backend_factory import (
InferenceBackendBlueprint,
InferenceBackendFactory,
)
-from pipelex.cogt.model_backends.gateway_config import GatewayConfig
+from pipelex.cogt.model_backends.gateway_config import GatewayConfig, drop_unknown_gateway_defaults
from pipelex.cogt.model_backends.model_spec_factory import (
BackendModelSpecs,
InferenceModelSpecBlueprint,
@@ -74,7 +74,12 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
backends_dir_path: Path to directory containing per-backend TOML files.
include_disabled: Whether to include disabled backends.
gateway_config: Gateway configuration for Pipelex Gateway backend.
- lenient: When True, skip backends with credential errors instead of raising.
+ lenient: When True, skip a backend whose *credentials* cannot be resolved instead of
+ raising — that is the whole of the tolerance. A malformed configuration (an unknown
+ or invalid key, a model spec that is not a table, a missing per-backend TOML) stays
+ fatal in both modes: a config typo must never silently delete a backend, because the
+ commands that boot leniently (validate, show, dry runs) would then report the far
+ more confusing "model not found" for every handle that backend served.
"""
try:
backends_dict = load_toml_from_path(path=backends_library_path)
@@ -163,6 +168,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
extra_config["aws_region"] = gateway_config.aws_region
model_specs_dict, backend_config_source = self._load_gateway_model_specs(
gateway_config=gateway_config,
+ backend_name=backend_name,
backends_dir_path=backends_dir_path,
substitute_vars_with_provider=substitute_vars_with_provider,
)
@@ -218,9 +224,9 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
model_specs=backend_model_specs,
)
self.root[backend_name] = backend
- except (InferenceBackendLibraryError, InferenceModelSpecError) as exc:
+ except InferenceBackendCredentialsError as credentials_exc:
if lenient:
- log.verbose(f"Skipping backend '{backend_name}': {exc}")
+ log.verbose(f"Skipping backend '{backend_name}': {credentials_exc}")
continue
raise
@@ -228,6 +234,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
self,
gateway_config: GatewayConfig,
*,
+ backend_name: str,
backends_dir_path: str,
substitute_vars_with_provider: Any,
) -> tuple[BackendModelSpecs, str]:
@@ -235,6 +242,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
Args:
gateway_config: Gateway configuration for Pipelex Gateway backend.
+ backend_name: Name the backend library gives this gateway backend.
backends_dir_path: Path to directory containing local override file.
substitute_vars_with_provider: Function to substitute variables.
@@ -242,7 +250,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
Model specs dictionary merged from remote and local overrides.
Raises:
- InferenceModelSpecError: If variable substitution fails.
+ InferenceBackendCredentialsError: If variable substitution fails.
"""
# Load local overrides if they exist
path_to_local_overrides = f"{backends_dir_path}/{PipelexBackend.GATEWAY}.toml"
@@ -250,18 +258,20 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
# Merge remote config with local overrides
model_specs_dict = GatewayConfigMerger.merge(
- gateway_model_specs=gateway_config.model_specs,
+ gateway_model_specs=drop_unknown_gateway_defaults(gateway_model_specs=gateway_config.model_specs),
local_overrides=local_overrides,
)
+ backend_config_source = f"remote config with local overrides from '{path_to_local_overrides}'"
# Apply variable substitution (in case remote config has any variables)
- try:
- model_specs_dict = apply_to_strings_recursive(model_specs_dict, transform_func=substitute_vars_with_provider)
- except (VarNotFoundError, UnknownVarPrefixError) as exc:
- msg = f"Variable substitution failed in remote gateway config: {exc}"
- raise InferenceModelSpecError(msg) from exc
+ model_specs_dict = self._substitute_model_spec_vars(
+ model_specs_dict=model_specs_dict,
+ backend_name=backend_name,
+ source=backend_config_source,
+ substitute_vars_with_provider=substitute_vars_with_provider,
+ )
- return model_specs_dict, f"remote config with local overrides from '{path_to_local_overrides}'"
+ return model_specs_dict, backend_config_source
def _load_local_model_specs(
self,
@@ -281,20 +291,70 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):
Model specs dictionary from local TOML.
Raises:
- InferenceBackendLibraryError: If loading fails.
+ InferenceBackendLibraryError: If the file is missing.
+ InferenceBackendCredentialsError: If variable substitution fails.
"""
path_to_model_specs_toml = f"{backends_dir_path}/{backend_name}.toml"
try:
model_specs_dict_raw = load_toml_from_path(path=path_to_model_specs_toml)
- try:
- model_specs_dict = apply_to_strings_recursive(model_specs_dict_raw, transform_func=substitute_vars_with_provider)
- except (VarNotFoundError, UnknownVarPrefixError) as exc:
- msg = f"Variable substitution failed in file '{path_to_model_specs_toml}': {exc}"
- raise InferenceModelSpecError(msg) from exc
- except (FileNotFoundError, InferenceModelSpecError) as exc:
- msg = f"Failed to load inference model specs from file '{path_to_model_specs_toml}': {exc}"
- raise InferenceBackendLibraryError(msg) from exc
- return model_specs_dict, f"file '{path_to_model_specs_toml}'"
+ except FileNotFoundError as file_not_found_exc:
+ msg = f"Failed to load inference model specs from file '{path_to_model_specs_toml}': {file_not_found_exc}"
+ raise InferenceBackendLibraryError(msg) from file_not_found_exc
+
+ backend_config_source = f"file '{path_to_model_specs_toml}'"
+ model_specs_dict = self._substitute_model_spec_vars(
+ model_specs_dict=model_specs_dict_raw,
+ backend_name=backend_name,
+ source=backend_config_source,
+ substitute_vars_with_provider=substitute_vars_with_provider,
+ )
+ return model_specs_dict, backend_config_source
+
+ @classmethod
+ def _substitute_model_spec_vars(
+ cls,
+ *,
+ model_specs_dict: BackendModelSpecs,
+ backend_name: str,
+ source: str,
+ substitute_vars_with_provider: Any,
+ ) -> BackendModelSpecs:
+ """Resolve variable placeholders in model specs, as a *credentials* failure when one cannot be.
+
+ The error class carries the leniency decision: `load(lenient=True)` skips a backend whose
+ credentials are missing, and nothing else. Raising anything broader here would put a
+ malformed-config failure on the same silent path.
+
+ Raises:
+ InferenceBackendCredentialsError: If a variable cannot be resolved.
+ """
+ try:
+ return apply_to_strings_recursive(model_specs_dict, transform_func=substitute_vars_with_provider)
+ except VarFallbackPatternError as var_fallback_pattern_exc:
+ msg = f"Variable substitution failed in {source}: {var_fallback_pattern_exc}"
+ raise InferenceBackendCredentialsError(
+ credentials_error_type=InferenceBackendCredentialsErrorType.VAR_FALLBACK_PATTERN,
+ backend_name=backend_name,
+ # The pattern names several candidates, so no single one of them is the missing key.
+ key_name="unknown",
+ message=msg,
+ ) from var_fallback_pattern_exc
+ except VarNotFoundError as var_not_found_exc:
+ msg = f"Variable substitution failed in {source}: {var_not_found_exc}"
+ raise InferenceBackendCredentialsError(
+ credentials_error_type=InferenceBackendCredentialsErrorType.VAR_NOT_FOUND,
+ backend_name=backend_name,
+ message=msg,
+ key_name=var_not_found_exc.var_name,
+ ) from var_not_found_exc
+ except UnknownVarPrefixError as unknown_var_prefix_exc:
+ msg = f"Variable substitution failed in {source}: {unknown_var_prefix_exc}"
+ raise InferenceBackendCredentialsError(
+ credentials_error_type=InferenceBackendCredentialsErrorType.UNKNOWN_VAR_PREFIX,
+ backend_name=backend_name,
+ message=msg,
+ key_name=unknown_var_prefix_exc.var_name,
+ ) from unknown_var_prefix_exc
def check_backend_credentials(self, path: str, *, include_disabled: bool = False) -> CredentialsValidationReport:
"""Check if required environment variables are set for enabled backends.
diff --git a/pipelex/cogt/model_backends/gateway_config.py b/pipelex/cogt/model_backends/gateway_config.py
index 3d558abe5..4b9e10b99 100644
--- a/pipelex/cogt/model_backends/gateway_config.py
+++ b/pipelex/cogt/model_backends/gateway_config.py
@@ -1,6 +1,9 @@
+import copy
+from typing import Any, cast
+
from pydantic import BaseModel, ConfigDict, Field
-from pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs
+from pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs, InferenceModelSpecBlueprint
class GatewayConfig(BaseModel):
@@ -8,3 +11,36 @@ class GatewayConfig(BaseModel):
model_specs: BackendModelSpecs = Field(description="Model specifications for Pipelex Gateway (model_name -> spec dict)")
aws_region: str = Field(description="AWS region")
+
+
+def drop_unknown_gateway_defaults(*, gateway_model_specs: BackendModelSpecs) -> BackendModelSpecs:
+ """Drop keys the model-spec blueprint no longer knows from the remote config's `defaults` block.
+
+ The gateway config is served by a component that deploys on its own schedule, so a client can
+ legitimately read a config written by a newer or older release than itself. An unknown key there
+ is version skew, and dropping it keeps a boot working across that skew; a *local* backend file
+ stays strict, because there an unknown key really is the author's typo.
+
+ Scoped to `defaults` on purpose. A per-model key the blueprint does not know is already meaningful
+ — `InferenceBackendLibrary.load` reclassifies it as an outbound HTTP header — and that behaviour is not this
+ function's to reinterpret.
+
+ Deliberately pure, and deliberately silent: it runs on the success path of every gateway-backend
+ load, including loads that happen before `runtime_hub.set_config()` has configured the log
+ dispatch. A `log` call here would turn a plain data transform into a boot-order dependency and
+ crash the caller with `LogConfig is not set`.
+ """
+ known_fields = InferenceModelSpecBlueprint.model_fields.keys()
+ defaults = gateway_model_specs.get("defaults")
+ if not isinstance(defaults, dict):
+ return gateway_model_specs
+
+ unknown_keys = [key for key in cast("dict[str, Any]", defaults) if key not in known_fields]
+ if not unknown_keys:
+ return gateway_model_specs
+
+ pruned: BackendModelSpecs = copy.deepcopy(gateway_model_specs)
+ pruned_defaults = cast("dict[str, Any]", pruned["defaults"])
+ for unknown_key in unknown_keys:
+ del pruned_defaults[unknown_key]
+ return pruned
diff --git a/pipelex/cogt/model_backends/model_spec.py b/pipelex/cogt/model_backends/model_spec.py
index 0b77807a4..1d2fa0694 100644
--- a/pipelex/cogt/model_backends/model_spec.py
+++ b/pipelex/cogt/model_backends/model_spec.py
@@ -7,7 +7,6 @@ from pipelex.cogt.llm.structured_output import StructureMethod
from pipelex.cogt.llm.thinking_mode import ThinkingMode
from pipelex.cogt.model_backends.constraints import ListedConstraint, ValuedConstraint
from pipelex.cogt.model_backends.model_type import ModelType
-from pipelex.cogt.model_backends.prompting_target import PromptingTarget
from pipelex.cogt.usage.cost_category import CostsByCategoryDict
from pipelex.system.configuration.config_model import ConfigModel
from pipelex.tools.typing.pydantic_utils import empty_dict_factory_of, empty_list_factory_of
@@ -30,7 +29,6 @@ class InferenceModelSpec(ConfigModel):
thinking_mode: ThinkingMode = Field(strict=False)
max_tokens: int | None
max_prompt_images: int | None
- prompting_target: PromptingTarget | None = Field(default=None, strict=False)
listed_constraints: list[ListedConstraint] = Field(default_factory=empty_list_factory_of(ListedConstraint))
valued_constraints: dict[ValuedConstraint, Any] = Field(default_factory=empty_dict_factory_of(ValuedConstraint))
extra_headers: dict[str, str] | None = None
diff --git a/pipelex/cogt/model_backends/model_spec_factory.py b/pipelex/cogt/model_backends/model_spec_factory.py
index b9298cc47..a7b3e03f2 100644
--- a/pipelex/cogt/model_backends/model_spec_factory.py
+++ b/pipelex/cogt/model_backends/model_spec_factory.py
@@ -8,7 +8,6 @@ from pipelex.cogt.llm.thinking_mode import ThinkingMode
from pipelex.cogt.model_backends.constraints import ListedConstraint, ValuedConstraint
from pipelex.cogt.model_backends.model_spec import InferenceModelSpec
from pipelex.cogt.model_backends.model_type import ModelType
-from pipelex.cogt.model_backends.prompting_target import PromptingTarget
from pipelex.cogt.usage.cost_category import CostCategory, CostsByCategoryDict
from pipelex.system.configuration.config_model import ConfigModel
from pipelex.tools.typing.pydantic_utils import empty_dict_factory_of, empty_list_factory_of
@@ -29,7 +28,6 @@ class InferenceModelSpecBlueprint(ConfigModel):
thinking_mode: ThinkingMode = Field(default=ThinkingMode.NONE, strict=False)
max_tokens: int | None = None
max_prompt_images: int | None = None
- prompting_target: PromptingTarget | None = Field(default=None, strict=False)
listed_constraints: list[ListedConstraint] = Field(default_factory=empty_list_factory_of(ListedConstraint))
valued_constraints: dict[ValuedConstraint, Any] = Field(default_factory=empty_dict_factory_of(ValuedConstraint))
rules: ImgGenModelRules | None = None
@@ -105,7 +103,6 @@ class InferenceModelSpecFactory(BaseModel):
thinking_mode=blueprint.thinking_mode,
max_tokens=blueprint.max_tokens,
max_prompt_images=blueprint.max_prompt_images,
- prompting_target=blueprint.prompting_target,
listed_constraints=merged_listed_constraints,
valued_constraints=merged_valued_constraints,
extra_headers=extra_headers,
diff --git a/pipelex/cogt/model_backends/prompting_target.py b/pipelex/cogt/model_backends/prompting_target.py
deleted file mode 100644
index 8ff40a10f..000000000
--- a/pipelex/cogt/model_backends/prompting_target.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from enum import StrEnum
-
-
-class PromptingTarget(StrEnum):
- OPENAI = "openai"
- ANTHROPIC = "anthropic"
- MISTRAL = "mistral"
- GEMINI = "gemini"
- FAL = "fal"
diff --git a/pipelex/kernel/compose_ops.py b/pipelex/kernel/compose_ops.py
index c824b8cc7..d89a27422 100644
--- a/pipelex/kernel/compose_ops.py
+++ b/pipelex/kernel/compose_ops.py
@@ -69,13 +69,18 @@ async def run_compose_template(
category: TemplateCategory,
concept: Concept,
output_class: type[StuffContent],
- templating_style: TemplatingStyle | None = None,
+ templating_style: TemplatingStyle,
runtime_params: dict[str, Any] | None = None,
extra_context: dict[str, Any] | None = None,
result_name: str | None = None,
result_code: str | None = None,
) -> ComposeResult:
- """A whole compose step over a template: build the context, render, wrap, store, report."""
+ """A whole compose step over a template: build the context, render, wrap, store, report.
+
+ `templating_style` is required rather than nullable: a composed template can tag its inputs like
+ any prompt does, and the filters that do it have no default of their own. The caller resolves what
+ the step authored against the runtime default.
+ """
rendered_text = await render_template(
template=template,
category=category,
diff --git a/pipelex/kernel/img_gen_prompt.py b/pipelex/kernel/img_gen_prompt.py
index 90c33eae9..e4f720405 100644
--- a/pipelex/kernel/img_gen_prompt.py
+++ b/pipelex/kernel/img_gen_prompt.py
@@ -33,6 +33,7 @@ from pipelex.tools.jinja2.jinja2_models import Jinja2ContextKey
from pipelex.tools.misc.context_provider_abstract import ContextProviderAbstract
from pipelex.tools.misc.dict_utils import substitute_nested_in_context
from pipelex.tools.misc.exceptions import ContextProviderError
+from pipelex.tools.templating.templating_style import TemplatingStyle
if TYPE_CHECKING:
from pipelex.cogt.image.prompt_image import PromptImage
@@ -41,6 +42,7 @@ if TYPE_CHECKING:
async def assemble_img_gen_prompt(
*,
context_provider: ContextProviderAbstract,
+ templating_style: TemplatingStyle,
prompt_blueprint: TemplateBlueprint | None = None,
negative_prompt_blueprint: TemplateBlueprint | None = None,
image_references: list[ImageReference] | None = None,
@@ -48,9 +50,12 @@ async def assemble_img_gen_prompt(
) -> ImgGenPrompt:
"""Build an `ImgGenPrompt`: resolve image references, render the templates, collect the images.
- `context_provider` is typically the `WorkingMemory` the step runs against. Raises
- `PromptContentError` when an image reference names something the context does not hold, or holds
- as the wrong type.
+ `context_provider` is typically the `WorkingMemory` the step runs against. `templating_style` is
+ required for the reason `assemble_llm_prompt` states: an image prompt is a prompt, so it renders
+ under a style the caller resolved rather than under whatever a filter would have defaulted to.
+
+ Raises `PromptContentError` when an image reference names something the context does not hold, or
+ holds as the wrong type.
"""
image_registry = ImageRegistry()
# Maps image variable name to its 0-based registry index (for placeholder generation)
@@ -91,6 +96,7 @@ async def assemble_img_gen_prompt(
if prompt_blueprint:
positive_text = await _render_text(
context_provider=context_provider,
+ templating_style=templating_style,
template_blueprint=prompt_blueprint,
extra_params=extra_params,
image_registry=image_registry,
@@ -100,6 +106,7 @@ async def assemble_img_gen_prompt(
if negative_prompt_blueprint:
negative_text = await _render_text(
context_provider=context_provider,
+ templating_style=templating_style,
template_blueprint=negative_prompt_blueprint,
extra_params=extra_params,
image_registry=image_registry,
@@ -226,10 +233,15 @@ async def _render_text(
*,
context_provider: ContextProviderAbstract,
template_blueprint: TemplateBlueprint,
+ templating_style: TemplatingStyle,
extra_params: dict[str, Any] | None = None,
image_registry: ImageRegistry | None = None,
) -> str:
"""Render a template with context and optional image registry."""
+ # A style declared on the blueprint wins over the resolved one — the same precedence
+ # `_unravel_text` applies on the LLM path, and kept as a local for the same reason.
+ effective_style = template_blueprint.templating_style or templating_style
+
context: dict[str, Any] = context_provider.generate_context()
if extra_params:
context = substitute_nested_in_context(context=context, extra_params=extra_params)
@@ -246,6 +258,6 @@ async def _render_text(
template=template_blueprint.template,
category=template_blueprint.category,
context=context,
- templating_style=template_blueprint.templating_style,
+ templating_style=effective_style,
finalize=finalize,
)
diff --git a/pipelex/kernel/llm_ops.py b/pipelex/kernel/llm_ops.py
index 02bec7488..ea67c4083 100644
--- a/pipelex/kernel/llm_ops.py
+++ b/pipelex/kernel/llm_ops.py
@@ -1,4 +1,4 @@
-"""LLM operator semantics: deck resolution, style derivation, generation, memory write-back.
+"""LLM operator semantics: deck resolution, generation, memory write-back.
These are the functions the interpreter's `PipeLLM` and `PipeStructure` call, and the ones a
programmatic caller invokes on a `RuntimeBoot`-only process. They read the runtime hub for the
@@ -23,7 +23,6 @@ from pipelex.cogt.content_generation.cogt_run_params import CogtRunParams
from pipelex.cogt.exceptions import ModelChoiceNotFoundError
from pipelex.cogt.llm.llm_prompt import LLMPrompt
from pipelex.cogt.llm.llm_setting import LLMModelChoice, LLMSetting
-from pipelex.cogt.model_backends.model_type import ModelType
from pipelex.cogt.models.model_reference import ModelReferenceKind, ensure_model_reference
from pipelex.cogt.templating.template_rendering import render_template
from pipelex.config import get_config
@@ -108,28 +107,16 @@ def concrete_llm_model_handle(model: str) -> str:
return current
-def derive_templating_style(*, llm_setting: LLMSetting) -> TemplatingStyle | None:
- """The configured prompting style for a resolved setting, via its prompting target.
-
- Derived per call and never cached: the deck and the config can both change under a live process,
- and a cached style would shadow that with whatever the first call saw.
-
- Returns `None` when the deck has no inference model for the handle, which is what an external
- LLM plugin looks like from here — the model is real, it is just not in the deck.
- """
- inference_model = get_model_deck().get_optional_inference_model(model_handle=llm_setting.model, model_type=ModelType.LLM)
- if inference_model is None:
- return None
- prompting_target = llm_setting.prompting_target or inference_model.prompting_target
- return get_config().pipelex.prompting_config.get_prompting_style(prompting_target=prompting_target)
-
-
-async def derive_structure_prompt(*, output_class: type[StuffContent]) -> str | None:
+async def derive_structure_prompt(*, output_class: type[StuffContent], templating_style: TemplatingStyle) -> str | None:
"""Render the structure-description prompt for an output class.
Derived from the class in hand — no concept-to-class registry hop, because the caller already
holds the class. Returns `None` when structure prompts are disabled in config, or when the class
has no printable structure (a bare text content has none).
+
+ It renders under a style like every other prompt fragment: the shipped template uses no tagging
+ filter, but the template is config-editable, and one that reached this render style-less could
+ not use one at all.
"""
llm_config = get_config().cogt.llm_config
if not llm_config.is_structure_prompt_enabled:
@@ -141,6 +128,7 @@ async def derive_structure_prompt(*, output_class: type[StuffContent]) -> str |
template=llm_config.get_template(template_name="output_structure_prompt"),
category=TemplateCategory.LLM_PROMPT,
context={"class_structure_str": "\n".join(class_structure)},
+ templating_style=templating_style,
)
@@ -193,16 +181,15 @@ async def run_llm_text(
output_class: type[StuffContent],
job_metadata: JobMetadata,
cogt_run_params: CogtRunParams,
- templating_style: TemplatingStyle | None = None,
+ templating_style: TemplatingStyle,
extra_params: dict[str, Any] | None = None,
result_name: str | None = None,
result_code: str | None = None,
) -> LlmTextResult:
"""A whole LLM step with a text output: assemble, generate, store, report.
- `templating_style` is an argument rather than derived here because a caller may hold more than
- one resolved setting for a step and has to say which one governs rendering — `PipeLLM` derives
- it from its text setting even on its object path.
+ `templating_style` is an argument because the style is an authoring decision the caller holds —
+ what the step declared, resolved against the runtime default — not something derivable here.
"""
llm_prompt = await assemble_llm_prompt(
prompt_content=prompt_content,
@@ -243,7 +230,7 @@ async def run_llm_object(
structure_prompt: str | None = None,
is_multiple_output: bool = False,
fixed_nb_output: int | None = None,
- templating_style: TemplatingStyle | None = None,
+ templating_style: TemplatingStyle,
extra_params: dict[str, Any] | None = None,
result_name: str | None = None,
result_code: str | None = None,
@@ -255,7 +242,11 @@ async def run_llm_object(
same prompt by default — a prompt supplied only from outside would have left the derivation at
each caller and let the two defaults fork.
"""
- output_structure_prompt = structure_prompt if structure_prompt is not None else await derive_structure_prompt(output_class=output_class)
+ output_structure_prompt = (
+ structure_prompt
+ if structure_prompt is not None
+ else await derive_structure_prompt(output_class=output_class, templating_style=templating_style)
+ )
llm_prompt = await assemble_llm_prompt(
prompt_content=prompt_content,
context_provider=memory,
diff --git a/pipelex/kernel/llm_prompt_content.py b/pipelex/kernel/llm_prompt_content.py
index 26dfce734..82c34283d 100644
--- a/pipelex/kernel/llm_prompt_content.py
+++ b/pipelex/kernel/llm_prompt_content.py
@@ -72,7 +72,7 @@ async def assemble_llm_prompt(
context_provider: ContextProviderAbstract,
output_structure_prompt: str | None = None,
extra_params: dict[str, Any] | None = None,
- templating_style: TemplatingStyle | None = None,
+ templating_style: TemplatingStyle,
) -> LLMPrompt:
"""Render both templates against the context and collect the images and documents they reference."""
############################################################
@@ -380,7 +380,7 @@ async def _unravel_text(
jinja2_blueprint: TemplateBlueprint,
extra_params: dict[str, Any] | None = None,
image_registry: ImageRegistry | None = None,
- templating_style: TemplatingStyle | None = None,
+ templating_style: TemplatingStyle,
) -> str:
# A style declared on the blueprint wins over the run-derived one. Kept as a local: writing
# it onto `jinja2_blueprint` would mutate an object the pipe library holds and hands out.
diff --git a/pipelex/kernel/pipelex_kernel.py b/pipelex/kernel/pipelex_kernel.py
index fde22aede..3264150e9 100644
--- a/pipelex/kernel/pipelex_kernel.py
+++ b/pipelex/kernel/pipelex_kernel.py
@@ -45,7 +45,6 @@ from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.stuffs.stuff_content import StuffContent
from pipelex.core.stuffs.text_content import TextContent
from pipelex.kernel.llm_ops import (
- derive_templating_style,
resolve_llm_setting_for_object,
resolve_llm_setting_for_text,
run_llm_object,
@@ -53,10 +52,12 @@ from pipelex.kernel.llm_ops import (
)
from pipelex.kernel.llm_prompt_content import LlmPromptContent
from pipelex.kernel.llm_results import LlmObjectResult, LlmTextResult
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.runtime_hub import resolve_run_mode_for_boot
from pipelex.system.job_metadata import JobMetadata
from pipelex.system.pipe_run_mode import PipeRunMode
from pipelex.system.trace_context import TraceContext
+from pipelex.tools.templating.templating_style import TemplatingStyle
def _mint_step_id() -> str:
@@ -161,6 +162,7 @@ class PipelexKernel:
system: str | None = None,
concept: Concept | None = None,
output_class: type[StuffContent] | None = None,
+ templating_style: TemplatingStyle | None = None,
result: str,
) -> LlmTextResult:
"""The semantics of an LLM step with a Text output.
@@ -178,6 +180,9 @@ class PipelexKernel:
step and anything reading the result back raises `StuffContentTypeError`. Omitting `model`
is the ordinary authored case, not an edge one — it defers to the deck exactly as a `$preset`
does. `llm_object` below has taken all three from the start; this is the same convenience.
+
+ `templating_style` is the same authoring decision a `PipeLLM` declares; omitting it takes the
+ runtime default, exactly as an authored pipe that declares nothing does.
"""
llm_setting = resolve_llm_setting_for_text(llm_choice=model)
return await run_llm_text(
@@ -188,7 +193,7 @@ class PipelexKernel:
output_class=output_class or TextContent,
job_metadata=self.make_step_metadata(),
cogt_run_params=self.cogt_run_params,
- templating_style=derive_templating_style(llm_setting=llm_setting),
+ templating_style=resolve_templating_style(authored=templating_style),
result_name=result,
)
@@ -202,6 +207,7 @@ class PipelexKernel:
user: str,
system: str | None = None,
structure_prompt: str | None = None,
+ templating_style: TemplatingStyle | None = None,
result: str,
is_multiple_output: bool = False,
fixed_nb_output: int | None = None,
@@ -213,16 +219,8 @@ class PipelexKernel:
from `output_class` by default; pass `structure_prompt` to override it. As with `llm_text`,
prompts carrying image or document references go through `run_llm_object` directly.
- **One `model`, and it carries the interpreter's *text*-choice semantics for templating.** A
- `PipeLLM` can name two models (`model` → for_text, `model_to_structure` → for_object) and
- derives the prompting style from the text one. Here the single explicit choice wins
- `resolve_llm_setting_for_object`'s first rung, so the style comes from that same setting —
- which is what an interpreted run derives for a pipe naming only a text model. The two agree
- for every call this form can express; a pipe naming *both* is what it cannot express, and
- that is deliberate. Do not "fix" this by deriving the style from an object-only resolution:
- that would introduce the divergence rather than close it. The whole model-derived-style
- mechanism is slated for replacement by an explicit caller-chosen style — see
- `wip/prompting-style/README.md`.
+ `templating_style` is the same authoring decision a `PipeLLM` declares; omitting it takes the
+ runtime default, exactly as an authored pipe that declares nothing does.
"""
llm_setting = resolve_llm_setting_for_object(llm_choice=model)
return await run_llm_object(
@@ -236,6 +234,6 @@ class PipelexKernel:
structure_prompt=structure_prompt,
is_multiple_output=is_multiple_output,
fixed_nb_output=fixed_nb_output,
- templating_style=derive_templating_style(llm_setting=llm_setting),
+ templating_style=resolve_templating_style(authored=templating_style),
result_name=result,
)
diff --git a/pipelex/kernel/search_ops.py b/pipelex/kernel/search_ops.py
index 01be4bef2..ed0a8c795 100644
--- a/pipelex/kernel/search_ops.py
+++ b/pipelex/kernel/search_ops.py
@@ -23,6 +23,7 @@ from pipelex.kernel.search_results import SearchResult
from pipelex.runtime_hub import get_content_generator, get_model_deck
from pipelex.system.job_metadata import JobMetadata
from pipelex.tools.jinja2.template_category import TemplateCategory
+from pipelex.tools.templating.templating_style import TemplatingStyle
def resolve_search_setting(
@@ -61,6 +62,7 @@ async def run_search(
concept: Concept,
job_metadata: JobMetadata,
cogt_run_params: CogtRunParams,
+ templating_style: TemplatingStyle,
output_structure_class: type[StuffContent] | None = None,
include_domains: list[str] | None = None,
exclude_domains: list[str] | None = None,
@@ -72,8 +74,10 @@ async def run_search(
"""A whole search step: render the query, search, store, report.
The query template arrives as source plus category rather than as a `TemplateBlueprint`, the way
- `run_compose_template` takes it: a search renders against memory alone, with no style and no extra
- context, so a blueprint would hand over two fields this function has nothing to do with.
+ `run_compose_template` takes it: a search renders against memory alone, with no extra context, so
+ a blueprint would hand over a field this function has nothing to do with. The style is not that
+ field — it is passed explicitly, because a query template can tag its inputs like any other and
+ the filters that do it have no default of their own.
The search itself goes through the same content-generation seam as the LLM, image-generation and
extract leaves — direct inline, an activity when in-workflow, or a dry mock — which is what makes
@@ -84,6 +88,7 @@ async def run_search(
template=template,
category=category,
context=memory.generate_context(),
+ templating_style=templating_style,
)
search_assignment = SearchAssignment(
job_metadata=job_metadata,
diff --git a/pipelex/kernel/templating_style_ops.py b/pipelex/kernel/templating_style_ops.py
new file mode 100644
index 000000000..9995afde9
--- /dev/null
+++ b/pipelex/kernel/templating_style_ops.py
@@ -0,0 +1,15 @@
+"""Templating-style semantics: how a pipe's inputs are tagged into a prompt.
+
+One function, and its totality is the point: every prompt-rendering entry point resolves a style
+here, so nothing downstream has to carry a `None` and invent a fallback for it. Two levels only —
+what the pipe authored, else the runtime default from config. No model metadata, no deck, no
+credentials: a style is an authoring decision, not a property of whichever model happens to run.
+"""
+
+from pipelex.config import get_config
+from pipelex.tools.templating.templating_style import TemplatingStyle
+
+
+def resolve_templating_style(*, authored: TemplatingStyle | None) -> TemplatingStyle:
+ """The style a prompt renders under: the authored one, else the configured default."""
+ return authored or get_config().pipelex.templating_config.default_templating_style
diff --git a/pipelex/kit/configs/inference/backends/anthropic.toml b/pipelex/kit/configs/inference/backends/anthropic.toml
index 41ec5e603..1e00088a1 100644
--- a/pipelex/kit/configs/inference/backends/anthropic.toml
+++ b/pipelex/kit/configs/inference/backends/anthropic.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "anthropic"
-prompting_target = "anthropic"
structure_method = "instructor/anthropic_tools"
thinking_mode = "manual"
diff --git a/pipelex/kit/configs/inference/backends/azure_openai.toml b/pipelex/kit/configs/inference/backends/azure_openai.toml
index 8e67a88c0..5258545b0 100644
--- a/pipelex/kit/configs/inference/backends/azure_openai.toml
+++ b/pipelex/kit/configs/inference/backends/azure_openai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "azure_openai_responses"
-prompting_target = "openai"
structure_method = "instructor/openai_responses_tools"
thinking_mode = "none"
diff --git a/pipelex/kit/configs/inference/backends/bedrock.toml b/pipelex/kit/configs/inference/backends/bedrock.toml
index a85d382b2..4a6ac6bf9 100644
--- a/pipelex/kit/configs/inference/backends/bedrock.toml
+++ b/pipelex/kit/configs/inference/backends/bedrock.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "bedrock_aioboto3"
-prompting_target = "anthropic"
thinking_mode = "none"
################################################################################
diff --git a/pipelex/kit/configs/inference/backends/fal.toml b/pipelex/kit/configs/inference/backends/fal.toml
index 2a4d03e12..d8dc03f68 100644
--- a/pipelex/kit/configs/inference/backends/fal.toml
+++ b/pipelex/kit/configs/inference/backends/fal.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "img_gen"
sdk = "fal"
-prompting_target = "fal"
thinking_mode = "none"
################################################################################
diff --git a/pipelex/kit/configs/inference/backends/google.toml b/pipelex/kit/configs/inference/backends/google.toml
index bfa5a5cc5..5c93038ac 100644
--- a/pipelex/kit/configs/inference/backends/google.toml
+++ b/pipelex/kit/configs/inference/backends/google.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "google"
-prompting_target = "gemini"
structure_method = "instructor/genai_tools"
thinking_mode = "manual"
diff --git a/pipelex/kit/configs/inference/backends/minimax.toml b/pipelex/kit/configs/inference/backends/minimax.toml
index 583380254..2f4998a8a 100644
--- a/pipelex/kit/configs/inference/backends/minimax.toml
+++ b/pipelex/kit/configs/inference/backends/minimax.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "anthropic"
-prompting_target = "anthropic"
structure_method = "instructor/anthropic_tools"
thinking_mode = "manual"
max_tokens = 16384
diff --git a/pipelex/kit/configs/inference/backends/mistral.toml b/pipelex/kit/configs/inference/backends/mistral.toml
index 1de55d3a5..f4866ac56 100644
--- a/pipelex/kit/configs/inference/backends/mistral.toml
+++ b/pipelex/kit/configs/inference/backends/mistral.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "mistral"
-prompting_target = "mistral"
structure_method = "instructor/mistral_tools"
thinking_mode = "none"
diff --git a/pipelex/kit/configs/inference/backends/ollama.toml b/pipelex/kit/configs/inference/backends/ollama.toml
index 3e020a84e..3828f43da 100644
--- a/pipelex/kit/configs/inference/backends/ollama.toml
+++ b/pipelex/kit/configs/inference/backends/ollama.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai"
-prompting_target = "anthropic"
structure_method = "instructor/openai_tools"
thinking_mode = "none"
diff --git a/pipelex/kit/configs/inference/backends/openai.toml b/pipelex/kit/configs/inference/backends/openai.toml
index b75142169..12684a75d 100644
--- a/pipelex/kit/configs/inference/backends/openai.toml
+++ b/pipelex/kit/configs/inference/backends/openai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai_responses"
-prompting_target = "openai"
structure_method = "instructor/openai_responses_tools"
thinking_mode = "none"
diff --git a/pipelex/kit/configs/inference/backends/portkey.toml b/pipelex/kit/configs/inference/backends/portkey.toml
index 796de3a90..e17965a09 100644
--- a/pipelex/kit/configs/inference/backends/portkey.toml
+++ b/pipelex/kit/configs/inference/backends/portkey.toml
@@ -23,7 +23,6 @@
model_type = "llm"
sdk = "portkey_completions"
structure_method = "instructor/openai_tools"
-prompting_target = "anthropic"
thinking_mode = "none"
################################################################################
@@ -265,7 +264,6 @@ outputs = ["text", "structured"]
max_prompt_images = 3000
costs = { input = 1.25, output = 10.0 }
thinking_mode = "manual"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-2.5-flash"]
@@ -274,7 +272,6 @@ inputs = ["text", "images", "pdf"]
outputs = ["text", "structured"]
costs = { input = 0.30, output = 2.50 }
thinking_mode = "manual"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-2.5-flash-lite"]
@@ -283,7 +280,6 @@ inputs = ["text", "images", "pdf"]
outputs = ["text", "structured"]
costs = { input = 0.10, output = 0.40 }
thinking_mode = "manual"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-3.1-pro"]
@@ -293,7 +289,6 @@ outputs = ["text", "structured"]
max_prompt_images = 3000
costs = { input = 2, output = 12.0 }
thinking_mode = "adaptive"
-prompting_target = "gemini"
x-portkey-provider = "@google"
["gemini-3.0-flash"]
@@ -303,5 +298,4 @@ outputs = ["text", "structured"]
max_prompt_images = 3000
costs = { input = 0.5, output = 3.0 }
thinking_mode = "adaptive"
-prompting_target = "gemini"
x-portkey-provider = "@google"
diff --git a/pipelex/kit/configs/inference/backends/vertexai.toml b/pipelex/kit/configs/inference/backends/vertexai.toml
index fe89dc8ce..c65f76335 100644
--- a/pipelex/kit/configs/inference/backends/vertexai.toml
+++ b/pipelex/kit/configs/inference/backends/vertexai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai"
-prompting_target = "gemini"
structure_method = "instructor/vertexai_tools"
thinking_mode = "none"
diff --git a/pipelex/kit/configs/inference/backends/xai.toml b/pipelex/kit/configs/inference/backends/xai.toml
index a6348f202..402529979 100644
--- a/pipelex/kit/configs/inference/backends/xai.toml
+++ b/pipelex/kit/configs/inference/backends/xai.toml
@@ -23,7 +23,6 @@
[defaults]
model_type = "llm"
sdk = "openai"
-prompting_target = "anthropic"
structure_method = "instructor/openai_tools"
thinking_mode = "none"
diff --git a/pipelex/mthds_parsing/bundle_elaborator.py b/pipelex/mthds_parsing/bundle_elaborator.py
index e0681af2b..33b10b176 100644
--- a/pipelex/mthds_parsing/bundle_elaborator.py
+++ b/pipelex/mthds_parsing/bundle_elaborator.py
@@ -143,6 +143,8 @@ class BundleElaborator:
# --- step 1: PipeLLM that produces a single Text draft ---
# Image variables on the original prompt naturally flow only here, since step-2's prompt
# template is the canned `structuring_prompt` which references only `{{ text }}`.
+ # This step renders the author's own prompt, so it carries the author's declared style too:
+ # dropping it here would silently re-render that prompt under the runtime default.
draft_blueprint = PipeLLMBlueprint(
type="PipeLLM",
pipe_category="PipeOperator",
@@ -154,6 +156,7 @@ class BundleElaborator:
model=pipe_blueprint.model,
model_to_structure=None,
structuring_method=None,
+ templating_style=pipe_blueprint.templating_style,
)
# --- step 2: PipeStructure that turns the draft Text into the original structured output ---
diff --git a/pipelex/pipe_operators/compose/pipe_compose.py b/pipelex/pipe_operators/compose/pipe_compose.py
index b81ffe652..2336a0689 100644
--- a/pipelex/pipe_operators/compose/pipe_compose.py
+++ b/pipelex/pipe_operators/compose/pipe_compose.py
@@ -17,6 +17,7 @@ from pipelex.core.stuffs.stuff_content import StuffContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_concept_library, get_native_concept
from pipelex.kernel.compose_ops import run_compose_template
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.template_guard_lint import lint_optional_input_guards
from pipelex.pipe_operators.compose.construct_blueprint import ConstructBlueprint
from pipelex.pipe_operators.compose.exceptions import PipeComposeError, StructuredContentComposerValueError
@@ -58,7 +59,7 @@ class PipeCompose(PipeOperator[PipeComposeOutput]):
if self.is_construct_mode:
return f"PipeCompose in construct mode for StructuredContent output of type '{self.output.concept.structure_class_name}'"
else:
- return f"PipeCompose in template mode with Jinja2 template, prompting style {self.templating_style}, category {self.category}"
+ return f"PipeCompose in template mode with Jinja2 template, templating style {self.templating_style}, category {self.category}"
@override
def required_variables(self) -> set[str]:
@@ -203,7 +204,7 @@ class PipeCompose(PipeOperator[PipeComposeOutput]):
category=self.category,
concept=self.output.concept,
output_class=structure_class,
- templating_style=self.templating_style,
+ templating_style=resolve_templating_style(authored=self.templating_style),
runtime_params=pipe_run_params.params,
extra_context=self.extra_context,
result_name=output_name,
@@ -247,6 +248,7 @@ class PipeCompose(PipeOperator[PipeComposeOutput]):
construct_blueprint=self.construct_blueprint,
working_memory=working_memory,
output_class=output_class,
+ templating_style=resolve_templating_style(authored=self.templating_style),
runtime_params=pipe_run_params.params if pipe_run_params else None,
extra_context=self.extra_context,
)
diff --git a/pipelex/pipe_operators/compose/structured_content_composer.py b/pipelex/pipe_operators/compose/structured_content_composer.py
index 531bc30d7..5945d8b73 100644
--- a/pipelex/pipe_operators/compose/structured_content_composer.py
+++ b/pipelex/pipe_operators/compose/structured_content_composer.py
@@ -22,6 +22,7 @@ from pipelex.pipe_operators.compose.exceptions import (
StructuredContentComposerValueError,
)
from pipelex.tools.jinja2.template_category import TemplateCategory
+from pipelex.tools.templating.templating_style import TemplatingStyle
from pipelex.tools.typing.annotation_utils import unwrap_optional
from pipelex.tools.typing.class_utils import are_classes_equivalent
from pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error
@@ -67,12 +68,14 @@ class StructuredContentComposer:
construct_blueprint: ConstructBlueprint,
working_memory: WorkingMemory,
output_class: type[StuffContent],
+ templating_style: TemplatingStyle,
runtime_params: dict[str, Any] | None = None,
extra_context: dict[str, Any] | None = None,
):
self.construct_blueprint = construct_blueprint
self.working_memory = working_memory
self.output_class = output_class
+ self.templating_style = templating_style
self.runtime_params = runtime_params or {}
self.extra_context = extra_context or {}
# Per-field record of how each field was built. Populated as fields resolve.
@@ -790,6 +793,7 @@ class StructuredContentComposer:
return await render_template(
template=field_blueprint.template,
category=TemplateCategory.BASIC,
+ templating_style=self.templating_style,
context=build_compose_context(
memory=self.working_memory,
runtime_params=self.runtime_params,
@@ -819,6 +823,7 @@ class StructuredContentComposer:
construct_blueprint=field_blueprint.nested,
working_memory=self.working_memory,
output_class=nested_class,
+ templating_style=self.templating_style,
runtime_params=self.runtime_params,
extra_context=self.extra_context,
)
diff --git a/pipelex/pipe_operators/img_gen/img_gen_prompt_blueprint.py b/pipelex/pipe_operators/img_gen/img_gen_prompt_blueprint.py
index 5bf13acd5..bad40d835 100644
--- a/pipelex/pipe_operators/img_gen/img_gen_prompt_blueprint.py
+++ b/pipelex/pipe_operators/img_gen/img_gen_prompt_blueprint.py
@@ -18,6 +18,7 @@ from pipelex.kernel.prompt_references import ImageReference
from pipelex.pipe_operators.img_gen.exceptions import PipeImgGenFactoryError
from pipelex.tools.misc.context_provider_abstract import ContextProviderAbstract
from pipelex.tools.misc.string_utils import get_root_from_dotted_path
+from pipelex.tools.templating.templating_style import TemplatingStyle
class ImgGenPromptBlueprint(BaseModel):
@@ -59,6 +60,7 @@ class ImgGenPromptBlueprint(BaseModel):
self,
*,
context_provider: ContextProviderAbstract,
+ templating_style: TemplatingStyle,
extra_params: dict[str, Any] | None = None,
max_prompt_images: int | None = None,
) -> ImgGenPrompt:
@@ -69,6 +71,7 @@ class ImgGenPromptBlueprint(BaseModel):
"""
img_gen_prompt = await assemble_img_gen_prompt(
context_provider=context_provider,
+ templating_style=templating_style,
prompt_blueprint=self.prompt_blueprint,
negative_prompt_blueprint=self.negative_prompt_blueprint,
image_references=self.image_references,
diff --git a/pipelex/pipe_operators/img_gen/pipe_img_gen.py b/pipelex/pipe_operators/img_gen/pipe_img_gen.py
index e579692d0..d5df044c0 100644
--- a/pipelex/pipe_operators/img_gen/pipe_img_gen.py
+++ b/pipelex/pipe_operators/img_gen/pipe_img_gen.py
@@ -21,6 +21,7 @@ from pipelex.core.stuffs.image_content import ImageContent
from pipelex.interpreter_hub import get_concept_library, get_native_concept
from pipelex.kernel.exceptions import PromptContentError
from pipelex.kernel.img_gen_ops import build_img_gen_job_params, resolve_img_gen_setting, run_img_gen
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.template_guard_lint import lint_optional_input_guards
from pipelex.pipe_operators.img_gen.exceptions import PipeImgGenFactoryError, PipeImgGenRunError
from pipelex.pipe_operators.img_gen.img_gen_prompt_blueprint import ImgGenPromptBlueprint
@@ -175,6 +176,9 @@ class PipeImgGen(PipeOperator[PipeImgGenOutput]):
try:
img_gen_prompt = await self.img_gen_prompt_blueprint.make_img_gen_prompt(
context_provider=working_memory,
+ # No authored style on this operator: an image prompt takes the runtime default, the
+ # same one an LLM pipe that declares nothing gets.
+ templating_style=resolve_templating_style(authored=None),
extra_params=pipe_run_params.params,
max_prompt_images=max_prompt_images,
)
diff --git a/pipelex/pipe_operators/llm/llm_prompt_blueprint.py b/pipelex/pipe_operators/llm/llm_prompt_blueprint.py
index 642b2e994..f31c901dd 100644
--- a/pipelex/pipe_operators/llm/llm_prompt_blueprint.py
+++ b/pipelex/pipe_operators/llm/llm_prompt_blueprint.py
@@ -67,7 +67,7 @@ class LLMPromptBlueprint(BaseModel):
context_provider: ContextProviderAbstract,
output_structure_prompt: str | None = None,
extra_params: dict[str, Any] | None = None,
- templating_style: TemplatingStyle | None = None,
+ templating_style: TemplatingStyle,
) -> LLMPrompt:
llm_prompt = await assemble_llm_prompt(
prompt_content=self.to_prompt_content(),
diff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.py
index 85940e543..64eb41652 100644
--- a/pipelex/pipe_operators/llm/pipe_llm.py
+++ b/pipelex/pipe_operators/llm/pipe_llm.py
@@ -22,12 +22,12 @@ from pipelex.core.stuffs.stuff_content import StuffContent
from pipelex.interpreter_hub import get_concept_library, get_native_concept, get_required_concept
from pipelex.kernel.llm_ops import (
concrete_llm_model_handle,
- derive_templating_style,
resolve_llm_setting_for_object,
resolve_llm_setting_for_text,
run_llm_object,
run_llm_text,
)
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.template_guard_lint import lint_optional_input_guards
from pipelex.pipe_machinery.validation import is_input_used_by_variables, is_variable_satisfied_by_inputs
from pipelex.pipe_operators.llm.llm_prompt_blueprint import LLMPromptBlueprint
@@ -39,6 +39,7 @@ from pipelex.pipe_run.pipe_run_params import (
from pipelex.runtime_hub import get_class_registry
from pipelex.system.job_metadata import JobMetadata
from pipelex.system.pipe_run_param_key import PipeRunParamKey
+from pipelex.tools.templating.templating_style import TemplatingStyle
from pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error
if TYPE_CHECKING:
@@ -55,6 +56,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
llm_prompt_spec: LLMPromptBlueprint
llm_choices: LLMSettingChoices | None = None
output_multiplicity: VariableMultiplicity | None = None
+ templating_style: TemplatingStyle | None = None
@override
def validate_inputs_static(self):
@@ -210,18 +212,16 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
llm_for_text_choice = self.llm_choices.for_text
llm_for_object_choice = self.llm_choices.for_object
- # The deck chain and the style derivation are kernel semantics; the settings are derived per
- # run into locals and never cached onto `self`, because the pipe instance is the one the
- # library holds and hands out — a write-back would make its serialized form depend on run
- # order and shadow any later config/deck change with the first run's value.
+ # The deck chain is kernel semantics; the settings are derived per run into locals and never
+ # cached onto `self`, because the pipe instance is the one the library holds and hands out —
+ # a write-back would make its serialized form depend on run order and shadow any later
+ # config/deck change with the first run's value.
llm_setting_main: LLMSetting = resolve_llm_setting_for_text(llm_choice=llm_for_text_choice)
llm_setting_for_object: LLMSetting = resolve_llm_setting_for_object(
llm_choice=llm_for_object_choice,
llm_choice_for_text=llm_for_text_choice,
)
- # Both paths render under the *text* setting's style: it is the pipe's main model, and the
- # object path differs only in how the answer comes back, not in how the prompt is written.
- templating_style = derive_templating_style(llm_setting=llm_setting_main)
+ templating_style = resolve_templating_style(authored=self.templating_style)
llm_prompt_run_params = PipeRunParams.copy_by_injecting_multiplicity(
pipe_run_params=pipe_run_params,
diff --git a/pipelex/pipe_operators/llm/pipe_llm_blueprint.py b/pipelex/pipe_operators/llm/pipe_llm_blueprint.py
index d97acdb31..101e33bbc 100644
--- a/pipelex/pipe_operators/llm/pipe_llm_blueprint.py
+++ b/pipelex/pipe_operators/llm/pipe_llm_blueprint.py
@@ -16,6 +16,7 @@ from pipelex.tools.jinja2.exceptions import Jinja2DetectVariablesError
from pipelex.tools.jinja2.jinja2_required_variables import detect_jinja2_required_variables
from pipelex.tools.jinja2.template_category import TemplateCategory
from pipelex.tools.misc.string_utils import get_root_from_dotted_path
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
class StructuringMethod(StrEnum):
@@ -43,6 +44,10 @@ class PipeLLMBlueprint(PipeBlueprint):
structuring_method: StructuringMethod | None = None
+ # A bare string is the `tag_style` shorthand; an inline table is the full struct. The factory
+ # widens the string arm, so the union never travels past parsing.
+ templating_style: TagStyle | TemplatingStyle | None = None
+
@model_validator(mode="after")
def validate_preliminary_text_output(self) -> Self:
# Same string-level guard the elaborator runs — surfaced at authoring time so
diff --git a/pipelex/pipe_operators/llm/pipe_llm_factory.py b/pipelex/pipe_operators/llm/pipe_llm_factory.py
index cde624dcc..f1dbbc209 100644
--- a/pipelex/pipe_operators/llm/pipe_llm_factory.py
+++ b/pipelex/pipe_operators/llm/pipe_llm_factory.py
@@ -18,6 +18,7 @@ from pipelex.pipe_operators.llm.template_document_analyzer import TemplateDocume
from pipelex.pipe_operators.shared.template_image_analyzer import TemplateImageAnalyzer
from pipelex.tools.jinja2.exceptions import Jinja2TemplateSyntaxError
from pipelex.tools.jinja2.template_category import TemplateCategory
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
class PipeLLMFactory(PipeFactoryProtocol[PipeLLMBlueprint, PipeLLM]):
@@ -138,6 +139,17 @@ class PipeLLMFactory(PipeFactoryProtocol[PipeLLMBlueprint, PipeLLM]):
multiple_items=output_parse_result.multiplicity if isinstance(output_parse_result.multiplicity, bool) else None,
)
+ # The authored union narrows here: a bare tag style widens into a full style, so the runtime
+ # pipe holds one shape and nothing downstream re-interprets the shorthand.
+ templating_style: TemplatingStyle | None
+ match blueprint.templating_style:
+ case None:
+ templating_style = None
+ case TagStyle():
+ templating_style = TemplatingStyle(tag_style=blueprint.templating_style)
+ case TemplatingStyle():
+ templating_style = blueprint.templating_style
+
return PipeLLM(
domain_code=domain_code,
code=pipe_code,
@@ -147,4 +159,5 @@ class PipeLLMFactory(PipeFactoryProtocol[PipeLLMBlueprint, PipeLLM]):
llm_prompt_spec=llm_prompt_spec,
llm_choices=llm_choices,
output_multiplicity=output_multiplicity,
+ templating_style=templating_style,
)
diff --git a/pipelex/pipe_operators/search/pipe_search.py b/pipelex/pipe_operators/search/pipe_search.py
index f1882d76d..0a4d10219 100644
--- a/pipelex/pipe_operators/search/pipe_search.py
+++ b/pipelex/pipe_operators/search/pipe_search.py
@@ -12,6 +12,7 @@ from pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecs
from pipelex.core.pipes.pipe_output import PipeOutput
from pipelex.interpreter_hub import get_concept_library
from pipelex.kernel.search_ops import resolve_search_setting, run_search
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.template_guard_lint import lint_optional_input_guards
from pipelex.pipe_operators.pipe_operator import PipeOperator
from pipelex.pipe_run.pipe_run_params import PipeRunParams
@@ -114,6 +115,9 @@ class PipeSearch(PipeOperator[PipeSearchOutput]):
concept=self.output.concept,
job_metadata=job_metadata,
cogt_run_params=pipe_run_params.cogt_run_params,
+ # No authored style on this operator: a query template takes the runtime default, the
+ # same one an LLM pipe that declares nothing gets.
+ templating_style=resolve_templating_style(authored=None),
output_structure_class=output_structure_class,
include_domains=self.include_domains,
exclude_domains=self.exclude_domains,
diff --git a/pipelex/pipe_operators/structure/pipe_structure.py b/pipelex/pipe_operators/structure/pipe_structure.py
index 3876262e7..1414e6ab2 100644
--- a/pipelex/pipe_operators/structure/pipe_structure.py
+++ b/pipelex/pipe_operators/structure/pipe_structure.py
@@ -20,6 +20,7 @@ from pipelex.core.stuffs.stuff_content import StuffContent
from pipelex.interpreter_hub import get_concept_library, get_native_concept
from pipelex.kernel.llm_ops import concrete_llm_model_handle, derive_structure_prompt, generate_object_content, resolve_llm_setting_for_object
from pipelex.kernel.memory_ops import store_result
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_operators.pipe_operator import PipeOperator
from pipelex.pipe_run.pipe_run_params import PipeRunParams, output_multiplicity_to_apply
from pipelex.runtime_hub import get_class_registry
@@ -120,12 +121,16 @@ class PipeStructure(PipeOperator[PipeStructureOutput]):
# Render the structuring prompt template against the input text. Prompt *assembly* is not
# shared with PipeLLM: this pipe has no template of its own and no memory-borne references —
# it renders one configured template over one input string.
+ # No authored style on this operator: the structuring prompt takes the runtime default, the
+ # same one an LLM pipe that declares nothing gets.
+ templating_style = resolve_templating_style(authored=None)
llm_config = get_config().cogt.llm_config
structuring_template = llm_config.get_template(template_name="structuring_prompt")
rendered_user_prompt = await render_template(
template=structuring_template,
category=TemplateCategory.LLM_PROMPT,
context={"text": text_str},
+ templating_style=templating_style,
)
content_class: type[StuffContent] = get_class_registry().get_required_subclass(
@@ -134,7 +139,7 @@ class PipeStructure(PipeOperator[PipeStructureOutput]):
)
# Append the schema description, from the same kernel derivation PipeLLM's object path uses.
- output_structure_prompt = await derive_structure_prompt(output_class=content_class)
+ output_structure_prompt = await derive_structure_prompt(output_class=content_class, templating_style=templating_style)
if output_structure_prompt:
rendered_user_prompt += output_structure_prompt
diff --git a/pipelex/pipelex.toml b/pipelex/pipelex.toml
index e646e431b..abaf4f65f 100644
--- a/pipelex/pipelex.toml
+++ b/pipelex/pipelex.toml
@@ -266,17 +266,11 @@ default_page_views_dpi = 72
# in order to test new model integrations or debug issues with the Gateway
####################################################################################################
-# Prompting config
+# Templating config
####################################################################################################
-[pipelex.prompting_config]
-default_prompting_style = { tag_style = "xml" }
-
-[pipelex.prompting_config.prompting_styles]
-openai = { tag_style = "ticks" }
-anthropic = { tag_style = "xml" }
-mistral = { tag_style = "square_brackets" }
-gemini = { tag_style = "xml" }
+[pipelex.templating_config]
+default_templating_style = { tag_style = "xml" }
####################################################################################################
# Pipe run config
diff --git a/pipelex/providers/anthropic/anthropic_llm_worker.py b/pipelex/providers/anthropic/anthropic_llm_worker.py
index c340ab4c0..6092c04f5 100644
--- a/pipelex/providers/anthropic/anthropic_llm_worker.py
+++ b/pipelex/providers/anthropic/anthropic_llm_worker.py
@@ -1,4 +1,4 @@
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING, Any, ClassVar
from anthropic import (
APIConnectionError,
@@ -58,6 +58,9 @@ class _ThinkingParams:
class AnthropicLLMWorker(LLMWorkerAbstract):
+ # Key into cogt.llm_config.effort_to_budget_maps for manual-thinking budget resolution
+ reasoning_budget_family: ClassVar[str] = "anthropic"
+
def __init__(
self,
sdk_instance: Any,
@@ -177,12 +180,8 @@ class AnthropicLLMWorker(LLMWorkerAbstract):
output_config=None,
suppress_temperature=False,
)
- prompting_target = self.inference_model.prompting_target
- if prompting_target is None:
- msg = f"Model '{self.inference_model.desc}' has no prompting_target configured, cannot resolve reasoning budget"
- raise LLMCapabilityError(msg)
budget = get_config().cogt.llm_config.get_reasoning_budget(
- prompting_target=prompting_target,
+ family=self.reasoning_budget_family,
effort=effort,
)
safe_budget = min(budget, max_tokens - 1)
diff --git a/pipelex/providers/google/google_llm_worker.py b/pipelex/providers/google/google_llm_worker.py
index 59445c550..ff97cee05 100644
--- a/pipelex/providers/google/google_llm_worker.py
+++ b/pipelex/providers/google/google_llm_worker.py
@@ -1,5 +1,5 @@
import asyncio
-from typing import TYPE_CHECKING, cast
+from typing import TYPE_CHECKING, ClassVar, cast
import httpx
from google.genai import errors as genai_errors
@@ -36,6 +36,9 @@ if TYPE_CHECKING:
class GoogleLLMWorker(LLMWorkerAbstract):
+ # Key into cogt.llm_config.effort_to_budget_maps for manual-thinking budget resolution
+ reasoning_budget_family: ClassVar[str] = "gemini"
+
def __init__(
self,
sdk_instance: GoogleGenAiClient,
@@ -146,12 +149,8 @@ class GoogleLLMWorker(LLMWorkerAbstract):
if google_level is None:
log.verbose("Google manual thinking disabled (effort mapped to disabled)")
return genai_types.ThinkingConfig(thinking_budget=0)
- prompting_target = self.inference_model.prompting_target
- if prompting_target is None:
- msg = f"Model '{self.inference_model.desc}' has no prompting_target configured, cannot resolve reasoning budget"
- raise LLMCapabilityError(msg)
budget = get_config().cogt.llm_config.get_reasoning_budget(
- prompting_target=prompting_target,
+ family=self.reasoning_budget_family,
effort=effort,
)
if max_tokens is not None:
diff --git a/pipelex/system/configuration/configs.py b/pipelex/system/configuration/configs.py
index 99c936343..90b3186c5 100644
--- a/pipelex/system/configuration/configs.py
+++ b/pipelex/system/configuration/configs.py
@@ -6,7 +6,6 @@ from pydantic import Field, field_validator, model_validator
from pipelex.base_exceptions import PipelexConfigError
from pipelex.cogt.config_cogt import Cogt
-from pipelex.cogt.model_backends.prompting_target import PromptingTarget
from pipelex.graph.graph_config import GraphConfig
from pipelex.language.mthds_config import MthdsConfig
from pipelex.system.configuration.config_model import ConfigModel
@@ -77,14 +76,8 @@ class DryRunConfig(ConfigModel):
return value
-class PromptingConfig(ConfigModel):
- default_prompting_style: TemplatingStyle
- prompting_styles: dict[str, TemplatingStyle]
-
- def get_prompting_style(self, prompting_target: PromptingTarget | None = None) -> TemplatingStyle | None:
- if prompting_target:
- return self.prompting_styles.get(prompting_target, self.default_prompting_style)
- return None
+class TemplatingConfig(ConfigModel):
+ default_templating_style: TemplatingStyle
class ReportingConfig(ConfigModel):
@@ -204,7 +197,7 @@ class Pipelex(ConfigModel):
log_config: LogConfig
aws_config: AwsConfig
- prompting_config: PromptingConfig
+ templating_config: TemplatingConfig
mthds_config: MthdsConfig
dry_run_config: DryRunConfig
diff --git a/pipelex/system/pipelex_service/pipelex_details.py b/pipelex/system/pipelex_service/pipelex_details.py
index 1cd2afd5c..4ebb8a96c 100644
--- a/pipelex/system/pipelex_service/pipelex_details.py
+++ b/pipelex/system/pipelex_service/pipelex_details.py
@@ -2,7 +2,7 @@ import os
from pipelex.tools.misc.hash_utils import hash_sha256
-_DEFAULT_REMOTE_CONFIG_URL = "https://pipelex-config.s3.eu-west-3.amazonaws.com/pipelex_remote_config_11.json"
+_DEFAULT_REMOTE_CONFIG_URL = "https://pipelex-config.s3.eu-west-3.amazonaws.com/pipelex_remote_config_12.json"
REMOTE_CONFIG_URL_ENV_VAR = "PIPELEX_REMOTE_CONFIG_URL"
diff --git a/pipelex/system/runtime.py b/pipelex/system/runtime.py
index 981628061..d8840080a 100644
--- a/pipelex/system/runtime.py
+++ b/pipelex/system/runtime.py
@@ -82,8 +82,6 @@ class ProblemReaction(StrEnum):
class ProblemReactions(BaseModel):
- template_inputs: ProblemReaction
- prompt_templates: ProblemReaction
job: ProblemReaction
@@ -93,8 +91,6 @@ class RuntimeManager(BaseModel):
_worker_mode: WorkerMode | None = None
problem_reactions: ProblemReactions = ProblemReactions(
- template_inputs=ProblemReaction.LOG,
- prompt_templates=ProblemReaction.LOG,
job=ProblemReaction.LOG,
)
diff --git a/pipelex/tools/jinja2/jinja2_filters.py b/pipelex/tools/jinja2/jinja2_filters.py
index b445f23f1..d3952fac5 100644
--- a/pipelex/tools/jinja2/jinja2_filters.py
+++ b/pipelex/tools/jinja2/jinja2_filters.py
@@ -20,9 +20,28 @@ from pipelex.tools.templating.text_format import TextFormat
ALLOWED_FILTERS = ["tag", "format", "default", "escape_script_tag", "with_images"]
+def require_templating_style_value(*, context: Context, jinja2_context_key: Jinja2ContextKey) -> str:
+ """Read a templating-style key out of the render context, or fail loudly.
+
+ Deliberately without a fallback: every prompt-rendering entry point resolves a templating style
+ before rendering, so a missing key means the render was set up without one. A default here would
+ silently change the shape of a prompt — which is exactly how a triple-backtick style used to
+ reach prompts nobody had chosen it for.
+ """
+ value = context.get(jinja2_context_key)
+ if value is None:
+ msg = (
+ f"No templating style in the render context: '{jinja2_context_key}' is missing. "
+ "The tag, format and with_images filters have no default to fall back on — the caller "
+ "must resolve a templating style and pass it to the render call."
+ )
+ raise Jinja2ContextError(msg)
+ return str(value)
+
+
# Filter to format some Stuff or any object with the appropriate text formatting methods
@pass_context
-async def text_format(context: Context, value: Any, text_format: TextFormat | None = None) -> Any:
+async def text_format(context: Context, value: Any, text_format: TextFormat | str | None = None) -> Any:
# Check if this is a registered image - use placeholder instead of rendering as text
# This handles $page.page_view syntax where the format filter would otherwise call rendered_plain() → URL
registry = context.get(Jinja2ContextKey.IMAGE_REGISTRY)
@@ -31,16 +50,18 @@ async def text_format(context: Context, value: Any, text_format: TextFormat | No
if placeholder is not None:
return placeholder
+ applied_text_format: TextFormat
if text_format:
- if isinstance(text_format, str): # pyright: ignore[reportUnnecessaryIsInstance]
+ # A template can name its own format — `{{ x | format("markdown") }}` — and Jinja2 hands the
+ # argument over as a raw string, so both that and a `TextFormat` member normalise here. An
+ # unknown name is a template error, reported as one rather than as a bare `ValueError`.
+ try:
applied_text_format = TextFormat(text_format)
- elif isinstance(text_format, TextFormat): # pyright: ignore[reportUnnecessaryIsInstance]
- applied_text_format = text_format
- else:
+ except ValueError as exc:
msg = f"Invalid text format: '{text_format}'"
- raise Jinja2ContextError(msg)
+ raise Jinja2ContextError(msg) from exc
else:
- applied_text_format = TextFormat(context.get(Jinja2ContextKey.TEXT_FORMAT, default=TextFormat.PLAIN))
+ applied_text_format = TextFormat(require_templating_style_value(context=context, jinja2_context_key=Jinja2ContextKey.TEXT_FORMAT))
# Protocol-based rendering
if isinstance(value, TextFormatRenderable):
@@ -118,8 +139,7 @@ def apply_tag_style(*, context: Context, value: str, tag_name: str | None = None
Returns:
Content wrapped in tags according to the style.
"""
- tag_style_str = context.get(Jinja2ContextKey.TAG_STYLE)
- tag_style = TagStyle(tag_style_str) if tag_style_str else TagStyle.TICKS
+ tag_style = TagStyle(require_templating_style_value(context=context, jinja2_context_key=Jinja2ContextKey.TAG_STYLE))
match tag_style:
case TagStyle.NO_TAG:
diff --git a/pipelex/tools/jinja2/jinja2_with_images_filter.py b/pipelex/tools/jinja2/jinja2_with_images_filter.py
index 24fb7dc5d..a6f6b0819 100644
--- a/pipelex/tools/jinja2/jinja2_with_images_filter.py
+++ b/pipelex/tools/jinja2/jinja2_with_images_filter.py
@@ -8,6 +8,7 @@ from jinja2.runtime import Context, Undefined
from pipelex.tools.jinja2.exceptions import Jinja2ContextError
from pipelex.tools.jinja2.image_registry import ImageRegistry
from pipelex.tools.jinja2.image_renderable import ImageRenderable
+from pipelex.tools.jinja2.jinja2_filters import require_templating_style_value
from pipelex.tools.jinja2.jinja2_models import Jinja2ContextKey
from pipelex.tools.templating.text_format import TextFormat
@@ -53,9 +54,8 @@ def with_images(context: Context, value: Any, _: Any = None) -> str:
msg = f"Expected ImageRegistry in context, got {type(registry).__name__}"
raise Jinja2ContextError(msg)
- # Get text format from context
- text_format_str = context.get(Jinja2ContextKey.TEXT_FORMAT, default=TextFormat.PLAIN)
- text_format = TextFormat(text_format_str)
+ # Get text format from context — no fallback, same as the tag and format filters
+ text_format = TextFormat(require_templating_style_value(context=context, jinja2_context_key=Jinja2ContextKey.TEXT_FORMAT))
# Protocol-based rendering
if isinstance(value, ImageRenderable):
diff --git a/pipelex/tools/templating/templating_style.py b/pipelex/tools/templating/templating_style.py
index a8f8c0e39..09c730d64 100644
--- a/pipelex/tools/templating/templating_style.py
+++ b/pipelex/tools/templating/templating_style.py
@@ -1,5 +1,4 @@
from enum import StrEnum
-from typing import Self
from pydantic import BaseModel, Field
from typing_extensions import override
@@ -16,12 +15,8 @@ class TagStyle(StrEnum):
class TemplatingStyle(BaseModel):
tag_style: TagStyle = Field(strict=False)
- text_format: TextFormat = Field(TextFormat.PLAIN, strict=False)
+ text_format: TextFormat = Field(default=TextFormat.PLAIN, strict=False)
@override
def __str__(self):
return f"{self.tag_style}/{self.text_format}"
-
- @classmethod
- def make_default_prompting_style(cls) -> Self:
- return cls(tag_style=TagStyle.NO_TAG, text_format=TextFormat.PLAIN)
diff --git a/subject_grants.toml b/subject_grants.toml
index 6f33ecf7a..bf9ef56fe 100644
--- a/subject_grants.toml
+++ b/subject_grants.toml
@@ -1244,10 +1244,6 @@ rationale = "Parser: the text is the operand; comment_prefix is context."
param = "model_name"
rationale = "Keyed accessor by the model_name; single operand."
-["pipelex/cogt/config_cogt.py::LLMConfig.get_reasoning_budget"]
-param = "prompting_target"
-rationale = "Keyed accessor by the prompting_target; single operand."
-
["pipelex/cogt/config_cogt.py::LLMConfig.get_template"]
param = "template_name"
rationale = "Keyed accessor by the template_name; single operand."
@@ -1924,14 +1920,6 @@ rationale = "Prepares the job against the inference_model; single operand."
param = "llm_prompt"
rationale = "Factory from source: builds the result from the llm_prompt; single operand."
-["pipelex/cogt/llm/llm_prompt_template_inputs.py::LLMPromptTemplateInputs.complemented_by"]
-param = "additional_template_inputs"
-rationale = "Operates on the additional_template_inputs; single operand (qualifiers keyword-only)."
-
-["pipelex/cogt/llm/llm_prompt_template_inputs.py::LLMPromptTemplateInputs.complemented_by_dict"]
-param = "additional_inputs_dict"
-rationale = "Operates on the additional_inputs_dict; single operand (qualifiers keyword-only)."
-
["pipelex/cogt/llm/llm_report.py::LLMTokenCostReportField.report_field_for_cost_by_category"]
param = "token_category"
rationale = "Derives the report field for the token category; single operand."
@@ -5472,10 +5460,6 @@ rationale = "Predicate on the text; single operand."
param = "text"
rationale = "Predicate on the text; single operand."
-["pipelex/system/configuration/configs.py::PromptingConfig.get_prompting_style"]
-param = "prompting_target"
-rationale = "Config getter keyed by the prompting target; single operand."
-
["pipelex/system/environment.py::all_env_vars_are_set"]
param = "keys"
rationale = "Predicate on the given env-var keys; single operand."
diff --git a/tests/data/errors/error_identity.txt b/tests/data/errors/error_identity.txt
index b6e5ad23a..300802c42 100644
--- a/tests/data/errors/error_identity.txt
+++ b/tests/data/errors/error_identity.txt
@@ -145,7 +145,6 @@ LLMHandleNotFoundError | LLM handle not found | https://docs.pipelex.com/latest/
LLMModelNotFoundError | LLM model not found | https://docs.pipelex.com/latest/errors/llm-model-not-found-error/
LLMPromptParameterError | LLM prompt parameter | https://docs.pipelex.com/latest/errors/llm-prompt-parameter-error/
LLMPromptSpecError | LLM prompt spec | https://docs.pipelex.com/latest/errors/llm-prompt-spec-error/
-LLMPromptTemplateInputsError | LLM prompt template inputs | https://docs.pipelex.com/latest/errors/llm-prompt-template-inputs-error/
LLMSettingsValidationError | LLM settings validation | https://docs.pipelex.com/latest/errors/llm-settings-validation-error/
LangfuseCredentialsError | Langfuse credentials | https://docs.pipelex.com/latest/errors/langfuse-credentials-error/
LibraryError | Library error | https://docs.pipelex.com/latest/errors/library-error/
diff --git a/tests/integration/pipelex/cogt/test_data.py b/tests/integration/pipelex/cogt/test_data.py
index 03d6d15c7..dcac102ff 100644
--- a/tests/integration/pipelex/cogt/test_data.py
+++ b/tests/integration/pipelex/cogt/test_data.py
@@ -5,8 +5,6 @@ from pydantic import BaseModel, Field, field_validator
from pipelex.cogt.image.prompt_image import PromptImageUri
from pipelex.cogt.llm.llm_prompt import LLMPrompt
-from pipelex.cogt.llm.llm_prompt_template import LLMPromptTemplate
-from pipelex.cogt.llm.llm_prompt_template_inputs import LLMPromptTemplateInputs
from tests.cases import ImageTestCases
from tests.cases.documents import DocumentTestCases
from tests.integration.pipelex.test_data import PipeTestCases
@@ -178,39 +176,29 @@ How tall do you think he was when he was 12? and at 15?
class SerDeTestLLMCases:
- """Constants and example objects used for SerDe unit tests."""
+ """Constants and example objects used for SerDe unit tests.
- # Base building blocks -------------------------------------------------
- PROTO_PROMPT: ClassVar[LLMPrompt] = LLMPrompt(
- user_text="Some user text in the template",
- )
+ The subject is `LLMPrompt`, which really does cross a process boundary — the interpreter hands one
+ to a worker, and a distributed run serializes it onto the wire. Its `user_images` list is the part
+ that matters: the items are `PromptImage` subclasses, so a round-trip that lost the subclass would
+ hand the model a prompt with no image and nothing downstream would notice.
+ """
- BASE_TEMPLATE_INPUTS_1: ClassVar[LLMPromptTemplateInputs] = LLMPromptTemplateInputs(
- root={"foo": "bar"},
- )
- MY_PROMPT_TEMPLATE_MODEL_1: ClassVar[LLMPromptTemplate] = LLMPromptTemplate(
- proto_prompt=PROTO_PROMPT,
- base_template_inputs=BASE_TEMPLATE_INPUTS_1,
+ # Base building blocks -------------------------------------------------
+ PLAIN_PROMPT: ClassVar[LLMPrompt] = LLMPrompt(
+ user_text="Some user text in the prompt",
)
- BASE_TEMPLATE_INPUTS_2: ClassVar[LLMPromptTemplateInputs] = LLMPromptTemplateInputs(
- root={},
- )
- MY_PROMPT_TEMPLATE_MODEL_2: ClassVar[LLMPromptTemplate] = LLMPromptTemplate(
- proto_prompt=PROTO_PROMPT,
- base_template_inputs=BASE_TEMPLATE_INPUTS_2,
+ PROMPT_WITH_SYSTEM_TEXT: ClassVar[LLMPrompt] = LLMPrompt(
+ system_text="Some system text",
+ user_text="Some user text in the prompt",
)
# Dictionary representation example ------------------------------------
DICT_1: ClassVar[dict[str, Any]] = {
- "proto_prompt": LLMPrompt(
- system_text=None,
- user_text="Some user text in the template",
- user_images=[],
- ),
- "base_template_inputs": LLMPromptTemplateInputs(root={}),
- "source_system_template_name": None,
- "source_user_template_name": "markdown_reordering_vision_claude3_5_sonnet",
+ "system_text": None,
+ "user_text": "Some user text in the prompt",
+ "user_images": [],
}
# Prompt containing an image URI --------------------------------------
@@ -224,8 +212,8 @@ class SerDeTestLLMCases:
# Group constants for parametrization ----------------------------------
PYDANTIC_EXAMPLES: ClassVar[list[BaseModel]] = [
- MY_PROMPT_TEMPLATE_MODEL_1,
- MY_PROMPT_TEMPLATE_MODEL_2,
+ PLAIN_PROMPT,
+ PROMPT_WITH_SYSTEM_TEXT,
]
PYDANTIC_EXAMPLES_USING_SUBCLASS: ClassVar[list[BaseModel]] = [
PROMPT_WITH_IMAGE_URI,
diff --git a/tests/integration/pipelex/cogt/test_serde_llm_classes.py b/tests/integration/pipelex/cogt/test_serde_llm_classes.py
index caca27a2c..7811082d1 100644
--- a/tests/integration/pipelex/cogt/test_serde_llm_classes.py
+++ b/tests/integration/pipelex/cogt/test_serde_llm_classes.py
@@ -5,7 +5,7 @@ from kajson import kajson
from pydantic import BaseModel
from pipelex import pretty_print
-from pipelex.cogt.llm.llm_prompt_template import LLMPromptTemplate
+from pipelex.cogt.llm.llm_prompt import LLMPrompt
from tests.integration.pipelex.cogt.test_data import SerDeTestLLMCases
@@ -45,8 +45,8 @@ class TestSerDeLLMClasses:
test_dict: dict[str, Any],
):
pretty_print(test_dict, title="Original dict")
- # Deserialize the dictionary to a LLMPromptTemplate model
- the_obj = LLMPromptTemplate.model_validate(test_dict)
+ # Deserialize the dictionary to a LLMPrompt model
+ the_obj = LLMPrompt.model_validate(test_dict)
pretty_print(the_obj, title="Deserialized from dict")
# Serialize the model to a dictionary
@@ -66,8 +66,8 @@ class TestSerDeLLMClasses:
test_dict: dict[str, Any],
):
pretty_print(test_dict, title="Original dict")
- # Deserialize the dictionary to a LLMPromptTemplate model
- the_obj = LLMPromptTemplate(**test_dict)
+ # Deserialize the dictionary to a LLMPrompt model
+ the_obj = LLMPrompt(**test_dict)
pretty_print(the_obj, title="Deserialized from dict")
# Serialize the model to a dictionary
diff --git a/tests/integration/pipelex/kernel/test_usage_parity.py b/tests/integration/pipelex/kernel/test_usage_parity.py
index 3fb40c317..518ff8b83 100644
--- a/tests/integration/pipelex/kernel/test_usage_parity.py
+++ b/tests/integration/pipelex/kernel/test_usage_parity.py
@@ -45,9 +45,10 @@ from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.core.concepts.native.concept_native import NativeConceptCode
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.stuffs.text_content import TextContent
-from pipelex.kernel.llm_ops import derive_templating_style, resolve_llm_setting_for_text, run_llm_text
+from pipelex.kernel.llm_ops import resolve_llm_setting_for_text, run_llm_text
from pipelex.kernel.llm_prompt_content import LlmPromptContent
from pipelex.kernel.pipelex_kernel import PipelexKernel
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipeline.runner import PipelexMTHDSProtocol
from pipelex.reporting.reporting_types import AnyTokensUsage
from pipelex.reporting.usage_records import TokensUsageRecord, make_tokens_usage_record
@@ -142,7 +143,7 @@ class TestKernelUsageParity:
output_class=TextContent,
job_metadata=kernel.make_step_metadata(pipe_code=_PIPE_CODE),
cogt_run_params=kernel.cogt_run_params,
- templating_style=derive_templating_style(llm_setting=llm_setting),
+ templating_style=resolve_templating_style(authored=None),
result_name="written",
)
else:
diff --git a/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py b/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py
index ea0ec2673..feba86a4f 100644
--- a/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py
+++ b/tests/integration/pipelex/pipes/img_gen_prompt_inputs/test_img_gen_prompt_image_extraction.py
@@ -14,6 +14,7 @@ from pipelex.core.stuffs.page_content import PageContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_and_images_content import TextAndImagesContent
from pipelex.core.stuffs.text_content import TextContent
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.img_gen.pipe_img_gen import PipeImgGen
from pipelex.pipe_operators.img_gen.pipe_img_gen_blueprint import PipeImgGenBlueprint
@@ -65,6 +66,7 @@ class TestImgGenPromptImageExtraction:
)
img_gen_prompt = await pipe.img_gen_prompt_blueprint.make_img_gen_prompt(
+ templating_style=resolve_templating_style(authored=None),
context_provider=working_memory,
)
@@ -120,6 +122,7 @@ class TestImgGenPromptImageExtraction:
)
img_gen_prompt = await pipe.img_gen_prompt_blueprint.make_img_gen_prompt(
+ templating_style=resolve_templating_style(authored=None),
context_provider=working_memory,
)
@@ -174,6 +177,7 @@ class TestImgGenPromptImageExtraction:
)
img_gen_prompt = await pipe.img_gen_prompt_blueprint.make_img_gen_prompt(
+ templating_style=resolve_templating_style(authored=None),
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_extraction.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_extraction.py
index 0f983bea1..a1df96aec 100644
--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_extraction.py
+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_extraction.py
@@ -12,6 +12,7 @@ from pipelex.core.stuffs.image_content import ImageContent
from pipelex.core.stuffs.list_content import ListContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_native_concept
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
@@ -48,6 +49,7 @@ class TestPromptDocumentExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -88,6 +90,7 @@ class TestPromptDocumentExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -128,6 +131,7 @@ class TestPromptDocumentExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -169,6 +173,7 @@ class TestPromptDocumentExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_token_substitution.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_token_substitution.py
index 5ffea2c3f..cee5d0e62 100644
--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_token_substitution.py
+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_document_token_substitution.py
@@ -11,6 +11,7 @@ from pipelex.core.stuffs.document_content import DocumentContent
from pipelex.core.stuffs.list_content import ListContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_native_concept
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
@@ -48,6 +49,7 @@ class TestPromptDocumentTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -82,6 +84,7 @@ class TestPromptDocumentTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -118,6 +121,7 @@ class TestPromptDocumentTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -172,6 +176,7 @@ class TestPromptDocumentTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py
index fad918a89..4727478b8 100644
--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py
+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py
@@ -16,6 +16,7 @@ from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_and_images_content import TextAndImagesContent
from pipelex.core.stuffs.text_content import TextContent
from pipelex.interpreter_hub import get_native_concept
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
@@ -54,6 +55,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -94,6 +96,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -138,6 +141,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -196,6 +200,7 @@ class TestPromptImageExtraction:
# Should raise error because tag converts to string before with_images
with pytest.raises(Jinja2TemplateRenderError, match="does not implement the ImageRenderable protocol"):
await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -205,6 +210,7 @@ class TestPromptImageExtraction:
This demonstrates the CORRECT way to use the tag filter for formatted output.
Note: tag returns a string, so no images are extracted (use with_images for that).
+ Rendered under the resolved style, which is what every real entry point supplies.
"""
load_test_library([Path("tests/integration/pipelex/pipes/pipelines")])
@@ -242,13 +248,14 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
# Tag filter produces formatted text output but NO image tokens or extraction
assert llm_prompt.user_text is not None
- assert "```" in llm_prompt.user_text # Tag wraps in code blocks by default
+ assert "<pages>" in llm_prompt.user_text # Tag wraps in XML tags under the house default
assert "[Image 1]" not in llm_prompt.user_text # No image tokens from tag
assert llm_prompt.user_images is None or len(llm_prompt.user_images) == 0
pretty_print(llm_prompt.user_text, title="tag filter prompt - formatted text, no images")
@@ -258,7 +265,7 @@ class TestPromptImageExtraction:
This order works because:
1. with_images extracts images and returns string with [Image N] tokens
- 2. tag wraps that string in tags (```...``` or XML)
+ 2. tag wraps that string in tags, under the resolved style
The images are extracted because with_images processes structured data first.
"""
@@ -298,13 +305,16 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
# with_images | tag: images ARE extracted AND content is wrapped in tags
assert llm_prompt.user_text is not None
- assert "```" in llm_prompt.user_text # Tag wraps in code blocks
+ # `with_images` hands `tag` a plain string, which has no name of its own, so the XML arm
+ # falls back to the generic `data` tag.
+ assert "<data>" in llm_prompt.user_text
assert "[Image 1]" in llm_prompt.user_text # Image tokens present
assert "[Image 2]" in llm_prompt.user_text
assert llm_prompt.user_images is not None
@@ -353,6 +363,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -402,6 +413,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -450,6 +462,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -506,10 +519,12 @@ class TestPromptImageExtraction:
)
prompt_at = await pipe_at.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_at.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
prompt_dollar = await pipe_dollar.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_dollar.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -578,10 +593,12 @@ class TestPromptImageExtraction:
)
prompt_at = await pipe_at.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_at.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
prompt_dollar = await pipe_dollar.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_dollar.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -667,6 +684,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -719,6 +737,7 @@ class TestPromptImageExtraction:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_text_token_substitution.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_text_token_substitution.py
index ca6f88e22..c7e19a67b 100644
--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_text_token_substitution.py
+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_text_token_substitution.py
@@ -11,6 +11,7 @@ from pipelex.core.stuffs.image_content import ImageContent
from pipelex.core.stuffs.list_content import ListContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_native_concept
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
@@ -48,6 +49,7 @@ class TestPromptTextTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -82,6 +84,7 @@ class TestPromptTextTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -118,6 +121,7 @@ class TestPromptTextTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -172,6 +176,7 @@ class TestPromptTextTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -214,6 +219,7 @@ class TestPromptTextTokenSubstitution:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_refined_concept_references.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_refined_concept_references.py
index ebbac051d..6b6e46436 100644
--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_refined_concept_references.py
+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_refined_concept_references.py
@@ -15,6 +15,7 @@ from pipelex.core.stuffs.image_content import ImageContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_required_concept
from pipelex.kernel.prompt_references import DocumentReferenceKind, ImageReferenceKind
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
@@ -98,6 +99,7 @@ class TestRefinedConceptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -135,6 +137,7 @@ class TestRefinedConceptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_system_prompt_references.py b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_system_prompt_references.py
index 867ef6f2e..bdcf765a4 100644
--- a/tests/integration/pipelex/pipes/llm_prompt_inputs/test_system_prompt_references.py
+++ b/tests/integration/pipelex/pipes/llm_prompt_inputs/test_system_prompt_references.py
@@ -13,6 +13,7 @@ from pipelex.core.stuffs.list_content import ListContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_native_concept
from pipelex.kernel.prompt_references import DocumentReferenceKind, ImageReferenceKind
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
@@ -150,6 +151,7 @@ class TestSystemPromptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -189,6 +191,7 @@ class TestSystemPromptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -238,6 +241,7 @@ class TestSystemPromptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -289,6 +293,7 @@ class TestSystemPromptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
@@ -339,6 +344,7 @@ class TestSystemPromptReferences:
)
llm_prompt = await pipe_llm.llm_prompt_spec.make_llm_prompt(
+ templating_style=resolve_templating_style(authored=pipe_llm.templating_style),
output_concept_ref="Text",
context_provider=working_memory,
)
diff --git a/tests/integration/pipelex/pipes/pipelines/templating_style.mthds b/tests/integration/pipelex/pipes/pipelines/templating_style.mthds
new file mode 100644
index 000000000..2c35e00c6
--- /dev/null
+++ b/tests/integration/pipelex/pipes/pipelines/templating_style.mthds
@@ -0,0 +1,44 @@
+domain = "test_templating_style"
+description = "Test library for authored templating styles"
+
+[pipe.square_brackets_note]
+type = "PipeLLM"
+description = "Render a note under an authored bare-string templating style"
+inputs = { topic = "Text" }
+output = "Text"
+templating_style = "square_brackets"
+prompt = """
+Here is the topic:
+@topic
+"""
+
+[pipe.full_struct_note]
+type = "PipeLLM"
+description = "Render a note under an authored full-struct templating style"
+inputs = { topic = "Text" }
+output = "Text"
+templating_style = { tag_style = "xml", text_format = "markdown" }
+prompt = """
+Here is the topic:
+@topic
+"""
+
+[pipe.default_style_note]
+type = "PipeLLM"
+description = "Render a note under the config-default templating style"
+inputs = { topic = "Text" }
+output = "Text"
+prompt = """
+Here is the topic:
+@topic
+"""
+
+[pipe.default_style_picture]
+type = "PipeImgGen"
+description = "An image prompt has no authored style, so it renders under the config default"
+inputs = { topic = "Text" }
+output = "Image"
+prompt = """
+Draw the topic:
+@topic
+"""
diff --git a/tests/integration/pipelex/pipes/test_templating_style_bundle.py b/tests/integration/pipelex/pipes/test_templating_style_bundle.py
new file mode 100644
index 000000000..4426e2921
--- /dev/null
+++ b/tests/integration/pipelex/pipes/test_templating_style_bundle.py
@@ -0,0 +1,90 @@
+"""End-to-end: a bundle authoring `templating_style` parses, loads, and renders under that style.
+
+Also covers the operators that have no authored style of their own: they inherit the same runtime
+default rather than falling into a filter-level one, which is the whole point of resolving centrally.
+"""
+
+from collections.abc import Callable
+from pathlib import Path
+from typing import TYPE_CHECKING, cast
+
+import pytest
+
+from pipelex.core.concepts.native.concept_native import NativeConceptCode
+from pipelex.core.memory.working_memory import WorkingMemory
+from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
+from pipelex.core.stuffs.stuff_factory import StuffFactory
+from pipelex.core.stuffs.text_content import TextContent
+from pipelex.interpreter_hub import get_native_concept, get_required_pipe
+from pipelex.kernel.templating_style_ops import resolve_templating_style
+from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
+from pipelex.tools.templating.text_format import TextFormat
+
+if TYPE_CHECKING:
+ from pipelex.pipe_operators.img_gen.pipe_img_gen import PipeImgGen
+
+_PIPELINES_DIR = Path("tests/integration/pipelex/pipes/pipelines")
+
+
+def _make_memory() -> WorkingMemory:
+ return WorkingMemoryFactory.make_from_single_stuff(
+ stuff=StuffFactory.make_stuff(
+ concept=get_native_concept(NativeConceptCode.TEXT),
+ content=TextContent(text="Bees are great"),
+ name="topic",
+ ),
+ )
+
+
+async def _render_user_text(pipe: PipeLLM) -> str:
+ llm_prompt = await pipe.llm_prompt_spec.make_llm_prompt(
+ output_concept_ref="native.Text",
+ context_provider=_make_memory(),
+ templating_style=resolve_templating_style(authored=pipe.templating_style),
+ )
+ assert llm_prompt.user_text is not None
+ return llm_prompt.user_text
+
+
[email protected](loop_scope="class")
+class TestTemplatingStyleBundle:
+ async def test_bare_string_style_parses_and_governs_rendering(self, load_test_library: Callable[[list[Path]], None]):
+ load_test_library([_PIPELINES_DIR])
+ pipe = cast("PipeLLM", get_required_pipe("test_templating_style.square_brackets_note"))
+ assert pipe.templating_style == TemplatingStyle(tag_style=TagStyle.SQUARE_BRACKETS, text_format=TextFormat.PLAIN)
+ user_text = await _render_user_text(pipe)
+ assert "[topic]" in user_text
+ assert "[/topic]" in user_text
+ assert "Bees are great" in user_text
+
+ async def test_full_struct_style_parses_and_governs_rendering(self, load_test_library: Callable[[list[Path]], None]):
+ load_test_library([_PIPELINES_DIR])
+ pipe = cast("PipeLLM", get_required_pipe("test_templating_style.full_struct_note"))
+ assert pipe.templating_style == TemplatingStyle(tag_style=TagStyle.XML, text_format=TextFormat.MARKDOWN)
+ user_text = await _render_user_text(pipe)
+ assert "<topic>" in user_text
+ assert "</topic>" in user_text
+
+ async def test_absent_style_renders_under_config_default(self, load_test_library: Callable[[list[Path]], None]):
+ load_test_library([_PIPELINES_DIR])
+ pipe = cast("PipeLLM", get_required_pipe("test_templating_style.default_style_note"))
+ assert pipe.templating_style is None
+ user_text = await _render_user_text(pipe)
+ assert "<topic>" in user_text
+ assert "</topic>" in user_text
+ assert "```" not in user_text
+
+ async def test_img_gen_prompt_renders_under_config_default(self, load_test_library: Callable[[list[Path]], None]):
+ """An image prompt has no authored style, and used to render under the filters' triple-backtick
+ fallback. It now inherits the same default an LLM pipe that declares nothing gets.
+ """
+ load_test_library([_PIPELINES_DIR])
+ pipe = cast("PipeImgGen", get_required_pipe("test_templating_style.default_style_picture"))
+ img_gen_prompt = await pipe.img_gen_prompt_blueprint.make_img_gen_prompt(
+ context_provider=_make_memory(),
+ templating_style=resolve_templating_style(authored=None),
+ )
+ assert "<topic>" in img_gen_prompt.positive_text
+ assert "</topic>" in img_gen_prompt.positive_text
+ assert "```" not in img_gen_prompt.positive_text
diff --git a/tests/unit/pipelex/cogt/llm/test_llm_config_reasoning.py b/tests/unit/pipelex/cogt/llm/test_llm_config_reasoning.py
index c8e957818..568a75b15 100644
--- a/tests/unit/pipelex/cogt/llm/test_llm_config_reasoning.py
+++ b/tests/unit/pipelex/cogt/llm/test_llm_config_reasoning.py
@@ -89,20 +89,20 @@ class TestLLMConfigReasoning:
def test_get_reasoning_budget_valid(self):
config = _make_llm_config()
- assert config.get_reasoning_budget("anthropic", effort=ReasoningEffort.HIGH) == 16384
+ assert config.get_reasoning_budget(family="anthropic", effort=ReasoningEffort.HIGH) == 16384
def test_get_reasoning_budget_none_effort(self):
config = _make_llm_config()
- assert config.get_reasoning_budget("gemini", effort=ReasoningEffort.NONE) == 0
+ assert config.get_reasoning_budget(family="gemini", effort=ReasoningEffort.NONE) == 0
def test_get_reasoning_budget_max_effort(self):
config = _make_llm_config()
- assert config.get_reasoning_budget("anthropic", effort=ReasoningEffort.MAX) == 65536
+ assert config.get_reasoning_budget(family="anthropic", effort=ReasoningEffort.MAX) == 65536
- def test_get_reasoning_budget_unknown_target_raises(self):
+ def test_get_reasoning_budget_unknown_family_raises(self):
config = _make_llm_config()
with pytest.raises(ConfigValidationError, match="No effort-to-budget map found"):
- config.get_reasoning_budget("unknown_target", effort=ReasoningEffort.HIGH)
+ config.get_reasoning_budget(family="unknown_family", effort=ReasoningEffort.HIGH)
def test_validator_missing_effort_level_raises(self):
incomplete_maps = {
@@ -152,7 +152,7 @@ class TestLLMConfigReasoning:
)
def test_all_effort_levels_retrievable(self, effort: ReasoningEffort):
config = _make_llm_config()
- budget = config.get_reasoning_budget("anthropic", effort=effort)
+ budget = config.get_reasoning_budget(family="anthropic", effort=effort)
assert isinstance(budget, int)
assert budget >= 0
diff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py b/tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py
new file mode 100644
index 000000000..fa5ff615d
--- /dev/null
+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py
@@ -0,0 +1,178 @@
+"""`load(lenient=True)` tolerates missing credentials — and nothing else.
+
+The distinction matters because the lenient boot is the one commands like `validate`, `show` and
+`--dry-run` use: a config error swallowed there deletes a whole backend from the library, and every
+handle it served then fails much later with a far more confusing "model not found".
+"""
+
+from pathlib import Path
+
+import pytest
+
+from pipelex.cogt.exceptions import InferenceBackendCredentialsError, InferenceBackendCredentialsErrorType, InferenceBackendLibraryError
+from pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary
+from pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider
+
+ABSENT_VAR = "PIPELEX_TEST_ABSENT_VAR_FOR_LENIENCY"
+
+BACKENDS_TOML = """
+[acme]
+enabled = true
+api_key = "sk-not-a-real-key"
+"""
+
+BACKENDS_TOML_WITH_MISSING_CREDENTIAL = f"""
+[acme]
+enabled = true
+api_key = "${{{ABSENT_VAR}}}"
+"""
+
+MODEL_SPECS_TOML = """
+[defaults]
+model_type = "llm"
+sdk = "openai_responses"
+
+["acme-one"]
+model_id = "acme-one"
+"""
+
+MODEL_SPECS_TOML_WITH_UNKNOWN_DEFAULT = """
+[defaults]
+model_type = "llm"
+sdk = "openai_responses"
+a_field_we_removed = "openai"
+
+["acme-one"]
+model_id = "acme-one"
+"""
+
+MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL = f"""
+[defaults]
+model_type = "llm"
+sdk = "openai_responses"
+
+["acme-one"]
+model_id = "${{{ABSENT_VAR}}}"
+"""
+
+MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN = f"""
+[defaults]
+model_type = "llm"
+sdk = "openai_responses"
+
+["acme-one"]
+model_id = "${{env:{ABSENT_VAR}_A|env:{ABSENT_VAR}_B}}"
+"""
+
+
+class TestBackendLibraryLeniency:
+ def _write_config(self, tmp_path: Path, *, backends_toml: str, model_specs_toml: str | None) -> tuple[str, str]:
+ backends_dir = tmp_path / "backends"
+ backends_dir.mkdir()
+ backends_library_path = tmp_path / "backends.toml"
+ backends_library_path.write_text(backends_toml)
+ if model_specs_toml is not None:
+ (backends_dir / "acme.toml").write_text(model_specs_toml)
+ return str(backends_library_path), str(backends_dir)
+
+ def _load(self, tmp_path: Path, *, backends_toml: str, model_specs_toml: str | None, lenient: bool) -> InferenceBackendLibrary:
+ backends_library_path, backends_dir_path = self._write_config(
+ tmp_path,
+ backends_toml=backends_toml,
+ model_specs_toml=model_specs_toml,
+ )
+ library = InferenceBackendLibrary.make_empty()
+ library.load(
+ secrets_provider=EnvSecretsProvider(),
+ backends_library_path=backends_library_path,
+ backends_dir_path=backends_dir_path,
+ lenient=lenient,
+ )
+ return library
+
+ def test_a_well_formed_backend_loads(self, tmp_path: Path) -> None:
+ """The control: without this the failure cases below would prove nothing."""
+ library = self._load(tmp_path, backends_toml=BACKENDS_TOML, model_specs_toml=MODEL_SPECS_TOML, lenient=True)
+
+ assert "acme" in library.root
+
+ @pytest.mark.parametrize("lenient", [True, False])
+ def test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:
+ """A stale local TOML — the shape an upgrade leaves behind, since init never overwrites an existing file."""
+ with pytest.raises(InferenceBackendLibraryError, match="a_field_we_removed"):
+ self._load(
+ tmp_path,
+ backends_toml=BACKENDS_TOML,
+ model_specs_toml=MODEL_SPECS_TOML_WITH_UNKNOWN_DEFAULT,
+ lenient=lenient,
+ )
+
+ @pytest.mark.parametrize("lenient", [True, False])
+ def test_a_missing_per_backend_toml_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:
+ with pytest.raises(InferenceBackendLibraryError, match=r"acme\.toml"):
+ self._load(tmp_path, backends_toml=BACKENDS_TOML, model_specs_toml=None, lenient=lenient)
+
+ def test_a_missing_backend_credential_is_skipped_leniently(self, tmp_path: Path) -> None:
+ library = self._load(
+ tmp_path,
+ backends_toml=BACKENDS_TOML_WITH_MISSING_CREDENTIAL,
+ model_specs_toml=MODEL_SPECS_TOML,
+ lenient=True,
+ )
+
+ assert library.root == {}
+
+ def test_a_missing_model_spec_credential_is_skipped_leniently(self, tmp_path: Path) -> None:
+ """The placeholder lives in the per-backend TOML, not in backends.toml — same tolerance."""
+ library = self._load(
+ tmp_path,
+ backends_toml=BACKENDS_TOML,
+ model_specs_toml=MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL,
+ lenient=True,
+ )
+
+ assert library.root == {}
+
+ def test_an_unresolvable_model_spec_fallback_pattern_is_skipped_leniently(self, tmp_path: Path) -> None:
+ """A fallback pattern whose every candidate is absent is still just a missing credential."""
+ library = self._load(
+ tmp_path,
+ backends_toml=BACKENDS_TOML,
+ model_specs_toml=MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN,
+ lenient=True,
+ )
+
+ assert library.root == {}
+
+ def test_an_unresolvable_model_spec_fallback_pattern_raises_a_credentials_error_when_strict(self, tmp_path: Path) -> None:
+ """No single variable name is right when several were tried, but the error still names the backend."""
+ with pytest.raises(InferenceBackendCredentialsError) as exc_info:
+ self._load(
+ tmp_path,
+ backends_toml=BACKENDS_TOML,
+ model_specs_toml=MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN,
+ lenient=False,
+ )
+
+ assert exc_info.value.credentials_error_type is InferenceBackendCredentialsErrorType.VAR_FALLBACK_PATTERN
+ assert exc_info.value.backend_name == "acme"
+
+ @pytest.mark.parametrize(
+ ("backends_toml", "model_specs_toml"),
+ [
+ (BACKENDS_TOML_WITH_MISSING_CREDENTIAL, MODEL_SPECS_TOML),
+ (BACKENDS_TOML, MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL),
+ ],
+ )
+ def test_a_missing_credential_raises_a_credentials_error_when_strict(
+ self,
+ tmp_path: Path,
+ backends_toml: str,
+ model_specs_toml: str,
+ ) -> None:
+ """Strictly, both placements name the variable — that is what the boot turns into 'set this key'."""
+ with pytest.raises(InferenceBackendCredentialsError) as exc_info:
+ self._load(tmp_path, backends_toml=backends_toml, model_specs_toml=model_specs_toml, lenient=False)
+
+ assert exc_info.value.key_name == ABSENT_VAR
+ assert exc_info.value.backend_name == "acme"
diff --git a/tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py b/tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py
new file mode 100644
index 000000000..337c1c764
--- /dev/null
+++ b/tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py
@@ -0,0 +1,70 @@
+"""The remote gateway config may carry keys this client's model-spec blueprint does not know.
+
+It is served by a component that deploys on its own schedule, so a client can read a config written
+by a different release than itself. `InferenceModelSpecBlueprint` forbids extra fields, so without
+this pruning an unknown key in the remote `defaults` block hard-fails the boot — which is exactly
+what happened the day `prompting_target` was removed while the served config still declared it.
+"""
+
+from typing import Any, cast
+
+from pytest_mock import MockerFixture
+
+from pipelex import log
+from pipelex.cogt.model_backends.gateway_config import drop_unknown_gateway_defaults
+from pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs, InferenceModelSpecBlueprint
+
+
+class TestGatewayUnknownDefaults:
+ def _specs(self, *, defaults: dict[str, Any]) -> BackendModelSpecs:
+ return cast(
+ "BackendModelSpecs",
+ {
+ "defaults": defaults,
+ "gpt-4o-mini": {"model_id": "gpt-4o-mini", "sdk": "openai"},
+ },
+ )
+
+ def test_unknown_default_key_is_dropped(self) -> None:
+ pruned = drop_unknown_gateway_defaults(gateway_model_specs=self._specs(defaults={"max_tokens": 4096, "a_field_we_removed": "anthropic"}))
+
+ assert pruned["defaults"] == {"max_tokens": 4096}
+
+ def test_the_spec_still_validates_after_pruning(self) -> None:
+ """The point of the pruning, stated as the thing that used to raise."""
+ pruned = drop_unknown_gateway_defaults(gateway_model_specs=self._specs(defaults={"max_tokens": 4096, "a_field_we_removed": "anthropic"}))
+
+ merged = dict(cast("dict[str, Any]", pruned["defaults"]))
+ merged.update(cast("dict[str, Any]", pruned["gpt-4o-mini"]))
+ blueprint = InferenceModelSpecBlueprint.model_validate(merged)
+
+ assert blueprint.max_tokens == 4096
+
+ def test_known_defaults_are_left_alone(self) -> None:
+ """No unknown key means the caller gets its own object back, uncopied."""
+ specs = self._specs(defaults={"max_tokens": 4096})
+
+ assert drop_unknown_gateway_defaults(gateway_model_specs=specs) is specs
+
+ def test_pruning_does_not_need_the_log_hub(self, mocker: MockerFixture) -> None:
+ """It runs on the success path of every gateway load, including ones that precede runtime_hub.set_config().
+
+ The served config really does carry an unknown key today, so this is the ordinary path, not a corner.
+ """
+ mocker.patch.object(log.log_dispatch, "_log_config_instance", None)
+
+ pruned = drop_unknown_gateway_defaults(gateway_model_specs=self._specs(defaults={"max_tokens": 4096, "a_field_we_removed": "anthropic"}))
+
+ assert pruned["defaults"] == {"max_tokens": 4096}
+
+ def test_per_model_unknown_keys_are_untouched(self) -> None:
+ """A per-model unknown key means something already — it becomes an outbound HTTP header."""
+ # The unknown key in `defaults` is what forces the deep-copy prune to run at all: without it
+ # the function early-returns and this test proves nothing.
+ specs = self._specs(defaults={"max_tokens": 4096, "a_field_we_removed": "anthropic"})
+ cast("dict[str, Any]", specs["gpt-4o-mini"])["x-some-header"] = "value"
+
+ pruned = drop_unknown_gateway_defaults(gateway_model_specs=specs)
+
+ assert pruned is not specs
+ assert cast("dict[str, Any]", pruned["gpt-4o-mini"])["x-some-header"] == "value"
diff --git a/tests/unit/pipelex/exceptions/test_class_level_metadata.py b/tests/unit/pipelex/exceptions/test_class_level_metadata.py
index 4294505c3..b43aac316 100644
--- a/tests/unit/pipelex/exceptions/test_class_level_metadata.py
+++ b/tests/unit/pipelex/exceptions/test_class_level_metadata.py
@@ -10,7 +10,6 @@ from pipelex.cogt.exceptions import (
InferenceErrorCategory,
LLMPromptParameterError,
LLMPromptSpecError,
- LLMPromptTemplateInputsError,
PromptDocumentFactoryError,
PromptImageFactoryError,
PromptImageFormatError,
@@ -80,7 +79,6 @@ class TestClassLevelMetadata:
("_topic", "exc", "expected_category"),
[
("prompt_spec", LLMPromptSpecError("x"), InferenceErrorCategory.CONTENT),
- ("prompt_template", LLMPromptTemplateInputsError("x"), InferenceErrorCategory.CONTENT),
("prompt_parameter", LLMPromptParameterError("x"), InferenceErrorCategory.CONTENT),
("prompt_image_factory", PromptImageFactoryError("x"), InferenceErrorCategory.CONTENT),
("prompt_image_format", PromptImageFormatError("x"), InferenceErrorCategory.CONTENT),
diff --git a/tests/unit/pipelex/kernel/test_img_gen_prompt_kernel.py b/tests/unit/pipelex/kernel/test_img_gen_prompt_kernel.py
index d4d83f927..894638bf9 100644
--- a/tests/unit/pipelex/kernel/test_img_gen_prompt_kernel.py
+++ b/tests/unit/pipelex/kernel/test_img_gen_prompt_kernel.py
@@ -28,6 +28,11 @@ from pipelex.kernel.img_gen_prompt import assemble_img_gen_prompt
from pipelex.kernel.prompt_references import ImageReference, ImageReferenceKind
from pipelex.pipe_operators.img_gen.img_gen_prompt_blueprint import ImgGenPromptBlueprint
from pipelex.tools.jinja2.template_category import TemplateCategory
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
+
+# Explicit rather than resolved: these are unit tests over the assembly itself, so the style they
+# render under is stated here instead of read out of config.
+_TEMPLATING_STYLE = TemplatingStyle(tag_style=TagStyle.XML)
IMAGE_URL_1 = "https://example.com/first.png"
IMAGE_URL_2 = "https://example.com/second.png"
@@ -58,6 +63,7 @@ class TestImgGenPromptKernel:
@pytest.mark.asyncio(loop_scope="class")
async def test_tokens_are_numbered_from_the_registry_that_orders_input_images(self) -> None:
prompt = await assemble_img_gen_prompt(
+ templating_style=_TEMPLATING_STYLE,
context_provider=_memory_with_images(),
prompt_blueprint=_prompt_template(),
image_references=_image_references(),
@@ -79,6 +85,7 @@ class TestImgGenPromptKernel:
async def test_the_kernel_and_the_blueprint_build_the_same_prompt(self) -> None:
"""Both readers, same answer — the property the blueprint's delegation has to preserve."""
from_kernel = await assemble_img_gen_prompt(
+ templating_style=_TEMPLATING_STYLE,
context_provider=_memory_with_images(),
prompt_blueprint=_prompt_template(),
image_references=_image_references(),
@@ -86,7 +93,7 @@ class TestImgGenPromptKernel:
from_blueprint = await ImgGenPromptBlueprint(
prompt_blueprint=_prompt_template(),
image_references=_image_references(),
- ).make_img_gen_prompt(context_provider=_memory_with_images())
+ ).make_img_gen_prompt(context_provider=_memory_with_images(), templating_style=_TEMPLATING_STYLE)
assert from_kernel == from_blueprint
@@ -95,6 +102,7 @@ class TestImgGenPromptKernel:
"""The error moved into the kernel with the code that raises it, so it is the kernel's."""
with pytest.raises(PromptContentError):
await assemble_img_gen_prompt(
+ templating_style=_TEMPLATING_STYLE,
context_provider=_memory_with_images(),
prompt_blueprint=TemplateBlueprint(template="Draw {{ nobody }}.", category=TemplateCategory.IMG_GEN_PROMPT),
image_references=[ImageReference(variable_path="nobody", kind=ImageReferenceKind.DIRECT)],
diff --git a/tests/unit/pipelex/kernel/test_kernel_boot_contract.py b/tests/unit/pipelex/kernel/test_kernel_boot_contract.py
index 54910cb05..2cbcb3924 100644
--- a/tests/unit/pipelex/kernel/test_kernel_boot_contract.py
+++ b/tests/unit/pipelex/kernel/test_kernel_boot_contract.py
@@ -15,9 +15,10 @@ interpreter through a function-local import, which is invisible to the static gr
import-closure test *at once*. The sweep below therefore runs **after** the kernel call, which is
what makes this test strictly stronger than the import-time one it complements.
-**Every kernel entry point is called, not a representative one** — the seven operator arms and the
-memory-boundary ops (`shape_inputs` and the four extraction helpers), with the three
-`resolve_*_setting` helpers the sole exception, for the deck reason given below. The blind spot this test
+**Every kernel entry point is called, not a representative one** — the operator arms and the
+memory-boundary ops (`shape_inputs` and the extraction helpers), with the deck-reading helpers
+(`resolve_*_setting`, `concrete_llm_model_handle`) the sole exception, for the deck reason given
+below. The blind spot this test
exists for is per-function, so covering one op says nothing about the next: a function-local import
inside `run_search` is caught only by calling `run_search`. That also makes this the only gate the
ops modules other than `llm_ops` have — `PipelexKernel` is an LLM-era façade that does not import
@@ -110,6 +111,7 @@ _KERNEL_CALL_SCRIPT = textwrap.dedent(
from pipelex.kernel.pipelex_kernel import PipelexKernel
from pipelex.kernel.prompt_references import ImageReference, ImageReferenceKind
from pipelex.kernel.search_ops import run_search
+ from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.runtime_boot import RuntimeBoot
from pipelex.system.pipe_run_mode import PipeRunMode
from pipelex.system.registries.class_registry_access import get_class_registry
@@ -278,6 +280,10 @@ _KERNEL_CALL_SCRIPT = textwrap.dedent(
# exactly the way the kernel surface was. Assembly is also the half that reaches into memory to
# resolve references, which is where a function-local interpreter import would hide, and this
# subprocess is the only gate that can see one.
+ # Resolved here rather than hand-built: the resolver reads config, so passing it through every
+ # prompt-rendering call below is also what proves it works on a boot with no library.
+ templating_style = resolve_templating_style(authored=None)
+
img_gen_memory = WorkingMemoryFactory.make_from_single_stuff(
StuffFactory.make_stuff(
concept=ConceptFactory.make_native_concept(native_concept_code=NativeConceptCode.IMAGE),
@@ -288,6 +294,7 @@ _KERNEL_CALL_SCRIPT = textwrap.dedent(
img_gen_prompt = asyncio.run(
assemble_img_gen_prompt(
context_provider=img_gen_memory,
+ templating_style=templating_style,
prompt_blueprint=TemplateBlueprint(
template="Draw something like {{ reference }}.",
category=TemplateCategory.IMG_GEN_PROMPT,
@@ -329,6 +336,7 @@ _KERNEL_CALL_SCRIPT = textwrap.dedent(
template=search_query,
category=TemplateCategory.LLM_PROMPT,
search_setting=SearchSetting(model="kernel-boot-contract-search-model"),
+ templating_style=templating_style,
concept=text_concept,
job_metadata=kernel.make_step_metadata(),
cogt_run_params=kernel.cogt_run_params,
@@ -350,6 +358,7 @@ _KERNEL_CALL_SCRIPT = textwrap.dedent(
category=TemplateCategory.LLM_PROMPT,
concept=text_concept,
output_class=TextContent,
+ templating_style=templating_style,
result_name="composed",
)
)
diff --git a/tests/unit/pipelex/kernel/test_templating_style_ops.py b/tests/unit/pipelex/kernel/test_templating_style_ops.py
new file mode 100644
index 000000000..49ea52be9
--- /dev/null
+++ b/tests/unit/pipelex/kernel/test_templating_style_ops.py
@@ -0,0 +1,22 @@
+"""Unit tests for the total templating-style resolver (kernel semantics, deck-free)."""
+
+from pipelex.config import get_config
+from pipelex.kernel.templating_style_ops import resolve_templating_style
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
+from pipelex.tools.templating.text_format import TextFormat
+
+
+class TestResolveTemplatingStyle:
+ def test_none_resolves_to_config_default(self):
+ """Totality: with nothing authored, the resolver returns the config default — never None."""
+ resolved = resolve_templating_style(authored=None)
+ assert resolved == get_config().pipelex.templating_config.default_templating_style
+
+ def test_house_default_is_xml_plain(self):
+ """Pins the shipped default declared in pipelex.toml: xml tags, plain text format."""
+ resolved = resolve_templating_style(authored=None)
+ assert resolved == TemplatingStyle(tag_style=TagStyle.XML, text_format=TextFormat.PLAIN)
+
+ def test_authored_wins_over_config_default(self):
+ authored = TemplatingStyle(tag_style=TagStyle.SQUARE_BRACKETS, text_format=TextFormat.MARKDOWN)
+ assert resolve_templating_style(authored=authored) is authored
diff --git a/tests/unit/pipelex/language/test_mthds_schema.py b/tests/unit/pipelex/language/test_mthds_schema.py
index f47e93685..9517dfcbd 100644
--- a/tests/unit/pipelex/language/test_mthds_schema.py
+++ b/tests/unit/pipelex/language/test_mthds_schema.py
@@ -108,6 +108,17 @@ class TestMthdsSchemaGeneration:
props = definitions[def_name].get("properties", {})
assert "pipe_category" not in props, f"pipe_category should be excluded from {def_name}"
+ def test_pipe_llm_carries_optional_templating_style(self, schema: dict[str, Any]) -> None:
+ """The authored styling surface is published as a typed union, and stays optional."""
+ definitions = schema.get("definitions", {})
+ props = definitions["PipeLLMBlueprint"].get("properties", {})
+
+ assert "templating_style" in props, "PipeLLMBlueprint should publish its authored templating_style"
+ arms = props["templating_style"].get("anyOf", [])
+ assert {"$ref": "#/definitions/TagStyle"} in arms, "the bare-string arm should be the TagStyle enum, not a free-form string"
+ assert {"$ref": "#/definitions/TemplatingStyle"} in arms, "the inline-table arm should be the full TemplatingStyle"
+ assert {"type": "null"} in arms, "templating_style must stay optional"
+
def test_construct_alias_used(self, schema: dict[str, Any]) -> None:
"""Verify PipeComposeBlueprint uses 'construct' alias, not 'construct_blueprint'."""
definitions = schema.get("definitions", {})
diff --git a/tests/unit/pipelex/mthds_parsing/test_bundle_elaborator.py b/tests/unit/pipelex/mthds_parsing/test_bundle_elaborator.py
index 89019f2c2..3867a812b 100644
--- a/tests/unit/pipelex/mthds_parsing/test_bundle_elaborator.py
+++ b/tests/unit/pipelex/mthds_parsing/test_bundle_elaborator.py
@@ -7,6 +7,8 @@ from pipelex.pipe_controllers.sequence.pipe_sequence_blueprint import PipeSequen
from pipelex.pipe_operators.func.pipe_func_blueprint import PipeFuncBlueprint
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint, StructuringMethod
from pipelex.pipe_operators.structure.pipe_structure_blueprint import PipeStructureBlueprint
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
+from pipelex.tools.templating.text_format import TextFormat
class TestBundleElaborator:
@@ -249,6 +251,42 @@ class TestBundleElaborator:
assert draft.model is not None
assert draft.model_to_structure is None
+ def test_templating_style_propagates_to_step_1(self):
+ """Step 1 renders the author's own prompt, so it must inherit the author's declared style."""
+ bundle = PipelexBundleBlueprint(
+ domain="my_domain",
+ description="Templating style propagation",
+ concept={"Foo": "A foo"},
+ pipe={
+ "make_foo": PipeLLMBlueprint(
+ type="PipeLLM",
+ description="Make a Foo",
+ output="Foo",
+ prompt="hello",
+ templating_style=TagStyle.SQUARE_BRACKETS,
+ structuring_method=StructuringMethod.PRELIMINARY_TEXT,
+ ),
+ "make_bar": PipeLLMBlueprint(
+ type="PipeLLM",
+ description="Make a Bar",
+ output="Foo",
+ prompt="hello",
+ templating_style=TemplatingStyle(tag_style=TagStyle.XML, text_format=TextFormat.MARKDOWN),
+ structuring_method=StructuringMethod.PRELIMINARY_TEXT,
+ ),
+ },
+ )
+ elaborated = BundleElaborator.elaborate(bundle=bundle)
+ assert elaborated.pipe is not None
+
+ shorthand_draft = elaborated.pipe["make_foo__draft_text"]
+ assert isinstance(shorthand_draft, PipeLLMBlueprint)
+ assert shorthand_draft.templating_style is TagStyle.SQUARE_BRACKETS
+
+ full_table_draft = elaborated.pipe["make_bar__draft_text"]
+ assert isinstance(full_table_draft, PipeLLMBlueprint)
+ assert full_table_draft.templating_style == TemplatingStyle(tag_style=TagStyle.XML, text_format=TextFormat.MARKDOWN)
+
def test_model_to_structure_none_yields_step_2_default(self):
bundle = PipelexBundleBlueprint(
domain="my_domain",
diff --git a/tests/unit/pipelex/pipe_operators/pipe_compose/test_composer_field_resolutions.py b/tests/unit/pipelex/pipe_operators/pipe_compose/test_composer_field_resolutions.py
index 2ca9f15e4..575a185ce 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_compose/test_composer_field_resolutions.py
+++ b/tests/unit/pipelex/pipe_operators/pipe_compose/test_composer_field_resolutions.py
@@ -18,6 +18,11 @@ from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_native_concept
from pipelex.pipe_operators.compose.construct_blueprint import ConstructBlueprint, ConstructFieldMethod
from pipelex.pipe_operators.compose.structured_content_composer import StructuredContentComposer
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
+
+# Explicit rather than resolved: these are unit tests over the assembly itself, so the style they
+# render under is stated here instead of read out of config.
+_TEMPLATING_STYLE = TemplatingStyle(tag_style=TagStyle.XML)
class HeadquartersForResolutions(StructuredContent):
@@ -79,6 +84,7 @@ class TestComposerFieldResolutions:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_inputs,
output_class=ReportForResolutions,
diff --git a/tests/unit/pipelex/pipe_operators/pipe_compose/test_structured_content_composer.py b/tests/unit/pipelex/pipe_operators/pipe_compose/test_structured_content_composer.py
index a71a0ee1b..4a1a3dd62 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_compose/test_structured_content_composer.py
+++ b/tests/unit/pipelex/pipe_operators/pipe_compose/test_structured_content_composer.py
@@ -20,8 +20,13 @@ from pipelex.interpreter_hub import get_native_concept
from pipelex.pipe_operators.compose.construct_blueprint import ConstructBlueprint
from pipelex.pipe_operators.compose.exceptions import StructuredContentComposerValidationError, StructuredContentComposerValueError
from pipelex.pipe_operators.compose.structured_content_composer import StructuredContentComposer
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
from pipelex.tools.typing.pydantic_utils import empty_list_factory_of
+# Explicit rather than resolved: these are unit tests over the assembly itself, so the style they
+# render under is stated here instead of read out of config.
+_TEMPLATING_STYLE = TemplatingStyle(tag_style=TagStyle.XML)
+
# Test StructuredContent classes for testing
class SimpleReport(StructuredContent):
@@ -112,6 +117,7 @@ class TestStructuredContentComposerFixedValues:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=SimpleReport,
@@ -147,6 +153,7 @@ class TestStructuredContentComposerVariableRefs:
blueprint = ConstructBlueprint.make_from_raw(ComposerTestData.VAR_REF_CONSTRUCT)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=SalesSummary,
@@ -180,6 +187,7 @@ class TestStructuredContentComposerTemplates:
blueprint = ConstructBlueprint.make_from_raw(ComposerTestData.MIXED_CONSTRUCT)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=SalesSummary,
@@ -225,6 +233,7 @@ class TestStructuredContentComposerNested:
blueprint = ConstructBlueprint.make_from_raw(ComposerTestData.NESTED_CONSTRUCT)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_address,
output_class=Company,
@@ -301,6 +310,7 @@ class TestStructuredContentComposerNestedOptional:
blueprint = ConstructBlueprint.make_from_raw(nested_construct)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_address,
output_class=CompanyWithOptionalAddress,
@@ -332,6 +342,7 @@ class TestStructuredContentComposerErrors:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=SimpleReport,
@@ -366,6 +377,7 @@ class TestStructuredContentComposerErrors:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=SalesSummary,
@@ -388,6 +400,7 @@ class TestStructuredContentComposerErrors:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=SimpleReport,
@@ -419,6 +432,7 @@ class TestStructuredContentComposerWithTemplates:
blueprint = ConstructBlueprint.make_from_raw(ComposerTestData.MIXED_CONSTRUCT)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=SalesSummary,
@@ -487,6 +501,7 @@ class TestStructuredContentComposerDottedPathTypeConversion:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_container,
output_class=OutputWithStringField,
@@ -512,6 +527,7 @@ class TestStructuredContentComposerDottedPathTypeConversion:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_container,
output_class=OutputWithTextContentField,
@@ -561,6 +577,7 @@ class TestGetNestedFieldClassOptionalSyntaxes:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=CompanyWithTypingOptionalAddress,
@@ -590,6 +607,7 @@ class TestGetNestedFieldClassOptionalSyntaxes:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=CompanyWithOptionalAddress,
@@ -615,12 +633,14 @@ class TestGetNestedFieldClassOptionalSyntaxes:
working_memory = WorkingMemory()
composer_typing_optional = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=CompanyWithTypingOptionalAddress,
)
composer_union_syntax = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=CompanyWithOptionalAddress,
@@ -679,6 +699,7 @@ class TestGetNestedFieldClassGenericTypes:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=CompanyWithAddressList,
@@ -707,6 +728,7 @@ class TestGetNestedFieldClassGenericTypes:
working_memory = WorkingMemory()
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory,
output_class=CompanyWithAddressDict,
@@ -778,6 +800,7 @@ class TestStructuredContentComposerRuntimeParams:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=ReportWithRuntimeParams,
@@ -807,6 +830,7 @@ class TestStructuredContentComposerRuntimeParams:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=ReportWithRuntimeParams,
@@ -837,6 +861,7 @@ class TestStructuredContentComposerRuntimeParams:
)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=ReportWithRuntimeParams,
@@ -868,6 +893,7 @@ class TestStructuredContentComposerRuntimeParams:
blueprint = ConstructBlueprint.make_from_raw(nested_construct)
composer = StructuredContentComposer(
+ templating_style=_TEMPLATING_STYLE,
construct_blueprint=blueprint,
working_memory=working_memory_with_deal,
output_class=NestedReportWithRuntimeParams,
diff --git a/tests/unit/pipelex/pipe_operators/pipe_img_gen/test_compose_drops_embedded_image.py b/tests/unit/pipelex/pipe_operators/pipe_img_gen/test_compose_drops_embedded_image.py
index bb1a7b74e..f6e5a5193 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_img_gen/test_compose_drops_embedded_image.py
+++ b/tests/unit/pipelex/pipe_operators/pipe_img_gen/test_compose_drops_embedded_image.py
@@ -31,6 +31,7 @@ from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.stuffs.image_content import ImageContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.interpreter_hub import get_native_concept, get_pipe_router
+from pipelex.kernel.templating_style_ops import resolve_templating_style
from pipelex.pipe_machinery.pipe_factory import PipeFactory
from pipelex.pipe_operators.compose.pipe_compose import PipeCompose, PipeComposeOutput
from pipelex.pipe_operators.compose.pipe_compose_blueprint import PipeComposeBlueprint
@@ -100,7 +101,9 @@ async def _compose_then_build_img_gen_prompt(job_metadata: JobMetadata) -> tuple
prompt="$gen_prompt",
),
)
- img_gen_prompt = await pipe_img_gen.img_gen_prompt_blueprint.make_img_gen_prompt(context_provider=working_memory)
+ img_gen_prompt = await pipe_img_gen.img_gen_prompt_blueprint.make_img_gen_prompt(
+ context_provider=working_memory, templating_style=resolve_templating_style(authored=None)
+ )
return composed_prompt_text, img_gen_prompt
diff --git a/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_templating_style.py b/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_templating_style.py
new file mode 100644
index 000000000..345650cca
--- /dev/null
+++ b/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_templating_style.py
@@ -0,0 +1,80 @@
+"""Authored `templating_style` on PipeLLM: parsing shapes, spec passthrough, factory widening.
+
+The authored surface is a typed union — a bare string is the `tag_style` shorthand, an inline
+table is the full struct — and the union never travels past parsing: the factory widens a bare
+`TagStyle` into a full `TemplatingStyle` so the runtime `PipeLLM` holds `TemplatingStyle | None`.
+"""
+
+from collections.abc import Callable
+from typing import Any
+
+from pipelex.builder.pipe.pipe_llm_spec import PipeLLMSpec
+from pipelex.pipe_machinery.pipe_factory import PipeFactory
+from pipelex.pipe_operators.llm.pipe_llm import PipeLLM
+from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
+from pipelex.tools.templating.templating_style import TagStyle, TemplatingStyle
+from pipelex.tools.templating.text_format import TextFormat
+
+_BASE_TABLE: dict[str, Any] = {
+ "description": "templating style parsing test",
+ "inputs": {"topic": "native.Text"},
+ "output": "native.Text",
+ "prompt": "Here is the topic:\n@topic",
+}
+
+
+def _make_blueprint(**overrides: Any) -> PipeLLMBlueprint:
+ return PipeLLMBlueprint.model_validate({**_BASE_TABLE, **overrides})
+
+
+class TestPipeLLMTemplatingStyle:
+ def test_absent_is_none_at_blueprint_level(self):
+ assert _make_blueprint().templating_style is None
+
+ def test_bare_string_is_tag_style_shorthand(self):
+ blueprint = _make_blueprint(templating_style="no_tag")
+ assert blueprint.templating_style is TagStyle.NO_TAG
+
+ def test_inline_table_is_full_struct(self):
+ blueprint = _make_blueprint(templating_style={"tag_style": "xml", "text_format": "markdown"})
+ assert blueprint.templating_style == TemplatingStyle(tag_style=TagStyle.XML, text_format=TextFormat.MARKDOWN)
+
+ def test_spec_passes_through_to_blueprint(self):
+ spec = PipeLLMSpec.model_validate(
+ {
+ "pipe_code": "templating_style_spec_case",
+ "description": "templating style spec passthrough",
+ "inputs": {},
+ "output": "native.Text",
+ "prompt": "Say hello",
+ "templating_style": "square_brackets",
+ }
+ )
+ assert spec.to_blueprint().templating_style is TagStyle.SQUARE_BRACKETS
+
+ def test_factory_widens_bare_tag_style(self, load_empty_library: Callable[[], str]):
+ load_empty_library()
+ pipe = PipeFactory[PipeLLM].make_from_blueprint(
+ domain_code="test_domain",
+ pipe_code="widen_bare_tag_style",
+ blueprint=_make_blueprint(templating_style="square_brackets"),
+ )
+ assert pipe.templating_style == TemplatingStyle(tag_style=TagStyle.SQUARE_BRACKETS, text_format=TextFormat.PLAIN)
+
+ def test_factory_passes_full_struct_through(self, load_empty_library: Callable[[], str]):
+ load_empty_library()
+ pipe = PipeFactory[PipeLLM].make_from_blueprint(
+ domain_code="test_domain",
+ pipe_code="full_struct_passthrough",
+ blueprint=_make_blueprint(templating_style={"tag_style": "xml", "text_format": "markdown"}),
+ )
+ assert pipe.templating_style == TemplatingStyle(tag_style=TagStyle.XML, text_format=TextFormat.MARKDOWN)
+
+ def test_factory_keeps_absent_as_none(self, load_empty_library: Callable[[], str]):
+ load_empty_library()
+ pipe = PipeFactory[PipeLLM].make_from_blueprint(
+ domain_code="test_domain",
+ pipe_code="absent_stays_none",
+ blueprint=_make_blueprint(),
+ )
+ assert pipe.templating_style is None
diff --git a/tests/unit/pipelex/pipe_operators/pipe_llm/test_prompt_rendering_purity.py b/tests/unit/pipelex/pipe_operators/pipe_llm/test_prompt_rendering_purity.py
index a908a8677..d4eb6c8b4 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_llm/test_prompt_rendering_purity.py
+++ b/tests/unit/pipelex/pipe_operators/pipe_llm/test_prompt_rendering_purity.py
@@ -3,15 +3,15 @@
`PipeLibrary.get_required_pipe` hands out the stored pipe instance — nothing copies it — so
any write-back performed while rendering a prompt pollutes shared, long-lived state. Two
sites used to do exactly that: `PipeLLM._live_run_operator_pipe` cached the config-derived
-prompting style onto `self.llm_prompt_spec`, and `LLMPromptBlueprint._unravel_text` wrote
+templating style onto `self.llm_prompt_spec`, and `LLMPromptBlueprint._unravel_text` wrote
the spec-level style into the caller's `TemplateBlueprint`.
Pinned behaviors:
- rendering a prompt leaves the `TemplateBlueprint` untouched (the run-scoped style is
passed as a parameter, never stored)
-- a blueprint-declared `templating_style` wins over the run-derived one; without one, the
- run-derived style governs
+- a template-declared `templating_style` wins over the resolved one; without one, the
+ resolved style governs
- a dry run of a `PipeLLM` leaves `pipe.model_dump()` byte-identical, so the serialized form
that feeds the graph registry and the Temporal crate payload does not depend on run order
"""
@@ -60,7 +60,7 @@ class TestPromptRenderingPurity:
self,
load_empty_library: Callable[[], str],
):
- """Regression: `_unravel_text` used to write the run-derived style into the caller's
+ """Regression: `_unravel_text` used to write the run-scoped style into the caller's
`TemplateBlueprint`, which on a library-held pipe is shared long-lived state.
"""
load_empty_library()
@@ -82,9 +82,9 @@ class TestPromptRenderingPurity:
@pytest.mark.parametrize(
("topic", "blueprint_style", "passed_style", "expects_xml_tag"),
[
- ("blueprint style wins over the run-derived one", _XML_STYLE, _NO_TAG_STYLE, True),
- ("run-derived style governs when the blueprint declares none", None, _XML_STYLE, True),
- ("run-derived style is really applied, not merely tolerated", None, _NO_TAG_STYLE, False),
+ ("template style wins over the resolved one", _XML_STYLE, _NO_TAG_STYLE, True),
+ ("resolved style governs when the template declares none", None, _XML_STYLE, True),
+ ("resolved style is really applied, not merely tolerated", None, _NO_TAG_STYLE, False),
],
)
async def test_effective_style_precedence(
@@ -92,10 +92,10 @@ class TestPromptRenderingPurity:
load_empty_library: Callable[[], str],
topic: str,
blueprint_style: TemplatingStyle | None,
- passed_style: TemplatingStyle | None,
+ passed_style: TemplatingStyle,
expects_xml_tag: bool,
):
- """A blueprint-declared style takes precedence over the run-derived one.
+ """A template-declared style takes precedence over the resolved one.
The XML tag style wraps an `@variable` in `<name>...</name>`; NO_TAG inlines it bare,
so the rendered text tells us which style actually governed.
@@ -124,7 +124,7 @@ class TestPromptRenderingPurity:
self,
load_empty_library: Callable[[], str],
):
- """Regression: the operator used to cache the config-derived prompting style onto
+ """Regression: the operator used to cache the config-derived templating style onto
`self.llm_prompt_spec`, so a pipe's `model_dump()` — which feeds the graph registry and
the crate payload sent to a Temporal worker — differed before and after its first run.
"""
diff --git a/tests/unit/pipelex/providers/anthropic/test_anthropic_reasoning.py b/tests/unit/pipelex/providers/anthropic/test_anthropic_reasoning.py
new file mode 100644
index 000000000..c3420e538
--- /dev/null
+++ b/tests/unit/pipelex/providers/anthropic/test_anthropic_reasoning.py
@@ -0,0 +1,106 @@
+import pytest
+from pytest_mock import MockerFixture
+
+from pipelex.cogt.exceptions import LLMCapabilityError
+from pipelex.cogt.llm.llm_job_components import LLMJobParams, ReasoningEffort
+from pipelex.cogt.llm.thinking_mode import ThinkingMode
+from pipelex.providers.anthropic.anthropic_config import AnthropicConfig
+from pipelex.providers.anthropic.anthropic_llm_worker import AnthropicLLMWorker
+
+_ANTHROPIC_LEVEL_MAP: dict[str, str] = {
+ "none": "disabled",
+ "minimal": "low",
+ "low": "low",
+ "medium": "medium",
+ "high": "high",
+ "xhigh": "xhigh",
+ "max": "max",
+}
+
+
+def _make_worker(mocker: MockerFixture, thinking_mode: ThinkingMode) -> AnthropicLLMWorker:
+ """Create a minimal AnthropicLLMWorker with a mocked inference_model."""
+ worker = object.__new__(AnthropicLLMWorker)
+ mock_model = mocker.MagicMock()
+ mock_model.thinking_mode = thinking_mode
+ mock_model.desc = "test-model"
+ worker.inference_model = mock_model
+ return worker
+
+
+def _mock_config(mocker: MockerFixture, budget_mock: object | None = None) -> None:
+ """Mock get_config() with a real anthropic_config and an optional get_reasoning_budget mock."""
+ anthropic_config = AnthropicConfig(structured_output_timeout_seconds=1200, effort_to_level_map=_ANTHROPIC_LEVEL_MAP)
+ llm_config = mocker.MagicMock(anthropic_config=anthropic_config)
+ if budget_mock is not None:
+ llm_config.get_reasoning_budget = budget_mock
+ mocker.patch(
+ "pipelex.providers.anthropic.anthropic_llm_worker.get_config",
+ return_value=mocker.MagicMock(cogt=mocker.MagicMock(llm_config=llm_config)),
+ )
+
+
+class TestAnthropicReasoning:
+ """Tests for _build_thinking_params on AnthropicLLMWorker."""
+
+ @pytest.mark.parametrize(
+ ("effort", "expected_budget"),
+ [
+ (ReasoningEffort.MINIMAL, 512),
+ (ReasoningEffort.LOW, 1024),
+ (ReasoningEffort.MEDIUM, 5000),
+ (ReasoningEffort.HIGH, 16384),
+ (ReasoningEffort.XHIGH, 32768),
+ (ReasoningEffort.MAX, 65536),
+ ],
+ )
+ def test_manual_mode_effort_maps_to_budget(
+ self,
+ mocker: MockerFixture,
+ effort: ReasoningEffort,
+ expected_budget: int,
+ ):
+ """MANUAL mode maps each non-NONE ReasoningEffort to the correct budget_tokens, keyed by the worker-owned family."""
+ worker = _make_worker(mocker, thinking_mode=ThinkingMode.MANUAL)
+ budget_mock = mocker.MagicMock(return_value=expected_budget)
+ _mock_config(mocker, budget_mock=budget_mock)
+ job_params = LLMJobParams(temperature=0.5, reasoning_effort=effort)
+ result = worker._build_thinking_params(job_params=job_params, max_tokens=100000) # noqa: SLF001 # pyright: ignore[reportPrivateUsage]
+ assert result.thinking == {"type": "enabled", "budget_tokens": expected_budget}
+ assert result.suppress_temperature is True
+ budget_mock.assert_called_once_with(family="anthropic", effort=effort)
+
+ def test_manual_mode_effort_none_disables_thinking(self, mocker: MockerFixture):
+ """MANUAL mode with NONE effort disables thinking entirely (no budget lookup)."""
+ worker = _make_worker(mocker, thinking_mode=ThinkingMode.MANUAL)
+ budget_mock = mocker.MagicMock()
+ _mock_config(mocker, budget_mock=budget_mock)
+ job_params = LLMJobParams(temperature=0.5, reasoning_effort=ReasoningEffort.NONE)
+ result = worker._build_thinking_params(job_params=job_params, max_tokens=100000) # noqa: SLF001 # pyright: ignore[reportPrivateUsage]
+ assert result.thinking is None
+ assert result.suppress_temperature is False
+ budget_mock.assert_not_called()
+
+ def test_effort_budget_capped_by_max_tokens(self, mocker: MockerFixture):
+ """Effort-resolved budget is capped to max_tokens - 1 when max_tokens is small."""
+ worker = _make_worker(mocker, thinking_mode=ThinkingMode.MANUAL)
+ budget_mock = mocker.MagicMock(return_value=16384)
+ _mock_config(mocker, budget_mock=budget_mock)
+ job_params = LLMJobParams(temperature=0.5, reasoning_effort=ReasoningEffort.HIGH)
+ result = worker._build_thinking_params(job_params=job_params, max_tokens=2000) # noqa: SLF001 # pyright: ignore[reportPrivateUsage]
+ assert result.thinking == {"type": "enabled", "budget_tokens": 1999}
+
+ def test_explicit_budget_passes_through(self, mocker: MockerFixture):
+ """Explicit reasoning_budget passes through directly as budget_tokens in MANUAL mode."""
+ worker = _make_worker(mocker, thinking_mode=ThinkingMode.MANUAL)
+ job_params = LLMJobParams(temperature=0.5, reasoning_budget=8192)
+ result = worker._build_thinking_params(job_params=job_params, max_tokens=100000) # noqa: SLF001 # pyright: ignore[reportPrivateUsage]
+ assert result.thinking == {"type": "enabled", "budget_tokens": 8192}
+ assert result.suppress_temperature is True
+
+ def test_thinking_mode_none_raises_capability_error(self, mocker: MockerFixture):
+ """Models with thinking_mode=none should raise LLMCapabilityError on reasoning_effort."""
+ worker = _make_worker(mocker, thinking_mode=ThinkingMode.NONE)
+ job_params = LLMJobParams(temperature=0.5, reasoning_effort=ReasoningEffort.HIGH)
+ with pytest.raises(LLMCapabilityError, match="does not support reasoning"):
+ worker._build_thinking_params(job_params=job_params, max_tokens=100000) # noqa: SLF001 # pyright: ignore[reportPrivateUsage]
diff --git a/tests/unit/pipelex/providers/google/test_google_reasoning.py b/tests/unit/pipelex/providers/google/test_google_reasoning.py
index e99b76ad9..283fcbb6a 100644
--- a/tests/unit/pipelex/providers/google/test_google_reasoning.py
+++ b/tests/unit/pipelex/providers/google/test_google_reasoning.py
@@ -19,12 +19,11 @@ _GOOGLE_LEVEL_MAP: dict[str, str] = {
}
-def _make_worker(mocker: MockerFixture, thinking_mode: ThinkingMode, prompting_target: str = "gemini") -> GoogleLLMWorker:
+def _make_worker(mocker: MockerFixture, thinking_mode: ThinkingMode) -> GoogleLLMWorker:
"""Create a minimal GoogleLLMWorker with a mocked inference_model."""
worker = object.__new__(GoogleLLMWorker)
mock_model = mocker.MagicMock()
mock_model.thinking_mode = thinking_mode
- mock_model.prompting_target = prompting_target
mock_model.desc = "test-model"
worker.inference_model = mock_model
return worker
@@ -65,15 +64,16 @@ class TestGoogleReasoning:
effort: ReasoningEffort,
expected_budget: int,
):
- """MANUAL mode maps each non-NONE ReasoningEffort to the correct thinking_budget."""
+ """MANUAL mode maps each non-NONE ReasoningEffort to the correct thinking_budget, keyed by the worker-owned family."""
worker = _make_worker(mocker, thinking_mode=ThinkingMode.MANUAL)
google_config = GoogleConfig(effort_to_level_map=_GOOGLE_LEVEL_MAP)
+ budget_mock = mocker.MagicMock(return_value=expected_budget)
mocker.patch(
"pipelex.providers.google.google_llm_worker.get_config",
return_value=mocker.MagicMock(
cogt=mocker.MagicMock(
llm_config=mocker.MagicMock(
- get_reasoning_budget=mocker.MagicMock(return_value=expected_budget),
+ get_reasoning_budget=budget_mock,
google_config=google_config,
),
),
@@ -83,6 +83,7 @@ class TestGoogleReasoning:
result = worker._build_thinking_config(job_params=job_params, max_tokens=100000) # noqa: SLF001 # pyright: ignore[reportPrivateUsage]
assert result is not None
assert result.thinking_budget == expected_budget
+ budget_mock.assert_called_once_with(family="gemini", effort=effort)
@pytest.mark.parametrize(
("effort", "expected_level"),
diff --git a/tests/unit/pipelex/tools/test_jinja2_style_context_strictness.py b/tests/unit/pipelex/tools/test_jinja2_style_context_strictness.py
new file mode 100644
index 000000000..6d5e118ad
--- /dev/null
+++ b/tests/unit/pipelex/tools/test_jinja2_style_context_strictness.py
@@ -0,0 +1,57 @@
+"""Every styling filter fails loudly when the render context carries no templating style.
+
+There used to be three independent fallbacks — `TagStyle.TICKS` in `apply_tag_style`, `TextFormat.PLAIN`
+in the `format` filter and again in `with_images`. Each quietly decided the shape of a prompt nobody had
+chosen a style for. Now that every prompt-rendering entry point resolves one, a missing key is a wiring
+bug, and these tests are what keeps a convenience default from creeping back in.
+"""
+
+from typing import Any
+
+import pytest
+from jinja2.runtime import Context
+from pytest_mock import MockerFixture
+
+from pipelex.core.stuffs.text_content import TextContent
+from pipelex.tools.jinja2.exceptions import Jinja2ContextError
+from pipelex.tools.jinja2.image_registry import ImageRegistry
+from pipelex.tools.jinja2.jinja2_filters import apply_tag_style, text_format
+from pipelex.tools.jinja2.jinja2_models import Jinja2ContextKey
+from pipelex.tools.jinja2.jinja2_with_images_filter import with_images
+
+
+class TestStyleContextStrictness:
+ def _make_context(self, mocker: MockerFixture, *, context_dict: dict[str, Any]) -> Any:
+ context = mocker.MagicMock(spec=Context)
+ context.get = lambda key, default=None: context_dict.get(key, default) # pyright: ignore[reportUnknownLambdaType, reportUnknownArgumentType]
+ return context
+
+ def test_tag_style_missing_raises(self, mocker: MockerFixture) -> None:
+ context = self._make_context(mocker, context_dict={})
+
+ with pytest.raises(Jinja2ContextError, match="No templating style in the render context"):
+ apply_tag_style(context=context, value="content", tag_name=None)
+
+ @pytest.mark.asyncio
+ async def test_text_format_missing_raises(self, mocker: MockerFixture) -> None:
+ context = self._make_context(mocker, context_dict={})
+
+ with pytest.raises(Jinja2ContextError, match="No templating style in the render context"):
+ await text_format(context, value=TextContent(text="content"))
+
+ def test_with_images_text_format_missing_raises(self, mocker: MockerFixture) -> None:
+ context = self._make_context(mocker, context_dict={Jinja2ContextKey.IMAGE_REGISTRY: ImageRegistry()})
+
+ with pytest.raises(Jinja2ContextError, match="No templating style in the render context"):
+ with_images(context, TextContent(text="content"))
+
+ @pytest.mark.asyncio
+ async def test_an_explicit_filter_argument_still_bypasses_the_context(self, mocker: MockerFixture) -> None:
+ """`{{ x | format("markdown") }}` names its own format, so it never reads the context key.
+
+ Strictness is about the *absent* decision, not about forbidding a per-call one — pinned here so
+ the raise above is not mistaken for "the context key is always required".
+ """
+ context = self._make_context(mocker, context_dict={})
+
+ assert await text_format(context, value="plain string", text_format="markdown") == "plain string"
diff --git a/tests/unit/pipelex/tools/test_jinja2_tag_filter.py b/tests/unit/pipelex/tools/test_jinja2_tag_filter.py
index ea694b729..fd42ddd28 100644
--- a/tests/unit/pipelex/tools/test_jinja2_tag_filter.py
+++ b/tests/unit/pipelex/tools/test_jinja2_tag_filter.py
@@ -20,8 +20,8 @@ from pipelex.tools.templating.templating_style import TagStyle
class TestTagFilterValidation:
"""Tests for tag filter error handling and edge cases."""
- def _make_context(self, mocker: MockerFixture, tag_style: TagStyle = TagStyle.TICKS) -> Any:
- """Create a mock Jinja2 context."""
+ def _make_context(self, mocker: MockerFixture, *, tag_style: TagStyle) -> Any:
+ """Create a mock Jinja2 context. The style is explicit: no filter supplies one any more."""
context_dict: dict[str, Any] = {
Jinja2ContextKey.TAG_STYLE: tag_style,
}
@@ -37,30 +37,30 @@ class TestTagFilterValidation:
async def test_tag_raises_on_undefined(self, mocker: MockerFixture) -> None:
"""Test tag raises error for undefined value."""
- context = self._make_context(mocker)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
with pytest.raises(Jinja2ContextError, match="undefined"):
await tag(context, value=Undefined())
async def test_tag_raises_on_undefined_with_tag_name(self, mocker: MockerFixture) -> None:
"""Test tag raises error for undefined value with tag name in message."""
- context = self._make_context(mocker)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
with pytest.raises(Jinja2ContextError, match="tag_name 'my_tag'"):
await tag(context, value=Undefined(), tag_name="my_tag")
async def test_tag_with_string_converts_to_string(self, mocker: MockerFixture) -> None:
"""Test tag filter converts plain string input."""
- context = self._make_context(mocker)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
result = await tag(context, value="hello world")
assert "hello world" in result
- assert "```" in result # Default style is TICKS
+ assert "```" in result
async def test_tag_with_number_converts_to_string(self, mocker: MockerFixture) -> None:
"""Test tag filter converts number input to string."""
- context = self._make_context(mocker)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
result = await tag(context, value=42)
@@ -78,7 +78,7 @@ class TestTagFilterValidation:
async def test_tag_with_tag_renderable(self, mocker: MockerFixture) -> None:
"""Test tag filter uses TagRenderable protocol."""
- context = self._make_context(mocker)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
# Create a mock TagRenderable with async method
mock_renderable = mocker.MagicMock(spec=TagRenderable)
@@ -108,7 +108,7 @@ class TestTagFilterValidation:
class TestApplyTagStyle:
"""Tests for apply_tag_style helper function."""
- def _make_context(self, mocker: MockerFixture, tag_style: TagStyle) -> Any:
+ def _make_context(self, mocker: MockerFixture, *, tag_style: TagStyle) -> Any:
"""Create a mock Jinja2 context with specific tag style."""
context_dict: dict[str, Any] = {
Jinja2ContextKey.TAG_STYLE: tag_style,
@@ -121,7 +121,7 @@ class TestApplyTagStyle:
def test_no_tag_style_returns_value_unchanged(self, mocker: MockerFixture) -> None:
"""Test NO_TAG style returns value unchanged."""
- context = self._make_context(mocker, TagStyle.NO_TAG)
+ context = self._make_context(mocker, tag_style=TagStyle.NO_TAG)
result = apply_tag_style(context=context, value="hello", tag_name="my_tag")
@@ -129,7 +129,7 @@ class TestApplyTagStyle:
def test_ticks_style_without_tag_name(self, mocker: MockerFixture) -> None:
"""Test TICKS style without tag name."""
- context = self._make_context(mocker, TagStyle.TICKS)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
result = apply_tag_style(context=context, value="content", tag_name=None)
@@ -137,7 +137,7 @@ class TestApplyTagStyle:
def test_ticks_style_with_tag_name(self, mocker: MockerFixture) -> None:
"""Test TICKS style with tag name."""
- context = self._make_context(mocker, TagStyle.TICKS)
+ context = self._make_context(mocker, tag_style=TagStyle.TICKS)
result = apply_tag_style(context=context, value="content", tag_name="my_tag")
@@ -145,7 +145,7 @@ class TestApplyTagStyle:
def test_xml_style_without_tag_name_uses_default(self, mocker: MockerFixture) -> None:
"""Test XML style uses 'data' as default tag name."""
- context = self._make_context(mocker, TagStyle.XML)
+ context = self._make_context(mocker, tag_style=TagStyle.XML)
result = apply_tag_style(context=context, value="content", tag_name=None)
@@ -153,7 +153,7 @@ class TestApplyTagStyle:
def test_xml_style_with_tag_name(self, mocker: MockerFixture) -> None:
"""Test XML style with tag name."""
- context = self._make_context(mocker, TagStyle.XML)
+ context = self._make_context(mocker, tag_style=TagStyle.XML)
result = apply_tag_style(context=context, value="content", tag_name="my_tag")
@@ -161,7 +161,7 @@ class TestApplyTagStyle:
def test_square_brackets_style_without_tag_name_uses_default(self, mocker: MockerFixture) -> None:
"""Test SQUARE_BRACKETS style uses 'data' as default tag name."""
- context = self._make_context(mocker, TagStyle.SQUARE_BRACKETS)
+ context = self._make_context(mocker, tag_style=TagStyle.SQUARE_BRACKETS)
result = apply_tag_style(context=context, value="content", tag_name=None)
@@ -169,19 +169,22 @@ class TestApplyTagStyle:
def test_square_brackets_style_with_tag_name(self, mocker: MockerFixture) -> None:
"""Test SQUARE_BRACKETS style with tag name."""
- context = self._make_context(mocker, TagStyle.SQUARE_BRACKETS)
+ context = self._make_context(mocker, tag_style=TagStyle.SQUARE_BRACKETS)
result = apply_tag_style(context=context, value="content", tag_name="my_tag")
assert result == "[my_tag]\ncontent\n[/my_tag]"
- def test_default_style_is_ticks_when_not_set(self, mocker: MockerFixture) -> None:
- """Test default tag style is TICKS when not set in context."""
+ def test_missing_tag_style_raises(self, mocker: MockerFixture) -> None:
+ """A style-less render context is an error, not a silent triple-backtick default.
+
+ Every prompt-rendering entry point resolves a templating style, so a missing TAG_STYLE means
+ the render was set up without one — which used to reshape the prompt quietly.
+ """
context_dict: dict[str, Any] = {} # No TAG_STYLE set
context = mocker.MagicMock(spec=Context)
context.get = lambda key, default=None: context_dict.get(key, default) # pyright: ignore[reportUnknownLambdaType, reportUnknownArgumentType]
- result = apply_tag_style(context=context, value="content", tag_name=None)
-
- assert "```" in result # TICKS is default
+ with pytest.raises(Jinja2ContextError, match="No templating style in the render context"):
+ apply_tag_style(context=context, value="content", tag_name=None)
diff --git a/wip/drift-contracts/dogfood-log.md b/wip/drift-contracts/dogfood-log.md
index 8837f0f86..35039c535 100644
--- a/wip/drift-contracts/dogfood-log.md
+++ b/wip/drift-contracts/dogfood-log.md
@@ -79,7 +79,21 @@ The surviving finding is real and small: the table under "What a programmatic ca
- **2026-08-13 · cli-docs · clean-pass** — opened by the PR #1099 review fixes to `validate pipe` / `show pipe` (ambiguity now a clean exit instead of a traceback) and `which` (markup escaping). Reviewed both targets: `docs/tools/cli/` documents no exit codes or error rendering for these commands and has no `which` page, and the agent-CLI contract doc covers only the agent CLI, untouched here. The one user-visible behavior (ambiguous codes refused, naming candidates) was already documented in `docs/building-methods/libraries.md` by this branch — the fixes make the code honor the doc, the pleasant inverse of drift. Second consecutive clean-pass on cli-docs from the same underlying fact (the targets simply do not document the surfaces this branch keeps touching); not yet friction — the contract opened on genuine CLI-surface edits and the review was cheap.
- **2026-08-13 · pipelex-kernel-docs · clean-pass** — Opened on the `search_domain_codes`→`search_scope` rename threading through `shape_inputs` and the boot-contract mock swapping to `get_required_entry_concept`; the kernel doc names neither the parameter nor the resolver method, so nothing was stale.
+
+- **2026-08-14 · config-docs · scope-miss (recorded in arrears)** — The templating-style work deleted `[pipelex.prompting_config]` and its `prompting_styles` sub-table from `pipelex.toml`, opening `config-docs` in Phase 1. The review target `docs/configuration/**/*.md` was read in full and honestly found to say nothing about the block, so the ack was "no configuration page mentions it" — and that was true. The page that *did* document that exact config block, field by field, with a TOML sample and the Python signature of the accessor being deleted, was `docs/building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md`, which no contract watches. It stayed stale for three phases and was deleted in Phase 4 by a plan step, not by a contract.
+
+ The transferable part is the shape, not the miss: **the contract's review target is scoped by directory, but the docs are organized by audience.** A `[pipelex.*_config]` block explained to authors lives under `docs/building-methods/`; a contract whose stated job is "user-facing configuration docs must track the config model and the shipped defaults" cannot see it. The ack was honest and the contract was correct on its own terms — the trigger fired, the target was reviewed, the target was clean. Every step worked and the stale page survived, which is the failure mode worth naming: a review target narrower than the claim in the contract's `description` produces confident green.
+
+ Not proposing a widening to `docs/**` — that makes every config touch review the whole site and the acks go perfunctory, which this log has already warned about twice. The narrower reading is that a doc page reproducing a config block's *schema* (field list, TOML sample, accessor signature) is a config doc wherever it is filed, and the cheap instrument is a grep-based derived check for `[pipelex.` TOML blocks appearing under `docs/` outside `docs/configuration/`, not another review obligation. Recorded here rather than acted on, per the pilot's bias.
+
+- **2026-08-14 · Phase 4 (docs-only) · no contract opened, correctly** — Worth one line for the asymmetry it demonstrates. The phase that rewrote or deleted every doc page in this change's blast radius opened nothing, because drift contracts key on *code* triggers: they catch code that outran its docs, never docs that outran their code. That is the right asymmetry — a docs-only edit has no code to re-review — but it means the instrument is structurally silent exactly when a doc is being replaced wholesale, which is when a cross-reference is most likely to be left dangling. The `mkdocs.yml` nav/redirect rewiring and the `docs/404.html` prefix-rule chain were verified by hand here; nothing in the drift system would have flagged them.
+
- **2026-08-14 · pipelex-kernel-docs · friction** — Reopened with **zero trigger-file changes**. Every blob under `pipelex/kernel/**` and `test_kernel_boot_contract.py` was byte-identical to the previous ack (verified by diffing the ack's recorded `trigger_files` map against `git ls-files -s`); what moved was the contract-definition half of the digest, across the `dev` merge on `feature/usage-graph-spec`. So the obligation fired on a change that could not, even in principle, have made the review target stale — and it fired in CI, as the one red check on PR #1100, on a branch about graph usage attribution that never touched the kernel.
No **trigger** narrowing prevents this one: the triggers matched nothing. It is the definition-change reopening rule, and the case for that rule is real (widen a glob or add a review target and every prior ack genuinely under-covers). But it does not distinguish a *semantic* definition change from bookkeeping. Two candidate refinements, both cheap: digest the definition and the trigger content **separately**, so `drift plan` can say "definition-only reopening, trigger content unchanged" and a reviewer knows up front that no code moved; or exempt a definition change that only **narrows** (removing triggers, removing review targets) since the prior review still covers a superset. The first is the honest one — it costs a field in the ack file and turns this entry's ten minutes of forensics into a printed line.
The review itself: ran anyway, on both halves the contract names. Module table diffed against every public function AST-parsed out of `pipelex/kernel/*.py` — complete, including `concrete_llm_model_handle` added by this branch; `kernel.exceptions` is correctly absent (error classes, no entry point), which the check flagged and I dismissed by opening it, the same lead-generator-not-verdict lesson the 2026-08-03 entry draws. Gates table's claim that the boot-contract test covers every entry point except the three `resolve_*_setting` deck-reading helpers still matches that test's own stated exception. Nothing stale.
**Third consecutive clean review on this contract** (2026-08-03, 2026-08-13, today), and today's opened on nothing at all. The pattern is not yet "drop" — the doc is a real specification and a renamed entry point would genuinely falsify it — but it is worth asking at verdict time whether the module table, the one part that keeps being checked and keeps being fine, is mechanizable outright: the AST enumeration I wrote here is ~20 lines and would have answered "is the table complete" as a derived check, leaving only the prose claims to human review.
+
+- **2026-08-14 · pipelex-kernel-docs · real-catch, on the entry immediately above** — Merging `dev` into `fix/Keyless-dry-run` reopened the contract on a genuine trigger change: `llm_ops.py` gained `concrete_llm_model_handle`, textually conflicting with this branch's deletion of `derive_templating_style`. The module table took the union and was fine. The Gates row was not: it claimed the boot-contract test runs every kernel entry point *except the three `resolve_*_setting` helpers*, and `concrete_llm_model_handle` reads the deck too and has no arm in that test — so the "sole exception" was false from the moment the function landed on `dev`. Fixed the row (and the test docstring it derives from) to name deck-reading helpers as a class rather than a count.
+ The transferable part is **who missed it, and why the miss was structurally invited**. The entry directly above is the ack that let it through, and its rationale is precise about what it checked: the module table was AST-diffed and found complete *including* `concrete_llm_model_handle`, and the Gates claim was verified as "still matches that test's own stated exception." Both statements are true. The reviewer checked the table against the code, and the doc against the test — but never the *test's* claim against the code, which is where the new function fell out of the enumeration. **A consistency check between two documents is not a check against reality**, and two mutually-agreeing prose claims are exactly the shape that survives it. This is the inverse of the 2026-08-09 lesson: there, mechanical checks produced false positives that opening the file dismissed; here, a careful human check produced a false negative that only re-deriving the claim from the code would have caught.
+ Also worth noting for the friction verdict above: that entry proposed mechanizing the module table because it "keeps being checked and keeps being fine." The table was indeed fine again. The row that rotted is the one nobody proposed mechanizing — and it rotted *because* it counts ("the three"), the one construct the workspace writing rules already ban for going stale silently. A derived check that enumerates deck-reading kernel functions and asserts the boot-contract test's exception list matches would be cheaper than the table check and would have caught this; the table check would not have.
+ Third consecutive clean review is now second, and the reopening it complained about turned out to be the one that mattered.
diff --git a/wip/keyless/keyless-boot-changes-dry-prompts.md b/wip/keyless/keyless-boot-changes-dry-prompts.md
new file mode 100644
index 000000000..f7fa7a202
--- /dev/null
+++ b/wip/keyless/keyless-boot-changes-dry-prompts.md
@@ -0,0 +1,59 @@
+# Bug report — a keyless boot silently changes what a DRY run renders
+
+**Filed 2026-08-14 as the brief for this fix branch (`fix/Keyless-dry-run`).** Measured 2026-08-08 against the then-current tip; re-verify on this branch before building the fix — the boot and deck code has moved since (v0.43.x, v0.44.0).
+
+> ## ✅ CLOSED 2026-08-14 — dissolved, not fixed
+>
+> **This bug no longer exists, and the mechanism it describes has been deleted.** Prompt shape is now an authoring decision: a pipe declares `templating_style`, anything that declares nothing takes one runtime default from config, and **no code path consults the deck, a model spec, or a credential to decide how a prompt is tagged**. A keyless boot and a keyed boot therefore render byte-identical prompts by construction — there is no longer a derivation that could disagree with itself.
+>
+> The two load-bearing facts in "Why it happens" are both gone: `derive_templating_style` is deleted, and the `TagStyle.TICKS` fallback that made a `None` style silently *render* rather than *fail* is deleted too. Where a style is genuinely absent, the Jinja2 filters now raise `Jinja2ContextError` instead of quietly picking a shape — so the specific failure mode named in this report's title, *silently*, is unreachable even in principle.
+>
+> Shipped on this same branch: design in [`../prompting-style/prompt-style-as-an-authoring-decision.md`](../prompting-style/prompt-style-as-an-authoring-decision.md), build in [`../prompting-style/templating-style-implementation-plan.md`](../prompting-style/templating-style-implementation-plan.md). Note the change was **not** undertaken to fix this bug — it was a separate design ruling that happened to dissolve it, which is why the fix plan's core survives while its headline does not.
+>
+> **What did not get fixed.** The underlying boot behaviour this report *diagnosed* is untouched: a keyless boot still drops every backend and still yields an empty deck. That still has consequences — a skipped `max_prompt_images` check, skipped image-param validation, handle-pinned bundles rejected, and the two CLIs disagreeing about whether `--dry-run` needs credentials. Those survive in the re-scoped [`keyless-dry-prompts-fix-plan.md`](keyless-dry-prompts-fix-plan.md) and are pending their own re-judging. **"Why it stayed invisible" below is still worth reading** — the two-sided-gate blindness it describes is a general lesson about measurement, not a fact about prompting.
+
+## The claim it undermines
+
+A DRY run's whole purpose is to rehearse the real run without spending money — which is why it is documented as needing no keys. That promise is naturally read as "same program, mocked leaves". It currently is not: **a dry run booted keyless renders different prompts from a dry run booted with credentials, and nothing in either run says so.**
+
+## Reproduction
+
+Take any method where a second `PipeLLM` step's prompt embeds a first step's output (so the tag style is observable in the rendered prompt), and run it DRY twice — identical inputs, identical method. The only difference is the boot: `needs_inference=False` (keyless) vs `needs_inference=True` (keyed).
+
+| boot | `derive_templating_style(llm_setting=…)` | how step 1's output is tagged into step 2's prompt |
+| --- | --- | --- |
+| keyless | `None` | fallback style, e.g. `` result: ``` `` |
+| keyed | the model's own, e.g. `xml/plain` | `<result>` |
+
+Both runs complete, both report the same usage records, neither logs anything about the difference. The two output texts differ only in how the first step's result is tagged into the second step's prompt.
+
+## Why it happens
+
+`RuntimeBoot.make` derives `effective_needs_model_specs` from `needs_inference`, so a keyless boot loads no inference models into the deck. `pipelex/kernel/llm_ops.py::derive_templating_style` then takes its documented `None` path — written for the external-LLM-plugin case, where "the deck has no model for this handle" means the model is real but managed elsewhere. A keyless boot satisfies that condition for **every** model at once, and the caller cannot tell the two situations apart. Prompt rendering downstream falls back to its default tag style instead of the model's own.
+
+## Why it stayed invisible
+
+Any gate whose two sides boot the same way cannot see this variable at all, and reads as evidence that it does not matter. Two keyless sides agree with each other perfectly; the divergence only surfaces when a keyless side is compared against a side that *cannot* boot keyless (e.g. a worker whose boot hard-fails without credentials). It first presents as a downstream divergence ("the same program produces different content over there") — it is not; splitting the boot variable isolates it.
+
+## Blast radius, as far as it was measured
+
+- Only the *rendered prompt* was compared. Whether anything else keyed off the deck changes under a keyless boot was not enumerated — worth enumerating as part of the fix.
+- A dry run used for **validation** — "does this method's prompt render?" — is validating a prompt the live run will not send, whenever it is run keyless.
+
+## What the fix has to decide first
+
+Is a keyless dry run meant to be **faithful** (then the deck's prompting metadata must load without credentials — `needs_model_specs=True` already exists as that seam) or merely **cheap** (then the divergence is by design and should be said out loud, at least as a log line)? Either way, the current state — faithful-looking and unfaithful, with no signal — is the one that should not persist.
+
+---
+
+## Re-verified 2026-08-14 at this branch's base (tip `84b1f682c`, v0.44.0 — before the templating-style change) — and one premise above is wrong
+
+The divergence reproduces exactly as described: a keyless boot derives `None`, a keyed boot derives `xml/plain`, and `None` renders as `TICKS` because `apply_tag_style` defaults to it when `TAG_STYLE` was never put on the Jinja2 context.
+
+> **The TICKS half is now false, deliberately** — see the CLOSED box above. `apply_tag_style` has no fallback any more: a render context with no tag style raises `Jinja2ContextError` rather than quietly choosing a shape, and there is no deck-derived style left to be `None`. Kept as the record of what reproduced at that tip.
+
+**But the last paragraph's parenthesis is false.** `needs_model_specs=True` is *not* the faithful seam. Measured on a machine with no credentials at all, it changes nothing — the deck is empty in both modes. `needs_model_specs` only governs whether the *gateway's* remote specs are fetched or dummied; what empties the deck is `lenient=not needs_inference`, which makes the backend loader **skip every backend whose `${…_API_KEY}` cannot substitute** — and every shipped backend, gateway included, declares its key that way. There is currently no flag combination that gives a credential-free process a populated deck. The seam has to be built, not switched on.
+
+Two things also worth carrying forward: the prompting metadata itself was credential-free on-disk data (~~`prompting_target` lives in the per-backend spec TOMLs~~ — that field is deleted too), which is what made "faithful" cheap; and the blast radius includes a *loud* converse — on a keyless machine a bundle pinning a bare model handle is **rejected** by validation, while preset-pinned methods silently get rewritten prompts.
+
+Full measurements, the enumerated blast radius, and the TDD fix plan: [`keyless-dry-prompts-fix-plan.md`](keyless-dry-prompts-fix-plan.md).
diff --git a/wip/keyless/keyless-dry-prompts-fix-plan.md b/wip/keyless/keyless-dry-prompts-fix-plan.md
new file mode 100644
index 000000000..28fbd5e2b
--- /dev/null
+++ b/wip/keyless/keyless-dry-prompts-fix-plan.md
@@ -0,0 +1,199 @@
+# Fix plan — a keyless boot must not change what a DRY run renders
+
+**Written 2026-08-14 on `fix/Keyless-dry-run`, against tip `84b1f682c` (v0.44.0).** Brief: [`keyless-boot-changes-dry-prompts.md`](keyless-boot-changes-dry-prompts.md). Everything in §0 was measured on this branch today, not carried over from the 2026-08-08 measurement.
+
+> ✅ **Re-scoped 2026-08-14 — the hold is lifted and the headline symptom is gone, dissolved rather than fixed.** The templating-style change shipped on this same branch ([design](../prompting-style/prompt-style-as-an-authoring-decision.md), [build](../prompting-style/templating-style-implementation-plan.md)): prompt shape is now declared on the pipe and defaulted from config, and **no code path consults the deck, a model spec, or a credential to decide it.** A keyless boot and a keyed boot therefore render byte-identical prompts by construction. **Symptoms 1 and 2 no longer exist, and neither do the fields they were about** — `prompting_target` and `derive_templating_style` are deleted. Part 1 (§3.2) is dissolved entirely; Part 3 (§3.4) loses its warning site.
+>
+> **What survives is a real bug and still worth fixing**, but it is a different bug than the one this plan was written for. A keyless boot still drops every backend, so the deck is still empty — and the deck still governs things that have nothing to do with prompting: symptoms 3, 4, 5 and 7 in §2. **Part 2 (§3.3) remains the core and is unchanged**; Part 4 (§3.5) remains the user-visible half. Sections below are annotated in place: struck premises are kept as the record of what was measured, not as instructions.
+>
+> ⚠️ **Re-judging the surviving residue is its own task.** With the headline symptom gone the cost/benefit has changed — the remaining symptoms are narrower and none of them silently rewrites output. Whether Part 2's `BackendLoadMode` surgery is still worth its blast radius is an open question for Louis, not a conclusion this plan should be read as having reached.
+
+## 0. Re-verification, and one correction to the brief
+
+### 0.1 The divergence reproduces ~~(dissolved — historical record)~~
+
+> **Dissolved.** `derive_templating_style` is deleted; the style no longer comes from the deck at all, so the last column of this table has no meaning against current code. Kept because the *first three* columns still reproduce exactly as measured — a keyless boot still yields a 0-model deck — and that is the mechanism symptoms 3/4/5 ride on.
+
+Booting `Pipelex.make(...)` three ways and asking for the deck-resolved default text setting's style:
+
+| boot | machine | deck `inference_models` | resolved setting | `derive_templating_style` |
+| --- | --- | --- | --- | --- |
+| `needs_inference=True` | keyed | 75 | `claude-4.6-sonnet` | `xml/plain` |
+| `needs_inference=False` | keyed | 2 | `claude-4.6-sonnet` | **`None`** |
+| `needs_inference=False, needs_model_specs=True` | keyed | 75 | `claude-4.6-sonnet` | `xml/plain` |
+| `needs_inference=False` | **no credentials at all** | **0** | `claude-4.6-sonnet` | **`None`** |
+| `needs_inference=False, needs_model_specs=True` | **no credentials at all** | **0** | `claude-4.6-sonnet` | **`None`** |
+
+`None` is not inert. `apply_tag_style` (`pipelex/tools/jinja2/jinja2_filters.py:120-122`) reads `TAG_STYLE` off the Jinja2 context and, when the key was never set, falls back to `TagStyle.TICKS` — so the step-2 prompt says ``result: ``` `` where a keyed run says `<result>`. The brief's reproduction table is accurate.
+
+> **Both halves of that sentence are now false, deliberately.** There is no deck-derived style to be `None`, and `apply_tag_style` no longer has a `TICKS` fallback — a context with no tag style raises `Jinja2ContextError` rather than silently choosing a shape. The silent-rewrite failure mode this plan was named for cannot recur: the only two outcomes left are the authored style and a loud error.
+
+### 0.2 The correction: `needs_model_specs=True` is **not** the faithful seam
+
+The brief closes with "`needs_model_specs=True` already exists as that seam". It does not. The last two rows above are the measurement that matters — on a machine with **no credentials**, `needs_model_specs=True` changes nothing, because it only governs whether the *gateway's* remote specs are fetched or dummied (`pipelex/runtime_boot.py:295-342`). The thing that actually empties the deck is a different flag on a different axis:
+
+```
+runtime_boot.setup(needs_inference=False)
+ → ModelManager.setup(needs_inference=False) # model_manager.py:72
+ → InferenceBackendLibrary.load(lenient=True) # model_manager.py:83
+ → every backend whose `api_key = "${…}"` cannot substitute
+ is SKIPPED entirely # backend_library.py:119-127
+ (log.verbose only — invisible at default log level)
+ → build_deck(enabled_backends=[]) # model_manager.py:93
+ → deck.inference_models == {}
+```
+
+Every shipped backend declares its key as a `${VAR}` (`pipelex/kit/configs/inference/backends.toml`), the gateway included (`${PIPELEX_GATEWAY_API_KEY}`). So on a keyless machine **`lenient=True` drops every backend**, and `lenient` is wired to `needs_inference`, not to `needs_model_specs`. There is currently *no* flag combination that gives a credential-free process a populated deck.
+
+That reframes the fix: this is not "flip the existing seam on", it is "build the seam".
+
+### 0.3 The metadata is already credential-free on disk
+
+The reason the faithful option is cheap: `max_prompt_images`, `rules`, `inputs`/`outputs` and costs live in the per-backend spec TOMLs, which need no credential to read. Only the *backend entry's* `${VAR}` substitution fails. The load conflates two unrelated things — "can I call this provider" and "do I know what its models are like" — and drops the second because the first failed.
+
+> *(`prompting_target` was the fourth item on that list and the one the plan leaned on hardest; it no longer exists. The argument is unaffected — the remaining fields are just as credential-free, and `max_prompt_images` is what symptom 3 needs.)*
+
+The gateway is the one genuine exception: its specs come from a remote fetch (`RemoteConfigFetcher.fetch_remote_config`, a public URL, no key needed for the fetch itself), so an offline keyless boot cannot know them. That residual is what §3.4 makes audible instead of silent.
+
+## 1. The decision: faithful, with the residual said out loud
+
+The brief asks the fix to choose between **faithful** and **cheap-but-honest**. Recommendation: **faithful**, because the metadata is free (§0.3) and because "same program, mocked leaves" is what a dry run is *for* — a rehearsal that quietly rewrites the script is worth less than no rehearsal. Concretely the invariant to establish:
+
+> **Credentials gate inference. They do not gate knowledge of models.** A boot without credentials resolves the same models and the same model constraints as a boot with them; what it cannot do is call a provider.
+
+*(The invariant originally said "the same prompting styles" too. That clause is now true unconditionally and for a different reason — prompt shape never consults the deck — so it is dropped rather than claimed as a benefit of this fix.)*
+
+One thing the invariant deliberately does not promise, handled in §3.4: gateway-hosted models on an **offline** keyless boot are unknowable, so warned. *(The second exception — an external-LLM-plugin model, absent from the deck, where a `None` style stayed correct — is gone with the style derivation.)*
+
+## 2. Blast radius, enumerated
+
+The brief asks for this enumeration as part of the fix. Everything a keyless boot changes, via the one mechanism "the deck has no `InferenceModelSpec`":
+
+| # | Symptom | Mechanism | Site | Status |
+| --- | --- | --- | --- | --- |
+| ~~1~~ | ~~Step-2 prompts tag step-1 output with ``` ``` ``` instead of `<…>`~~ | ~~style `None` → Jinja2 `TAG_STYLE` unset → `TICKS`~~ | — | **✅ dissolved** — no deck-derived style, and no `TICKS` fallback to land in |
+| ~~2~~ | ~~An **explicitly set** `llm_setting.prompting_target` is ignored~~ | ~~deck lookup short-circuits to `None`~~ | — | **✅ dissolved** — the field is deleted; the authored `templating_style` on the pipe is the only declaration and it is always honoured |
+| 3 | `PipeImgGen`'s `max_prompt_images` limit is not enforced | `model_spec` `None` → limit `None` → check skipped | `pipe_operators/img_gen/pipe_img_gen.py:172-173`, `img_gen_prompt_blueprint.py:81` | code-read, test in §3.1 |
+| 4 | `PipeImgGen` param-support validation is skipped | `spec is None` → early return | `pipe_operators/img_gen/pipe_img_gen.py:100-104` | code-read |
+| 5 | A bundle pinning a **bare model handle** is *rejected* on a keyless machine | `is_model_handle_defined` false against an empty deck | `cogt/models/model_deck_check.py:91-101` | **measured** (`ModelChoiceNotFoundError`) |
+| 6 | Deck preset validation degrades to log-only noise | every handle missing → `missing_presets_reaction = "log"` | `cogt/models/model_deck.py:612-630`, `pipelex.toml:140` | code-read |
+| 7 | The two CLIs disagree with each other on a keyless machine | `pipelex run --dry-run` boots **keyed** (so it fails outright without keys); `pipelex-agent run --dry` boots keyless (so it degrades silently) | `cli/commands/run/_run_core.py:419` vs `cli/agent_cli/commands/run/*_cmd.py` | code-read |
+
+~~Item 5 is the loud converse of item 1 and belongs in the same fix: today a keyless process silently rewrites prompts for preset-pinned methods *and* hard-rejects handle-pinned ones. Both stop once the deck is populated.~~
+
+**Item 5 now stands alone, and that changes its character.** With item 1 dissolved there is no longer a silent-rewrite half to pair it with: what remains is a keyless process *loudly rejecting* handle-pinned bundles. A loud wrong answer is a much weaker motivation for the Part 2 surgery than a silent one was — it is visible, diagnosable, and arguably even defensible ("this machine cannot resolve that handle"). This is the single biggest input into the re-judging flagged in the banner.
+
+**Verified non-effects** (so the fix does not chase them): dry-run mock usage records are model-independent — `dry_mock.py:152-165` uses fixed `DRY_RUN_INFERENCE_MODEL_*` constants — and mock text length comes from `dry_run_config`, not from any spec. The brief's "both report the same usage records" holds.
+
+## 3. The fix, in four parts
+
+TDD throughout: each part lands its tests first, red, then the implementation that turns them green.
+
+### 3.1 Part 0 — characterization tests (all red before any production edit)
+
+New module `tests/integration/pipelex/system/test_keyless_boot_model_metadata.py`, sibling to the existing `test_keyless_boot_forced_dry.py` (reuse its module-scoped `Pipelex.teardown_if_needed()` fixture pattern).
+
+**The two-sided gate must differ in exactly one variable — credential presence — and nothing else.** Do *not* compare a keyed boot against a keyless one: that varies the boot flag too, and CI machines may or may not carry real keys. Instead inject two secrets providers into an otherwise identical keyless boot:
+
+- `EmptySecretsProvider` — every lookup raises `SecretNotFoundError` (a genuinely keyless machine).
+- `FakeCredentialedSecretsProvider` — every lookup returns `"fake-key"` (a credentialed machine; no call is ever made, the boot is forced-DRY).
+
+Both via `Pipelex.make(secrets_provider=…, needs_inference=False)`. Assertions, all failing today:
+
+1. `len(deck.inference_models)` is equal on both sides (today: 0 vs 75).
+2. ~~`derive_templating_style(...)` is equal and non-`None` on both sides~~ — **dropped, the function is deleted.**
+3. A bundle pinning a bare handle passes `check_llm_choice_with_deck` on both sides (today: `ModelChoiceNotFoundError` on the empty side — item 5).
+
+Then the end-to-end assertion the brief actually asks for, `tests/integration/pipelex/pipes/test_dry_prompt_parity_keyless.py`: a two-step method whose second `PipeLLM` embeds the first's output, dry-run under both providers, asserting the two `LlmTextResult.rendered_prompt` values are **identical** — not merely both non-empty. (`tests/unit/pipelex/pipe_operators/pipe_llm/test_prompt_rendering_purity.py` is the precedent for reaching the rendered prompt.)
+
+> **This one is now green before any production edit, and is worth writing anyway — as a guard, not as a receipt.** Prompt rendering no longer reads the deck, so the parity it asserts holds by construction. That makes it exactly the kind of test the sequencing step 5 warns about (*"a parity test that passes against the old code is testing nothing"*) — it must be understood as a regression guard against re-coupling prompt shape to infrastructure, and it should be labelled as such in its docstring so a future reader does not mistake it for evidence that Part 2 works.
+
+And one for item 3: a `PipeImgGen` given more input images than the model's `max_prompt_images`, dry-run keyless with `EmptySecretsProvider`, must raise — today it passes.
+
+### 3.2 ~~Part 1 — style derivation precedence~~ ✅ DISSOLVED — do not build
+
+> **Nothing in this section is buildable or wanted.** `derive_templating_style` and `llm_setting.prompting_target` are both deleted; the four-case precedence table below describes a resolution that no longer has any inputs. The concern it encoded — *an explicitly authored declaration must beat an inferred one* — is satisfied structurally: `resolve_templating_style(authored=…)` returns the authored style when there is one and the config default otherwise, with nothing in between to override it. Kept only so a reader of the original plan can see why this part vanished.
+
+<details>
+<summary>Original Part 1 (obsolete)</summary>
+
+Unit module `tests/unit/pipelex/kernel/test_derive_templating_style.py`, stubbing the deck on the hub (`tests/unit/pipelex/cli/test_agent_models_cmd.py:86` shows the fake-deck pattern):
+
+| case | expected | today |
+| --- | --- | --- |
+| setting carries `prompting_target`, deck has the model | the setting's target wins | deck's target wins — **red** |
+| setting carries `prompting_target`, deck has **no** such model | the setting's target is honoured | `None` — **red** |
+| setting has no target, deck has the model | the model's target | same — green, pin it |
+| setting has no target, deck has no model | `None` (external-plugin case) | same — green, pin it |
+
+Implementation in `pipelex/kernel/llm_ops.py:62-75`: read `llm_setting.prompting_target` first and only consult the deck when it is unset. Keeps the documented `None` path intact and makes an explicitly-pinned target authoritative — which it always should have been.
+
+</details>
+
+### 3.3 Part 2 — credential-free model metadata (the core)
+
+**The conflation to break:** `lenient` currently means both "tolerate a missing credential" and "tolerate a broken config file", and answers both by dropping the backend.
+
+Unit module `tests/unit/pipelex/cogt/model_backends/test_backend_library_metadata_load.py` — a temp-dir `backends.toml` + one backend spec TOML + `EmptySecretsProvider`:
+
+1. metadata-only load: the backend **is present**, its `model_specs` carry `prompting_target`, `api_key is None`, and `missing_credential_vars == ["…_API_KEY"]`.
+2. credentials-required load (a keyed boot): still raises `InferenceBackendCredentialsError` — unchanged.
+3. metadata-only load of a **malformed** spec file: still skipped, still `log.verbose` — unchanged.
+4. a backend with missing credentials is reported as enabled-but-uncredentialed, and is **not** in `all_credentialed_backends()`.
+
+Implementation:
+
+- Replace the `lenient: bool` parameter of `InferenceBackendLibrary.load` (`backend_library.py:57-65`) with an explicit `BackendLoadMode` StrEnum — `REQUIRE_CREDENTIALS` / `METADATA_ONLY`. Structural-error skipping stays tied to `METADATA_ONLY`; credential errors no longer skip.
+- Substitution today is all-or-nothing: `apply_to_strings_recursive` raises on the first unresolvable `${VAR}` (`backend_library.py:105-145`). Add a collecting variant that, in `METADATA_ONLY`, substitutes what resolves, records the names it could not, and leaves those fields unset. Note `${AZURE_API_BASE}`-style endpoints go the same way — irrelevant to metadata, relevant only to a call.
+- `InferenceBackend` (`backend.py:38-48`) gains `missing_credential_vars: list[str]` and an `is_credentialed` property. Keep `all_enabled_backends()` returning uncredentialed backends — the deck must contain their models — and add `all_credentialed_backends()` for callers that mean "usable for inference".
+- `ModelManager.setup` picks the mode from `needs_inference` (`model_manager.py:83`, `:88`).
+- **Guard the live path loudly.** `pipelex/providers/openai/openai_client_factory.py:45` turns a `None` key into `"unused-no-auth-needed"`, which would surface a missing credential as a provider 401 rather than as our own error. Gate at the point a backend becomes a client/worker: an uncredentialed backend raises `InferenceBackendCredentialsError` there. Defence in depth — a keyless boot is forced-DRY (`runtime_boot.py:539`) so no worker should be built at all — but the placeholder is a live-fire hazard either way and is worth closing while we are here.
+- Sweep `all_enabled_backends()` callers (doctor, `show backends`, the init flows) and move the ones that mean "credentialed" onto the new accessor. This is the part most likely to surprise; do it with a grep, not from memory.
+
+Green after this: every assertion in §3.1 except any gateway-only model on an offline machine.
+
+### 3.4 Part 3 — the residual, made audible
+
+Once Part 2 lands, a missing model spec on a keyless boot means something specific and narrow: *this model's metadata is genuinely unknowable here* (gateway model, no network, dummy specs) — not "we forgot to load anything". Warn exactly there, and only there.
+
+> **The warning site named below is deleted; the need is smaller but not zero.** `derive_templating_style` was where this plan proposed to warn, because a silently-wrong prompt shape was the damage being detected. That damage is gone. What is left worth warning about is narrower: a model whose spec is unknowable still silently skips the `max_prompt_images` check (symptom 3) and the param-support validation (symptom 4). If Part 2 is built, warn at *those* two sites — where a constraint is being skipped rather than enforced — and drop the notion of a style-derivation warning entirely.
+
+- ~~In `derive_templating_style`, when the deck has no model **and** `is_dry_run_forced()` is set, emit a `log.warning` naming the handle and the fallback tag style.~~ **Obsolete.** Replace with: at the `max_prompt_images` and param-support checks, when the spec is absent under a forced-dry boot, log that the constraint was not enforced and why.
+- Dedupe per boot, not per run: keep the already-warned handles on the `ModelDeck` instance, which is rebuilt at each boot. **Not** a ContextVar and not module-global state (`payload-first, no ContextVars`; a process-global set leaks across runs in a server). *(Unchanged — this part of the design survives whichever site does the warning.)*
+
+### 3.5 Part 4 — entry-point audit
+
+- `cli/commands/run/_run_core.py:419` boots with the default `needs_inference=True` even for `--dry-run`, so `pipelex run --dry-run` demands credentials it never uses — and outright fails on a keyless machine, while `pipelex-agent run --dry` succeeds and degrades. Change to `needs_inference=not dry_run`. This is what makes the documented promise in `docs/features/validation-dry-run.md` ("no API calls required") true for both CLIs, and it is the user-visible half of the fix.
+- Re-check `graph_cmd.py:160` and `show_cmd.py:312` (neither asks for specs today; after Part 2 they get metadata anyway — confirm neither now does surprise network I/O).
+- Confirm the programmatic path the brief reproduces with, plain `Pipelex.make(needs_inference=False)`, is faithful for every locally-configured backend without needing `needs_model_specs=True`.
+
+## 4. Sequencing
+
+1. **Part 0 tests** — commit red (or `xfail` with a reason naming this doc, flipped in step 4). They are the receipt that the bug existed. *(Assertion 2 is dropped and the prompt-parity test is green from the start — see §3.1.)*
+2. ~~**Part 1** — self-contained; can merge on its own if Part 2 stalls.~~ **Dissolved; Part 2 no longer has a cheap independent sibling to ship ahead of it.**
+3. **Part 2** — the core. ⛳ *Checkpoint*: at this point re-run the §3.1 gate and record actual numbers in this doc before touching the CLI surface; Part 2 is where a hidden `all_enabled_backends()` consumer would show up.
+4. **Parts 3 + 4**, then flip the xfails.
+5. **Mutation-check the gate**: revert Part 2 locally and confirm the *deck-count and handle-resolution* assertions go red. ⚠️ **Do not mutation-check against the prompt-parity test** — it passes with or without Part 2 now, by construction; using it as the mutation target would produce a false green on the whole gate.
+6. `make agent-check` && `make agent-test`.
+
+## 5. Decisions for Louis
+
+- **⚠️ First, the prior question: is any of this still worth building?** The symptom that justified "faithful over cheap" — a dry run silently validating a prompt that will not be sent — is gone. Every survivor is either loud (5) or a skipped constraint check (3, 4) or a CLI inconsistency (7). Part 4 is cheap and clearly right on its own; Part 2 is the expensive one and now has to earn its keep against a weaker case. Recommend deciding Part 2 and Part 4 **separately** rather than as one plan.
+- **Faithful over cheap** (§1) — confirm, *if Part 2 proceeds at all*. The alternative is a log line and a documented divergence, which is honest but leaves dry-run-as-validation skipping constraint checks it claims to run.
+- **`pipelex run --dry-run` stops requiring credentials** (§3.5). Behaviour change, arguably breaking for anyone relying on it as a credential check. It is the right default, but say so in the changelog.
+- **Handle-pinned bundles start validating keylessly** (item 5). A bundle that today fails `pipelex-agent validate` on a keyless machine will pass. That is a fix, but it changes CI outcomes for keyless runners.
+- **Does `needs_model_specs` survive?** After Part 2 it means only "fetch the gateway's remote specs rather than dummy them" — i.e. a *network* flag, not a metadata flag. Either rename it (`needs_gateway_specs`) or document the narrowed meaning. Renaming touches every CLI command listed in §2 item 7; recommend renaming, since the current name is precisely what made the brief's closing sentence wrong.
+
+## 6. Docs, changelog, drift
+
+- `docs/features/validation-dry-run.md` — state the guarantee and its two exceptions (§1).
+- `docs/under-the-hood/dry-run-mock-generation.md` — the credentials-vs-metadata split, and what the new warning means.
+- Backend config docs — `missing_credential_vars` / uncredentialed-but-enabled as a visible state.
+- `CHANGELOG.md` under `## [Unreleased]`: ~~the dry-run parity fix, the explicit-`prompting_target` fix,~~ and the `pipelex run --dry-run` credential change. *(The first two are dissolved and are already covered by the templating-style entry that shipped on this branch — do not double-report them.)*
+- `make drift-plan` after staging — Part 2 touches config-model and CLI trigger files; ack with an honest rationale.
+
+## 7. Out of scope
+
+- Anything about *live* runs. This is a dry-run faithfulness fix.
+- Making gateway specs available offline (a cache-warming feature, not this bug).
+- The `missing_presets_reaction` policy (item 6) — after Part 2 the deck is populated, so the noise disappears on its own; if it does not, that is its own investigation.
diff --git a/wip/parity/README.md b/wip/parity/README.md
index 3e0001547..290fbed7f 100644
--- a/wip/parity/README.md
+++ b/wip/parity/README.md
@@ -24,7 +24,7 @@ This track fixes a family of defects that share one shape: a single authored fac
- **Phase 0 (planning): ✅ done 2026-08-03.** Plan written, targets verified on this tree, decisions D-1..D-3 posed with recommendations.
- **Phase 1: ✅ done 2026-08-03.** All three fixes landed with their gates, red-green verified; Checkpoint A recorded in the plan. D-1 settled as crate-wide resolution (not own-domain-first — see [`d1-domain-hint-deferred.md`](d1-domain-hint-deferred.md)); D-2 settled as recommended.
-- **Phase 2: ✅ done 2026-08-04, folded into the kernel stack.** 2.1 fixed in #1081; 2.3 fixed in #1082, with the boot-contract arm it turned out to owe in the same PR and the doc review on #1083 — commits named by subject in [`parity-gaps-plan.md`](parity-gaps-plan.md), because the stack is rebased and hashes do not survive it. 2.2 **withdrawn** on re-verification — the façade's single `model` wins the object resolution's first rung, so the style it derives already matches an interpreted run for every call the façade can express; the surviving narrowness is deferred as KF-16, because the whole model-derived-style mechanism is slated to become an explicit user choice (design in [`../prompting-style/README.md`](../prompting-style/README.md), which landed with the kernel stack). D-3 settled as recommended, (a), and its predicted layering cost did not materialise.
+- **Phase 2: ✅ done 2026-08-04, folded into the kernel stack.** 2.1 fixed in #1081; 2.3 fixed in #1082, with the boot-contract arm it turned out to owe in the same PR and the doc review on #1083 — commits named by subject in [`parity-gaps-plan.md`](parity-gaps-plan.md), because the stack is rebased and hashes do not survive it. 2.2 **withdrawn** on re-verification — the façade's single `model` wins the object resolution's first rung, so the style it derives already matches an interpreted run for every call the façade can express; the surviving narrowness was deferred as KF-16. **KF-16 is now closed, by dissolution rather than by fix** (2026-08-14, branch `fix/Keyless-dry-run`): the model-derived-style mechanism is deleted outright, the style is an authoring decision declared on the pipe, and both `llm_text` and `llm_object` take it as an argument. The façade and the interpreter agree because neither derives anything. Design in [`../prompting-style/prompt-style-as-an-authoring-decision.md`](../prompting-style/prompt-style-as-an-authoring-decision.md), build in [`../prompting-style/templating-style-implementation-plan.md`](../prompting-style/templating-style-implementation-plan.md). D-3 settled as recommended, (a), and its predicted layering cost did not materialise.
## Deferred, not dropped
diff --git a/wip/parity/SESSION-HANDOFF.md b/wip/parity/SESSION-HANDOFF.md
index 1656913ca..a9b672256 100644
--- a/wip/parity/SESSION-HANDOFF.md
+++ b/wip/parity/SESSION-HANDOFF.md
@@ -34,7 +34,7 @@ Backups to roll back to: `backup/parity-pre-round3` and `backup/kernel-{,phase2-
**What round 2 produced** (a record of that round, not the current state — see the dates above). Cubic came back on all four heads; **Greptile and Codex did not, despite pings** — cubic was already the only fresh external signal by then, so treat "the bots are happy" with corresponding caution. Its findings were mostly doc-accuracy, and the arbitration is recorded in a comment on each PR. The substantive ones:
-- **#1081 — the one that mattered.** `wip/prompting-style/README.md` described the prompting style as derived "in two places that must agree" and rested its first argument on exactly that. False since the extraction: `pipe_llm.py:223` calls the kernel's `derive_templating_style`, so there is one site. Left alone, KF-16's design basis would have carried a false premise.
+- **#1081 — the one that mattered.** `wip/prompting-style/README.md` (since superseded by `prompt-style-as-an-authoring-decision.md` in the same directory) described the prompting style as derived "in two places that must agree" and rested its first argument on exactly that. False since the extraction: `pipe_llm.py:223` calls the kernel's `derive_templating_style`, so there is one site. Left alone, KF-16's design basis would have carried a false premise.
- **#1082.** `ImgGenPromptBlueprint`'s class docstring still advertised the four things it had just delegated to the kernel, contradicting its own module docstring.
- **Deferred as KF-17**, not fixed: the resolvers select the model choice by truthiness, so `model=""` falls through to the deck default. The chain is verbatim from `dev`'s `pipe_llm.py`, the interpreter calls these same functions so no divergence exists, and pydantic already rejects `""` on every authored path. The honest fix is `LLMModelChoice` rejecting `""` at the type boundary once — a deliberate pass, not a spot edit.
@@ -73,7 +73,7 @@ Gates all run and green at `d9efffbfb`:
| Gap | Outcome | Commit (by subject — the stack is rebased, so hashes die) |
| --- | --- | --- |
| 2.1 `llm_text` narrowness | fixed | *make llm_text as wide as the op beneath it* — `refactor/Kernel` (#1081) |
-| 2.2 `llm_object` prompting style | **withdrawn** — not a live defect | silenced by the KF-16 numbering commit on #1081, which added the `llm_object` docstring recording why its single `model` is correct (its subject line is truncated in git — *"…to keep the stack's"* — so match on `KF-16`); deferred as KF-16 |
+| 2.2 `llm_object` templating style | **withdrawn** — not a live defect; deferred as KF-16, now **closed** | silenced by the KF-16 numbering commit on #1081, which added the `llm_object` docstring recording why its single `model` is correct (its subject line is truncated in git — *"…to keep the stack's"* — so match on `KF-16`). **KF-16 closed 2026-08-14 by dissolution** on `fix/Keyless-dry-run` (*Phase 1 — templating style becomes an authoring decision on the LLM path*): the derivation is deleted, the style is authored on the pipe, and that docstring goes with it |
| 2.3 kernel cannot build an `ImgGenPrompt` | fixed | *let a runtime-only caller build the image prompt it has to pass in* — `refactor/Kernel-phase2` (#1082) |
| — its boot-contract arm | added | *give the image prompt assembler the boot-contract arm the rule owes it* — `refactor/Kernel-phase2` (#1082), same PR as the entry point |
| — the kernel doc's drift review | recorded | *record the image prompt assembler on the page that specifies the kernel* — `refactor/Kernel-phase3` (#1083), where the doc and its contract live |
diff --git a/wip/parity/parity-gaps-plan.md b/wip/parity/parity-gaps-plan.md
index afb070faa..b0ef9ebf2 100644
--- a/wip/parity/parity-gaps-plan.md
+++ b/wip/parity/parity-gaps-plan.md
@@ -87,7 +87,7 @@ These three are written against the open kernel-extraction PRs and share a theme
| Gap | Outcome | Where |
|---|---|---|
| 2.1 `llm_text` narrower than its op | Fixed | *make llm_text as wide as the op beneath it*, on `refactor/Kernel` (#1081) |
-| 2.2 `llm_object` prompting style | **Not a live defect** — claim overstated; the surviving question is deferred | *number the prompting-style follow-up KF-16 to keep the stack's*, on `refactor/Kernel` (#1081); KF-16 → `wip/prompting-style/README.md` |
+| 2.2 `llm_object` templating style | **Not a live defect** — claim overstated; deferred as KF-16, now **closed by dissolution** | *number the prompting-style follow-up KF-16 to keep the stack's*, on `refactor/Kernel` (#1081); closed on `fix/Keyless-dry-run` by *Phase 1 — templating style becomes an authoring decision on the LLM path* |
| 2.3 kernel cannot build an `ImgGenPrompt` | Fixed | *let a runtime-only caller build the image prompt it has to pass in* + arm *give the image prompt assembler the boot-contract arm the rule owes it*, on `refactor/Kernel-phase2` (#1082); doc review *record the image prompt assembler on the page that specifies the kernel* (#1083) |
**Commits are named by subject, not by SHA, and deliberately.** These fixes live on a three-deep stacked series that is rebased whenever a parent moves, which rewrites every hash on it. An earlier revision of this table named SHAs; the rebase that folded in the review round orphaned three of them, so they resolved from no branch at all. A subject survives the rewrite — `git log --grep` finds it.
@@ -118,7 +118,11 @@ The re-verification the plan asked for happened against each PR's own branch rat
*The mechanism is obsolete.* Model-derived prompting style dates from when models were genuinely sensitive to prompt markup. Louis' ruling: rather than widen the derivation, the style becomes an explicit user choice defaulting to XML, and the derivation goes away. Building `model_for_object` here would mean constructing the two-setting derivation that refactor deletes.
-Deferred as **KF-16** in the kernel track's deferred-follow-ups doc (now tracked at workspace level), with the design in [`../prompting-style/README.md`](../prompting-style/README.md) — that design landed with [PR #1081](https://github.com/Pipelex/pipelex/pull/1081) and is present on this branch. Silenced in #1081 by *number the prompting-style follow-up KF-16 to keep the stack's* — a docstring on `llm_object` recording why its single `model` is correct, carrying the trap explicitly: *do not "fix" this by deriving the style from an object-only resolution, which would introduce the divergence rather than close it.*
+Deferred as **KF-16** in the kernel track's deferred-follow-ups doc (now tracked at workspace level), with the design in [`../prompting-style/prompt-style-as-an-authoring-decision.md`](../prompting-style/prompt-style-as-an-authoring-decision.md) — superseding the deferred note that landed with [PR #1081](https://github.com/Pipelex/pipelex/pull/1081). Silenced in #1081 by *number the prompting-style follow-up KF-16 to keep the stack's* — a docstring on `llm_object` recording why its single `model` is correct, carrying the trap explicitly: *do not "fix" this by deriving the style from an object-only resolution, which would introduce the divergence rather than close it.*
+
+**✅ KF-16 closed 2026-08-14, by dissolution — on `fix/Keyless-dry-run`, commit *Phase 1 — templating style becomes an authoring decision on the LLM path*.** The second reason above is what happened: the derivation is deleted, not widened. A `PipeLLM` declares `templating_style` (bare tag-style string or full `{ tag_style, text_format }` table); everything that declares nothing resolves one runtime default; no code path consults a model, a deck, or a credential to decide prompt shape. `llm_text` and `llm_object` both take the style as an optional argument resolved through the same total resolver, so the two-choice case that motivated this gap can no longer diverge — there is nothing left to derive from either setting.
+
+**The trap recorded in the #1081 docstring is now moot, and the docstring carrying it is deleted.** "Do not fix this by deriving the style from an object-only resolution" was a warning about a mechanism that no longer exists; there is no object-only resolution to derive a style from, and no derivation site to put one in. It is preserved here as history only — do not reintroduce it as guidance.
### 2.3 Nothing in the kernel can build an `ImgGenPrompt`
@@ -136,7 +140,7 @@ Deferred as **KF-16** in the kernel track's deferred-follow-ups doc (now tracked
**🔶 CHECKPOINT B — plan complete.** Record: merged-code re-verification results for 2.1–2.3 (what moved, what held), each fix's commit and gates, D-3's scoping outcome (which helpers moved to which layer), and changelog entries. Run the full gate set. Update the README status block and close the track, or spin out whatever the re-verification surfaced.
-**Checkpoint B record.** Re-verification: 2.1 held as written in all three of its arms, `model` included; 2.2 did **not** hold and was withdrawn (above); 2.3 held, and its predicted layering cost did not materialise. Commits and gates are recorded per-gap above. D-3 settled on (a) with no helper moving layers. Changelog: one entry extended (`LLMPromptBlueprintValueError` → *and `ImgGenPromptBlueprintValueError`*) plus one new entry for `assemble_img_gen_prompt`, both on #1082; 2.1 needed none. Gate set green on both branches — `make agent-check`, `make drift-check`, and a full `make agent-test`. Spun out: KF-16 / `wip/prompting-style/README.md`.
+**Checkpoint B record.** Re-verification: 2.1 held as written in all three of its arms, `model` included; 2.2 did **not** hold and was withdrawn (above); 2.3 held, and its predicted layering cost did not materialise. Commits and gates are recorded per-gap above. D-3 settled on (a) with no helper moving layers. Changelog: one entry extended (`LLMPromptBlueprintValueError` → *and `ImgGenPromptBlueprintValueError`*) plus one new entry for `assemble_img_gen_prompt`, both on #1082; 2.1 needed none. Gate set green on both branches — `make agent-check`, `make drift-check`, and a full `make agent-test`. Spun out: KF-16 / `wip/prompting-style/` (design now at `prompt-style-as-an-authoring-decision.md`).
## Decisions
diff --git a/wip/prompting-style/README.md b/wip/prompting-style/README.md
deleted file mode 100644
index e058020a5..000000000
--- a/wip/prompting-style/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Deferred — make the prompting style an explicit choice, not a model-derived one
-
-**Status: deferred, not started.** Raised 2026-08-03 while folding the parity-gap fixes into the kernel-extraction PRs. Owner decision (Louis): the feature this plan replaces is **obsolete**, so patching it to match the interpreter would be throwaway work. Nothing here blocks the kernel extraction.
-
-## What exists today
-
-The prompting style is **derived from the model**, per call, in exactly one place — `derive_templating_style` in `pipelex/kernel/llm_ops.py` — which both callers go through:
-
-- interpreter — `pipelex/pipe_operators/llm/pipe_llm.py` resolves the pipe's text setting and calls `derive_templating_style` with it (`pipe_llm.py:223`), passing the result to both the text and the object generation paths.
-- kernel — the ops call the same function over whichever `LLMSetting` the caller supplied.
-
-**That single site is the extraction's doing.** Before it, the interpreter carried its own copy of the lookup, and an earlier draft of this doc described two readers that must be kept in agreement. There is now one, so the parity hazard is already gone — none of the reasons below depend on it.
-
-The chain is `llm_setting.prompting_target` when set, otherwise the inference model's own `prompting_target`, then `prompting_config.get_prompting_style(...)` → `TemplatingStyle`. The setting-level override is the first branch and is easy to miss: a caller can steer the style without changing the model. Note also the silent arm — `derive_templating_style` returns `None` when the deck holds no inference model for the handle, which is what an external LLM plugin looks like from there.
-
-## Why it should go
-
-The mechanism dates from when models were genuinely sensitive to prompt shape and each family wanted its own markup. That no longer holds — current models are not meaningfully sensitive to the difference, so deriving the style from the model spends real complexity on a distinction that no longer pays.
-
-What the indirection actually costs:
-
-- **The derivation is invisible to every caller.** Nothing at a call site says which style a prompt will render under; it falls out of a deck lookup two hops away. That invisibility is why the parity-gaps track's 2.2 took real work to adjudicate — and why it was initially, and wrongly, called a live defect.
-- **The style is unstateable.** A caller who wants a specific style has no way to say so — they must pick a *model* whose prompting target maps to it.
-- **A deck/config change silently changes prompt text** for a method nobody edited.
-
-## The target design
-
-Make the prompting style an **explicit choice**, defaulting to **XML**:
-
-- an explicit setting a caller/author can state directly, defaulting to XML when unstated;
-- the model-derived path removed, along with `prompting_target` plumbing that exists only to feed it (check what else reads it before deleting — it may have non-style consumers);
-- no derivation site at all, rather than the single one that survives today;
-- `TemplatingStyle | None` at the op boundary reconsidered: with an explicit default, `None` may stop being a reachable state, which would let `run_llm_*` take a plain `TemplatingStyle`.
-
-Open questions for whoever picks this up:
-
-- Where does the explicit choice live — `.mthds` pipe-level, deck-level, config-level, or more than one with a precedence chain?
-- Is it per-pipe or per-run? A pipe-level override implies a language surface (`prompting_style = "xml"`), which is an MTHDS spec change and belongs with the `mthds/` repo, not just here.
-- What happens to `prompting_target` on `LLMSetting` and on inference models — deleted, or kept for another purpose?
-- Migration: methods relying on a non-XML style today would change prompt text. Given the premise (models no longer sensitive), that is expected to be a no-op in output quality, but it *is* a wire-visible change to rendered prompts and should be called out in the changelog.
-
-## What was silenced in the meantime, and what was not
-
-The parity-gaps plan listed this as gap **2.2 — "`PipelexKernel.llm_object` renders under the wrong model's prompting style"**, and called it *a wrong value*. **That was overstated.** Re-verified 2026-08-03 against `refactor/Kernel`:
-
-| Call | Style derived from |
-| --- | --- |
-| `PipelexKernel.llm_object(model=X)` | `X` |
-| interpreter, pipe declares `for_text = X` only | `X` — **identical** |
-| interpreter, pipe declares `for_object = X` only | the deck's **text** default — differs |
-
-The façade takes one explicit `model`, which wins `resolve_llm_setting_for_object`'s first rung, so the style comes from that same setting. That matches the interpreter's single-text-choice reading — the natural reading of a parameter called `model`. **For every call the façade can express, the two agree.** The divergence needs a pipe naming *both* models, which the façade has no way to say.
-
-So 2.2 is not a wrong value; it is the same **narrowness** as 2.1 — a two-choice form that is inexpressible. It is left alone deliberately: widening the façade to take a second choice would mean building the two-setting derivation this plan is about to delete.
-
-**Recorded in code** as a docstring block on `PipelexKernel.llm_object`, including the trap: do *not* "fix" it by deriving the style from an object-only resolution — that would *introduce* the divergence rather than close it.
-
-**Not silenced, still open:** nothing. There is no live defect to carry. This document exists so the obsolete mechanism gets deleted deliberately rather than discovered again by the next person who compares the two readers.
diff --git a/wip/prompting-style/gateway-config-still-declares-prompting-target.md b/wip/prompting-style/gateway-config-still-declares-prompting-target.md
new file mode 100644
index 000000000..3e66df520
--- /dev/null
+++ b/wip/prompting-style/gateway-config-still-declares-prompting-target.md
@@ -0,0 +1,45 @@
+# The gateway config still declares `prompting_target` — a cross-repo follow-up
+
+**Found 2026-08-14, during Phase 3 of the templating-style plan.** Deleting `prompting_target` from `InferenceModelSpecBlueprint` made **every** test in the suite error at boot, on this machine and on any machine with a cached gateway config:
+
+```
+InferenceBackendLibraryError: Invalid inference model spec 'gpt-4o-mini' for backend
+'pipelex_gateway' from remote config with local overrides from '.pipelex/inference/backends/pipelex_gateway.toml':
+Extra forbidden fields: 'prompting_target'
+```
+
+## Why it happens
+
+The Pipelex Gateway backend does not read its model specs from a file in this repo. They are fetched from the Pipelex API and cached at `~/.pipelex/cache/remote_config.json`, and that config's `backend_model_specs.defaults` block carries `prompting_target = "anthropic"`. `InferenceModelSpecBlueprint` is `extra="forbid"`, so once the field was deleted here, a config that still declares it stopped validating.
+
+Note the asymmetry inside `InferenceBackendLibrary.load`: the loop that reclassifies unknown keys as outbound HTTP headers iterates the **per-model** dict only. So an unknown key per-model is silently turned into a header (the hazard the implementation plan already flags), while an unknown key in `defaults` is fatal. Same input, two opposite failure modes, neither of them "ignore it".
+
+## What was done here
+
+`drop_unknown_gateway_defaults` (`pipelex/cogt/model_backends/gateway_config.py`) prunes keys the blueprint does not know from the **remote** config's `defaults` before the merge with local overrides. Rationale, stated in the docstring: the gateway config is served by a component that deploys on its own schedule, so a client legitimately reads a config written by a different release than itself — unknown key there is version skew, not a typo. Local backend files stay strict.
+
+This is not a shim for `prompting_target` specifically; it is the tolerance a remote config needs in general, and it would have prevented this failure for any removed field. Tested in `tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py`.
+
+The prune is pure and silent by design. It first logged the dropped keys, which crashed any caller that loads backends before `runtime_hub.set_config()` has configured the log dispatch (`RuntimeError: LogConfig is not set`) — and since the served config really does declare an unknown key, that fired on the ordinary success path, not a corner. Pinned by `test_pruning_does_not_need_the_log_hub`.
+
+## What still needs doing, elsewhere
+
+1. **Drop `prompting_target` from the gateway config served by the Pipelex API.** It is dead data as of this change: nothing in `pipelex` reads it any more. The source is **our back-office repo** (private), not the hosted server: its gateway-models TOML declares it in `[defaults]`, and its build service publishes that block as the remote config's `backend_model_specs`.
+
+ **Done — and the mechanism that made it safe is the versioned config URL, not timing.** Deleting the key would have been a live prompt change for every deployed client, in the one direction we do not want:
+
+ | Client | Config declares the key | Config drops it |
+ |---|---|---|
+ | With the prune (this branch) | pruned → `xml` (the new resolved default) | `xml` |
+ | Earlier release | `anthropic` → `xml` | **`None` → the filter's own `TICKS` fallback** |
+
+ An older client never reaches its configured `default_prompting_style`: `PromptingConfig.get_prompting_style(None)` returns `None` rather than the default, so no style reaches `apply_tag_style`, which applies its own `TagStyle.TICKS` (`tools/jinja2/jinja2_filters.py`). Every gateway prompt in the field would have moved from XML tags to backtick fences, silently.
+
+ That never happens because the served config is **versioned in its URL**, and this branch bumps it: `pipelex_details.py` now points at `pipelex_remote_config_12.json` (was `_11`). The edited `gateway_models.toml` was published as `_12`; `_11` is frozen and still carries `prompting_target = "anthropic"`, so every earlier release keeps rendering XML. Verified live against both URLs: `_12` `defaults` = `{model_type, sdk, structure_method}`, `_11` = the same plus `prompting_target`, 73 model entries either side.
+
+ The URL bump is the compatibility boundary for *any* breaking change to this config, which is worth knowing before the next one — it is the reason the deletion did not need to wait for a deployed floor.
+2. **Decide whether the per-model unknown-key → HTTP-header rule should survive for the gateway backend.** Deliberately untouched here. A removed field that had lived per-model rather than in `defaults` would have been sent to the provider as a header instead of raising — a worse outcome than the one that was actually hit, and one no test would catch.
+
+ **Decided, and planned: [`../rogue-extra-headers-guard-plan.md`](../rogue-extra-headers-guard-plan.md).** The rule survives, but only for header-shaped keys; anything else is fatal from a local file and pruned from the served payload. To be executed after the templating-style branch merges.
+
+Neither is in scope for the templating-style change. Item 1 is a back-office deliverable (private repo); item 2 is a design question about the backend loader that deserves its own look.
diff --git a/wip/prompting-style/pr-1104-deferred-review-items.md b/wip/prompting-style/pr-1104-deferred-review-items.md
new file mode 100644
index 000000000..d8f3fc450
--- /dev/null
+++ b/wip/prompting-style/pr-1104-deferred-review-items.md
@@ -0,0 +1,49 @@
+# PR #1104 — review findings deferred, not dropped
+
+Two findings from the bot review of [#1104](https://github.com/Pipelex/pipelex/pull/1104) were confirmed real but deliberately left out of that PR. Both threads stay **open** on the PR.
+
+---
+
+## 1. `TemplatingStyle` silently ignores unknown keys
+
+**Reported by:** chatgpt-codex-connector (P2), on `pipelex/pipe_operators/llm/pipe_llm_blueprint.py`.
+
+`TemplatingStyle` (`pipelex/tools/templating/templating_style.py`) is a bare `BaseModel`, so it inherits pydantic's default `extra="ignore"`. An author who misspells an optional key gets a silently different prompt shape:
+
+```toml
+templating_style = { tag_style = "xml", text_formt = "markdown" } # parses fine, yields xml/plain
+```
+
+Confirmed end-to-end through the MTHDS parse path — nothing at bundle level catches it, because the blueprint validation *is* the check and it stops at the nested-model boundary.
+
+Note the reporter's literal example (`{ text_formt = "markdown" }` alone) does **not** reproduce: `tag_style` has no default, so a table missing it fails both arms of the union. The misspelled key has to be an *optional* one, with `tag_style` present.
+
+Every sibling authoring model is strict — `PipeBlueprint`, `ConceptBlueprint`, `DomainBlueprint`, `SubPipeBlueprint` all set `extra="forbid"`, and `ConfigModel` exists as a shared strict base. `TemplatingStyle` is one of the few nested authoring models that inherits neither.
+
+**Why it was deferred.** The fix reads like a one-liner and isn't:
+
+- `TemplatingStyle` is pre-existing and **already reachable from the published JSON Schema** via `TemplateBlueprint` (on `dev`). Its generated definition currently emits no `additionalProperties`; adding `extra="forbid"` emits `"additionalProperties": false`. That is a schema change requiring `pipelex-dev generate-mthds-schema` plus the `mthds-schema-sync` propagation to the downstream committed copies, gated on a released `pipelex` version. The drift is invisible in a PR because `derived/mthds_schema.json` is gitignored.
+- `TemplateBlueprint` itself has the **same hole and a bigger one** — both `templating_stile` and `extra_contxt` are silently dropped today, on the `PipeCompose` authoring surface. Closing only `TemplatingStyle` is exactly the partial fix the templating-style plan warns about elsewhere.
+
+**Recommendation.** One deliberate strictness pass over the nested authoring models — `TemplatingStyle` and `TemplateBlueprint` together — with the schema regen and downstream sync budgeted as part of it. Not a drive-by line in a 120-file PR.
+
+**When.** Any time before the next release that moves the schema; it composes naturally with any other MTHDS-schema-affecting change, since the sync tax is paid once.
+
+---
+
+## 2. `PipeStructure` does not resolve the authored templating style
+
+**Reported by:** cubic-dev-ai (P2), as the second half of the `preliminary_text` finding. The first half — the draft blueprint dropping `templating_style` — was a real bug and is fixed in #1104.
+
+There is a genuine asymmetry between the two structuring paths:
+
+- `direct` — `run_llm_object` renders `output_structure_prompt` under the **authored** style.
+- `preliminary_text` — the synthesized `PipeStructure` renders it under the **runtime default**.
+
+**Why it was deferred.** It is unobservable under the shipped templates, and closing it is a refactor that contradicts a decision the code already records:
+
+- Both built-in structuring templates (`structuring_prompt`, `output_structure_prompt` in `pipelex.toml`) use bare `{{ }}` interpolation with no style-sensitive filter, on a value that is already a `str`. The style is inert there.
+- `pipe_structure.py` states the choice deliberately: *"No authored style on this operator: the structuring prompt takes the runtime default, the same one an LLM pipe that declares nothing gets."* The matching docs say the same.
+- Closing it means a new field on `PipeStructureBlueprint` + `PipeStructureFactory` + the runtime pipe + the builder spec + the JSON schema + downstream schema sync — for zero observable effect today.
+
+**Recommendation.** Leave it. Revisit only if a structuring template ever grows a style-sensitive filter (`| tag`, `| format`), at which point the asymmetry becomes observable and the field earns its cost. If revisited, it lands with item 1 above — both pay the same schema-sync tax.
diff --git a/wip/prompting-style/prompt-style-as-an-authoring-decision.md b/wip/prompting-style/prompt-style-as-an-authoring-decision.md
new file mode 100644
index 000000000..e998160df
--- /dev/null
+++ b/wip/prompting-style/prompt-style-as-an-authoring-decision.md
@@ -0,0 +1,141 @@
+# Prompt style as an authoring decision
+
+**Design note, 2026-08-14.** Status: **✅ built** — all §7 rulings settled by Louis 2026-08-14 and implemented on `fix/Keyless-dry-run` across Phases 0–5 of [`templating-style-implementation-plan.md`](templating-style-implementation-plan.md), whose checkpoint log is the build record. One ruling overrides the body: the authored field is **`templating_style` everywhere** (§4.1's `prompt_style` proposal was not retained). Written on `fix/Keyless-dry-run` but deliberately scoped to stand alone — the keyless dry-run bug is what surfaced this, not what motivates it. See §9 for the relationship.
+
+**Read the body as the design, not as the current code.** It argues from a world where `prompting_target` exists; that field, the `PromptingTarget` enum, the per-target style map and `derive_templating_style` are all deleted. Two things landed beyond what this note designed, both consequences of the strict-filter ruling in §4.3: the `TICKS`/`PLAIN` fallbacks in the Jinja2 filters are gone (a style-less render of a filter-bearing template now raises), and every prompt-rendering entry point — including compose, image generation, search, construct-mode template fields and the built-in structuring prompts — resolves a real style rather than only the LLM path. User-facing documentation is [`docs/building-methods/templating-style.md`](../../docs/building-methods/templating-style.md).
+
+The direction itself is older: Louis first ruled the model-derived mechanism obsolete on 2026-08-03, during the parity-gaps/kernel-extraction work, and it was deferred as **KF-16**. This doc supersedes that deferred note (formerly this directory's `README.md`, deleted — its inbound pointers, the `PipelexKernel.llm_object` docstring and the `wip/parity/` docs, were re-aimed here).
+
+## 1. The change in one sentence
+
+**How a method's inputs get tagged into a prompt becomes something the method author declares, not something the runtime infers from which provider happens to serve the model.**
+
+## 2. Why, independent of any bug
+
+**The premise it rests on has expired.** The whole mechanism exists to send back-ticks to OpenAI models and XML to Anthropic ones. That distinction is several model generations old; every current frontier model handles XML tags well, and Anthropic still actively recommends them. A per-provider dialect map is now maintaining a difference that no longer pays for itself.
+
+**The data is infra-shaped and partly arbitrary.** `prompting_target` is declared once per backend in each spec file's `[defaults]` block (`pipelex/kit/configs/inference/backends/*.toml`), with a handful of per-model overrides in `portkey.toml`. It does not track the backend — bedrock, minimax, ollama and xai all declare `anthropic`. For bedrock and minimax that is considered (they really are Anthropic-dialect endpoints). For ollama it is close to meaningless: ollama serves whatever you pull into it, and every one of those models is being told the same dialect. The field's accuracy degrades exactly where the backend is a multiplexer, which is the direction the ecosystem is moving.
+
+**Prompt shape is a property of the method, not of the machine.** A method is meant to be portable — written once, run against whatever model is available. Today, moving a method from an OpenAI preset to an Anthropic one silently rewrites every prompt it renders. The author never asked for that and cannot see it in the `.mthds` file. If tag style materially affects output quality, it belongs where the author can read, diff, review and version it. If it doesn't, it shouldn't be per-model at all. Either way the current placement is wrong.
+
+**There are three defaults today, in three layers, and they disagree.** This is the strongest argument, because it means the current behaviour is not a design at all:
+
+| # | Site | Value | When it applies |
+| --- | --- | --- | --- |
+| 1 | `pipelex.toml` → `prompting_config.default_prompting_style` | `xml` | Only when a `prompting_target` **is set but unrecognised**. Unreachable when the target is absent — `PromptingConfig.get_prompting_style(None)` returns `None`, not the default. |
+| 2 | `tools/jinja2/jinja2_filters.py:120-122` (`apply_tag_style`) | `TICKS` | Whenever `TAG_STYLE` was never put on the Jinja2 context — i.e. the actual fallback for "no style", in the tools layer, several layers below anyone who could have decided. |
+| 3 | `cogt/llm/llm_prompt_template.py:93` | `xml` + `markdown`, hardcoded | The `LLMPromptTemplate` path, which appears to be dead (referenced only from its own module and `cogt/exceptions.py` — confirm and delete). |
+
+So the setting named "default prompting style" is not the default, and the real default lives in a Jinja2 filter. Any change to this area has to collapse these to one regardless of which way the per-model question goes.
+
+## 3. What exists today
+
+**The resolution chain.** `pipelex/kernel/llm_ops.py:62-75`:
+
+```
+llm_setting.model (handle) → deck.get_optional_inference_model(handle) → spec.prompting_target
+ → prompting_config.prompting_styles[target] → TemplatingStyle(tag_style, text_format)
+ → Jinja2 context TAG_STYLE / TEXT_FORMAT → the `| tag` and `| format` filters
+```
+
+The handle is only a lookup key; nothing parses it. `prompting_target` is a model-family label, and `TemplatingStyle` is the pair of knobs that actually does anything.
+
+**`prompting_target` has a second consumer that is not about prompting.** `cogt.llm_config.effort_to_budget_maps` is keyed by it, and the Anthropic and Google workers read `inference_model.prompting_target` to resolve a thinking budget, raising *"has no prompting_target configured, cannot resolve reasoning budget"* when it is absent (`providers/anthropic/anthropic_llm_worker.py:180-185`, `providers/google/google_llm_worker.py:149-154`, `cogt/config_cogt.py:96`). This is the one hard blocker — see §6.
+
+**Authoring surfaces that already exist**, and which this design extends rather than invents:
+
+- `TemplateBlueprint.templating_style` (`cogt/templating/template_blueprint.py:15`), described in its own field docstring as *"Style of prompting to use (typically for different LLMs)"*. Used by `PipeCompose` and by `PipeImgGen`'s prompt assembly (`kernel/img_gen_prompt.py:245-249`). So an authored style is already a language concept — it just doesn't reach `PipeLLM`.
+- `PipeComposeSpec.target_format` — the spec layer's friendly enum widening into a `TemplatingStyle`, the precedent for a shorthand.
+- `LLMSetting.prompting_target` — reachable today from a deck preset or an inline `.mthds` model table (`model = { model = "gpt-4o-mini", temperature = 1, prompting_target = "anthropic" }`). No shipped config uses it, and `derive_templating_style` ignores it anyway when the deck lacks the model.
+
+## 4. The design
+
+### 4.1 Vocabulary
+
+One concept, one type. `TemplatingStyle` stays the type (`tag_style` + `text_format`). The authored field on a `PipeLLM` is **`prompt_style`**, because there the thing being styled *is* the prompt. `PipeCompose` keeps `templating_style` inside its `template` table, because a composed template may render HTML that never reaches an LLM — calling that a "prompt style" would be a lie. Two names for one type is a real cost; §7 asks for a ruling rather than pretending it isn't.
+
+`PromptingTarget` (the `openai` / `anthropic` / `mistral` / `gemini` / `fal` enum) disappears from style selection entirely. Authors do not think "my target is openai"; they think "tag my inputs with XML".
+
+### 4.2 Two levels, pipe wins
+
+1. **The pipe** — `PipeLLM.prompt_style`. For a step that needs a specific shape.
+2. **The runtime config** — `pipelex.prompting_config.default_prompt_style`. The value every pipe gets when it says nothing; house style for an org that wants one.
+
+Resolution is a **total function**: `pipe.prompt_style or config.default_prompt_style`. It consults no deck, no model spec, no credentials — which is why the result cannot depend on how the process booted.
+
+(A domain-level `prompt_style` inheriting down like `system_prompt` does was considered and **rejected — Louis, 2026-08-14**: two levels are enough. If a whole method genuinely wants one style, that is what the config default is for; don't add a third place to look.)
+
+### 4.3 The invariant: there is no "no style"
+
+The resolver never returns `None`. That is the load-bearing part, and it is what collapses the three defaults of §2:
+
+- `templating_style: TemplatingStyle | None` stops being optional along the prompt-rendering path — concretely, the kernel ops `run_llm_text` / `run_llm_object` and `assemble_llm_prompt` take a plain `TemplatingStyle` (the tightening the KF-16 note already anticipated).
+- The `TICKS` fallback in `apply_tag_style` becomes unreachable and gets **deleted**. A missing `TAG_STYLE` on the Jinja2 context stops being a silent default and becomes what it actually is — a bug.
+- The hardcoded `xml`/`markdown` in `llm_prompt_template.py` goes with the module, if that module is indeed dead.
+
+It also disposes of the "external LLM plugin" case cleanly: a model served by a plugin the deck knows nothing about no longer gets to have an opinion about prompt shape, because nothing about prompt shape is read from a model any more.
+
+### 4.4 The authored surface
+
+A string shorthand that widens into the struct — the same idiom `PipeComposeBlueprint.template: str | TemplateBlueprint` already uses:
+
+```toml
+[pipe.extract_clauses]
+type = "PipeLLM"
+prompt = "Extract the clauses from $contract" # says nothing → config default (xml)
+
+[pipe.summarize_verbatim]
+type = "PipeLLM"
+prompt = "Summarize $clauses"
+prompt_style = { tag_style = "no_tag", text_format = "markdown" } # this one step differs
+```
+
+Bare string = `tag_style`, the overwhelmingly common case. Inline table = the full `TemplatingStyle`. `no_tag` is already in the enum and becomes a genuinely useful authoring choice ("don't wrap my inputs in anything").
+
+### 4.5 Layering
+
+Per the spec-vs-blueprint split: `PipeLLMBlueprint` gets `prompt_style` (language), `PipeLLMSpec` gets the matching authoring field mapped through `to_blueprint()` (convenience). The resolver belongs next to the other kernel prompt semantics, replacing `derive_templating_style` in `kernel/llm_ops.py`.
+
+### 4.6 What gets deleted
+
+- `InferenceModelSpec.prompting_target` and every `prompting_target` line in the kit's backend spec TOMLs.
+- `LLMSetting.prompting_target`.
+- `PromptingConfig.prompting_styles` (the target → style map in `pipelex.toml`).
+- `PromptingTarget` itself, once §6 lands.
+- The `TICKS` fallback in `apply_tag_style`, and `derive_templating_style`'s deck lookup.
+- The `PipelexKernel.llm_object` docstring paragraph recording the parity-gap 2.2 adjudication — why its single `model` carries the text-choice semantics for templating, the "do not fix by deriving from an object-only resolution" trap, and its pointer to this directory (`pipelex/kernel/pipelex_kernel.py`). With derivation gone, prompt style no longer depends on which model resolution ran, so the question that paragraph adjudicates dissolves. **KF-16 closes with this change** — update the `wip/parity/` docs that carry it.
+
+## 5. One resolver, every prompt
+
+The resolver must serve **every pipe that renders a prompt**, not just `PipeLLM`. Today `PipeImgGen`'s prompt renders with whatever `TemplateBlueprint.templating_style` the author supplied, which is normally nothing — so it falls into the same `TICKS` default from the same filter. Once the resolver is total, img-gen and compose prompts inherit the config default the same way, and the author gets one mental model instead of three.
+
+Note that the style is consumed **before** dispatch — `assemble_llm_prompt` renders in the interpreter and the content generator receives an already-rendered `LLMPrompt` — so nothing about this has to cross the transport boundary for `PipeLLM`. `TemplatingAssignment.templating_style` (`cogt/content_generation/assignment_models.py:116`) does travel, for the compose path; it is a plain pydantic field and stays as-is.
+
+## 6. The blocker: reasoning budgets must move first
+
+`effort_to_budget_maps` is keyed by `prompting_target`, so deleting the field breaks thinking-budget resolution on Anthropic and Google. The fix is small and improves things: **the worker already knows its own family.** The Anthropic worker is the Anthropic worker; it does not need a config field to tell it so. Have each worker supply its own budget-map key, keep the config map keyed as it is (`anthropic`, `gemini`), and rename the concept so it stops borrowing the word "prompting" for something that is about reasoning effort.
+
+This is a prerequisite, not a follow-up. Sequence it first so that removing `prompting_target` is a pure deletion.
+
+## 7. Rulings — all settled (Louis, 2026-08-14)
+
+- **Naming: `templating_style` everywhere.** One name for the one type, on PipeLLM and PipeCompose alike — the §4.1 proposal of `prompt_style` on PipeLLM was not retained. Accepts that "templating" is the broader word; avoids two names for one type. Config vocabulary follows (see the implementation plan's derived decisions).
+- **The new global default: `xml` + `plain`**, as proposed. OpenAI-family prompts flip from back-ticks to XML — the point of the change.
+- **No per-model or per-preset override survives.** Pure two-level resolution: pipe > config default, nothing else. The infra-side lever is removed entirely.
+- **The authored surface is the full `TemplatingStyle`.** Bare string = `tag_style` shorthand (the common case); inline table = the full struct including `text_format`.
+
+## 8. Migration and blast radius
+
+- **Every prompt rendered for an OpenAI-family model changes shape** — from `` name: ``` `` back-tick blocks to `<name>` XML tags. This is the point of the change, not a side effect, but it is a change to the actual text sent for a large share of shipped methods and should be stated plainly in the changelog. Anything with recorded prompt goldens will move.
+- **Test fixtures and goldens** that assert rendered prompt text will need regenerating; grep for both tag shapes.
+- **Schema propagation.** `PipeLLMBlueprint` gaining a field changes the MTHDS JSON Schema: regenerate with `pipelex-dev generate-mthds-schema`, then propagate to the downstream committed copies via the `mthds-schema-sync` skill, gated on a released `pipelex` version.
+- **Config shape.** `prompting_config` loses `prompting_styles` and renames its default — the config model and every `pipelex.toml` must move together or boot fails; `make tb` is the quick check.
+- **Docs.** Prompt style becomes an authoring topic (a page under method authoring) rather than an inference-config topic; the backend-config docs lose a field. One whole published page is premised on the old mechanism — `docs/building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md` ("adapt prompting styles for OpenAI, Anthropic, Mistral…"), linked from `docs/features/llm-integration.md` — replace it with the authoring page rather than patching it; even its URL states the dead premise.
+- **MTHDS spec.** A pipe-level `templating_style` is a language-surface change, which the `mthds/` spec repo owns — the JSON-Schema regen and downstream sync above are only the mechanical half; the spec prose is a deliverable of its own.
+- **No backward compatibility**, per repo policy: no deprecation window, just the changelog entry.
+
+## 9. Relationship to the keyless dry-run bug
+
+`wip/keyless/` documents a bug where a process booted without credentials renders different prompts than one booted with them, because prompt style is derived from model metadata that only loads with credentials. **This design dissolves that bug rather than fixing it** — once style depends on nothing but authored declarations and config, a keyless boot and a keyed boot agree by construction.
+
+That is a consequence, not a justification. The keyless investigation has its own residue that survives this change and must still be judged on its own merits: `max_prompt_images` unenforced, img-gen param rules skipped, and handle-pinned bundles *rejected* on a keyless machine. Settle prompt style first; then re-open `wip/keyless/keyless-dry-prompts-fix-plan.md` with a smaller and clearer question.
diff --git a/wip/prompting-style/templating-style-explainer.html b/wip/prompting-style/templating-style-explainer.html
new file mode 100644
index 000000000..5f9a1acd1
--- /dev/null
+++ b/wip/prompting-style/templating-style-explainer.html
@@ -0,0 +1,659 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Retiring prompting_target</title>
+<style>
+:root {
+ --ground: #F2F5F5;
+ --surface: #FFFFFF;
+ --surface-2: #E9EFEF;
+ --ink: #101619;
+ --ink-soft: #56656A;
+ --ink-faint: #7E8D91;
+ --accent: #0C6E6E;
+ --accent-soft: #D6EAE8;
+ --old: #9C5638;
+ --old-soft: #F3E1D8;
+ --line: #D6DFDF;
+ --line-strong: #B9C6C6;
+
+ --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
+ --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
+
+ --measure: 68ch;
+ --pad: clamp(1.1rem, 4vw, 2.5rem);
+}
+
+@media (prefers-color-scheme: dark) {
+ :root:not([data-theme="light"]) {
+ --ground: #0D1214;
+ --surface: #151D1F;
+ --surface-2: #1D2729;
+ --ink: #E4EBEB;
+ --ink-soft: #94A4A6;
+ --ink-faint: #728284;
+ --accent: #4FC3BE;
+ --accent-soft: #12312F;
+ --old: #D3906F;
+ --old-soft: #33211A;
+ --line: #253032;
+ --line-strong: #37484A;
+ }
+}
+
+:root[data-theme="dark"] {
+ --ground: #0D1214;
+ --surface: #151D1F;
+ --surface-2: #1D2729;
+ --ink: #E4EBEB;
+ --ink-soft: #94A4A6;
+ --ink-faint: #728284;
+ --accent: #4FC3BE;
+ --accent-soft: #12312F;
+ --old: #D3906F;
+ --old-soft: #33211A;
+ --line: #253032;
+ --line-strong: #37484A;
+}
+
+* { box-sizing: border-box; }
+
+html { -webkit-text-size-adjust: 100%; }
+
+body {
+ margin: 0;
+ background: var(--ground);
+ color: var(--ink);
+ font-family: var(--sans);
+ font-size: 17px;
+ line-height: 1.65;
+ -webkit-font-smoothing: antialiased;
+}
+
+.wrap {
+ max-width: 1080px;
+ margin: 0 auto;
+ padding: var(--pad);
+ display: flex;
+ flex-direction: column;
+ gap: 3rem;
+}
+
+/* ---------- masthead ---------- */
+
+header.masthead {
+ display: flex;
+ flex-direction: column;
+ gap: 1.1rem;
+ padding-top: 1.5rem;
+}
+
+.eyebrow {
+ font-family: var(--mono);
+ font-size: 0.72rem;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--accent);
+ margin: 0;
+}
+
+h1 {
+ font-family: var(--mono);
+ font-size: clamp(2rem, 6vw, 3.1rem);
+ line-height: 1.05;
+ letter-spacing: -0.02em;
+ font-weight: 600;
+ margin: 0;
+ text-wrap: balance;
+}
+
+h1 .brk { color: var(--line-strong); font-weight: 400; }
+
+.standfirst {
+ font-size: clamp(1.05rem, 2.4vw, 1.24rem);
+ line-height: 1.55;
+ color: var(--ink-soft);
+ margin: 0;
+ max-width: var(--measure);
+ text-wrap: pretty;
+}
+
+.meta {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.5rem 1.4rem;
+ font-family: var(--mono);
+ font-size: 0.76rem;
+ color: var(--ink-faint);
+ border-top: 1px solid var(--line);
+ padding-top: 0.9rem;
+ margin-top: 0.3rem;
+}
+.meta b { color: var(--ink-soft); font-weight: 500; }
+
+/* ---------- tldr ---------- */
+
+.tldr {
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-left: 3px solid var(--accent);
+ border-radius: 4px;
+ padding: clamp(1.2rem, 3vw, 1.9rem);
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+}
+
+.tldr h2 {
+ font-family: var(--mono);
+ font-size: 0.76rem;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--accent);
+ margin: 0;
+ font-weight: 600;
+}
+
+.tldr ul { margin: 0; padding-left: 1.15rem; display: flex; flex-direction: column; gap: 0.6rem; }
+.tldr li { max-width: var(--measure); }
+
+/* ---------- sections ---------- */
+
+section { display: flex; flex-direction: column; gap: 1.1rem; }
+
+h2.sec {
+ font-family: var(--mono);
+ font-size: clamp(1.15rem, 3vw, 1.5rem);
+ font-weight: 600;
+ letter-spacing: -0.01em;
+ margin: 0;
+ padding-bottom: 0.55rem;
+ border-bottom: 1px solid var(--line);
+ display: flex;
+ align-items: baseline;
+ gap: 0.7rem;
+}
+
+h2.sec .num {
+ font-size: 0.75rem;
+ color: var(--accent);
+ letter-spacing: 0.1em;
+ flex: none;
+}
+
+h3 {
+ font-family: var(--mono);
+ font-size: 1rem;
+ font-weight: 600;
+ margin: 0.7rem 0 0;
+ color: var(--ink);
+}
+
+p { margin: 0; max-width: var(--measure); text-wrap: pretty; }
+
+section > ul { margin: 0; padding-left: 1.2rem; max-width: var(--measure); display: flex; flex-direction: column; gap: 0.55rem; }
+
+a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
+a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
+
+code {
+ font-family: var(--mono);
+ font-size: 0.875em;
+ background: var(--surface-2);
+ padding: 0.1em 0.34em;
+ border-radius: 3px;
+ word-break: break-word;
+}
+
+strong { font-weight: 650; }
+
+/* ---------- figure ---------- */
+
+figure {
+ margin: 0.6rem 0;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 4px;
+ padding: clamp(0.9rem, 2.5vw, 1.5rem);
+ overflow-x: auto;
+}
+figure svg { display: block; min-width: 640px; width: 100%; height: auto; }
+figcaption {
+ font-family: var(--mono);
+ font-size: 0.74rem;
+ color: var(--ink-faint);
+ margin-top: 1rem;
+ line-height: 1.5;
+ max-width: 78ch;
+}
+
+.s-box { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
+.s-box-a { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.2; }
+.s-box-o { fill: var(--old-soft); stroke: var(--old); stroke-width: 1.2; }
+.s-t { font-family: var(--mono); font-size: 12px; fill: var(--ink); }
+.s-t-s { font-family: var(--mono); font-size: 11px; fill: var(--ink-soft); }
+.s-lbl { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; }
+.s-lbl-a { fill: var(--accent); }
+.s-lbl-o { fill: var(--old); }
+.s-ln-o { stroke: var(--old); stroke-width: 1.4; fill: none; }
+.s-ln-a { stroke: var(--accent); stroke-width: 1.4; fill: none; }
+.s-head-o { fill: var(--old); }
+.s-head-a { fill: var(--accent); }
+.s-dash { stroke-dasharray: 4 3; }
+.s-rule { stroke: var(--line); stroke-width: 1; }
+
+/* ---------- code ---------- */
+
+pre {
+ font-family: var(--mono);
+ font-size: 0.8rem;
+ line-height: 1.62;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 4px;
+ padding: 1rem 1.1rem;
+ overflow-x: auto;
+ margin: 0;
+ tab-size: 2;
+}
+pre code { background: none; padding: 0; font-size: inherit; }
+
+.diff .add { color: var(--accent); display: block; }
+.diff .del { color: var(--old); display: block; }
+
+.filelabel {
+ font-family: var(--mono);
+ font-size: 0.72rem;
+ color: var(--ink-faint);
+ letter-spacing: 0.04em;
+ margin-bottom: 0.35rem;
+ display: block;
+}
+
+.codeblock { display: flex; flex-direction: column; margin: 0.4rem 0; }
+
+/* ---------- two-up ---------- */
+
+.twoup {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
+ gap: 1rem;
+ margin: 0.4rem 0;
+}
+.pane {
+ background: var(--surface);
+ border: 1px solid var(--line);
+ border-radius: 4px;
+ padding: 1rem 1.1rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.6rem;
+ min-width: 0;
+}
+.pane.old { border-top: 2px solid var(--old); }
+.pane.new { border-top: 2px solid var(--accent); }
+.pane h4 {
+ font-family: var(--mono);
+ font-size: 0.72rem;
+ letter-spacing: 0.14em;
+ text-transform: uppercase;
+ margin: 0;
+ font-weight: 600;
+}
+.pane.old h4 { color: var(--old); }
+.pane.new h4 { color: var(--accent); }
+.pane pre { border: none; background: var(--surface-2); padding: 0.75rem 0.85rem; }
+.pane p { font-size: 0.92rem; color: var(--ink-soft); }
+
+/* ---------- table ---------- */
+
+.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
+table { border-collapse: collapse; width: 100%; font-size: 0.87rem; min-width: 520px; }
+th, td { text-align: left; padding: 0.62rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
+th {
+ font-family: var(--mono);
+ font-size: 0.7rem;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ color: var(--ink-faint);
+ font-weight: 600;
+ background: var(--surface-2);
+ white-space: nowrap;
+}
+tbody tr:last-child td { border-bottom: none; }
+td code { font-size: 0.82em; white-space: pre-line; display: inline-block; line-height: 1.5; }
+
+/* ---------- callout ---------- */
+
+.callout {
+ border: 1px solid var(--line);
+ border-left: 3px solid var(--old);
+ background: var(--surface);
+ border-radius: 4px;
+ padding: 1rem 1.2rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.6rem;
+}
+.callout.good { border-left-color: var(--accent); }
+.callout .tag {
+ font-family: var(--mono);
+ font-size: 0.7rem;
+ letter-spacing: 0.14em;
+ text-transform: uppercase;
+ color: var(--old);
+ font-weight: 600;
+}
+.callout.good .tag { color: var(--accent); }
+.callout p { max-width: 74ch; }
+
+/* ---------- details ---------- */
+
+details {
+ border: 1px solid var(--line);
+ border-radius: 4px;
+ background: var(--surface);
+ padding: 0.5rem 1.1rem;
+}
+details[open] { padding-bottom: 1.1rem; }
+summary {
+ cursor: pointer;
+ font-family: var(--mono);
+ font-size: 0.82rem;
+ font-weight: 600;
+ padding: 0.55rem 0;
+ color: var(--ink);
+ list-style: none;
+ display: flex;
+ align-items: center;
+ gap: 0.6rem;
+}
+summary::-webkit-details-marker { display: none; }
+summary::before {
+ content: "+";
+ color: var(--accent);
+ font-weight: 600;
+ flex: none;
+ width: 1ch;
+}
+details[open] summary::before { content: "\2013"; }
+details > *:not(summary) { margin-top: 0.7rem; }
+details p, details ul { max-width: 74ch; }
+details ul { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
+
+footer {
+ border-top: 1px solid var(--line);
+ padding: 1.4rem 0 3rem;
+ font-family: var(--mono);
+ font-size: 0.74rem;
+ color: var(--ink-faint);
+ display: flex;
+ flex-direction: column;
+ gap: 0.4rem;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ * { animation: none !important; transition: none !important; }
+}
+</style>
+</head>
+<body>
+<div class="wrap">
+
+<header class="masthead">
+ <p class="eyebrow">Engineering note &middot; branch fix/Keyless-dry-run</p>
+ <h1><span class="brk">&lt;</span>Retiring prompting_target<span class="brk">&gt;</span></h1>
+ <p class="standfirst">How a method&rsquo;s inputs get tagged into a prompt is now something the <em>author</em> declares, not something the runtime infers from whichever provider happens to serve the model. The per-provider dialect map is deleted. Every OpenAI-family prompt changes shape from back-tick fences to XML tags.</p>
+ <div class="meta">
+ <span><b>Status</b> all phases built &amp; green; final two staged, uncommitted</span>
+ <span><b>Repo</b> Pipelex/pipelex</span>
+ <span><b>Date</b> 2026-08-14</span>
+ <span><b>Breaking</b> yes</span>
+ </div>
+</header>
+
+<div class="tldr">
+ <h2>TL;DR</h2>
+ <ul>
+ <li><strong>What.</strong> A <code>PipeLLM</code> can declare <code>templating_style</code> &mdash; a bare tag-style string (<code>"xml"</code>, <code>"ticks"</code>, <code>"square_brackets"</code>, <code>"no_tag"</code>) or a full <code>{ tag_style, text_format }</code> table. Anything that declares nothing takes <strong>one</strong> runtime default, shipped as <code>xml</code>. <code>prompting_target</code>, the per-target style map and <code>derive_templating_style</code> are gone; nothing consults a model, a deck or a credential to decide prompt shape.</li>
+ <li><strong>Why.</strong> Sending back-ticks to OpenAI and XML to Anthropic maintained a distinction current frontier models no longer make &mdash; and the data was infra-shaped, declared once per backend rather than per model. The direction was ruled on <strong>2026-08-03</strong> and deferred as <strong>KF-16</strong>.</li>
+ <li><strong>Why now.</strong> A keyless boot was silently rendering <em>different prompts</em> in dry runs. We started to fix that, realised the fix was to delete the mechanism we had already agreed was obsolete, and did that instead. The bug is dissolved, not repaired.</li>
+ <li><strong>What breaks for you.</strong> Prompt text changes for every OpenAI-family model, and for any template using <code>| tag</code> on any model. <strong>Any repo shipping its own <code>.pipelex/inference/backends/*.toml</code> fails to boot</strong> until every <code>prompting_target</code> line is deleted &mdash; and <code>portkey.toml</code> carries it per-model as well as in <code>[defaults]</code>.</li>
+ </ul>
+</div>
+
+<section>
+ <h2 class="sec"><span class="num">01</span> The mechanism we deleted</h2>
+ <p>Prompt shape used to be the tail end of a six-link inference chain: the pipe resolved an LLM setting, the setting named a model handle, the handle was looked up in the deck, the deck returned an <code>InferenceModelSpec</code>, the spec carried a <code>prompting_target</code> string, and that string indexed a map in <code>pipelex.toml</code> which finally produced a <code>TemplatingStyle</code>. Six links, each of which had to succeed, to answer a question the method author could simply have been asked.</p>
+
+ <figure>
+ <svg viewBox="0 0 880 470" role="img" aria-label="Diagram comparing the old six-step model-derived resolution chain against the new two-step authored resolution.">
+ <defs>
+ <marker id="ah-o" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
+ <path d="M0,1 L7,4 L0,7 z" class="s-head-o"></path>
+ </marker>
+ <marker id="ah-a" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
+ <path d="M0,1 L7,4 L0,7 z" class="s-head-a"></path>
+ </marker>
+ </defs>
+
+ <text x="20" y="22" class="s-lbl s-lbl-o">BEFORE &mdash; DERIVED FROM INFRASTRUCTURE</text>
+ <text x="480" y="22" class="s-lbl s-lbl-a">AFTER &mdash; DECLARED BY THE AUTHOR</text>
+ <line x1="450" y1="10" x2="450" y2="460" class="s-rule"></line>
+
+ <rect x="20" y="42" width="330" height="38" rx="5" class="s-box"></rect>
+ <text x="36" y="66" class="s-t">PipeLLM runs</text>
+
+ <path d="M60,80 L60,102" class="s-ln-o" marker-end="url(#ah-o)"></path>
+ <rect x="20" y="104" width="330" height="38" rx="5" class="s-box"></rect>
+ <text x="36" y="128" class="s-t">resolve LLMSetting &rarr; model handle</text>
+
+ <path d="M60,142 L60,164" class="s-ln-o" marker-end="url(#ah-o)"></path>
+ <rect x="20" y="166" width="330" height="38" rx="5" class="s-box"></rect>
+ <text x="36" y="190" class="s-t">ModelDeck lookup &rarr; InferenceModelSpec</text>
+
+ <path d="M60,204 L60,226" class="s-ln-o" marker-end="url(#ah-o)"></path>
+ <rect x="20" y="228" width="330" height="38" rx="5" class="s-box-o"></rect>
+ <text x="36" y="252" class="s-t">spec.prompting_target = "openai"</text>
+
+ <path d="M60,266 L60,288" class="s-ln-o" marker-end="url(#ah-o)"></path>
+ <rect x="20" y="290" width="330" height="38" rx="5" class="s-box-o"></rect>
+ <text x="36" y="314" class="s-t">prompting_styles["openai"]</text>
+
+ <path d="M60,328 L60,350" class="s-ln-o" marker-end="url(#ah-o)"></path>
+ <rect x="20" y="352" width="330" height="38" rx="5" class="s-box"></rect>
+ <text x="36" y="376" class="s-t">TagStyle.TICKS</text>
+
+ <path d="M185,390 L185,412" class="s-ln-o" marker-end="url(#ah-o)"></path>
+ <text x="20" y="432" class="s-t-s">deck miss at any link &rarr; style is None</text>
+ <text x="20" y="450" class="s-t-s">&rarr; filter falls back to TICKS, silently</text>
+
+ <rect x="480" y="42" width="330" height="38" rx="5" class="s-box"></rect>
+ <text x="496" y="66" class="s-t">PipeLLM runs</text>
+
+ <path d="M520,80 L520,164" class="s-ln-a" marker-end="url(#ah-a)"></path>
+ <rect x="480" y="166" width="330" height="38" rx="5" class="s-box-a"></rect>
+ <text x="496" y="190" class="s-t">resolve_templating_style(authored=&hellip;)</text>
+
+ <path d="M520,204 L520,288" class="s-ln-a" marker-end="url(#ah-a)"></path>
+ <text x="536" y="240" class="s-t-s">pipe declared one? use it.</text>
+ <text x="536" y="258" class="s-t-s">else: the config default.</text>
+
+ <rect x="480" y="290" width="330" height="38" rx="5" class="s-box"></rect>
+ <text x="496" y="314" class="s-t">TagStyle.XML</text>
+
+ <path d="M645,328 L645,350" class="s-ln-a s-dash" marker-end="url(#ah-a)"></path>
+ <text x="480" y="370" class="s-t-s">no deck, no model spec, no credential</text>
+ <text x="480" y="388" class="s-t-s">is read anywhere on this path</text>
+
+ <text x="480" y="432" class="s-t-s">a style-less render is now a loud</text>
+ <text x="480" y="450" class="s-t-s">Jinja2ContextError &mdash; never a fallback</text>
+ </svg>
+ <figcaption>The old chain had two failure modes and no way to tell them apart: &ldquo;this model is served by an external plugin, so we legitimately know nothing about it&rdquo; and &ldquo;we loaded no models at all.&rdquo; Both produced <code>None</code>, and <code>None</code> was silently absorbed by a triple-backtick fallback in the Jinja2 filter.</figcaption>
+ </figure>
+</section>
+
+<section>
+ <h2 class="sec"><span class="num">02</span> Why now: the dry-run divergence</h2>
+ <p>The branch is called <code>fix/Keyless-dry-run</code> because it was cut to fix a different bug. A dry run exists to rehearse a real run without spending money, which is why it is documented as needing no API keys &mdash; naturally read as <em>same program, mocked leaves</em>. It was not true: <strong>a dry run booted without credentials rendered different prompts from one booted with them, and nothing in either run said so.</strong></p>
+
+ <div class="twoup">
+ <div class="pane new">
+ <h4>Boot A &mdash; with credentials</h4>
+<pre><code>deck: every model loaded
+style &rarr; xml/plain
+
+&lt;result&gt;
+&hellip;
+&lt;/result&gt;</code></pre>
+ </div>
+ <div class="pane old">
+ <h4>Boot B &mdash; keyless</h4>
+<pre><code>deck: zero models
+style &rarr; None
+
+result: ```
+&hellip;
+```</code></pre>
+ </div>
+ </div>
+ <p>Same method, same inputs. Every backend declares its key as a <code>${VAR}</code>, so on a keyless machine the lenient load skipped every backend and the deck came out empty &mdash; and the style derivation took its documented <code>None</code> path, written for a case (a model served by an external plugin) that a keyless boot satisfies for <em>every</em> model at once. Both runs complete, both report identical usage records, neither logs the difference.</p>
+ <p><strong>Why it stayed invisible:</strong> any gate whose two sides boot the same way cannot see this variable at all &mdash; and reads as evidence that it does not matter. Two keyless sides agree perfectly. The divergence only surfaces against a side that <em>cannot</em> boot keyless.</p>
+
+ <div class="callout good">
+ <span class="tag">The turn &mdash; and the relationship, stated precisely</span>
+ <p>A four-part fix plan was written: build a seam letting a credential-free process load model <em>metadata</em> without model <em>credentials</em>. Then the obvious thing landed &mdash; <strong>the headline symptom only exists because prompt shape is derived from infrastructure at all.</strong> Delete the derivation, and keyless and keyed boots render byte-identical prompts <em>by construction</em>.</p>
+ <p>The bug <strong>surfaced and scheduled</strong> this work; it did not motivate it. Every argument for the change holds with no bug in the picture. Had we fixed the bug as planned, we would have built a metadata seam whose main beneficiary was a derivation we were about to delete.</p>
+ </div>
+
+ <p>The <em>diagnosis</em> in that bug report is untouched &mdash; a keyless boot still yields an empty deck &mdash; but the two silent symptoms (back-tick step-2 prompts, an ignored <code>llm_setting.prompting_target</code>) are dissolved rather than fixed. What survives is loud or minor: <code>max_prompt_images</code> and image param-support checks need a populated deck; handle-pinned bundles are <em>rejected</em> keylessly; the two CLIs disagree on whether <code>--dry-run</code> needs credentials. Whether the expensive half of that plan still earns its blast radius is now an open question rather than a settled one.</p>
+</section>
+
+<section>
+ <h2 class="sec"><span class="num">03</span> What it looks like now</h2>
+
+ <div class="twoup">
+ <div class="pane old">
+ <h4>Before &mdash; infra decided</h4>
+ <span class="filelabel">pipelex/pipelex.toml</span>
+<pre><code>[pipelex.prompting_config]
+default_prompting_style = { tag_style = "xml" }
+
+[pipelex.prompting_config.prompting_styles]
+openai = { tag_style = "ticks" }
+anthropic = { tag_style = "xml" }
+mistral = { tag_style = "square_brackets" }
+gemini = { tag_style = "xml" }</code></pre>
+ <p>Plus a <code>prompting_target</code> line in every backend TOML, and per-model overrides in <code>portkey.toml</code>.</p>
+ </div>
+ <div class="pane new">
+ <h4>After &mdash; the author decides</h4>
+ <span class="filelabel">pipelex/pipelex.toml</span>
+<pre><code>[pipelex.templating_config]
+default_templating_style = { tag_style = "xml" }</code></pre>
+ <p>One default for anything that declares nothing. No per-model, per-backend or per-preset override exists &mdash; deliberately.</p>
+ </div>
+ </div>
+
+<div class="codeblock">
+<span class="filelabel">any .mthds file &mdash; bare string is the tag_style shorthand, inline table is the full struct</span>
+<pre><code>[pipe.summarize_article]
+type = "PipeLLM"
+inputs = { article = "Text" }
+output = "Text"
+templating_style = "square_brackets"
+
+[pipe.render_note]
+type = "PipeLLM"
+templating_style = { tag_style = "xml", text_format = "markdown" }</code></pre>
+</div>
+
+ <p>Each style below shows what <code>@article</code> produces for an input named <code>article</code>. The tag name comes from the variable; a value with no name of its own falls back to <code>data</code>. The two sigils are governed by different halves of the style: <code>@variable</code> on its own line wraps the whole input per <code>tag_style</code>; inline <code>$variable</code> inserts it formatted per <code>text_format</code>, unwrapped.</p>
+ <div class="tablewrap">
+ <table>
+ <thead><tr><th>tag_style</th><th>Renders as</th></tr></thead>
+ <tbody>
+ <tr><td><code>xml</code> <em>(default)</em></td><td><code>&lt;article&gt;&#10;&hellip;&#10;&lt;/article&gt;</code></td></tr>
+ <tr><td><code>ticks</code></td><td><code>article: ```&#10;&hellip;&#10;```</code></td></tr>
+ <tr><td><code>square_brackets</code></td><td><code>[article]&#10;&hellip;&#10;[/article]</code></td></tr>
+ <tr><td><code>no_tag</code></td><td>the value, bare</td></tr>
+ </tbody>
+ </table>
+ </div>
+
+ <h3>The two edits that carry the change</h3>
+<div class="codeblock">
+<span class="filelabel">pipelex/kernel/templating_style_ops.py &mdash; new, and this is the whole thing</span>
+<pre class="diff"><code><span class="add">+def resolve_templating_style(*, authored: TemplatingStyle | None) -> TemplatingStyle:</span>
+<span class="add">+ """The style a prompt renders under: the authored one, else the configured default."""</span>
+<span class="add">+ return authored or get_config().pipelex.templating_config.default_templating_style</span></code></pre>
+</div>
+ <p>Total, deck-free, credential-free. Its totality is the point &mdash; because it can never return <code>None</code>, nothing downstream has to carry an optional style and invent a fallback for it.</p>
+
+<div class="codeblock">
+<span class="filelabel">pipelex/tools/jinja2/jinja2_filters.py &mdash; the fallbacks die</span>
+<pre class="diff"><code><span class="del">- tag_style_str = context.get(Jinja2ContextKey.TAG_STYLE)</span>
+<span class="del">- tag_style = TagStyle(tag_style_str) if tag_style_str else TagStyle.TICKS</span>
+<span class="add">+ tag_style = TagStyle(require_templating_style_value(</span>
+<span class="add">+ context=context, jinja2_context_key=Jinja2ContextKey.TAG_STYLE))</span></code></pre>
+</div>
+ <p>This is what makes the class of bug unreachable rather than merely fixed. A missing key now raises <code>Jinja2ContextError</code>, with no default, deliberately: every prompt-rendering entry point resolves a style before rendering, so a missing one means the render was set up wrong. The old <code>TICKS</code> default is exactly how a triple-backtick style used to reach prompts nobody had chosen it for.</p>
+</section>
+
+<section>
+ <h2 class="sec"><span class="num">04</span> Three traps worth knowing about</h2>
+
+ <div class="callout">
+ <span class="tag">Trap 1 &mdash; an unknown key becomes an HTTP header</span>
+ <p><code>backend_library.py</code> reclassifies any per-model TOML key that is not in <code>InferenceModelSpecBlueprint.model_fields</code> as an <strong>outbound HTTP header</strong>. Deleting the model field while a per-model <code>prompting_target = "gemini"</code> line survived would have shipped that line to the provider as a header, silently. The field deletion and the TOML deletions had to land in one commit, verified by grep across the source tree and the synced kit copies.</p>
+ <p><strong>This is the trap in the downstream sweep too</strong>, and it is why deleting only the <code>[defaults]</code> line is worse than doing nothing: the boot starts working again while the per-model occurrences quietly become headers.</p>
+ <p><strong>Now scheduled to be closed &mdash; <code>wip/rogue-extra-headers-guard-plan.md</code>, gated on this branch merging.</strong> The bag stays open (the gateway genuinely needs to be served new <code>x-portkey-*</code> headers without a client release) but gets a <em>shape</em> rule: an unknown key is accepted as a header only if it is header-shaped, i.e. contains a hyphen. Blueprint field names never do, so every removed field and every snake_case typo &mdash; <code>max_tokns</code> &mdash; becomes a loud error from a local TOML and a silent prune from the served payload, instead of a string posted to the provider. <code>endpoint_path</code>, which is routing metadata rather than a header and only escapes the wire by luck today, is promoted to a real field.</p>
+ </div>
+
+ <div class="callout">
+ <span class="tag">Trap 2 &mdash; the remote config outlives the field, and the skew is routine</span>
+ <p>Deleting <code>prompting_target</code> from the blueprint made the entire test suite fail at boot, one cause. The Pipelex Gateway does not read its model specs from this repo: they are fetched from the API and cached, and that served config still declared the key. The blueprint is <code>extra="forbid"</code>, so a config written by a different release than the client reading it stopped the boot dead. Fixed with a general tolerance rather than a shim for one field &mdash; <code>drop_unknown_gateway_defaults</code> prunes unknown keys from the <em>remote</em> config&rsquo;s <code>defaults</code>. Local files stay strict.</p>
+ <p><strong>That tolerance is load-bearing every day, not just on deploy days.</strong> The cache is <em>one file per machine</em>, <code>~/.pipelex/cache/remote_config.json</code>, shared by every worktree &mdash; and it records <code>schema_version</code>, <code>cached_at</code> and the body, but <strong>no source URL</strong>. So a checkout pinning <code>_12</code> cannot tell it is reading an <code>_11</code> body. On this machine on 2026-08-14 it was doing exactly that: the cache held <code>_11</code> byte-for-byte, because the other seven checkouts all pin <code>_11</code> and one had booted more recently. Make remote unknowns fatal and that ordinary local condition turns the suite red.</p>
+ </div>
+
+ <div class="callout">
+ <span class="tag">Trap 3 &mdash; deleting the key from the served config is a live change</span>
+ <p>The served gateway config is owned by our back-office repo (private). Removing the key there would have flipped every gateway prompt <strong>already deployed in the field</strong> from XML to back-tick fences &mdash; because an older client never reaches its configured default (<code>get_prompting_style(None)</code> returns <code>None</code>, not the default), so no style reaches the filter and the old <code>TICKS</code> fallback applies.</p>
+ <p>That never happened because the config is <strong>versioned in its URL</strong> and this branch bumps it: <code>pipelex_remote_config_12.json</code>, was <code>_11</code>. <code>_11</code> is frozen and still carries the key, so every earlier release keeps rendering XML. <strong>The URL bump is the compatibility boundary for any breaking change to that config</strong> &mdash; worth knowing before the next one.</p>
+ </div>
+</section>
+
+<section>
+ <h2 class="sec"><span class="num">05</span> What you need to do</h2>
+
+ <h3>If you author .mthds methods</h3>
+ <p>Nothing, unless you want the control. Prompts for OpenAI-family models change shape from back-tick fences to XML tags &mdash; that <em>is</em> the change. If a specific pipe wants a different shape, declare <code>templating_style</code> on it; if your whole project wants a different house style, set <code>default_templating_style</code> in your <code>.pipelex/pipelex.toml</code>.</p>
+
+ <h3>If your repo ships its own backend TOMLs &mdash; not optional</h3>
+ <p>Local backend files are read strictly. On the version bump, every repo shipping <code>.pipelex/inference/backends/*.toml</code> <strong>dies at boot</strong> with <code>Extra forbidden fields: 'prompting_target'</code> &mdash; confirmed in <code>pipelex-api/</code>, <code>cocode/</code>, <code>pipelex-cookbook/</code>, <code>mthds-ui/</code>, plus our hosted worker, our demo repos, and fixtures in our JS runtime (all private). Delete <strong>every</strong> occurrence, <code>[defaults]</code> and per-model alike, and grep to prove it. Re-read trap 1 first: a partial fix is worse than none.</p>
+
+ <h3>If you use a template with <code>| tag</code> or <code>| format</code></h3>
+ <p>Those filters no longer have a default of their own. Through any normal prompt path you are fine &mdash; a style is always resolved for you. Drive the kernel API directly and omit the style, and you now get a loud <code>Jinja2ContextError</code> instead of a silently-chosen shape.</p>
+
+ <details>
+ <summary>Other things this change also does, that you might not expect</summary>
+ <ul>
+ <li><strong>Compose, image-gen, search and structuring prompts all changed too.</strong> They previously rendered style-less, which the filters silently absorbed as back-ticks and plain text. If your <code>PipeCompose</code> template or a construct-mode template field uses <code>| tag</code>, its output changes shape &mdash; on any model family, not just OpenAI&rsquo;s.</li>
+ <li><strong><code>PipeImgGen</code> and <code>PipeSearch</code> have no authored knob</strong> (deliberately, for now). They inherit the config default.</li>
+ <li><strong>Lenient loading got narrower.</strong> <code>InferenceBackendLibrary.load(lenient=...)</code> exists so a keyless boot can skip backends with missing credentials &mdash; but it caught the error <em>base</em> classes, so a malformed local TOML was skipped just as quietly. Now only <code>InferenceBackendCredentialsError</code> is tolerated; malformed configuration is fatal in both modes.</li>
+ <li><strong>The <code>format</code> filter had a latent bug, fixed in passing:</strong> its argument was annotated <code>TextFormat | None</code>, but Jinja2 hands a template-supplied <code>{{ x | format("markdown") }}</code> over as a raw <code>str</code>.</li>
+ <li><strong>A dead module went with it:</strong> <code>llm_prompt_template.py</code>, <code>llm_prompt_factory_abstract.py</code>, <code>llm_prompt_template_inputs.py</code> and <code>LLMPromptTemplateInputsError</code> &mdash; a hardcoded XML+Markdown style that predated the configurable one and had no production consumer.</li>
+ </ul>
+ </details>
+</section>
+
+<footer>
+ <span>Written for co-developers, 2026-08-14. Companion to the design note, the implementation plan and the rogue-headers guard plan in this repo&rsquo;s <code>wip/</code>.</span>
+ <span>Gates at time of writing: make agent-check green &middot; full make agent-test green &middot; mkdocs build --strict green.</span>
+</footer>
+
+</div>
+</body>
+</html>
diff --git a/wip/prompting-style/templating-style-implementation-plan.md b/wip/prompting-style/templating-style-implementation-plan.md
new file mode 100644
index 000000000..3cd492838
--- /dev/null
+++ b/wip/prompting-style/templating-style-implementation-plan.md
@@ -0,0 +1,249 @@
+# Templating style as an authoring decision — implementation plan
+
+**2026-08-14, branch `fix/Keyless-dry-run` (worktree `_keyless`), off v0.44.0.** Implements [`prompt-style-as-an-authoring-decision.md`](prompt-style-as-an-authoring-decision.md) under the settled §7 rulings: **`templating_style` everywhere**, global default **`xml` + `plain`**, **no per-model/preset override**, authored surface = **full `TemplatingStyle`** (bare string = `tag_style` shorthand, inline table = full struct).
+
+Progress is tracked with the checkboxes below. **Checkpoints marked ✋ are hard stops: the executing agent must not proceed past them without Louis' explicit go.** At every checkpoint, update this doc first: tick boxes, fill the checkpoint log at the bottom (status, decisions taken, open questions, state of the code), so the work can hand off into a fresh session with nothing lost.
+
+## Decisions derived from the rulings (veto here, cheaply)
+
+These follow from "one name everywhere" but were not explicitly ruled; they are what this plan builds unless overridden:
+
+- **D1 — config vocabulary follows the ruling.** `PromptingConfig` → `TemplatingConfig`, mounted as `pipelex.templating_config`; TOML section `[pipelex.templating_config]` with the single field `default_templating_style = { tag_style = "xml" }` (`text_format` omitted → `plain` via the model default). The `prompting_styles` map is deleted, not renamed.
+- **D2 — the resolver lives in a small new kernel module**, `pipelex/kernel/templating_style_ops.py`: `resolve_templating_style(*, authored: TemplatingStyle | None) -> TemplatingStyle` returning `authored or get_config().pipelex.templating_config.default_templating_style`. It serves the LLM, img-gen, search and compose paths alike; putting it in `llm_ops.py` would misname it for three of the four.
+- **D3 — the authored union is typed, not stringly.** `templating_style: TagStyle | TemplatingStyle | None = None` on blueprint and spec — pydantic's lax mode coerces the bare TOML string into the `TagStyle` StrEnum, and the MTHDS JSON Schema gets a proper enum for the string arm instead of a free-form `str`. The factory widens `TagStyle` → `TemplatingStyle(tag_style=...)` so the runtime `PipeLLM` holds `TemplatingStyle | None` and the union never travels past parsing. Same idiom family as `PipeComposeBlueprint.template: str | TemplateBlueprint` (bare smart union, narrowing before use — no validator needed).
+- **D4 — the kernel façade gains the same lever.** `PipelexKernel.llm_text` / `llm_object` accept an optional `templating_style` argument, resolved through the same total resolver. This is what finally dissolves parity gap 2.2 / KF-16: the façade and the interpreter agree because neither derives anything.
+- **D5 — filters go strict, entry points resolve.** `render_template` keeps an optional `templating_style` (the EXPRESSION and MERMAID categories have no tag/format filters and legitimately render style-less), but the `tag` / `format` / `with_images` filters lose their silent fallbacks (`TICKS`, `PLAIN`): a missing context key raises `Jinja2ContextError`, because after this change every prompt-rendering entry point supplies a resolved style — a missing one is a bug, per §4.3.
+- **D6 — no new authored field on PipeImgGen/PipeSearch in this change.** They inherit the config default through the resolver (§5's requirement); giving them their own authored knob is a deliberate follow-up if ever wanted, not scope creep now.
+
+## Baseline: what is already sitting uncommitted on this branch
+
+The worktree carries doc-migration changes from the design session: `pipelex/kernel/pipelex_kernel.py` (docstring pointer re-aimed at the new design-doc filename), the `wip/prompting-style/` README deletion + design doc, the `wip/keyless/` brief and plan, and `wip/parity/` updates. Plus this plan and the design doc's §7 ruling record.
+
+- [x] Commit the standing wip/doc baseline as its own commit before Phase 0 code begins, so each phase's diff is reviewable on its own. — Already done before this session: the branch-tip commit "plans" carries exactly that baseline (kernel docstring pointer, wip/prompting-style, wip/keyless, wip/parity).
+
+## Phase map
+
+- **Phase 0** — prerequisite: re-home reasoning budgets off `prompting_target` (§6). Standalone, shippable, zero style-behaviour change. → ✋ **Checkpoint 1**
+- **Phase 1** — the authored surface + total resolver on the LLM path (TDD). The behaviour flip (back-ticks → XML) lands here.
+- **Phase 2** — one resolver, every prompt: img-gen, search, compose; tighten `TemplatingStyle | None` → `TemplatingStyle` along the rendering path; delete the silent filter fallbacks.
+- **Phase 3** — deletions: `prompting_target` from every surface, the target→style map, the dead template module, grants. → ✋ **Checkpoint 2**
+- **Phase 4** — migration surfaces: MTHDS schema, docs, changelog, drift acks.
+- **Phase 5** — bookkeeping: KF-16 closure, keyless plan re-scope, design-doc status. → ✋ **Checkpoint 3 (final)**
+
+## Traps to keep in view (learned from the inventories — read before each phase)
+
+- **Silent-header hazard.** `backend_library.py` (the `extra_headers` loop in `InferenceBackendLibrary.load`, around lines 191-193) reclassifies any per-model TOML key not in `InferenceModelSpecBlueprint.model_fields` as an outbound **HTTP extra header**. Deleting the blueprint field while portkey's per-model `prompting_target = "gemini"` lines survive would ship those as headers, silently. The field deletion and the TOML deletions must be one commit, verified by grep.
+- **Config sync is one-directional.** `.pipelex/inference/backends/` is the source of truth; edit there, then `make ukc` to sync `pipelex/kit/configs/inference/backends/`, gated by `make ccs`.
+- **Config model and TOML move in lockstep** or boot fails — `make tb` after every config-shape edit.
+- **Drift reads the git index.** Stage changes before `make drift-check` / `agent-check`, or the gate sees nothing. The `config-docs` contract (triggers: `configuration/**`, `config_cogt.py`, `pipelex.toml`) fires in Phases 0 and 1; `pipelex-kernel-docs` (triggers: `kernel/**`) fires from Phase 1 on. Ack only after actually reviewing the named docs.
+- **The keyword-only auto-fixer is destructive to intent.** `make agent-check` runs `fix-keyword-only`; deleting grants is deliberate here (the granted defs are deleted or made fully keyword-only), but never let it silently keyword-only something meant to keep a granted subject. `subject_grants.toml` must stay sorted.
+- **Deleted/renamed tests leave `.test_durations` stale** — only the full `make agent-test` at checkpoints catches the fallout; don't skip it.
+
+---
+
+## Phase 0 — Re-home reasoning budgets (prerequisite, §6)
+
+Goal: no code reads `inference_model.prompting_target` for thinking budgets; each worker supplies its own family key. Pure re-homing — the style path is untouched, `prompting_target` still exists everywhere else. Independently shippable.
+
+- [x] **Tests first (red):** in `tests/unit/pipelex/providers/google/test_google_reasoning.py`, rewrite `_make_worker` so the mock model spec has **no** `prompting_target` and the budget tests still pass once the worker owns its key; add the missing twin coverage for the Anthropic worker's manual-thinking budget resolution (today its budget branch has no test at all). — Done: `del mock_model.prompting_target` proves the spec is never read; new `tests/unit/pipelex/providers/anthropic/test_anthropic_reasoning.py` covers the manual budget branch, NONE gating, cap, explicit passthrough, and thinking_mode=none raise; both budget tests assert the lookup is keyed `family="anthropic"`/`"gemini"`. Confirmed red before implementation (14 failed), green after.
+- [x] Give each worker its own key: a `ClassVar` on the worker class — `reasoning_budget_family = "anthropic"` on `AnthropicLLMWorker`, `"gemini"` on `GoogleLLMWorker` — read where the workers previously read `self.inference_model.prompting_target`.
+- [x] Delete both `prompting_target is None → LLMCapabilityError` raise sites (the "has no prompting_target configured" branches) — unreachable once the key is worker-owned. The `LLMCapabilityError` class survives (other users).
+- [x] Rename the concept in `pipelex/cogt/config_cogt.py`: `get_reasoning_budget(self, prompting_target, *, effort)` becomes fully keyword-only `get_reasoning_budget(*, family: str, effort: ReasoningEffort)`; update the two error message strings; delete the now-dead subject grant for it in `subject_grants.toml` (preserving sort order). `effort_to_budget_maps` keeps its name and its TOML keys (`anthropic`, `gemini`) — only the lookup parameter stops borrowing the word "prompting".
+- [x] Update `tests/unit/pipelex/cogt/llm/test_llm_config_reasoning.py` for the new signature.
+- [x] Docs in the same change: `docs/under-the-hood/reasoning-controls.md` — both "keyed by `prompting_target`" passages now describe the worker-owned key.
+- [x] Gates: targeted pytest green (64 passed), `make agent-check` green after honest acks of `config-docs` (no configuration page mentions the budget lookup; the one `prompting_target` hit is the style path, Phase 3/4 scope) and `pipelex-kernel-docs` (trigger was the baseline commit's docstring pointer re-aim; kernel page references no wip paths and still describes today's code). Full `make agent-test` green — see Checkpoint 1 log.
+
+### ✋ CHECKPOINT 1 — HARD STOP
+
+Do not start Phase 1 without Louis' explicit go. Present: the Phase 0 diff summary, test results, and confirmation that `prompting_target` now has exactly one consumer left (the style path). Louis decides whether Phase 0 is committed (and possibly PR'd separately) before the breaking work begins. Update the checkpoint log below. This is also a natural fresh-session handoff point.
+
+---
+
+## Phase 1 — Authored surface + total resolver on the LLM path
+
+Goal: a `PipeLLM` step can declare `templating_style`; when it says nothing, the config default (`xml`) applies; nothing consults the deck. **This is where every OpenAI-family prompt flips from back-ticks to XML** — the point of the change. TDD throughout: each box's test lands red before its implementation.
+
+Config (D1):
+
+- [x] `pipelex/system/configuration/configs.py`: `PromptingConfig` → `TemplatingConfig` with the single field `default_templating_style: TemplatingStyle`; delete `prompting_styles` and `get_prompting_style` (and its subject grant, keeping `subject_grants.toml` sorted); remount as `templating_config`.
+- [x] `pipelex/pipelex.toml`: replace the `[pipelex.prompting_config]` block (and its `prompting_styles` sub-table) with `[pipelex.templating_config]` / `default_templating_style = { tag_style = "xml" }`. Neither `.pipelex/pipelex.toml` nor the kit `pipelex.toml` carries the section — no other TOML moves. `make tb` proves the lockstep.
+
+Resolver (D2):
+
+- [x] New `pipelex/kernel/templating_style_ops.py` with `resolve_templating_style(*, authored: TemplatingStyle | None) -> TemplatingStyle` — total, deck-free, credential-free.
+- [x] Unit tests: totality (returns config default on `None`), authored-wins precedence, and the invariant that it never returns `None`. — `tests/unit/pipelex/kernel/test_templating_style_ops.py`, which also pins the shipped house default (xml + plain).
+
+Authored surface (D3):
+
+- [x] `PipeLLMBlueprint.templating_style: TagStyle | TemplatingStyle | None = None` (`pipe_llm_blueprint.py`).
+- [x] `PipeLLMSpec.templating_style` — same union, passed through in `to_blueprint()` (`builder/pipe/pipe_llm_spec.py`), per the spec-vs-blueprint layering.
+- [x] `PipeLLMFactory.make` widens `TagStyle` → `TemplatingStyle(tag_style=...)`; `PipeLLM` gains `templating_style: TemplatingStyle | None = None` (`pipe_llm_factory.py`, `pipe_llm.py`).
+- [x] Parsing tests: bare string (`templating_style = "no_tag"`), inline table (`{ tag_style = "xml", text_format = "markdown" }`), absent → `None` at blueprint level. — `tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_templating_style.py`, covering both parsing shapes, the spec passthrough, and all three factory-widening outcomes.
+- [x] An e2e/integration bundle exercising the authored field — `tests/integration/pipelex/pipes/pipelines/templating_style.mthds` + `test_templating_style_bundle.py`: all three arms parse, load, and actually govern the rendered text. (a small `.mthds` under the existing test-package layout) — today zero `.mthds` files in the repo touch styling, so this is the first.
+
+Wiring:
+
+- [x] `pipe_llm.py` — replace `templating_style = derive_templating_style(llm_setting=llm_setting_main)` with `resolve_templating_style(authored=self.templating_style)`; drop the "both paths render under the text setting's style" comment (there is no derived style to agree about any more — both arms simply pass the pipe's resolved style).
+- [x] `pipelex_kernel.py` — `llm_text` / `llm_object` gain `templating_style: TemplatingStyle | None = None`, resolved through the resolver (D4); **delete the `llm_object` docstring paragraph** recording the parity-gap 2.2 adjudication ("One `model`, and it carries…") — the question it adjudicates dissolves.
+- [x] Update `tests/unit/pipelex/pipe_operators/pipe_llm/test_prompt_rendering_purity.py`: the "blueprint style wins over the **run-derived** one" parametrization becomes authored-vs-config-default; the purity assertion itself (blueprint not mutated) survives as-is.
+- [x] Flip the two default-shape assertions in `tests/integration/pipelex/pipes/llm_prompt_inputs/test_prompt_image_extraction.py` (`assert "```" in llm_prompt.user_text` → XML shape) and fix its docstring prose.
+- [x] MTHDS schema test `tests/unit/pipelex/language/test_mthds_schema.py`: assert `PipeLLMBlueprint` now carries `templating_style` (optional — the minimal-table cases stay valid).
+- [x] Gates: `make tb`, targeted tests, stage + `make agent-check` (both drift contracts fire — review `docs/configuration/**` and `docs/under-the-hood/pipelex-kernel.md`; the kernel page's surface table still names `derive_templating_style`, which is *correct to leave red until Phase 4* — if the ack would be dishonest, defer the ack to Phase 4 and run gates knowing drift is the one expected red, or update the one table row now and ack honestly. Prefer the latter: keep gates green.)
+
+Note: `LLMSetting.prompting_target` and friends are now **uncalled but still present** — deletion is batched in Phase 3 so this phase stays reviewable as "add + rewire".
+
+**Deviation taken in Phase 1:** `derive_templating_style` could *not* wait for Phase 3. Its only data source was `PromptingConfig.get_prompting_style`, which D1 deletes here, so leaving it in place would have left the tree not type-checking. It was deleted in this phase together with the config it read; everything else in the Phase 3 deletion batch is untouched.
+
+## Phase 2 — One resolver, every prompt; tighten optionality; strict filters
+
+Goal: img-gen, search and compose prompts stop falling into the silent `TICKS` fallback and inherit the same config default; `TemplatingStyle` stops being optional along the prompt-rendering path (§4.3); the fallbacks die.
+
+- [x] **Img-gen:** `kernel/img_gen_prompt.py` — `assemble_img_gen_prompt` and `_render_text` gain a required `templating_style: TemplatingStyle`; `pipe_img_gen.py` resolves via `resolve_templating_style(authored=None)` (no authored surface, D6) and passes it down. — Done; `_render_text` keeps the per-template override arm (`template_blueprint.templating_style or templating_style`), mirroring `_unravel_text` exactly.
+- [x] **Search:** the query template renders under the resolved default. — `run_search` gains a required `templating_style`; `pipe_search.py` resolves `authored=None`. Its docstring no longer justifies the source-plus-category signature with "no style".
+- [x] **Compose:** `run_compose_template`'s `templating_style` is required; `pipe_compose.py` resolves `authored=self.templating_style`. Behaviour note for the changelog: a bare-string compose template using `| tag` flips from the TICKS fallback to the config default. **Beyond the plan:** construct mode needed the same treatment — `StructuredContentComposer` renders each TEMPLATE field with `render_template(category=BASIC)`, which is filter-bearing and was style-less, so a construct field using `| tag` would have hard-failed once the fallbacks died. It now takes a `templating_style` and threads it into nested composers.
+- [x] **Tighten the LLM chain:** `run_llm_text`, `run_llm_object` (`kernel/llm_ops.py`), `assemble_llm_prompt`, `_unravel_text` (`kernel/llm_prompt_content.py`), `make_llm_prompt` (`llm_prompt_blueprint.py`) — `templating_style: TemplatingStyle`, required, no default. The per-template merge `jinja2_blueprint.templating_style or templating_style` stays (a template-level declaration still wins) but is now total by construction.
+- [x] `render_template` / `render_jinja2_*` keep an optional style (filter-less categories, D5); `_prepare_templating_context` unchanged in shape. Also left optional, deliberately: `ContentGeneratorProtocol.make_templated_text` and its `TemplatingAssignment` — a generic templating seam with no production caller, not a prompt-rendering entry point, and a caller may legitimately render an EXPRESSION or MERMAID template style-less. A caller that does use `| tag` there now gets a loud error instead of silent TICKS, which is D5's intent.
+- [x] **Delete the fallbacks (D5):** `apply_tag_style`'s `TICKS` arm (`jinja2_filters.py`) → missing `TAG_STYLE` raises `Jinja2ContextError`; the `format` filter's `PLAIN` default and `jinja2_with_images_filter.py`'s twin likewise go strict. Also delete the dead `TemplatingStyle.make_default_prompting_style` (zero callers).
+- [x] Tests: `test_default_style_is_ticks_when_not_set` is now `test_missing_tag_style_raises`; `test_jinja2_tag_filter.py`'s `_make_context` takes a keyword-only `tag_style` with no default, so every case states the style it renders under. New `tests/unit/pipelex/tools/test_jinja2_style_context_strictness.py` covers all three filters raising on a style-less context, plus the case that must NOT raise (an explicit `| format("markdown")` argument never reads the context key). The img-gen twin is `test_img_gen_prompt_renders_under_config_default` in the Phase-1 bundle test, against a new `default_style_picture` PipeImgGen in `templating_style.mthds`. `dry_mock.py` needed nothing: it stringifies `TemplatingAssignment.templating_style`, which stays optional on the seam left optional above. The kernel boot-contract subprocess now resolves the style itself, which incidentally proves the resolver runs on a library-less boot.
+- [x] Gates: targeted tests green across tools, kernel, pipe_operators, integration pipes and cogt; `make tb`; stage + `make agent-check`.
+
+**Two things Phase 2 touched that the plan had not anticipated**, both consequences of the filters going strict — a style-less render of a filter-bearing category stops being merely odd and becomes a hard failure, so every such render site had to be found, not just the ones on the prompt paths:
+
+- **Construct-mode template fields** (`StructuredContentComposer`), described in the compose box above. This one was user-facing: `.mthds` construct fields are authored templates.
+- **The two generic prompt templates** — `derive_structure_prompt` (`kernel/llm_ops.py`) and the structuring prompt rendered in `pipe_structure.py`. Both render `TemplateCategory.LLM_PROMPT` with no style. The shipped templates use no filter, so nothing breaks today, but they are config-editable, and a user who added `| tag` would have hit the new error with no way to supply a style. `derive_structure_prompt` now takes the style its caller already holds (it is appended to that same prompt, so any other answer would be incoherent); `pipe_structure.py` resolves `authored=None` like the other operators with no authored surface.
+
+**One pre-existing wrinkle fixed in passing**, in the `format` filter being edited anyway: its `text_format` argument was annotated `TextFormat | None`, but Jinja2 hands a template-supplied `{{ x | format("markdown") }}` over as a raw `str`. The annotation made two branches unreachable to the type checker while the reachable path raised a bare `ValueError` on an unknown format name. Now annotated `TextFormat | str | None`, normalising both through `TextFormat(...)` and reporting an unknown name as a `Jinja2ContextError` — which the renderer already wraps into a template render error.
+
+## Phase 3 — Deletions (pure by now)
+
+Everything below is uncalled after Phases 0-2; this phase is grep-verified removal. **One commit for the model-field + TOML pair** (silent-header hazard).
+
+- [x] `LLMSetting.prompting_target` (field, import, the `desc()` fragment) — `cogt/llm/llm_setting.py`. This also erases the independent keyless-plan symptom "an explicitly set `llm_setting.prompting_target` is ignored" — dissolved, not fixed.
+- [x] `InferenceModelSpec.prompting_target` + `InferenceModelSpecBlueprint.prompting_target` (+ the factory passthrough) — `cogt/model_backends/model_spec.py`, `model_spec_factory.py`.
+- [x] **Same commit:** every `prompting_target` line in `.pipelex/inference/backends/*.toml` — the `[defaults]` line in anthropic, azure_openai, bedrock, fal, google, minimax, mistral, ollama, openai, portkey, vertexai, xai, **plus portkey's per-model `gemini` overrides** — then `make ukc` to sync the kit copies, `make ccs` to prove it. Grep both trees afterwards: zero hits. — Done: 17 lines across 12 files, `make ccs` green, both trees grep clean.
+- [x] The `PromptingTarget` enum module — `cogt/model_backends/prompting_target.py` — and its imports.
+- [x] `derive_templating_style` (`kernel/llm_ops.py`) and its docstring. — Deleted in Phase 1, see the deviation note there.
+- [x] **The dead template module:** re-confirm `cogt/llm/llm_prompt_template.py` has no production consumer (inventory says: only two serde test files import it), then delete it together with its only base `llm_prompt_factory_abstract.py`; rework `tests/integration/pipelex/cogt/test_serde_llm_classes.py` and `test_data.py` to serde-test a living model (e.g. `LLMPrompt` itself) instead. The hardcoded xml+markdown style dies with it. — Done: `SerDeTestLLMCases` now serde-tests `LLMPrompt`, which genuinely crosses a process boundary, and its docstring says why that subject was chosen (the `user_images` items are `PromptImage` subclasses, so a round-trip losing the subclass would silently drop the image).
+- [x] **Investigate `llm_prompt_template_inputs.py`:** if its only production consumer was the dead module, delete it too along with `LLMPromptTemplateInputsError` — then remove its subject-grant entries, run `make gei` (error-identity snapshot) and `make gep` (error pages), and let `docs/errors/llm-prompt-template-inputs-error.md` go. If something live uses it, keep all of it and record why here. — Verdict: nothing live used it, so it went, along with `LLMPromptTemplateInputsError`, its two subject grants, its `docs/errors/` page and its `error_identity.txt` row (both regenerated, not hand-edited), and the error's case in `test_class_level_metadata.py`.
+- [x] Final sweeps: `prompting_target` greps clean outside `wip/`, `CHANGELOG.md` and the `.drift/acks` historical record; `PromptingTarget` zero; `prompting_style`/`prompting_config` survive only in the three Phase-4 doc targets (the styling page, `inference-backend-config.md`'s stale example, `add-model/SKILL.md`). Also removed the two now-pointless `del mock_model.prompting_target` lines in the reasoning tests: they guarded against reading a field that no longer exists.
+- [x] Gates: stage + `make agent-check`, **full `make agent-test`** — both green.
+
+**A blocker Phase 3 uncovered, and what was done about it.** Deleting `prompting_target` from `InferenceModelSpecBlueprint` made the *entire* test suite error at boot — 9671 errors, all one cause. The Pipelex Gateway backend does not read its model specs from this repo: they are fetched from the Pipelex API and cached at `~/.pipelex/cache/remote_config.json`, and that config's `defaults` block still declares `prompting_target = "anthropic"`. The blueprint is `extra="forbid"`, so a served config declaring a field this client no longer knows stops the boot dead.
+
+The fix is not a shim for this field. `drop_unknown_gateway_defaults` (`cogt/model_backends/gateway_config.py`) prunes keys the blueprint does not know from the **remote** config's `defaults` before the merge with local overrides, on the principle that a config served by a component deploying on its own schedule is legitimately written by a different release than the client reading it — version skew to tolerate, not a typo to reject. Local backend files stay strict. Tested in `tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py`.
+
+Two things this leaves for elsewhere, written up in [`gateway-config-still-declares-prompting-target.md`](gateway-config-still-declares-prompting-target.md): dropping the now-dead field from the config our hosted plane serves, and deciding whether the per-model unknown-key → HTTP-header rule should survive for the gateway backend (a removed field living per-model rather than in `defaults` would have been *sent to the provider as a header* instead of raising — a worse outcome than the one actually hit, and one no test would catch).
+
+### ✋ CHECKPOINT 2 — HARD STOP
+
+Do not start Phase 4 without Louis' explicit go. This is the point-of-no-return review of the behaviour flip. Present: full diff stats by phase, the green `agent-test` run, and a **before/after rendering of one real prompt** (e.g. from the flipped `test_prompt_image_extraction` case) showing back-ticks → XML. Louis reviews the actual prompt text change, rules on any surprises logged along the way, and decides the commit strategy for Phases 1-3. Update the checkpoint log. Natural fresh-session handoff.
+
+---
+
+## Phase 4 — Migration surfaces: schema, docs, changelog, drift
+
+Schema (mechanical half — cross-repo propagation is release-gated, see follow-ups):
+
+- [x] `make gms` then `make cms` — the diff is two-sided: `PipeLLMBlueprint` gains `templating_style`; `LLMSetting` loses `prompting_target` and the `PromptingTarget` definition disappears (`TemplatingStyle`/`TagStyle` were already published via `TemplateBlueprint`). — Regenerated, `make cms` green. **No tracked diff:** `derived/mthds_schema.json` is gitignored, so the schema change reaches consumers only through the release-gated downstream sync already listed in the follow-ups.
+
+Docs (the design's §8 — replace, don't patch, the dead-premise page):
+
+- [x] **New authoring page** (e.g. `docs/building-methods/templating-style.md`): the two-level model (pipe > config default), bare-string shorthand vs full table, the tag-style gallery incl. `no_tag`, the compose/img-gen story, xml as house default. Written for authors, not infra.
+- [x] **Delete** `docs/building-methods/adapt-to-llm-prompting-style-openai-anthropic-mistral.md`; update `mkdocs.yml`: both nav entries, the existing legacy redirect re-pointed to the new page, and a new redirect from the deleted path.
+- [x] `docs/features/llm-integration.md` — rewrite the "Prompting Styles" section (its "provider-specific formatting … automatically" claim is exactly what's deleted) + front-matter description; `docs/features/index.md` blurb.
+- [x] `docs/configuration/config-technical/inference-backend-config.md` — drop the (already-stale) prompting field from the model-spec example.
+- [x] `docs/under-the-hood/pipelex-kernel.md` — the flow prose ("derive a prompting style"), the kernel-surface table row, the per-call note; whatever Phase 1 already touched, finish here. — Nothing left to do: Phases 1-2 finished this page to keep their drift acks honest, and it now contains no `prompting` hit at all.
+- [x] `docs/building-methods/pipes/pipe-operators/PipeLLM.md` — new `templating_style` parameter row; inline model-table field list checked (it never documented `prompting_target`, so no deletion there).
+- [x] `docs/building-methods/pipes/pipe-operators/PipeCompose.md` — align wording with the one-name vocabulary; cross-link the new page.
+- [x] `.claude/skills/add-model/SKILL.md` — remove the `prompting_target` authoring step. **Pulled forward out of Phase 4 and done**, because it is an agent-executable instruction living in the repo: between Phase 3 and Phase 4 it told an author to write a key that now hard-fails the boot. Replaced with a line saying a model spec never declares prompt formatting, and that an unknown key becomes an outbound header.
+- [x] Verify `docs/CLAUDE.md`'s language-surface note still reads true now that PipeLLM carries the field too. — It does. The note's claim is scoped to its own example (`PipeComposeSpec.target_format` is a spec convenience; the language uses `category` + `templating_style` on `TemplateBlueprint`), and that remains exactly true. `templating_style` now living on `PipeLLMBlueprint` as well does not contradict it — both are blueprint-level, which is the point the note is making. Left unedited.
+- [x] Sweep for stragglers: `grep -ri "prompting" docs/` and judge each survivor. — Two survivors, both the ordinary English verb and both correct: `init-cli-flows.md` ("credential prompting", i.e. asking the user) and `tools/cli/update.md` ("without prompting on the unchanged files"). Left alone.
+
+Changelog:
+
+- [x] Insert `## [Unreleased]` at the top of `CHANGELOG.md` (the header was consumed by v0.44.0) with a breaking entry, condensed style. Draft: **"Breaking — templating style is now an authoring decision.** How a pipe's inputs are tagged into a prompt is declared on the pipe (`templating_style` on `PipeLLM`: bare tag-style string or full `{ tag_style, text_format }` table) with a single runtime default (`[pipelex.templating_config].default_templating_style`, `xml`). It is no longer derived from model metadata: `prompting_target` is gone from model specs, backend TOMLs and inline model tables, along with the per-target style map. Every prompt rendered for an OpenAI-family model changes shape from back-tick blocks to XML tags; img-gen, search and compose prompts follow the same default instead of a silent triple-backtick fallback." Plus a Changed entry: reasoning budgets are worker-owned, no longer read from `prompting_target`.
+
+Drift:
+
+- [x] `make drift-plan`; review and ack whatever remains open of `config-docs` / `pipelex-kernel-docs` with honest rationales; append the dogfood observation to `wip/drift-contracts/dogfood-log.md`. — **Nothing open:** Phases 1-3 acked both contracts, and Phase 4 touches only docs, which are review targets rather than triggers. No ack was invented to fill the box. Two dogfood entries appended, and the first is a genuine finding rather than a formality: `config-docs` reviews only `docs/configuration/**`, so the page that actually documented `[pipelex.prompting_config]` — filed under `docs/building-methods/` because it was written for authors — was invisible to the one contract whose description claims to cover config docs. It stayed stale for three phases behind an honest green ack.
+- [x] Gates: stage + `make agent-check`.
+
+## Phase 5 — Bookkeeping: KF-16 closes, keyless un-holds
+
+- [x] `wip/parity/README.md` — flip the Phase-2 "slated to become" sentence to closed; update the 2.2 gaps-table row.
+- [x] `wip/parity/SESSION-HANDOFF.md` and `wip/parity/parity-gaps-plan.md` — record KF-16 as closed by this change (name commits by subject, never SHA — this branch may rebase); the §2.2 deferral record's "do not fix by object-only derivation" trap is now moot and can say so.
+- [x] `wip/keyless/keyless-dry-prompts-fix-plan.md` — replace the hold banner: the headline symptom, Part 1, and most of Part 3 are dissolved by construction; re-scope the plan to the surviving residue (`max_prompt_images` unenforced, img-gen param rules skipped, handle-pinned bundles rejected keylessly, the two CLIs disagreeing on `--dry-run` credentials). Re-judging that residue is its own future task, not this one.
+- [x] `wip/keyless/keyless-boot-changes-dry-prompts.md` — a short closing note pointing at the dissolution.
+- [x] This design doc — status flips to built; this plan's checkpoint log completed.
+- [x] Final gates: stage everything, `make agent-check`, **full `make agent-test`** — both green. Also ran `make docs-check` (`mkdocs build --strict`), which the plan had not listed and which this phase needed: Phase 4 rewires `mkdocs.yml` nav and redirects, and a nav entry pointing at a deleted file fails only at build time. Clean.
+
+### ✋ CHECKPOINT 3 — FINAL HARD STOP
+
+Everything is green and documented; nothing is committed beyond what earlier checkpoints approved. Louis decides: commit/PR shape (one PR vs. Phase 0 split out), whether this branch keeps the `fix/Keyless-dry-run` name or is rebranded (the keyless fix it was cut for has been dissolved, not fixed), and release timing. Present the release-gated follow-ups below. Update the checkpoint log.
+
+## Out of scope here — release-gated / cross-repo follow-ups
+
+- **MTHDS schema downstream sync** (mthds, vscode-pipelex, mthds-ui committed copies) via the `mthds-schema-sync` skill — gated on a released `pipelex` version.
+- **MTHDS spec prose** — a pipe-level `templating_style` is a language-surface change owned by the `mthds/` repo; the schema regen is only the mechanical half. A deliverable of its own after release.
+- **`pipelex-api` CI** — its openapi check runs only under its own `make check` and has been bitten by pipelex bumps before; verify on the release bump whether the schema change surfaces there.
+- **Cookbook / starter sweeps** — no shipped `.mthds` uses any styling surface today, so no migration is expected; a post-release sanity pass confirms.
+- **Downstream backend-TOML sweep — a boot-breaker, and the one item on this list that is not optional.** Every repo that ships its own `.pipelex/inference/backends/*.toml` still declares `prompting_target`, and local backend files are read strictly: on the `pipelex` version bump each one dies at boot with `Extra forbidden fields: 'prompting_target'`. Tracked-file hits confirmed in `pipelex-api/`, `cocode/`, `pipelex-cookbook/`, `mthds-ui/`, plus our hosted worker, our demo repos, and two fixtures in our JS runtime (all private). **`portkey.toml` is the trap in every one of them**: the key appears once in `[defaults]` *and* again on several per-model entries, so a "fix" that deletes only the `[defaults]` line unblocks the boot while leaving the per-model ones — which the loader reclassifies as **outbound HTTP headers** sent to Portkey. Delete every occurrence, `[defaults]` and per-model alike, and grep to prove it.
+- **~~The served gateway config~~ — DONE (2026-08-14), and it changed the branch.** The config is owned by our back-office repo, not the hosted server (both private): its gateway-models TOML declared `prompting_target = "anthropic"` in its `[defaults]`, and its build service publishes that block as the remote config's `backend_model_specs` — that file is the reason `drop_unknown_gateway_defaults` exists. The key is deleted there (edit + `[Unreleased]` changelog, uncommitted in that repo) and **published**.
+
+ Publishing it was only safe because **the served config is versioned in its URL, and this branch bumps it**: `pipelex/system/pipelex_service/pipelex_details.py` now points at `pipelex_remote_config_12.json` (was `_11`) — an uncommitted change on this branch that must ship with it. `_11` is frozen and still carries the key, so earlier releases keep resolving `anthropic` → `xml`; had they read a key-less config they would have fallen through to `TagStyle.TICKS`, flipping every gateway prompt in the field to backtick fences. Verified live against both URLs. Retires the *occasion* for the tolerance, not the tolerance itself, which is general. See [`gateway-config-still-declares-prompting-target.md`](gateway-config-still-declares-prompting-target.md).
+
+ Two things this leaves open: **the URL bump needs a Phase 4 changelog line** (a released client fetching a different config URL is user-visible), and **our JS runtime (private repo) is a second consumer of this same wire contract** — it pins `_11` in its own worker catalogue and models the field as `promptingTarget` on its spec, so it is unaffected today but diverges the moment it moves to `_12`. That is beyond the backend-TOML fixture hits already listed above.
+- **PipeImgGen/PipeSearch authored styling** (D6) — only if a real need appears.
+
+## Checkpoint log
+
+*(Filled in as checkpoints are reached: status of completed phases, decisions taken, open questions, state of the code.)*
+
+- **Checkpoint 1:** *(2026-08-14)* Phase 0 complete. Reasoning-budget resolution is re-homed off `prompting_target`: each worker owns a `reasoning_budget_family` ClassVar (`"anthropic"` on the Anthropic worker, `"gemini"` on the Google worker) and `LLMConfig.get_reasoning_budget` is fully keyword-only with a `family` parameter (its subject grant removed from `subject_grants.toml`). TDD red→green: new twin Anthropic reasoning test module + updated Google/config tests landed red first, went green with the implementation; the tests `del mock_model.prompting_target` so any spec read would raise — this stays valid after Phase 3 deletes the field. `effort_to_budget_maps` TOML keys unchanged. Docs updated (`docs/under-the-hood/reasoning-controls.md`). Gates: `make agent-check` green (two drift contracts honestly reviewed and acked: config-docs, pipelex-kernel-docs); full `make agent-test` green. Verified exit criterion: `prompting_target`'s only remaining consumers are the style path (configs.py `get_prompting_style`, llm_setting.py, model_spec + factory, kernel/llm_ops.py derive path) — Phases 1–3 scope. State: committed standalone on `fix/Keyless-dry-run` (commit "Phase 0 — re-home reasoning budgets off prompting_target"). Open questions: none. Louis' go received 2026-08-14 → Phase 1 underway.
+- **Checkpoint 2:** *(2026-08-14)* **Reached. Phases 1-3 complete, `make agent-check` and the full `make agent-test` both green.** Awaiting Louis' go for Phase 4.
+
+ **Phase 1 landed (2026-08-14), committed, all gates green.** What it built: `TemplatingConfig` (single field `default_templating_style`, mounted `pipelex.templating_config`; `prompting_styles` and `get_prompting_style` deleted along with the latter's subject grant), the total resolver `pipelex/kernel/templating_style_ops.py`, the authored `templating_style` union on `PipeLLMBlueprint` / `PipeLLMSpec` / `PipeLLM` with the factory widening the bare-`TagStyle` arm, and both `PipelexKernel` façade calls taking the same optional argument (D4 — the `llm_object` parity-gap docstring paragraph is deleted, the question it adjudicated having dissolved). **The behaviour flip is live:** every OpenAI-family prompt now renders XML instead of back-ticks, because nothing derives a style from model metadata any more.
+
+ One deviation from the plan, recorded under Phase 1: `derive_templating_style` was deleted here rather than in Phase 3, because D1 deletes the config map that was its only data source — leaving it would not type-check. The rest of the Phase 3 deletion batch is untouched.
+
+ Tests added: `test_templating_style_ops.py` (totality, house default, authored-wins), `test_pipe_llm_templating_style.py` (both parsing shapes, spec passthrough, all three factory outcomes), and the `templating_style.mthds` bundle + `test_templating_style_bundle.py` proving the authored field survives parse→load→render. `test_prompt_image_extraction.py`'s two default-shape assertions now supply the resolved style and assert XML; note the `with_images | tag` case asserts `<data>`, not `<pages>` — after `with_images` the value is a plain string with no name of its own.
+
+ Docs touched in-phase (to keep the drift acks honest): `docs/under-the-hood/pipelex-kernel.md` — entry-point table lists `templating_style_ops` and drops `derive_templating_style`, and the flow prose plus the per-call-derivation note use the templating vocabulary. Both `config-docs` and `pipelex-kernel-docs` were reviewed and acked.
+
+ Known and deliberate: the Claude Code `check-mthds` hook rejects `templating_style` in a `.mthds` file because it validates against the plugin's bundled schema, which is stale. `make plxt-lint` regenerates `derived/mthds_schema.json` first and passes. The downstream schema sync is already listed as a release-gated follow-up.
+ **Phase 2 landed (2026-08-14), committed, all gates green.** Every prompt-rendering entry point now takes a **required** `TemplatingStyle`, and the three styling filters lost their silent fallbacks — a missing `TAG_STYLE` or `TEXT_FORMAT` raises `Jinja2ContextError` instead of quietly choosing triple-backticks or plain text. Img-gen, search and compose resolve through the same resolver the LLM path uses. Two render sites the plan had not anticipated needed the same treatment, both found by asking "which filter-bearing category still renders style-less": construct-mode template fields (user-authored `.mthds` content, so this one was user-facing) and the two generic prompt templates (the structure prompt and the structuring prompt, both config-editable). Details under the Phase 2 heading.
+
+ **Phase 3 landed (2026-08-14), committed, all gates green.** `prompting_target` is gone from `LLMSetting`, `InferenceModelSpec`, `InferenceModelSpecBlueprint`, the factory passthrough, and every backend TOML in both trees — the field deletion and the TOML deletions in one commit, as the silent-header hazard requires. The `PromptingTarget` enum module is deleted. The dead `llm_prompt_template.py` / `llm_prompt_factory_abstract.py` / `llm_prompt_template_inputs.py` trio went with it, along with `LLMPromptTemplateInputsError` and its generated error page and identity row; the serde tests they anchored now exercise `LLMPrompt`.
+
+ **The one surprise, and it was a big one:** the deletion broke the boot against the *remote* gateway config, which still declares `prompting_target`. Whole suite red, one cause. Resolved with a general remote-config tolerance rather than a field-specific shim; a back-office follow-up and an open design question are written up in [`gateway-config-still-declares-prompting-target.md`](gateway-config-still-declares-prompting-target.md). **This is the item most worth Louis' ruling.**
+
+ **Before / after, one real prompt.** Same template (`Summarize the article below.\n\n@article\n\nKeep it to one sentence.`), same input, rendered under the old OpenAI-family style and under the new default:
+
+ ```text
+ BEFORE (prompting_target "openai" -> ticks) AFTER (no authored style -> config default)
+ Summarize the article below. Summarize the article below.
+
+ article: ``` <article>
+ Bees pollinate a third of the food we eat. Bees pollinate a third of the food we eat.
+ ``` </article>
+
+ Keep it to one sentence. Keep it to one sentence.
+ ```
+
+ The resolved default is `xml/plain`. Note the tag *name*: `@article` carries the variable name into the tag, so XML reads better than the old `article: ```' prefix-plus-fence shape.
+
+ **Open for Louis at this checkpoint:** (a) the gateway-config finding above and its two follow-ups; (b) the commit strategy — Phases 0-3 are four separate commits on `fix/Keyless-dry-run`, so squashing to any shape is still trivial; (c) whether Phase 4's changelog entry should call out the compose and img-gen flips separately from the LLM one (they change prompt text for anyone whose template uses `| tag`, not just OpenAI-family users).
+
+- **Checkpoint 3:** *(2026-08-14)* **Reached. Phases 4 and 5 complete; `make agent-check`, the full `make agent-test`, and `mkdocs build --strict` all green.** Phases 4-5 are **staged but uncommitted**, per this checkpoint's own terms — the commit/PR shape is Louis' call.
+
+ **Phase 4 — migration surfaces.** Schema regenerated (`make gms`/`make cms` green); it produces no tracked diff because `derived/mthds_schema.json` is gitignored, so the schema reaches consumers only via the release-gated downstream sync. Docs: the dead-premise page `adapt-to-llm-prompting-style-openai-anthropic-mistral.md` is **deleted** and replaced by a new authoring page, [`docs/building-methods/templating-style.md`](../../docs/building-methods/templating-style.md) — the two-level model, bare-string vs full-table, the four-style gallery with rendered output for each, what the two sigils (`@` tag / `$` format) each govern, and the compose/img-gen story. `mkdocs.yml` updated in three places (both nav entries, the legacy redirect re-aimed) plus a **new** redirect from the deleted path — that fourth entry is load-bearing: `docs/404.html`'s prefix rule rewrites the legacy URL to the now-deleted `building-methods/adapt-…` path, so without it the JS-rewrite fallback would land on a 404. `llm-integration.md` (section + front-matter), `features/index.md`, `inference-backend-config.md`, `PipeLLM.md` (new parameter row), `PipeCompose.md` (wording + cross-link) all updated. Changelog `## [Unreleased]` written with the breaking entry.
+
+ **Two things worth Louis' eye in Phase 4.** (1) I **did not use content tabs** for the style gallery — `pymdownx.tabbed` is not enabled in `mkdocs.yml`, so `=== "xml"` would have rendered as literal text; it is plain subsections instead, which also avoids a nested-fence break in the `ticks` example (that one needs a 4-backtick fence). (2) Open question (c) from Checkpoint 2 — whether to call out the compose/img-gen flips separately — I **resolved as yes**, as its own changelog entry, because it changes prompt text for a different audience (anyone whose template uses `| tag`, on any model family) than the LLM-path flip (everyone on OpenAI-family models). Easy to merge back into one entry if Louis prefers.
+
+ **The drift box, and the one real finding in this phase.** `make drift-plan` reported **nothing open** — Phases 1-3 acked both contracts, and Phase 4 touches only docs, which are review *targets*, not triggers. No ack was invented to fill the box. But the dogfood review surfaced something worth reading: **`config-docs` reviews only `docs/configuration/**`, and the page that actually documented `[pipelex.prompting_config]` — field list, TOML sample, accessor signature — lived under `docs/building-methods/` because it was written for authors.** So in Phase 1 the trigger fired, the review target was read in full, the target was genuinely clean, the ack was honest — and the stale page sailed through three phases behind a confident green, to be deleted here by a plan step rather than by the contract. Every step of the mechanism worked and it still missed. Logged in `wip/drift-contracts/dogfood-log.md` with the narrow remedy (a derived grep check for `[pipelex.` blocks documented outside `docs/configuration/`) rather than the tempting one (widening the review target to `docs/**`, which this log has twice warned makes acks perfunctory). **Not acted on** — recorded per the pilot's bias.
+
+ **Phase 5 — bookkeeping.** KF-16 is recorded **closed by dissolution** in all three parity docs, with the #1081 docstring's trap note explicitly marked moot (there is no object-only resolution left to derive a style from, so the warning has no referent — preserved as history, flagged not-guidance). The keyless brief is closed with a banner explaining that the bug is unreachable in principle now, since both the derivation *and* the silent `TICKS` fallback are gone. The keyless fix plan is re-scoped in place rather than rewritten: Part 1 is folded into a `<details>` block as dissolved, and struck premises are kept as the record of what was measured.
+
+ **The re-scope produced a judgement Louis should overrule if he disagrees.** I flagged in that plan that **the surviving residue may no longer be worth Part 2's blast radius**, and said so at the top rather than quietly proceeding. The reasoning: the symptom that justified "faithful over cheap" was a dry run *silently* validating a prompt that would never be sent. Every survivor is either loud (handle-pinned bundles rejected), a skipped constraint check (`max_prompt_images`, img-gen params), or a CLI inconsistency. Item 5 in particular loses its force — it was framed as "the loud converse of item 1", and with item 1 gone a loud refusal is a much weaker case for the `BackendLoadMode` surgery than a silent rewrite was. My recommendation is to decide **Part 2 and Part 4 separately**: Part 4 (`pipelex run --dry-run` should stop demanding credentials) is cheap and clearly right on its own. I also flagged a live trap for whoever builds it: the prompt-parity end-to-end test is now **green before any production edit**, so using it as the mutation-check target would produce a false green across the whole gate.
+
+ **Open for Louis:** (a) commit/PR shape for Phases 0-5 — six commits' worth on `fix/Keyless-dry-run`, still trivially squashable; (b) whether the branch keeps its name, since the keyless bug it was cut for was dissolved rather than fixed; (c) the Checkpoint-2 gateway-config finding and its two follow-ups, still unruled; (d) the changelog's separate compose/img-gen entry (my call, easily merged); (e) the Part 2 re-judging above. **The downstream backend-TOML sweep is the one non-optional follow-up** — every repo shipping its own `.pipelex/inference/backends/*.toml` dies at boot on the version bump, and `portkey.toml`'s per-model occurrences become outbound HTTP headers if only the `[defaults]` line is deleted.
diff --git a/wip/rogue-extra-headers-guard-plan.md b/wip/rogue-extra-headers-guard-plan.md
new file mode 100644
index 000000000..f5fb0a90a
--- /dev/null
+++ b/wip/rogue-extra-headers-guard-plan.md
@@ -0,0 +1,152 @@
+# Guarding against rogue outbound headers — implementation plan
+
+**Written 2026-08-14, to be executed after the templating-style branch merges.** This answers item 2 of [`prompting-style/gateway-config-still-declares-prompting-target.md`](prompting-style/gateway-config-still-declares-prompting-target.md) — "decide whether the per-model unknown-key → HTTP-header rule should survive" — which that document deliberately left open because it is a design question about the backend loader, not part of the templating change.
+
+Progress is tracked with the checkboxes below. **The checkpoint marked ✋ is a hard stop: the executing agent must not proceed past it without Louis' explicit go.** At the checkpoint, update this doc first — tick boxes, fill the checkpoint log at the bottom — so the work can hand off into a fresh session with nothing lost.
+
+## The behaviour today
+
+`InferenceBackendLibrary.load` (`pipelex/cogt/model_backends/backend_library.py:195-199`) loops over each per-model TOML table and moves every key that is not a field of `InferenceModelSpecBlueprint` into `extra_headers`:
+
+```python
+extra_headers: dict[str, str] = {}
+for model_spec_key in model_spec_dict:
+ if model_spec_key not in model_spec_blueprint_standard_fields:
+ extra_headers[model_spec_key] = model_spec_blueprint_dict.pop(model_spec_key)
+```
+
+That dict lands on `InferenceModelSpec.extra_headers` (`model_spec.py:34`) and every provider factory forwards it to the wire as request headers — `gateway_factory.py:99`, `portkey_factory.py:47`, `openai_completions_factory.py:118`, `openai_responses_factory.py:113`, `openrouter_completions_factory.py:24`, `blackboxai_completions_factory.py:29`.
+
+So the rule is: **anything the blueprint does not recognise is assumed to be a header the author meant to send, and is sent, silently.** There is no allowlist, no shape check, and no log line.
+
+Note the asymmetry with the `[defaults]` block of the same file, which is validated strictly and raises on an unknown key — except for the remote gateway payload, where `drop_unknown_gateway_defaults` (`gateway_config.py:16`) prunes it as version skew. Same input, three different fates depending on where it sits and where it came from.
+
+## What is actually in the bag (measured 2026-08-14)
+
+Re-measure before starting; the served config moves independently of this repo.
+
+```bash
+# local backend TOMLs: per-model keys the blueprint does not know
+python3 -c "
+import tomllib, pathlib
+KNOWN = {'enabled','sdk','variant','model_type','model_id','inputs','outputs','costs','structure_method','thinking_mode','max_tokens','max_prompt_images','listed_constraints','valued_constraints','rules'}
+for p in sorted(pathlib.Path('.pipelex/inference/backends').glob('*.toml')):
+ data = tomllib.loads(p.read_text())
+ extras = {k for name, spec in data.items() if name != 'defaults' and isinstance(spec, dict) for k in spec if k not in KNOWN}
+ if extras: print(p.name, sorted(extras))
+"
+# the served gateway payload (URL pinned in pipelex/system/pipelex_service/pipelex_details.py)
+curl -s https://pipelex-config.s3.eu-west-3.amazonaws.com/pipelex_remote_config_12.json | python3 -m json.tool | head -40
+```
+
+What that turned up:
+
+| Source | Key | Genuinely a header? |
+|---|---|---|
+| `.pipelex/inference/backends/portkey.toml`, per-model | `x-portkey-provider` | yes — read by Portkey |
+| served gateway config, on every model | `x-portkey-config` | yes — also read back locally by `GatewayDeck.get_config_id` (`gateway_deck.py:9`) |
+| served gateway config, on the image models | `endpoint_path` | **no** — internal routing, read back by `gateway_img_gen_worker.py:86` |
+
+No other local backend TOML uses the mechanism at all, and the served `[defaults]` block is clean.
+
+Two things follow. First, the mechanism is load-bearing and cannot simply be closed: the gateway would lose its per-model Portkey config id. Second, **the bag is already not what its name says** — `endpoint_path` is our own routing metadata, and it escapes the wire only by luck, because the image worker builds its headers explicitly instead of forwarding the bag. Put the same key on a model served by the LLM path and `GatewayFactory.make_extras` ships `endpoint_path: openai/deployments/…` to Portkey as a header.
+
+## Why this is worth fixing
+
+- **A deleted or renamed blueprint field becomes a header.** This is the hazard the templating-style plan flagged and then dodged by luck: `prompting_target` happened to live in `[defaults]`, so its removal was fatal and loud. Had it lived per-model — and in `portkey.toml` it *does* also live per-model — the same removal would have started sending `prompting_target: gemini` to the provider. No test in the suite would have gone red.
+- **A typo becomes a header.** `max_tokns = 4096` on a model posts a junk header *and* silently leaves the real cap unset. That is exactly the class of silent misconfiguration `InferenceBackendLibrary.load`'s own docstring says it refuses to tolerate ("a config typo must never silently delete a backend, because the commands that boot leniently would then report the far more confusing 'model not found'").
+- **We send unreviewed strings to third parties.** Whatever is in a model table goes out over the network to the provider. That deserves a deliberate opt-in, not a default.
+- **The rule is undocumented.** `grep -rn "header" docs/` returns nothing about it. Nobody outside this file knows it exists, which means nobody outside this file can use it on purpose either.
+
+## The rule to build
+
+**An unknown per-model key is accepted as a header only if it is shaped like a header name.** Concretely: it contains a hyphen. HTTP header names conventionally do (`x-portkey-config`, `anthropic-beta`, `api-version`); blueprint field names never do, because they are Python identifiers. Every real key in the table above passes except `endpoint_path`, which is not a header and is promoted to a declared field in Phase 1.
+
+A shape rule, not an allowlist of names: the whole point of the open bag is that the back office can start serving a new `x-portkey-*` header without waiting for a client release, and a name allowlist would take that away.
+
+Everything unknown that is *not* header-shaped is then handled by source:
+
+- **From a local backend TOML — fatal.** There, an unknown snake_case key really is the author's typo, and local files are already strict about `[defaults]`.
+- **From the served gateway payload — pruned, silently.** There, it is version skew: a client legitimately reads a config written by a different release. This is the identical judgement `drop_unknown_gateway_defaults` already makes for the `defaults` block, for the identical reason, and the silence is required for the identical reason too — the prune runs before `runtime_hub.set_config()` on some boot paths, so a `log` call turns a data transform into a boot-order dependency (`test_pruning_does_not_need_the_log_hub` pins this).
+
+**That skew tolerance is not theoretical, and the executing agent should verify it still holds before assuming otherwise.** Observed on 2026-08-14: a local `~/.pipelex/cache/remote_config.json` held the `_11` payload byte-for-byte while this branch pinned `_12`. The cache path is shared across every checkout on a machine, and the cache records `schema_version` / `cached_at` / `raw_config` but **no source URL** — so a `_12` client cannot tell it is reading an `_11` body, and whichever version most checkouts pin is the one that populates it. Making remote unknowns fatal would have turned that ordinary local condition into a red suite.
+
+## Decisions (veto here, cheaply)
+
+- **D1 — the classifier is pure, the policy lives at the call site.** A new `pipelex/cogt/model_backends/model_spec_keys.py` splits a raw model table into (blueprint fields, headers, rejected). It does not decide what "rejected" means. `InferenceBackendLibrary.load` decides, because only it knows the source. Functions are fully keyword-only so no subject grant is needed.
+- **D2 — the source is an enum, not a bool.** `ModelSpecSource.LOCAL_FILE | REMOTE_GATEWAY`, matched with `match`/`case` per the repo's enum convention. `InferenceBackendLibrary.load` already distinguishes the two branches (`PipelexBackend.is_gateway_backend`), so this threads one value, not new logic.
+- **D3 — near-miss protection.** A key whose hyphens-to-underscores form matches a known blueprint field (`max-tokens`, `model-id`, `thinking-mode`) is rejected despite being header-shaped. Three lines, and it closes the one hole the shape rule leaves. **Separable — drop this if you think it is a solution in search of a problem.**
+- **D4 — `endpoint_path` becomes a real field**, not a permanent exception to the rule. It is our own data, read by our own worker; it has no business in a bag named for headers.
+- **D5 — no change to the backend-level twin** (`backend_library.py:154-156`, unknown backend keys → `extra_config`) in this change. Same silent-reclassification shape, but that dict never reaches a provider, so the blast radius is a local misconfiguration rather than an outbound one. See "Considered and deferred".
+- **D6 — the error names the key and the file, and says what to do.** A boot failure reading `Unknown key 'max_tokns' on model 'gpt-4o' in '.pipelex/inference/backends/openai.toml' — not a known model-spec field, and not header-shaped (a header key must contain a hyphen, e.g. 'x-portkey-provider')` is the whole value of this change for a user. A bare pydantic `extra_forbidden` is not.
+
+## Phase map
+
+- **Phase 1** — promote `endpoint_path` to a declared field. Standalone, no behaviour change, shippable on its own.
+- **Phase 2** — the shape guard and its two policies (TDD). This is where a config that used to boot can start failing. → ✋ **Checkpoint**
+- **Phase 3** — docs, changelog, dogfood log.
+
+**Phase 1 must precede Phase 2, and they must ship in the same release.** If the guard lands first, `endpoint_path` — snake_case, no hyphen — gets pruned out of the remote payload and every image model breaks with "does not have an endpoint_path configured".
+
+## Traps to keep in view
+
+- **Do not write the regression test against `prompting_target`.** It no longer exists in the blueprint, so a test using it would prove nothing about the mechanism. Construct the dead-field case with a synthetic key.
+- **Config sync is one-directional.** `.pipelex/inference/backends/` is the source of truth; edit there, then `make ukc`, gated by `make ccs`. Both trees carry the portkey headers.
+- **The gateway's *local* override file is already safe** — `GatewayConfigMerger` restricts local overrides to `{sdk, structure_method}` (`gateway_config_merger.py:10`) and warns on anything else, so a user's `pipelex_gateway.toml` cannot inject headers today and will not be affected by this change. The exposure is the direct-provider local TOMLs and the served payload. Do not "fix" the merger; verify and move on.
+- **No drift contract fires.** `backend_library.py` and `model_spec_factory.py` are in no contract's trigger set (`config-docs` triggers `system/configuration/**`, `cogt/config_cogt.py`, and friends). Do not hunt for an ack to record — but do log the observation, see Phase 3.
+- **`make agent-check` runs the keyword-only auto-fixer**, which will silently keyword-only an ungranted subject. D1's functions are keyword-only by design, so there is nothing to grant here — just do not let the fixer surprise you elsewhere.
+- **Drift reads the git index**: stage before `make drift-check` / `agent-check`.
+
+---
+
+## Phase 1 — `endpoint_path` becomes a declared field
+
+Goal: the one non-header key in the bag stops pretending to be a header. No behaviour change, no served-config change, no config URL bump — the served TOML is untouched, the new client merely classifies the key differently, and older clients keep reading it out of `extra_headers` exactly as before.
+
+- [ ] `InferenceModelSpecBlueprint.endpoint_path: str | None = None` (`model_spec_factory.py`) and the matching field on `InferenceModelSpec` (`model_spec.py`), with the factory passthrough.
+- [ ] `gateway_img_gen_worker.py:86` reads `self.inference_model.endpoint_path` instead of digging in `extra_headers`. Its existing "does not have an endpoint_path configured" error stays — it is the right error, it just now guards a real field.
+- [ ] Update the image-worker tests that stub the bag: `test_gateway_img_gen_worker_semantic.py`, `test_gateway_img_gen_worker_malformed_body.py`, `test_gateway_img_gen_worker_edit_routing.py`, `test_gateway_quota_detection.py`. Each sets `mock_model.extra_headers = {"endpoint_path": …}`; they should set the field and leave the bag to the headers that belong in it.
+- [ ] Verify against the live payload that the key still parses into the field and that `x-portkey-config` still lands in `extra_headers` — a real boot, not only mocks.
+- [ ] Gates: targeted tests, `make tb`, stage + `make agent-check`.
+
+## Phase 2 — the shape guard
+
+Goal: an unknown per-model key is either a plausible header or a loud error, and never a silent outbound string. TDD throughout — each box's test lands red first.
+
+- [ ] **Tests first (red):** new `tests/unit/pipelex/cogt/model_backends/test_model_spec_key_policy.py` — header-shaped key accepted; snake_case unknown rejected; D3 near-miss (`max-tokens`) rejected; known blueprint field never diverted.
+- [ ] New `pipelex/cogt/model_backends/model_spec_keys.py` (D1): the pure classifier plus `ModelSpecSource` (D2).
+- [ ] Wire it into `InferenceBackendLibrary.load` (`backend_library.py:195-199`), replacing the unconditional loop. Local source raises `InferenceBackendLibraryError` with D6's message; gateway source prunes.
+- [ ] **Tests (red first):** a local backend TOML carrying a synthetic unknown snake_case key fails the load with a message naming the key, the model and the file; the same key in a remote payload is pruned and the boot survives. Extend `test_gateway_unknown_defaults.py` rather than starting a parallel module — it already owns the remote-tolerance story, including the no-log-hub constraint.
+- [ ] **Regression, and the point of the whole change:** `x-portkey-provider` from local `portkey.toml` and `x-portkey-config` from the remote payload still reach `extra_headers` and still reach the wire.
+- [ ] **Leniency interaction:** confirm what a rejected key does under `lenient=True`. A typo must not silently delete a backend — that is the existing ruling in `InferenceBackendLibrary.load`'s docstring, and this new raise sits inside the same `try`. Decide deliberately and record the answer here; if it needs to escape the lenient skip, say why in a comment at the raise site.
+- [ ] **Mutation-check the new tests:** revert the guard, confirm the new tests go red, restore. A guard whose tests pass without it is not a guard.
+- [ ] Gates: `make tb`, targeted tests, stage + `make agent-check`, **full `make agent-test`**.
+
+### ✋ CHECKPOINT — HARD STOP
+
+Do not start Phase 3 without Louis' explicit go. This is where a config that booted yesterday can fail today. Present: the diff, the test results, the answer to the leniency question, and a **worked example of the new error message** as a user would see it. Louis rules on D3 (near-miss), on the leniency behaviour, and on the commit/PR shape. Update the checkpoint log.
+
+---
+
+## Phase 3 — Docs, changelog, dogfood
+
+- [ ] `docs/configuration/config-technical/inference-backend-config.md` — document the mechanism for the first time: extra per-model keys are sent to the provider as request headers, they must be header-shaped, anything else is a configuration error, and `endpoint_path` is a declared field. Include what a rejected key looks like.
+- [ ] Changelog `## [Unreleased]`, condensed style, **breaking**: a per-model key that is neither a known model-spec field nor header-shaped now fails the backend load instead of being sent to the provider as a request header; `endpoint_path` is a declared model-spec field.
+- [ ] Append a dogfood entry to `wip/drift-contracts/dogfood-log.md`. The observation worth recording: **`backend_library.py` shapes user-facing configuration and sits in no contract's trigger set** — the same shape of finding as the Phase 4 templating entry (a config surface documented outside `docs/configuration/`), from the other direction. Record it; per the pilot's bias, do not act on it here.
+- [ ] Gates: stage + `make agent-check`.
+
+## Cross-repo / release-gated follow-ups
+
+- **The downstream backend-TOML sweep gets louder, and that is the good news.** The templating-style plan already lists this as its one non-optional follow-up: every repo shipping `.pipelex/inference/backends/*.toml` still declares `prompting_target`, and `portkey.toml` carries it **per-model as well as in `[defaults]`**, so a fix that deletes only the `[defaults]` line unblocks the boot while quietly turning the per-model ones into outbound headers. With this guard in place that residue becomes a boot error naming the key instead. Confirmed tracked-file hits at the time of writing: `pipelex-api/`, `cocode/`, `pipelex-cookbook/`, `mthds-ui/`, plus our hosted worker, our demo repos, and fixtures in our JS runtime (all private). **Ship this guard in or after the release that deletes `prompting_target`, never before** — before, it would reject the key while the field still exists.
+- **Our back-office repo** (private) owns the served gateway config, in its gateway-models TOML. Nothing to change now: `endpoint_path` becomes a declared field on the client side and `x-portkey-config` is header-shaped. Worth telling whoever maintains it that a *new* non-header per-model key would from now on be pruned by new clients rather than forwarded as a header.
+- **Our JS runtime** (private repo) is a second consumer of the same wire contract and models these specs its own way, in its worker catalogue. Whether it wants a parallel rule is its own call, not this plan's.
+
+## Considered and deferred
+
+- **The backend-level twin** (`backend_library.py:154-156`): unknown *backend* keys are reclassified into `extra_config` with the same silence. Deferred because `extra_config` never reaches a provider — the failure is a local misconfiguration, not an outbound string. It is a small follow-up on its own, and the classifier built in Phase 2 would serve it directly.
+- **Renaming `extra_headers`.** Once `endpoint_path` moves out, the field genuinely holds only headers and the name is finally honest. Renaming it touches every provider factory for zero behaviour change; do it only if it rides along with something else in that area.
+- **Logging accepted headers at load time.** Tempting — "here is what we will send" — but the prune path runs before the log hub is configured, and the accepted path would need the same care. Not worth a boot-order dependency.
+
+## Checkpoint log
+
+*(Filled in as the checkpoint is reached: status, decisions taken, open questions, state of the code.)*