Inferensys

Prompt

Architecture Decision Record Generation Prompt Template

A practical prompt playbook for generating Architecture Decision Records from pull request discussions, commit messages, and design document comments in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user, required context, and when not to use the prompt.

This prompt is for tech leads and platform engineers who need to capture architecture decisions retroactively. The core job-to-be-done is converting unstructured, scattered decision-making evidence—such as pull request discussions, commit messages, and design document comments—into a formal, structured Architecture Decision Record (ADR). The ideal user is someone who has already made a technical decision in the flow of development work but has not yet documented it in the team's decision log. The prompt assumes you have access to the original discussion threads and can provide them as the [INPUT] context. It does not replace the need for human review of the generated ADR before it is committed to the decision log.

Use this prompt when you have a high-signal, messy conversation that contains a clear decision, alternatives that were seriously considered, and a rationale that can be extracted. The prompt is designed to work with raw text from GitHub pull requests, Slack threads, RFC documents, or meeting notes. It is not suitable for generating ADRs from a blank slate or a single-sentence decision. The prompt requires enough source material to ground the output in evidence. If the input is too sparse, the model will hallucinate options or rationale that were never discussed. Always provide the full discussion context, including any dissenting opinions, to produce a balanced record.

Do not use this prompt for decisions that are still under active debate, for capturing real-time meeting notes, or for generating architectural diagrams. It is a documentation tool, not a decision-making tool. The output is a draft that must be reviewed by a human who was present for the decision. Before integrating this into a pipeline, ensure you have a validation step that checks for required ADR fields, source links, and the presence of at least two considered options. The next step after generation is to have the decision owner verify the accuracy of the context, options, and rationale, then commit the record to your ADR repository.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Architecture Decision Record generation requires traceable evidence and structured rationale. Use it for retrospective documentation, not forward-looking design.

01

Good Fit: Retroactive Decision Capture

Use when: you have completed pull request discussions, commit history, and design doc comments that contain the actual decision rationale. The prompt excels at extracting decisions that were already made and discussed, not inventing new ones. Guardrail: provide at least two evidence sources (PR comments, commit messages, design doc fragments) per decision to ensure grounding.

02

Bad Fit: Forward-Looking Architecture Design

Avoid when: you need to make a new architecture decision or evaluate trade-offs that haven't been discussed yet. This prompt extracts and structures existing decisions, it does not perform architecture analysis or recommend design choices. Guardrail: use a separate design review prompt for forward-looking decisions, then feed the outcome into this prompt for documentation.

03

Required Inputs: Evidence Sources

Risk: generating ADRs without source evidence produces plausible but ungrounded records that look authoritative but lack traceability. Guardrail: require at minimum pull request URLs, commit SHAs, or design doc sections as input. The prompt should refuse to generate an ADR if no evidence sources are provided, or flag sections with [EVIDENCE_MISSING] markers.

04

Operational Risk: Hallucinated Rationale

Risk: the model may fabricate options considered, trade-off analysis, or consequences that were never actually discussed by the team. This creates false institutional memory. Guardrail: every option and consequence in the output must cite a specific source location. Run an eval that checks each claim against the provided evidence and flags unsupported statements.

05

Operational Risk: Stale or Incomplete Context

Risk: if the provided evidence is partial (e.g., only PR comments but not the design doc that preceded them), the ADR will miss critical context and rationale. Guardrail: define a minimum evidence checklist before generation (problem statement, options discussed, decision, consequences). If any category is missing from sources, mark the ADR section as [INCOMPLETE] rather than fabricating content.

06

Operational Risk: Decision Drift Over Time

Risk: an ADR generated today from old discussions may not reflect later reversals, superseding decisions, or implementation changes. Guardrail: include a Superseded By field in the ADR schema and run periodic checks that compare generated ADRs against recent commit history for contradictory changes. Flag ADRs older than N months for review.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for generating Architecture Decision Records from pull request discussions, commit messages, and design document comments.

This prompt template is designed to be pasted directly into your AI system. It instructs the model to act as a technical lead and generate a structured Architecture Decision Record (ADR) from provided source material. The template uses square-bracket placeholders that you must replace with real values before execution. The core instruction set defines the persona, the strict output schema, and the critical requirement to ground every decision and rationale in the provided evidence.

text
You are a senior technical lead responsible for documenting past architecture decisions. Your task is to generate a single Architecture Decision Record (ADR) from the provided source material.

