Mahal Systems

Overview › 3Prompts

Prompts

7 optimizations in 3 sub-categories.

a.Structuring

Clarify structure and intent

  1. i.

    Add worked examples to the prompt (few-shot), or curated example queries for data agents

    Put a few solved examples of the task in the prompt (the input and the exact output wanted), or give a data agent commented example queries for its custom metrics and an index of past queries it retrieves per question.

    Mixed qualityHigher costSlower

    Tier 3 · tuning · changes prompt · any agent · 7 sources, 6 measured

  2. ii.

    Avoid few-shot ruts

    An agent's own history, and any examples in its prompt, act as few-shot demonstrations: when the context fills with near-identical action-observation pairs (twenty similar items in a row, a retried call), the model tends to copy their surface form instead of judging the current item.

    Mixed qualityMixed cost

    Tier 3 · tuning · changes prompt · any agent · 13 sources, 8 measured

  3. iii.

    Dynamic context injection

    Put the runtime facts the model cannot know into its context each run: today's date and timezone, the working directory, OS and git state, the tools available, the user and locale.

    Better for brandMixed quality

    Tier 3 · tuning · changes prompt, context · any agent · 9 sources, 4 measured

  4. iv.

    Restructure the system prompt: every requirement once, up front, in named sections; nothing the model doesn't need

    Rewrite the system prompt so that each requirement the task has (constraints, the answer format, the completion check, how to work efficiently, the domain procedure) is stated once, up front, in a named section, and remove instructions the model does not need.

    Lower costFasterMixed quality

    Tier 3 · tuning · changes prompt · any agent · 11 sources, 2 measured

See also

  1. 9.b.i

    Make the final answer reliably extractable: state the format, extract robustly, force an answer at the limit

    State the required answer format in the prompt, and make the harness extract it robustly: strip markers, normalize numbers, detect refusals, and force a best-effort answer when the loop ends on a budget rather than returning nothing.

    Verification › Confirming completion

    Better quality

    Tier 2 · reliability · changes control flow, prompt · structured output agents · 4 sources

b.Caching

Design for caching and reuse

  1. i.

    Keep the prompt prefix cache-stable

    Put static content (identity, rules, tool definitions) before a boundary and per-turn content (date, state, memory) after it; keep the prefix bit-for-bit identical across turns; strip thinking text from persisted history; and track per-turn cache-miss cost.

    Lower costFaster

    Tier 1 · hygiene · changes context · any agent · 8 sources, 1 measured

  2. ii.

    Mask tools instead of removing them

    When the tools an agent may use change mid-task (by mode, phase or permission), declare every tool once, keep the definitions byte-stable, and restrict the choice another way: OpenAI's allowed_tools or tool_choice "none", Anthropic's appended tool_removal and tool_addition blocks, a decode-time logit mask or grammar on self-hosted models, and a harness check that rejects calls outside the allowed set.

    Lower costFasterMore secureBetter governanceMixed quality

    Tier 3 · tuning · changes context, tool surface · any agent · 11 sources, 5 measured

c.Sizing reasoning effort

Match reasoning effort to the task

  1. i.

    Self-Discover reasoning structures

    Self-Discover has the model compose a reasoning structure once per task type (select useful modules from 39 seed heuristics, adapt them to the task, write them as a step-by-step plan), then follow that cached structure on every instance, so each instance costs one call.

    Mixed qualityHigher costSlower

    Tier 3 · tuning · changes model, prompt · reasoning agents · 11 sources, 9 measured

See also

  1. 1.b.i

    Match the model and its effort to each call site and query class

    Pick the model per role or call site rather than one model everywhere, and set its reasoning effort and sampling parameters per site; tune each role's prompt to its model (GEPA raised every model tested at lower cost).

    Models › Finding specialists

    Better qualityLower cost

    Tier 3 · tuning · changes model, prompt · any agent · 19 sources, 6 measured

Before you go...

Build better agents, weekly

Our latest research, performance benchmarks, optimization strategies, and updates around AOT development.

One email a week, nothing else. Unsubscribe anytime.