@edjbarron/ux-guard 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ ux-guard is consumer-neutral: your repository owns its use-case catalog,
37
37
  policy, browser harness, reviewed baselines, targets, artifact locations, and
38
38
  CI enforcement decision.
39
39
 
40
- ## Quickstart
40
+ ## Getting started
41
41
 
42
42
  Requirements: Node.js 22 or newer, npm, and a TypeScript UI project with JSX or
43
43
  TSX source.
@@ -51,153 +51,313 @@ Or ask your agent:
51
51
 
52
52
  > Set up ux-guard in this repo.
53
53
 
54
- `npx` executes the installed local package, so the project controls the
55
- ux-guard version.
54
+ `npx` uses the version installed in your project. Setup inspects non-test UI
55
+ source and writes an unapproved supporting review file when it finds usable
56
+ source. It does not know whether observed patterns are intentional, and it does
57
+ not inspect or invent your important workflows.
56
58
 
57
- `setup` inspects non-test UI source and reports what it could establish:
59
+ Work through these four review stages to get a useful first result.
58
60
 
59
- ```text
60
- ux-guard setup
61
+ ### 1. Define the user outcomes that matter
61
62
 
62
- Inspected
63
- 1 non-test UI source files across 1 source roots.
64
- TypeScript projects: tsconfig.json.
65
- Component libraries: (none observed).
66
- Icon libraries: (none observed).
67
- Signals: component use, control props, icons, styling, pattern debt.
63
+ Start with workflows, not routes or components. Identify who is trying to do
64
+ what and what success means. Entry points are optional implementation bindings,
65
+ so an important use case can be defined before its route or prompt is known.
66
+ Known bindings may be mapped navigation surfaces, direct application routes
67
+ such as `/login`, or assistant prompts. Discovery records only bindings backed
68
+ by repository routes, workflows, or tests; it does not invent them.
69
+ Approval provenance is recorded separately when the catalog is adopted.
68
70
 
69
- Good
70
- - Inspected 1 non-test UI source files.
71
- - No inline styles were observed in the inspected files.
72
- - No pixel literals were observed in the inspected files.
73
- - No raw button elements were observed in the inspected files.
74
- - No icon-library uses were observed in the inspected files.
71
+ > Help me define and review ux-guard use cases for this repo. Identify the
72
+ > important user workflows, personas, goals, success outcomes, priority tiers,
73
+ > and effects. Record known entry points as optional bindings and leave unknown
74
+ > bindings visible. Prepare the use-case catalog for review, but do not approve
75
+ > or activate it.
75
76
 
76
- Needs attention
77
- - 3 hard-coded colors observed; review before deciding policy.
78
- src/Page.tsx: 3
77
+ A product owner should confirm that the catalog covers the workflows whose
78
+ quality and backslide actually matter.
79
79
 
80
- Unknown
81
- - Observed conventions have not been approved as policy.
82
- - No use-case catalog was inspected, so workflow coverage is unknown.
83
- - No trusted baseline was used, so regression from main is unknown.
84
- - Enforcement is not enabled.
80
+ ### 2. Decide which UI patterns are allowed
85
81
 
86
- Next steps
87
- 1. Define the important user workflows and use cases. Agent Skill prompt: "Help me define ux-guard use cases for this repo"
88
- 2. Review the observed styling and pattern issues (hard-coded colors) and decide which are intentional conventions versus UX debt. Agent Skill prompt: "Review ux-guard's observed hard-coded colors in this repo and help me decide which are intentional conventions versus UX debt; do not change policy or baselines"
89
- 3. Decide what should become reviewed policy and prepare the initial baseline. Use ux-guard/setup-proposal.json as a supporting review file; it contains observed source roots, component and icon usage, pattern counts, and unresolved policy choices. Do not activate policy or baseline until a human explicitly approves them. Agent Skill prompt: "Help me review ux-guard/setup-proposal.json, decide what should become reviewed ux-guard policy, and prepare the initial baseline; do not activate anything until I explicitly approve it"
90
- 4. After human approval and activation, run ux-guard check and ux-guard report; report will explain any remaining journey evidence gaps.
91
- No policy, baseline, waiver, or enforcement was activated.
92
- ```
82
+ Review what setup observed: buttons and other controls, their props, component
83
+ and icon libraries, styling, and repeated pattern debt. Frequency is evidence
84
+ of current usage, not proof that a pattern is good.
93
85
 
