← Table of Contents · Page 207 of 868

CONTEXT CONSTRUCTION (THE CONTEXT BUILDER)

Part 3 of 12

PROMPT COMPOSITION Prompt composition means assembling the system prompt from modular pieces instead of writing it as one giant hand-typed block. The system prompt is the standing set of instructions placed at the start of the context that tells the model who it is and how it must behave. Why compose it from pieces? Imagine you write a long instruction document by hand. Over time you need to change one rule. You open the big document, hunt for the rule, edit it, and accidentally break something nearby. Now imagine instead that the document is made of labeled sections stored separately: one for the agent's identity, one for safety rules, one for formatting preferences, one for the current project, and one for today's date. When you need to change a rule, you edit exactly one small piece. When you need a different agent, you swap a few pieces and reuse the rest. This is like building with toy bricks instead of carving a single block of wood. Modular blocks bring several benefits. First, they are easier to read and review, because each block has one purpose. Second, they are easier to test, because you can check each block by itself. Third, they are easier to keep fresh, because dynamic blocks such as today's date or the current task can be generated automatically at the start of every run. Fourth, they are easier to reuse across different agents. Common blocks include the following. The identity block says who the agent is, for example "You are a careful resume reviewer who only states facts found in the resume." The standing rules block lists the rules that always apply, such as "Never invent a skill." The project conventions block carries the rules for the current job, often loaded from a file written by the team. The date and environment block states the current date and relevant facts about the setting, which the model could not know otherwise. The task block states the current goal. The retrieved context block holds reference material fetched for this step. The format block explains how the answer should be structured. The builder joins these blocks in a chosen order, separated by clear labels, for example by placing a short heading line before each block. Clear labels help the model tell the blocks apart, and they help humans debug. When something goes wrong, an engineer can print the final assembled prompt and see exactly which block contributed what.
Advertisement
Read Aloud:
0:00 / 0:00