Alignment Page Convention
This file is the single authoring source for the alignment-page convention. Source checkouts load it from docs/alignment-page-convention.md; packaged installs load the same content from assets/alignment-page-convention.md; older installed skills may still fall back to a sibling ALIGNMENT-PAGE.md if present. scripts/upgrade-alignment-page.mjs reads the marked block below, validates thin SKILL.md resolver stubs, and can regenerate legacy sibling bundles only when run with --legacy-bundles. Edit the convention here only — do not hand-edit legacy generated ALIGNMENT-PAGE.md files. Replace {skill-name} with the skill's name and {topic} with a normalized topic slug. The {{SKILL_SPECIFIC_GATES}}, {{SKILL_CONTEXT_INTAKE}}, {{SKILL_VISUAL_TIER}}, and {{SKILL_GLOSSARY_GATE}} tokens are filled per skill by the generator-side registries and skill frontmatter.
Bespoke allowlist. A skill whose ## Alignment Page section carries no generator-owned pointer/stub paragraph is classified bespoke: the generator preserves the section verbatim and does not replace it with the shared resolver stub. Intentionally bespoke skills must be listed in scripts/alignment-bespoke-list.txt, and the list is exact — the generator exits non-zero (in dry-run and write mode) on an unlisted bespoke section, on a stale allowlist entry with no bespoke section remaining, and on a mixed sibling pair where one mirror is generated and the other bespoke (even when allowlisted). Converting an allowlisted skill back to the generated stub requires updating both mirrors and removing its allowlist entry in the same commit.
Output path consistency. Every active ALIGNMENT-PAGE.md — generated or bespoke — must reference only its owning skill's output path: each alignment/<name>-{topic}.html occurrence in the bundle must have <name> equal to the skill directory name. Archive references such as docs/history/archive/YYYY-MM-DD/HHMMSS/alignment/<name>-{topic}.html end with the same segment and are held to the same rule. The generator validates this after its write pass and exits non-zero (in dry-run and write mode) on any foreign-skill reference, which indicates a stale, hand-edited, or mis-rendered bundle; fix it by re-running the generator (generated bundles) or correcting the hand-authored path (bespoke bundles). The summary reports Output paths: N bundles, exact|DRIFT.
Shared-resolver drift check. scripts/upgrade-alignment-page.mjs --check validates, without writing, that every generator-owned (ownable) skill's ## Alignment Page section has the current resolver stub and output path, exiting non-zero with named per-skill diagnostics (Stale SKILL.md resolver stub). Plain --dry-run keeps exiting 0 on pending updates so the edit-convention → preview → write workflow is preserved; --check is the repo-state gate (enforced by layer1 tests). Bespoke (allowlisted) and skip-listed skills have no expected render and are exempt from this check. Existing sibling ALIGNMENT-PAGE.md files are treated as legacy fallback artifacts: they are not required and are not byte-equal checked by default, but any that remain are still covered by output-path validation. Run scripts/upgrade-alignment-page.mjs --legacy-bundles only when an installed-skill compatibility bundle must be regenerated. The summary reports Shared resolver stubs: N ownable, exact|DRIFT in every mode; only --check escalates resolver-stub drift to a failing exit.
Active-page audit. npx skillpacks alignment pages audit is the portable read-only convention gate for active alignment/*.html pages in any repo with the packaged CLI available; in this source checkout, node scripts/audit-alignment-pages.mjs is the equivalent local fallback. Direct edits made without invoking a skill are still checked (archived pages under docs/history/archive/ are out of scope). It validates the scriptable subset of this convention: the Brief Me TTS include (the scripts/alignment-tts-kokoro.js src tag before </body> — not inlined, not type="module"), the question-nav include (the scripts/alignment-question-nav.js src tag before </body> on review-answerable pages), the data-alignment-category and data-visual-tier attributes on <html> with valid slugs, the responsive viewport meta, the embed prohibition (<object>/<iframe>/<embed>), confirmed-page removal of active alignment status controls, and central-index integrity (alignment/index.html exists, links every active page exactly once with no dangling entries, and every entry carries a YYYY-MM-DD meta date). index.html is exempt from the per-page TTS, metadata, and confirmed-page controls checks but held to the viewport and embed rules. The audit exits non-zero with named per-page diagnostics grouped per check and prints exact|DRIFT summary lines (TTS include, Question-nav include, Page metadata, Viewport meta, Embed prohibition, Alignment status controls, Index integrity); it has no fix mode — TTS and question-nav diagnostics route to the idempotent npx skillpacks alignment pages inject-tts alignment/<page>.html command (or node scripts/inject-tts.mjs alignment/<page>.html in this source checkout, which injects both includes), the rest are manual fixes. Layer1 enforces this source repo state via tests/layer1/audit-alignment-pages.test.ts, and the local fallback supports --root <path> for fixture trees.
Packaged HTML scaffold. npx skillpacks alignment pages scaffold <skill-name> <topic> --out alignment/<skill-name>-<topic>.html writes a starter HTML page from the packaged assets/templates/alignment-page.html template and creates a minimal alignment/index.html when none exists. This is infrastructure only: the markdown convention remains the behavioral source of truth, and the producing skill must replace placeholder regions with its own evidence, page-specific sections, gates, YAML compiler, approval semantics, and final handoff. Normal alignment-producing skills should populate their own page directly using this scaffold/template when useful; they must not invoke create-alignment-page as a mandatory subskill. create-alignment-page remains the user-facing workflow for ad hoc or non-skill alignment pages.
Stage relationship to the interrogation page. The alignment page is the stage-two review/approval surface only — it reviews and approves deliverables after research, and (for Pattern A loops) the stage-one framework/scope selection. Pre-research elicitation of unknowns the agent cannot infer lives in the separate interrogation page archetype (docs/interrogation-page-convention.md), which runs as stage zero before any alignment page. Do not add open elicitation loops to alignment pages; build an interrogation page for that. This is a cross-reference only — it changes nothing about the alignment contract below.
<!-- alignment-convention:start --> When this skill produces durable deliverables (research, specs, plans, reports, prototypes, or any document output), build a full-depth HTML alignment page at alignment/{skill-name}-{topic}.html. Use a normalized topic slug derived from the app, feature, research subject, report subject, or output filename.
Visual rendering tier. Each alignment page declares a rendering tier:
document(default) — text, tables, approval gates. No charts or interactive elements.visual— adds inline charts, diagrams, and spatial layouts rendered via self-contained Canvas/SVG. Data is embedded as inline JSON. No external fetches.prototype— adds functional interactive components (clickable flows, live CSS previews, drag interactions). Prototypes are ephemeral previews, not production code.
The tier is set per skill via visual_tier in SKILL.md frontmatter (or detected by the upgrade script). The bundled ALIGNMENT-PAGE.md receives tier-appropriate rendering guidance from the generator.
{{SKILL_CONTEXT_INTAKE}}
Alignment lifecycle. Alignment pages have three lifecycle states. review is the draft/pre-approval page: it contains the complete deliverable preview, evidence, required inline gate questions, section feedback controls, local section-feedback YAML only after a section feedback choice is selected, and one bottom Compile Responses control. confirmed is the post-approval page after the agent has consumed final compiled response YAML, made any approved user-requested edits, and written or updated the approved canonical artifacts. A confirmed page is finished and current for the completed alignment cycle, but it remains amendable when later research changes or extends the conclusions. amended is a future revision of a confirmed page: archive the previous confirmed page first, mark what changed, preserve the prior approval record, and highlight the new evidence, decisions, or scope that changed the earlier conclusion. Staged pages should declare data-alignment-stage="stage-1" for scope-only review pages and data-alignment-stage="stage-2" for artifact-review pages after approved research/work is complete; this lets audits distinguish scope previews from pending final artifact approval.
Central alignment index. When a research-producing skill writes or updates an HTML alignment page, also maintain the repository's central alignment index. Look for alignment/index.html at the repository root; if the target repo documents a different central alignment-index path, use that path and report it. If the index does not exist, create it as a self-contained HTML page that works from file://, links to every active alignment/*.html page except itself, and includes the newly written page. Every index entry must include the page's alignment date in a muted meta span after the link, formatted YYYY-MM-DD, for example <a href="page.html">Title</a> <span class="meta">2026-06-09</span>. The alignment date is the review or confirmed date written inside the page itself; new pages use today's date. If the index exists, update it instead of blindly appending: preserve valid existing entries, metadata, and entry dates; remove duplicate entries for the same page path; keep links repo-relative; and include the new or updated page. When updating an existing index, add a date only to entries that are missing one, deriving it from the page's internal alignment date, or from file history when the page has no internal date. If a new marker is used, combine it with the date as <span class="meta">new · YYYY-MM-DD</span>, and remove stale new markers from entries that are no longer the latest addition.
Alignment index categories. The index groups alignment pages into five categories. Each alignment page belongs to exactly one category. When writing or updating the index, assign each page to a category and render the index grouped by category in the order listed below.
- Research (
research) — market research, competitive analysis, investigative reports. Skill prefixes:devtool-positioning,devtool-adoption,devtool-monetization,devtool-user-map,devtool-workflow,devtool-dx-journey,devtool-integration-map,deep-research,repo-glossary. - Product Design & Spec (
product-design) — product scoping, idea briefs, design plans, specifications. Skill prefixes:idea-scope-brief,fork-idea-branch,animation-design-planner,skills-showcase,skills-inventory. - Utility & Maintenance (
utility) — diagnostics, triage, incident investigation, infrastructure maintenance. Skill prefixes:investigate,session-triage,prompt-history-backfill. - QA & Meta-Skill Improvement (
qa-meta) — code review, benchmarking, skill building/fixing, expert review. Skill prefixes:expert-review,benchmark,targeted-skill-builder,devtool-docs-audit. - Ops & Session Analysis (
ops-analysis) — operational intelligence, session history analysis, cost/token/workflow analysis. Skill prefixes:analyze-sessions,canonical-workflow,run-batch.
Category assignment rule. Match the skill name that produced the alignment page against the prefix lists above; use the first matching category. When no prefix matches, read the page title and summary to assign the best-fit category. When the category is ambiguous, default to Research.
Visual tier badge. When writing or updating the alignment index, display a visual tier badge next to each linked page: [doc] for document tier, [visual] for visual tier (pages with charts/diagrams), [proto] for prototype tier (interactive pages). Read the tier from the alignment page's data-visual-tier attribute on the <html> element. When the attribute is missing, default to [doc].
Category data attribute. Set data-alignment-category on the <html> element of each alignment page with the category slug (research, product-design, utility, qa-meta, or ops-analysis). Also set data-visual-tier on the <html> element with the rendering tier (document, visual, or prototype). When an existing alignment page lacks the attribute, infer the category from the skill-name prefix or page content and add it on the next update. The index should read this attribute when available; when it is missing, apply the prefix-matching rule to assign a category for display.
Category and product-path grouping. In product-line or product-path repositories, identify product from research/.progress.yaml product_paths[], active research/{slug}/ or specs/{slug}/ scopes, page metadata, page title, or the alignment page path. Group index entries by category first, then by product/product path within each category, with the repo's existing secondary sort preserved when clear. In flat repositories, group by category, then preserve the existing index organization within each category or use a clear newest-first or title order when creating a new index.
Research quality contract. For research-producing outputs, do not synthesize research findings, recommendations, candidate rankings, or working packets until the user approves the research scope from the review alignment page's final compiled response YAML. Before scope approval, do only minimal discovery needed to propose the research scope, source plan, assumptions, output paths, and approval questions; label any observed files or source availability as scope evidence, not findings. After scope approval, perform the synthesized research and separate and label claims (what the report concludes), evidence (source, repo artifact or file path, quote or observation, date, and confidence), inference (why that evidence supports the claim), assumptions (what remains unproven), and decision impact (what the user should approve, reject, or correct). Do not collapse evidence and inference into unsupported summary prose.
Revision hygiene for research artifacts. When feedback asks to remove, replace, or reduce emphasis on content, update the page and any proposed artifacts toward the requested final state. Keep corrected or rejected claims out of findings, recommendations, synthesis narratives, and forward-looking instructions. If provenance is needed, put it in a concise revision note or archive record rather than repeating it in the canonical narrative.
Embed prohibition. Do not use <object>, <iframe>, <embed>, or "open working packet" / "view full document" links as the primary rendering of any proposed deliverable, evidence matrix, interview log, or manifest entry. The alignment page HTML must contain the rendered content directly. Embedded or linked external documents are permitted only as supplemental references alongside the fully rendered content already present in the page. Exception: Self-contained inline <canvas> and <svg> elements are permitted for charts and diagrams within the same HTML file.
Visual accessibility contract. Every chart or diagram in a visual or prototype tier alignment page must include: (1) a <table> or text fallback rendering the same data, (2) an aria-label attribute on every <canvas> and <svg> element describing the chart type and data summary, and (3) a "View as table" toggle button that swaps between the chart and its table fallback. The toggle must default to showing the chart, with the table hidden via a hidden attribute that is toggled by the button.
Inline chart contract. Visual and prototype tier pages must inline all chart rendering code as a <script> block within the HTML file. No external CDN references, relative file imports, or <script src="..."> tags for chart libraries. Use the alignment chart snippet library (scripts/alignment-chart-snippets.js) as the reference implementation — copy the needed functions directly into the page's <script> block. Charts must read CSS variables (--chart-1 through --chart-8) for colors and adapt to the dark-mode palette.
No context loss rule. The alignment page must contain the complete content of every proposed markdown deliverable -- every section, every finding, every detail, every list item -- plus the decision-relevant substance from search logs, interview logs, source notes, repo scans, and approval notes. If a fact, source, caveat, uncertainty, alternative, rejected or lower-confidence finding, or decision rationale appears in a proposed deliverable or research log, it must either appear in the HTML page or be explicitly linked from the exact section that depends on it. The page is a thorough interactive review document, not a summary. Render the full deliverable content in clean, readable HTML with appropriate hierarchy, styling, and navigation. If the skill writes multiple scoped deliverables in one run, build one alignment page that contains all deliverables with anchor-linked navigation. Durable tracker artifacts, such as research/assumption-tracker.md, remain canonical markdown outputs but must also be fully rendered into the alignment page before approval.
Page layout contract. After the page title and short summary, include a top-of-page "Table of Contents" section with anchor links to the major review sections and the bottom compile section. Keep the Table of Contents in normal document flow. Do not use a sidebar, side rail, drawer, split-shell layout, or sticky navigation for the Table of Contents unless the user explicitly asks for that layout. Do not place compile, copy, feedback, or answer controls in a sticky or fixed bottom banner/footer. Bottom compile controls must appear as ordinary content in a bottom compile section, so they scroll with the page and do not cover content at high zoom.
Research translation requirements. For research outputs, the HTML page must include an evidence matrix, confidence/assumption register, alternatives considered, rejected or lower-confidence findings, source coverage gaps, and downstream implications. The evidence matrix must map each major claim to source or repo evidence, inference, confidence, assumption status, and decision impact. The confidence/assumption register must show which conclusions are evidence-backed, which are provisional, and what evidence would change them.
Dark-mode styling. Use a dark color scheme by default. Base CSS variables: --bg: #0d1117; --surface: #161b22; --border: #30363d; --text: #c9d1d9; --text-muted: #8b949e; --accent: #58a6ff; --green: #3fb950; --red: #f85149; --orange: #d29922; --purple: #bc8cff;. Data visualization palette (for visual and prototype tier pages): --chart-1: #58a6ff; --chart-2: #3fb950; --chart-3: #d29922; --chart-4: #bc8cff; --chart-5: #f85149; --chart-6: #79c0ff; --chart-7: #f0883e; --chart-8: #a5d6ff;. Apply background: var(--bg); color: var(--text); on body. Use --surface for cards, the top Table of Contents, and table headers. Use --border for all borders. Use --purple for question blocks and gate headings. Use --accent for links and section headings. Keep headings color: #fff or var(--accent) for hierarchy. Question block backgrounds should use #1c2333.
Responsive layout. Include <meta name="viewport" content="width=device-width, initial-scale=1"> in the head. Use at most two breakpoints: @media (max-width: 860px) for tablet and @media (max-width: 560px) for phone. Wrap every <table> in a <div style="overflow-x: auto"> so tables scroll horizontally instead of breaking layout. All interactive elements (buttons, radio labels, feedback controls) must have a minimum touch target of 44px height and at least 10px 16px padding. Use rem for font sizes and respect the user's base font size — do not set a fixed font-size on html or body. Flex containers that place a heading beside controls (display: flex; justify-content: space-between) must include flex-wrap: wrap; gap: 8px so controls drop below the heading on narrow screens. Grid layouts must use minmax(min(210px, 100%), 1fr) instead of bare minmax(210px, 1fr) to prevent horizontal overflow when the viewport is narrower than the minimum. Set max-width: 100%; overflow-wrap: break-word; on main and any fixed-width container so no element forces a horizontal scrollbar at any zoom level.
Bar and meter sizing. CSS-rendered bars, meters, and progress fills (a container element plus a percentage-sized fill child) are a third visual idiom beyond tables and Canvas/SVG charts, and they collapse silently when sized wrong. Any element given a percentage height (e.g. a fill at height: 100%) must sit inside a container with an explicit, definite height — never min-height alone. A percentage height resolves against the parent's definite height; a min-height-only parent has none, so the fill computes to zero and paints empty even at width: 100%. Prefer the native <progress>/<meter> element where it fits; otherwise give the container an explicit height (or give the fill its own min-height so it paints regardless of the parent). Always render the value as text beside the bar (e.g. 100% — Covered) so the meaning survives even if the fill fails to paint. The active-page audit (node scripts/audit-alignment-pages.mjs) flags the min-height-only container plus percentage-fill collapse mechanically.
Alignment gates. In review pages, treat gates as explicit review sections inside the HTML page. A gate blocks finalization only while the page is in review, until its required inline questions are answered and compiled into YAML. Include every gate that applies to the skill output, and include these gate types whenever relevant: evidence coverage, assumptions/confidence, scope/non-goals, candidate/verdict decisions, artifact destination, proposed file changes, coverage checkpoint, and post-approval route. In confirmed pages, preserve the gate decisions as read-only approval records instead of active approval controls.
Gate reactivity after revisions. When feedback, partial compiled response YAML, other answers, needs-clarification, or approval-with-edits changes the artifact premise, regenerate the affected gate set from the revised artifact instead of carrying the prior gate structure forward mechanically. Recompute gate questions, options, defaults, blocking state, unanswered_required_questions, and any requiredGateNames or gate registry from the current reviewed content. Remove or rewrite superseded gates; do not keep obsolete choices, stale required gates, stale counters, or stale registry entries merely because they existed in the previous page. Visibly mark changed gates in the revised review page with the same update treatment used for changed content, so the reviewer can see which approval questions changed before compiling responses again.
Output gate semantics and de-duplication. The artifact destination gate approves the durable or review artifact location, such as the alignment page, working packet, report, spec, plan, prototype, or document path. The proposed file changes gate approves downstream mutation scope, timing, and the allowed file set after review. Keep these as separate approval concepts. If both gate concepts ask only the same path-destination question, render one combined visual section such as Artifact Destination & Proposed File Changes instead of duplicating path-only sections. If the decisions differ, render separate gates. Do not duplicate YAML entries solely because one visual section title names both concepts: emit separate YAML items only when the page asked separate decisions, and keep each item's gate_type equal to the decision it controls (artifact destination or proposed file changes).
Research completeness gate. For research outputs, include a research completeness gate with inline questions asking whether the evidence is sufficient for the recommendation, which claims need more support, and whether missing context could change the recommendation. Place these questions directly under the evidence matrix or recommendation section they govern.
Source coverage expectations. For web research, organize source coverage by category rather than citation list alone; use categories such as competitors, pricing, user sentiment, positioning, integrations, and recent activity when relevant to the topic. For repo or codebase research, include file/path evidence and clearly distinguish observed code facts from inferred product, workflow, or user conclusions.
Report-only research gates. For report-only or pre-approval research skills, the first review alignment page must explicitly contain proposed research scope, source plan, assumptions/confidence, recommended output path, proposed file changes, and approval gates before synthesized research begins and before any working packet, canonical research, spec, or task file is created or updated.
Staged research workflow. When the producing SKILL.md defines a ## Staged Research Workflow, treat that section as the operational source of truth for Stage 1, Stage 2, Stage 3, working-packet paths, approval boundaries, archive timing, and canonical writes. The alignment page must render the current stage, proposed or approved scope, source plan, working-packet and canonical output paths, evidence and assumptions, review gates, user format preferences, final artifact approval, and the approval record required by that workflow without restating the workflow prose. If a report-first research skill has no explicit staged workflow, use the generic scope-first pattern: scope-only review page before synthesis, artifact-review page after approved research, then confirmed page only after final compiled response YAML approves the canonical write.
Stage 2 review-page template. Stage 1 scope-review pages must include a Stage 2 Preview / Expected Review Format section that previews the exact section sequence, table shapes, evidence treatment, visual density, and approval gates the user will see after research; make it specific enough for the user to flag preferred content formats, grouping, labels, visuals, and evidence density before the agent does heavy research. After scope approval and research, the Stage 2 review page must include these sections as structured HTML, not as raw Markdown dumps: Research Scope Approved status block with approved scope, source plan, output paths, and unresolved caveats; Executive Findings or a skill-specific top-findings section with confidence labels; Evidence Matrix mapping claim, evidence/source/path, inference, confidence, assumptions, and decision impact; Working Packet Review with the complete working-packet substance rendered as purpose-built HTML sections, lists, tables, matrices, cards, and tier-appropriate charts or diagrams; Alternatives / Rejected or Lower-Confidence Findings; Source Coverage & Gaps; Assumptions / Confidence Register; Proposed Canonical Artifacts & File Changes; a required User Format Preferences gate asking whether the layout, tables, grouping, visuals, labels, and evidence density match expectations; and a required Final Artifact Approval gate for Stage 3 readiness. Raw Markdown packet text, search logs, or source notes may appear only as supplemental source views after the rendered review UI and never replace the Stage 2 review sections.
{{SKILL_SPECIFIC_GATES}}
{{SKILL_VISUAL_TIER}}
{{SKILL_GLOSSARY_GATE}}
Required inline questions. In review pages, each gate must contain at least one required inline question placed directly under the content it governs, inside a visually distinct question block. Each question must use radio-button inputs and include two standing options after the skill-generated choices: "Other / None of the above" backed by a multi-line text box for free-form input, and "Need clarification" backed by an optional notes box where the user can explain what is unclear. Every radio option must carry explicit gate outcome metadata with data-approval-effect="approve", data-approval-effect="block", data-approval-effect="clarify", or data-approval-effect="other"; equivalent structured metadata is acceptable only when the compiler reads that metadata directly instead of visible text. Mark affirmative approval options with approve, blocking/rejection/rework options with block, clarification options with clarify, and free-form other options with other. When any radio option other than "Other" or "Need clarification" is selected, show an optional "Additional notes" text box beneath it so the user can qualify their choice. Generate questions based on what genuinely needs user input -- do not add filler questions. Do not create a separate bottom "Decisions & Clarifications" section. Confirmed pages must not keep these as required input controls; render the answered decisions as read-only records.
Section feedback controls. Every major section of the page (each deliverable section, evidence matrix, confidence register, gate, and any anchor-linked top-level heading) carries a lightweight section-feedback control near its heading: three mutually exclusive choices -- "emphasize" (add more weight to this section or to the point named in the notes), thumbs down (reject or flag a concern), and "clarification needed". The section feedback textarea, local compile/copy controls, and local read-only YAML output are hidden by default. Selecting any one feedback choice reveals a multi-line section-feedback textarea plus local "Compile Feedback YAML", "Copy YAML", and read-only YAML controls placed directly under or beside that section's emphasize/down/clarify controls; deselecting the active choice hides the textarea, local compile/copy controls, and local read-only YAML output again and omits that section from compiled responses. This textarea is separate from required gate-question text inputs: even when the same section has gate questions with their own text boxes, selecting emphasize/down/clarify must still reveal the section-feedback textarea near the feedback controls. Use --green for active "emphasize", --red for the active thumbs-down, and --orange for active "clarification needed", with muted/inactive states otherwise. These controls are optional for final approval and do not replace required gate questions. They also contribute section_feedback entries to the unified response payload so the user can send emphasis requests, concerns, or clarification requests before answering every required gate question. When a section contains nested subsections (h3 or deeper), duplicate the section-feedback control at the bottom of the section, just before the closing </section> tag. The bottom copy mirrors the top copy — same data-section, same id with a -bottom suffix, same button set. Sections without nested subsections keep only the top control. Pair top and bottom controls by matching data-section attribute. When a feedback button is clicked on one copy, mirror the active state, has-feedback class, and dataset.feedback value to the paired copy. Textarea content should sync on compile — whichever textarea has content takes precedence (prefer the one the user last typed in). Both copies' local compile/copy buttons produce the same YAML. Use the top copy's id (without -bottom) as the canonical feedback id for YAML output.
Continuation command YAML field. Every YAML payload compiled by a review alignment page must begin with a valid YAML comment of the form # Invoke with: <producing-skill-or-parent-route>, followed immediately by a top-level command: "<producing-skill-or-parent-route>" field as the first real YAML key. Populate both values with the same literal route the terminal handoff would otherwise ask the user to copy separately, including product path, topic, branch, or mode arguments when applicable. The comment is an attention cue for humans and LLM agents; parsers ignore it, so the root command field remains the enforceable routing contract. For Pattern A pages with agent_routing.command, the root command value must exactly match agent_routing.command. This root command is review-loop continuation metadata, not downstream routing or execution authority; the receiving skill still validates the YAML, resolves filesystem state, and applies the approval boundary before writing artifacts or routing onward.
Section feedback YAML contract. Provide local section-feedback YAML only under each selected section-feedback textarea. When a section-feedback control is selected, show local "Compile Feedback YAML" and "Copy YAML" controls plus a read-only YAML textarea directly under that section's feedback textarea; when the control is deselected, hide those local controls and output again. The local feedback compile generates YAML with # Invoke with: <producing-skill-or-parent-route>, command: "<producing-skill-or-parent-route>", alignment_page: alignment/{skill-name}-{topic}.html, feedback_status: revision-request, approval_status: not-approved, unanswered_required_questions, and a section_feedback list containing the single selected section-feedback entry for that local control. Enable local feedback compile controls as soon as that section-feedback control is set, even if required inline gate questions are unanswered. Populate alignment_page from the known repo-relative output path used to write the HTML page, not from the page title, browser URL, window location, or any display label. Populate command from the exact continuation route the user should invoke with this YAML, not from display labels or inferred downstream recommendations, and keep it as the first real YAML key after the invocation comment. Each feedback entry uses the shape section, feedback (emphasize, down, or needs-clarification), optional notes from that section's feedback textarea, and requested_agent_action (add-weight-to-section, investigate-and-revise, or clarify-before-approval). For emphasize feedback, the YAML must make clear that the agent should add more weight, prominence, evidence, detail, or recommendation emphasis to that section or to the specific point named in the notes; this is a revision request, not approval of the section as-is. For down and needs-clarification feedback, the YAML must make clear that the agent should evaluate the feedback, classify the feedback intent before mutation under the Feedback intake before mutation rule, investigate further when needed, and resolve the issue before asking again for final approval responses. Automatically attempt to copy local feedback YAML to the clipboard, display local copy status, display it in the matching read-only textarea, and provide a "Copy YAML" button with the same retry and fallback behavior as response YAML.
Feedback intake before mutation. When consuming local section-feedback YAML, partial compiled response YAML, or fresh-session pasted YAML, classify each feedback item before editing artifacts. Use one of these intent classes: answer-only (the note is a question that can be answered without changing the page), amend-page (the user explicitly asks for a page/artifact change or the correction is plainly factual), investigate-before-amend (the concern might require evidence gathering before deciding whether to amend), pushback-needed (the premise appears false, harmful, out of scope, or in conflict with approved evidence), or ask-user-before-amend (the note is ambiguous or a tradeoff where the desired final state is unclear). If the note is a question, concern, premise challenge, "can we...", "would X not...", or ambiguous tradeoff, answer the question, state the pushback, or ask the needed follow-up in the agent response before mutating the HTML page. Edit the page directly only when the clarification is plainly factual, the user explicitly asks for an amendment, or investigation confirms that an amendment is warranted; when editing, archive first as required, visibly mark changes, regenerate affected gates, and return the page to review. clarify-before-approval means resolve the clarification before approval; it does not mean silently patch the HTML. Never mark the page confirmed, write approved canonical artifacts, or route downstream while unresolved clarification, unresolved down feedback, pushback, or negative feedback remains.
Response YAML contract. In review pages, at the bottom of the page, include an ordinary in-flow compile section with a single "Compile Responses" button. The bottom compile section must not be sticky, fixed, floating, or styled as a persistent banner. "Compile Responses" aggregates all answered inline gate questions throughout the page, including free-text notes, plus every selected section-feedback entry. Enable it as soon as at least one gate question has an answer or at least one section-feedback control is selected; do not require every required gate question to be answered before compiling partial responses. If clicked with no answered gates and no selected section feedback, show a response status that asks the user to answer a gate question or select section feedback. The compiled YAML is a mixed response payload beginning with # Invoke with: <producing-skill-or-parent-route>, command: "<producing-skill-or-parent-route>", alignment_page: alignment/{skill-name}-{topic}.html, response_status (partial or complete), approval_status (not-approved or ready-for-agent-review), required_gate_status (incomplete or complete), and unanswered_required_questions. It may include a gate_answers list where each answered gate item preserves the stable gate-answer shape: section, gate_type, status (answered, other, or needs-clarification), answer, optional notes, and optional target_artifact or target_path when the gate controls file output. It may also include a section_feedback list using the section-feedback shape from the section feedback YAML contract. Compute approval_status from the selected options' explicit data-approval-effect metadata plus unresolved section feedback only; never classify readiness by regex, substring, label text, input value text, prose, or visible answer copy. Set approval_status: ready-for-agent-review only when every required gate is answered with data-approval-effect="approve" or an accepted other answer and there are no unresolved down, unresolved needs-clarification, data-approval-effect="block", data-approval-effect="clarify", or other unresolved negative feedback items; otherwise set approval_status: not-approved and keep the response in review. Positive copy may contain words such as missing, reject, retry, or revision when negated or contextualized; for example, No decision-critical coverage is missing. is an approving path when its option metadata is data-approval-effect="approve". Populate alignment_page from the known repo-relative output path used to write the HTML page, not from the page title, browser URL, window location, or any display label. Populate command from the exact continuation route the user should invoke with this YAML, keep it as the first real YAML key after the invocation comment, and match agent_routing.command when that mapping is present. After successful compilation, automatically attempt to copy the YAML to the clipboard with the Clipboard API, display copy status, and display the YAML in a read-only textarea with an explicit "Copy YAML" button. The copy button must retry clipboard copy when supported and fall back to selecting the textarea contents when clipboard access is unavailable or blocked.
Gate outcome validation. Before handing off a generated review page, test the compile path against explicit gate outcome fixtures, not visible words. The all-approve path must compile to response_status: complete, required_gate_status: complete, unanswered_required_questions: [], and approval_status: ready-for-agent-review. A path with one data-approval-effect="block" option selected must compile to approval_status: not-approved. A path with one data-approval-effect="clarify" option selected, one unresolved needs-clarification section feedback entry, or one unresolved down section feedback entry must compile to approval_status: not-approved. Include at least one approving fixture whose visible label contains negated risk words, such as No decision-critical coverage is missing., to prove the compiler is not using substring or regex checks over label text, values, or prose.
Unanswered-question navigator. Every review page must include a <script src="../scripts/alignment-question-nav.js"></script> tag before </body>. The script discovers each answerable gate/question block (radio groups and required or open text/textarea inputs; read-only record gates with no inputs are skipped) and injects a compact ‹ prev unanswered · N left · next unanswered › pager both inline inside each answerable block and into the bottom compile section, so the reviewer can hop directly between remaining gaps without scrolling to hunt for them. Next/prev jump to the next/previous unanswered block (wrapping) with a smooth scroll and a brief highlight; the N left count updates live as gates are answered and reads "All answered" with the controls disabled once none remain. The pager is navigation-only — it carries no compile, copy, or answer semantics — so it is exempt from the sticky-controls prohibition even though it renders inline beside questions. confirmed pages omit the include: they are read-only approval records with no answerable questions. To add the include to an existing page, run node scripts/inject-tts.mjs alignment/<page>.html, which injects both the Brief Me and question-nav tags. Do not inline the script and do not use type="module" — module scripts are blocked by CORS on file:// URLs.
Confirmed page contract. After final approval has been applied, convert the active alignment page from review to confirmed. Include a visible status block with alignment_status: confirmed, confirmation date, confirmed artifact paths, approval source summary, and explicit finished but amendable language: the page is current for the completed alignment cycle, and later research can amend it only by archiving the prior confirmed page and highlighting the amendment. Remove required gate-question controls, section feedback input controls, local compile/copy controls, local read-only YAML outputs, the final "Compile Responses" button, response counters, disabled approval buttons, approval-blocking language, stale requiredGateNames or gate registry data, and any retained controls. Preserve decisions only as read-only approval records. Preserve the full research and approval record: answered decisions, user requests, evidence matrix, assumptions/confidence register, source gaps, proposed file changes, final compiled response YAML or faithful approval summary, and what changed during confirmation. Keep research caveats visible; confirmed means approved/current, not immutable or permanently true. Reconcile before confirming. Before marking a page confirmed, reconcile every displayed gate decision against the final compiled response YAML and the written canonical artifact. The read-only approval record must show the selected answer. When a gate answer used other/freeform, render the user's freeform decision as the read-only gate decision and remove the superseded generated options — do not leave the original multi-option control or its non-selected options visible. Post-confirmation self-check (agent-run, before handoff). Before reporting completion, verify on the confirmed page that: it has data-alignment-status="confirmed"; no active gate inputs/textareas, Compile Responses button, Compile Feedback YAML controls, response counters, requiredGateNames, gate registry data, section feedback controls, local compile/copy/YAML controls, disabled approval buttons, approval-blocking language, or retained controls remain; every compiled gate answer appears as a read-only approval record matching the final YAML; and any other/freeform selection is reflected in both the canonical artifact and the confirmed page.
Confirmed-artifact terminal handoff. After approved YAML is consumed, requested edits are resolved, canonical artifacts are written or updated, the active page is confirmed, and the post-confirmation self-check passes, the terminal completion response must include an explicit next-step route. If another automated workflow remains, include Recommended next skill: <agent-command> for a visible or installed skill route, or include both Next work and Recommended next command: <shell-command-or-agent-command> for shell/project commands, prerequisites, or non-skill routes. If the artifact, approval YAML, skill contract, or confirmed page names a downstream route, verify the route is available before recommending it: use the active session skill list, project-local skill configuration, supported package CLI/script, or repo-local command evidence as appropriate. Use the current agent's active skill syntax ($skill ... for Codex, /skill ... for Claude). If no automated route remains, write Recommended next command: none and name the manual or decision state in Next work. Changed files, verification summaries, commit summaries, and canonical artifact prose are not a substitute for this terminal handoff route.
Pre-approval stop. While an alignment page is in review, the next action is review of the HTML alignment page, not downstream routing. In the terminal handoff, ask the user to review the page, compile either local section-feedback YAML from the relevant section or bottom compiled response YAML from the page's Compile Responses control, clear context, and paste that YAML into a fresh agent session; the YAML itself must begin with the invocation comment and include the top-level command field for the producing skill's continuation route/session so the user does not have to copy a separate command. Do not require the user to answer every gate before sending emphasis requests, negative feedback, clarification needs, or other partial responses. When local section-feedback YAML has feedback_status: revision-request, compiled response YAML is partial, or any YAML has approval_status: not-approved, treat it as a pre-approval resolution request: classify feedback intent under the Feedback intake before mutation rule, answer or push back before editing when the note is question-like or ambiguous, investigate further when needed, and amend only when the classification supports mutation. If amendment is warranted, archive and amend the HTML page contextually, regenerate affected gates under the Gate reactivity after revisions rule, highlight the changes, and ask again for review with the same review/compile/paste instruction. Do not include Recommended next skill, Recommended next command, review-pending command sections, or downstream routing language until after final compiled response YAML with approval_status: ready-for-agent-review has been provided, all clarification/negative feedback has been resolved, and the approved artifacts have been written or updated. If the user already cleared context and pasted YAML into a fresh session, do not ask for another clear; route directly through the current skill's YAML handling, then apply the Fresh-session handoff rule after confirmation. Precedence at chunked assemble stops. When the stop reaching this review page is an intra-skill chunked assemble+approve stop (deliverable page just assembled, in review), this Pre-approval stop governs and takes precedence over the chunked Progress Handoff Block's repeat-command framing (docs/design-tree-loop-convention.md §5). Foreground "Review required"; present exactly one YAML — the page's compiled response YAML. Do not emit a same-command ## Invoke With YAML payload or "why repeat this command" framing at this stop; that framing is reserved for setup/per-unit stops whose next action is agent continuation. The Progress Handoff progress fields (completed count, durable cursor, current/next phase) may still appear.
After approval handling. When final compiled response YAML with approval_status: ready-for-agent-review is provided, inspect it before confirming the page. If it contains approvals plus user-requested edits, first classify the edit intent under the Feedback intake before mutation rule, then update the page, research, and proposed canonical artifacts to satisfy confirmed amendments, regenerating any gates affected by those edits before final confirmation; then write or update the approved canonical artifacts and confirm the page. As part of confirming, reconcile each gate decision against the final YAML and run the post-confirmation self-check from the Confirmed page contract. If it contains needs-clarification, unresolved down feedback, unresolved pushback, or any unresolved negative feedback, resolve that feedback under the Feedback intake before mutation rule and return the page to review instead of marking it confirmed; amend the page only when the classified intent supports mutation, and regenerate affected gates under the Gate reactivity after revisions rule. Before replacing any existing alignment page, archive it to docs/history/archive/YYYY-MM-DD/HHMMSS/alignment/{skill-name}-{topic}.html. Future amendments to confirmed pages follow the same archive-first rule and must show what changed from the prior confirmed record.
Fresh-session handoff. A final compiled response YAML with approval_status: ready-for-agent-review present in first-turn or session-start context is a resume-and-confirm trigger: consume it under the After approval handling rule rather than dismissing it as residual, stale, or already-handled context. This holds even when the payload rode in bundled with a /clear command and is therefore wrapped by the harness local-command caveat (for example "do not respond to these messages unless explicitly asked"); a session-start ready-for-agent-review payload takes precedence over that generic ignore-trailing-context caveat, because the user compiled and delivered it specifically to continue this workflow. Before acting on it, confirm the payload's alignment_page resolves to a real page in the current repository; if it names a page, skill, or repository absent from this checkout, surface that mismatch and ask the user instead of editing unrelated files. If the final compiled response YAML is consumed in an already-fresh session — the page-building conversation is not in the current context (e.g. the user cleared context and pasted the compiled YAML to start this session) — do not present or recommend another context clear in the post-approval downstream handoff. There is no accumulated build context to shed: after writing artifacts and confirming the page, route directly into the next skill's own required gates (continue-now). Offer the stop/clear-context-vs-continue-now choice only when consuming in the same session that built the page. This does not relax the no-auto-run rule — the next skill still begins with its own interaction gates under user control — and it does not apply to Pattern A self-advancing loop continuation (docs/alignment-yaml-routing-contract.md line-15 exception), which intentionally clears context between same-command re-invocations.
Diff highlighting on updates. When the agent updates an existing alignment page after receiving feedback, compiled answers, confirmation edits, or later amendment evidence, the rendered HTML must visibly indicate what changed since the previous version. Highlight changed sections or blocks in-place with a Changed/Updated badge, distinct border or background, <ins>/<del> markup, or a side-by-side before/after comparison when that is clearer. A top-level change summary is useful but not sufficient by itself unless the changed content is also visibly marked where the reader reviews it. Remove or refresh stale change markers on later updates so the highlights describe the current revision only.
Archiving. Before replacing an existing alignment page, archive it to docs/history/archive/YYYY-MM-DD/HHMMSS/alignment/{skill-name}-{topic}.html.
Brief Me (text-to-speech). Every alignment page must include a <script src="../scripts/alignment-tts-kokoro.js"></script> tag before </body>. The script adds a "Brief Me" button that reads the page aloud section-by-section using Kokoro TTS (an 82M-parameter model running client-side via WebGPU/WASM from kokoro-js). The transport bar includes play/pause/stop/skip controls, a voice selector (persisted in localStorage), and speed selection. On first click the voice model downloads (~92MB quantized on WASM; ~326MB fp32 on WebGPU). Weights persist between visits via Cache API origin storage, and this works on file:// origins in Chrome — including file://wsl.localhost UNC paths (verified 2026-06-09 with an instrumented probe in Windows Chrome: caches is available, entries survive reloads and browser restarts, and Chrome shares a single file:// origin across all local pages, so one download serves every alignment page). Repeat visits pay model initialization only, not re-download. If caches is undefined (non-Chromium or locked-down browsers), the model re-downloads each visit; serving pages from a local HTTP origin with npx skillpacks alignment pages serve --port 8907 in the target repo, then http://localhost:8907/alignment/<page>.html, guarantees caching there. In this source checkout, node scripts/serve-alignment.mjs is the fallback server command. Note http://localhost is a separate origin from file://, so the first localhost visit downloads once even when the file:// cache is already warm. After the first successful load on a machine, the script preloads the model during browser idle time on later page loads (gated by a tts-kokoro-used localStorage flag, so users who never click pay nothing). Text is prepared for speech before synthesis: block boundaries (headings, paragraphs, list items, table cells) get sentence punctuation so the model does not read them as run-ons, and speech-hostile symbols are normalized (~92MB reads as "approximately 92MB", v0.3 as "version 0.3", em-dashes as comma pauses, e.g./i.e./vs. expanded). Synthesis is pipelined with small chunks: the first audio chunk is kept short (~250 chars) for fast time-to-first-audio, later chunks stay small (~300 chars, cut at sentence or clause boundaries) with up to two chunks synthesizing ahead during playback, and the next section's opening chunk is prefetched while the current section's last chunk plays, so chunk and section boundaries are gapless. If Kokoro fails to load (old browser, network error), it falls back to the Web Speech API automatically. It skips gate controls, compile UI, feedback textareas, and stat grids. Charts and tables use narrative summaries instead of raw data: containers with a data-tts-narrative attribute have the narrative read aloud; containers without the attribute are silently skipped. To inject TTS into existing pages and install the packaged TTS asset when missing, run npx skillpacks alignment pages inject-tts alignment/<page>.html (idempotent), or node scripts/inject-tts.mjs alignment/<page>.html as a source-checkout fallback. Use --force to replace the existing TTS block with an updated version. Do not inline the TTS script; always use the src tag. Do not use type="module" — module scripts are blocked by CORS on file:// URLs. Narration follows along visually: the blocks currently being read (paragraphs, list items, table rows, headings, chart narratives) receive a .tts-active-chunk highlight at ~1–2-sentence chunk granularity, and the page auto-scrolls to keep them centered (instantly rather than smoothly under prefers-reduced-motion: reduce), while the active section keeps a lightened outline frame. The Web Speech fallback stays section-level — outline plus section-start scroll, no per-chunk highlight.
TTS narrative contract. Every .chart-container and .table-wrap element should carry a data-tts-narrative attribute with a 1-3 sentence human-readable summary of what the chart or table shows. Chart functions in scripts/alignment-chart-snippets.js auto-generate a baseline narrative from their data; author-provided data-tts-narrative attributes take precedence. When authoring alignment pages manually, add data-tts-narrative to chart containers and table wrappers so that Brief Me reads a meaningful summary instead of skipping the element.
Browser open. When the briefing-slides review-surface convention asset is installed (source checkout: docs/briefing-slides-convention.md; packaged install: assets/briefing-slides-convention.md), use the briefing-first open sequence: write or amend the dense alignment/{skill-name}-{topic}.html page first; treat the dense alignment page as the canonical backup/reference surface; build or amend briefing-slides/{skill-name}-{topic}.html second; link the dense page and source artifacts from the deck; then attempt to open only the briefing deck. Use npx skillpacks alignment pages open briefing-slides/{skill-name}-{topic}.html --browser auto for the deck, replacing the path with the actual deck path when needed; in this source checkout, if the packaged CLI is unavailable, fall back to node scripts/open-html-page.mjs briefing-slides/{skill-name}-{topic}.html --browser auto. Do not auto-open the dense alignment page when the briefing deck exists. The deck's compiled YAML must route to the producing skill's continuation command, not $create-briefing-slides or /create-briefing-slides. If the briefing-slides convention asset is absent, the dense page remains the primary review surface: after writing or amending it, attempt to open it from the repository root with npx skillpacks alignment pages open alignment/{skill-name}-{topic}.html --browser auto, replacing alignment/{skill-name}-{topic}.html with the actual page path when needed; in this source checkout, if the packaged CLI is unavailable, fall back to node scripts/open-html-page.mjs alignment/{skill-name}-{topic}.html --browser auto. Only if the applicable helper paths are unavailable or blocked should you use manual platform fallbacks. For WSL, open a browser-friendly file URI through PowerShell when /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe is available: build file://wsl.localhost/${WSL_DISTRO_NAME:-Ubuntu}/<absolute-linux-path> from the HTML page's absolute path and run PowerShell Start-Process '<file-uri>'. Try xdg-open <absolute-linux-path> only after the packaged CLI, source-checkout helper, and WSL PowerShell bridge are unavailable or blocked. Report the final status (focused, opened, fallback-opened, blocked, or failed) in the handoff, and include the absolute path when the status is blocked or failed. If no helper status has been produced yet, the handoff is incomplete; run the applicable helper before ending the turn. A manual instruction to open the file is not a substitute for the helper attempt and status. Continue when opening is blocked if the files were written and verified correctly; a blocked browser-open attempt does not make the skill fail. <!-- alignment-convention:end -->