94
- The ordered next steps come from the findings: pattern review is omitted when
95
- no pattern issues were observed, and catalog or baseline work appears only
96
- when that evidence is missing. Setup does not activate policy, a baseline, a
97
- waiver, or enforcement, and it never overwrites existing review work.
86
+ > Inspect ux-guard's setup findings and `ux-guard/setup-proposal.json`. Show me
87
+ > the observed controls, control props, components, icons, and styling patterns.
88
+ > Help me classify each as an approved convention, tolerated existing debt to
89
+ > record in the baseline, or a non-approved pattern to fix. Do not change policy
90
+ > or baselines.
98
91
 
99
- If there is no executable UI evidence yet, setup says so, writes nothing, and
100
- gives the next safe action instead of reporting success.
92
+ The product or design owner makes those classifications. Approved conventions
93
+ become policy. Tolerated debt can be recorded so new debt is visible.
94
+ Non-approved patterns should not be legitimized by a baseline.
95
+
96
+ ### 3. Prepare reviewed comparison evidence
97
+
98
+ A baseline records what happened; it does not declare the experience good.
99
+ Collect only evidence that really executed. If a browser journey cannot run,
100
+ leave it unknown instead of creating substitute data.
101
+
102
+ > Prepare ux-guard's baseline review work for the approved use cases and UI
103
+ > conventions. Use only real repository evidence: the setup proposal for static
104
+ > patterns and the existing browser harness for configured journeys or visuals.
105
+ > Show what each proposed baseline would tolerate, keep every artifact
106
+ > unapproved, and stop before promotion.
101
107
 
102
- ## Understand results
108
+ Review pattern, journey, and visual evidence separately. The owner should reject
109
+ unexpected controls, failed workflows, unstable screenshots, or incomplete
110
+ coverage instead of accepting them just to make a check pass.
103
111
 
104
- Suppose a reviewed pattern baseline contains `Button size="sm"` and a change
105
- introduces `Button size="xl"`:
112
+ ### 4. Run the first meaningful check
106
113
 
107
- - `check` reports a new control value and exits `1`.
108
- - A journey report may still say that a tested workflow is acceptable. That
109
- advisory UX verdict does not erase the policy finding.
110
- - If no trusted workflow baseline was available, regression remains unknown.
111
- - If the baseline contains the same value, `unchanged` means only “equal to
112
- reviewed comparison evidence.” It does not mean the UX is good.
114
+ Approval must name the exact review artifacts and the files they may create.
115
+ After that one-time approval, ask the agent to activate only those artifacts and
116
+ run the checks:
113
117
 
114
- Exit `0` means no enforceable catalog or pattern finding. Exit `1` means those
115
- findings are present. Exit `2` means configuration, evidence, or execution
116
- failed; it must not be interpreted as clean.
118
+ > These exact ux-guard review artifacts and resulting files are approved:
119
+ > [list paths]. Activate only those approvals. Run ux-guard check and, if
120
+ > journey reporting is configured, ux-guard report. Explain the first result as
121
+ > good, needs attention, and unknown. Separate enforceable policy findings from
122
+ > advisory UX findings. Do not add waivers or change policy or baselines.
123
+
124
+ You now have a result tied to product-owned workflows, reviewed UI conventions,
125
+ and actual evidence. Missing or unexecutable evidence remains visible rather
126
+ than being reported as success.
117
127
 
118
128
  ## Daily use
119
129
 
