{"id":571,"date":"2025-08-05T08:10:30","date_gmt":"2025-08-05T07:10:30","guid":{"rendered":"https:\/\/anapoly.co.uk\/labs\/?page_id=571"},"modified":"2025-08-05T08:38:50","modified_gmt":"2025-08-05T07:38:50","slug":"contract-first-prompting","status":"publish","type":"page","link":"https:\/\/anapoly.co.uk\/labs\/contract-first-prompting\/","title":{"rendered":"Contract-First Prompting"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Contract-First Prompting<\/h1>\n\n\n\n<p>Transcript of a chat with Perplexity AI on 4 August 2025. Scope:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is contract-first prompting?<\/li>\n\n\n\n<li>How can we achieve compliance with the contract?<\/li>\n\n\n\n<li>Glossary<\/li>\n\n\n\n<li>What does the Prompt Contract comprise?<\/li>\n<\/ul>\n\n\n\n<p>The AI cited a range of sources which are not listed here.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"is-style-default\"><strong><em>Alec<\/em><\/strong><\/p>\n\n\n\n<p>I\u2019m reading about contract-first prompting. Is this a well known idea?<\/p>\n\n\n\n<p><strong><em>Perplexity<\/em><\/strong><\/p>\n\n\n\n<p>Contract-first prompting is an emerging approach in the field of prompt engineering for large language models (LLMs), but it is not yet a broadly established or widely recognized term in the AI community. The concept centers on treating the prompt as a contract: before the LLM begins generating output, both the human and the model arrive at a clear, mutual understanding of the task, success criteria, requirements, and constraints\u2014essentially simulating the way engineers or teams agree on specifications before work begins.<\/p>\n\n\n\n<p>The main advocate for this method, as of August 2025, appears to be Nate B. Jones, who describes contract-first prompting as a way to overcome mismatches in intent that often lead to prompt failures. His process involves explicitly communicating the mission, listing out unknowns, having the LLM ask clarifying questions until it is highly confident it understands, and then \u201clocking\u201d the agreement before any generative work starts. This ensures a precision in the model&#8217;s output that typical, single-shot instructions often lack<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p>Key features of contract-first prompting include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Explicit Agreement:<\/strong>&nbsp;Agreed-upon goals, constraints, and deliverables set before generation begins.<\/li>\n\n\n\n<li><strong>Clarification Loop:<\/strong>&nbsp;The LLM systematically asks questions about any gaps or ambiguities until it reaches a high confidence threshold (often cited as 95%).<\/li>\n\n\n\n<li><strong>Echo Check:<\/strong>&nbsp;Before proceeding, the model summarizes (in a single crisp sentence) the mission to confirm everyone is aligned.<\/li>\n\n\n\n<li><strong>Token Efficiency:<\/strong>&nbsp;The approach aims for clarity without unnecessarily long prompts, relying instead on a structured negotiation for understanding.<\/li>\n<\/ul>\n\n\n\n<p>While the term \u201ccontract-first\u201d has broader use in software (such as API design<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/stackoverflow.com\/questions\/1898989\/what-do-contract-first-and-contract-last-mean\"><\/a>) and business contract processes, its specific application to prompting LLMs is recent and is only beginning to gain attention outside of Jones&#8217; blog, newsletter, and talks. There are no signs (as of August 2025) that this is a standard technique in mainstream AI literature, though it is being applied practically and seems to be gaining traction among advanced prompt engineers seeking more reliable, aligned outputs from AI models<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p>In summary:&nbsp;<strong>Contract-first prompting is a new, not-yet-mainstream idea in LLM prompting, but its principles are resonating with users frustrated by intent failures and iterative prompt re-writing. Its adoption and notoriety may grow as more practitioners experiment with the method and share results.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-default\"\/>\n\n\n\n<p><em><strong>Alec<\/strong><\/em><\/p>\n\n\n\n<p>Having locked the agreement &#8211; the contract &#8211; how is compliance achieved?<\/p>\n\n\n\n<p><em><strong>Perplexity<\/strong><\/em><\/p>\n\n\n\n<p>Compliance in contract-first prompting\u2014after \u201clocking\u201d the agreement\u2014relies on both process and mechanisms designed to minimize misunderstanding and enforce the original intent as the model generates outputs.<\/p>\n\n\n\n<p>Here\u2019s how compliance is typically achieved:<\/p>\n\n\n\n<p><strong>1. Mutually Verified Understanding\u2014Before Execution<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Before any generative task begins, both the human user and the LLM go through a structured clarification phase. The LLM actively interrogates gaps or ambiguities, asking targeted questions until a high confidence threshold (such as 95% clarity) is met<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li>An \u201cecho check\u201d is performed, where the model summarizes the mission and requirements in a single definitive sentence. If this summary matches the human\u2019s expectations, the contract is \u201clocked,\u201d making intent explicit and verifiable.<\/li>\n<\/ul>\n\n\n\n<p><strong>2. Process-Driven Output Generation<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once agreement is locked, the LLM proceeds to generate according to the contract. The steps and constraints defined upfront become the rubric against which the output will be compared<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li>The contract includes not just the end goals, but also deliverables, must-hit facts, hardest constraints, and even \u201cguardrails\u201d for creativity, tone, or style\u2014allowing for precise post-generation comparison of what was promised versus what was delivered.<\/li>\n<\/ul>\n\n\n\n<p><strong>3. Internal Self-Testing and Critique<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Advanced workflows employ \u201cself-testing\u201d or \u201cself-critique\u201d phases, where the LLM is asked to evaluate its output against the agreed contract. This can involve the model itself (or a second critique pass) systematically checking for alignment with requirements, completeness, and accuracy\u2014much as code is tested against a written specification<a href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li>This may be repeated or budgeted with a cap on retries to avoid an endless critique loop.<\/li>\n<\/ul>\n\n\n\n<p><strong>4. Human Oversight and Feedback<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the output fails to satisfy the locked contract, a feedback stage allows the user to flag deficiencies, inconsistencies, or missed constraints for another iteration\u2014always referencing the specific terms of the locked agreement as the benchmark for compliance<a href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n<\/ul>\n\n\n\n<p><strong>5. Traceability and Amendments<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The locked contract (\u201cprompt contract\u201d) and any conversation history serve as a transparent audit trail. If outputs diverge or intent drifts over time, the contract can be revisited, amended with new information, and relocked to renew mutual understanding<a href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n<\/ul>\n\n\n\n<p><strong>Key Principles for Enforcing Compliance:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Explicit rubrics:<\/strong>&nbsp;Every required element and forbidden omission is made explicit.<\/li>\n\n\n\n<li><strong>Model-enabled self-verification:<\/strong>&nbsp;The LLM is prompted to \u201cmark its own homework\u201d before delivering.<\/li>\n\n\n\n<li><strong>External criticism:<\/strong>&nbsp;Human or model-based critics can review the output, pinpointing contract breaches.<\/li>\n\n\n\n<li><strong>Iterative negotiation:<\/strong>&nbsp;In the case of failures, the process can resume from clarification, not starting from scratch.<\/li>\n<\/ul>\n\n\n\n<p>In sum:&nbsp;Contract-first prompting doesn\u2019t just minimize ambiguity upfront\u2014it supports compliance by converting vague expectations into actionable, checkable commitments, and by making the verification of those commitments part of the generation and review process itself. <\/p>\n\n\n\n<p>This \u201ccontract discipline\u201d borrows best practices from software engineering and project management, tailored to the specifics of LLM interaction.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em><strong>Alec<\/strong><\/em><\/p>\n\n\n\n<p>Please provide a glossary for the content of this chat.<\/p>\n\n\n\n<p><strong><em>Perplexity<\/em><\/strong><\/p>\n\n\n\n<p>Here\u2019s a glossary for key terms and concepts related to contract-first prompting, as discussed in this conversation:<\/p>\n\n\n\n<p><strong>Contract-First Prompting<\/strong><br>An approach to prompt engineering where both the user and the language model establish an explicit, mutual understanding of the task, requirements, constraints, and deliverables before generating any outputs. The prompt acts as a \u201ccontract\u201d guiding model behavior and evaluation<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p><strong>Locked Contract \/ Agreement<\/strong><br>The state achieved when both the human user and the language model have fully clarified, summarized, and agreed upon the task and its criteria. Generation begins only after this \u201ccontract\u201d is accepted by both parties<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p><strong>Clarification Loop<\/strong><br>A process in which the language model asks targeted questions about the prompt or assignment until all gaps or ambiguities are resolved. This loop continues until a certain confidence threshold (e.g., 95%) is achieved, ensuring both parties understand exactly what is required<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p><strong>Echo Check<\/strong><br>A final summary step, where the language model restates the mission or main goal in a single, explicit sentence to confirm mutual understanding. This is usually the step before locking the contract<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p><strong>Compliance<\/strong><br>The act of ensuring that the model\u2019s outputs adhere to the requirements, constraints, and expectations set out in the locked contract. Compliance involves explicit rubrics, self-testing, and human or model review to verify that the \u201ccontract\u201d is fully honored<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\"><\/a>.<\/p>\n\n\n\n<p><strong>Self-Testing \/ Self-Critique<\/strong><br>A process where the language model evaluates its own output versus the locked contract, checking for alignment on deliverables, content, tone, and constraints. This may involve specific prompt instructions for the model to \u201cmark its own homework\u201d<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\"><\/a>.<\/p>\n\n\n\n<p><strong>Rubric<\/strong><br>A set of explicit, measurable criteria used to judge whether the model\u2019s output meets the contract. Rubrics can cover required facts, tone, structure, style, and any \u201cmust-not\u201d constraints.<\/p>\n\n\n\n<p><strong>Guardrails<\/strong><br>Rules or boundaries in the contract that keep output within the intended scope, such as stylistic requirements, forbidden content, or strict adherence to facts.<\/p>\n\n\n\n<p><strong>Iterative Negotiation<\/strong><br>The process of returning to the clarification loop or contract stage when outputs fail to comply, allowing for further refinement and amendments rather than starting over from scratch<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\"><\/a>.<\/p>\n\n\n\n<p><strong>Prompt Contract<\/strong><br>Another term for the locked prompt; the full, mutually agreed prompt specification defining the agreed work, constraints, and criteria.<\/p>\n\n\n\n<p><strong>Audit Trail<\/strong><br>The conversation history, including contract negotiations, clarifications, and amendments. This record provides transparency for how compliance and intent alignment were achieved<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/www.linkedin.com\/pulse\/prompting-from-first-principles-field-notes-thousands-nar%C3%A9-vardanyan-yrjae\"><\/a>.<\/p>\n\n\n\n<p><strong>Confidence Threshold<\/strong><br>A percentage (such as 95%) representing the degree of certainty the model must reach before locking the contract. Achieved through questions and summarization steps<a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\"><\/a>.<\/p>\n\n\n\n<p><strong>Token Efficiency<\/strong><br>The principle of using prompt and process structure (such as contract-first negotiation) to achieve clarity and compliance without relying on excessively long or verbose prompts.<\/p>\n\n\n\n<p>These terms form the core vocabulary for understanding and using contract-first prompting as a discipline in language model interactions.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong><em>Alec<\/em><\/strong><\/p>\n\n\n\n<p>What does the Prompt Contract comprise, in this approach to working with an LLM?<\/p>\n\n\n\n<p><strong><em>Perplexity<\/em><\/strong><\/p>\n\n\n\n<p>A Prompt Contract, in contract-first prompting for large language models (LLMs), is a structured, mutually agreed specification between the user and the model that defines exactly what is expected\u2014turning vague intentions into an explicit, checkable work order before any output is generated. Its main components include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Mission Statement\/Task Description:<\/strong><br>A concise summary of the specific task or objective the model is asked to accomplish. This is the \u201cheadline\u201d of the work assignment and sets the frame for all further instructions<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li><strong>Deliverables:<\/strong><br>Explicit details about the output format, length, style, structure, and any other properties the response must have. For example, \u201ca 500-word summary,\u201d \u201cPython code with comments,\u201d or \u201ca list of five strategic recommendations.\u201d<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><\/li>\n\n\n\n<li><strong>Must-Include Facts and Requirements:<\/strong><br>Any key pieces of information, facts, or arguments that must appear in the output. These are non-negotiable and serve as the backbone for measuring compliance<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li><strong>Constraints (Hardest Constraints and Guardrails):<\/strong><br>Limitations or boundaries the model should not cross\u2014such as \u201cdo not speculate,\u201d \u201cno first-person language,\u201d \u201cavoid repetition,\u201d or \u201cnever reference X.\u201d Guardrails may also cover tone, audience, or domain-specific restrictions.<\/li>\n\n\n\n<li><strong>Success Criteria\/Rubric:<\/strong><br>Criteria or checklist for what constitutes a \u201csuccessful\u201d output. This could involve accuracy, completeness, style, tone, or inclusion of certain sections. These criteria become the basis for self-testing or human review of the model\u2019s output<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li><strong>Clarified Unknowns and Assumptions:<\/strong><br>List of any remaining ambiguities, potential edge cases, or unstated assumptions. These are surfaced and explicitly agreed upon through a clarification loop before locking the contract<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n\n\n\n<li><strong>Echo Check\/Summary Statement:<\/strong><br>The language model returns a single, crisp summary statement of the agreed task and constraints. The user confirms this matches their intent\u2014at which point, the \u201ccontract\u201d is locked and execution (output generation) can begin<a href=\"https:\/\/natesnewsletter.substack.com\/p\/stop-letting-ai-guess-why-your-prompts\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>.<\/li>\n<\/ul>\n\n\n\n<p>In practice, the Prompt Contract acts as both a plan and a testable checklist. If model output deviates or is incomplete, parties return to the contract to clarify or amend terms, ensuring high accuracy and alignment. This disciplined, engineering-inspired approach is especially useful for high-stakes, complex, or collaborative tasks, reducing intent gaps and making model behavior more predictable and auditable.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n<!-- PMB print buttons is only displayed on a single post\/page URLs-->","protected":false},"excerpt":{"rendered":"<p>Contract-First Prompting Transcript of a chat with Perplexity AI on 4 August 2025. Scope: The AI cited a range of sources which are not listed here. Alec I\u2019m reading about contract-first prompting. Is this a well known idea? Perplexity Contract-first prompting is an emerging approach in the field of prompt engineering for large language models [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[7,212],"class_list":["post-571","page","type-page","status-publish","hentry","tag-concept","tag-prompt"],"_links":{"self":[{"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/pages\/571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/comments?post=571"}],"version-history":[{"count":5,"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/pages\/571\/revisions"}],"predecessor-version":[{"id":580,"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/pages\/571\/revisions\/580"}],"wp:attachment":[{"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/media?parent=571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/categories?post=571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anapoly.co.uk\/labs\/wp-json\/wp\/v2\/tags?post=571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}