@exaudeus/workrail 3.4.0 → 3.5.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.
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"metaGuidance": {
|
|
69
69
|
"type": "array",
|
|
70
|
-
"description": "Persistent
|
|
70
|
+
"description": "Persistent behavioral rules surfaced on start and resume. Not repeated on every step advance. For external document pointers, use 'references' instead.",
|
|
71
71
|
"items": {
|
|
72
72
|
"type": "string",
|
|
73
73
|
"minLength": 1,
|
|
@@ -142,6 +142,14 @@
|
|
|
142
142
|
"$ref": "#/$defs/extensionPoint"
|
|
143
143
|
},
|
|
144
144
|
"uniqueItems": true
|
|
145
|
+
},
|
|
146
|
+
"references": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"description": "Workflow-declared references to external documents. Each reference is a pointer — content is never inlined. Declarations participate in the workflow hash; referenced file content does not.",
|
|
149
|
+
"items": {
|
|
150
|
+
"$ref": "#/$defs/workflowReference"
|
|
151
|
+
},
|
|
152
|
+
"uniqueItems": true
|
|
145
153
|
}
|
|
146
154
|
},
|
|
147
155
|
"required": [
|
|
@@ -189,6 +197,49 @@
|
|
|
189
197
|
"required": ["slotId", "purpose", "default"],
|
|
190
198
|
"additionalProperties": false
|
|
191
199
|
},
|
|
200
|
+
"workflowReference": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"description": "A pointer to an external document relevant to the workflow. Content is never inlined — the agent reads the file itself if needed.",
|
|
203
|
+
"properties": {
|
|
204
|
+
"id": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"description": "Unique identifier within the workflow",
|
|
207
|
+
"pattern": "^[a-z][a-z0-9_-]*$",
|
|
208
|
+
"minLength": 2,
|
|
209
|
+
"maxLength": 64
|
|
210
|
+
},
|
|
211
|
+
"title": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "Human-readable title for the reference",
|
|
214
|
+
"minLength": 1,
|
|
215
|
+
"maxLength": 128
|
|
216
|
+
},
|
|
217
|
+
"source": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"description": "File path relative to workspace root",
|
|
220
|
+
"minLength": 1,
|
|
221
|
+
"maxLength": 512
|
|
222
|
+
},
|
|
223
|
+
"purpose": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"description": "Why this reference matters to the workflow",
|
|
226
|
+
"minLength": 1,
|
|
227
|
+
"maxLength": 512
|
|
228
|
+
},
|
|
229
|
+
"authoritative": {
|
|
230
|
+
"type": "boolean",
|
|
231
|
+
"description": "Whether this document is authoritative (agent should follow it strictly)"
|
|
232
|
+
},
|
|
233
|
+
"resolveFrom": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"enum": ["workspace", "package"],
|
|
236
|
+
"description": "Resolution base for source path. 'workspace' (default) resolves against the user's project root. 'package' resolves against the workrail package root (for files shipped with the workflow).",
|
|
237
|
+
"default": "workspace"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"required": ["id", "title", "source", "purpose", "authoritative"],
|
|
241
|
+
"additionalProperties": false
|
|
242
|
+
},
|
|
192
243
|
"stepId": {
|
|
193
244
|
"type": "string",
|
|
194
245
|
"pattern": "^[a-z0-9-]+$",
|
|
@@ -246,7 +297,13 @@
|
|
|
246
297
|
"functionDefinitions": { "type": "array", "items": { "$ref": "#/$defs/functionDefinition" } },
|
|
247
298
|
"functionCalls": { "type": "array", "items": { "$ref": "#/$defs/functionCall" } },
|
|
248
299
|
"functionReferences": { "type": "array", "items": { "type": "string", "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*\\(\\)$" } },
|
|
249
|
-
"templateCall": { "$ref": "#/$defs/templateCall" }
|
|
300
|
+
"templateCall": { "$ref": "#/$defs/templateCall" },
|
|
301
|
+
"promptFragments": {
|
|
302
|
+
"type": "array",
|
|
303
|
+
"description": "Conditional prompt fragments appended to the step's base prompt at render time. Each fragment is appended in declaration order when its 'when' condition matches the session context.",
|
|
304
|
+
"items": { "$ref": "#/$defs/promptFragment" },
|
|
305
|
+
"minItems": 1
|
|
306
|
+
}
|
|
250
307
|
},
|
|
251
308
|
"required": ["id", "title"],
|
|
252
309
|
"additionalProperties": false
|
|
@@ -471,8 +528,37 @@
|
|
|
471
528
|
"not": {
|
|
472
529
|
"$ref": "#/$defs/condition",
|
|
473
530
|
"description": "Logical NOT of a condition"
|
|
531
|
+
},
|
|
532
|
+
"in": {
|
|
533
|
+
"type": "array",
|
|
534
|
+
"description": "Check if variable value is in this array of allowed values"
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
"additionalProperties": false
|
|
538
|
+
},
|
|
539
|
+
"promptFragment": {
|
|
540
|
+
"type": "object",
|
|
541
|
+
"description": "A conditional prompt fragment appended to a step's base prompt at render time when its condition matches the session context.",
|
|
542
|
+
"properties": {
|
|
543
|
+
"id": {
|
|
544
|
+
"type": "string",
|
|
545
|
+
"description": "Unique identifier for this fragment within the step",
|
|
546
|
+
"minLength": 1,
|
|
547
|
+
"maxLength": 64,
|
|
548
|
+
"pattern": "^[a-z][a-z0-9_-]*$"
|
|
549
|
+
},
|
|
550
|
+
"when": {
|
|
551
|
+
"$ref": "#/$defs/condition",
|
|
552
|
+
"description": "Condition evaluated against session context at render time. If absent, fragment is always appended."
|
|
553
|
+
},
|
|
554
|
+
"text": {
|
|
555
|
+
"type": "string",
|
|
556
|
+
"description": "Prompt text appended when the condition matches. Must not contain {{wr.*}} tokens.",
|
|
557
|
+
"minLength": 1,
|
|
558
|
+
"maxLength": 4096
|
|
474
559
|
}
|
|
475
560
|
},
|
|
561
|
+
"required": ["id", "text"],
|
|
476
562
|
"additionalProperties": false
|
|
477
563
|
},
|
|
478
564
|
"confirmationRule": {
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "cross-platform-code-conversion",
|
|
3
|
+
"name": "Cross-Platform Code Conversion",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Guides an agent through converting code from one platform to another (e.g., Android to iOS, iOS to Web). Triages files by difficulty, delegates easy literal translations to parallel subagents, then the main agent tackles platform-specific code requiring design decisions.",
|
|
6
|
+
"recommendedPreferences": {
|
|
7
|
+
"recommendedAutonomy": "guided",
|
|
8
|
+
"recommendedRiskPolicy": "conservative"
|
|
9
|
+
},
|
|
10
|
+
"features": [
|
|
11
|
+
"wr.features.subagent_guidance",
|
|
12
|
+
"wr.features.memory_context"
|
|
13
|
+
],
|
|
14
|
+
"preconditions": [
|
|
15
|
+
"User specifies source and target platforms.",
|
|
16
|
+
"Agent has read access to the source codebase.",
|
|
17
|
+
"Agent has write access to create target-platform files.",
|
|
18
|
+
"Agent can run build or typecheck tools for the target platform."
|
|
19
|
+
],
|
|
20
|
+
"metaGuidance": [
|
|
21
|
+
"IDIOMATIC CONVERSION: translate patterns and idioms, not syntax. A Kotlin sealed class becomes a Swift enum with associated values, not a class hierarchy workaround.",
|
|
22
|
+
"SCOPE DISCIPLINE: convert only what the user scoped. Do not expand to adjacent features or modules unless explicitly asked.",
|
|
23
|
+
"DEPENDENCY MAPPING: never assume a library exists on the target platform. Map each dependency to its target equivalent or flag it as needing a custom solution.",
|
|
24
|
+
"PLATFORM CONVENTIONS: follow the target platform's conventions for project structure, naming, error handling, concurrency, and testing.",
|
|
25
|
+
"BUILD PROOF: code that does not build is not done. Run build or typecheck after every conversion batch.",
|
|
26
|
+
"PRESERVE INTENT: the goal is functional equivalence, not line-by-line correspondence. Restructure when the target platform has a better way.",
|
|
27
|
+
"TRIAGE FIRST: not all code is equal. Separate trivial translations from code needing real design decisions. Delegate the easy stuff, focus on the hard stuff.",
|
|
28
|
+
"TARGET REPO DISCOVERY: find the target repo yourself before asking. Check workspace roots, sibling dirs, monorepo modules, and agent config files first.",
|
|
29
|
+
"PERSIST REPO MAPPINGS: once a target repo is confirmed, offer to save the source-to-target mapping in the source repo's agent config so future runs skip discovery.",
|
|
30
|
+
"DRIFT DETECTION: if a file turns out harder than its bucket classification during conversion, stop and reclassify it. Do not silently absorb complexity."
|
|
31
|
+
],
|
|
32
|
+
"steps": [
|
|
33
|
+
{
|
|
34
|
+
"id": "phase-0-scope",
|
|
35
|
+
"title": "Phase 0: Scope & Platform Analysis",
|
|
36
|
+
"prompt": "Understand what you're converting before you touch anything.\n\nFigure out:\n- What is being converted? (single file, module, feature, full component, entire app)\n- What is the source platform? (Android/Kotlin, iOS/Swift, Web/React, etc.)\n- What is the target platform?\n- How large is the conversion scope? (file count, rough LOC)\n- Where does the converted code go? Find the target repo yourself before asking the user.\n\nIf the user hasn't specified scope boundaries, ask. Don't guess at scope.\n\nThen classify the conversion:\n- `conversionComplexity`: Small (1-3 files, straightforward translation) / Medium (a module or feature, mixed difficulty) / Large (many modules, significant platform-specific code)\n\nUse this guidance:\n- Small: few files, mostly mechanical, low risk of idiom mismatch\n- Medium: a module or feature with some platform-specific code mixed in\n- Large: many files, deep platform coupling, multiple idiom mapping decisions\n\nCapture:\n- `sourcePlatform`\n- `targetPlatform`\n- `conversionScope`\n- `targetRepoPath`\n- `estimatedSize`\n- `conversionComplexity`",
|
|
37
|
+
"requireConfirmation": {
|
|
38
|
+
"var": "conversionComplexity",
|
|
39
|
+
"not_equals": "Small"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "phase-1-understand-source",
|
|
44
|
+
"title": "Phase 1: Understand Source Code",
|
|
45
|
+
"prompt": "Read and analyze the source code through a conversion lens — what will be easy to convert, what will be hard, and why.\n\nMap out:\n- Architecture and module structure\n- Key patterns used (MVI, MVVM, dependency injection, etc.)\n- External dependencies and what they do\n- Entry points and public API surface\n- Platform coupling depth: is the code cleanly layered or is platform-specific code smeared throughout? This directly determines how much falls into easy vs. hard buckets.\n- Concurrency model: Coroutines, Combine, RxJS, async/await? This is often the single hardest mapping decision.\n- DI approach: Dagger/Hilt, Swinject, Koin? DI frameworks rarely map 1:1.\n- Test coverage shape: unit tests on business logic (convert easily), UI tests (likely rewrite), integration tests (depends on infra).\n- Shared code boundaries: is there already a shared/common module that might not need conversion at all?\n\nCapture:\n- `sourceArchitecture`\n- `dependencies`\n- `publicApiSurface`\n- `platformCouplingAssessment`\n- `concurrencyModel`\n- `testCoverageShape`",
|
|
46
|
+
"promptFragments": [
|
|
47
|
+
{
|
|
48
|
+
"id": "phase-1-small-light",
|
|
49
|
+
"when": { "var": "conversionComplexity", "equals": "Small" },
|
|
50
|
+
"text": "For Small conversions, keep this lightweight. A quick read of the files in scope is enough — don't map the entire architecture. Focus on identifying any platform-specific code that would prevent a straight translation."
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"requireConfirmation": false
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "phase-small-fast-path",
|
|
57
|
+
"title": "Small Conversion Fast Path",
|
|
58
|
+
"runCondition": {
|
|
59
|
+
"var": "conversionComplexity",
|
|
60
|
+
"equals": "Small"
|
|
61
|
+
},
|
|
62
|
+
"prompt": "For Small conversions, skip triage and planning — just convert.\n\n- Translate the files to the target platform idiomatically\n- Follow target platform naming and structure conventions\n- Map any dependencies to target equivalents\n- Convert tests if they exist\n- Run build or typecheck to verify\n\nIf something turns out harder than expected (deep platform coupling, no clean dependency equivalent), update `conversionComplexity` to `Medium` and stop. The full triage and planning pipeline will activate for the remaining work.\n\nCapture:\n- `filesConverted`\n- `buildPassed`\n- `conversionComplexity`",
|
|
63
|
+
"requireConfirmation": false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "phase-2-triage",
|
|
67
|
+
"title": "Phase 2: Triage & Sort",
|
|
68
|
+
"runCondition": {
|
|
69
|
+
"var": "conversionComplexity",
|
|
70
|
+
"not_equals": "Small"
|
|
71
|
+
},
|
|
72
|
+
"prompt": "Classify every file or module in scope into one of three buckets:\n\n**Bucket A — Literal translation**: Platform-agnostic business logic, data models, utilities, pure functions. These use no platform-specific APIs or libraries. Conversion is mechanical: translate the language syntax, follow target naming conventions, done. These will be delegated to subagents.\n\n**Bucket B — Library substitution**: Code that uses platform-specific libraries (networking, persistence, serialization, DI) but follows standard patterns. These need dependency mapping but the structure stays the same.\n\n**Bucket C — Platform-specific**: Code deeply tied to the platform (UI layer, lifecycle management, concurrency/threading, navigation, platform APIs). These need design decisions about target-platform idioms.\n\nFor each file or module, list:\n- File/module name\n- Bucket (A, B, or C)\n- One-line reason for classification\n- Dependencies it has on other files in scope (so we know conversion order)\n\nSort the work items within each bucket by dependency order (convert dependencies first).\n\nGroup Bucket A files into parallel batches of 3-5 files each. Each batch should contain files with no cross-dependencies so subagents can work independently.\n\nGroup Bucket B and C files into sequential batches by dependency order.\n\nEach batch should have: `name` (short label), `bucket` (A, B, or C), and `files` (list of file paths).\n\nCapture:\n- `bucketABatches` (parallel batches for subagent delegation)\n- `bucketBCBatches` (sequential batches for main agent)\n- `bucketACounts`\n- `bucketBCounts`\n- `bucketCCounts`",
|
|
73
|
+
"requireConfirmation": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "phase-3-plan-hard-items",
|
|
77
|
+
"title": "Phase 3: Plan Platform-Specific Conversions",
|
|
78
|
+
"runCondition": {
|
|
79
|
+
"var": "conversionComplexity",
|
|
80
|
+
"not_equals": "Small"
|
|
81
|
+
},
|
|
82
|
+
"prompt": "For Bucket B and Bucket C items, plan the conversion before writing code.\n\nFor Bucket B (library substitution):\n- Map each source dependency to its target-platform equivalent\n- If no equivalent exists, flag it and propose an alternative\n\nFor Bucket C (platform-specific):\n- Threading/concurrency model mapping\n- UI framework mapping\n- DI framework mapping\n- State management mapping\n- Error handling mapping\n- Navigation patterns\n- Lifecycle management approach\n- Testing framework mapping\n\nFor anything with no clean target equivalent, propose an idiomatic solution and explain the tradeoff.\n\nBucket A items don't need a plan. They're mechanical translation handled by subagents.\n\nCapture:\n- `idiomMapping`\n- `dependencyMapping`\n- `tradeoffs`",
|
|
83
|
+
"promptFragments": [
|
|
84
|
+
{
|
|
85
|
+
"id": "phase-3-medium-focused",
|
|
86
|
+
"when": { "var": "conversionComplexity", "equals": "Medium" },
|
|
87
|
+
"text": "For Medium conversions, focus the plan on the items that actually need design decisions. Don't exhaustively map every dimension — only the ones relevant to the files in scope."
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"requireConfirmation": true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "phase-4-delegate-bucket-a",
|
|
94
|
+
"title": "Phase 4: Delegate Bucket A (Parallel Subagents)",
|
|
95
|
+
"runCondition": {
|
|
96
|
+
"and": [
|
|
97
|
+
{ "var": "conversionComplexity", "not_equals": "Small" },
|
|
98
|
+
{ "var": "bucketACounts", "not_equals": 0 }
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"prompt": "Delegate all Bucket A batches to subagents in parallel. If subagent delegation is not available in your environment, convert Bucket A files yourself sequentially — they're mechanical translations.\n\nFor each batch in `bucketABatches`, spawn a subagent with these instructions:\n- Source platform: `{{sourcePlatform}}`\n- Target platform: `{{targetPlatform}}`\n- Target repo: `{{targetRepoPath}}`\n- Files to convert: (list the specific files in this batch)\n- Task: translate these files from the source language to the target language. Follow target platform naming conventions. These are platform-agnostic files — no library substitution or idiom mapping needed. Preserve the public API. Convert tests if they exist.\n\nRun batches in parallel. Each subagent works independently on files with no cross-dependencies.\n\nWhen all subagents finish, review their output:\n- Spot-check a few converted files for quality\n- Flag any files a subagent misclassified as easy (actually needs library substitution or platform-specific handling)\n- Move misclassified files back to the appropriate bucket for main agent handling\n\nRun build or typecheck on the Bucket A output to catch issues early.\n\nCapture:\n- `bucketAComplete`\n- `bucketABuildPassed`\n- `reclassifiedFiles`",
|
|
102
|
+
"requireConfirmation": false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "phase-5-convert-hard",
|
|
106
|
+
"type": "loop",
|
|
107
|
+
"title": "Phase 5: Convert Bucket B & C (Main Agent)",
|
|
108
|
+
"runCondition": {
|
|
109
|
+
"var": "conversionComplexity",
|
|
110
|
+
"not_equals": "Small"
|
|
111
|
+
},
|
|
112
|
+
"loop": {
|
|
113
|
+
"type": "forEach",
|
|
114
|
+
"items": "bucketBCBatches",
|
|
115
|
+
"itemVar": "currentBatch",
|
|
116
|
+
"indexVar": "batchIndex",
|
|
117
|
+
"maxIterations": 30
|
|
118
|
+
},
|
|
119
|
+
"body": [
|
|
120
|
+
{
|
|
121
|
+
"id": "phase-5a-convert-batch",
|
|
122
|
+
"title": "Convert Current Batch",
|
|
123
|
+
"prompt": "Convert the current batch: `{{currentBatch.name}}`\n\nThis is Bucket B or C code that needs your full context.\n\n- **Bucket B**: Follow the dependency mapping from Phase 3. Substitute libraries, keep structure.\n- **Bucket C**: Follow the idiom mapping from Phase 3. Restructure where the target platform has a better way.\n\nAlso handle any `reclassifiedFiles` that were moved back from Bucket A delegation.\n\nFor all files:\n- Follow target platform conventions\n- Preserve public API contracts where possible\n- Add TODO comments for anything uncertain\n- Convert tests alongside production code when source tests exist\n\nRun build or typecheck after this batch. If it fails, fix it before moving on.\n\nTrack whether this batch required:\n- `bucketDriftDetected`: a file turned out to be harder than its bucket classification (e.g., Bucket B file needed Bucket C-level design decisions)\n- `unexpectedDependency`: a dependency was discovered that wasn't in the Phase 3 mapping\n- `buildBroke`: build or typecheck failed after this batch\n\nCapture:\n- `batchFilesConverted`\n- `batchBuildPassed`\n- `batchIssues`\n- `bucketDriftDetected`\n- `unexpectedDependency`\n- `buildBroke`",
|
|
124
|
+
"requireConfirmation": false
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "phase-5b-verify-batch",
|
|
128
|
+
"title": "Verify Batch",
|
|
129
|
+
"runCondition": {
|
|
130
|
+
"or": [
|
|
131
|
+
{ "var": "bucketDriftDetected", "equals": true },
|
|
132
|
+
{ "var": "unexpectedDependency", "equals": true },
|
|
133
|
+
{ "var": "buildBroke", "equals": true }
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"prompt": "Something unexpected happened in this batch. Before moving on, check what went wrong.\n\nIf `bucketDriftDetected`: the file was harder than classified. Update the idiom or dependency mapping from Phase 3 so downstream batches don't hit the same surprise. Record what changed.\n\nIf `unexpectedDependency`: a dependency wasn't in the Phase 3 plan. Map it now and check whether other batches depend on the same thing.\n\nIf `buildBroke`: diagnose whether the failure is local to this batch or a cross-batch integration issue. Fix it before continuing.\n\nIf the drift is severe enough that the Phase 3 plan is unreliable, say so. Don't silently absorb complexity.\n\nCapture:\n- `mappingUpdated`\n- `verificationPassed`",
|
|
137
|
+
"requireConfirmation": {
|
|
138
|
+
"var": "bucketDriftDetected",
|
|
139
|
+
"equals": true
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "phase-6-verify",
|
|
146
|
+
"type": "loop",
|
|
147
|
+
"title": "Phase 6: Final Verification",
|
|
148
|
+
"runCondition": {
|
|
149
|
+
"var": "conversionComplexity",
|
|
150
|
+
"not_equals": "Small"
|
|
151
|
+
},
|
|
152
|
+
"loop": {
|
|
153
|
+
"type": "while",
|
|
154
|
+
"conditionSource": {
|
|
155
|
+
"kind": "artifact_contract",
|
|
156
|
+
"contractRef": "wr.contracts.loop_control",
|
|
157
|
+
"loopId": "final_verification_loop"
|
|
158
|
+
},
|
|
159
|
+
"maxIterations": 3
|
|
160
|
+
},
|
|
161
|
+
"body": [
|
|
162
|
+
{
|
|
163
|
+
"id": "phase-6a-full-build",
|
|
164
|
+
"title": "Full Build and Integration Check",
|
|
165
|
+
"prompt": "Run a full build or typecheck on the entire converted codebase — both subagent-converted and main-agent-converted code together.\n\nCheck for:\n- Build/compile errors from cross-batch integration issues\n- Inconsistencies between subagent output and main agent output (naming, patterns)\n- Non-idiomatic patterns that slipped through\n- Missing error handling at module boundaries\n- Threading or concurrency issues across modules\n- Broken public API contracts\n\nFix each issue. If a fix is a band-aid over a deeper mapping problem, go back and fix the mapping.\n\nCapture:\n- `fullBuildPassed`\n- `integrationIssues`\n- `issuesFixed`",
|
|
166
|
+
"requireConfirmation": false
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"id": "phase-6b-loop-decision",
|
|
170
|
+
"title": "Verification Loop Decision",
|
|
171
|
+
"prompt": "Decide whether verification needs another pass.\n\n- If the build fails or critical integration issues remain: continue.\n- If the build passes and remaining issues are minor: stop.\n- If you've hit the iteration limit: stop and record what remains.\n\nEmit the loop-control artifact:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue or stop\"\n }]\n}\n```",
|
|
172
|
+
"requireConfirmation": false,
|
|
173
|
+
"outputContract": {
|
|
174
|
+
"contractRef": "wr.contracts.loop_control"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"id": "phase-7-handoff",
|
|
181
|
+
"title": "Phase 7: Handoff",
|
|
182
|
+
"prompt": "Summarize what was converted.\n\nInclude:\n- Source and target platforms\n- Total files converted\n- Build/typecheck status\n- Known gaps, TODOs, or limitations\n- What would need manual attention\n\nKeep it concise. The converted code is the deliverable.",
|
|
183
|
+
"promptFragments": [
|
|
184
|
+
{
|
|
185
|
+
"id": "phase-7-small-summary",
|
|
186
|
+
"when": { "var": "conversionComplexity", "equals": "Small" },
|
|
187
|
+
"text": "For Small conversions, keep the summary brief — just list what was converted, build status, and any issues."
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"id": "phase-7-full-summary",
|
|
191
|
+
"when": { "var": "conversionComplexity", "not_equals": "Small" },
|
|
192
|
+
"text": "Also include: bucket breakdown (A/B/C counts), delegation results (how many files delegated, subagent quality, any reclassified), key idiom mapping decisions, and dependency substitutions."
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"notesOptional": true,
|
|
196
|
+
"requireConfirmation": false
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "routine-parallel-work-partitioning",
|
|
3
|
+
"name": "Parallel Work Partitioning Routine",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Analyzes a set of work items and their dependencies, partitions them into independent batches that can be safely parallelized across subagents, and produces a sorted execution plan. Flags items with cross-dependencies for sequential handling by the main agent.",
|
|
6
|
+
"metaGuidance": [
|
|
7
|
+
"INDEPENDENCE IS THE PRIORITY: a batch is only parallel-safe if no item in it depends on any other item in any concurrent batch.",
|
|
8
|
+
"CONSERVATIVE CLASSIFICATION: when dependency is unclear, classify as sequential. Wrong parallelization is worse than missed parallelization.",
|
|
9
|
+
"MAIN AGENT OWNS HARD WORK: items needing judgment, design decisions, or cross-cutting context belong to the main agent, not subagents."
|
|
10
|
+
],
|
|
11
|
+
"steps": [
|
|
12
|
+
{
|
|
13
|
+
"id": "step-inventory",
|
|
14
|
+
"title": "Step 1: Inventory Work Items",
|
|
15
|
+
"prompt": "List every work item in scope.\n\nFor each item, capture:\n- Item identifier (file path, module name, test case, doc section, etc.)\n- One-line description of what needs to be done\n- Estimated complexity: trivial / moderate / complex\n- Whether it requires judgment or design decisions (yes/no)\n\nDon't classify or sort yet. Just get the full inventory.\n\nCapture:\n- `workItems` (the full list)\n- `totalCount`",
|
|
16
|
+
"requireConfirmation": false
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "step-dependency-map",
|
|
20
|
+
"title": "Step 2: Map Dependencies",
|
|
21
|
+
"prompt": "For each work item, identify its dependencies on other items in the inventory.\n\nA dependency exists when:\n- Item B imports, references, or extends something in Item A\n- Item B's output format or API is consumed by Item A\n- Item B cannot be correctly completed without Item A being done first\n- Item B shares mutable state, configuration, or resources with Item A\n\nA dependency does NOT exist just because:\n- Items are in the same module or directory\n- Items use the same library or framework\n- Items are conceptually related but structurally independent\n\nProduce a dependency map: for each item, list which other items it depends on (if any). Items with no dependencies on other in-scope items are roots.\n\nCapture:\n- `dependencyMap`\n- `rootItems` (items with no in-scope dependencies)\n- `crossCuttingItems` (items that many others depend on)",
|
|
22
|
+
"requireConfirmation": false
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "step-classify",
|
|
26
|
+
"title": "Step 3: Classify Parallel vs. Sequential",
|
|
27
|
+
"prompt": "Classify each work item into one of two tracks:\n\n**Parallel track** — can be delegated to a subagent. ALL of these must be true:\n- No unresolved dependencies on other in-scope items (or all dependencies are already completed/in an earlier batch)\n- Trivial or moderate complexity\n- Does NOT require judgment, design decisions, or cross-cutting context\n- Can be verified independently (build, test, or review in isolation)\n- Failure is cheap to fix (a bad result can be caught and redone)\n\n**Sequential track** — must be handled by the main agent. ANY of these makes it sequential:\n- Has dependencies on items that haven't been completed yet\n- Complex or requires design decisions\n- Touches cross-cutting concerns (shared state, configuration, APIs used by many items)\n- Needs context from other items to be done correctly\n- Failure is expensive (wrong output cascades to other items)\n\nWhen in doubt, classify as sequential.\n\nCapture:\n- `parallelItems`\n- `sequentialItems`\n- `classificationRationale` (one line per item explaining the decision)",
|
|
28
|
+
"requireConfirmation": false
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "step-batch",
|
|
32
|
+
"title": "Step 4: Form Parallel Batches",
|
|
33
|
+
"prompt": "Group parallel-track items into batches that can run concurrently.\n\nBatching rules:\n- No two items in the same batch should depend on each other\n- No two items in the same batch should write to the same file or resource\n- Keep batches between 3-5 items for manageable subagent scope\n- Items that share a common dependency should be in the same batch or in batches that run after that dependency is resolved\n- Prefer grouping items by similarity (same file type, same kind of work) so each subagent gets coherent instructions\n\nAlso sort sequential-track items by dependency order (dependencies first).\n\nCapture:\n- `parallelBatches` (array of batches, each with item list and subagent instructions summary)\n- `sequentialOrder` (sorted list of sequential items)\n- `executionPlan` (the full plan: which parallel batches run first, then which sequential items, noting any sync points)",
|
|
34
|
+
"requireConfirmation": false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "step-plan-delivery",
|
|
38
|
+
"title": "Step 5: Produce Execution Plan",
|
|
39
|
+
"prompt": "Write the final execution plan as a structured artifact in {deliverableName}.\n\nStructure:\n\n```markdown\n# Parallel Work Partitioning Plan\n\n## Summary\n- Total items: [count]\n- Parallel track: [count] items in [N] batches\n- Sequential track: [count] items\n- Cross-cutting items: [list]\n\n## Execution Order\n\n### Wave 1: Parallel Batches (delegate to subagents)\n\n#### Batch 1: [theme/description]\n- [item]: [one-line task]\n- [item]: [one-line task]\n**Subagent instructions**: [what the subagent needs to know]\n\n#### Batch 2: ...\n\n### Wave 2: Sequential Items (main agent)\n1. [item]: [one-line task] — depends on: [items]\n2. [item]: [one-line task] — depends on: [items]\n\n## Dependency Graph\n[Compact representation of which items depend on which]\n\n## Risk Notes\n- [Any items where classification was uncertain]\n- [Any sync points where parallel work must complete before sequential work starts]\n```\n\nCapture:\n- `planDelivered`",
|
|
40
|
+
"requireConfirmation": false
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "workflow-for-workflows",
|
|
3
|
+
"name": "Workflow Authoring Workflow (Lean, References-First)",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"description": "Guides an agent through creating a new WorkRail workflow: understand the task, choose the shape, draft the JSON, validate with real validators, review the method, and optionally refine.",
|
|
6
|
+
"recommendedPreferences": {
|
|
7
|
+
"recommendedAutonomy": "guided",
|
|
8
|
+
"recommendedRiskPolicy": "conservative"
|
|
9
|
+
},
|
|
10
|
+
"preconditions": [
|
|
11
|
+
"User has a recurring task or problem the new workflow should solve.",
|
|
12
|
+
"Agent has access to file creation, editing, and terminal tools.",
|
|
13
|
+
"Agent can run workflow validators (npm run validate:registry or equivalent)."
|
|
14
|
+
],
|
|
15
|
+
"metaGuidance": [
|
|
16
|
+
"REFERENCE HIERARCHY: treat workflow-schema as legal truth for structure. Treat authoring-spec as canonical current guidance for what makes a workflow good. Treat authoring-provenance as optional maintainer context only.",
|
|
17
|
+
"META DISTINCTION: you are creating a workflow, not executing one. Keep the authored workflow's concerns separate from this meta-workflow's execution.",
|
|
18
|
+
"DEFAULT BEHAVIOR: self-execute with tools. Only ask the user for business decisions about the workflow being created, not things you can learn from the schema, authoring spec, or example workflows.",
|
|
19
|
+
"AUTHORED VOICE: prompts in the created workflow must be user-voiced. No middleware narration, no pseudo-DSL, no tutorial framing, no teaching-product language.",
|
|
20
|
+
"VOICE ADAPTATION: the lean coding workflow is one voice example, not the universal template. Adapt vocabulary and tone to the created workflow's domain.",
|
|
21
|
+
"VOICE EXAMPLES: Coding: 'Review the changes in this MR.' Ops: 'Check whether the pipeline is healthy.' Content: 'Read the draft and check the argument.' NOT: 'The system will now perform a comprehensive analysis of...'",
|
|
22
|
+
"VALIDATION GATE: validate with real validators, not regex approximations. When validator output and authoring assumptions conflict, runtime wins.",
|
|
23
|
+
"ARTIFACT STRATEGY: the workflow JSON file is the primary output. Intermediate notes go in output.notesMarkdown. Do not create extra planning artifacts unless the workflow is genuinely complex.",
|
|
24
|
+
"V2 DURABILITY: use output.notesMarkdown as the primary durable record. Do not mirror execution state into CONTEXT.md or markdown checkpoint files.",
|
|
25
|
+
"ANTI-PATTERNS TO AVOID IN CREATED WORKFLOWS: no pseudo-function metaGuidance, no learning-path branching, no satisfaction-score loops, no heavy clarification batteries, no regex-as-primary-validation, no celebration phases.",
|
|
26
|
+
"NEVER COMMIT MARKDOWN FILES UNLESS USER EXPLICITLY ASKS."
|
|
27
|
+
],
|
|
28
|
+
"references": [
|
|
29
|
+
{
|
|
30
|
+
"id": "workflow-schema",
|
|
31
|
+
"title": "Workflow JSON Schema",
|
|
32
|
+
"source": "spec/workflow.schema.json",
|
|
33
|
+
"resolveFrom": "package",
|
|
34
|
+
"purpose": "Canonical schema for validating structure and field semantics while authoring workflows. This is legal truth.",
|
|
35
|
+
"authoritative": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "authoring-spec",
|
|
39
|
+
"title": "Workflow Authoring Specification",
|
|
40
|
+
"source": "spec/authoring-spec.json",
|
|
41
|
+
"resolveFrom": "package",
|
|
42
|
+
"purpose": "Canonical authoring guidance, rule levels, and examples for composing workflows correctly. This is current authoring truth.",
|
|
43
|
+
"authoritative": true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "authoring-provenance",
|
|
47
|
+
"title": "Workflow Authoring Provenance",
|
|
48
|
+
"source": "spec/authoring-spec.provenance.json",
|
|
49
|
+
"resolveFrom": "package",
|
|
50
|
+
"purpose": "Source-of-truth map showing what is canonical, derived, and non-canonical in workflow authoring guidance. Optional maintainer context.",
|
|
51
|
+
"authoritative": false
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "lean-coding-workflow",
|
|
55
|
+
"title": "Lean Coding Workflow (Modern Example)",
|
|
56
|
+
"source": "workflows/coding-task-workflow-agentic.lean.v2.json",
|
|
57
|
+
"resolveFrom": "package",
|
|
58
|
+
"purpose": "Current modern example of a well-authored workflow. Inspect for patterns, voice, loop semantics, prompt fragments, and delegation policy.",
|
|
59
|
+
"authoritative": false
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"steps": [
|
|
63
|
+
{
|
|
64
|
+
"id": "phase-0-understand",
|
|
65
|
+
"title": "Phase 0: Understand the Workflow to Create",
|
|
66
|
+
"prompt": "Before you write anything, understand what you're building.\n\nStart by reading:\n- `workflow-schema` reference (legal structure)\n- `authoring-spec` reference (what makes a workflow good)\n- `lean-coding-workflow` reference (modern example to inspect)\n\nThen understand the task from the user:\n- What recurring task or problem does this workflow solve?\n- Who runs it and how often?\n- What does success look like?\n- What constraints exist (tools, permissions, domain rules)?\n\nExplore first. Use tools to understand the domain if it involves code or a repo. Ask the user only what you genuinely cannot figure out yourself.\n\nThen classify:\n- `workflowComplexity`: Simple (linear, few steps) / Medium (branches, loops, or moderate step count) / Complex (multiple loops, delegation, extension points, many steps)\n- `rigorMode`: QUICK (simple linear workflow, low risk) / STANDARD (moderate complexity or domain risk) / THOROUGH (complex architecture, high stakes, needs review loops)\n\nCapture:\n- `workflowComplexity`\n- `rigorMode`\n- `taskDescription`\n- `intendedAudience`\n- `successCriteria`\n- `domainConstraints`\n- `openQuestions` (only real questions that need user input)",
|
|
67
|
+
"requireConfirmation": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "phase-1-shape",
|
|
71
|
+
"title": "Phase 1: Choose the Workflow Shape",
|
|
72
|
+
"runCondition": {
|
|
73
|
+
"var": "workflowComplexity",
|
|
74
|
+
"not_equals": "Simple"
|
|
75
|
+
},
|
|
76
|
+
"prompt": "Decide the architecture before you write JSON.\n\nBased on what you learned in Phase 0, decide:\n\n1. **Step structure**: how many phases, what each one does, what order\n2. **Loops**: does any phase need iteration? If so, what are the exit rules and max iterations?\n\nLoop design heuristics:\n- Add a loop ONLY when: (a) a quality gate may fail on first pass (validation, review), (b) each pass adds measurable value (progressive refinement), or (c) external feedback requires re-execution.\n- Do NOT loop when: (a) the agent can get it right in one pass with sufficient context, or (b) the full workflow is cheap enough to re-run entirely.\n- Every loop needs: an explicit exit condition (not vibes), a bounded maxIterations, and a decision step with outputContract.\n- Sensible defaults: validation ≈ 2-3, review/refinement ≈ 2, user-feedback ≈ 2-3 with confirmation gate. Go higher only with explicit justification in your notes.\n3. **Confirmation gates**: where does the user genuinely need to approve before proceeding? Don't add confirmations as ceremony.\n4. **Delegation**: does any step benefit from subagent routines? If so, which ones and why? Keep delegation bounded.\n5. **Prompt composition**: will any steps need promptFragments for rigor-mode branching? Will any steps share enough structure to use templates?\n6. **Extension points**: are there customizable slots that projects might want to override (e.g., a verification routine, a review routine)?\n7. **References**: should the created workflow declare its own references to external docs?\n8. **Artifacts**: what does each step produce? Which artifact is canonical for which concern?\n9. **metaGuidance**: what persistent behavioral rules should the agent see on start and resume?\n\nWrite the shape as a structured outline in your notes. Include:\n- Phase list with titles and one-line goals\n- Which phases loop and why\n- Which phases have confirmation gates and why\n- Context variables that flow between phases\n- Artifact ownership (which artifact is canonical for what)\n\nDon't write JSON yet.\n\nCapture:\n- `workflowOutline`\n- `loopDesign`\n- `confirmationDesign`\n- `delegationDesign`\n- `artifactPlan`\n- `contextModel` (the context variables the workflow will use and where they're set)\n- `voiceStrategy` (domain vocabulary, authority posture: directive/collaborative/supervisory, density calibration)",
|
|
77
|
+
"requireConfirmation": {
|
|
78
|
+
"or": [
|
|
79
|
+
{ "var": "workflowComplexity", "not_equals": "Simple" },
|
|
80
|
+
{ "var": "rigorMode", "not_equals": "QUICK" }
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "phase-2-draft",
|
|
86
|
+
"title": "Phase 2: Draft the Workflow",
|
|
87
|
+
"prompt": "Write the workflow JSON file.\n\nUse the outline from Phase 1 and write the best first draft you can. Phase 3 will catch structural issues, so focus on getting the shape and voice right. Follow these rules:\n\n1. The schema (`workflow-schema` reference) defines what is structurally legal. Do not invent fields.\n2. The authoring spec (`authoring-spec` reference) defines what is good. Follow its active rules.\n3. Write prompts in the user's voice. The opening sentence of each step should sound like a direct ask, not system narration.\n4. Calibrate prompt density to the step's needs. Not all steps need the same level of detail:\n - Sparse (expert audience, clear task): direct ask + capture footer only.\n - Focused (expert audience, ambiguous task): direct ask + key criteria or trade-offs + capture.\n - Guided (broad audience, clear task): direct ask + enumerated sub-steps + capture.\n - Scaffolded (broad audience, ambiguous task): direct ask + context frame + sub-steps + heuristic + capture.\n Default to Focused if unsure. Vary density across steps -- uniform density is a smell.\n5. Keep protocol requirements explicit. If a step must emit a specific artifact or capture specific context, say that plainly.\n6. Use promptFragments for conditional rigor-mode branches instead of duplicating entire steps.\n7. Loop decision steps must use `outputContract` with `wr.contracts.loop_control` and allow both `continue` and `stop` in the output example.\n8. Loops must have explicit exit rules, bounded maxIterations, and a clear reason for another pass.\n9. Confirmation gates are for real human decisions, not routine ceremony.\n10. metaGuidance should be clean behavioral rules, not pseudo-functions or teaching prose.\n11. Do not use regex validationCriteria as the primary quality gate. Use real validators.\n\nAsk the user what filename to use if they haven't specified one.\n\nWrite the file. Do not explain the JSON back to the user field by field.\n\nCapture:\n- `workflowFilePath`\n- `draftComplete`",
|
|
88
|
+
"promptFragments": [
|
|
89
|
+
{
|
|
90
|
+
"id": "phase-2-simple-fast",
|
|
91
|
+
"when": { "var": "workflowComplexity", "equals": "Simple" },
|
|
92
|
+
"text": "No shape outline exists for Simple workflows -- Phase 1 was skipped. Decide the step list now and draft directly. Keep it linear, 3-5 steps, no loops unless the task genuinely needs iteration. metaGuidance is optional for Simple workflows."
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"requireConfirmation": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "phase-3-validate",
|
|
99
|
+
"type": "loop",
|
|
100
|
+
"title": "Phase 3: Validate and Fix",
|
|
101
|
+
"loop": {
|
|
102
|
+
"type": "while",
|
|
103
|
+
"conditionSource": {
|
|
104
|
+
"kind": "artifact_contract",
|
|
105
|
+
"contractRef": "wr.contracts.loop_control",
|
|
106
|
+
"loopId": "validation_loop"
|
|
107
|
+
},
|
|
108
|
+
"maxIterations": 3
|
|
109
|
+
},
|
|
110
|
+
"body": [
|
|
111
|
+
{
|
|
112
|
+
"id": "phase-3a-run-validation",
|
|
113
|
+
"title": "Run Validation",
|
|
114
|
+
"prompt": "Run the real workflow validators against the drafted workflow.\n\nUse the available validation tools or commands (e.g., `npm run validate:registry`, schema validation, or the MCP validation surface). Do not rely on reading the JSON and eyeballing it.\n\nIf validation passes cleanly, say so and move to the loop decision.\n\nIf validation fails:\n1. List the actual errors.\n2. Fix each one in the workflow file.\n3. Re-run validation to confirm the fixes worked.\n\nIf the validator reports something that conflicts with your authoring assumptions, the validator (runtime) wins. Update your understanding.\n\nCapture:\n- `validationErrors`\n- `validationPassed`",
|
|
115
|
+
"promptFragments": [
|
|
116
|
+
{
|
|
117
|
+
"id": "phase-3a-thorough",
|
|
118
|
+
"when": { "var": "rigorMode", "equals": "THOROUGH" },
|
|
119
|
+
"text": "After fixing structural errors, also check the workflow against the authoring spec rules manually. Score each active required-level rule as pass/fail and fix any failures before moving on."
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"requireConfirmation": false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "phase-3b-loop-decision",
|
|
126
|
+
"title": "Validation Loop Decision",
|
|
127
|
+
"prompt": "Decide whether validation needs another pass.\n\n- If all errors are fixed and validation passes: stop.\n- If you fixed errors but haven't re-validated yet: continue.\n- If you've hit the iteration limit: stop and record what remains.\n\nEmit the loop-control artifact in this shape (`decision` must be `continue` or `stop`):\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue or stop\"\n }]\n}\n```",
|
|
128
|
+
"requireConfirmation": false,
|
|
129
|
+
"outputContract": {
|
|
130
|
+
"contractRef": "wr.contracts.loop_control"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "phase-3-escalation",
|
|
137
|
+
"title": "Validation Escalation",
|
|
138
|
+
"runCondition": {
|
|
139
|
+
"var": "validationPassed",
|
|
140
|
+
"equals": false
|
|
141
|
+
},
|
|
142
|
+
"prompt": "Validation did not pass after the maximum number of attempts.\n\nCheck whether the last validation run actually passed. If `validationPassed` is false or if you're uncertain, list the remaining errors and your assessment of their severity.\n\nThen present the options:\n1. Proceed with known issues documented in handoff notes.\n2. Stop workflow creation here so the user can intervene manually.\n\nDo not silently continue with a broken workflow.",
|
|
143
|
+
"requireConfirmation": true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "phase-4-review",
|
|
147
|
+
"title": "Phase 4: Method Review",
|
|
148
|
+
"prompt": "The workflow is valid. Now check whether it's actually good.\n\nScore each dimension 0-2 with one sentence of evidence:\n\n- `voiceClarity`: 0 = prompts are direct user-voiced asks in the workflow's domain vocabulary, 1 = mostly user-voiced but borrows vocabulary from other domains or has middleware narration, 2 = reads like system documentation or sounds like a different domain\n- `ceremonyLevel`: 0 = confirmations only at real decision points, 1 = one or two unnecessary gates, 2 = over-asks the user or adds routine ceremony\n- `loopSoundness`: 0 = loops have explicit exit rules, bounded iterations, and real decision steps, 1 = minor issues with exit clarity, 2 = vibes-only exit conditions or unbounded loops (score 0 if no loops)\n- `delegationBoundedness`: 0 = delegation is bounded and explicit or absent, 1 = one delegation could be tighter, 2 = open-ended or ownership-transferring delegation (score 0 if no delegation)\n- `legacyPatterns`: 0 = no legacy anti-patterns, 1 = minor legacy residue, 2 = pseudo-DSL, learning paths, satisfaction loops, or regex-as-gate present\n- `artifactClarity`: 0 = clear what each artifact is for and which is canonical, 1 = mostly clear, 2 = ambiguous artifact ownership\n\nIf the total score is 0-2: the workflow is ready.\nIf the total score is 3-5: fix the worst dimensions before proceeding.\nIf the total score is 6+: this needs significant rework. Fix the worst dimensions here, re-validate, and record what you would change if you could redraft from scratch.\n\nFix any issues directly in the workflow file. Re-run validation if you changed structure.\n\nCapture:\n- `reviewScores`\n- `reviewPassed`\n- `fixesApplied`",
|
|
149
|
+
"promptFragments": [
|
|
150
|
+
{
|
|
151
|
+
"id": "phase-4-quick-skip",
|
|
152
|
+
"when": { "var": "rigorMode", "equals": "QUICK" },
|
|
153
|
+
"text": "For QUICK rigor, do a fast pass on voiceClarity and legacyPatterns only. Skip the full rubric unless something looks off."
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "phase-4-thorough-extra",
|
|
157
|
+
"when": { "var": "rigorMode", "equals": "THOROUGH" },
|
|
158
|
+
"text": "Also review:\n- Are the context captures complete and correctly named?\n- Do runConditions and promptFragment conditions use the right variables?\n- Is the metaGuidance minimal and non-redundant?\n- Would this workflow make sense to an agent that has never seen it before?"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "phase-4-trace-walkthrough",
|
|
162
|
+
"when": { "var": "rigorMode", "not_equals": "QUICK" },
|
|
163
|
+
"text": "After scoring the rubric, trace through the workflow with the user's original task as the test scenario. For each step:\n- What context variables does it need? Are they available from prior steps?\n- What would the agent actually do given only the prompt and references?\n- What does it produce? Does the next step have everything it needs?\n\nFlag any context flow gaps, naming mismatches, or steps where the agent wouldn't know what to do. Fix them in the workflow file."
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"requireConfirmation": false
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"id": "phase-5-refine",
|
|
170
|
+
"title": "Phase 5: Refinement",
|
|
171
|
+
"runCondition": {
|
|
172
|
+
"var": "rigorMode",
|
|
173
|
+
"not_equals": "QUICK"
|
|
174
|
+
},
|
|
175
|
+
"prompt": "The workflow is valid and reviewed. Check whether any of these improvements are worth making:\n\n1. **Prompt fragments**: are there steps with near-identical prompts that differ only by rigor mode? Extract the differences into promptFragments.\n2. **Extension points**: are there slots that different teams or projects would want to customize? Declare them.\n3. **References**: should the workflow point at external documents the agent should be aware of during execution?\n4. **Deduplication**: is there repeated prose across steps that could be moved to metaGuidance or a shared pattern?\n5. **Context templates**: are there simple variable substitutions that would make prompts cleaner?\n\nOnly make changes that genuinely improve the workflow. Do not refine for the sake of refining.\n\nIf you change anything, re-run validation.\n\nCapture:\n- `refinementsApplied`\n- `finalValidationPassed`",
|
|
176
|
+
"requireConfirmation": false
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"id": "phase-6-handoff",
|
|
180
|
+
"title": "Phase 6: Handoff",
|
|
181
|
+
"prompt": "Summarize what was created.\n\nInclude:\n- workflow file path and name\n- what the workflow does (one sentence)\n- step count and structure overview\n- loops, confirmations, and delegation if any\n- validation status\n- any known limitations or future improvements\n- how to test it: where to place the file and how to run it\n\nKeep it concise. The workflow file is the deliverable, not the summary.",
|
|
182
|
+
"notesOptional": true,
|
|
183
|
+
"requireConfirmation": false
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|