Inferensys

Prompt

Context Extraction Prompt for ADR

A practical prompt playbook for using Context Extraction Prompt for ADR in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job, ideal user, required inputs, and boundaries for the Context Extraction Prompt for ADR.

This prompt is for architects and engineering leads who need to extract a structured problem context from unstructured source material—meeting notes, design docs, incident reports, or Slack threads—before drafting an Architecture Decision Record (ADR). The job-to-be-done is converting messy, implicit, and scattered information into a single, reliable context summary that captures the problem statement, known constraints, stakeholder concerns, and assumptions. Without this step, ADRs often start with an ill-defined problem, leading to decisions that solve the wrong thing or ignore critical constraints.

Use this prompt when you have raw source material that contains the why behind a pending architectural decision but no structured summary. It works best when the source material includes discussions of trade-offs, non-functional requirements (latency, cost, compliance, operability), or explicit disagreements between stakeholders. The prompt is designed to produce a completeness-checked output that flags missing constraint categories—such as security, cost, team capability, or regulatory requirements—so you know what to go investigate before writing the ADR. Do not use this prompt when you already have a well-structured problem statement, when the decision is trivial with no trade-offs, or when you need a final ADR document (use the ADR Generation Prompt Template for that).

This prompt is a pre-ADR extraction step. It assumes you will review the output, fill gaps, and then feed the structured context into a downstream ADR generation or drafting workflow. In high-risk or regulated environments, always have a human architect validate the extracted constraints and stakeholder concerns before they become the foundation of a recorded decision. The output is a working document, not an approved artifact. If the source material contains conflicting statements, the prompt will surface them rather than resolve them—resolution is a human judgment call.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Context Extraction Prompt for ADR works well and where it introduces risk. Use these cards to decide if this prompt fits your workflow before you wire it into a decision pipeline.

01

Good Fit: Messy Multi-Source Input

Use when: you have meeting notes, design docs, and incident reports that contain scattered constraints and stakeholder concerns. Guardrail: the prompt is designed to synthesize across sources, but always include a source-traceability requirement in the output schema so reviewers can verify each extracted claim.

02

Bad Fit: Single Clear Constraint

Avoid when: the problem context is already well-structured and unambiguous. Guardrail: running extraction on a clean spec can introduce spurious constraints or over-interpretation. Use a simpler template or skip directly to ADR generation when inputs are already organized.

03

Required Inputs: Source Material and Constraint Categories

What to watch: the prompt needs both raw source material and a defined set of constraint categories to check against. Guardrail: provide a [CONSTRAINT_CATEGORIES] list (e.g., latency, compliance, team capability) or the model will invent its own categories, which may miss domain-specific requirements.

04

Operational Risk: Silent Omission

What to watch: the model may fail to extract a constraint that is implicit in the source material but not explicitly stated. Guardrail: pair this prompt with a completeness check step that compares extracted constraints against a known checklist. Flag any missing categories for human review before the context summary enters the ADR draft.

05

Operational Risk: Hallucinated Stakeholders

What to watch: the model may invent stakeholder concerns or personas that were not present in the source material. Guardrail: require every extracted stakeholder concern to cite a specific source passage. If no citation exists, drop the claim or mark it as low-confidence inference.

06

Scale Limit: Single Decision Scope

What to watch: the prompt is designed for one architectural decision at a time. Feeding multiple unrelated decisions produces conflated context. Guardrail: run extraction once per decision. If source material covers multiple decisions, pre-split the input or use a routing step to isolate the relevant sections.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for extracting structured ADR context from unstructured source material.

This prompt template is designed to extract the problem context, constraints, and stakeholder concerns from raw source material such as meeting notes, design documents, or incident reports. It produces a structured summary that can be directly fed into an ADR generation workflow. The template uses square-bracket placeholders for all variable inputs, allowing you to swap in different source documents, constraint categories, and output schemas without rewriting the core instruction set.

text
You are an architecture analyst extracting structured context for an Architecture Decision Record (ADR).

Your task is to read the provided source material and extract the problem context, explicit and implicit constraints, stakeholder concerns, and any assumptions that should be documented before a decision is made.

## INPUT
[SOURCE_MATERIAL]

