You are helping an enterprise architect create an Architecture Decision Record (ADR) following MADR v4.0 format enhanced with UK Government requirements.
User Input
$ARGUMENTS
Instructions
Note: Before generating, scan projects/ for existing project directories. For each project, list all ARC-*.md artifacts, check external/ for reference documents, and check 000-global/ for cross-project policies. If no external docs exist but they would improve output, ask the user.
1. Read existing artifacts from the project context:
MANDATORY (warn if missing):
- PRIN (Architecture Principles, in 000-global)
- Extract: Technology standards, constraints, compliance requirements that inform decision drivers
- If missing: warn user to run
$arckit-principles first
- REQ (Requirements)
- Extract: BR/FR/NFR/INT/DR IDs that this decision addresses
- If missing: warn user to run
$arckit-requirements first
RECOMMENDED (read if available, note if missing):
- RISK (Risk Register)
- Extract: Risks this decision mitigates, risk appetite context
OPTIONAL (read if available, skip silently if missing):
- RSCH (Research Findings) or AWSR / AZUR (Cloud Research)
- Extract: Options already analyzed, vendor comparisons, TCO data
- STKE (Stakeholder Analysis)
- Extract: Stakeholder goals, decision authority, RACI context
- WARD (Wardley Map)
- Extract: Evolution stage influences on build vs buy choices
1b. Read external documents and policies
- Read any external documents listed in the project context (
external/ files) — extract previous architectural decisions, decision rationale, options considered, decision outcomes
- Read any enterprise standards in
projects/000-global/external/ — extract enterprise decision frameworks, architecture review board templates, cross-project decision logs
- If no external docs exist but they would improve context, ask: "Do you have any previous ADRs from legacy systems or decision logs? I can read PDFs directly. Place them in
projects/{project-dir}/external/ and re-run, or skip."
- Citation traceability: When referencing content from external documents, follow the citation instructions in
.arckit/references/citation-instructions.md. Place inline citation markers (e.g., [PP-C1]) next to findings informed by source documents and populate the "External References" section in the template.
1c. Interactive Configuration
Before creating the ADR, ask the user for key decision parameters. Skip any question where the user has already provided a clear answer in their arguments.
Gathering rules — the one-message interview in .arckit/references/interview-pattern.md:
- Prefill from the arguments and the project context; say what you inferred.
- Ask every remaining question in one call. There is no second round.
- An unanswered question takes its (Recommended) option, listed as an assumption in your closing summary. With no question tool available, take every default and never block.
Question 1 — header: Escalation, multiSelect: false
"What escalation level does this architectural decision require?"
- Team: Local implementation decision (frameworks, libraries, testing approaches)
- Cross-team: Affects multiple teams (integration patterns, shared services, APIs)
- Department (Recommended): Department-wide impact (technology standards, cloud providers, security frameworks)
- Cross-government: National infrastructure or cross-department interoperability
Question 2 — header: Options, multiSelect: false
"How many options should be evaluated (plus a 'Do Nothing' baseline)?"
- 3 options (Recommended): Standard analysis — Do Nothing + 2 alternatives provides clear comparison
- 2 options: Quick decision — Do Nothing + 1 proposed approach for straightforward choices
- 4+ options: Comprehensive analysis — Do Nothing + 3+ alternatives for complex technology selections
Apply the user's selections: the escalation level determines the governance forum and stakeholder RACI in the ADR. The option count determines how many alternatives to analyze in the "Considered Options" section (always include "Do Nothing" as baseline).
2. Identify the target project
- Use the ArcKit Project Context (above) to find the project matching the user's input (by name or number)
- If no match, create a new project:
- Use Glob to list
projects/*/ directories and find the highest NNN-* number (or start at 001 if none exist)
- Calculate the next number (zero-padded to 3 digits, e.g.,
002)
- Slugify the project name (lowercase, replace non-alphanumeric with hyphens, trim)
- Use the Write tool to create
projects/{NNN}-{slug}/README.md with the project name, ID, and date — the Write tool will create all parent directories automatically
- Also create
projects/{NNN}-{slug}/external/README.md with a note to place external reference documents here
- Set
PROJECT_ID = the 3-digit number, PROJECT_PATH = the new directory path
3. Create decisions directory and determine ADR number
- Use Glob to find existing
projects/{project-slug}/decisions/ADR-*.md files
- If none found, the next ADR number is
ADR-001
- If found, extract the highest ADR number and increment by 1 (e.g.,
ADR-003 → ADR-004), zero-padded to 3 digits
- The decisions directory will be created automatically when saving the file with the Write tool
4. Read the template (with user override support)
First, check if .arckit/templates-custom/adr-template.md exists in the project root
If found: Read the user's customized template (user override takes precedence)
If not found: Read .arckit/templates/adr-template.md (default)
Then read .arckit/templates/_partials/RENDERING.md and resolve the <!-- DOC-CONTROL-HEADER --> marker in the template before writing. Do not hand-write the Document Control table: the partial RENDERING.md selects is the only source of the 14 standard fields and of the classification ladder.
Tip: Users can customize templates with $arckit-customize adr
5. Gather decision information from user
- Decision title: Short noun phrase (e.g., "Use PostgreSQL for Data Persistence")
- Problem statement: What architectural decision needs to be made?
- Context: Why is this decision needed? Business/technical drivers?
- Status: Proposed (default) / Accepted / Deprecated / Superseded
- Escalation level: Team / Cross-team / Department / Cross-government
- Governance forum: Architecture Review Board, TDA, Programme Board, etc.
6. Generate comprehensive ADR following MADR v4.0 + UK Gov framework
Document Control (see "Auto-Populate Document Control Fields" section below for full details):
Document ID: ARC-{PROJECT_ID}-ADR-{NUM}-v{VERSION} (e.g., ARC-001-ADR-001-v1.0)
ADR Number: ADR-{NUM} (e.g., ADR-001, ADR-002)
Version: ${VERSION} (from Step 0: Detect Version)
Status: Proposed (or as user specified)
Date: Current date (YYYY-MM-DD)
Escalation Level: Based on decision scope
Governance Forum: Based on escalation level
Stakeholders:
Deciders: Who has authority to approve this ADR?
Consulted: Subject matter experts to involve (two-way communication)
Informed: Stakeholders to keep updated (one-way communication)
UK Government Escalation Context:
- Team: Local implementation (frameworks, libraries, testing)
- Cross-team: Integration patterns, shared services, APIs
- Department: Technology standards, cloud providers, security
- Cross-government: National infrastructure, cross-department interoperability
Context and Problem Statement:
Problem description (2-3 sentences or story format)
Why is this decision needed?
Business context (link to BR-xxx requirements)
Technical context (link to FR-xxx, NFR-xxx requirements)
Regulatory context (GDPR, GDS Service Standard, Cyber Essentials)
Supporting links (user stories, requirements, research)
Decision Drivers (Forces):
Technical drivers: Performance, scalability, maintainability, security
- Link to NFR-xxx requirements
- Reference architecture principles
Business drivers: Cost, time to market, risk reduction
- Link to BR-xxx requirements
- Link to stakeholder goals
Regulatory & compliance drivers:
- GDS Service Standard (which points apply?)
- Technology Code of Practice (Point 5: Cloud first, Point 8: Reuse, Point 13: AI)
- NCSC Cyber Security (Cyber Essentials, CAF principles)
- Data Protection (UK GDPR Article 25, 35)
Alignment to architecture principles: Create table showing which principles support/conflict
Considered Options (MINIMUM 2-3 options, always include "Do Nothing"):
For each option:
Description: What is this option?
Implementation approach: How would it be implemented?
Wardley Evolution Stage: Genesis / Custom-Built / Product / Commodity
Good (Pros):
- ✅ Benefits, requirements met, principles supported
- ✅ Quantify where possible (performance, cost savings)
Bad (Cons):
- ❌ Drawbacks, requirements not met, risks
- ❌ Trade-offs and negative consequences
Cost Analysis:
- CAPEX: One-time costs (licenses, hardware, migration)
- OPEX: Ongoing costs (support, training, maintenance per year)
- TCO (3-year): Total cost of ownership
GDS Service Standard Impact: Create table showing impact on relevant points
Option: Do Nothing (Baseline):
Always include this as baseline comparison
Pros: No immediate cost, no risk
Cons: Technical debt accumulates, opportunity cost, compliance risk
Decision Outcome:
Chosen Option: Which option was selected
Y-Statement (structured justification):
In the context of [use case],
facing [concern],
we decided for [option],
to achieve [quality/benefit],
accepting [downside/trade-off].
Justification: Why this option over alternatives?
- Key reasons with evidence
- Stakeholder consensus or dissenting views
- Risk appetite alignment
Consequences:
Positive: Benefits, capabilities enabled, compliance achieved
- Include measurable outcomes (metrics: baseline → target)
Negative: Accepted trade-offs, limitations, technical debt
- Include mitigation strategies
Neutral: Changes needed (training, infrastructure, process, vendors)
Risks and Mitigations: Create table with risk, likelihood, impact, mitigation, owner
- Link to risk register (RISK-xxx)
Validation & Compliance:
How will implementation be verified?
- Design review requirements (HLD, DLD include this decision)
- Code review checklist (PR checklist includes ADR compliance)
- Testing strategy (unit, integration, performance, security tests)
Monitoring & Observability:
- Success metrics (how to measure if goals achieved)
- Alerts and dashboards
Compliance verification:
- GDS Service Assessment: Which points addressed, evidence prepared
- Technology Code of Practice: Which points addressed
- Security assurance: NCSC principles, Cyber Essentials, security testing
- Data protection: DPIA updated, data flows, privacy notice
Links to Supporting Documents:
Requirements traceability:
- Business: BR-xxx requirements addressed
- Functional: FR-xxx requirements addressed
- Non-functional: NFR-xxx requirements addressed
Architecture artifacts:
- Architecture principles: Which influenced this decision
- Stakeholder drivers: Which stakeholder goals supported
- Risk register: Which risks mitigated (RISK-xxx)
- Research findings: Which research sections analyzed these options
- Wardley Maps: Which maps show evolution stage
- Architecture diagrams: Which C4/deployment/sequence diagrams show this
- Strategic roadmap: Which theme/initiative this supports
Design documents:
- High-Level Design: HLD section implementing this
- Detailed Design: DLD specifications
- Data model: If decision affects data structure
External references:
- Standards and RFCs
- Vendor documentation
- UK Government guidance (GDS Service Manual, NCSC, GOV.UK patterns)
- Research and evidence
Implementation Plan:
Dependencies: Prerequisite ADRs, infrastructure, team skills
Implementation timeline: Phases, activities, duration, owners
Rollback plan: Trigger, procedure, owner
Review and Updates:
Review schedule: Initial (3-6 months), periodic (annually)
Review criteria: Metrics met? Assumptions changed? Still optimal?
Trigger events: Version changes, cost changes, security incidents, regulatory changes
Related Decisions:
Depends on: ADR-xxx
Depended on by: ADR-yyy
Conflicts with: ADR-zzz (how resolved)
Appendices (optional):
Options analysis details: Benchmarks, PoC results
Stakeholder consultation log: Date, stakeholder, feedback, action
Mermaid decision flow diagram: Visual representation of decision logic
7. Ensure comprehensive traceability
- Link decision drivers to requirements (BR-xxx, FR-xxx, NFR-xxx)
- Link to architecture principles (show alignment/conflicts)
- Link to stakeholder goals (from ARC-{PROJECT_ID}-STKE-v*.md)
- Link to risk mitigations (from ARC-{PROJECT_ID}-RISK-v*.md)
- Link to research findings (which sections analyzed these options)
- Link to Wardley maps (evolution stage influences choice)
- Link to roadmap (which theme/initiative this supports)
- Create bidirectional traceability chain
8. Create file naming
- Format:
ARC-{PROJECT_ID}-ADR-{NUM}-v{VERSION}.md
- Example:
ARC-001-ADR-001-v1.0.md, ARC-001-ADR-002-v1.0.md
- Path:
projects/{PROJECT_ID}-{project-name}/decisions/ARC-{PROJECT_ID}-ADR-{NUM}-v{VERSION}.md
- Sequence number auto-assigned from existing files in the directory
Before writing the file, read .arckit/references/quality-checklist.md and verify all Common Checks plus the ADR per-type checks pass. Fix any failures before proceeding.
9. Use Write tool to create the ADR file
- CRITICAL: Because ADRs are very large documents (500+ lines), you MUST use the Write tool to create the file
- Do NOT output the full ADR content in your response (this will exceed token limits)
- Use Write tool with the full ADR content
- Path:
projects/{PROJECT_ID}-{project-name}/decisions/ARC-{PROJECT_ID}-ADR-{NUM}-v${VERSION}.md
CRITICAL - Auto-Populate Document Control Fields:
Before completing the document, populate ALL document control fields in the header:
Step 0: Detect Version
Before generating the document ID, check if a previous version exists:
ADRs are multi-instance documents. Version detection depends on whether you are creating a new ADR or updating an existing one:
Creating a new ADR (default): Use VERSION="1.0" — the ADR number is auto-incremented by --next-num.
Updating an existing ADR (user explicitly references an existing ADR number, e.g., "update ADR-001", "revise ADR-003"):
- Look for existing
ARC-{PROJECT_ID}-ADR-{NUM}-v*.md files in projects/{project-dir}/decisions/
- If no existing file: Use VERSION="1.0"
- If existing file found:
- Read the existing document to understand its current state
- Compare against current inputs and the decision being made
- Minor increment (e.g., 1.0 → 1.1): Status change, updated evidence, corrected details, same decision outcome
- Major increment (e.g., 1.0 → 2.0): Decision outcome changed, options re-evaluated, fundamentally different justification
- Use the determined version for document ID, filename, Document Control, and Revision History
- For v1.1+/v2.0+: Add a Revision History entry describing what changed from the previous version
Step 1: Construct Document ID
- Document ID:
ARC-{PROJECT_ID}-ADR-{NNN}-v{VERSION} (e.g., ARC-001-ADR-001-v1.0)
- Sequence number
{NNN}: Check existing files in decisions/ and use the next number (001, 002, ...)
Step 2: Populate Required Fields
Auto-populated fields (populate these automatically):
[PROJECT_ID] → Extract from project path (e.g., "001" from "projects/001-project-name")
[VERSION] → Determined version from Step 0
[DATE] / [YYYY-MM-DD] → Current date in YYYY-MM-DD format
[DOCUMENT_TYPE_NAME] → "Architecture Decision Record"
ARC-[PROJECT_ID]-ADR-[NUM]-v[VERSION] → Construct using format from Step 1
[COMMAND] → "arckit.adr"
User-provided fields (extract from project metadata or user input):
[PROJECT_NAME] → Full project name from project metadata or user input
[OWNER_NAME_AND_ROLE] → Document owner (prompt user if not in metadata)
- Classification → comes from the resolved Document Control header, not from a placeholder.
_partials/RENDERING.md fixes the ladder from the artefact's own regime; ${default_classification} applies only where that regime falls through to user config.
Calculated fields:
[YYYY-MM-DD] for Next Review Date → Current date + 30 days (requirements, research, risks)
[YYYY-MM-DD] for Next Review Date → Phase gate dates (Alpha/Beta/Live for compliance docs)
Pending fields (leave as [PENDING] until manually updated):
[REVIEWER_NAME] → [PENDING]
[APPROVER_NAME] → [PENDING]
[DISTRIBUTION_LIST] → Default to "Project Team, Architecture Team" or [PENDING]
Step 3: Populate Revision History
| 1.0 | {DATE} | ArcKit AI | Initial creation from `$arckit-adr` command | [PENDING] | [PENDING] |
Step 4: Populate Generation Metadata Footer
The footer should be populated with:
**Generated by**: ArcKit `$arckit-adr` command
**Generated on**: {DATE} {TIME} GMT
**ArcKit Version**: {ARCKIT_VERSION}
**Project**: {PROJECT_NAME} (Project {PROJECT_ID})
**AI Model**: [Use actual model name, e.g., "Claude Sonnet 5 (session default)"]
**Generation Context**: [Brief note about source documents used]
Example Rendered Header and Revision History
## Document Control
<!-- DOC-CONTROL-HEADER -->
<!-- Resolved at command-execution time per _partials/RENDERING.md. -->
## Revision History
| Version | Date | Author | Changes | Approved By | Approval Date |
|---------|------|--------|---------|-------------|---------------|
| 1.0 | 2025-10-29 | ArcKit AI | Initial creation from `$arckit-adr` command | [PENDING] | [PENDING] |
10. Show summary to user (NOT full document)
## Architecture Decision Record Created
**ADR Number**: ADR-{NUM}
**Title**: {Decision title}
**Status**: {Proposed/Accepted/etc}
**File**: `projects/{PROJECT_ID}-{project-name}/decisions/ARC-{PROJECT_ID}-ADR-{NUM}-v${VERSION}.md`
### Chosen Option
{Option name}
### Y-Statement
> In the context of {use case},
> facing {concern},
> we decided for {option},
> to achieve {quality},
> accepting {downside}.
### Options Considered
- Option 1: {Name} - {Brief summary}
- Option 2: {Name} - {Brief summary}
- Option 3: Do Nothing - Baseline comparison
### Key Consequences
**Positive**:
- {Benefit 1}
- {Benefit 2}
**Negative** (accepted trade-offs):
- {Trade-off 1}
- {Trade-off 2}
### Decision Drivers
- {Driver 1}: {Brief description}
- {Driver 2}: {Brief description}
### Requirements Addressed
- BR-XXX: {Business requirement}
- FR-XXX: {Functional requirement}
- NFR-XXX: {Non-functional requirement}
### Traceability Links
- Architecture principles: {Count} principles referenced
- Stakeholder goals: {Count} goals supported
- Requirements: {Count} requirements addressed
- Risks: {Count} risks mitigated
### Next Steps
- [ ] Stakeholder review and approval
- [ ] Update status to "Accepted" once approved
- [ ] Reflect decision in HLD/DLD
- [ ] Update architecture diagrams
- [ ] Implement decision
- [ ] Verify with testing
- [ ] Schedule ADR review ({Date})
### UK Government Compliance
**Escalation Level**: {Level}
**Governance Forum**: {Forum}
**GDS Service Standard**: Points {X, Y, Z} addressed
**Technology Code of Practice**: Points {A, B, C} addressed
11. Provide guidance on ADR lifecycle
- Status transitions:
- Proposed → Accepted (after approval)
- Accepted → Superseded (when replaced by new ADR)
- Accepted → Deprecated (when no longer recommended but not replaced)
- When to create new ADR:
- Significant architectural decision affecting structure, behavior, or quality attributes
- Technology choices (databases, frameworks, cloud services, APIs)
- Integration patterns and protocols
- Security and compliance approaches
- Deployment and infrastructure decisions
- Data management and privacy decisions
- When NOT to create ADR:
- Minor implementation details (variable names, coding style)
- Temporary workarounds or fixes
- Decisions that don't affect other teams or systems
- ADR numbering:
- Sequential: ADR-001, ADR-002, ADR-003, etc.
- Never reuse numbers (even if ADR is superseded)
- Superseded ADRs remain in place with updated status
Important Notes
Token Limit: ADRs are very large documents. Always use Write tool to create the file, never output full content
Minimum Options: Always analyze at least 2-3 options plus "Do Nothing" baseline
Y-Statement: This is the concise justification format - always include it
Traceability: Every ADR must link to requirements, principles, stakeholders, risks
UK Government: Include escalation level and governance forum for compliance
MADR Format: Follow MADR v4.0 structure (Context, Decision Drivers, Options, Outcome, Consequences)
Evidence-Based: Decisions should be supported by research findings, benchmarks, PoCs
Wardley Evolution: Consider evolution stage (Genesis/Custom/Product/Commodity) when choosing options
GDS Service Standard: Document which Service Standard points the decision addresses
Technology Code of Practice: Show TCoP compliance (Point 5: Cloud first, Point 8: Reuse, etc.)
Security: Include NCSC guidance, Cyber Essentials, security testing requirements
Review Schedule: Every ADR needs review schedule and trigger events for re-evaluation
Rollback Plan: Document how to rollback if decision proves wrong
Cost Analysis: Always include CAPEX, OPEX, TCO for each option
Consequences: Be explicit about both positive and negative consequences
Validation: Define how implementation will be verified (review, testing, monitoring)
Markdown escaping: When writing less-than or greater-than comparisons, always include a space after < or > (e.g., < 3 seconds, > 99.9% uptime) to prevent markdown renderers from interpreting them as HTML tags or emoji
Example Decision Titles
- "Use PostgreSQL for Transactional Data Persistence"
- "Adopt API Gateway Pattern for Service Integration"
- "Deploy on Azure Government Cloud"
- "Implement OAuth 2.0 with Azure AD for Authentication"
- "Use Event-Driven Architecture for Real-Time Processing"
- "Choose React with TypeScript for Frontend Development"
- "Implement Microservices over Monolithic Architecture"
- "Use Terraform for Infrastructure as Code"
- "Adopt Kubernetes for Container Orchestration"
- "Implement CQRS Pattern for Read/Write Separation"
UK Government Escalation Guidance
| Level |
Decision Makers |
Example Decisions |
Governance Forum |
| Team |
Tech Lead, Senior Developers |
Framework choice, testing strategy, code patterns |
Team standup, Sprint review |
| Cross-team |
Technical Architects, Lead Engineers |
Integration patterns, API standards, shared libraries |
Architecture Forum, Technical Design Review |
| Department |
Enterprise Architects, CTO, Architecture Board |
Cloud provider, security framework, technology standards |
Architecture Review Board, Enterprise Architecture Board |
| Cross-government |
Technical Design Authority, GDS |
National infrastructure, cross-department APIs, GOV.UK standards |
Technical Design Council, GDS Architecture Community |
Suggested Next Steps
After completing this command, consider running:
$arckit-hld-review -- Reflect decision in High-Level Design
$arckit-diagram -- Update architecture diagrams
$arckit-traceability -- Update traceability matrix with decision links
1---2name: arckit-adr3description: Document architectural decisions with options analysis and traceability4---56You are helping an enterprise architect create an Architecture Decision Record (ADR) following MADR v4.0 format enhanced with UK Government requirements.78## User Input910```text11$ARGUMENTS12```1314## Instructions1516> **Note**: Before generating, scan `projects/` for existing project directories. For each project, list all `ARC-*.md` artifacts, check `external/` for reference documents, and check `000-global/` for cross-project policies. If no external docs exist but they would improve output, ask the user.1718### 1. **Read existing artifacts from the project context:**1920**MANDATORY** (warn if missing):2122- **PRIN** (Architecture Principles, in 000-global)23 - Extract: Technology standards, constraints, compliance requirements that inform decision drivers24 - If missing: warn user to run `$arckit-principles` first25- **REQ** (Requirements)26 - Extract: BR/FR/NFR/INT/DR IDs that this decision addresses27 - If missing: warn user to run `$arckit-requirements` first2829**RECOMMENDED** (read if available, note if missing):3031- **RISK** (Risk Register)32 - Extract: Risks this decision mitigates, risk appetite context3334**OPTIONAL** (read if available, skip silently if missing):3536- **RSCH** (Research Findings) or **AWSR** / **AZUR** (Cloud Research)37 - Extract: Options already analyzed, vendor comparisons, TCO data38- **STKE** (Stakeholder Analysis)39 - Extract: Stakeholder goals, decision authority, RACI context40- **WARD** (Wardley Map)41 - Extract: Evolution stage influences on build vs buy choices4243### 1b. **Read external documents and policies**4445- Read any **external documents** listed in the project context (`external/` files) — extract previous architectural decisions, decision rationale, options considered, decision outcomes46- Read any **enterprise standards** in `projects/000-global/external/` — extract enterprise decision frameworks, architecture review board templates, cross-project decision logs47- If no external docs exist but they would improve context, ask: "Do you have any previous ADRs from legacy systems or decision logs? I can read PDFs directly. Place them in `projects/{project-dir}/external/` and re-run, or skip."48- **Citation traceability**: When referencing content from external documents, follow the citation instructions in `.arckit/references/citation-instructions.md`. Place inline citation markers (e.g., `[PP-C1]`) next to findings informed by source documents and populate the "External References" section in the template.4950### 1c. **Interactive Configuration**5152Before creating the ADR, ask the user for key decision parameters. **Skip any question where the user has already provided a clear answer in their arguments.**5354**Gathering rules** — the one-message interview in `.arckit/references/interview-pattern.md`:5556- Prefill from the arguments and the project context; say what you inferred.57- Ask every remaining question in **one** call. There is no second round.58- An unanswered question takes its **(Recommended)** option, listed as an assumption in your closing summary. With no question tool available, take every default and never block.5960**Question 1** — header: `Escalation`, multiSelect: false61> "What escalation level does this architectural decision require?"6263- **Team**: Local implementation decision (frameworks, libraries, testing approaches)64- **Cross-team**: Affects multiple teams (integration patterns, shared services, APIs)65- **Department (Recommended)**: Department-wide impact (technology standards, cloud providers, security frameworks)66- **Cross-government**: National infrastructure or cross-department interoperability6768**Question 2** — header: `Options`, multiSelect: false69> "How many options should be evaluated (plus a 'Do Nothing' baseline)?"7071- **3 options (Recommended)**: Standard analysis — Do Nothing + 2 alternatives provides clear comparison72- **2 options**: Quick decision — Do Nothing + 1 proposed approach for straightforward choices73- **4+ options**: Comprehensive analysis — Do Nothing + 3+ alternatives for complex technology selections7475Apply the user's selections: the escalation level determines the governance forum and stakeholder RACI in the ADR. The option count determines how many alternatives to analyze in the "Considered Options" section (always include "Do Nothing" as baseline).7677### 2. **Identify the target project**7879- Use the **ArcKit Project Context** (above) to find the project matching the user's input (by name or number)80- If no match, create a new project:81 1. Use Glob to list `projects/*/` directories and find the highest `NNN-*` number (or start at `001` if none exist)82 2. Calculate the next number (zero-padded to 3 digits, e.g., `002`)83 3. Slugify the project name (lowercase, replace non-alphanumeric with hyphens, trim)84 4. Use the Write tool to create `projects/{NNN}-{slug}/README.md` with the project name, ID, and date — the Write tool will create all parent directories automatically85 5. Also create `projects/{NNN}-{slug}/external/README.md` with a note to place external reference documents here86 6. Set `PROJECT_ID` = the 3-digit number, `PROJECT_PATH` = the new directory path8788### 3. **Create decisions directory and determine ADR number**8990- Use Glob to find existing `projects/{project-slug}/decisions/ADR-*.md` files91- If none found, the next ADR number is `ADR-001`92- If found, extract the highest ADR number and increment by 1 (e.g., `ADR-003` → `ADR-004`), zero-padded to 3 digits93- The decisions directory will be created automatically when saving the file with the Write tool9495### 4. **Read the template** (with user override support)9697- **First**, check if `.arckit/templates-custom/adr-template.md` exists in the project root98- **If found**: Read the user's customized template (user override takes precedence)99- **If not found**: Read `.arckit/templates/adr-template.md` (default)100- **Then read** `.arckit/templates/_partials/RENDERING.md` and resolve the `<!-- DOC-CONTROL-HEADER -->` marker in the template before writing. Do not hand-write the Document Control table: the partial `RENDERING.md` selects is the only source of the 14 standard fields and of the classification ladder.101102 > **Tip**: Users can customize templates with `$arckit-customize adr`103104### 5. **Gather decision information from user**105106- **Decision title**: Short noun phrase (e.g., "Use PostgreSQL for Data Persistence")107- **Problem statement**: What architectural decision needs to be made?108- **Context**: Why is this decision needed? Business/technical drivers?109- **Status**: Proposed (default) / Accepted / Deprecated / Superseded110- **Escalation level**: Team / Cross-team / Department / Cross-government111- **Governance forum**: Architecture Review Board, TDA, Programme Board, etc.112113### 6. **Generate comprehensive ADR** following MADR v4.0 + UK Gov framework114115 **Document Control** (see "Auto-Populate Document Control Fields" section below for full details):116117- Document ID: `ARC-{PROJECT_ID}-ADR-{NUM}-v{VERSION}` (e.g., `ARC-001-ADR-001-v1.0`)118- ADR Number: ADR-{NUM} (e.g., ADR-001, ADR-002)119- Version: ${VERSION} (from Step 0: Detect Version)120- Status: Proposed (or as user specified)121- Date: Current date (YYYY-MM-DD)122- Escalation Level: Based on decision scope123- Governance Forum: Based on escalation level124125 **Stakeholders**:126127- **Deciders**: Who has authority to approve this ADR?128- **Consulted**: Subject matter experts to involve (two-way communication)129- **Informed**: Stakeholders to keep updated (one-way communication)130- **UK Government Escalation Context**:131 - Team: Local implementation (frameworks, libraries, testing)132 - Cross-team: Integration patterns, shared services, APIs133 - Department: Technology standards, cloud providers, security134 - Cross-government: National infrastructure, cross-department interoperability135136 **Context and Problem Statement**:137138- Problem description (2-3 sentences or story format)139- Why is this decision needed?140- Business context (link to BR-xxx requirements)141- Technical context (link to FR-xxx, NFR-xxx requirements)142- Regulatory context (GDPR, GDS Service Standard, Cyber Essentials)143- Supporting links (user stories, requirements, research)144145 **Decision Drivers (Forces)**:146147- **Technical drivers**: Performance, scalability, maintainability, security148 - Link to NFR-xxx requirements149 - Reference architecture principles150- **Business drivers**: Cost, time to market, risk reduction151 - Link to BR-xxx requirements152 - Link to stakeholder goals153- **Regulatory & compliance drivers**:154 - GDS Service Standard (which points apply?)155 - Technology Code of Practice (Point 5: Cloud first, Point 8: Reuse, Point 13: AI)156 - NCSC Cyber Security (Cyber Essentials, CAF principles)157 - Data Protection (UK GDPR Article 25, 35)158- **Alignment to architecture principles**: Create table showing which principles support/conflict159160 **Considered Options** (MINIMUM 2-3 options, always include "Do Nothing"):161162 For each option:163164- **Description**: What is this option?165- **Implementation approach**: How would it be implemented?166- **Wardley Evolution Stage**: Genesis / Custom-Built / Product / Commodity167- **Good (Pros)**:168 - ✅ Benefits, requirements met, principles supported169 - ✅ Quantify where possible (performance, cost savings)170- **Bad (Cons)**:171 - ❌ Drawbacks, requirements not met, risks172 - ❌ Trade-offs and negative consequences173- **Cost Analysis**:174 - CAPEX: One-time costs (licenses, hardware, migration)175 - OPEX: Ongoing costs (support, training, maintenance per year)176 - TCO (3-year): Total cost of ownership177- **GDS Service Standard Impact**: Create table showing impact on relevant points178179 **Option: Do Nothing (Baseline)**:180181- Always include this as baseline comparison182- Pros: No immediate cost, no risk183- Cons: Technical debt accumulates, opportunity cost, compliance risk184185 **Decision Outcome**:186187- **Chosen Option**: Which option was selected188- **Y-Statement** (structured justification):189 > In the context of [use case],190 > facing [concern],191 > we decided for [option],192 > to achieve [quality/benefit],193 > accepting [downside/trade-off].194- **Justification**: Why this option over alternatives?195 - Key reasons with evidence196 - Stakeholder consensus or dissenting views197 - Risk appetite alignment198199 **Consequences**:200201- **Positive**: Benefits, capabilities enabled, compliance achieved202 - Include measurable outcomes (metrics: baseline → target)203- **Negative**: Accepted trade-offs, limitations, technical debt204 - Include mitigation strategies205- **Neutral**: Changes needed (training, infrastructure, process, vendors)206- **Risks and Mitigations**: Create table with risk, likelihood, impact, mitigation, owner207 - Link to risk register (RISK-xxx)208209 **Validation & Compliance**:210211- **How will implementation be verified?**212 - Design review requirements (HLD, DLD include this decision)213 - Code review checklist (PR checklist includes ADR compliance)214 - Testing strategy (unit, integration, performance, security tests)215- **Monitoring & Observability**:216 - Success metrics (how to measure if goals achieved)217 - Alerts and dashboards218- **Compliance verification**:219 - GDS Service Assessment: Which points addressed, evidence prepared220 - Technology Code of Practice: Which points addressed221 - Security assurance: NCSC principles, Cyber Essentials, security testing222 - Data protection: DPIA updated, data flows, privacy notice223224 **Links to Supporting Documents**:225226- **Requirements traceability**:227 - Business: BR-xxx requirements addressed228 - Functional: FR-xxx requirements addressed229 - Non-functional: NFR-xxx requirements addressed230- **Architecture artifacts**:231 - Architecture principles: Which influenced this decision232 - Stakeholder drivers: Which stakeholder goals supported233 - Risk register: Which risks mitigated (RISK-xxx)234 - Research findings: Which research sections analyzed these options235 - Wardley Maps: Which maps show evolution stage236 - Architecture diagrams: Which C4/deployment/sequence diagrams show this237 - Strategic roadmap: Which theme/initiative this supports238- **Design documents**:239 - High-Level Design: HLD section implementing this240 - Detailed Design: DLD specifications241 - Data model: If decision affects data structure242- **External references**:243 - Standards and RFCs244 - Vendor documentation245 - UK Government guidance (GDS Service Manual, NCSC, GOV.UK patterns)246 - Research and evidence247248 **Implementation Plan**:249250- **Dependencies**: Prerequisite ADRs, infrastructure, team skills251- **Implementation timeline**: Phases, activities, duration, owners252- **Rollback plan**: Trigger, procedure, owner253254 **Review and Updates**:255256- **Review schedule**: Initial (3-6 months), periodic (annually)257- **Review criteria**: Metrics met? Assumptions changed? Still optimal?258- **Trigger events**: Version changes, cost changes, security incidents, regulatory changes259260 **Related Decisions**:261262- **Depends on**: ADR-xxx263- **Depended on by**: ADR-yyy264- **Conflicts with**: ADR-zzz (how resolved)265266 **Appendices** (optional):267268- **Options analysis details**: Benchmarks, PoC results269- **Stakeholder consultation log**: Date, stakeholder, feedback, action270- **Mermaid decision flow diagram**: Visual representation of decision logic271272### 7. **Ensure comprehensive traceability**273274- Link decision drivers to requirements (BR-xxx, FR-xxx, NFR-xxx)275- Link to architecture principles (show alignment/conflicts)276- Link to stakeholder goals (from ARC-{PROJECT_ID}-STKE-v*.md)277- Link to risk mitigations (from ARC-{PROJECT_ID}-RISK-v*.md)278- Link to research findings (which sections analyzed these options)279- Link to Wardley maps (evolution stage influences choice)280- Link to roadmap (which theme/initiative this supports)281- Create bidirectional traceability chain282283### 8. **Create file naming**284285- **Format**: `ARC-{PROJECT_ID}-ADR-{NUM}-v{VERSION}.md`286- **Example**: `ARC-001-ADR-001-v1.0.md`, `ARC-001-ADR-002-v1.0.md`287- **Path**: `projects/{PROJECT_ID}-{project-name}/decisions/ARC-{PROJECT_ID}-ADR-{NUM}-v{VERSION}.md`288- Sequence number auto-assigned from existing files in the directory289290Before writing the file, read `.arckit/references/quality-checklist.md` and verify all **Common Checks** plus the **ADR** per-type checks pass. Fix any failures before proceeding.291292### 9. **Use Write tool to create the ADR file**293294- **CRITICAL**: Because ADRs are very large documents (500+ lines), you MUST use the Write tool to create the file295- Do NOT output the full ADR content in your response (this will exceed token limits)296- Use Write tool with the full ADR content297- Path: `projects/{PROJECT_ID}-{project-name}/decisions/ARC-{PROJECT_ID}-ADR-{NUM}-v${VERSION}.md`298299**CRITICAL - Auto-Populate Document Control Fields**:300301Before completing the document, populate ALL document control fields in the header:302303### Step 0: Detect Version304305Before generating the document ID, check if a previous version exists:306307ADRs are multi-instance documents. Version detection depends on whether you are creating a **new** ADR or **updating** an existing one:308309**Creating a new ADR** (default): Use `VERSION="1.0"` — the ADR number is auto-incremented by `--next-num`.310311**Updating an existing ADR** (user explicitly references an existing ADR number, e.g., "update ADR-001", "revise ADR-003"):3123131. Look for existing `ARC-{PROJECT_ID}-ADR-{NUM}-v*.md` files in `projects/{project-dir}/decisions/`3142. **If no existing file**: Use VERSION="1.0"3153. **If existing file found**:316 - Read the existing document to understand its current state317 - Compare against current inputs and the decision being made318 - **Minor increment** (e.g., 1.0 → 1.1): Status change, updated evidence, corrected details, same decision outcome319 - **Major increment** (e.g., 1.0 → 2.0): Decision outcome changed, options re-evaluated, fundamentally different justification3204. Use the determined version for document ID, filename, Document Control, and Revision History3215. For v1.1+/v2.0+: Add a Revision History entry describing what changed from the previous version322323### Step 1: Construct Document ID324325- **Document ID**: `ARC-{PROJECT_ID}-ADR-{NNN}-v{VERSION}` (e.g., `ARC-001-ADR-001-v1.0`)326- Sequence number `{NNN}`: Check existing files in `decisions/` and use the next number (001, 002, ...)327328### Step 2: Populate Required Fields329330**Auto-populated fields** (populate these automatically):331332- `[PROJECT_ID]` → Extract from project path (e.g., "001" from "projects/001-project-name")333- `[VERSION]` → Determined version from Step 0334- `[DATE]` / `[YYYY-MM-DD]` → Current date in YYYY-MM-DD format335- `[DOCUMENT_TYPE_NAME]` → "Architecture Decision Record"336- `ARC-[PROJECT_ID]-ADR-[NUM]-v[VERSION]` → Construct using format from Step 1337- `[COMMAND]` → "arckit.adr"338339**User-provided fields** (extract from project metadata or user input):340341- `[PROJECT_NAME]` → Full project name from project metadata or user input342- `[OWNER_NAME_AND_ROLE]` → Document owner (prompt user if not in metadata)343- **Classification** → comes from the resolved Document Control header, not from a placeholder. `_partials/RENDERING.md` fixes the ladder from the artefact's own regime; `${default_classification}` applies only where that regime falls through to user config.344345**Calculated fields**:346347- `[YYYY-MM-DD]` for Next Review Date → Current date + 30 days (requirements, research, risks)348- `[YYYY-MM-DD]` for Next Review Date → Phase gate dates (Alpha/Beta/Live for compliance docs)349350**Pending fields** (leave as [PENDING] until manually updated):351352- `[REVIEWER_NAME]` → [PENDING]353- `[APPROVER_NAME]` → [PENDING]354- `[DISTRIBUTION_LIST]` → Default to "Project Team, Architecture Team" or [PENDING]355356### Step 3: Populate Revision History357358```markdown359| 1.0 | {DATE} | ArcKit AI | Initial creation from `$arckit-adr` command | [PENDING] | [PENDING] |360```361362### Step 4: Populate Generation Metadata Footer363364The footer should be populated with:365366```markdown367**Generated by**: ArcKit `$arckit-adr` command368**Generated on**: {DATE} {TIME} GMT369**ArcKit Version**: {ARCKIT_VERSION}370**Project**: {PROJECT_NAME} (Project {PROJECT_ID})371**AI Model**: [Use actual model name, e.g., "Claude Sonnet 5 (session default)"]372**Generation Context**: [Brief note about source documents used]373```374375### Example Rendered Header and Revision History376377```markdown378## Document Control379380<!-- DOC-CONTROL-HEADER -->381<!-- Resolved at command-execution time per _partials/RENDERING.md. -->382383## Revision History384385| Version | Date | Author | Changes | Approved By | Approval Date |386|---------|------|--------|---------|-------------|---------------|387| 1.0 | 2025-10-29 | ArcKit AI | Initial creation from `$arckit-adr` command | [PENDING] | [PENDING] |388```389390### 10. **Show summary to user** (NOT full document)391392 ```markdown393 ## Architecture Decision Record Created394395 **ADR Number**: ADR-{NUM}396 **Title**: {Decision title}397 **Status**: {Proposed/Accepted/etc}398 **File**: `projects/{PROJECT_ID}-{project-name}/decisions/ARC-{PROJECT_ID}-ADR-{NUM}-v${VERSION}.md`399400 ### Chosen Option401 {Option name}402403 ### Y-Statement404 > In the context of {use case},405 > facing {concern},406 > we decided for {option},407 > to achieve {quality},408 > accepting {downside}.409410 ### Options Considered411 - Option 1: {Name} - {Brief summary}412 - Option 2: {Name} - {Brief summary}413 - Option 3: Do Nothing - Baseline comparison414415 ### Key Consequences416 **Positive**:417 - {Benefit 1}418 - {Benefit 2}419420 **Negative** (accepted trade-offs):421 - {Trade-off 1}422 - {Trade-off 2}423424 ### Decision Drivers425 - {Driver 1}: {Brief description}426 - {Driver 2}: {Brief description}427428 ### Requirements Addressed429 - BR-XXX: {Business requirement}430 - FR-XXX: {Functional requirement}431 - NFR-XXX: {Non-functional requirement}432433 ### Traceability Links434 - Architecture principles: {Count} principles referenced435 - Stakeholder goals: {Count} goals supported436 - Requirements: {Count} requirements addressed437 - Risks: {Count} risks mitigated438439 ### Next Steps440 - [ ] Stakeholder review and approval441 - [ ] Update status to "Accepted" once approved442 - [ ] Reflect decision in HLD/DLD443 - [ ] Update architecture diagrams444 - [ ] Implement decision445 - [ ] Verify with testing446 - [ ] Schedule ADR review ({Date})447448 ### UK Government Compliance449 **Escalation Level**: {Level}450 **Governance Forum**: {Forum}451 **GDS Service Standard**: Points {X, Y, Z} addressed452 **Technology Code of Practice**: Points {A, B, C} addressed453 ```454455### 11. **Provide guidance on ADR lifecycle**456457- **Status transitions**:458 - Proposed → Accepted (after approval)459 - Accepted → Superseded (when replaced by new ADR)460 - Accepted → Deprecated (when no longer recommended but not replaced)461- **When to create new ADR**:462 - Significant architectural decision affecting structure, behavior, or quality attributes463 - Technology choices (databases, frameworks, cloud services, APIs)464 - Integration patterns and protocols465 - Security and compliance approaches466 - Deployment and infrastructure decisions467 - Data management and privacy decisions468- **When NOT to create ADR**:469 - Minor implementation details (variable names, coding style)470 - Temporary workarounds or fixes471 - Decisions that don't affect other teams or systems472- **ADR numbering**:473 - Sequential: ADR-001, ADR-002, ADR-003, etc.474 - Never reuse numbers (even if ADR is superseded)475 - Superseded ADRs remain in place with updated status476477## Important Notes478479- **Token Limit**: ADRs are very large documents. Always use Write tool to create the file, never output full content480- **Minimum Options**: Always analyze at least 2-3 options plus "Do Nothing" baseline481- **Y-Statement**: This is the concise justification format - always include it482- **Traceability**: Every ADR must link to requirements, principles, stakeholders, risks483- **UK Government**: Include escalation level and governance forum for compliance484- **MADR Format**: Follow MADR v4.0 structure (Context, Decision Drivers, Options, Outcome, Consequences)485- **Evidence-Based**: Decisions should be supported by research findings, benchmarks, PoCs486- **Wardley Evolution**: Consider evolution stage (Genesis/Custom/Product/Commodity) when choosing options487- **GDS Service Standard**: Document which Service Standard points the decision addresses488- **Technology Code of Practice**: Show TCoP compliance (Point 5: Cloud first, Point 8: Reuse, etc.)489- **Security**: Include NCSC guidance, Cyber Essentials, security testing requirements490- **Review Schedule**: Every ADR needs review schedule and trigger events for re-evaluation491- **Rollback Plan**: Document how to rollback if decision proves wrong492- **Cost Analysis**: Always include CAPEX, OPEX, TCO for each option493- **Consequences**: Be explicit about both positive and negative consequences494- **Validation**: Define how implementation will be verified (review, testing, monitoring)495496- **Markdown escaping**: When writing less-than or greater-than comparisons, always include a space after `<` or `>` (e.g., `< 3 seconds`, `> 99.9% uptime`) to prevent markdown renderers from interpreting them as HTML tags or emoji497498## Example Decision Titles499500- "Use PostgreSQL for Transactional Data Persistence"501- "Adopt API Gateway Pattern for Service Integration"502- "Deploy on Azure Government Cloud"503- "Implement OAuth 2.0 with Azure AD for Authentication"504- "Use Event-Driven Architecture for Real-Time Processing"505- "Choose React with TypeScript for Frontend Development"506- "Implement Microservices over Monolithic Architecture"507- "Use Terraform for Infrastructure as Code"508- "Adopt Kubernetes for Container Orchestration"509- "Implement CQRS Pattern for Read/Write Separation"510511## UK Government Escalation Guidance512513| Level | Decision Makers | Example Decisions | Governance Forum |514|-------|----------------|-------------------|------------------|515| **Team** | Tech Lead, Senior Developers | Framework choice, testing strategy, code patterns | Team standup, Sprint review |516| **Cross-team** | Technical Architects, Lead Engineers | Integration patterns, API standards, shared libraries | Architecture Forum, Technical Design Review |517| **Department** | Enterprise Architects, CTO, Architecture Board | Cloud provider, security framework, technology standards | Architecture Review Board, Enterprise Architecture Board |518| **Cross-government** | Technical Design Authority, GDS | National infrastructure, cross-department APIs, GOV.UK standards | Technical Design Council, GDS Architecture Community |519520## Suggested Next Steps521522After completing this command, consider running:523524- `$arckit-hld-review` -- Reflect decision in High-Level Design525- `$arckit-diagram` -- Update architecture diagrams526- `$arckit-traceability` -- Update traceability matrix with decision links