## SOURCE MATERIAL
[SOURCE_MATERIAL]

## OUTPUT SCHEMA
You must output a single JSON object conforming to the following structure. Do not include any text outside the JSON object.
{
  "title": "A concise, descriptive title for the decision.",
  "status": "One of: Proposed, Accepted, Deprecated, Superseded.",
  "context": "A paragraph describing the problem, the forces at play, and the circumstances that necessitated this decision. Ground this in the source material.",
  "decision": "A clear, direct statement of the decision that was made. Ground this in the source material.",
  "consequences": "A paragraph describing the resulting context after applying the decision. Include both positive and negative consequences. Ground this in the source material.",
  "options_considered": [
    {
      "option": "A brief description of an alternative option.",
      "rationale": "Why this option was not chosen, based on the source material."
    }
  ],
  "evidence_links": [
    "A direct quote or specific reference from the source material that supports this ADR."
  ]
}

## CONSTRAINTS
- Every field in the output must be populated. Use 'N/A' only if information is truly absent from the source material.
- The 'evidence_links' array must contain at least one direct quote or specific reference from the source material for each of the 'context', 'decision', and 'consequences' fields.
- If the source material contains conflicting viewpoints, you must note the conflict in the 'context' field and explain which viewpoint prevailed in the 'decision' field.
- Do not invent information. If the source material is insufficient to generate a complete ADR, output a JSON object with a single key "error" explaining what is missing.

To adapt this template, replace the [SOURCE_MATERIAL] placeholder with the concatenated text of pull request discussions, commit messages, and design document comments. For high-stakes decisions, consider adding a [RISK_LEVEL] constraint to adjust the strictness of the evidence-grounding requirement. Before integrating this into a production pipeline, you should validate the model's output against the JSON schema and run an LLM-as-a-judge evaluation to check for hallucinated evidence.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Architecture Decision Record generation prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to check input quality before execution.

PlaceholderPurposeExampleValidation Notes

[DECISION_TITLE]

Short name for the architecture decision being documented

Adopt PostgreSQL as primary OLTP store

Required. Must be 5-120 characters. Reject if empty or contains only generic terms like 'decision' or 'architecture'.

[DECISION_CONTEXT]

Background problem, constraints, and forces that led to the decision

Team needed a relational store with strong consistency for payment data. Existing MySQL instance had replication lag exceeding 2s under load.

Required. Must be 50-2000 characters. Reject if copied verbatim from a generic template with no project-specific details.

[OPTIONS_CONSIDERED]

Alternatives evaluated with pros and cons for each

Option 1: PostgreSQL (pros: mature, strong consistency; cons: vertical scaling limits). Option 2: CockroachDB (pros: horizontal scaling; cons: operational complexity, team unfamiliar).

Required. Must contain at least 2 options. Each option must have at least 1 pro and 1 con. Reject if only one option or if pros/cons are identical across options.

[DECISION_OUTCOME]

The chosen option and implementation approach

Adopt PostgreSQL 16 with streaming replication. Migrate payment tables first, then non-critical data over 2 sprints.

Required. Must explicitly state which option was chosen. Reject if outcome is ambiguous or contradicts [OPTIONS_CONSIDERED].

[DECISION_RATIONALE]

Why this option was chosen over alternatives

PostgreSQL met consistency requirements with lower operational overhead than CockroachDB. Team had existing expertise. Migration risk was acceptable given phased rollout.

Required. Must reference specific trade-offs from [OPTIONS_CONSIDERED]. Reject if rationale is generic ('best fit') without referencing rejected alternatives.

[CONSEQUENCES]

Positive and negative consequences of the decision

Positive: sub-10ms read latency, simpler ops. Negative: must implement sharding logic if data exceeds 500GB. Risk: vendor lock-in to PostgreSQL-specific features like JSONB indexing.

Required. Must include at least 1 positive and 1 negative consequence. Reject if only positive consequences listed.

[SOURCE_EVIDENCE]

Links to PR discussions, design docs, meeting notes, or commit messages that support this ADR

PR #4521 comments, design doc at /docs/decisions/storage-evaluation.md, Slack thread in #architecture on 2024-11-15

Required. Must contain at least 1 verifiable reference. Reject if all references are dead links or generic ('team discussion') without a date or artifact.

[DECISION_STATUS]

Current status of the decision

Accepted

