Engineering reference
A Python Prompt Hook for Claude Workflows
A first-person account of prompt scattering, its operating-cost calculation, and the option of using a local model.
The services, methods, and examples described here do not establish an expected performance result for your workload.
This article describes the auto-scatter hook and how to compare its complete operating costs with the original workflow.
The Math
Here is how it works. I send my prompts through Claude Haiku first. Haiku is the small, cheap AI model. It reads my prompt and breaks it into 6 parts: PERSONA, CONTEXT, DATA, CONSTRAINTS, FORMAT, and TASK. It sends those parts back as JSON. That JSON goes in as extra context before the big, expensive model ever reads my original prompt.
Scatter-call cost: record the actual model, input and output tokens, and applicable API rates.
Clarification cost: record responses, retries, and input and output tokens for the same task.
Net cost comparison: include scatter overhead, main-model usage, and output checks for the same workload.
Record the workload, scatter API usage, main-model usage, output checks, and measurement window for a cost comparison.
Cost Components to Compare
The expensive model (Claude Sonnet or whatever you use) costs a lot per token. But the per-token price is not what hurts most. The real problem is the number of back-and-forth exchanges. When the model does not have enough context to answer in one shot, it asks a question. You answer. It asks another. You answer again. Each exchange adds output tokens. It also makes the input context bigger for every future exchange in that same conversation.
Compare responses per prompt and input/output token usage for the same workload before attributing a change to auto-scatter.
The scatter call supplies six-field context before the main model runs. Check whether the model still needs clarification and whether the response meets the task.
What the Scatter Actually Does
When I type something like "fix the payment webhook", the Haiku scatter reads it and figures out:
{
"formula": "x(t) = Σ x(nT) · sinc((t - nT) / T)",
"T": "specification-axis",
"fragments": [
{"n": 0, "t": "PERSONA", "x": "Senior backend engineer familiar with webhook architectures"},
{"n": 1, "t": "CONTEXT", "x": "Working in a FastAPI codebase with Stripe webhook endpoints"},
{"n": 2, "t": "DATA", "x": "Webhook validation, event parsing, idempotency patterns"},
{"n": 3, "t": "CONSTRAINTS", "x": "Minimal change footprint. No schema changes. Must pass existing tests."},
{"n": 4, "t": "FORMAT", "x": "Code diff with brief inline comments"},
{"n": 5, "t": "TASK", "x": "Identify and fix the root cause of the payment webhook failure"}
]
}
The main model receives the original prompt and the structured breakdown as context. Review the role, situation, rules, and output requirements, then check the response and any follow-up exchanges.
The Local Model Option
The article describes a local Qwen2.5-7B model trained on scatter examples, GGUF export, and inference on an RTX 5090.
Local scattering uses a model on your own GPU. Compare the complete operating costs and output checks with the API-based option.
Haiku scatter and the local model are open-source options. Leave a comment for links. Compare their complete costs and outputs for your task.
// Production AI Engineering
Build AI systems that hold up in production.
sinc-LLM designs, audits, and stabilises production AI infrastructure: from vendor evaluation and cost accountability to incident controls and MCP architecture.
See what we do →Additional context
sinc-LLM About Blog Services
DOI: 10.5281/zenodo.19152668 · © 2026 sinc-LLM · Mario Alexandre
sinc-LLM

