The operating principles

  1. Outcome-first: define the artifact (e.g., 120-word email, JSON with fixed fields, SQL query). If you can’t name it, don’t prompt yet.

  2. Spend where it matters: cheap models for classify/extract/condense; strong model only for final synthesis or tricky reasoning.

  3. Token discipline: cap input/output, ban rambling (“return final result only”), and compress context before you call the strong model.

  4. Schemas over examples: zero-shot + strict schema beats long few-shot for cost and stability.

  5. Draft → Verify → Escalate: one mid-tier draft, a tiny verifier, and escalate to the best model only on failure.

  6. Measure → prune: log tokens, dollars, pass rate, and escalation rate; remove low-value instructions monthly.

A lean, repeatable pipeline

1) Frame the task

Mini-spec

Goal: Produce a 120-word customer apology email.
Constraints: ≤120 words; warm; include order#, ETA, coupon; no excuses.
Budget: max_output_tokens=160
Checks: [length, tone, order#, ETA, coupon]

2) Route to the right model

3) Put hard caps in the prompt

4) Compress inputs before synthesis

Compressor

Condense to ≤90 tokens as bullets. Preserve facts, numbers, decisions; drop qualifiers.

5) Prefer schema to few-shot

Schema guard

Return JSON:
{ "title":"≤60 chars", "summary":"≤120 words", "actions":["...", "...", "..."] }
No other keys. No explanations.

6) Draft → Verify → Escalate (GSCP-lite)

7) Cache & reuse

8) Observe and optimize

Ready-to-use templates

A) System (cost guardrails)

You are a cost-aware assistant. Rules:
1) Follow the schema exactly; no extra keys or commentary.
2) Respect max_tokens and stop sequences.
3) If unsure, output "INSUFFICIENT_CONTEXT".
4) Keep answers as short as constraints allow.

B) Task (user)

Task: <one sentence>
Inputs: <compressed bullets only>
Format: <schema>
Constraints: length≤N; tone=<X>; banned=<list>
Budget: max_output_tokens=M
Return only the formatted result.

C) Verifier (small model)

Given draft JSON and rules [r1..r5], return:
{"pass": true|false, "failed": ["rX", ...]}
No prose.

D) Escalation (only if needed)

Draft failed rules: ["..."]. Produce a corrected final that satisfies all rules.
Use only provided inputs. No new facts. No explanations.

Three concrete patterns

1) Short email (best cost)

2) JSON extraction

3) SQL from natural language

Cost levers that actually work

Back-of-envelope

Cost ≈ input_tokens * $/1k_in + output_tokens * $/1k_out
Priority: reduce input tokens; then cap output.

Troubleshooting quick fixes

Pocket checklist

Use this pipeline and you’ll get consistent, high-quality outputs while paying only for the moments that truly demand top-tier reasoning.