component-distill
Distill the recurring components out of iterated pages and propose promoting them into the project DESIGN.md. This is the backflow leg of the pipeline: design-baseline reads the baseline into pages once. This skill reads the pages back toward the baseline. It is propose-only and user-gated; it never writes DESIGN.md or any authority. Promotion is a user decision (governance log) executed only by design_baseline.py promote (ADR-0012).
This is a cross-run review, not a step of a single Design I/O run. It reads prior runs' decision-report.md files and emits a proposal artifact for user adjudication.
Authority boundary
| This skill owns | Does not own |
|---|---|
| Deriving recurring-component candidates across runs | Durable write to DESIGN.md (design_baseline.py promote, T-070) |
| Rendering the propose-only promotion proposal | The user promotion decision (governance log, user-only) |
| Reporting distance-to-threshold for below-threshold signals | Component and template selection for a run (ui-picker) |
Deep module (SSOT for deterministic work)
Derivation lives in ../../scripts/component_candidates.py:
pythoncandidate_view(reports_by_run) -> dict # qualifying + below_threshold + gaps
reports_by_run maps a run id to its decision-report.md text. The module prefers the Fill face in a text code fence. It also accepts legacy reports whose Fill face is unfenced top matter (parsing stops before the first ## DD-* entry). It parses components: and counts only path-shaped reuse <path> or extend <path> targets. A new entry or prose such as “no component” is not a candidate. A candidate qualifies when it recurs across distinct runs ≥ 3 AND distinct scenes ≥ 2. Explanatory suffixes in scene after ( / ( do not create a new scene identity. Every group is returned, qualifying first, then below-threshold signals with their gap list, so distance to qualification is visible, never silent.
Candidate identity is currently the referenced file path. Multiple selectors or domain components implemented in one file therefore remain one candidate. Changing identity to path#selector (and migrating governance targets, provenance, and merge semantics) is a separate schema-level change, not inferred by this skill.
Workflow
- Discover runs. Scan the project's
.scratch/<run>/dirs for adecision-report.md. List dirs without one as skipped (they contribute 0 references). If fewer than 2 runs carry a decision report, report that count and stop, backflow needs history to mean anything. - Derive. Build
reports_by_runand callcandidate_view. Read-only: parse, never mutate. - Render the proposal (markdown, report header
component-distill/v1) at the invocation-level output path the caller names (not a single run'sdesign-baseline/dir; this is a cross-run artifact). Sections:- Inclusion manifest,
run | status(included / skipped + reason). - Qualifying candidates, one block per candidate: component path, recurrence, distinct runs, distinct scenes, the contributing references (
run / role / action / scene), and a decision slot for the user (promote | reject | defer). - Below threshold, candidates approaching the threshold with their gap list (e.g.
distinct_runs 2 < 3), so the distance is visible. - Coverage,
runs_with_components/total_references, so an empty corpus reads as "no qualifying candidates + why", never silence.
- Inclusion manifest,
- Adjudicate (user). Present the proposal. The user marks each qualifying candidate. Record the decision as a governance event (agent may append
promotion_candidate_opened; only the user'spromotion_decidedcarriespromote/reject/defer). In this local-file architecture,decided_by: useris an explicit attestation enforced by the read and write protocol, not cryptographic or OS-backed identity authentication. Processes with filesystem write access remain inside the local trust boundary. This skill stops at the proposal; it does not writeDESIGN.md. - Promote through the write seam.
design_baseline.py promotere-derives the current project candidate view. It refuses components that no longer meet the threshold or lack a project-relative source file, even when an older user decision exists.
Done when: all these conditions hold. The proposal artifact exists at the named output path. Qualifying candidates carry full provenance and a decision slot. Below-threshold signals carry their gaps. Nothing under the project DESIGN.md was touched.
Scope fence
| In | Out of scope |
|---|---|
| Derive a proposal from cross-run component recurrence | Durable DESIGN.md merge belongs to design_baseline.py promote (T-070) |
| Report-only candidate derivation | Record the user decision in the promotion governance log |
| Token candidates (counted) | Token promotion into baseline is tracked in T-072 |


