plan
Decision
Architecture decision record capturing context, options, rationale, and consequences
Install
- Add the package:
npm install @refrakt-md/plan - Add it to the
pluginsarray inrefrakt.config.json:"plugins": ["@refrakt-md/plan"]
Source
import { createContentModelSchema, slotSections } from '@refrakt-md/runes';
import type { EmitsDeclaration } from '@refrakt-md/runes';
import { VALID_STATUS } from '../commands/enums.js';
export const decisionEmits = {
rune: 'decision',
tag: 'article',
properties: {
id: '',
status: 'proposed',
date: '',
supersedes: '',
source: '',
tags: '',
created: { from: ['attrs.created', 'file.created'], default: '' },
modified: { from: ['attrs.modified', 'file.modified'], default: '' },
},
slots: {
title: { as: 'region', el: 'header' },
blurb: { from: 'description', as: 'region', omitWhenEmpty: true },
intro: { as: 'region', omitWhenEmpty: true, role: 'body' },
body: { from: 'sections', as: 'region' },
},
} satisfies EmitsDeclaration;
export const decisionSections = slotSections(decisionEmits);
export const decision = createContentModelSchema({
provides: ['prose'],
attributes: {
id: { type: String, required: true, description: 'Identifier (e.g., "ADR-007").' },
status: {
type: String,
required: false,
matches: [...VALID_STATUS.decision],
description: 'Decision status: proposed, accepted, rejected, superseded, or deprecated.',
},
date: { type: String, required: false, description: 'Date decided (ISO 8601).' },
supersedes: { type: String, required: false, description: 'ID of the decision this replaces.' },
source: {
type: String,
required: false,
description: 'Comma-separated IDs of specs or other entities this decision informs.',
},
tags: { type: String, required: false, description: 'Comma-separated labels.' },
created: {
type: String,
required: false,
description: 'Creation date (ISO 8601). Defaults to file creation date from git.',
},
modified: {
type: String,
required: false,
description: 'Last modified date (ISO 8601). Defaults to file modification date from git.',
},
},
contentModel: () => ({
type: 'sections' as const,
sectionHeading: 'heading:2',
fields: [
{ name: 'title', match: 'heading', optional: false },
{ name: 'description', match: 'paragraph', optional: true, greedy: true },
{ name: 'intro', match: 'any', optional: true, greedy: true },
],
sectionModel: {
type: 'sequence' as const,
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
},
knownSections: {
Context: {
alias: ['Background'],
},
'Options Considered': {
alias: ['Options', 'Alternatives'],
},
Decision: {},
Rationale: {
alias: ['Reasoning'],
},
Consequences: {
alias: ['Impact', 'Trade-offs'],
},
},
}),
emits: decisionEmits,
});
Architecture decision record. Captures the context, options considered, the decision made, the rationale, and the consequences. The most important rune in the package for AI-native workflows — without decision records, every AI session starts from zero context.
Also available as {% adr %}.
Accepted decision
A fully documented architecture decision record.
{% decision id="ADR-9007" status="accepted" date="2026-03-11" tags="tint,css" %}
# Use CSS custom properties for tint token injection
## Context
Tint runes need to override color tokens within a section scope. The solution must work without JavaScript and cascade through nested elements.
## Options Considered
1. **CSS custom properties on the container** — inline styles setting `--tint-*` tokens, theme bridges via `var()` fallbacks.
2. **Generated CSS classes per tint combination** — build step creates per-tint classes. Avoids inline styles but combinatorial explosion.
3. **JavaScript runtime token injection** — behaviour script reads data attributes and sets styles. Most flexible but requires JS.
## Decision
CSS custom properties via inline styles on the container element.
## Rationale
Custom properties cascade naturally through the DOM subtree without JavaScript. Themes opt into tint support by including bridge CSS. The `--tint-*` namespace avoids collisions with theme-internal tokens.
## Consequences
- Themes must include the tint bridge CSS
- Inline styles cannot use media queries — dark mode handled separately
- Inspector must audit tint token contrast ratios
{% /decision %}<article data-rune="decision" data-rune-fields="{"id":"ADR-9007","status":"accepted","date":"2026-03-11","supersedes":"","source":"","tags":"tint,css","created":"2026-11-11","modified":"2026-11-11"}">
<header data-name="title">
<h1 id="use-css-custom-properties-for-tint-token-injection">Use CSS custom properties for tint token injection</h1>
</header>
<div data-name="body">
<section data-name="context">
<h2 id="context" data-known-section="Context">Context</h2>
<p>Tint runes need to override color tokens within a section scope. The solution must work without JavaScript and cascade through nested elements.</p>
</section>
<section data-name="options-considered">
<h2 id="options-considered" data-known-section="Options Considered">Options Considered</h2>
<ol>
<li>
<strong marker="**">CSS custom properties on the container</strong>
— inline styles setting
<code>--tint-*</code>
tokens, theme bridges via
<code>var()</code>
fallbacks.
</li>
<li>
<strong marker="**">Generated CSS classes per tint combination</strong>
— build step creates per-tint classes. Avoids inline styles but combinatorial explosion.
</li>
<li>
<strong marker="**">JavaScript runtime token injection</strong>
— behaviour script reads data attributes and sets styles. Most flexible but requires JS.
</li>
</ol>
</section>
<section data-name="decision">
<h2 id="decision" data-known-section="Decision">Decision</h2>
<p>CSS custom properties via inline styles on the container element.</p>
</section>
<section data-name="rationale">
<h2 id="rationale" data-known-section="Rationale">Rationale</h2>
<p>
Custom properties cascade naturally through the DOM subtree without JavaScript. Themes opt into tint support by including bridge CSS. The
<code>--tint-*</code>
namespace avoids collisions with theme-internal tokens.
</p>
</section>
<section data-name="consequences">
<h2 id="consequences" data-known-section="Consequences">Consequences</h2>
<ul>
<li>Themes must include the tint bridge CSS</li>
<li>Inline styles cannot use media queries — dark mode handled separately</li>
<li>Inspector must audit tint token contrast ratios</li>
</ul>
</section>
</div>
</article>Use CSS custom properties for tint token injection
Context
Tint runes need to override color tokens within a section scope. The solution must work without JavaScript and cascade through nested elements.
Decision
CSS custom properties via inline styles on the container element.
Rationale
Custom properties cascade naturally through the DOM subtree without JavaScript. Themes opt into tint support by including bridge CSS. The --tint-* namespace avoids collisions with theme-internal tokens.
Consequences
- Themes must include the tint bridge CSS
- Inline styles cannot use media queries — dark mode handled separately
- Inspector must audit tint token contrast ratios
<article class="rf-decision rf-decision--ADR-9007 rf-decision--accepted" data-id="ADR-9007" data-status="accepted" data-date="2026-03-11" data-supersedes="" data-source="" data-tags="tint,css" data-created="2026-11-11" data-modified="2026-11-11" data-rune="decision" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-decision__eyebrow">
<span data-meta-type="id" data-field="id">ADR-9007</span>
<span data-meta-type="status" data-meta-sentiment="positive" data-align="end" data-field="status">accepted</span>
</div>
<header data-name="title" class="rf-decision__title" data-section="title">
<h1 id="use-css-custom-properties-for-tint-token-injection">Use CSS custom properties for tint token injection</h1>
</header>
<dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-decision__metadata">
<div data-name="row" data-field="date" class="rf-decision__row">
<dt data-meta-label="">Date</dt>
<dd>
<time data-meta-type="temporal" datetime="2026-03-11">2026-03-11</time>
</dd>
</div>
<div data-name="row" data-field="created" class="rf-decision__row">
<dt data-meta-label="">Created</dt>
<dd>
<time data-meta-type="temporal" datetime="2026-11-11">2026-11-11</time>
</dd>
</div>
<div data-name="row" data-field="modified" class="rf-decision__row">
<dt data-meta-label="">Modified</dt>
<dd>
<time data-meta-type="temporal" datetime="2026-11-11">2026-11-11</time>
</dd>
</div>
</dl>
<div data-name="tags" data-zone="tags" data-zone-layout="bar" class="rf-decision__tags">
<span data-meta-type="tag" data-field="tags">tint</span>
<span data-meta-type="tag" data-field="tags">css</span>
</div>
<div data-name="body" class="rf-decision__body" data-section="body">
<section data-name="context" class="rf-decision__context">
<h2 id="context" data-known-section="Context">Context</h2>
<p>Tint runes need to override color tokens within a section scope. The solution must work without JavaScript and cascade through nested elements.</p>
</section>
<section data-name="options-considered" class="rf-decision__options-considered">
<h2 id="options-considered" data-known-section="Options Considered">Options Considered</h2>
<ol>
<li>
<strong marker="**">CSS custom properties on the container</strong>
— inline styles setting
<code>--tint-*</code>
tokens, theme bridges via
<code>var()</code>
fallbacks.
</li>
<li>
<strong marker="**">Generated CSS classes per tint combination</strong>
— build step creates per-tint classes. Avoids inline styles but combinatorial explosion.
</li>
<li>
<strong marker="**">JavaScript runtime token injection</strong>
— behaviour script reads data attributes and sets styles. Most flexible but requires JS.
</li>
</ol>
</section>
<section data-name="decision" class="rf-decision__decision">
<h2 id="decision" data-known-section="Decision">Decision</h2>
<p>CSS custom properties via inline styles on the container element.</p>
</section>
<section data-name="rationale" class="rf-decision__rationale">
<h2 id="rationale" data-known-section="Rationale">Rationale</h2>
<p>
Custom properties cascade naturally through the DOM subtree without JavaScript. Themes opt into tint support by including bridge CSS. The
<code>--tint-*</code>
namespace avoids collisions with theme-internal tokens.
</p>
</section>
<section data-name="consequences" class="rf-decision__consequences">
<h2 id="consequences" data-known-section="Consequences">Consequences</h2>
<ul>
<li>Themes must include the tint bridge CSS</li>
<li>Inline styles cannot use media queries — dark mode handled separately</li>
<li>Inspector must audit tint token contrast ratios</li>
</ul>
</section>
</div>
</article>How Markdown is read
| You write | It becomes |
|---|---|
| A heading | The decision's title |
| The paragraphs right after it | The decision's lead |
Anything else before the first ## | An intro above the sections |
A ## heading | A named section; the content up to the next ## is its body |
## Context, ## Options Considered, ## Decision, ## Rationale, ## Consequences | The standard record sections; aliases such as ## Background or ## Alternatives count as the same section |
Proposed decision
A decision still under review.
{% decision id="ADR-9015" status="proposed" date="2026-03-18" %}
# Adopt content model validation at parse time
## Context
Currently content model violations are only caught during transform. Earlier validation would improve error messages.
## Decision
Move validation to a post-parse AST pass.
{% /decision %}<article data-rune="decision" data-rune-fields="{"id":"ADR-9015","status":"proposed","date":"2026-03-18","supersedes":"","source":"","tags":"","created":"2026-11-11","modified":"2026-11-11"}">
<header data-name="title">
<h1 id="adopt-content-model-validation-at-parse-time">Adopt content model validation at parse time</h1>
</header>
<div data-name="body">
<section data-name="context">
<h2 id="context" data-known-section="Context">Context</h2>
<p>Currently content model violations are only caught during transform. Earlier validation would improve error messages.</p>
</section>
<section data-name="decision">
<h2 id="decision" data-known-section="Decision">Decision</h2>
<p>Move validation to a post-parse AST pass.</p>
</section>
</div>
</article>Adopt content model validation at parse time
Context
Currently content model violations are only caught during transform. Earlier validation would improve error messages.
Decision
Move validation to a post-parse AST pass.
<article class="rf-decision rf-decision--ADR-9015 rf-decision--proposed" data-id="ADR-9015" data-status="proposed" data-date="2026-03-18" data-supersedes="" data-source="" data-tags="" data-created="2026-11-11" data-modified="2026-11-11" data-rune="decision" data-density="full">
<div data-name="eyebrow" data-zone="eyebrow" data-zone-layout="bar" class="rf-decision__eyebrow">
<span data-meta-type="id" data-field="id">ADR-9015</span>
<span data-meta-type="status" data-meta-sentiment="neutral" data-align="end" data-field="status">proposed</span>
</div>
<header data-name="title" class="rf-decision__title" data-section="title">
<h1 id="adopt-content-model-validation-at-parse-time">Adopt content model validation at parse time</h1>
</header>
<dl data-name="metadata" data-zone="metadata" data-zone-layout="definition-list" class="rf-decision__metadata">
<div data-name="row" data-field="date" class="rf-decision__row">
<dt data-meta-label="">Date</dt>
<dd>
<time data-meta-type="temporal" datetime="2026-03-18">2026-03-18</time>
</dd>
</div>
<div data-name="row" data-field="created" class="rf-decision__row">
<dt data-meta-label="">Created</dt>
<dd>
<time data-meta-type="temporal" datetime="2026-11-11">2026-11-11</time>
</dd>
</div>
<div data-name="row" data-field="modified" class="rf-decision__row">
<dt data-meta-label="">Modified</dt>
<dd>
<time data-meta-type="temporal" datetime="2026-11-11">2026-11-11</time>
</dd>
</div>
</dl>
<div data-name="body" class="rf-decision__body" data-section="body">
<section data-name="context" class="rf-decision__context">
<h2 id="context" data-known-section="Context">Context</h2>
<p>Currently content model violations are only caught during transform. Earlier validation would improve error messages.</p>
</section>
<section data-name="decision" class="rf-decision__decision">
<h2 id="decision" data-known-section="Decision">Decision</h2>
<p>Move validation to a post-parse AST pass.</p>
</section>
</div>
</article>Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Identifier (e.g., "ADR-007"). |
status | "proposed" | "accepted" | "rejected" | "superseded" | "deprecated" | — | Decision status: proposed, accepted, rejected, superseded, or deprecated. |
date | string | — | Date decided (ISO 8601). |
supersedes | string | — | ID of the decision this replaces. |
source | string | — | Comma-separated IDs of specs or other entities this decision informs. |
tags | string | — | Comma-separated labels. |
created | string | — | Creation date (ISO 8601). Defaults to file creation date from git. |
modified | string | — | Last modified date (ISO 8601). Defaults to file modification date from git. |
Universal attributes
bg
The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.
| Attribute | Type | Required | Description |
|---|---|---|---|
bg | string | — | Background preset applied to this block |
bg-from | string | — | Gradient start colour — a semantic token name (→ var(--rf-color-*)) |
bg-gradient | "to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl" | — | Gradient direction (bounded named set) |
bg-gradient-type | "linear" | "radial" | "conic" | — | Gradient type |
bg-to | string | — | Gradient end colour — a semantic token name |
bg-via | string | — | Optional middle gradient stop — a semantic token name |
scrim | "top" | "bottom" | "left" | "right" | "none" | — | Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim |
scrim-blur | "none" | "sm" | "md" | "lg" | — | Frost scrim blur amount |
scrim-strength | "sm" | "md" | "lg" | — | Gradient scrim strength |
scrim-tone | "dark" | "light" | — | Whether the scrim darkens (for light text) or lightens (for dark text) |
scrim-type | "gradient" | "frost" | — | Scrim treatment: gradient (default) or frost (backdrop blur) |
dropcap
Per-instance drop-cap opt-in.
| Attribute | Type | Required | Description |
|---|---|---|---|
dropcap | boolean | — | Style the opening letter of a prose body as a drop cap. Honoured only when the body reads as prose; ignored otherwise. |
elevation
How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.
| Attribute | Type | Required | Description |
|---|---|---|---|
elevation | "sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg" | — | Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating) |
inset
Internal padding override.
| Attribute | Type | Required | Description |
|---|---|---|---|
inset | "flush" | "tight" | "default" | "loose" | "breathe" | — | Inner padding of this block |
motion
Scroll-reveal entrance. You choose its character; the theme decides how it moves.
| Attribute | Type | Required | Description |
|---|---|---|---|
reveal | "none" | "fade" | "slide" | "scale" | "blur" | — | Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography |
stagger | boolean | — | Cascade this block's items in as it reveals (no-op on single-child runes) |
prominence
Header emphasis. Scales a rune's header, or its featured quotation; the theme decides the type size for each step.
| Attribute | Type | Required | Description |
|---|---|---|---|
prominence | "quiet" | "normal" | "prominent" | "display" | "marquee" | — | Emphasis of a page-section header or a featured quotation (only on runes that have one) |
reading
Editorial register for body text. You pick the register; the theme decides how it looks.
| Attribute | Type | Required | Description |
|---|---|---|---|
reading | "fine" | "ui" | "prose" | — | Reading register for this block’s body: fine | ui | prose. The theme sets how each one looks. |
spacing
Block-level rhythm override.
| Attribute | Type | Required | Description |
|---|---|---|---|
spacing | "flush" | "tight" | "default" | "loose" | "breathe" | — | Vertical spacing above and below this block |
substrate
Generated pattern fills behind the content, drawn by the theme.
| Attribute | Type | Required | Description |
|---|---|---|---|
substrate | "dots" | "grid" | "lines" | "cross" | "checker" | "none" | — | Generated surface pattern |
substrate-fill | "inherit" | "inset" | — | Surface fill the pattern sits on (full colour stays with tint) |
substrate-opacity | "sm" | "md" | "lg" | — | Pattern ink strength |
substrate-size | "sm" | "md" | "lg" | — | Pattern cell size |
substrate-target | "self" | "media" | — | Which surface the pattern fills (overrides the rune/theme default) |
tint
Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.
| Attribute | Type | Required | Description |
|---|---|---|---|
tint | string | — | Color tint preset applied to this block |
tint-mode | "auto" | "dark" | "light" | — | Whether the tint adapts to auto, dark, or light mode |
width
The track a block rune occupies.
| Attribute | Type | Required | Description |
|---|---|---|---|
width | "compact" | "narrow" | "content" | "wide" | "full" | — | Maximum width constraint for this block |
| Not available | Why |
|---|---|
| frame | this rune declares neither a `frameTarget` nor a media section |