@exaudeus/workrail 3.14.0 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/application/services/validation-engine.js +4 -9
  2. package/dist/application/services/workflow-compiler.js +4 -6
  3. package/dist/application/services/workflow-service.d.ts +2 -0
  4. package/dist/application/services/workflow-service.js +3 -0
  5. package/dist/console/assets/index-BE5PAgPO.js +28 -0
  6. package/dist/console/assets/index-BZNM03t1.css +1 -0
  7. package/dist/console/index.html +2 -2
  8. package/dist/engine/engine-factory.js +2 -2
  9. package/dist/engine/types.d.ts +1 -1
  10. package/dist/env-flags.d.ts +1 -0
  11. package/dist/env-flags.js +4 -0
  12. package/dist/infrastructure/session/HttpServer.d.ts +3 -3
  13. package/dist/infrastructure/session/HttpServer.js +68 -74
  14. package/dist/infrastructure/storage/caching-workflow-storage.d.ts +2 -0
  15. package/dist/infrastructure/storage/caching-workflow-storage.js +15 -6
  16. package/dist/infrastructure/storage/file-workflow-storage.js +3 -4
  17. package/dist/infrastructure/storage/schema-validating-workflow-storage.js +9 -8
  18. package/dist/manifest.json +283 -219
  19. package/dist/mcp/assert-output.d.ts +37 -0
  20. package/dist/mcp/assert-output.js +52 -0
  21. package/dist/mcp/boundary-coercion.d.ts +1 -0
  22. package/dist/mcp/boundary-coercion.js +44 -0
  23. package/dist/mcp/dev-mode.d.ts +1 -0
  24. package/dist/mcp/dev-mode.js +4 -0
  25. package/dist/mcp/handler-factory.js +12 -9
  26. package/dist/mcp/handlers/session.js +8 -9
  27. package/dist/mcp/handlers/shared/request-workflow-reader.d.ts +5 -0
  28. package/dist/mcp/handlers/shared/request-workflow-reader.js +47 -2
  29. package/dist/mcp/handlers/v2-advance-core/assessment-consequences.d.ts +1 -1
  30. package/dist/mcp/handlers/v2-advance-core/assessment-consequences.js +4 -5
  31. package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +2 -0
  32. package/dist/mcp/handlers/v2-advance-core/event-builders.js +6 -6
  33. package/dist/mcp/handlers/v2-advance-core/index.d.ts +2 -0
  34. package/dist/mcp/handlers/v2-advance-core/index.js +5 -4
  35. package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +2 -0
  36. package/dist/mcp/handlers/v2-advance-core/input-validation.js +32 -9
  37. package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +2 -0
  38. package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +2 -2
  39. package/dist/mcp/handlers/v2-advance-core/outcome-success.d.ts +2 -0
  40. package/dist/mcp/handlers/v2-advance-core/outcome-success.js +1 -1
  41. package/dist/mcp/handlers/v2-checkpoint.d.ts +1 -1
  42. package/dist/mcp/handlers/v2-checkpoint.js +5 -6
  43. package/dist/mcp/handlers/v2-execution/advance.d.ts +4 -2
  44. package/dist/mcp/handlers/v2-execution/advance.js +5 -7
  45. package/dist/mcp/handlers/v2-execution/continue-advance.js +56 -26
  46. package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +1 -1
  47. package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +9 -9
  48. package/dist/mcp/handlers/v2-execution/replay.d.ts +6 -4
  49. package/dist/mcp/handlers/v2-execution/replay.js +47 -30
  50. package/dist/mcp/handlers/v2-execution/start.d.ts +3 -3
  51. package/dist/mcp/handlers/v2-execution/start.js +31 -12
  52. package/dist/mcp/handlers/v2-execution/workflow-object-cache.d.ts +5 -0
  53. package/dist/mcp/handlers/v2-execution/workflow-object-cache.js +19 -0
  54. package/dist/mcp/handlers/v2-execution-helpers.d.ts +1 -0
  55. package/dist/mcp/handlers/v2-execution-helpers.js +23 -7
  56. package/dist/mcp/handlers/v2-resume.d.ts +1 -1
  57. package/dist/mcp/handlers/v2-resume.js +3 -4
  58. package/dist/mcp/handlers/v2-state-conversion.js +5 -1
  59. package/dist/mcp/handlers/v2-workflow.d.ts +100 -0
  60. package/dist/mcp/handlers/v2-workflow.js +155 -31
  61. package/dist/mcp/handlers/workflow.d.ts +2 -5
  62. package/dist/mcp/handlers/workflow.js +15 -12
  63. package/dist/mcp/output-schemas.d.ts +123 -29
  64. package/dist/mcp/output-schemas.js +36 -18
  65. package/dist/mcp/server.js +70 -5
  66. package/dist/mcp/tool-call-timing.d.ts +24 -0
  67. package/dist/mcp/tool-call-timing.js +85 -0
  68. package/dist/mcp/tool-descriptions.js +17 -9
  69. package/dist/mcp/transports/http-entry.js +3 -2
  70. package/dist/mcp/transports/http-listener.d.ts +1 -0
  71. package/dist/mcp/transports/http-listener.js +25 -0
  72. package/dist/mcp/transports/shutdown-hooks.d.ts +4 -1
  73. package/dist/mcp/transports/shutdown-hooks.js +3 -2
  74. package/dist/mcp/transports/stdio-entry.js +6 -28
  75. package/dist/mcp/v2/tools.d.ts +6 -0
  76. package/dist/mcp/v2/tools.js +2 -0
  77. package/dist/mcp/v2-response-formatter.js +2 -4
  78. package/dist/mcp/validation/schema-introspection.d.ts +1 -0
  79. package/dist/mcp/validation/schema-introspection.js +15 -5
  80. package/dist/mcp/validation/suggestion-generator.js +2 -2
  81. package/dist/mcp/workflow-protocol-contracts.js +5 -1
  82. package/dist/runtime/adapters/node-process-signals.d.ts +1 -0
  83. package/dist/runtime/adapters/node-process-signals.js +5 -0
  84. package/dist/runtime/adapters/noop-process-signals.d.ts +1 -0
  85. package/dist/runtime/adapters/noop-process-signals.js +2 -0
  86. package/dist/runtime/ports/process-signals.d.ts +1 -0
  87. package/dist/types/workflow-definition.d.ts +3 -2
  88. package/dist/types/workflow.d.ts +3 -0
  89. package/dist/types/workflow.js +35 -26
  90. package/dist/v2/durable-core/domain/context-template-resolver.js +2 -2
  91. package/dist/v2/durable-core/domain/function-definition-expander.js +2 -17
  92. package/dist/v2/durable-core/domain/prompt-renderer.d.ts +1 -0
  93. package/dist/v2/durable-core/domain/prompt-renderer.js +23 -18
  94. package/dist/v2/durable-core/domain/recap-recovery.js +23 -16
  95. package/dist/v2/durable-core/domain/retrieval-contract.js +13 -7
  96. package/dist/v2/durable-core/session-index.d.ts +22 -0
  97. package/dist/v2/durable-core/session-index.js +58 -0
  98. package/dist/v2/durable-core/sorted-event-log.d.ts +6 -0
  99. package/dist/v2/durable-core/sorted-event-log.js +15 -0
  100. package/dist/v2/infra/local/fs/index.js +8 -8
  101. package/dist/v2/infra/local/session-store/index.d.ts +1 -1
  102. package/dist/v2/infra/local/session-store/index.js +71 -61
  103. package/dist/v2/infra/local/session-summary-provider/index.js +9 -4
  104. package/dist/v2/infra/local/snapshot-store/index.js +2 -1
  105. package/dist/v2/infra/local/workspace-anchor/index.js +4 -1
  106. package/dist/v2/ports/session-event-log-store.port.d.ts +1 -1
  107. package/dist/v2/projections/assessment-consequences.d.ts +2 -1
  108. package/dist/v2/projections/assessment-consequences.js +0 -5
  109. package/dist/v2/projections/assessments.d.ts +2 -1
  110. package/dist/v2/projections/assessments.js +2 -4
  111. package/dist/v2/projections/gaps.d.ts +2 -1
  112. package/dist/v2/projections/gaps.js +0 -5
  113. package/dist/v2/projections/preferences.d.ts +2 -1
  114. package/dist/v2/projections/preferences.js +0 -5
  115. package/dist/v2/projections/run-context.d.ts +2 -2
  116. package/dist/v2/projections/run-context.js +0 -5
  117. package/dist/v2/projections/run-dag.js +7 -1
  118. package/dist/v2/projections/run-execution-trace.d.ts +8 -0
  119. package/dist/v2/projections/run-execution-trace.js +124 -0
  120. package/dist/v2/projections/run-status-signals.d.ts +2 -2
  121. package/dist/v2/usecases/console-routes.d.ts +3 -1
  122. package/dist/v2/usecases/console-routes.js +149 -3
  123. package/dist/v2/usecases/console-service.d.ts +2 -0
  124. package/dist/v2/usecases/console-service.js +87 -26
  125. package/dist/v2/usecases/console-types.d.ts +65 -0
  126. package/dist/v2/usecases/worktree-service.js +87 -8
  127. package/package.json +7 -6
  128. package/spec/authoring-spec.json +82 -1
  129. package/spec/workflow-tags.json +132 -0
  130. package/spec/workflow.schema.json +21 -11
  131. package/workflows/adaptive-ticket-creation.json +33 -8
  132. package/workflows/architecture-scalability-audit.json +50 -9
  133. package/workflows/bug-investigation.agentic.v2.json +43 -14
  134. package/workflows/coding-task-workflow-agentic.json +57 -38
  135. package/workflows/coding-task-workflow-agentic.lean.v2.json +129 -34
  136. package/workflows/coding-task-workflow-agentic.v2.json +97 -30
  137. package/workflows/cross-platform-code-conversion.v2.json +175 -48
  138. package/workflows/document-creation-workflow.json +49 -12
  139. package/workflows/documentation-update-workflow.json +9 -2
  140. package/workflows/intelligent-test-case-generation.json +9 -2
  141. package/workflows/learner-centered-course-workflow.json +273 -266
  142. package/workflows/mr-review-workflow.agentic.v2.json +88 -14
  143. package/workflows/personal-learning-materials-creation-branched.json +181 -174
  144. package/workflows/presentation-creation.json +167 -160
  145. package/workflows/production-readiness-audit.json +61 -15
  146. package/workflows/relocation-workflow-us.json +21 -5
  147. package/workflows/routines/tension-driven-design.json +1 -1
  148. package/workflows/scoped-documentation-workflow.json +9 -2
  149. package/workflows/test-artifact-loop-control.json +1 -2
  150. package/workflows/ui-ux-design-workflow.json +334 -0
  151. package/workflows/workflow-diagnose-environment.json +7 -1
  152. package/workflows/workflow-for-workflows.json +514 -484
  153. package/workflows/workflow-for-workflows.v2.json +55 -11
  154. package/workflows/wr.discovery.json +118 -29
  155. package/dist/console/assets/index-DW78t31j.css +0 -1
  156. package/dist/console/assets/index-EsSXrC_a.js +0 -28