Required. Must be one of: Proposed, Accepted, Deprecated, Superseded. Reject if status is Superseded but no [SUPERSEDED_BY] reference provided.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the ADR generation prompt into an application or automated workflow.

This prompt is designed to be integrated into a backend service or CI/CD pipeline that processes pull request metadata, commit histories, and design document comments. The primary integration point is a webhook handler triggered by PR merges or a scheduled job that scans repositories for undocumented decisions. The application layer is responsible for assembling the [INPUT] block—extracting PR descriptions, linked issues, commit messages, and relevant design doc threads—before injecting them into the prompt template. Do not pass raw, unfiltered repository data directly to the model; the harness must deduplicate comments, truncate long threads to the most salient exchanges, and strip bot-generated noise to keep the context window focused on human decision-making.

The implementation should enforce a strict output contract. After the model returns the generated ADR, validate the JSON structure against the expected [OUTPUT_SCHEMA] before writing it to the documentation repository. A validation step must check that required fields—title, status, context, decision, consequences, and options_considered—are present and non-empty. For high-stakes architectural decisions, route the generated ADR to a human review queue (e.g., a pull request in the docs/adr directory) rather than auto-committing. Log the prompt version, model used, and validation pass/fail status as metadata on the ADR for auditability. If validation fails, implement a single retry with a repair prompt that includes the schema violation details; if the retry also fails, escalate to a human with the raw context and the failed output attached.

Model choice matters for this workflow. Use a model with strong structured output capabilities and a large context window (e.g., 128K tokens or more) to accommodate lengthy PR discussions and design doc threads. Enable structured output mode or JSON mode if the model provider supports it, and set a low temperature (0.0–0.2) to maximize factual consistency with the source evidence. For teams running this at scale across many repositories, consider batching ADR generation during off-peak hours and caching the extracted context per PR to avoid redundant API calls. The most common production failure mode is evidence hallucination—the model inventing options or rationale not present in the source material—so always pair this prompt with an evidence-grounding eval that checks whether each claim in the ADR can be traced back to a specific comment or commit in the input.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the structured ADR generated by the prompt. Use this contract to parse, validate, and store the output in a decision log system.

Field or ElementType or FormatRequiredValidation Rule

title

string

Must be a single sentence under 120 characters. Parse check: starts with 'ADR-' or contains a decision keyword.

status

enum: Proposed | Accepted | Deprecated | Superseded

Must match one of the four allowed values exactly. Schema check against enum.

context

string

Must contain at least one reference to a PR number, commit SHA, or design doc link. Citation check: regex for #[0-9]+ or 7+ char hex.

decision

string

Must be a single paragraph under 300 characters. Parse check: contains 'We will' or 'The team decided'.

options_considered

array of objects: {option: string, pros: string[], cons: string[]}

Array must contain 2-5 items. Each option must have at least one pro and one con. Schema check: min array length 2, max 5.

rationale

string

Must reference at least one option from options_considered by name. Cross-reference check: option name appears in rationale text.

consequences

object: {positive: string[], negative: string[], risks: string[]}

At least one entry across all three arrays. Schema check: sum of array lengths >= 1.

source_links

array of strings

Each string must be a valid URL or repo-relative path. Format check: starts with 'http' or './' or '/'. Minimum 1 link.

supersedes

string or null

If status is 'Superseded', this field is required and must reference a prior ADR ID. Conditional check: required when status=Superseded.

confidence

enum: High | Medium | Low

Must match one of three values. If 'Low', rationale must contain explicit uncertainty language. Conditional check: keyword match for 'uncertain', 'trade-off', or 'assume'.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when generating Architecture Decision Records from repository context and how to guard against it.

01

Hallucinated Decisions

What to watch: The model invents a decision that was never made, fabricating a rationale and context from unrelated code patterns or generic best practices. This is common when the prompt lacks explicit source grounding requirements. Guardrail: Require every ADR statement to cite a specific source (commit SHA, PR number, doc filename). Add a post-generation verification step that checks each claim against the cited source.

02

Missing Decision Context

What to watch: The generated ADR captures the 'what' but omits the 'why'—the constraints, trade-offs, and rejected alternatives that drove the decision. This produces documentation that looks complete but fails the core purpose of an ADR. Guardrail: Include explicit output fields for [CONSIDERED_OPTIONS] and [DECISION_DRIVERS] in the prompt schema. Validate that each ADR contains at least one rejected alternative with a reason.

03

Stale or Drifted Evidence