## CONSTRAINT CATEGORIES TO CHECK
[CONSTRAINT_CATEGORIES]

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "problem_statement": "A concise, one-paragraph description of the problem or decision to be made.",
  "context": {
    "background": "Relevant history, prior decisions, or system state that frames the problem.",
    "trigger": "What event, deadline, or observation prompted this decision now.",
    "scope": "What is in scope and out of scope for this decision."
  },
  "constraints": [
    {
      "category": "One of the provided constraint categories.",
      "description": "The specific constraint identified.",
      "source": "Quote or reference from the source material.",
      "explicit": true_or_false
    }
  ],
  "stakeholders": [
    {
      "role": "Team, system, or person affected.",
      "concern": "What they care about or risk they face.",
      "source": "Quote or reference from the source material."
    }
  ],
  "assumptions": [
    {
      "statement": "The assumption being made.",
      "validation": "How this assumption could be verified or falsified.",
      "risk_if_false": "What breaks if this assumption is wrong."
    }
  ],
  "completeness_notes": {
    "missing_categories": ["Constraint categories with no evidence found."],
    "low_confidence_areas": ["Topics where the source material is ambiguous or silent."]
  }
}

## INSTRUCTIONS
1. Extract only what is present in the source material. Do not invent constraints or stakeholders.
2. For each constraint, identify whether it is explicitly stated or implicitly present in the discussion.
3. Flag any constraint categories from the provided list that have no evidence in the source material.
4. If the source material is ambiguous on a point, note it in completeness_notes rather than guessing.
5. Quote the source material directly when providing source references.
6. If the source material is insufficient to produce a meaningful extraction, return {"error": "INSUFFICIENT_SOURCE", "detail": "explanation"}.

To adapt this template, replace [SOURCE_MATERIAL] with the raw text you need to analyze. Replace [CONSTRAINT_CATEGORIES] with a comma-separated list of categories relevant to your domain, such as performance, security, cost, team capability, compliance, timeline, operational burden, vendor dependency. The output schema can be extended with additional fields, but avoid removing the completeness_notes section—it is the primary mechanism for detecting when the source material is insufficient and preventing hallucinated context from entering your ADR pipeline. For high-risk domains, always route outputs with low_confidence_areas or missing_categories to a human reviewer before using them in a decision document.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required by the Context Extraction Prompt for ADR. Each placeholder must be populated before the prompt is sent to the model. Missing or malformed inputs are the most common cause of incomplete context summaries.

PlaceholderPurposeExampleValidation Notes

[SOURCE_MATERIAL]

Raw meeting notes, design doc text, incident report, or email thread from which context must be extracted

Full transcript of the March 14th architecture review meeting

Required. Must be non-empty string. Check for minimum 50 tokens to avoid vacuous extractions. Truncate at model context limit minus 2000 tokens for prompt overhead.

[DECISION_DOMAIN]

The architectural area or system scope the ADR will address, used to focus extraction on relevant details

Payment processing pipeline

Required. Must be a specific system or capability name. Reject generic values like 'architecture' or 'the system'. Used to filter irrelevant context from source material.

[CONSTRAINT_CATEGORIES]

List of constraint types to scan for: latency, cost, compliance, team capability, existing systems, vendor lock-in, operational burden

["latency", "compliance", "team capability"]

Optional. Defaults to all categories if omitted. Must be a valid JSON array of strings from the allowed category set. Unknown categories should trigger a warning but not block execution.

[STAKEHOLDER_ROLES]

Roles or teams whose concerns must be captured in the extracted context

["Platform Engineering", "Security", "Product"]

Optional. If omitted, extraction captures all mentioned stakeholders. If provided, the prompt prioritizes concerns from these roles. Must be a valid JSON array of strings.

[OUTPUT_SCHEMA]

JSON schema the extracted context must conform to, defining required fields like problem_statement, constraints, stakeholders, assumptions, and unknowns

See ADR Context schema v2.1

Required. Must be a valid JSON Schema object. Validate schema before prompt assembly. Reject schemas missing required fields: problem_statement, constraints, and stakeholders.

[CONFIDENCE_THRESHOLD]

Minimum confidence score (0.0 to 1.0) for extracted claims to be included in the output. Claims below threshold are placed in the unknowns section

0.7

Optional. Defaults to 0.6. Must be a float between 0.0 and 1.0. Values below 0.5 produce noisy extractions. Values above 0.9 may suppress valid low-confidence signals that belong in unknowns.

[MAX_CONSTRAINTS_PER_CATEGORY]

Limit on the number of constraints extracted per category to prevent context bloat

5

Optional. Defaults to 8. Must be a positive integer. Use lower values for noisy source material. If exceeded, the prompt instructs the model to keep the highest-confidence constraints.

[REQUIRE_CITATIONS]

Whether each extracted claim must include a citation back to the source material

Optional. Defaults to true. Must be boolean. Set to false only for informal or early-stage context extraction. When true, validate that output citations reference actual spans in source material.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Context Extraction prompt into an application or review workflow with validation, retries, and human-in-the-loop gates.