120
- After reviewed policy is active:
130
+ ### Check current work
131
+
132
+ > Check my current work with ux-guard. Run the installed local check and, when
133
+ > configured, report. Summarize good, needs attention, and unknown evidence. Do
134
+ > not change policy, baselines, waivers, or enforcement.
135
+
136
+ ### Compare a change with `main`
137
+
138
+ > Compare this change with `origin/main` using ux-guard's trusted-base mode.
139
+ > Explain every policy finding and advisory backslide signal, including missing
140
+ > evidence. Do not change policy or baselines.
141
+
142
+ ### Explain and fix findings
143
+
144
+ > Explain the ux-guard findings in this branch, then fix the actionable UI
145
+ > issues without weakening policy, adding waivers, or updating baselines just
146
+ > to make the result green. Explain the intended user outcome before editing
147
+ > production UI, and rerun the same ux-guard checks afterward.
148
+
149
+ CLI and CI equivalents:
121
150
 
122
151
  ```sh
152
+ # Current working tree
123
153
  npx ux-guard check
124
154
  npx ux-guard report
155
+
156
+ # Current code against reviewed policy and baselines from main
157
+ npx ux-guard check --base origin/main
158
+ npx ux-guard report --base origin/main
125
159
  ```
126
160
 
127
- Use a trusted base when reviewing a change against policy and baselines from
128
- main:
161
+ `check` validates the use-case catalog and source patterns. Configured journey
162
+ and visual evidence appears in advisory sections. `report` explains journey
163
+ quality, evidence gaps, targets, regression, supported scores, and
164
+ recommendations. `report` requires reviewed journey policy and a configured
165
+ journey report path; until those exist, use `check` and complete the missing
166
+ setup.
167
+
168
+ A saved partial use-case review can be assessed before adoption without
169
+ changing active policy:
129
170
 
130
171
  ```sh
131
- npx ux-guard check --base origin/main
132
- npx ux-guard report --base origin/main
172
+ npx ux-guard review audit \
173
+ --base origin/main \
174
+ --candidate ux-guard/use-case-candidate.json \
175
+ --review ux-guard/use-case-review.json \
176
+ --preview ux-guard/use-case-catalog.preview.yml \
177
+ --format markdown
133
178
  ```
134
179
 