What to watch: The model references a commit or PR that has since been reverted, superseded, or modified, producing an ADR that contradicts the current codebase state. This is especially dangerous when generating ADRs retroactively from older discussions. Guardrail: Cross-reference generated ADR claims against the current HEAD of the main branch. Flag any ADR where the cited source is more than N days old or where the referenced code path no longer exists.

04

Over-Generalized Rationale

What to watch: The model fills gaps in the source material with generic software engineering principles ('chose microservices for scalability') rather than the team's actual, context-specific reasoning. This erodes trust and makes ADRs useless for future decision reversal. Guardrail: Add a constraint that rationale must use team-specific terminology, reference internal constraints (e.g., 'our SLO requires...'), and quote directly from discussion threads where available. Use an eval rubric that penalizes generic rationale.

05

Incomplete Source Coverage

What to watch: The model generates an ADR from only the most recent PR discussion, ignoring earlier design docs, RFC comments, or Slack threads that contain critical context. The resulting ADR is accurate but incomplete. Guardrail: Provide a structured [SOURCE_MANIFEST] listing all available evidence sources. Require the model to explicitly list which sources were used and which were unavailable. Add a coverage check that flags ADRs using fewer than a minimum number of sources.

06

Temporal Ordering Confusion

What to watch: The model misorders the sequence of events—presenting a decision as preceding the discussion that led to it, or treating a later reversal as the original decision. This creates a false narrative of how the architecture evolved. Guardrail: Require the ADR to include a [TIMELINE] section with dated events extracted from commit timestamps and discussion metadata. Validate that the decision date is not earlier than the earliest cited discussion.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing Architecture Decision Record output quality before shipping this prompt to production. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Evidence Grounding

Every decision, option, and rationale sentence cites at least one source from [SOURCE_MATERIAL]

Output contains unsupported claims or generic rationale without a source reference

Parse output for citation markers; verify each marker resolves to a document in [SOURCE_MATERIAL]

ADR Structure Completeness

Output contains all required sections: Title, Status, Context, Decision, Options Considered, Consequences, and Source References

One or more required sections is missing or empty

Schema validation against the [OUTPUT_SCHEMA] definition; flag missing required fields

Decision Traceability

The chosen option maps directly to at least one explicit trade-off discussed in the Context or Options Considered sections

Decision appears disconnected from the evidence; rationale contradicts the options analysis

Manual review or LLM-as-judge pairwise check: does the Decision section logically follow from the Context and Options?

Option Enumeration

At least two distinct alternatives are described with pros, cons, and source grounding for each

Only one option presented; options are straw-man arguments; or options lack source grounding

Count distinct options in the Options Considered section; verify each has at least one pro, one con, and one source citation

Consequence Coverage

Positive and negative consequences are listed for the chosen decision, with at least one operational, one maintenance, and one team impact noted

Consequences section is generic, one-sided, or omits a major impact category

Keyword check for operational, maintenance, and team dimensions; flag if any dimension is absent

Source Conflict Handling

When [SOURCE_MATERIAL] contains conflicting signals, the ADR notes the conflict explicitly and explains how the decision resolves or defers it

Conflicting evidence is ignored or smoothed over without acknowledgment

Inject a known conflict into test [SOURCE_MATERIAL]; verify the output surfaces and addresses it

Status Field Validity

Status is one of: Proposed, Accepted, Deprecated, Superseded, and matches the decision maturity implied by the source material

Status is missing, invalid, or contradicts the source evidence (e.g., Accepted for an actively debated decision)

Enum check against allowed status values; spot-check status against source recency and closure signals

Token Efficiency

Output fits within [MAX_OUTPUT_TOKENS] without truncation and avoids redundant restatement of source material

Output is truncated mid-section or repeats large blocks of source text verbatim without synthesis

Token count check; compression ratio check (output tokens vs. source tokens); flag verbatim blocks over 100 chars

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the [OUTPUT_SCHEMA] constraint and ask for Markdown. Replace [EVIDENCE_LINKS] with inline quotes from the source material. Skip the eval harness.

Prompt modification

code
Generate an Architecture Decision Record from the following [SOURCE_MATERIAL].
Include: Title, Status, Context, Decision, Consequences.
Cite specific comments or commit messages inline.

Watch for

  • Fabricated commit SHAs or PR numbers
  • Missing "Options Considered" section
  • Overly generic rationale not grounded in the source discussion
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.