The Context Extraction prompt is designed to be the first stage in a multi-step ADR pipeline. It should be called before any generation or review prompt, consuming raw meeting notes, design docs, or incident reports and producing a structured context object. In a production harness, treat this prompt as a precondition gate: if the extracted context fails completeness checks, the system should not proceed to ADR generation. Instead, it should return a structured gap report to the user, requesting the missing information before continuing.

Wire the prompt into your application as an async pipeline step. The recommended flow: (1) Accept raw input text and optional metadata (source type, date, author). (2) Call the LLM with the prompt template, passing [RAW_INPUT] and [CONSTRAINT_CATEGORIES] (use a default set: performance, security, cost, timeline, team capability, compliance, operational burden, and dependencies). (3) Parse the JSON output and validate it against the expected schema—check that all required fields (problem_statement, constraints, stakeholders, assumptions, known_unknowns) are present and non-empty. (4) Run a completeness evaluator: if any constraint category from the input list is missing from the output, flag it. If known_unknowns is empty but the input contains ambiguous or conflicting statements, flag it. (5) If validation passes, store the structured context and proceed to ADR generation. If validation fails, return the gap report to the user with specific prompts for what's missing.

For model choice, prefer a model with strong instruction-following and structured output capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent). Set temperature low (0.0–0.2) to maximize extraction consistency. Implement a retry strategy with up to 2 retries on schema validation failure, appending the validation error to the next attempt's prompt as [PREVIOUS_ERROR]. Log every extraction attempt—including raw input hash, output, validation results, and retry count—for observability. For high-stakes architectural decisions (compliance-critical systems, safety-sensitive domains), add a human review step after extraction: present the structured context alongside the raw source in a review UI, require explicit approval before the context is used for ADR generation, and record the reviewer's identity and timestamp in the audit trail.

Avoid wiring this prompt directly into a synchronous user-facing chat interface. The extraction step benefits from batch or async processing because raw inputs can be long, validation may require multiple retries, and human review gates introduce latency. Instead, expose it through an API endpoint or queue-based worker that returns a job ID and status. The downstream ADR generation prompt should consume only the validated, approved context object—never the raw input directly. This separation of concerns prevents hallucinated context from contaminating the decision record and makes each pipeline stage independently testable and debuggable.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured output schema for the Context Extraction Prompt. Use this contract to validate the model's response before passing it to downstream ADR drafting tools.

Field or ElementType or FormatRequiredValidation Rule

problem_statement

string (1-3 sentences)

Must not be null or empty. Check length > 20 chars. Must not contain implementation details or solution language.

business_context

string (paragraph)

Must not be null. Check for stakeholder mention. If no business context is found, field must contain explicit 'No business context provided in source.'

technical_constraints

array of strings

Must be a valid JSON array. Each item must be a non-empty string. If no constraints are found, return an empty array [].

regulatory_or_compliance_notes

string or null

If null, validate that no regulatory terms (e.g., GDPR, HIPAA, PCI) appear in the source. If present, must cite specific regulation.

key_stakeholders

array of objects

Each object must have 'role' (string) and 'concern' (string) keys. Validate array length > 0. Reject if 'concern' is empty.

explicit_non_goals

array of strings

If present, each string must be a distinct item. Validate that items do not contradict the problem_statement. Null is acceptable.

source_confidence

object

Must contain 'score' (float 0.0-1.0) and 'rationale' (string). Validate score is within range. If score < 0.5, trigger human review.

PRACTICAL GUARDRAILS

Common Failure Modes

Context extraction prompts fail in predictable ways before they produce a useful ADR foundation. Each card below identifies a specific failure mode and the guardrail that prevents it.

01

Context Collapse into Summary

What to watch: The model produces a fluent narrative summary of the source material instead of extracting structured fields for problem context, constraints, and stakeholder concerns. The output reads well but is useless for downstream ADR generation because all information is flattened into prose. Guardrail: Require a strict output schema with named fields and forbid narrative paragraphs. Validate that each required field is populated with discrete, non-overlapping content before accepting the extraction.

02

Constraint Category Blindness

What to watch: The extraction misses entire categories of constraints—regulatory requirements, budget limits, team capability, timeline pressure, or operational SLAs—because the source material implies them rather than stating them explicitly. The resulting ADR context is dangerously incomplete. Guardrail: Provide a mandatory constraint taxonomy in the prompt and require the model to mark each category as 'found', 'implied', or 'not evident'. Flag 'not evident' categories for human review before ADR drafting proceeds.

03

Stakeholder Voice Erasure