@@ -2,7 +2,14 @@
2
2
  "id": "scoped-documentation-workflow",
3
3
  "name": "Scoped Documentation Workflow",
4
4
  "version": "2.0.0",
5
- "description": "Create documentation for a SINGLE, BOUNDED subject with strict scope enforcement. Perfect for: one class/component, one integration point, one mechanism, one architecture decision. Prevents documentation sprawl through continuous boundary validation.",
5
+ "description": "Use this to create documentation for a single, bounded subject one class, one integration point, one mechanism, or one architecture decision. Enforces strict scope discipline to prevent documentation sprawl.",
6
+ "about": "## Scoped Documentation Workflow\n\nUse this when you need to document **one specific, bounded subject** -- a single class, one integration contract, a particular algorithm, an architecture decision, or a single workflow step. The defining feature of this workflow is strict scope discipline: it explicitly defines what is \"in scope\" (explained in detail) vs. \"out of scope\" (referenced only, never explained), and enforces that boundary throughout analysis and writing.\n\n### What it produces\n\n- A focused documentation file covering the subject in depth.\n- A `SCOPE_MAP.md` that shows what is documented here vs. referenced elsewhere.\n- An optional `MAINTENANCE_NOTES.md` with guidance on when to update.\n\n### When to use it\n\n- You want docs for one class, module, mechanism, or concept -- not a whole system.\n- You've had documentation sprawl problems before and want enforced boundaries.\n- You're building a documentation set incrementally, one subject at a time.\n- The subject has clear integration points with other systems that should be referenced, not re-explained.\n\n### When NOT to use it\n\n- You need documentation that intentionally spans multiple components -- use the Document Creation workflow instead.\n- You're updating an existing doc -- use the Documentation Update workflow.\n\n### How to get good results\n\n- The first step asks you to review and approve a scope contract. Be precise here -- the whole workflow defends this boundary.\n- Out-of-scope items should already have their own documentation. If they don't, note that so the scope map can reflect it.\n- If you find the approved scope was too narrow or too broad during the workflow, you can request a scope renegotiation.",
7
+ "examples": [
8
+ "Document the RateLimiter class: its API, configuration options, and failure behavior",
9
+ "Write docs for the OAuth token refresh mechanism, scoped to our implementation only",
10
+ "Document the ADR for our choice to use event sourcing in the orders domain",
11
+ "Create a focused reference for the retry policy configuration in the HTTP client"
12
+ ],
6
13
  "clarificationPrompts": [
7
14
  "What specifically do you want to document? (feature, component, library, mechanism, interaction, architecture, process, etc.)",
8
15
  "Who will read this documentation? (team members, external users, new developers, architects, etc.)",
@@ -178,4 +185,4 @@
178
185
  "hasValidation": true
179
186
  }
