@cassiomc1/forgeloop 1.1.1 → 1.2.2
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/.cursor/rules/project-loop.mdc +1 -1
- package/.github/copilot-instructions.md +1 -1
- package/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/DOCS_INDEX.md +3 -0
- package/ENG/design-code-eng.md +124 -0
- package/ENG/premium-sites-studio-eng.md +28 -0
- package/ENG/taste-frontend-eng.md +3 -2
- package/ENG/test-code-eng.md +45 -0
- package/LOOP_ENGINEERING.md +74 -0
- package/LOOP_SYSTEM_DESIGN.md +9 -5
- package/ORCHESTRATOR_INTEGRATION.md +41 -6
- package/PROTOCOL_INTEGRATION.md +13 -0
- package/README.md +40 -6
- package/TERMINOLOGY.md +10 -0
- package/THIRD_PARTY_NOTICES.md +58 -1
- package/THREAT_MODEL.md +12 -1
- package/docs/ARTIFACT_REFERENCE.md +152 -2
- package/docs/CLI_REFERENCE.md +346 -30
- package/docs/CROSS_HARNESS_CONTINUITY.md +1 -0
- package/docs/DOCUMENTATION_GUIDE.md +41 -4
- package/docs/GETTING_STARTED.md +39 -8
- package/docs/RECIPES.md +66 -7
- package/docs/TROUBLESHOOTING.md +279 -6
- package/package.json +1 -1
- package/schemas/policy-baseline.schema.json +26 -0
- package/schemas/policy-discovery.schema.json +45 -0
- package/schemas/policy-lock.schema.json +16 -0
- package/schemas/policy-rules.schema.json +48 -0
- package/schemas/policy-snapshot.schema.json +16 -0
- package/src/cli.js +102 -1
- package/src/commands/baseline.js +120 -0
- package/src/commands/init.js +304 -6
- package/src/commands/next.js +15 -1
- package/src/commands/policy-diff.js +51 -0
- package/src/commands/policy-discover.js +42 -0
- package/src/commands/policy-status.js +33 -0
- package/src/commands/profile-interview.js +50 -0
- package/src/commands/progress.js +51 -0
- package/src/commands/reconcile-closure.js +49 -0
- package/src/commands/record-decision-criterion.js +34 -0
- package/src/commands/record-diagnosis.js +49 -0
- package/src/commands/rule-verify.js +36 -0
- package/src/commands/validate-receipt.js +38 -3
- package/src/core/artifact-registry.js +60 -0
- package/src/core/audit.js +24 -0
- package/src/core/cli-command-definitions.js +163 -7
- package/src/core/cli-metadata.js +1 -1
- package/src/core/completion-artifacts.js +29 -3
- package/src/core/completion.js +101 -10
- package/src/core/diagnosis-model.js +214 -0
- package/src/core/diagnosis.js +171 -0
- package/src/core/error-codes.js +292 -0
- package/src/core/events.js +47 -1
- package/src/core/execution-prerequisites.js +38 -20
- package/src/core/execution.js +20 -3
- package/src/core/native-adapters.js +14 -4
- package/src/core/next-action-model.js +40 -5
- package/src/core/next-action.js +234 -91
- package/src/core/phase.js +29 -0
- package/src/core/policy-adapters.js +276 -0
- package/src/core/policy-baseline.js +144 -0
- package/src/core/policy-diff.js +133 -0
- package/src/core/policy-discovery.js +225 -0
- package/src/core/policy-engine.js +533 -0
- package/src/core/policy-mutation.js +139 -0
- package/src/core/preflight-consistency.js +23 -15
- package/src/core/preflight-model.js +10 -2
- package/src/core/preflight.js +65 -1
- package/src/core/progress.js +143 -0
- package/src/core/protocol.js +8 -0
- package/src/core/reconcile-closure.js +173 -0
- package/src/core/schema-validation.js +6 -0
- package/src/core/settlement-model.js +85 -0
- package/src/core/settlement.js +78 -0
- package/src/core/task-context.js +11 -0
- package/src/core/task-discovery.js +67 -1
- package/src/core/task-paths.js +9 -0
- package/src/core/templates.js +5 -0
|
@@ -17,7 +17,7 @@ Do not treat ForgeLoop as vendor-specific, optional, or to follow only "in spiri
|
|
|
17
17
|
5. Make the minimum change, run specific checks, and run proportional regression checks.
|
|
18
18
|
6. Diagnose failures before fixing them; do not repeat attempts without new evidence.
|
|
19
19
|
7. Request authority for unrelated actions, installations, and publications. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
|
|
20
|
-
8. Before creating or activating new lifecycle state:
|
|
20
|
+
8. Before creating or activating new lifecycle state: discover existing tasks first with `forgeloop task-list --json`; if an existing task is selected or identifiable, use `forgeloop next --task <id> --json` before creating another task, reconcile continuity when present, and inspect the checkout. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task. Legacy singleton state such as `.forgeloop/work-state.json` is compatibility-only, not the primary modern discovery mechanism.
|
|
21
21
|
9. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
|
|
22
22
|
|
|
23
23
|
After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
|
|
@@ -14,7 +14,7 @@ Use these instructions across the repository while preserving local rules.
|
|
|
14
14
|
- Make the smallest coherent change; validate with specific and regression checks.
|
|
15
15
|
- Diagnose causes before fixing failures; do not make unverified attempts.
|
|
16
16
|
- Do not install software, publish, delete, or alter external state without authority. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
|
|
17
|
-
- Before creating or activating new lifecycle state:
|
|
17
|
+
- Before creating or activating new lifecycle state: discover existing tasks first with `forgeloop task-list --json`; if an existing task is selected or identifiable, use `forgeloop next --task <id> --json` before creating another task, reconcile continuity when present, and inspect the checkout. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task. Legacy singleton state such as `.forgeloop/work-state.json` is compatibility-only, not the primary modern discovery mechanism.
|
|
18
18
|
- After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
|
|
19
19
|
|
|
20
20
|
After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
|
package/AGENTS.md
CHANGED
|
@@ -12,7 +12,7 @@ Do not treat ForgeLoop as vendor-specific, optional, or to follow only "in spiri
|
|
|
12
12
|
1. Make the smallest coherent change, run specific checks, and proportional regression checks.
|
|
13
13
|
1. Diagnose failures before fixing; do not repeat attempts without new evidence.
|
|
14
14
|
1. Do not install software, publish, delete, or migrate data without authority. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
|
|
15
|
-
1. Before creating or activating new lifecycle state:
|
|
15
|
+
1. Before creating or activating new lifecycle state: discover existing tasks first with `forgeloop task-list --json`; if an existing task is selected or identifiable, use `forgeloop next --task <id> --json` before creating another task, reconcile continuity when present, and inspect the checkout. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task. Legacy singleton state such as `.forgeloop/work-state.json` is compatibility-only, not the primary modern discovery mechanism.
|
|
16
16
|
1. Before implementation, create/validate the task contract (`contract.json`), persist routing, satisfy gates, and require `forgeloop preflight` to return `READY`.
|
|
17
17
|
1. Before claiming `COMPLETE`, require `forgeloop complete` to return `VALID`; otherwise report completion as not protocol-verified.
|
|
18
18
|
1. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
|
package/CLAUDE.md
CHANGED
|
@@ -14,7 +14,7 @@ When working in this repository:
|
|
|
14
14
|
1. Make small changes, run specific checks, and run proportional regression checks.
|
|
15
15
|
1. Investigate root causes before fixing failures; do not make unverified attempts.
|
|
16
16
|
1. Request authority for unrelated installations, publications, deletions, or migrations. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
|
|
17
|
-
1. Before creating or activating new lifecycle state:
|
|
17
|
+
1. Before creating or activating new lifecycle state: discover existing tasks first with `forgeloop task-list --json`; if an existing task is selected or identifiable, use `forgeloop next --task <id> --json` before creating another task, reconcile continuity when present, and inspect the checkout. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task. Legacy singleton state such as `.forgeloop/work-state.json` is compatibility-only, not the primary modern discovery mechanism.
|
|
18
18
|
1. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
|
|
19
19
|
1. After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
|
|
20
20
|
1. Report current evidence, limitations, and publication state without claiming checks that were not run.
|
package/DOCS_INDEX.md
CHANGED
|
@@ -16,6 +16,7 @@ integration and guide context. Use this map before editing documentation.
|
|
|
16
16
|
| Documentation guide | [`docs/DOCUMENTATION_GUIDE.md`](./docs/DOCUMENTATION_GUIDE.md) | Rules and checklist for modifying documentation |
|
|
17
17
|
| Lifecycle, gates, planning, verification, and recovery | [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) | Normative process for agents and developer workflows |
|
|
18
18
|
| Capability levels, discovery, and degradation | [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) | Vendor-neutral harness contract |
|
|
19
|
+
| Host/orchestrator integration | [`ORCHESTRATOR_INTEGRATION.md`](./ORCHESTRATOR_INTEGRATION.md) | Serializable phases, transition boundaries, host responsibilities, and no-runtime integration contract |
|
|
19
20
|
| Durable project facts | [`PROJECT_PROFILE.md`](./PROJECT_PROFILE.md) | Target-specific facts only; no prompts or secrets |
|
|
20
21
|
| Guide selection | [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md) | Deterministic routing and exclusions |
|
|
21
22
|
| Architecture and safety boundaries | [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md) and [`THREAT_MODEL.md`](./THREAT_MODEL.md) | Design rationale and residual risk |
|
|
@@ -31,6 +32,7 @@ integration and guide context. Use this map before editing documentation.
|
|
|
31
32
|
| **First-time user or developer** | [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md) |
|
|
32
33
|
| **AI coding agent / harness** | [`AGENTS.md`](./AGENTS.md) → [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) |
|
|
33
34
|
| **Harness integrator** | [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) |
|
|
35
|
+
| **External runtime / orchestrator integrator** | [`ORCHESTRATOR_INTEGRATION.md`](./ORCHESTRATOR_INTEGRATION.md) |
|
|
34
36
|
| **Resuming another tool / session** | [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md) |
|
|
35
37
|
| **Looking up CLI commands** | [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md) |
|
|
36
38
|
| **Inspecting `.forgeloop/` files** | [`docs/ARTIFACT_REFERENCE.md`](./docs/ARTIFACT_REFERENCE.md) |
|
|
@@ -51,6 +53,7 @@ integration and guide context. Use this map before editing documentation.
|
|
|
51
53
|
- **Find operational copy-paste commands**: [`docs/RECIPES.md`](./docs/RECIPES.md)
|
|
52
54
|
- **Read the normative protocol specification**: [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md)
|
|
53
55
|
- **Integrate a new AI environment**: [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md)
|
|
56
|
+
- **Map ForgeLoop state into an external runtime/orchestrator**: [`ORCHESTRATOR_INTEGRATION.md`](./ORCHESTRATOR_INTEGRATION.md)
|
|
54
57
|
- **Edit documentation safely**: [`docs/DOCUMENTATION_GUIDE.md`](./docs/DOCUMENTATION_GUIDE.md)
|
|
55
58
|
|
|
56
59
|
`README.md` is intentionally a catalog and quickstart. Do not copy the full
|
package/ENG/design-code-eng.md
CHANGED
|
@@ -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
|
+
- **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.
|
|
345
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,84 @@ 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
|
+
#### External resource discovery workflow
|
|
377
|
+
|
|
378
|
+
When the needed design capability is not already available in the target project:
|
|
379
|
+
|
|
380
|
+
1. define the concrete capability first;
|
|
381
|
+
2. search the project's existing components/dependencies before external discovery;
|
|
382
|
+
3. use a curated index such as DesEngs when current alternatives would help;
|
|
383
|
+
4. shortlist at most 2–3 realistic candidates;
|
|
384
|
+
5. inspect each candidate's exact upstream source;
|
|
385
|
+
6. compare license, dependencies, accessibility, performance, compatibility, maintenance, and implementation cost;
|
|
386
|
+
7. choose the smallest compatible option;
|
|
387
|
+
8. do not install anything without the authority already required by ForgeLoop;
|
|
388
|
+
9. record provenance when materially adopting external code or assets.
|
|
389
|
+
|
|
390
|
+
Bound discovery effort: 2–3 candidates is the strong default; broader research is justified only for a genuinely high-risk architecture decision. External discovery is optional and proportional — it must never become a mandatory browsing gate.
|
|
391
|
+
|
|
392
|
+
#### Permanent reference admission rule
|
|
393
|
+
|
|
394
|
+
Do not add every useful external discovery to ForgeLoop's canonical guide. Add a named permanent reference only when it provides a recurring capability, workflow, or quality signal that is materially useful across projects and is not already covered by an existing reference. One-off discoveries remain target-project choices.
|
|
395
|
+
|
|
396
|
+
A meta-directory such as DesEngs may be used to rediscover current alternatives instead of expanding ForgeLoop into an exhaustive external-tools catalog.
|
|
397
|
+
|
|
398
|
+
### Design-engineering meta-discovery
|
|
399
|
+
|
|
400
|
+
- **DesEngs** — https://desengs.com/
|
|
401
|
+
Optional meta-directory for discovering current design-engineering resources across reading, learning, UI/component exploration, interaction tooling, skills, creative coding, design systems, and implementation references. Use it when a concrete design need is not already satisfied by the target project's design system or a known compatible ForgeLoop reference.
|
|
402
|
+
|
|
403
|
+
Treat DesEngs as a discovery index, not as an approval list. For any linked resource that may be materially adopted, inspect the exact upstream source, current license/terms, dependencies, accessibility, browser/platform support, performance cost, maintenance status, and premium/free boundary before use. The license or listing status of DesEngs does not grant reuse rights for the external projects it indexes.
|
|
404
|
+
|
|
405
|
+
### Optional pattern and asset references
|
|
406
|
+
|
|
407
|
+
External galleries and asset libraries are reconnaissance tools, not design authority. The target product's requirements, existing design system, accessibility, security, performance budget, and the rules in this guide take precedence.
|
|
408
|
+
|
|
409
|
+
Before using an external example:
|
|
410
|
+
|
|
411
|
+
1. identify the design problem it solves;
|
|
412
|
+
2. compare at least two structural options when practical;
|
|
413
|
+
3. choose based on content and interaction needs, not novelty;
|
|
414
|
+
4. rebuild the chosen pattern in the target project's own stack and tokens;
|
|
415
|
+
5. verify accessibility, responsiveness, states, and performance;
|
|
416
|
+
6. verify the current source/license before copying code, prompts, media, or other substantial material.
|
|
417
|
+
|
|
418
|
+
#### UI pattern reconnaissance
|
|
419
|
+
|
|
420
|
+
- **VibePrompt** — https://vibeprompts.dev/
|
|
421
|
+
Optional pattern-vocabulary reference for common UI structures including heroes, pricing, FAQ, onboarding, dashboards, navigation, contact, feature sections, and supporting utility UI. Use it to compare section and interaction structures before implementing, and treat the examples as inspiration and vocabulary, not as canonical ForgeLoop markup. Do not treat Tailwind examples or prompts as canonical ForgeLoop markup; rebuild the selected pattern using the target project's own stack, components, semantic HTML, tokens, accessibility rules, responsive behavior, and performance budget. Verify the source terms before copying any prompt, snippet, or substantial text.
|
|
422
|
+
|
|
423
|
+
#### Illustration references
|
|
424
|
+
|
|
425
|
+
- **Kitbitz** — https://kitbitz.art/
|
|
426
|
+
Optional hand-drawn illustration reference when the selected creative direction genuinely benefits from playful/editorial imagery (education, creative tools, games, maps, community products, illustrated onboarding). Do not make it a default asset source for every site, and do not assume a permanent license status: verify the current first-party license and the exact asset terms before use. Record source, license, purpose, and any required attribution. Prefer SVG when appropriate, optimize delivered assets, provide accessible alternatives, and ensure the page remains understandable if the illustration is unavailable.
|
|
427
|
+
|
|
428
|
+
#### Editorial strategy reference
|
|
429
|
+
|
|
430
|
+
- **Elaya Design — Landing Page Design**
|
|
431
|
+
https://github.com/elayadesign/ai-design-skills/blob/main/skills/landing-page-design/SKILL.md
|
|
432
|
+
|
|
433
|
+
Useful as an editorial reference for landing-page strategy, conversion structure, benefit-first copy, objection handling, proof placement, and section-by-section implementation. Its prescriptive visual system (specific fonts, palettes, motion recipes, and navigation styles) is not a ForgeLoop universal rule and does not override this guide or the target project's design system. ForgeLoop's own `NON_BLOCKING`/`BLOCKING` decision classification controls whether the user must be asked anything.
|
|
434
|
+
|
|
354
435
|
### React Bits — operational use for React interfaces
|
|
355
436
|
|
|
356
437
|
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.
|
|
@@ -386,6 +467,49 @@ Adoption workflow:
|
|
|
386
467
|
|
|
387
468
|
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.
|
|
388
469
|
|
|
470
|
+
### AIcss — contextual AI-agent and conversational UI reference
|
|
471
|
+
|
|
472
|
+
[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).
|
|
473
|
+
|
|
474
|
+
Use AIcss as a candidate only when at least one of these is in scope:
|
|
475
|
+
|
|
476
|
+
- streamed assistant output;
|
|
477
|
+
- visible tool execution/status;
|
|
478
|
+
- source citations;
|
|
479
|
+
- file/code diffs;
|
|
480
|
+
- structured agent results;
|
|
481
|
+
- agent-specific input/approval interaction.
|
|
482
|
+
|
|
483
|
+
For ordinary SaaS, editorial, portfolio, or marketing UI without those surfaces, use general component/design references instead.
|
|
484
|
+
|
|
485
|
+
> [!IMPORTANT]
|
|
486
|
+
> **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.
|
|
487
|
+
|
|
488
|
+
### beUI — React/Next animated component source
|
|
489
|
+
|
|
490
|
+
[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.
|
|
491
|
+
|
|
492
|
+
- **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.
|
|
493
|
+
- **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.
|
|
494
|
+
|
|
495
|
+
### Transition Kit — progressive-enhancement page and theme transitions
|
|
496
|
+
|
|
497
|
+
[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.
|
|
498
|
+
|
|
499
|
+
For Transition Kit or any View Transitions API effect:
|
|
500
|
+
|
|
501
|
+
1. **Functional Base First**: The page navigation or theme switch action must work completely without the transition; enhancement never owns essential meaning or action.
|
|
502
|
+
2. **Implementation-Time Capability Check**: Check current target-browser support for the View Transitions API at implementation time rather than assuming static support tables.
|
|
503
|
+
3. **Graceful Fallback**: Unsupported browsers must receive a functional, immediate fallback without errors or layout shifts.
|
|
504
|
+
4. **Reduced Motion**: Under `prefers-reduced-motion`, provide an equivalent static or near-instant path.
|
|
505
|
+
5. **State Preservation**: Ensure focus management, navigation/history, scroll restoration, theme persistence, and interactive controls remain correct during and after transitions.
|
|
506
|
+
6. **Motion Budget**: Transition duration and easing must respect the product motion budget.
|
|
507
|
+
7. **No Protocol Dependency**: Adapt copied CSS/JS into the target project architecture instead of creating a ForgeLoop dependency.
|
|
508
|
+
|
|
509
|
+
### Target-Project React Diagnostics Cross-Reference
|
|
510
|
+
|
|
511
|
+
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.
|
|
512
|
+
|
|
389
513
|
---
|
|
390
514
|
|
|
391
515
|
## UX, Accessibility, and Quality
|
|
@@ -92,6 +92,34 @@ Rules:
|
|
|
92
92
|
- Identify what must be approved by the client, user, or legal team before writing the interface.
|
|
93
93
|
- Define audience, device, network speed, language, location, and technology as context — not as end-stage details.
|
|
94
94
|
|
|
95
|
+
### Landing-page specialization
|
|
96
|
+
|
|
97
|
+
For a true landing page, narrow the brief further:
|
|
98
|
+
|
|
99
|
+
- identify one offer;
|
|
100
|
+
- identify the primary audience;
|
|
101
|
+
- identify one primary conversion action;
|
|
102
|
+
- define what counts as conversion;
|
|
103
|
+
- determine what visitors already know when they arrive;
|
|
104
|
+
- identify the most important objections;
|
|
105
|
+
- inventory available proof such as product screenshots, documented metrics, case studies, certifications, or real testimonials.
|
|
106
|
+
|
|
107
|
+
Apply normal ForgeLoop decision classification to missing information. Discover and infer first. A safe, local, reversible design choice is `NON_BLOCKING`: record the assumption and continue. Ask only when a missing fact is genuinely `BLOCKING`, such as real pricing, a regulated claim, a real customer endorsement, a legal guarantee, or external authority.
|
|
108
|
+
|
|
109
|
+
Choose page structure based on visitor knowledge and conversion friction rather than visual fashion. Useful structural modes include product-led classic, narrative/educational, minimal high-intent, and comparison/alternative-intent.
|
|
110
|
+
|
|
111
|
+
A common conversion narrative is:
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
Hero → problem/context → benefits → how it works → proof → objection handling → final primary CTA
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Adapt or remove stages according to the product. This is a decision framework, not a mandatory template.
|
|
118
|
+
|
|
119
|
+
Lead copy with supported outcomes, then explain features or mechanisms. Keep proof close to the claim it supports. Never invent metrics, testimonials, customer logos, guarantees, certifications, or regulated statements.
|
|
120
|
+
|
|
121
|
+
For long landing pages, implement one coherent section at a time when practical and verify it before multiplying the pattern across the page.
|
|
122
|
+
|
|
95
123
|
## 4. Gate 2 — Content, architecture, and journeys
|
|
96
124
|
|
|
97
125
|
### Content inventory
|
|
@@ -107,8 +107,9 @@ 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. For
|
|
111
|
-
or motion references
|
|
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
|
|
112
113
|
[`design-code-eng.md`](./design-code-eng.md) rather than treating a gallery
|
|
113
114
|
component as a project design-system default. Keep any external reference in
|
|
114
115
|
the task's source and attribution records; do not add a network dependency to
|
package/ENG/test-code-eng.md
CHANGED
|
@@ -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.
|
package/LOOP_ENGINEERING.md
CHANGED
|
@@ -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
|
|
@@ -1087,6 +1138,29 @@ Choose checks that match the artifact and risk.
|
|
|
1087
1138
|
Regression depth grows with risk: specific check, related tests, then suite,
|
|
1088
1139
|
build, and integration validation when reasonable.
|
|
1089
1140
|
|
|
1141
|
+
### Executable Policy & Autonomy-Preserving Invariants
|
|
1142
|
+
|
|
1143
|
+
ForgeLoop enforces executable verification rules (`.forgeloop/policy/rules.json`) that evaluate constraints on code and artifacts.
|
|
1144
|
+
|
|
1145
|
+
Autonomy invariant: **zero mandatory configuration, zero mandatory questions, deterministic discovery first, safe defaults second, graceful reduction of enforcement under uncertainty, and explicit configuration only as an optional override.** Uncertainty and corruption are different: uncertainty reduces enforcement where designed (for example, an unknown architecture produces no mandatory architecture question), while a broken trust boundary fails closed (for example, malformed policy produces `E_POLICY_INVALID`).
|
|
1146
|
+
|
|
1147
|
+
The enforceable invariants are:
|
|
1148
|
+
|
|
1149
|
+
1. **Zero-Interaction Autonomy Invariant**: The default workflow (`init` → `discovery` → `task creation` → `routing` → `execution` → `verification` → `completion`) must run to completion without interactive prompts, interviews, or mandatory user configuration.
|
|
1150
|
+
2. **Uncertainty Principle**: "Uncertainty reduces enforcement; uncertainty does not stop execution." When architecture, patterns, or tools cannot be inferred with high confidence, ForgeLoop records `confidence: "LOW"` or `confidence: "UNKNOWN"`, skips unproven rules or treats them as advisory, and proceeds with execution.
|
|
1151
|
+
3. **Brownfield Baseline Tolerances**: Existing violations in a repository are fingerprinted (SHA-256) into `.forgeloop/policy/baseline.json`. Baselined debt does not block task completion. Only *new* violations introduced during the task are blocking.
|
|
1152
|
+
4. **Monotonic Ratchet-Down**: As legacy debt is resolved, running `forgeloop baseline --update` removes the resolved fingerprints, preventing regression without re-introducing solved violations. It never adds new debt.
|
|
1153
|
+
5. **Mutation-Backed Verification**: Rule checkers must prove efficacy against synthetic mutation fixtures via `forgeloop rule-verify`. Expected `FAIL` with checker `FAIL` yields `PROVEN`. Expected `FAIL` with checker `PASS` yields `UNPROVEN` (`CHECK_MUTATION_NOT_DETECTED`).
|
|
1154
|
+
6. **Inert Check Graceful Degradation**: Automatically discovered inert checks (no matching files or adapters) degrade to `UNSUPPORTED`/`ADVISORY` with `isInert: true` and no error. Explicit project-configured blocking rules with no effective scope fail with `E_CHECK_INERT` to signal configuration errors.
|
|
1155
|
+
7. **Policy Diffing & Drift Detection**: Preflight captures a task policy snapshot (`policy-snapshot.json`). If workspace policy is modified mid-task, `forgeloop policy-status` detects policy drift. Drift is classified into `TIGHTEN` (stricter rules/debt reduction), `NEUTRAL`, `WEAKEN` (relaxed rules/expanded debt), or `UNKNOWN` (legacy snapshot without baseline state). Weakening takes precedence if both occur and blocks completion (`E_POLICY_WEAKENING`).
|
|
1156
|
+
8. **Mutation Proof States & Error Correctness**: `verifyRuleMutation` strictly distinguishes `PASS`, `FAIL`, and `ERROR`. Checkers throwing unhandled exceptions produce `observed: ERROR`, `CHECK_MUTATION_EXECUTION_ERROR`, and null `proofDigest`. A checker crash is never treated as proof of detecting a mutation.
|
|
1157
|
+
9. **Fail-Closed Policy Availability**: Absence of policy in legacy targets continues with `capability: "NOT_PRESENT"`. Present but corrupt or schema-invalid artifacts fail closed with `E_POLICY_INVALID` (blocking preflight and completion), and evaluation exceptions fail closed with `E_POLICY_EVALUATION_FAILED`.
|
|
1158
|
+
10. **Enforced Policy Lock Boundary**: `policy.lock` derives deterministically from effective rules (`built-in rules` + `discovered rules` + `project rules/overrides`) and `baseline`. Modern locks require `algorithm`, `digest`, `rulesDigest`, and `baselineDigest` to participate in integrity validation. `capturedAt` is non-semantic metadata and changes to it alone do not represent a policy change. Lock verification is enforced in `policy-status`, `audit`, and `complete`; unauthorized modifications produce `E_POLICY_LOCK_MISMATCH`.
|
|
1159
|
+
11. **Semantic Baseline Snapshots**: Task snapshots retain full semantic baseline entries. Drift diffing classifies fingerprint additions as `WEAKEN` and removals as `TIGHTEN`. Legacy snapshots lacking baseline state classify drift as `UNKNOWN` rather than inventing prior state.
|
|
1160
|
+
12. **Baseline Recording Protection During Active Tasks**: Re-recording baseline debt via `baseline --record` is blocked during active policy-bound tasks (`E_BASELINE_RECORD_DURING_ACTIVE_TASK`) to prevent absorbing new violations into legacy debt. `baseline --update` is strictly monotonic; additions trigger `E_BASELINE_EXPANSION`. Explicit operator resets require `--policy-reset-authorized`.
|
|
1161
|
+
13. **Semantic Next-Action Policy Recovery**: `forgeloop next` maps policy findings directly to actionable recovery commands (`RESTORE_POLICY`, `REPAIR_CHECKER`, `REPAIR_POLICY`, `REVERIFY_AFTER_POLICY_CHANGE`, `RESTORE_BASELINE`, `CONTINUE_WITH_EXISTING_BASELINE`, `RESOLVE_INERT_CHECK`) rather than collapsing into generic blockers.
|
|
1162
|
+
14. **Task Namespacing & Multi-Task Isolation**: Task-aware operations resolve artifacts under `.forgeloop/task-state/<taskKey>/` for the selected task (explicit `--task`, `FORGELOOP_TASK`, or the single active task), so a concurrent task cannot become an implicit source of lifecycle state. With multiple active tasks and no selector, task-aware commands report `E_TASK_AMBIGUOUS` instead of guessing.
|
|
1163
|
+
|
|
1090
1164
|
## Evidence-driven correction
|
|
1091
1165
|
|
|
1092
1166
|
```text
|
package/LOOP_SYSTEM_DESIGN.md
CHANGED
|
@@ -24,7 +24,7 @@ The system should use every guide that materially helps the task without loading
|
|
|
24
24
|
- The loop continues while safe progress is possible. Repetition without new evidence triggers hypothesis reassessment or a blocked result, not infinite retries.
|
|
25
25
|
- Third-party provenance and reuse boundaries remain part of every portable copy.
|
|
26
26
|
- Qwen-MM-Plugins is an optional, task-scoped capability extension: the agent checks native support first, installs the smallest missing capability when needed, and verifies it before use; it is not a package or runtime dependency.
|
|
27
|
-
- Canonical documents are installed under `.forgeloop/kit/`; root native adapters remain small shims and mutable protocol
|
|
27
|
+
- Canonical documents are installed under `.forgeloop/kit/`; root native adapters remain small discovery shims; project-scoped configuration remains under `.forgeloop/`; and modern mutable task protocol state is isolated under `.forgeloop/task-state/<taskKey>/`.
|
|
28
28
|
- `PREFLIGHT_READY` is a resumable protocol checkpoint reconciled with work state, activation events, fingerprints, and the append-only hash chain.
|
|
29
29
|
|
|
30
30
|
## Alternatives considered
|
|
@@ -331,6 +331,7 @@ A guide never authorizes installation, publication, deletion, migration, or an e
|
|
|
331
331
|
- **Missing tool:** use an available equivalent only when it provides compatible evidence; otherwise request approval or report the check as not run.
|
|
332
332
|
- **Missing guide or broken link:** continue only with conservative defaults and disclose the limitation.
|
|
333
333
|
- **Missing credential:** report the blocked capability without exposing or inventing a credential.
|
|
334
|
+
- **Executable policy failure:** present but malformed policy artifacts fail closed and block preflight and completion; policy weakening relative to the task snapshot blocks completion. Canonical invariants and recovery actions are defined in [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md#executable-policy--autonomy-preserving-invariants), with integration obligations in [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md).
|
|
334
335
|
- **Conflicting instructions:** apply precedence, choose the most conservative interpretation, and record any material decision.
|
|
335
336
|
- **Repeated failure without new evidence:** stop repeating the same action, reassess the hypothesis, and use another diagnostic method.
|
|
336
337
|
- **External or destructive action:** proceed only with explicit authority and an exact validated target.
|
|
@@ -367,10 +368,13 @@ directory selected with `--path` when the package is available in the npm
|
|
|
367
368
|
registry. If it is not available yet, the same commands can run as
|
|
368
369
|
`node src/cli.js ...` from a repository checkout. The CLI maps canonical
|
|
369
370
|
documents into `.forgeloop/kit/`, keeps only native instruction shims at the
|
|
370
|
-
target root, and leaves
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
target root, and leaves project-scoped configuration under `.forgeloop/` while
|
|
372
|
+
isolating modern mutable task protocol state (contract, route, gate, state,
|
|
373
|
+
event, preflight, and receipt artifacts) under
|
|
374
|
+
`.forgeloop/task-state/<taskKey>/`. Legacy singleton artifacts remain under
|
|
375
|
+
`.forgeloop/` for compatibility and migration only. Manual copying must
|
|
376
|
+
preserve that target layout; copying package-source root files directly is not
|
|
377
|
+
equivalent to `forgeloop init`.
|
|
374
378
|
|
|
375
379
|
The README explains the file set, activation behavior, current/relative/absolute
|
|
376
380
|
target installation, first-run profile flow, local validation commands, and safe
|
|
@@ -8,12 +8,13 @@ review primitive without adding that framework to the package.
|
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
10
|
RECEIVED → DISCOVERING → CONTRACT_READY → ROUTED
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
├→ DESIGNING → PLANNED
|
|
12
|
+
└→ PLANNED
|
|
13
13
|
PLANNED → EXECUTING → VERIFYING
|
|
14
14
|
VERIFYING ├→ DIAGNOSING → CORRECTING → VERIFYING
|
|
15
|
-
└→ REVIEWING
|
|
16
|
-
|
|
15
|
+
└→ REVIEWING ──────────────→ COMPLETE
|
|
16
|
+
├→ VERIFYING evidence-only completion recovery
|
|
17
|
+
└→ CORRECTING implementation/review correction required
|
|
17
18
|
Any non-terminal state → BLOCKED when a genuine blocker is evidenced
|
|
18
19
|
```
|
|
19
20
|
|
|
@@ -50,9 +51,41 @@ Any non-terminal state → BLOCKED when a genuine blocker is evidenced
|
|
|
50
51
|
| `CORRECTING` | the fix is applied | `VERIFYING` |
|
|
51
52
|
| `VERIFYING` | checks pass | `REVIEWING` |
|
|
52
53
|
| `REVIEWING` | completion is rejected only for evidence | `VERIFYING` |
|
|
54
|
+
| `REVIEWING` | an implementation or review finding requires correction | `CORRECTING` |
|
|
53
55
|
| `REVIEWING` | contract and quality are accepted | `COMPLETE` |
|
|
54
56
|
| `Any non-terminal state` | a genuine external blocker is evidenced | `BLOCKED` |
|
|
55
57
|
|
|
58
|
+
`BLOCKED` is additionally reachable from any non-terminal, non-`BLOCKED`
|
|
59
|
+
phase when the blocker invariant is satisfied. `WORK_TRANSITIONS` alone is
|
|
60
|
+
therefore not the entire executable transition model; the special `BLOCKED`
|
|
61
|
+
edge is part of the canonical machine semantics.
|
|
62
|
+
|
|
63
|
+
The exact edge inventory below is generated from the runtime
|
|
64
|
+
(`WORK_PHASES`/`WORK_TRANSITIONS` in `src/core/protocol.js`) and must not be
|
|
65
|
+
edited by hand.
|
|
66
|
+
|
|
67
|
+
<!-- BEGIN FORGELOOP GENERATED: work-transitions -->
|
|
68
|
+
|
|
69
|
+
| From | To |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `RECEIVED` | `DISCOVERING` |
|
|
72
|
+
| `DISCOVERING` | `CONTRACT_READY` |
|
|
73
|
+
| `CONTRACT_READY` | `ROUTED` |
|
|
74
|
+
| `ROUTED` | `DESIGNING` |
|
|
75
|
+
| `ROUTED` | `PLANNED` |
|
|
76
|
+
| `DESIGNING` | `PLANNED` |
|
|
77
|
+
| `PLANNED` | `EXECUTING` |
|
|
78
|
+
| `EXECUTING` | `VERIFYING` |
|
|
79
|
+
| `VERIFYING` | `DIAGNOSING` |
|
|
80
|
+
| `VERIFYING` | `REVIEWING` |
|
|
81
|
+
| `DIAGNOSING` | `CORRECTING` |
|
|
82
|
+
| `CORRECTING` | `VERIFYING` |
|
|
83
|
+
| `REVIEWING` | `COMPLETE` |
|
|
84
|
+
| `REVIEWING` | `CORRECTING` |
|
|
85
|
+
| `REVIEWING` | `VERIFYING` |
|
|
86
|
+
|
|
87
|
+
<!-- END FORGELOOP GENERATED: work-transitions -->
|
|
88
|
+
|
|
56
89
|
The host may skip proportional phases, but it must preserve the state
|
|
57
90
|
invariants and record why a skipped phase was not applicable.
|
|
58
91
|
|
|
@@ -60,12 +93,14 @@ invariants and record why a skipped phase was not applicable.
|
|
|
60
93
|
|
|
61
94
|
- `COMPLETE` requires verification evidence current to the task.
|
|
62
95
|
- `BLOCKED` requires blocker evidence, a category, and a safe next action.
|
|
63
|
-
- `CORRECTING` requires a diagnosed hypothesis
|
|
96
|
+
- `CORRECTING` requires a diagnosed hypothesis recorded in the event ledger (`DIAGNOSIS_RECORDED`) with non-zero information gain (`informationGain !== "NONE"`).
|
|
64
97
|
- `REVIEWING` cannot claim independent review when reviewer and implementer
|
|
65
98
|
identities are equal.
|
|
66
99
|
- `REVIEWING → VERIFYING` requires a persisted evidence-only completion
|
|
67
100
|
rejection and starts a new `verificationCycle`.
|
|
68
|
-
- A retry requires new evidence or a changed hypothesis.
|
|
101
|
+
- A retry requires new evidence or a changed hypothesis; repeating the same diagnosis produces `informationGain: NONE` and stalls progression (`CHANGE_STRATEGY`).
|
|
102
|
+
- `forgeloop progress` deterministically evaluates task progress across cycles as `ADVANCING`, `WATCH`, or `STALLED`.
|
|
103
|
+
- `forgeloop record-decision-criterion` attaches contract-bound guidance to unresolved decisions without breaking the schema.
|
|
69
104
|
|
|
70
105
|
## Serializable interfaces
|
|
71
106
|
|
package/PROTOCOL_INTEGRATION.md
CHANGED
|
@@ -312,3 +312,16 @@ because the executor changed.
|
|
|
312
312
|
|
|
313
313
|
For the practical handoff and multi-tool takeover sequence, see
|
|
314
314
|
[`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md).
|
|
315
|
+
|
|
316
|
+
## Executable Policy Protocol Integration
|
|
317
|
+
|
|
318
|
+
ForgeLoop integrates executable verification rules directly into the lifecycle:
|
|
319
|
+
|
|
320
|
+
- **Preflight**: Validates policy capability (`NOT_PRESENT`, `AVAILABLE`, `INVALID`). For `AVAILABLE`, captures effective policy rules and semantic baseline state into `.forgeloop/task-state/<taskKey>/policy-snapshot.json`. If policy artifacts are malformed (`INVALID`), preflight fails closed with `E_POLICY_INVALID`. Snapshot write conflicts fail closed with `E_POLICY_SNAPSHOT_WRITE_FAILED`.
|
|
321
|
+
- **Lock Verification**: Validates `.forgeloop/policy/policy.lock` against effective rules (`built-in` + `discovered` + `project overrides`) and baseline. Requires `algorithm`, `digest`, `rulesDigest`, and `baselineDigest` to match. `capturedAt` is non-semantic metadata. Mismatches trigger `E_POLICY_LOCK_MISMATCH`.
|
|
322
|
+
- **Execution & Verifying**: Evaluates checks with mutation proofing (`rule-verify`). Checkers must cleanly distinguish `PASS`, `FAIL`, and `ERROR` (`CHECK_MUTATION_EXECUTION_ERROR`). Expected mutant failure yields `PROVEN`; false passes yield `UNPROVEN` (`CHECK_MUTATION_NOT_DETECTED`). Unproven or inert checks in discovered rules degrade gracefully without stopping execution.
|
|
323
|
+
- **Completion**: Audits unbaselined violations, policy weakening, and drift. Weakening relative to task snapshot produces `E_POLICY_WEAKENING`. Returns `VALID` when policy integrity is intact and no new unbaselined violations exist.
|
|
324
|
+
- **Autonomy Principle**: Non-interactive execution is preserved. Tools, commands, and validators operate unattended with standard input closed and without interactive prompt dependencies.
|
|
325
|
+
- **Baseline Protection**: Re-recording baseline debt mid-task is rejected with `E_BASELINE_RECORD_DURING_ACTIVE_TASK`; only monotonic ratchet-down is allowed during active tasks (`baseline --update`). Explicit re-recording requires `--policy-reset-authorized`.
|
|
326
|
+
- **Semantic Recovery**: `forgeloop next` maps policy findings directly to actionable recovery actions (`RESTORE_POLICY`, `REPAIR_CHECKER`, `REPAIR_POLICY`, `REVERIFY_AFTER_POLICY_CHANGE`, `RESTORE_BASELINE`, `CONTINUE_WITH_EXISTING_BASELINE`, `RESOLVE_INERT_CHECK`).
|
|
327
|
+
- **Task Scoping**: Task-specific policy snapshots and state live under `.forgeloop/task-state/<taskKey>/` to ensure clean multi-task isolation and cross-harness continuity.
|