135
- `check` validates the use-case catalog and source patterns, then includes
136
- configured journey and visual evidence as advisory sections. `report` explains
137
- configured UX quality, evidence gaps, target attainment, regression, supported
138
- scores, and recommendations. Report generation requires reviewed journey
139
- policy; until then, the CLI explains what is missing.
180
+ `review audit` requires the on-disk preview to match the saved review exactly.
181
+ It labels active policy and the preview separately, scans candidate source
182
+ against trusted catalog/control policy, and reports review readiness, mapping,
183
+ journey evidence, quality, targets, regression, and score-or-not-scored per use
184
+ case. `--journey-report <path>` can select a versioned current evidence file
185
+ without changing configuration. Visual comparison is not reused implicitly;
186
+ pass `--visual-candidate <path>` only for an explicitly current visual
187
+ manifest. Missing, old-version, or invalid evidence is reported as unknown and
188
+ produces a fail-closed guard recommendation; the audit command itself remains
189
+ read-only and advisory. Compatible local measurements can support diagnostic
190
+ quality and scores, but their guard recommendation remains unknown until a
191
+ pinned-base authoritative runner regenerates them as trusted execution.
192
+
193
+ ## Review use cases
194
+
195
+ The use-case catalog says which user workflows matter. To build or extend it,
196
+ ask your agent:
197
+
198
+ > Help me discover and review the important use cases in this repository.
199
+ > Populate every required definition field that repository evidence supports.
200
+ > If a field cannot be supported, mark the item as an incomplete draft, add a
201
+ > focused unresolved question, and never invent a goal. Open ux-guard’s local
202
+ > review experience, explain the proposals and drafts in plain language, and
203
+ > do not activate policy without my explicit approval.
204
+
205
+ Record only evidence-backed navigation, direct-route, or assistant entry
206
+ points. Unknown bindings stay absent and visible as unknown coverage.
207
+
208
+ The agent drafts an assessment, `ux-guard review prepare` stamps it with
209
+ repository identity, and `ux-guard review` opens a local app:
210
+
211
+ ```sh
212
+ npx ux-guard review
213
+ ```
214
+
215
+ Discovery distinguishes a complete **proposal** from an incomplete **draft**.
216
+ A proposal has every definition field needed for direct acceptance: id/title,
217
+ persona, goal, success outcome, tier, and effect. A draft is missing at least
218
+ one of those fields because repository evidence could not support it; it carries
219
+ a focused unresolved question instead of invented content. Owner metadata and
220
+ entry-point bindings do not affect this distinction.
221
+
222
+ In the app, a complete proposal offers one **Approve this use case** decision.
223
+ It accepts the complete definition currently shown, including edits. Reset to
224
+ the assessment proposal first when that is the definition you want to approve.
225
+ Incomplete drafts lead with **Complete this draft** and field-specific
226
+ guidance; after completion, their distinct action is **Accept completed use
227
+ case**. Reject, merge, and split remain available, and merge uses an explicit
228
+ searchable target picker with a movement preview. Saving records only an
229
+ unapproved review. Use cases without entry-point bindings remain in the preview
230
+ with implementation coverage marked unknown.
231
+
232
+ Later, resume with:
233
+
234
+ > Continue my ux-guard use-case review.
235
+
236
+ > Open the ux-guard review app for this repository.
237
+
238
+ > Help me resolve the remaining unmapped workflows and exclusions. Do not
239
+ > approve or activate anything.
240
+
241
+ Changing the active catalog is a separate owner command, `ux-guard review
242
+ adopt`, which requires a saved, current, conflict-free review and prints who
243
+ approved it. Checking in the catalog and enforcement remain separate
244
+ decisions. The app binds only to `127.0.0.1`, loads no external assets, and
245
+ sends no telemetry. See [use-case review](docs/use-case-review.md) and its
246
+ [design](docs/use-case-review-design.md).
247
+
248
+ ## Reading a result
249
+
250
+ - **Policy finding:** current code conflicts with a reviewed catalog or static
251
+ pattern decision.
252
+ - **Advisory finding:** journey, target, regression, score, or visual evidence
253
+ needs attention but is not enforced by `report`.
254
+ - **Unknown:** evidence was missing, incompatible, or could not execute. Unknown
255
+ never means clean.
256
+ - **Unchanged:** current evidence matches the reviewed comparison evidence. It
257
+ does not mean the UX is good.
258
+
259
+ For example, if a reviewed pattern baseline contains `Button size="sm"` and a
260
+ change introduces `Button size="xl"`, `check` reports a new control value. A
261
+ journey can still receive an acceptable advisory verdict; that does not erase
262
+ the policy finding.
263
+
264
+ ## Safety and approval
265
+
266
+ - `setup` never activates policy, a baseline, a waiver, or enforcement.
267
+ - Setup supporting files and baseline promotions never silently overwrite
268
+ existing review work.
269
+ - If setup finds no executable UI source evidence, it writes nothing and
270
+ explains the next safe action.
271
+ - Observed usage is inventory, not approval. A human must approve policy,
272
+ tolerated debt, targets, and comparison evidence.
273
+ - A baseline can preserve known defects for comparison without declaring them
274
+ acceptable.
275
+ - `report` is advisory. A rendered report can describe a regression or target
276
+ breach and still exit successfully.
277
+ - Merge prevention exists only when the repository adopts a reviewed
278
+ enforcement decision and configures the relevant trusted check as required
279
+ in CI.
280
+
281
+ ### Exit codes
282
+
283
+ - `check` exits `0` when no enforceable catalog or static-pattern finding is
284
+ present, `1` when one is present, and `2` when configuration, evidence, or
285
+ execution failed.
286
+ - `report` exits `0` when it renders successfully, even with advisory findings.
287
+ Missing active journey policy and malformed or unsafe inputs exit `2`.
288
+
289
+ Never interpret exit `0` as a blanket UX approval or exit `2` as clean.
140
290
 
141
291
  ## Scoring and backslide protection
142
292
 