What to watch: The extraction homogenizes conflicting stakeholder concerns into a single neutral voice, losing the tension between security, product, engineering, and operations perspectives. The ADR that follows will lack the real trade-off dimensions that drove the decision. Guardrail: Require stakeholder-attributed concern extraction with direct quotes or paraphrases labeled by role. Validate that at least two distinct stakeholder perspectives appear when multiple roles are present in the source material.

04

Temporal Context Drift

What to watch: The extraction treats all information as equally current, mixing past constraints that have expired with present ones that still apply. An old budget cap or a resolved incident constraint contaminates the current decision context. Guardrail: Require temporal tagging for each extracted constraint and concern. Add a 'currency check' step that flags any constraint older than a specified threshold or without a clear timestamp for human verification.

05

Solution Contamination of Problem Space

What to watch: The source material contains proposed solutions disguised as requirements, and the extraction treats them as constraints rather than options. The ADR context becomes biased toward a predetermined solution before alternatives are even enumerated. Guardrail: Add a classification step that separates 'problem statements' from 'solution proposals' in the extraction. Flag any constraint that reads like a solution for human review. Validate that the problem context section contains no implementation details.

06

Completeness Overconfidence

What to watch: The extraction produces a confident, well-structured output that masks significant gaps. The model never indicates uncertainty about missing information, so the architect assumes the context is complete when critical constraints are absent. Guardrail: Require an explicit 'completeness confidence' field for each extracted section and a summary of known unknowns. Route extractions with low confidence scores or multiple 'not evident' constraint categories to human augmentation before ADR generation.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the quality of extracted context before it enters an ADR draft. Use these checks in automated eval harnesses or manual peer review.

CriterionPass StandardFailure SignalTest Method

Constraint Completeness

All constraint categories present in [INPUT] are captured: technical, business, regulatory, timeline, resource, and organizational

Missing constraint category that was explicitly mentioned in source material

Diff extracted constraint list against a manual annotation of constraint mentions in [INPUT]; flag categories with zero coverage

Stakeholder Coverage

Every named stakeholder or role in [INPUT] appears in the extracted context with their stated concern

Stakeholder mentioned in source is absent from output or assigned a concern not supported by the source

Entity extraction recall test: compare stakeholder names in output against a ground-truth list from [INPUT]

Problem Statement Fidelity

Extracted problem statement preserves the core tension or decision trigger without adding interpretation not present in [INPUT]

Problem statement introduces causal claims, urgency language, or scope expansion absent from source

Semantic similarity check between extracted problem statement and source passages; flag additions exceeding a similarity threshold drop

Assumption Separation

Explicit assumptions from [INPUT] are listed separately from inferred context; inferred items are marked with confidence level

Inferred context appears in the assumptions list without a confidence marker or source citation

Parse assumptions list for [INFERRED] tag presence; verify each untagged item has a direct quote match in [INPUT]

Non-Requirement Flagging

Explicit non-requirements or out-of-scope statements from [INPUT] are captured in a dedicated section

Out-of-scope statement from source is omitted or reclassified as a constraint

Check for presence of a non-requirements section; spot-check 3 known out-of-scope statements from [INPUT] for inclusion

Ambiguity Preservation

Areas where [INPUT] is ambiguous or contradictory are noted rather than resolved silently

Output presents a single, clean interpretation where the source contains conflicting statements

Search output for ambiguity markers such as 'unclear', 'conflicting', or 'TBD'; verify each marker corresponds to a genuine source ambiguity

Source Traceability

Each extracted element includes a reference to the source section, paragraph, or timestamp in [INPUT]

Extracted claim lacks a source pointer or the pointer does not resolve to supporting text

Automated citation check: for each extracted element, verify the cited source location exists and contains semantically related content

Irrelevance Filtering

Output excludes meeting meta-commentary, small talk, and content unrelated to the architectural decision

Output includes action items, scheduling notes, or general discussion not relevant to the decision context

Keyword-based filter test: scan output for exclusion-list terms such as 'next meeting', 'agenda', 'lunch'; flag any matches

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with lighter validation. Focus on getting a structured context summary quickly from a single meeting note or design doc. Skip completeness checks and constraint categorization in the first pass.

  • Remove the [CONSTRAINT_CATEGORIES] enumeration and replace with a simpler instruction: "List all constraints mentioned."
  • Drop the [COMPLETENESS_CHECK] section entirely.
  • Accept free-text output instead of enforcing the [OUTPUT_SCHEMA].
  • Use a smaller, faster model to iterate on prompt wording before locking the schema.

Watch for

  • Missing constraint categories that would be caught by the full prompt.
  • Stakeholder concerns blended into problem context without separation.
  • Overly broad instructions producing narrative summaries instead of structured extraction.
  • No signal on what the prompt missed, making it hard to know when to escalate to the production version.
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.