180
187
  ]
181
- }
188
+ }
@@ -59,8 +59,7 @@
59
59
  "assessmentConsequences": [
60
60
  {
61
61
  "when": {
62
- "dimensionId": "confidence",
63
- "equalsLevel": "low"
62
+ "anyEqualsLevel": "low"
64
63
  },
65
64
  "effect": {
66
65
  "kind": "require_followup",
@@ -0,0 +1,334 @@
1
+ {
2
+ "id": "ui-ux-design-workflow",
3
+ "name": "UI/UX Design Workflow (v1 \u2022 Process-Enforced \u2022 Evidence-Driven)",
4
+ "version": "0.1.0",
5
+ "description": "Design UI/UX from scratch with enforced process. Makes problem framing structurally required before solution proposals, forces exploration of multiple design directions before convergence, and applies reviewer families for information architecture, UX laws, accessibility, edge cases, and content. Output: a design spec concrete enough to implement or review.",
6
+ "about": "## UI/UX Design Workflow\n\nThis workflow produces a design spec for a new feature, screen, component, or interaction. It is built around a single principle: problem framing must happen before any solutions are proposed. The workflow makes this structurally impossible to skip, which prevents the most common failure mode in AI-assisted design -- going straight from \"I need a settings screen\" to a layout without ever asking who uses it or what they are trying to do.\n\n**What it does:**\nPhase 0 frames the problem by reading existing code patterns and asking only what tools cannot answer. Phase 1 generates 2-3 genuinely different design directions before any one is chosen. Phases 2-5 run parallel reviewer families -- information architecture, UX laws (Hick's Law, Miller's Law, Fitts's Law, and others), accessibility (specific WCAG requirements, not just \"follow WCAG\"), edge cases (empty, error, loading, first-use), and content quality -- then synthesize their findings, resolve contradictions, and write a spec only after all hard quality gates pass.\n\n**When to use it:**\n- You need to design a new screen, feature, or non-trivial component\n- You want explicit coverage of accessibility, edge states, and UX laws, not just a layout sketch\n- You need a spec concrete enough for an engineer to implement or a designer to review\n- Simple single-component changes also work through a lighter direct-spec path\n\n**What it produces:**\nA design spec with 8 sections: design decision, information architecture, interaction design, all element states, specific accessibility requirements, content copy, reviewer findings with citations, and open questions that still require human visual review.\n\n**How to get good results:**\nPoint the workflow to your codebase so it can read existing components and patterns. Provide the design system location if it is not in the repo. Share any known user pain points or research. The workflow will surface what it cannot determine on its own.",
7
+ "examples": [
8
+ "Design the empty state and onboarding flow for a new team dashboard feature",
9
+ "Design a settings panel for notification preferences with accessibility requirements",
10
+ "Design the error and loading states for the file upload component",
11
+ "Redesign the search results screen to reduce cognitive load for first-time users"
12
+ ],
13
+ "recommendedPreferences": {
14
+ "recommendedAutonomy": "guided",
15
+ "recommendedRiskPolicy": "conservative"
16
+ },
17
+ "features": [
18
+ "wr.features.subagent_guidance"
19
+ ],
20
+ "preconditions": [
21
+ "User has a UI/UX design task: a new feature, screen, component, or interaction to design.",
22
+ "Agent has enough context about the product or codebase to understand existing patterns.",
23
+ "A human will review the design spec before implementation begins."
24
+ ],
25
+ "metaGuidance": [
26
+ "PROCESS IS THE VALUE: the biggest failure mode in AI-assisted design is skipping to solutions before understanding the problem. This workflow makes that structurally impossible. Do not shortcut Phase 0.",
27
+ "EVIDENCE OVER PLATITUDES: every finding must cite a specific element from the context packet. 'Consider reducing cognitive load' is not a finding. 'The settings panel has 14 options, violating Miller\u2019s Law (7\u00b12)' is a finding.",
28
+ "SIMPLE CRITERIA: designComplexity=Simple is only valid for a single existing component with a minor change, no new user flows, no information architecture changes, and no new interaction patterns. If uncertain, classify upward.",
29
+ "HONEST LIMITS: this workflow produces a text-based design spec. It cannot produce visual mockups, conduct usability testing, or verify visual quality. Say so explicitly in the handoff and flag what still needs human visual review.",
30
+ "CONTEXT BLINDNESS: if the user has not provided design system, existing component patterns, or platform conventions, surface this gap in Phase 0 and ask. Do not silently design without this context.",
31
+ "V2 DURABILITY: use output.notesMarkdown as the primary durable record. Do not create DESIGN_CONTEXT.md or other sidecar files.",
32
+ "OWNERSHIP: the main agent owns synthesis, design decision, and final spec. Reviewer families provide independent perspectives only.",
33
+ "EDGE CASES ARE NOT OPTIONAL: every interactive design must address empty state, error state, loading state, and first-use. If any of these are not addressed in the spec, the spec is incomplete."
34
+ ],
35
+ "steps": [
36
+ {
37
+ "id": "phase-0-problem-framing",
38
+ "title": "Phase 0: Frame the Problem and Establish Design Context",
39
+ "promptBlocks": {
40
+ "goal": "Understand the design problem, the users it serves, and the context it exists in before proposing any solutions.",
41
+ "constraints": [
42
+ "Explore the codebase to find existing patterns, components, and conventions before asking questions.",
43
+ "Ask only for information tools cannot answer: design system location, target platform if ambiguous, user research or known pain points.",
44
+ "Do not propose any design solutions in this phase."
45
+ ],
46
+ "procedure": [
47
+ "Read the codebase to understand: existing UI components and patterns, platform (web/iOS/Android/cross-platform), tech stack constraints that affect UI, and any existing design documentation.",
48
+ "Identify the primary user and their goal: who will use this feature, what are they trying to accomplish, and what context are they in when they use it?",
49
+ "Identify constraints: technical limitations, existing design system components to use, platform conventions to follow, accessibility requirements, and any stated non-goals.",
50
+ "Identify the existing design context: what screens or components does this new design connect to? What does the user do before and after?",
51
+ "Surface any context you could not determine from tools: missing design system information, unknown user research, unclear platform target.",
52
+ "Classify designComplexity: Simple = single existing component, minor change, no new flows, no IA changes. Standard = new screen or component, moderate scope. Complex = new user flows, significant IA changes, multiple screens or interaction patterns.",
53
+ "Set needsReviewerBundle = true for Standard and Complex; false for Simple."
54
+ ],
55
+ "outputRequired": {
56
+ "notesMarkdown": "User and goal, design constraints, existing context, gaps that need human input, and complexity classification with rationale.",
57
+ "context": "Capture userGoals, userConstraints, existingDesignContext, designComplexity, needsReviewerBundle, designContextGaps, and openQuestions."
58
+ },
59
+ "verify": [
60
+ "The user and their goal are explicit before any design work begins.",
61
+ "designComplexity is classified with a concrete reason, not a guess.",
62
+ "Any missing context (design system, platform, user research) is surfaced, not silently assumed."
63
+ ]
64
+ },
65
+ "requireConfirmation": true
66
+ },
67
+ {
68
+ "id": "phase-1-design-directions",
69
+ "title": "Phase 1: Explore Design Directions",
70
+ "runCondition": {
71
+ "var": "needsReviewerBundle",
72
+ "equals": true
73
+ },
74
+ "promptBlocks": {
75
+ "goal": "Generate 2-3 genuinely different design directions before committing to any one of them.",
76
+ "constraints": [
77
+ "Directions must be genuinely different \u2014 not variations of the same pattern with different labels.",
78
+ "Each direction needs an information architecture sketch: how is content organized, what is the primary navigation path, what is the visual hierarchy?",
79
+ "Do not select a direction in this phase. Exploration comes before convergence."
80
+ ],
81
+ "procedure": [
82
+ "Generate Direction A: the most conventional approach that follows existing platform patterns and design system. Low risk, familiar to users.",
83
+ "Generate Direction B: an approach that prioritizes the primary user goal differently \u2014 different IA, different entry point, or different interaction model.",
84
+ "Generate Direction C (if designComplexity=Complex): a third direction that challenges the assumptions in A and B \u2014 a more radical rethinking of the problem.",
85
+ "For each direction, describe: (1) the primary IA sketch (main sections, navigation path, content hierarchy), (2) the core interaction model (how does the user accomplish their goal?), (3) the key tradeoffs relative to user goals and constraints.",
86
+ "After describing all directions, restate which user goals each direction serves well and where each direction is weakest."
87
+ ],
88
+ "outputRequired": {
89
+ "notesMarkdown": "All design directions with IA sketches and explicit tradeoffs. No recommendation yet.",
90
+ "context": "Capture designDirections (array of direction objects with name, iaSketch, interactionModel, tradeoffs)."
91
+ },
92
+ "verify": [
93
+ "At least 2 directions are genuinely different in IA or interaction model, not just surface styling.",
94
+ "Each direction has an explicit IA sketch and tradeoff analysis.",
95
+ "No direction has been selected or recommended yet."
96
+ ]
97
+ },
98
+ "requireConfirmation": true
99
+ },
100
+ {
101
+ "id": "phase-2-freeze-context-packet",
102
+ "title": "Phase 2: Freeze Context Packet and Select Reviewer Families",
103
+ "runCondition": {
104
+ "var": "needsReviewerBundle",
105
+ "equals": true
106
+ },
107
+ "promptBlocks": {
108
+ "goal": "Assemble a neutral context packet that all reviewer families will use as shared truth, then declare which reviewers are needed.",
109
+ "constraints": [
110
+ "The context packet is neutral \u2014 it presents the design problem and directions without advocating for any one.",
111
+ "Select the direction to develop further before running reviewers \u2014 reviewers evaluate a specific direction, not an abstract problem.",
112
+ "All 5 reviewer families are active for Complex designs; IA and UX laws reviewers are always included for Standard."
113
+ ],
114
+ "procedure": [
115
+ "Select the design direction to develop: based on the user goals and constraints from Phase 0, choose the direction from Phase 1 that best fits. State which direction and the specific reason it was chosen over the others.",
116
+ "Assemble the designContextPacket containing: (1) the selected direction's IA sketch and interaction model, (2) user goals and constraints from Phase 0, (3) existing design context (what connects to this), (4) platform and tech constraints, (5) any known user pain points or requirements.",
117
+ "Select reviewer families: IA reviewer (always), UX laws reviewer (always), accessibility reviewer (Standard and Complex), edge cases reviewer (Standard and Complex), content reviewer (Complex or when copy is a significant design concern).",
118
+ "Set selectedReviewerFamilies and needsReviewerBundle context."
119
+ ],
120
+ "outputRequired": {
121
+ "notesMarkdown": "Selected direction with rationale, frozen context packet summary, and selected reviewer families with justification.",
122
+ "context": "Capture designContextPacket, selectedDirection, selectedReviewerFamilies, contradictionCount (init 0), evidenceWeakCount (init 0)."
123
+ },
124
+ "verify": [
125
+ "A specific direction is selected with a concrete reason.",
126
+ "The context packet is complete enough that a reviewer can evaluate the design without regathering context.",
127
+ "Reviewer family selection is justified by designComplexity."
128
+ ]
129
+ },
130
+ "requireConfirmation": false
131
+ },
132
+ {
133
+ "id": "phase-3-reviewer-bundle",
134
+ "title": "Phase 3: Parallel Reviewer Bundle",
135
+ "runCondition": {
136
+ "var": "needsReviewerBundle",
137
+ "equals": true
138
+ },
139
+ "promptBlocks": {
140
+ "goal": "Run the selected reviewer families in parallel against the frozen context packet, then synthesize their findings as evidence rather than verdicts.",
141
+ "constraints": [
142
+ [
143
+ {
144
+ "kind": "ref",
145
+ "refId": "wr.refs.synthesis_under_disagreement"
146
+ }
147
+ ],
148
+ "Every finding must cite a specific element, component, or decision from the designContextPacket. Generic UX advice without a specific reference is not a valid finding.",
149
+ "Reviewer output is raw evidence. The main agent owns synthesis and design decisions."
150
+ ],
151
+ "procedure": [
152
+ "Before delegating, restate the selected direction and the user goal it serves best.",
153
+ "Spawn one WorkRail Executor per selected reviewer family simultaneously. Each executor receives: the designContextPacket, their specific reviewer mission, and the finding format requirement.",
154
+ "Reviewer family missions: (1) IA reviewer \u2014 evaluate content hierarchy, navigation paths, grouping logic, and information scent against user goals; cite specific IA decisions; (2) UX laws reviewer \u2014 check each relevant law: Hick's Law (decision count), Miller's Law (working memory), Jakob's Law (familiar patterns), Fitts's Law (target size and distance), Peak-End Rule (emotional journey), Tesler's Law (irreducible complexity), Von Restorff Effect (visual differentiation of important elements); cite specific violations or confirmations; (3) accessibility reviewer \u2014 check WCAG requirements: color contrast ratios (4.5:1 normal, 3:1 large text), keyboard navigation path, touch target sizes (44x44px minimum), screen reader labels, focus indicators, animation controls; produce specific requirements not 'follow WCAG'; (4) edge cases reviewer \u2014 for each interactive element, explicitly address: empty state (no data), error state (failed action), loading state, first-use/onboarding, offline or degraded state, destructive actions; flag any state not addressed in the current design; (5) content reviewer \u2014 evaluate every label, button copy, placeholder, error message, and helper text against clarity, user language vs. technical jargon, and actionability of error messages.",
155
+ "After receiving all executor outputs, synthesize explicitly: what was confirmed, what was new, what looks weak or generic, and what has citations vs. what is speculation.",
156
+ "Set evidenceWeakCount to the number of findings without specific citations."
157
+ ],
158
+ "outputRequired": {
159
+ "notesMarkdown": "Per-family synthesis, contradiction flags, evidence quality assessment, and overall finding count.",
160
+ "context": "Capture reviewerFindings (per-family), contradictionCount, evidenceWeakCount."
161
+ },
162
+ "verify": [
163
+ "Every declared reviewer family has at least one substantive finding.",
164
+ "Reviewer output was synthesized by the main agent, not adopted verbatim.",
165
+ "Findings with specific citations are distinguished from generic advice."
166
+ ]
167
+ },
168
+ "requireConfirmation": false
169
+ },
170
+ {
171
+ "id": "phase-4-synthesis-loop",
172
+ "type": "loop",
173
+ "title": "Phase 4: Synthesis and Contradiction Resolution",
174
+ "loop": {
175
+ "type": "while",
176
+ "conditionSource": {
177
+ "kind": "artifact_contract",
178
+ "contractRef": "wr.contracts.loop_control",
179
+ "loopId": "design_synthesis_loop"
180
+ },
181
+ "maxIterations": 2
182
+ },
183
+ "body": [
184
+ {
185
+ "id": "phase-4a-resolve",
186
+ "title": "Resolve Contradictions and Strengthen Weak Evidence",
187
+ "promptBlocks": {
188
+ "goal": "Resolve any contradictions between reviewer findings and strengthen evidence-weak findings before finalizing the design decision.",
189
+ "constraints": [
190
+ "Contradiction resolution is main-agent work. Do not delegate synthesis.",
191
+ "If two reviewers disagree about the same design element, explicitly adjudicate which evidence is stronger."
192
+ ],
193
+ "procedure": [
194
+ "List any contradictions: cases where two reviewer families disagree about the same design element or recommendation.",
195
+ "Adjudicate each contradiction: which evidence is more specific, which is better grounded in the design context packet?",
196
+ "For any finding with evidenceWeak=true, either find the specific citation yourself or downgrade the finding to advisory.",
197
+ "Update reviewerFindings with resolved contradictions and strengthened evidence.",
198
+ "Update contradictionCount to 0 when resolved; update evidenceWeakCount."
199
+ ],
200
+ "outputRequired": {
201
+ "notesMarkdown": "Contradictions resolved, evidence-weak findings addressed, updated finding summary.",
202
+ "context": "Capture contradictionCount, evidenceWeakCount, reviewerFindings."
203
+ },
204
+ "verify": [
205
+ "Each resolved contradiction names which evidence won and why.",
206
+ "No unresolved contradictions remain."
207
+ ]
208
+ },
209
+ "requireConfirmation": false
210
+ },
211
+ {
212
+ "id": "phase-4b-loop-decision",
213
+ "title": "Synthesis Loop Decision",
214
+ "promptBlocks": {
215
+ "goal": "Decide whether another synthesis pass is needed.",
216
+ "constraints": [
217
+ "Use trigger rules, not vibes."
218
+ ],
219
+ "procedure": [
220
+ "Continue if contradictionCount > 0.",
221
+ "Otherwise continue if evidenceWeakCount > 3 (more than 3 findings still lack specific citations).",
222
+ "Otherwise stop."
223
+ ],
224
+ "outputRequired": {
225
+ "artifact": "Emit a `wr.loop_control` artifact for `design_synthesis_loop` with `decision` set to `continue` or `stop`."
226
+ },
227
+ "verify": [
228
+ "The loop does not stop while material contradictions remain unresolved."
229
+ ]
230
+ },
231
+ "outputContract": {
232
+ "contractRef": "wr.contracts.loop_control"
233
+ },
234
+ "requireConfirmation": false
235
+ }
236
+ ],
237
+ "runCondition": {
238
+ "var": "needsReviewerBundle",
239
+ "equals": true
240
+ }
241
+ },
242
+ {
243
+ "id": "phase-5-hard-gate",
244
+ "title": "Phase 5: Hard Gate Check",
245
+ "runCondition": {
246
+ "var": "needsReviewerBundle",
247
+ "equals": true
248
+ },
249
+ "promptBlocks": {
250
+ "goal": "Verify all quality gates pass before writing the design spec.",
251
+ "constraints": [
252
+ "If any gate fails, fix the underlying issue before advancing \u2014 do not write the spec over known gaps."
253
+ ],
254
+ "procedure": [
255
+ "Gate 1 \u2014 Evidence citations: confirm every finding in reviewerFindings cites a specific design element from the context packet. Flag any finding that is generic advice without a specific reference and either improve it or mark it advisory-only.",
256
+ "Gate 2 \u2014 Reviewer coverage: confirm every declared reviewer family has at least one substantive finding. If a family has no findings, state explicitly why (e.g., 'IA reviewer found no issues \u2014 the single-screen design has no navigation structure to evaluate').",
257
+ "Gate 3 \u2014 Edge case coverage: confirm empty state, error state, loading state, and first-use are addressed for each interactive element in the selected design direction. List any that are not yet addressed.",
258
+ "Gate 4 \u2014 Accessibility specificity: confirm accessibility requirements are listed as specific constraints (color contrast ratios, touch target sizes, keyboard tab order), not as a generic 'follow WCAG' instruction."
259
+ ],
260
+ "outputRequired": {
261
+ "notesMarkdown": "Gate check results: which passed, which failed, what was fixed.",
262
+ "context": "Capture hardGatesPassed, hardGateFailures."
263
+ },
264
+ "verify": [
265
+ "hardGatesPassed = true before advancing to spec writing.",
266
+ "Any gate failures were fixed, not silently accepted."
267
+ ]
268
+ },
269
+ "requireConfirmation": false
270
+ },
271
+ {
272
+ "id": "phase-5-design-spec-handoff",
273
+ "title": "Phase 5: Design Spec",
274
+ "promptBlocks": {
275
+ "goal": "Produce a complete design spec ready for engineering review and implementation.",
276
+ "constraints": [
277
+ "Every interactive element must have its edge cases addressed in the spec.",
278
+ "Accessibility requirements must be specific, not 'follow WCAG'.",
279
+ "The spec must acknowledge what still requires human visual review and what requires usability testing.",
280
+ "Do not drift into implementation planning (specific component libraries, code) unless explicitly asked."
281
+ ],
282
+ "procedure": [
283
+ "Write the design spec covering: (1) Design Decision \u2014 which direction was chosen and the specific reason it was chosen over the others; (2) Information Architecture \u2014 content hierarchy, navigation structure, primary user path; (3) Interaction Design \u2014 how each interactive element works, what triggers what, what feedback the user gets; (4) States \u2014 for each element: default, hover/focus, loading, error, empty, first-use, disabled; (5) Accessibility Requirements \u2014 specific requirements (color contrast ratios, keyboard tab order, touch target sizes, screen reader labels); (6) Content \u2014 all copy, labels, error messages, placeholders, and onboarding text; (7) Reviewer Findings \u2014 per-dimension findings with citations that the design should address or has already addressed; (8) Open Questions \u2014 what still needs human input (visual design, usability testing, design system component availability).",
284
+ "Close the spec by naming: what visual review a human designer should perform, and what this workflow cannot verify (visual quality, usability, emotional feel)."
285
+ ],
286
+ "outputRequired": {
287
+ "notesMarkdown": "Complete design spec with all 8 sections. Open questions and human-review items explicitly listed."
288
+ },
289
+ "verify": [
290
+ "All 8 spec sections are present and substantive.",
291
+ "Every interactive element has states addressed.",
292
+ "Accessibility requirements are specific, not generic.",
293
+ "Open questions acknowledge the limits of agent-generated design specs."
294
+ ]
295
+ },
296
+ "requireConfirmation": false,
297
+ "runCondition": {
298
+ "var": "needsReviewerBundle",
299
+ "equals": true
300
+ }
301
+ },
302
+ {
303
+ "id": "phase-simple-design",
304
+ "title": "Simple Path: Direct Design Spec",
305
+ "runCondition": {
306
+ "var": "needsReviewerBundle",
307
+ "equals": false
308
+ },
309
+ "promptBlocks": {
310
+ "goal": "Produce a focused design spec for a simple, bounded change without the full reviewer pipeline.",
311
+ "constraints": [
312
+ "Simple means: single existing component, minor change, no new flows, no IA changes.",
313
+ "If during spec writing you discover the change is more complex than classified, stop, update designComplexity to Standard, set needsReviewerBundle=true, and return to Phase 1.",
314
+ "Even simple changes must address: error state, empty state if applicable, accessibility."
315
+ ],
316
+ "procedure": [
317
+ "Write the design spec: what changes, why, the specific interaction or visual change, any states affected, and the accessibility impact.",
318
+ "Apply quick UX checks: does the change violate any obvious UX laws (Fitts's Law for target size, consistency with nearby elements)? Is the copy clear and in user language?",
319
+ "Note what a human reviewer should visually verify."
320
+ ],
321
+ "outputRequired": {
322
+ "notesMarkdown": "Focused design spec: what changes, why, states, accessibility impact, and what needs visual review."
323
+ },
324
+ "verify": [
325
+ "The change is genuinely simple by the stated criteria.",
326
+ "Error and empty states are addressed if applicable.",
327
+ "Accessibility impact is stated."
328
+ ]
329
+ },
330
+ "requireConfirmation": false
331
+ }
332
+ ],
333
+ "validatedAgainstSpecVersion": 3
334
+ }
@@ -2,7 +2,13 @@
2
2
  "id": "workflow-diagnose-environment",
3
3
  "name": "Diagnostic: Environment & Subagents",
4
4
  "version": "1.0.0",
5
- "description": "Automated capability detection for Agentic IDEs. Probes for subagent access and generates a local configuration file.",
5
+ "description": "Use this to diagnose MCP server, tool availability, or environment configuration issues. Probes for subagent access and generates a local configuration file.",
6
+ "about": "## Environment Diagnostic Workflow\n\nThis is a short, self-contained diagnostic that checks what capabilities are actually available in the current workspace -- specifically whether subagent delegation works and whether WorkRail tools are accessible to those subagents.\n\n**What it does:**\nThe workflow actively probes for subagent access by attempting to contact a subagent and have it list available tools. Based on the result, it classifies the environment into one of three tiers: full delegation (Tier 3), proxy mode where subagents exist but lack tool access (Tier 2), or solo mode with no subagents available (Tier 1). It then writes a `.workrail/config.json` file recording the detected capability tier so other workflows can make informed delegation decisions.\n\n**When to use it:**\n- You are setting up WorkRail in a new workspace for the first time\n- A workflow that relies on subagent delegation is not working as expected\n- You suspect MCP server configuration is wrong but are not sure what tier you are in\n- You want a persistent record of what the current environment can actually do\n\n**What it produces:**\nA `.workrail/config.json` file with the detected mode (`delegate`, `proxy`, or `solo`) and subagent names if discovered. A summary of what capabilities were found.\n\n**How to get good results:**\nRun this workflow before starting complex multi-agent workflows. It takes only two steps and requires no input from you beyond starting it.",
7
+ "examples": [
8
+ "Check if subagent delegation is available in this workspace",
9
+ "Set up WorkRail config for a new project environment",
10
+ "Diagnose why delegation-dependent workflows are falling back to solo mode"
11
+ ],
6
12
  "steps": [
7
13
  {
8
14
  "id": "step-0-probe-capabilities",