@cassiomc1/forgeloop 1.1.0 → 1.2.1

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.
@@ -3,7 +3,7 @@ name: design-code-eng
3
3
  language: en
4
4
  description: "Visual direction, UX, motion, and perceived performance for premium digital experiences."
5
5
  version: "2026.09"
6
- last-reviewed: "2026-08-10"
6
+ last-reviewed: "2026-08-17"
7
7
  guide-id: design
8
8
  requires-gates:
9
9
  - design
@@ -342,7 +342,10 @@ Select references for a product problem; they do not override project tokens or
342
342
 
343
343
  - **Technical diagrams and architecture flows**: for polished Mermaid-based architecture and workflow diagrams, use [Beautiful Mermaid by Craft](https://agents.craft.do/mermaid) when relevant; preserve canonical Mermaid source, local versioned SVG assets, and do not treat presentation tooling as a mandatory protocol gate or runtime dependency.
344
344
  - **Component source and interaction inspiration**: use [21st.dev](https://21st.dev/) to study components and interactions; inspect each source, dependency, community contribution, and premium-material term before adoption.
345
- - **Component and motion inspiration**: use [React Bits](https://reactbits.dev/) to study component and motion behavior; distinguish public/free material from React Bits Pro and inspect each source/dependency license.
345
+ - **AI-agent and conversational UI reference**: use [AIcss](https://www.aicss.dev/) to study specialized AI-agent and assistant interfaces (streaming responses, tool/action states, diffs, citations, structured outputs, agent inputs, and approval cards) when the target actually has an AI-agent surface.
346
+ - **React component and motion reference**: use [React Bits](https://reactbits.dev/) to discover animated React components and interaction patterns, and inspect the [React Bits source repository](https://github.com/DavidHDev/react-bits) before adopting code. Use it only when the target stack is React or when a deliberate, reviewed adaptation is appropriate. Prefer the smallest component or pattern that solves the product need; do not install or copy the entire library by default. Inspect the exact component source, transitive dependencies, license/usage terms, accessibility behavior, reduced-motion behavior, responsive behavior, and runtime cost before adoption. Adapt tokens, typography, spacing, states, semantics, and motion to the target project's design system instead of preserving React Bits defaults.
347
+ - **React and Next.js animated components**: use [beUI](https://beui.dev/) and its [source repository](https://github.com/starc007/ui-components) to study React/Next.js animated components built with Motion and Tailwind; prefer source-level adoption of the smallest matching component when the target stack fits.
348
+ - **Page and theme transitions**: use [Transition Kit](https://transition-kit.space/) and its [source repository](https://github.com/AbdullahMukadam/Transition-kit) as a reference for CSS-first page and theme transitions built around the View Transitions API; use as progressive enhancement only with functional fallback.
346
349
  - **Component inspiration**: use [Fancy Components](https://www.fancycomponents.dev/) to study component composition; verify its terms separately from Motion, Tailwind, shadcn, or other dependencies.
347
350
  - **Motion primitives**: use [Motion Primitives](https://motion-primitives.com/) to study discrete interaction patterns; distinguish documented open-source material from its Pro offering and verify component/dependency terms.
348
351
  - **Component and design-system research**: use [Component Gallery](https://component.gallery/) for comparison, not for license assumptions.
@@ -351,6 +354,103 @@ Select references for a product problem; they do not override project tokens or
351
354
  - **Typography discovery**: verify each [UNCUT](https://uncut.wtf/) font's author, license, weights, and hosting rights.
352
355
  - **Creative coding and WebGL**: [cables.gl](https://cables.gl/) requires a semantic fallback, pause/offscreen behavior, a performance budget, and asset/operator provenance.
353
356
 
357
+ ### External UI/component reference adoption
358
+
359
+ External galleries, component registries, motion libraries, and UI references are discovery inputs, not product requirements.
360
+
361
+ Before materially adopting an external component or interaction:
362
+
363
+ 1. define the concrete UI need first;
364
+ 2. confirm the target stack and existing design system;
365
+ 3. inspect the exact component/source rather than relying on a gallery preview;
366
+ 4. verify current license/terms and any premium/free boundary;
367
+ 5. inspect runtime dependencies and avoid introducing a second animation or UI stack without a measured reason;
368
+ 6. verify keyboard/focus semantics, contrast, responsive behavior, touch, loading/error/disabled states, and reduced motion;
369
+ 7. evaluate bundle/runtime cost and browser/platform support;
370
+ 8. adapt the smallest useful source into the target project's tokens, architecture, and component conventions;
371
+ 9. record source/provenance when materially adopted;
372
+ 10. re-run target-project verification after adaptation.
373
+
374
+ Do not install or copy an entire component library merely because one example looks useful. When React Bits, beUI, Motion Primitives, or another motion/component source could all satisfy the same need, choose one smallest compatible implementation; do not combine libraries for variety. ForgeLoop itself must not gain a dependency on any resource listed in this section.
375
+
376
+ ### React Bits — operational use for React interfaces
377
+
378
+ React Bits is an optional implementation/reference source for high-finish React interfaces. It is not a required ForgeLoop tool, protocol dependency, verification dependency, or design-system replacement.
379
+
380
+ Use it when:
381
+
382
+ - the target application uses React;
383
+ - a concrete interaction, text treatment, background, reveal, or UI component would materially improve the product experience;
384
+ - implementing the behavior from scratch would add unnecessary design or engineering cost;
385
+ - the effect fits the selected motion intensity and visual direction.
386
+
387
+ Do not use it when:
388
+
389
+ - the target is not React and adaptation would add more complexity than value;
390
+ - the component exists only as decoration without a product or communication purpose;
391
+ - the same result already exists in the target project's design system;
392
+ - the component violates the project's accessibility, performance, security, dependency, or browser-support constraints;
393
+ - a static or simpler CSS/HTML implementation communicates the same result more clearly.
394
+
395
+ Adoption workflow:
396
+
397
+ 1. **Define the need first.** Identify the concrete UI or communication problem before browsing components.
398
+ 2. **Confirm the target stack.** Verify React version, styling strategy, TypeScript/JavaScript choice, SSR/CSR boundary, and existing animation/runtime libraries.
399
+ 3. **Inspect the source.** Review the exact component in the [React Bits repository](https://github.com/DavidHDev/react-bits), not only the visual demo.
400
+ 4. **Check usage terms.** Verify the current license and any component-specific dependency or attribution requirements before copying or installing code.
401
+ 5. **Choose the smallest variant.** Prefer one component/pattern and the variant matching the project (JS/TS and CSS/Tailwind); do not add unrelated components.
402
+ 6. **Prefer local adaptation.** Adapt the component into the target project's component structure and semantic tokens rather than importing a visual identity wholesale.
403
+ 7. **Preserve semantics.** Text, controls, navigation, forms, focus states, errors, status information, and primary actions must remain semantic and usable without decorative motion.
404
+ 8. **Respect reduced motion.** Provide a static or substantially reduced alternative under `prefers-reduced-motion`; essential information must never depend on animation.
405
+ 9. **Bound runtime cost.** Lazy-load expensive effects when practical, pause continuous animation outside the viewport or on hidden pages, and avoid adding duplicate animation/runtime libraries without justification.
406
+ 10. **Verify the result.** Test keyboard/focus behavior, contrast, 320 CSS px reflow, touch behavior, reduced motion, console/runtime errors, and the project's performance budget.
407
+ 11. **Record provenance.** When code or a material implementation pattern is adopted, record React Bits as an external source in the task/project attribution or source record when applicable.
408
+
409
+ ForgeLoop runtime must not gain a dependency on React Bits as a result of this guidance. Any installation belongs to the target project and remains subject to normal authorization and dependency policy.
410
+
411
+ ### AIcss — contextual AI-agent and conversational UI reference
412
+
413
+ [AIcss](https://www.aicss.dev/) is a specialized reference for AI-agent and conversational product surfaces (streaming responses, tool/action execution states, diffs, citations, structured outputs, agent inputs, and approval/status cards).
414
+
415
+ Use AIcss as a candidate only when at least one of these is in scope:
416
+
417
+ - streamed assistant output;
418
+ - visible tool execution/status;
419
+ - source citations;
420
+ - file/code diffs;
421
+ - structured agent results;
422
+ - agent-specific input/approval interaction.
423
+
424
+ For ordinary SaaS, editorial, portfolio, or marketing UI without those surfaces, use general component/design references instead.
425
+
426
+ > [!IMPORTANT]
427
+ > **Safety and Hidden-Reasoning Boundary**: AIcss labels such as "thinking" or "reasoning" describe presentation patterns, not an evidence source. They do not authorize exposing private chain-of-thought or hidden model state. Prefer concise observable progress/status information that the target product is permitted to show.
428
+
429
+ ### beUI — React/Next animated component source
430
+
431
+ [beUI](https://beui.dev/) and its source repository [starc007/ui-components](https://github.com/starc007/ui-components) provide copy-paste animated components for React/Next.js using Motion and Tailwind.
432
+
433
+ - **Smallest-Adoption Rule**: Prefer source-level adoption of the smallest matching component. Do not run its shadcn command, install its agent skill, or add Motion/Tailwind merely because the catalog is available. Any installation belongs to the target project and follows normal authorization and dependency policy.
434
+ - **Verification Expectations**: For any materially adopted animated component, verify keyboard/focus access, touch targets, reduced-motion behavior (`prefers-reduced-motion`), responsive reflow at 320 CSS px, loading/error/disabled states, console/runtime errors, and bundle/runtime impact.
435
+
436
+ ### Transition Kit — progressive-enhancement page and theme transitions
437
+
438
+ [Transition Kit](https://transition-kit.space/) and its source repository [AbdullahMukadam/Transition-kit](https://github.com/AbdullahMukadam/Transition-kit) provide CSS-first page and theme transitions built around the View Transitions API.
439
+
440
+ For Transition Kit or any View Transitions API effect:
441
+
442
+ 1. **Functional Base First**: The page navigation or theme switch action must work completely without the transition; enhancement never owns essential meaning or action.
443
+ 2. **Implementation-Time Capability Check**: Check current target-browser support for the View Transitions API at implementation time rather than assuming static support tables.
444
+ 3. **Graceful Fallback**: Unsupported browsers must receive a functional, immediate fallback without errors or layout shifts.
445
+ 4. **Reduced Motion**: Under `prefers-reduced-motion`, provide an equivalent static or near-instant path.
446
+ 5. **State Preservation**: Ensure focus management, navigation/history, scroll restoration, theme persistence, and interactive controls remain correct during and after transitions.
447
+ 6. **Motion Budget**: Transition duration and easing must respect the product motion budget.
448
+ 7. **No Protocol Dependency**: Adapt copied CSS/JS into the target project architecture instead of creating a ForgeLoop dependency.
449
+
450
+ ### Target-Project React Diagnostics Cross-Reference
451
+
452
+ For React-specific supplemental diagnostics after implementation, including design-tagged findings when supported by the adopted version, see [`test-code-eng.md`](./test-code-eng.md). React Doctor is a verifier candidate, not a component/design source.
453
+
354
454
  ---
355
455
 
356
456
  ## UX, Accessibility, and Quality
@@ -3,7 +3,7 @@ name: taste-frontend-eng
3
3
  language: en
4
4
  description: "Contextual visual-taste review for premium frontend and brand-heavy work."
5
5
  version: "2026.09"
6
- last-reviewed: "2026-08-10"
6
+ last-reviewed: "2026-08-17"
7
7
  guide-id: taste
8
8
  ---
9
9
 
@@ -107,8 +107,12 @@ Use the existing product system when one is present. If the target has no
107
107
  system, choose a small coherent set of semantic tokens, components, states,
108
108
  and usage rules that the team can maintain. A vendor guide, gallery, template,
109
109
  or AI output can inform a direction, but it is not evidence of product fit,
110
- license, accessibility, or performance. Keep any external reference in the
111
- task's source and attribution records; do not add a network dependency to
110
+ license, accessibility, or performance. For external component, AI-interface,
111
+ or motion references including React Bits, AIcss, beUI, and Transition Kit
112
+ when contextually applicable — follow the canonical adoption rules in
113
+ [`design-code-eng.md`](./design-code-eng.md) rather than treating a gallery
114
+ component as a project design-system default. Keep any external reference in
115
+ the task's source and attribution records; do not add a network dependency to
112
116
  ForgeLoop runtime.
113
117
 
114
118
  ## Visual Pre-Flight
@@ -68,6 +68,7 @@ A tool is a candidate, not a ranking winner. Record the decision in the reposito
68
68
  | Real services | [Testcontainers](https://testcontainers.com/), stack-native harness | required fidelity, container availability, time, and CI isolation |
69
69
  | HTTP/event contracts | [Pact](https://docs.pact.io/), OpenAPI/JSON Schema/GraphQL schema | consumer/provider ownership, versioning, and compatibility across deployments |
70
70
  | Performance | [k6](https://grafana.com/docs/k6/latest/), [Gatling](https://docs.gatling.io/), [JMeter](https://jmeter.apache.org/usermanual/), or [Locust](https://docs.locust.io/) | protocol, load model, volume, distribution, metrics, and team operability |
71
+ | React code quality diagnostics | [React Doctor](https://github.com/millionco/react-doctor) plus the project's existing lint/test/type/a11y/security tools | candidate supplemental scan for React targets; evaluate framework compatibility, version pinning, network/install policy, telemetry policy, false positives, changed-code scope, and whether findings overlap existing gates |
71
72
 
72
73
  Mocks, stubs, and fakes belong in isolated tests. For integration, prefer disposable dependencies equivalent to production when this reduces relevant differences. Typing, linting, and static analysis complement tests; they do not replace executing behavior.
73
74
 
@@ -84,10 +85,54 @@ Run only the rows applicable to the product and recorded risk. A tool name witho
84
85
  | Laravel | middleware, validation, policies/auth, queues, and database are not exercised by a pure unit test | separate unit from feature/HTTP/database tests; fake only the boundary outside the oracle and verify persisted effects; approve a critical endpoint with applicable auth, validation, response, database, and job/event evidence | [Laravel — testing](https://laravel.com/docs/12.x/testing), [HTTP tests](https://laravel.com/docs/12.x/http-tests), and [database testing](https://laravel.com/docs/12.x/database-testing) |
85
86
  | HTML and HyperFrames | invalid markup, overflow, nondeterministic timing, or an incorrect critical frame | validate HTML; run `hyperframes lint`/`hyperframes check` when exposed by the pinned version; preview/render declared formats and review critical frames/boundaries; any structural, timing, or layout error blocks | [WHATWG — validators](https://whatwg.org/validator/), [Nu HTML Checker](https://validator.w3.org/nu/), and [HyperFrames](https://hyperframes.heygen.com) |
86
87
  | CSS and visual regression | cascade, responsiveness, theme, font, or environment changes layout/behavior | run Stylelint and semantic/interaction assertions; compare screenshots only in a controlled environment and risk matrix; diffs require explicit review and the gate does not depend on a generated CSS snapshot | [Stylelint](https://stylelint.io/user-guide/get-started/) and [Playwright visual comparisons](https://playwright.dev/docs/test-snapshots) |
88
+ | React quality diagnostics | regressions in state/effects, performance, accessibility, security, or component architecture | run React Doctor when pinned/authorized; scope to changed files; triage findings against project risk and preserve exit code and findings as check evidence | [React Doctor](https://github.com/millionco/react-doctor) |
87
89
  | Terraform | valid configuration produces unexpected replace/destroy, cost, exposure, or state | run `fmt`/`validate`, test module assertions, and review `plan`; use a dedicated account/environment for `terraform test` that creates resources; block unexpected actions and confirm cleanup of every test resource | [Terraform validate](https://developer.hashicorp.com/terraform/cli/commands/validate), [test](https://developer.hashicorp.com/terraform/cli/commands/test), and [plan](https://developer.hashicorp.com/terraform/cli/commands/plan) |
88
90
  | Kubernetes and containers | a schema accepted locally fails in-cluster, or rollout/probe/rollback/image behavior diverges | use strict validation and server-side dry-run; use an ephemeral cluster when rollout/controller risk justifies it; run build checks and image smoke; the gate covers probes, resources, permissions, applicable rollback, and cleanup | [kubectl apply](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_apply/) and [Docker build checks](https://docs.docker.com/reference/build-checks/) |
89
91
  | Ansible | a playbook is not idempotent, makes a destructive change, or reaches an incorrect state | run syntax/check when safe and a Molecule scenario with converge, verify, idempotence, and destroy according to risk; approve only if the second convergence causes no unintended change and the environment is cleaned | [Ansible Molecule](https://docs.ansible.com/projects/molecule/) and [test sequence](https://docs.ansible.com/projects/molecule/usage/) |
90
92
 
93
+ ### React Doctor — optional supplemental React diagnostics
94
+
95
+ For a React target, [React Doctor](https://github.com/millionco/react-doctor) may be used as a supplemental static/quality scan when it is already available or its execution/install is explicitly authorized. It reports diagnostics across React correctness/state, performance, architecture, security, accessibility, and related design rules.
96
+
97
+ It does not replace the target's type checker, linter, unit/integration/E2E tests, security review, accessibility review, or performance evidence.
98
+
99
+ Before using it:
100
+
101
+ 1. **Identify version**: Determine the exact pinned/adopted version.
102
+ 2. **Follow authority policy**: Determine whether invocation downloads code or changes the environment; follow the target's authorization/network policy.
103
+ 3. **Telemetry policy**: Review the tool's current telemetry behavior and disable telemetry when target policy requires it.
104
+ 4. **Scope appropriately**: Select a scope that matches the task (`changed`/equivalent when supported) rather than turning an unrelated existing backlog into a new completion requirement.
105
+ 5. **Preserve evidence**: Retain the actual findings, exit status, version, and command as evidence.
106
+ 6. **Risk-based triage**: Triage findings by real project risk instead of treating the numeric score as the pass/fail oracle.
107
+
108
+ Command examples:
109
+
110
+ ```bash
111
+ # If the project already has a pinned React Doctor command:
112
+ npm run react-doctor -- --verbose --scope changed
113
+
114
+ # If an authorized one-off remote invocation is explicitly allowed:
115
+ npx react-doctor@<PINNED_VERSION> --no-telemetry --verbose --scope changed
116
+ ```
117
+
118
+ > [!NOTE]
119
+ > Verify current upstream CLI syntax before execution; external command flags are not part of the ForgeLoop protocol contract.
120
+
121
+ Evidence integration:
122
+
123
+ A successful observed run may be recorded through ForgeLoop's existing check mechanism:
124
+
125
+ ```bash
126
+ forgeloop run-check \
127
+ --task <task-id> \
128
+ --id react-doctor-changed \
129
+ --requirement react-quality \
130
+ -- <project-owned-react-doctor-command>
131
+ ```
132
+
133
+ - **Score Semantics**: A React Doctor score is diagnostic telemetry, not a universal gate. The target contract or project policy may define a versioned threshold, but absent such a contract ForgeLoop evaluates concrete findings against applicable correctness, accessibility, security, performance, and architecture requirements.
134
+ - **False Positives**: When a finding is disputed, inspect the exact rule and project context. A suppression/config change is a code-quality policy change and requires the same review as other lint/static-analysis configuration changes; do not disable a rule merely to make a score increase.
135
+
91
136
  ## Fixtures, cassettes, and oracles
92
137
 
93
138
  - Prefer minimal synthetic data. When fixtures are derived from production, anonymize them irreversibly and review reidentification, retention, and licensing risk before committing.
@@ -592,6 +592,57 @@ the current cycle. Lifecycle-owned terminal criteria such as validator-backed
592
592
  `record-check` claims. Compound `ALL` checks cannot pass while any declared
593
593
  component is failed, blocked, partial, or not verified.
594
594
 
595
+ ### Diagnosis Ledger and Evidence-Driven Correction
596
+
597
+ When a check fails during verification (`VERIFYING → DIAGNOSING`), the actor must record an append-only diagnosis event in the lifecycle ledger before entering `CORRECTING`:
598
+
599
+ ```bash
600
+ forgeloop record-diagnosis \
601
+ --hypothesis="Specific root-cause hypothesis explaining the verification failure" \
602
+ --failure-class="VERIFICATION_FAILURE" \
603
+ --evidence-ref="check-id" \
604
+ --settled-by="Observable condition that settles or falsifies the hypothesis" \
605
+ --next-safe-action="Smallest safe local action to address the hypothesis"
606
+ ```
607
+
608
+ - **Single Source of Truth**: The append-only, hash-chained `events.ndjson` is the sole authority for diagnosis chronology (`DIAGNOSIS_RECORDED` events). The mutable `work-state.diagnosedHypothesis` field is maintained strictly as a backward-compatibility projection.
609
+ - **Evidence Binding**: `evidence-ref` must reference at least one failed or blocked check from the active `verificationCycle`.
610
+ - **Information Gain Classification**: Each diagnosis is classified by comparing its normalized semantic fingerprint (`sha256(failureClass:normalizedHypothesis:sortedEvidenceRefs)`) against previous task diagnoses:
611
+ - `FIRST_DIAGNOSIS`: Initial diagnosis for the task.
612
+ - `NEW_HYPOTHESIS`: Distinct hypothesis with previously observed evidence.
613
+ - `NEW_EVIDENCE`: Same hypothesis supported by newly observed evidence checks.
614
+ - `NEW_HYPOTHESIS_AND_EVIDENCE`: Both hypothesis and evidence references are new.
615
+ - `NONE`: Repeating the previous hypothesis with the exact same evidence.
616
+ - **Idempotent Recovery in the Same Cycle**: Retrying `record-diagnosis` with the identical hypothesis and evidence within the *same* verification cycle is idempotent. It reuses the existing event, repairs or synchronizes `work-state.diagnosedHypothesis`, advances `work-state.lastUpdated`, and returns `idempotent: true` without appending a duplicate event or triggering a false stall.
617
+ - **No Retry Without Information Gain**: Repeating the same hypothesis and evidence in a *subsequent* verification cycle produces `informationGain: NONE`. Such diagnoses are recorded in the event ledger for auditability but cannot authorize a correction phase transition (`DIAGNOSING → CORRECTING` fails with `E_DIAGNOSIS_NO_NEW_INFORMATION`, and `forgeloop next` returns `CHANGE_STRATEGY`). Superficial alterations to `settled-by`, `next-safe-action`, or formatting without changing the underlying hypothesis or evidence references do not generate information gain.
618
+ - **Legacy Compatibility Invariant**: Tasks created under older protocol-v1 revisions that have `diagnosedHypothesis` populated in `work-state.json` without a corresponding `DIAGNOSIS_RECORDED` event remain readable. However, `forgeloop next` returns `RECORD_DIAGNOSIS` and `DIAGNOSING → CORRECTING` fails with `E_DIAGNOSIS_REQUIRED` until a formal diagnosis is appended via `forgeloop record-diagnosis`. ForgeLoop never synthesizes historical events automatically.
619
+
620
+ ### Progress Stall Detection (`forgeloop progress`)
621
+
622
+ Task progress across iterative verification cycles is evaluated deterministically without heuristics, model confidence scores, or chain-of-thought introspection:
623
+
624
+ - **Statuses**:
625
+ - `ADVANCING`: Failure counts are low, or new diagnostic information gain is present.
626
+ - `WATCH`: A single requirement has failed across 3+ distinct cycles with changing diagnoses, or the task has reached a high cycle count ($\ge 4$). High cycle count alone produces `WATCH`, never a hard stall.
627
+ - `STALLED`: The latest diagnosis has `informationGain: NONE` (global stall with signal `NO_DIAGNOSTIC_INFORMATION_GAIN`), or a specific requirement failed 3+ times with identical diagnoses (`REPEATED_FAILURE_WITH_SAME_DIAGNOSIS`).
628
+ - **Requirement-Specific Attribution**: Stall signals are mapped to individual contract requirements strictly through `evidenceRefs → check → requirement`. A stall on one requirement does not fabricate false repeat-diagnosis signals for unrelated requirements.
629
+ - **Strategy Change**: When stalled, `forgeloop next` returns action `CHANGE_STRATEGY` with error code `E_PROGRESS_STALLED`. This directs the actor to formulate a genuinely new root-cause hypothesis, gather independent diagnostic evidence, or change the technical approach.
630
+
631
+ ### Decision Settlement Criteria
632
+
633
+ Unresolved contract decisions in `current-contract.unresolvedDecisions[]` can be paired with append-only settlement criteria bound to the active contract fingerprint:
634
+
635
+ ```bash
636
+ forgeloop record-decision-criterion \
637
+ --decision="Exact text of unresolved decision" \
638
+ --settled-by="Criteria or guidance that settles the decision"
639
+ ```
640
+
641
+ - **Contract Schema Compatibility**: `current-contract.unresolvedDecisions[]` remains an array of strings (`string[]`) under `protocolVersion: 1`. Criteria are persisted as `DECISION_CRITERION_RECORDED` events in `events.ndjson` bound to `contractFingerprint`.
642
+ - **Guidance Surfacing**: `forgeloop next` surfaces recorded criteria in its blocker reasons as `SETTLEMENT_CRITERION` (for a single decision) or `SETTLEMENT_CRITERIA` with an `items[]` array (for multiple decisions). Decisions without recorded criteria do not receive fabricated guidance.
643
+ - **Fingerprint Binding and Staleness**: A criterion is valid only while the contract fingerprint matches. If the contract is modified, previous criteria bound to older fingerprints are automatically ignored as stale.
644
+ - **Non-Bypassing**: Recording a settlement criterion attaches advisory guidance only; it does not automatically resolve the decision or make preflight `READY`. The contract must still be explicitly updated or resolved before execution begins.
645
+
595
646
  ## Independent completion dimensions
596
647
 
597
648
  Local task completion, verification, publication, and production readiness are
@@ -60,12 +60,14 @@ invariants and record why a skipped phase was not applicable.
60
60
 
61
61
  - `COMPLETE` requires verification evidence current to the task.
62
62
  - `BLOCKED` requires blocker evidence, a category, and a safe next action.
63
- - `CORRECTING` requires a diagnosed hypothesis and a changed evidence basis.
63
+ - `CORRECTING` requires a diagnosed hypothesis recorded in the event ledger (`DIAGNOSIS_RECORDED`) with non-zero information gain (`informationGain !== "NONE"`).
64
64
  - `REVIEWING` cannot claim independent review when reviewer and implementer
65
65
  identities are equal.
66
66
  - `REVIEWING → VERIFYING` requires a persisted evidence-only completion
67
67
  rejection and starts a new `verificationCycle`.
68
- - A retry requires new evidence or a changed hypothesis.
68
+ - A retry requires new evidence or a changed hypothesis; repeating the same diagnosis produces `informationGain: NONE` and stalls progression (`CHANGE_STRATEGY`).
69
+ - `forgeloop progress` deterministically evaluates task progress across cycles as `ADVANCING`, `WATCH`, or `STALLED`.
70
+ - `forgeloop record-decision-criterion` attaches contract-bound guidance to unresolved decisions without breaking the schema.
69
71
 
70
72
  ## Serializable interfaces
71
73
 
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ForgeLoop — Verifiable Engineering Protocol
2
2
 
3
+ <p align="center">
4
+ <img src="./docs/assets/forgeloop-readme-banner.svg" alt="ForgeLoop — Verifiable Engineering Protocol" width="100%">
5
+ </p>
6
+
3
7
  [![Docs quality](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml/badge.svg?branch=main)](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml)
4
8
 
5
9
  ForgeLoop is a portable, vendor-neutral protocol for AI-assisted development
@@ -108,10 +112,12 @@ forgeloop complete --task example-task --json
108
112
  `advance` changes protocol phase only; it never runs target commands.
109
113
  `run-check` classifies the exact argv before launch and records ForgeLoop-owned
110
114
  execution provenance. `record-check` stores an observation and never executes
111
- the text supplied to `--command`. `complete` validates the contract, route,
112
- gates, ledger, evidence, coverage, receipt, and freshness. `audit` is
113
- read-only. `report` exposes independent completion, publication, and
114
- production-readiness dimensions.
115
+ the text supplied to `--command`. `record-diagnosis` appends an authoritative
116
+ root-cause hypothesis to the event ledger. `progress` evaluates task
117
+ progression and detects stalls deterministically. `complete` validates the
118
+ contract, route, gates, ledger, evidence, coverage, receipt, and freshness.
119
+ `audit` is read-only. `report` exposes independent completion, publication,
120
+ and production-readiness dimensions.
115
121
 
116
122
  The status precedence is `INVALID` > `INCONSISTENT` > `STALE` > `INCOMPLETE` >
117
123
  `VALID`. A `READY` preflight is a resumable checkpoint: if its work state is
@@ -56,6 +56,16 @@ dependencies, version, and distribution conditions before adoption.
56
56
  workflow boundaries and public discoverability only.
57
57
  - Boundary: this repository links to Superpowers as a reference; it is not a dependency of `ForgeLoop`, and `ForgeLoop` does not copy, bundle, install, or vendor any Superpowers source, skill, hook, plugin, runtime, dependency, credential, or provider.
58
58
 
59
+ ### React Doctor
60
+
61
+ - Project: [millionco/react-doctor](https://github.com/millionco/react-doctor).
62
+ - Use in this collection: optional target-project React diagnostic/verifier
63
+ reference.
64
+ - Boundary: React Doctor is not a ForgeLoop runtime dependency or universal
65
+ completion gate. ForgeLoop does not automatically download, install, execute,
66
+ configure, or enable its CI/agent integrations. Verify current upstream
67
+ license, CLI, telemetry, network behavior, and dependencies before use.
68
+
59
69
  ### Runtime and validator boundary
60
70
 
61
71
  The distributed CLI and repository validators use Node.js and Python standard
@@ -87,14 +97,27 @@ network behavior, and distribution terms separately.
87
97
 
88
98
  ## Design reference sites
89
99
 
90
- The following nine sites are references in the design guide. None is a
100
+ The following sites are references in the design guide. None is a
91
101
  dependency of this collection or a blanket permission to reuse code, assets,
92
102
  fonts, templates, or other material.
93
103
 
94
104
  - [21st.dev](https://21st.dev/): component and template registry; check the
95
105
  terms for the specific author, community contribution, or paid material.
106
+ - [AIcss](https://www.aicss.dev/): AI-agent interface pattern and component
107
+ reference; verify current terms, provenance, dependencies, and reuse rights
108
+ for the exact block before copying or redistributing it.
96
109
  - [React Bits](https://reactbits.dev/): component and motion reference; keep
97
110
  public/free material, React Bits Pro, and dependency terms separate.
111
+ - [beUI](https://beui.dev/) / source
112
+ [starc007/ui-components](https://github.com/starc007/ui-components):
113
+ React/Next.js animated component reference; verify current terms, license,
114
+ Motion/Tailwind dependencies, and accessibility/reduced-motion behavior before
115
+ adoption.
116
+ - [Transition Kit](https://transition-kit.space/) / source
117
+ [AbdullahMukadam/Transition-kit](https://github.com/AbdullahMukadam/Transition-kit):
118
+ CSS-first page/theme transition reference around the View Transitions API;
119
+ verify current terms, browser compatibility, and fallback behavior before
120
+ adoption.
98
121
  - [Fancy Components](https://www.fancycomponents.dev/): component reference;
99
122
  verify the linked source license and each dependency before reuse.
100
123
  - [Motion Primitives](https://motion-primitives.com/): motion reference; keep
@@ -160,7 +160,7 @@ Discovered repository facts, platforms, runtimes, and dependencies.
160
160
 
161
161
  <!-- forgeloop-doc: schema=event artifact=.forgeloop/task-state/<task-key>/events.ndjson -->
162
162
 
163
- The append-only cryptographic event ledger. Each line is a single JSON event object.
163
+ The append-only cryptographic event ledger. Each line is a single JSON event object. Records authoritative chronological events including lifecycle milestones (`TASK_RECEIVED`, `CONTRACT_VALIDATED`, `ROUTE_VALIDATED`, `PREFLIGHT_READY`, `EXECUTION_STARTED`, `VERIFICATION_STARTED`), evidence-backed diagnoses (`DIAGNOSIS_RECORDED`), and decision settlement criteria (`DECISION_CRITERION_RECORDED`).
164
164
 
165
165
  #### Canonical Line Fields
166
166
 
@@ -254,7 +254,7 @@ Pre-implementation gate approval artifact recording decisions, bound artifact ha
254
254
 
255
255
  <!-- forgeloop-doc: schema=work-state artifact=.forgeloop/task-state/<task-key>/work-state.json -->
256
256
 
257
- The canonical, authoritative lifecycle work state.
257
+ The canonical, authoritative lifecycle work state. Represents current checkpoint and resume state (`phase`, `checks`, `verificationCycle`, `lastUpdated`). Note: `diagnosedHypothesis` is maintained as a backward-compatibility projection of the latest diagnosis from `events.ndjson`.
258
258
 
259
259
  #### Canonical Fields
260
260
 
@@ -40,8 +40,8 @@ ForgeLoop uses a definition-driven command-line parser:
40
40
  | Category | Commands |
41
41
  | --- | --- |
42
42
  | **Setup & Maintenance** | [`init`](#init), [`update`](#update), [`task-migrate`](#task-migrate), [`task-unlock`](#task-unlock) |
43
- | **Inspection & Diagnostics** | [`doctor`](#doctor), [`inspect`](#inspect), [`status`](#status), [`validate-state`](#validate-state), [`validate-protocol`](#validate-protocol) |
44
- | **Lifecycle & State** | [`activate`](#activate), [`route`](#route), [`preflight`](#preflight), [`advance`](#advance), [`next`](#next), [`complete`](#complete), [`clear-state`](#clear-state), [`task-create`](#task-create), [`task-list`](#task-list), [`task-show`](#task-show), [`task-scope`](#task-scope) |
43
+ | **Inspection & Diagnostics** | [`doctor`](#doctor), [`progress`](#progress), [`inspect`](#inspect), [`status`](#status), [`validate-state`](#validate-state), [`validate-protocol`](#validate-protocol) |
44
+ | **Lifecycle & State** | [`activate`](#activate), [`route`](#route), [`preflight`](#preflight), [`advance`](#advance), [`next`](#next), [`record-diagnosis`](#record-diagnosis), [`record-decision-criterion`](#record-decision-criterion), [`complete`](#complete), [`clear-state`](#clear-state), [`task-create`](#task-create), [`task-list`](#task-list), [`task-show`](#task-show), [`task-scope`](#task-scope) |
45
45
  | **Cross-Harness Continuity** | [`continuity`](#continuity), [`record-continuity`](#record-continuity), [`reconcile-continuity`](#reconcile-continuity), [`clear-continuity`](#clear-continuity) |
46
46
  | **Verification & Completion** | [`prepare-completion`](#prepare-completion), [`run-check`](#run-check), [`record-check`](#record-check), [`record-terminal-result`](#record-terminal-result), [`audit`](#audit), [`report`](#report), [`validate-receipt`](#validate-receipt) |
47
47
  | **Policy & Auditing** | [`policy`](#policy), [`bundle`](#bundle) |
@@ -201,6 +201,33 @@ Creates a protocol/session activation marker for the current harness session.
201
201
  forgeloop activate --json
202
202
  ```
203
203
 
204
+ ### `record-decision-criterion`
205
+
206
+ Records an append-only decision settlement criterion bound to the active contract fingerprint.
207
+
208
+ - **Purpose**: Records settlement guidance or criteria for open contract decisions without modifying contract schema.
209
+ - **When to use**: To attach settlement guidance to unresolved decisions in `current-contract.unresolvedDecisions[]`.
210
+ - **Mutation**: Appends `DECISION_CRITERION_RECORDED` to event ledger.
211
+ - **Options**:
212
+
213
+ <!-- BEGIN FORGELOOP GENERATED: cli:record-decision-criterion:options -->
214
+
215
+ - `--path <directory>`: target project directory (default: current directory)
216
+ - `--task <id>`: task ID to operate on (when omitted, resolved from context or single active task)
217
+ - `--decision <text>`: unresolved decision text matching current contract
218
+ - `--settled-by <text>`: criteria or guidance that settles the decision
219
+ - `--json`: emit structured output as JSON
220
+
221
+ <!-- END FORGELOOP GENERATED: cli:record-decision-criterion:options -->
222
+
223
+ - **Example**:
224
+
225
+ ```bash
226
+ forgeloop record-decision-criterion \
227
+ --decision="Which authentication provider should be used?" \
228
+ --settled-by="Use provider supporting current session token middleware"
229
+ ```
230
+
204
231
  ### `advance`
205
232
 
206
233
  Advances the protocol lifecycle phase.
@@ -427,6 +454,39 @@ Records an observed or manual verification check result without executing comman
427
454
  --result "Verified contrast ratios exceed 4.5:1 across all color schemes"
428
455
  ```
429
456
 
457
+ ### `record-diagnosis`
458
+
459
+ Records an append-only diagnosis event in the lifecycle event ledger for the active cycle.
460
+
461
+ - **Purpose**: Records root-cause hypotheses, failure classes, and settlement criteria for failed verification checks.
462
+ - **When to use**: In `DIAGNOSING` phase before advancing to `CORRECTING`.
463
+ - **Mutation**: Appends `DIAGNOSIS_RECORDED` to event ledger and updates work state projection.
464
+ - **Options**:
465
+
466
+ <!-- BEGIN FORGELOOP GENERATED: cli:record-diagnosis:options -->
467
+
468
+ - `--path <directory>`: target project directory (default: current directory)
469
+ - `--task <id>`: task ID to operate on (when omitted, resolved from context or single active task)
470
+ - `--hypothesis <text>`: specific root-cause hypothesis explaining the verification failure
471
+ - `--failure-class <class>`: canonical failure class taxonomy
472
+ - `--evidence-ref <check-id>`: reference to failed/blocked check from current cycle (repeatable)
473
+ - `--settled-by <text>`: falsification or settlement criteria for the hypothesis
474
+ - `--next-safe-action <text>`: smallest safe action to address the hypothesis
475
+ - `--json`: emit structured output as JSON
476
+
477
+ <!-- END FORGELOOP GENERATED: cli:record-diagnosis:options -->
478
+
479
+ - **Example**:
480
+
481
+ ```bash
482
+ forgeloop record-diagnosis \
483
+ --hypothesis="Off-by-one index calculation in slice function" \
484
+ --failure-class="VERIFICATION_FAILURE" \
485
+ --evidence-ref="unit-tests" \
486
+ --settled-by="Test returns expected slice length" \
487
+ --next-safe-action="Adjust offset +1 in slice.js"
488
+ ```
489
+
430
490
  ### `validate-state`
431
491
 
432
492
  Validates `.forgeloop/work-state.json` structure, hash chain, and repository binding.
@@ -500,6 +560,29 @@ Performs comprehensive protocol validation across all active artifacts.
500
560
  forgeloop validate-protocol --json
501
561
  ```
502
562
 
563
+ ### `progress`
564
+
565
+ Evaluates task progress across verification cycles and detects stalls deterministically.
566
+
567
+ - **Purpose**: Evaluates whether iterative correction cycles are advancing, on watch, or stalled.
568
+ - **When to use**: Any time during execution, verification, or diagnosis to inspect progress signals and prevent repeated ineffective retries.
569
+ - **Mutation**: Read-only.
570
+ - **Options**:
571
+
572
+ <!-- BEGIN FORGELOOP GENERATED: cli:progress:options -->
573
+
574
+ - `--path <directory>`: target project directory (default: current directory)
575
+ - `--task <id>`: task ID to operate on (when omitted, resolved from context or single active task)
576
+ - `--json`: emit progress evaluation as JSON
577
+
578
+ <!-- END FORGELOOP GENERATED: cli:progress:options -->
579
+
580
+ - **Example**:
581
+
582
+ ```bash
583
+ forgeloop progress --json
584
+ ```
585
+
503
586
  ---
504
587
 
505
588
  ## 5. Completion & Reporting
@@ -237,10 +237,36 @@ forgeloop run-check --task task-contact-form-001 --id lint --requirement "npm ru
237
237
 
238
238
  If a check fails:
239
239
 
240
- 1. Do not repeat the failed check blindly.
241
- 2. Formulate a diagnostic hypothesis.
242
- 3. Apply the correction.
243
- 4. Re-run `forgeloop run-check`.
240
+ 1. Advance to `DIAGNOSING`:
241
+
242
+ ```bash
243
+ forgeloop advance --task task-contact-form-001 --to DIAGNOSING
244
+ ```
245
+
246
+ 2. Record an append-only root-cause diagnosis in the event ledger:
247
+
248
+ ```bash
249
+ forgeloop record-diagnosis \
250
+ --task task-contact-form-001 \
251
+ --hypothesis="Form validation regex incorrectly rejects valid domain formats" \
252
+ --failure-class="VERIFICATION_FAILURE" \
253
+ --evidence-ref="unit-tests" \
254
+ --settled-by="All domain validation unit tests pass" \
255
+ --next-safe-action="Update email domain regex in ContactForm.jsx"
256
+ ```
257
+
258
+ 3. Advance to `CORRECTING` and apply the fix:
259
+
260
+ ```bash
261
+ forgeloop advance --task task-contact-form-001 --to CORRECTING
262
+ ```
263
+
264
+ 4. Re-enter `VERIFYING` (advances `verificationCycle` monotonically) and re-run checks:
265
+
266
+ ```bash
267
+ forgeloop advance --task task-contact-form-001 --to VERIFYING
268
+ forgeloop run-check --task task-contact-form-001 --id unit-tests --requirement "npm test passes for contact form" -- npm test
269
+ ```
244
270
 
245
271
  ---
246
272
 
package/docs/RECIPES.md CHANGED
@@ -18,6 +18,7 @@ Concise, copy-paste friendly recipes for common ForgeLoop tasks.
18
18
  10. [Final Verification Before Pull Request](#recipe-10--final-verification-before-pull-request)
19
19
  11. [Run Multi-Task Workflows Concurrently](#recipe-11--run-multi-task-workflows-concurrently)
20
20
  12. [Migrate Legacy 1.0 Single-Task Layout](#recipe-12--migrate-legacy-10-single-task-layout)
21
+ 13. [Record Decision Settlement Criteria](#recipe-13--record-decision-settlement-criteria)
21
22
 
22
23
  ---
23
24
 
@@ -98,16 +99,29 @@ export FORGELOOP_TASK="task-001"
98
99
  forgeloop run-check --id unit-tests --requirement "All tests pass" -- npm test
99
100
  # Output: status = failed
100
101
 
101
- # 2. Query next action (directs to DIAGNOSE)
102
- forgeloop next --json
102
+ # 2. Advance to DIAGNOSING
103
+ forgeloop advance --to DIAGNOSING
104
+
105
+ # 3. Record append-only root-cause diagnosis in ledger
106
+ forgeloop record-diagnosis \
107
+ --hypothesis="Edge case comparison operator <= instead of < in validator" \
108
+ --failure-class="VERIFICATION_FAILURE" \
109
+ --evidence-ref="unit-tests" \
110
+ --settled-by="Boundary test passes with status 400" \
111
+ --next-safe-action="Replace <= with < in validator.js"
103
112
 
104
- # 3. Formulate diagnosis and apply code fix in checkout
113
+ # 4. Advance to CORRECTING and apply the fix
114
+ forgeloop advance --to CORRECTING
115
+
116
+ # 5. Re-enter VERIFYING (advances verificationCycle monotonically)
117
+ forgeloop advance --to VERIFYING
105
118
 
106
- # 4. Re-run verification check
119
+ # 6. Re-run verification check
107
120
  forgeloop run-check --id unit-tests --requirement "All tests pass" -- npm test
108
121
 
109
- # 5. Check audit
110
- forgeloop audit --json
122
+ # 7. Advance to REVIEWING and complete
123
+ forgeloop advance --to REVIEWING
124
+ forgeloop complete --json
111
125
  ```
112
126
 
113
127
  ---
@@ -248,3 +262,18 @@ forgeloop task-migrate --json
248
262
  forgeloop task-list --json
249
263
  forgeloop status --json
250
264
  ```
265
+
266
+ ---
267
+
268
+ ### Recipe 13 — Record Decision Settlement Criteria
269
+
270
+ ```bash
271
+ # 1. Record an append-only settlement criterion bound to the active contract
272
+ forgeloop record-decision-criterion \
273
+ --task task-001 \
274
+ --decision="Which authentication provider should be used?" \
275
+ --settled-by="Use provider with native support for current JWT session tokens"
276
+
277
+ # 2. Inspect next action (surfaces the guidance)
278
+ forgeloop next --task task-001
279
+ ```