143
- [Detailed scoring and backslide semantics](docs/scoring-and-backslide.md) ·
144
- [CLI commands and exit behavior](docs/cli-reference.md#scoring-and-backslide-protection)
293
+ Scores exist only for explicit, reviewed, product-owned metric targets. A score
294
+ describes target performance, not overall quality, and ux-guard does not create
295
+ a product-wide score. Trusted-base mode loads policy and baselines from the
296
+ resolved base commit so the change under review cannot redefine its judge.
145
297
 
146
- ### Where scoring appears
298
+ See [scoring and backslide semantics](docs/scoring-and-backslide.md) for the
299
+ formulas, comparison signals, and enforcement boundaries.
147
300
 
148
- After reviewed policy is active, `npx ux-guard report` shows quality verdict,
149
- target attainment, regression/backslide, and numerical scores as separate
150
- outputs. `npx ux-guard report --base origin/main` shows the same outputs while
151
- loading reviewed policy and baselines from `origin/main`. Markdown uses
152
- separate sections; JSON uses separate `quality`, `targetAttainment`,
153
- `regression`, and `scoring` fields.
301
+ Useful Agent Skill prompts:
154
302
 
155
- ### How to get and interpret scores
303
+ > Show me where ux-guard scoring comes from and explain every score.
156
304
 
157
- A score exists only for an explicit, reviewed, product-owned `at-most` metric
158
- target. A met target scores 100. A breach scores
159
- `round(100 * target / actual)`; a breached zero target scores 0. For example,
160
- a target of at most 3 edited fields with an actual value of 4 scores 75.
161
- That 75 is target performance, not the quality verdict: quality can remain
162
- acceptable while a product-owned target is breached.
305
+ > Compare this branch with origin/main and explain every backslide signal; do
306
+ > not change policy or baselines.
163
307
 
164
- A journey score is the weakest score among its scoreable configured metrics.
165
- A use-case score is the minimum across its scored required journeys, so a
166
- stronger workflow cannot hide a weaker one. Missing, unexecutable, or
167
- unmeasured evidence is not scored and remains explicit as partial or
168
- not-scored. ux-guard does not calculate a product-wide scalar score.
308
+ ## Setup output reference
169
309
 
170
- ### Whether and how ux-guard prevents backslide
310
+ Setup tailors its next steps to the observations it found. Pattern review is
311
+ omitted when no potential pattern problems were observed. Catalog or baseline
312
+ work appears only when that evidence is missing.
171
313
 
172
- Trusted-base mode loads reviewed main policy and baselines before evaluating
173
- candidate source and evidence, so candidate code cannot redefine its judge. It
174
- detects reviewed-tolerance metric increases, journey lifecycle degradation or
175
- missing journeys, new findings and severity increases, hard-floor breaches,
176
- static pattern-debt growth, and visual manifest, profile, hash, or dimension
177
- drift.
314
+ `setup` inspects non-test UI source and reports what it could establish:
315
+
316
+ ```text
317
+ ux-guard setup
318
+
319
+ Inspected
320
+ 1 non-test UI source files across 1 source roots.
321
+ TypeScript projects: tsconfig.json.
322
+ Component libraries: (none observed).
323
+ Icon libraries: (none observed).
324
+ Signals: component use, control props, icons, styling, pattern debt.
325
+
326
+ Good
327
+ - Inspected 1 non-test UI source files.
328
+ - No inline styles were observed in the inspected files.
329
+ - No pixel literals were observed in the inspected files.
330
+ - No raw button elements were observed in the inspected files.
331
+ - No icon-library uses were observed in the inspected files.
178
332
 
179
- Detection is advisory by default. A successfully rendered `report` exits 0
180
- even when it describes a target breach or regression; it does not block a
181
- merge. `check` exits 1 for enforceable catalog or static-pattern findings and
182
- 2 for configuration, evidence, or execution failure. Journey, target,
183
- regression, and visual results remain advisory unless the consumer adds a
184
- trusted classifier or other reviewed enforcement decision. Merge prevention
185
- occurs only when the consumer configures trusted ux-guard execution as a
186
- required CI check; making `report` alone required does not turn advisory
187
- signals into a failure.
333
+ Needs attention
334
+ - 3 hard-coded colors observed; review before deciding policy.
335
+ src/Page.tsx: 3
188
336
 
189
- Ask an Agent Skill:
337
+ Unknown
338
+ - Observed conventions have not been approved as policy.
339
+ - No use-case catalog was inspected, so workflow coverage is unknown.
340
+ - No trusted baseline was used, so regression from main is unknown.
341
+ - Enforcement is not enabled.
190
342
 
191
- > Show me where ux-guard scoring comes from and explain every score
343
+ Next steps
344
+ 1. Define the important user workflows and use cases. Agent Skill prompt: "Help me define ux-guard use cases for this repo"
345
+ 2. Review the observed styling and pattern issues (hard-coded colors) and decide which are intentional conventions versus UX debt. Agent Skill prompt: "Review ux-guard's observed hard-coded colors in this repo and help me decide which are intentional conventions versus UX debt; do not change policy or baselines"
346
+ 3. Decide what should become reviewed policy and prepare the initial baseline. Use ux-guard/setup-proposal.json as a supporting review file; it contains observed source roots, component and icon usage, pattern counts, and unresolved policy choices. Do not activate policy or baseline until a human explicitly approves them. Agent Skill prompt: "Help me review ux-guard/setup-proposal.json, decide what should become reviewed ux-guard policy, and prepare the initial baseline; do not activate anything until I explicitly approve it"
347
+ 4. After human approval and activation, run ux-guard check. Run ux-guard report after reviewed journey policy and a journey report path are configured.
348
+ No policy, baseline, waiver, or enforcement was activated.
349
+ ```
192
350
 
193
- > Compare this branch with origin/main and explain every backslide signal; do
194
- > not change policy or baselines
351
+ If no executable UI source evidence is available, setup writes nothing and
352
+ gives the next safe action instead of reporting success.
195
353
 
196
354
  ## Reference
197
355
 
198
356
  - [CLI reference and advanced maintainer commands](docs/cli-reference.md)
357
+ - [Use-case review](docs/use-case-review.md)
358
+ - [Use-case review design](docs/use-case-review-design.md)
199
359
  - [Scoring and backslide semantics](docs/scoring-and-backslide.md)
200
- - [111-test catalog](docs/test-suite.md)
360
+ - [Enumerated 160-test catalog and verification commands](docs/test-suite.md)
201
361
  - [Contributing](CONTRIBUTING.md)
202
362
  - [Security policy](SECURITY.md)
203
363
  - [Source provenance](PROVENANCE.md)
@@ -218,7 +378,7 @@ The package exposes eleven explicit module subpaths:
218
378
  - `@edjbarron/ux-guard/verdicts`
219
379
 
220
380
  TypeScript `5.9.3` is an exact runtime dependency. The ux-guard tool version
221
- is `0.6.1`, and existing public schema versions are unchanged.
381
+ is `0.7.0`, and existing public schema versions are unchanged.
222
382
 
223
383
  ## Development
224
384
 
@@ -8,6 +8,7 @@ The primary workflow is:
8
8
 
9
9
  ```sh
10
10
  ux-guard setup
11
+ ux-guard review
11
12
  ux-guard check
12
13
  ux-guard report
13
14
  ```
@@ -58,6 +59,43 @@ markdown` for a review document or `--format json` for another renderer.
58
59
  `report` requires configured journey policy. Missing or unexecutable evidence
59
60
  stays visible as incomplete or unavailable.
60
61
 
62
+ ### `review`
63
+
64
+ Opens a local app for reviewing proposed use cases. See
65
+ [use-case review](use-case-review.md) for the workflow, draft format, and
66
+ safety model.
67
+
68
+ - `review` starts the app on `127.0.0.1`. Without a candidate, it explains
69
+ what is missing, prints an agent prompt, and writes nothing.
70
+ - `review --format json` reports review status without starting the app.
71
+ - `review prepare` validates `ux-guard/use-case-draft.json` and writes an
72
+ unapproved, identity-stamped candidate without overwriting.
73
+ - `review audit --base <ref> --format json|markdown` evaluates the exact saved
74
+ preview against trusted policy without adopting it. `--journey-report
75
+ <path>` selects versioned current evidence while leaving configuration
76
+ unchanged. `--visual-candidate <path>` opts into an explicitly current visual
77
+ manifest; historical configured visual candidates are not reused implicitly.
78
+ The output separates active and preview state, readiness,
79
+ source/control findings, evidence compatibility, quality, targets,
80
+ regression, and per-use-case score-or-not-scored.
81
+ - `review adopt` writes the active catalog after explicit owner approval. It
82
+ requires `--reviewer`, `--reviewed-at`, `--rationale`, a saved, current,
83
+ conflict-free review, and `--replace-catalog-sha256` when a catalog exists.
84
+
85
+ Saving in the app writes only `ux-guard/use-case-review.json` and
86
+ `ux-guard/use-case-catalog.preview.yml`, both unapproved. No review command
87
+ changes configuration, baselines, targets, waivers, inventory, or
88
+ enforcement.
89
+
90
+ `review audit` exits 0 when it renders successfully. Findings and missing or
91
+ incompatible evidence appear in `guard.recommendedExit` as 1 or 2; applying
92
+ that recommendation in CI requires a separate reviewed enforcement decision.
93
+ Malformed trusted policy, unsafe inputs, a missing base, or a stale preview
94
+ match exit 2.
95
+ Compatible local journey evidence remains candidate-untrusted: it can render
96
+ diagnostic quality and scores, but its check-in recommendation stays at exit 2
97
+ until pinned-base authoritative regeneration establishes trusted execution.
98
+
61
99
  ### Trusted-base comparisons
62
100
 
63
101
  `check --base <ref>` and `report --base <ref>` load reviewed policy, targets,
@@ -89,6 +89,46 @@ report returns 0.
89
89
  Consumers that choose to enforce advisory signals need a trusted classifier or
90
90
  wrapper with an explicit reviewed failure policy.
91
91
 
92
+ ## Prepared trusted check-in guard
93
+
94
+ `review audit` exposes a non-activating `guard.recommendedExit` for the saved
95
+ unapproved preview. A check-in guard should use the same meanings only after a
96
+ separate enforcement review:
97
+
98
+ - exit 0: trusted execution completed, required evidence is compatible, and no
99
+ selected reviewed-policy finding, regression, or target breach was observed;
100
+ - exit 1: candidate code/source has a reviewed catalog or control-policy
101
+ finding, trusted regression, or reviewed-target breach;
102
+ - exit 2: trusted configuration, evidence, or execution is missing,
103
+ incompatible, invalid, or failed, so the result is unknown rather than
104
+ clean;
105
+ - exit 3: candidate catalog, workflow, target, control policy, or baseline
106
+ files differ from the trusted base and require a separate visible policy
107
+ review. The candidate version is never used to judge itself.
108
+
109
+ If several categories apply, the report must retain all of them. Execution or
110
+ evidence failure takes exit 2 precedence, explicit policy-review work takes
111
+ exit 3 precedence over code findings, and code findings take exit 1. A
112
+ consumer can choose a stricter reviewed policy, but it must not silently turn
113
+ unknown evidence into success.
114
+
115
+ The trusted implementation, configuration, policy, targets, and baselines must
116
+ be extracted from an immutable base commit such as `origin/main`. Candidate
117
+ browser shards and source are inputs only. The repository should first run the
118
+ classifier as advisory, inspect its JSON/Markdown artifacts, then require the
119
+ check only after an explicit human approval names the command, selected
120
+ blocking signals, trusted base, and CI job. Neither ux-guard nor an agent should
121
+ enable that requirement automatically.
122
+
123
+ Every blocking result has two legitimate remediation paths:
124
+
125
+ 1. fix candidate product/source code and regenerate evidence;
126
+ 2. prepare an explicit policy, use-case, workflow, target, control, or baseline
127
+ candidate with a visible diff for separate review.
128
+
129
+ Automatically updating a baseline, target, waiver, or policy to make the same
130
+ candidate pass is never a remediation.
131
+
92
132
  Useful Agent Skill prompts:
93
133
 
94
134
  > Show me where ux-guard scoring comes from and explain every score