@exaudeus/workrail 1.17.0 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/services/workflow-interpreter.js +15 -7
- package/dist/manifest.json +16 -16
- package/dist/v2/durable-core/domain/decision-trace-builder.d.ts +2 -0
- package/dist/v2/durable-core/domain/decision-trace-builder.js +15 -0
- package/dist/v2/durable-core/domain/loop-control-evaluator.d.ts +1 -1
- package/dist/v2/durable-core/domain/loop-control-evaluator.js +16 -9
- package/dist/v2/durable-core/domain/prompt-renderer.js +49 -16
- package/dist/v2/durable-core/schemas/artifacts/loop-control.d.ts +1 -1
- package/dist/v2/durable-core/schemas/artifacts/loop-control.js +2 -5
- package/package.json +1 -1
- package/workflows/bug-investigation.agentic.v2.json +1 -1
- package/workflows/coding-task-workflow-agentic.v2.json +1 -1
- package/workflows/mr-review-workflow.agentic.v2.json +1 -1
- package/workflows/test-artifact-loop-control.json +2 -2
- package/workflows/workflow-for-workflows.json +2 -2
|
@@ -196,7 +196,7 @@ let WorkflowInterpreter = class WorkflowInterpreter {
|
|
|
196
196
|
return (0, neverthrow_1.ok)(shouldEnter);
|
|
197
197
|
}
|
|
198
198
|
case 'while': {
|
|
199
|
-
const res = this.evaluateWhileUntilCondition(loopCompiled, iteration, context, artifacts, frame, false);
|
|
199
|
+
const res = this.evaluateWhileUntilCondition(loopCompiled, iteration, context, artifacts, frame, false, trace);
|
|
200
200
|
if (res.isOk()) {
|
|
201
201
|
const source = loopCompiled.conditionSource?.kind === 'artifact_contract' ? 'artifact'
|
|
202
202
|
: loopCompiled.conditionSource?.kind === 'context_variable' ? 'context'
|
|
@@ -208,7 +208,7 @@ let WorkflowInterpreter = class WorkflowInterpreter {
|
|
|
208
208
|
return res;
|
|
209
209
|
}
|
|
210
210
|
case 'until': {
|
|
211
|
-
const res = this.evaluateWhileUntilCondition(loopCompiled, iteration, context, artifacts, frame, true);
|
|
211
|
+
const res = this.evaluateWhileUntilCondition(loopCompiled, iteration, context, artifacts, frame, true, trace);
|
|
212
212
|
if (res.isOk()) {
|
|
213
213
|
const source = loopCompiled.conditionSource?.kind === 'artifact_contract' ? 'artifact'
|
|
214
214
|
: loopCompiled.conditionSource?.kind === 'context_variable' ? 'context'
|
|
@@ -303,7 +303,7 @@ let WorkflowInterpreter = class WorkflowInterpreter {
|
|
|
303
303
|
return (0, neverthrow_1.err)(error_1.Err.invalidState('Non-exhaustive loop decision'));
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
evaluateWhileUntilCondition(loopCompiled, iteration, context, artifacts, frame, invertForUntil) {
|
|
306
|
+
evaluateWhileUntilCondition(loopCompiled, iteration, context, artifacts, frame, invertForUntil, traceEntries = []) {
|
|
307
307
|
const source = loopCompiled.conditionSource;
|
|
308
308
|
if (!source) {
|
|
309
309
|
if (!loopCompiled.loop.loop.condition) {
|
|
@@ -318,11 +318,19 @@ let WorkflowInterpreter = class WorkflowInterpreter {
|
|
|
318
318
|
}
|
|
319
319
|
switch (source.kind) {
|
|
320
320
|
case 'artifact_contract': {
|
|
321
|
-
const result = (0, loop_control_evaluator_1.evaluateLoopControlFromArtifacts)(artifacts
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
const result = (0, loop_control_evaluator_1.evaluateLoopControlFromArtifacts)(artifacts);
|
|
322
|
+
traceEntries.push((0, decision_trace_builder_1.traceArtifactMatchResult)(source.loopId, iteration, result));
|
|
323
|
+
switch (result.kind) {
|
|
324
|
+
case 'found':
|
|
325
|
+
return (0, neverthrow_1.ok)(result.decision === 'continue');
|
|
326
|
+
case 'not_found':
|
|
327
|
+
case 'invalid':
|
|
328
|
+
return (0, neverthrow_1.ok)(true);
|
|
329
|
+
default: {
|
|
330
|
+
const _exhaustive = result;
|
|
331
|
+
return (0, neverthrow_1.ok)(true);
|
|
332
|
+
}
|
|
324
333
|
}
|
|
325
|
-
return (0, neverthrow_1.ok)(true);
|
|
326
334
|
}
|
|
327
335
|
case 'context_variable': {
|
|
328
336
|
const raw = (0, condition_evaluator_1.evaluateCondition)(source.condition, this.projectLoopContextAtIteration(loopCompiled.loop, iteration, context));
|
package/dist/manifest.json
CHANGED
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"bytes": 1507
|
|
111
111
|
},
|
|
112
112
|
"application/services/workflow-interpreter.js": {
|
|
113
|
-
"sha256": "
|
|
114
|
-
"bytes":
|
|
113
|
+
"sha256": "df7a04c0b2c578cf54e3bc818a08b6e1af18ea75f6ade4901b3e9ceeabf46814",
|
|
114
|
+
"bytes": 21430
|
|
115
115
|
},
|
|
116
116
|
"application/services/workflow-service.d.ts": {
|
|
117
117
|
"sha256": "b92da17c6d91c90758ec42b4ee3bc448e5d5b1dfe7351f2fe0f5e1d10a715ec6",
|
|
@@ -1362,12 +1362,12 @@
|
|
|
1362
1362
|
"bytes": 1734
|
|
1363
1363
|
},
|
|
1364
1364
|
"v2/durable-core/domain/decision-trace-builder.d.ts": {
|
|
1365
|
-
"sha256": "
|
|
1366
|
-
"bytes":
|
|
1365
|
+
"sha256": "bcc7892a25099be88ca92770d98f2e7e232eef007ff8f48001aefe9c08ee876c",
|
|
1366
|
+
"bytes": 1742
|
|
1367
1367
|
},
|
|
1368
1368
|
"v2/durable-core/domain/decision-trace-builder.js": {
|
|
1369
|
-
"sha256": "
|
|
1370
|
-
"bytes":
|
|
1369
|
+
"sha256": "411da4951de3603c811afe8f4fa93de724f162834522c84e99a219c28248bf73",
|
|
1370
|
+
"bytes": 4332
|
|
1371
1371
|
},
|
|
1372
1372
|
"v2/durable-core/domain/function-definition-expander.d.ts": {
|
|
1373
1373
|
"sha256": "2720e7c4dfbd9ec0cdf75eb4384fdbea18d4430aeae7f13d9215f0e5e4980468",
|
|
@@ -1386,12 +1386,12 @@
|
|
|
1386
1386
|
"bytes": 908
|
|
1387
1387
|
},
|
|
1388
1388
|
"v2/durable-core/domain/loop-control-evaluator.d.ts": {
|
|
1389
|
-
"sha256": "
|
|
1390
|
-
"bytes":
|
|
1389
|
+
"sha256": "fbda4d2cb49d71e066f1b9bc967d5b89f4e2d1c692b865b026cf9e0bad80ad99",
|
|
1390
|
+
"bytes": 517
|
|
1391
1391
|
},
|
|
1392
1392
|
"v2/durable-core/domain/loop-control-evaluator.js": {
|
|
1393
|
-
"sha256": "
|
|
1394
|
-
"bytes":
|
|
1393
|
+
"sha256": "0db4f39141a02c3a60c50955e71e5d925a473cdd01a6d6661b2d6df5d4ca2643",
|
|
1394
|
+
"bytes": 1071
|
|
1395
1395
|
},
|
|
1396
1396
|
"v2/durable-core/domain/loop-runtime.d.ts": {
|
|
1397
1397
|
"sha256": "ee4f8857d72bf0066bccc351a4e8fd8e4800f3d540e9851bb4978179b8ebfc04",
|
|
@@ -1430,8 +1430,8 @@
|
|
|
1430
1430
|
"bytes": 935
|
|
1431
1431
|
},
|
|
1432
1432
|
"v2/durable-core/domain/prompt-renderer.js": {
|
|
1433
|
-
"sha256": "
|
|
1434
|
-
"bytes":
|
|
1433
|
+
"sha256": "5021f3cc9e59db56c5aeddcc8ed6f69df7ea1b1f3011d685695021e039376e49",
|
|
1434
|
+
"bytes": 13910
|
|
1435
1435
|
},
|
|
1436
1436
|
"v2/durable-core/domain/reason-model.d.ts": {
|
|
1437
1437
|
"sha256": "650fcb2d9969a4e6123cccbd4913f4d57aeab21a19bb907aa1e11f95e5a95089",
|
|
@@ -1618,12 +1618,12 @@
|
|
|
1618
1618
|
"bytes": 1728
|
|
1619
1619
|
},
|
|
1620
1620
|
"v2/durable-core/schemas/artifacts/loop-control.d.ts": {
|
|
1621
|
-
"sha256": "
|
|
1622
|
-
"bytes":
|
|
1621
|
+
"sha256": "714e2980400da0aaf814c691d8915653393316e70bc9af9da72130bb07e959be",
|
|
1622
|
+
"bytes": 2768
|
|
1623
1623
|
},
|
|
1624
1624
|
"v2/durable-core/schemas/artifacts/loop-control.js": {
|
|
1625
|
-
"sha256": "
|
|
1626
|
-
"bytes":
|
|
1625
|
+
"sha256": "c4b2ed38f9fdda3fbe3e4b68b0a228890fd9a7c73117a6d202928acabe6fc0f9",
|
|
1626
|
+
"bytes": 2115
|
|
1627
1627
|
},
|
|
1628
1628
|
"v2/durable-core/schemas/compiled-workflow/index.d.ts": {
|
|
1629
1629
|
"sha256": "d13d2dbbcd0971f7c170788552f533c2605f26e0f352939bf5cd2348437d7519",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Result } from 'neverthrow';
|
|
2
|
+
import type { LoopControlEvaluationResult } from './loop-control-evaluator.js';
|
|
2
3
|
export type DecisionTraceEntryKind = 'selected_next_step' | 'evaluated_condition' | 'entered_loop' | 'exited_loop' | 'detected_non_tip_advance';
|
|
3
4
|
export type DecisionTraceRef = {
|
|
4
5
|
readonly kind: 'step_id';
|
|
@@ -22,6 +23,7 @@ export declare function traceEnteredLoop(loopId: string, iteration: number): Dec
|
|
|
22
23
|
export declare function traceEvaluatedCondition(loopId: string, iteration: number, result: boolean, source: 'artifact' | 'context' | 'legacy'): DecisionTraceEntry;
|
|
23
24
|
export declare function traceExitedLoop(loopId: string, reason: string): DecisionTraceEntry;
|
|
24
25
|
export declare function traceSelectedNextStep(stepId: string): DecisionTraceEntry;
|
|
26
|
+
export declare function traceArtifactMatchResult(loopId: string, iteration: number, result: LoopControlEvaluationResult): DecisionTraceEntry;
|
|
25
27
|
export declare function applyTraceBudget(entries: readonly DecisionTraceEntry[]): readonly DecisionTraceEntry[];
|
|
26
28
|
export declare function buildDecisionTraceEventData(traceId: string, entries: readonly DecisionTraceEntry[]): Result<{
|
|
27
29
|
readonly traceId: string;
|
|
@@ -4,6 +4,7 @@ exports.traceEnteredLoop = traceEnteredLoop;
|
|
|
4
4
|
exports.traceEvaluatedCondition = traceEvaluatedCondition;
|
|
5
5
|
exports.traceExitedLoop = traceExitedLoop;
|
|
6
6
|
exports.traceSelectedNextStep = traceSelectedNextStep;
|
|
7
|
+
exports.traceArtifactMatchResult = traceArtifactMatchResult;
|
|
7
8
|
exports.applyTraceBudget = applyTraceBudget;
|
|
8
9
|
exports.buildDecisionTraceEventData = buildDecisionTraceEventData;
|
|
9
10
|
const neverthrow_1 = require("neverthrow");
|
|
@@ -38,6 +39,20 @@ function traceSelectedNextStep(stepId) {
|
|
|
38
39
|
refs: [{ kind: 'step_id', stepId }],
|
|
39
40
|
};
|
|
40
41
|
}
|
|
42
|
+
function traceArtifactMatchResult(loopId, iteration, result) {
|
|
43
|
+
const detail = (() => {
|
|
44
|
+
switch (result.kind) {
|
|
45
|
+
case 'found': return `decision="${result.decision}"`;
|
|
46
|
+
case 'not_found': return result.reason;
|
|
47
|
+
case 'invalid': return result.reason;
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
return {
|
|
51
|
+
kind: 'evaluated_condition',
|
|
52
|
+
summary: `Loop '${loopId}' iteration ${iteration}: artifact match=${result.kind} — ${detail}`,
|
|
53
|
+
refs: [{ kind: 'loop_id', loopId }, { kind: 'iteration', value: iteration }],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
41
56
|
function applyTraceBudget(entries) {
|
|
42
57
|
const capped = entries.slice(0, constants_js_1.MAX_DECISION_TRACE_ENTRIES);
|
|
43
58
|
let totalBytes = 0;
|
|
@@ -10,4 +10,4 @@ export type LoopControlEvaluationResult = {
|
|
|
10
10
|
readonly kind: 'invalid';
|
|
11
11
|
readonly reason: string;
|
|
12
12
|
};
|
|
13
|
-
export declare function evaluateLoopControlFromArtifacts(artifacts: readonly unknown[]
|
|
13
|
+
export declare function evaluateLoopControlFromArtifacts(artifacts: readonly unknown[]): LoopControlEvaluationResult;
|
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.evaluateLoopControlFromArtifacts = evaluateLoopControlFromArtifacts;
|
|
4
4
|
const index_js_1 = require("../schemas/artifacts/index.js");
|
|
5
|
-
function evaluateLoopControlFromArtifacts(artifacts
|
|
5
|
+
function evaluateLoopControlFromArtifacts(artifacts) {
|
|
6
6
|
if (artifacts.length === 0) {
|
|
7
7
|
return {
|
|
8
8
|
kind: 'not_found',
|
|
9
|
-
reason:
|
|
9
|
+
reason: 'No artifacts provided for loop control evaluation',
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
const artifact = (0, index_js_1.findLoopControlArtifact)(artifacts
|
|
13
|
-
if (
|
|
12
|
+
const artifact = (0, index_js_1.findLoopControlArtifact)(artifacts);
|
|
13
|
+
if (artifact) {
|
|
14
14
|
return {
|
|
15
|
-
kind: '
|
|
16
|
-
|
|
15
|
+
kind: 'found',
|
|
16
|
+
decision: artifact.decision,
|
|
17
|
+
artifact,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const hasKindMatch = artifacts.some(index_js_1.isLoopControlArtifact);
|
|
21
|
+
if (hasKindMatch) {
|
|
22
|
+
return {
|
|
23
|
+
kind: 'invalid',
|
|
24
|
+
reason: 'Artifact with kind=wr.loop_control found but failed schema validation (bad loopId format, missing decision, or extra fields)',
|
|
17
25
|
};
|
|
18
26
|
}
|
|
19
27
|
return {
|
|
20
|
-
kind: '
|
|
21
|
-
|
|
22
|
-
artifact,
|
|
28
|
+
kind: 'not_found',
|
|
29
|
+
reason: 'No wr.loop_control artifact found',
|
|
23
30
|
};
|
|
24
31
|
}
|
|
@@ -114,24 +114,55 @@ function applyPromptBudget(combinedPrompt) {
|
|
|
114
114
|
const decoder = new TextDecoder('utf-8');
|
|
115
115
|
return decoder.decode(truncatedBytes) + markerText + omissionNote;
|
|
116
116
|
}
|
|
117
|
+
function resolveParentLoopMaxIterations(workflow, stepId) {
|
|
118
|
+
for (const step of workflow.definition.steps) {
|
|
119
|
+
if ((0, workflow_js_1.isLoopStepDefinition)(step) && Array.isArray(step.body)) {
|
|
120
|
+
for (const bodyStep of step.body) {
|
|
121
|
+
if (bodyStep.id === stepId) {
|
|
122
|
+
return step.loop.maxIterations;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
function buildScopeInstruction(iteration, maxIterations) {
|
|
130
|
+
if (iteration <= 1)
|
|
131
|
+
return 'Focus on what the first pass missed — do not re-litigate settled findings.';
|
|
132
|
+
if (maxIterations !== undefined && iteration + 1 >= maxIterations)
|
|
133
|
+
return 'FINAL PASS — verify prior amendments landed correctly. Only flag regressions or clearly missed issues.';
|
|
134
|
+
return 'Diminishing returns expected. Focus on gaps and regressions, not fresh territory.';
|
|
135
|
+
}
|
|
117
136
|
function buildLoopContextBanner(args) {
|
|
118
137
|
if (args.loopPath.length === 0 || args.isExitStep)
|
|
119
138
|
return '';
|
|
120
139
|
const current = args.loopPath[args.loopPath.length - 1];
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
const iterationNumber = current.iteration + 1;
|
|
141
|
+
const maxIter = args.maxIterations;
|
|
142
|
+
if (current.iteration === 0) {
|
|
143
|
+
const bound = maxIter !== undefined ? ` (up to ${maxIter} passes)` : '';
|
|
144
|
+
return [
|
|
145
|
+
`> This step is part of an iterative loop${bound}. After your work, a decision step determines whether another pass is needed.`,
|
|
146
|
+
``,
|
|
147
|
+
].join('\n');
|
|
148
|
+
}
|
|
149
|
+
const lines = ['---'];
|
|
150
|
+
if (maxIter !== undefined) {
|
|
151
|
+
const filled = Math.min(iterationNumber, maxIter);
|
|
152
|
+
const empty = Math.max(maxIter - filled, 0);
|
|
153
|
+
const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(empty);
|
|
154
|
+
lines.push(`**Progress: [${bar}] Pass ${iterationNumber} of ${maxIter}**`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
lines.push(`**Pass ${iterationNumber}**`);
|
|
158
|
+
}
|
|
159
|
+
lines.push('');
|
|
160
|
+
lines.push(`**Scope**: ${buildScopeInstruction(current.iteration, maxIter)}`);
|
|
161
|
+
lines.push('');
|
|
162
|
+
lines.push('Your previous work is in the **Ancestry Recap** below. Build on it — do not repeat work already done.');
|
|
163
|
+
lines.push('---');
|
|
164
|
+
lines.push('');
|
|
165
|
+
return lines.join('\n');
|
|
135
166
|
}
|
|
136
167
|
function formatOutputContractRequirements(outputContract) {
|
|
137
168
|
const contractRef = outputContract?.contractRef;
|
|
@@ -143,7 +174,8 @@ function formatOutputContractRequirements(outputContract) {
|
|
|
143
174
|
`Artifact contract: ${index_js_2.LOOP_CONTROL_CONTRACT_REF}`,
|
|
144
175
|
`Provide an artifact with kind: "wr.loop_control"`,
|
|
145
176
|
`Required field: decision ("continue" | "stop")`,
|
|
146
|
-
`
|
|
177
|
+
`Do NOT include loopId — the engine matches automatically`,
|
|
178
|
+
`Canonical format:\n\`\`\`json\n{ "artifacts": [{ "kind": "wr.loop_control", "decision": "stop" }] }\n\`\`\``,
|
|
147
179
|
];
|
|
148
180
|
default:
|
|
149
181
|
return [
|
|
@@ -184,7 +216,8 @@ function renderPendingPrompt(args) {
|
|
|
184
216
|
? step.outputContract
|
|
185
217
|
: undefined;
|
|
186
218
|
const isExitStep = outputContract?.contractRef === index_js_2.LOOP_CONTROL_CONTRACT_REF;
|
|
187
|
-
const
|
|
219
|
+
const maxIterations = resolveParentLoopMaxIterations(args.workflow, args.stepId);
|
|
220
|
+
const loopBanner = buildLoopContextBanner({ loopPath: args.loopPath, isExitStep, maxIterations });
|
|
188
221
|
const validationCriteria = step.validationCriteria;
|
|
189
222
|
const requirements = (0, validation_requirements_extractor_js_1.extractValidationRequirements)(validationCriteria);
|
|
190
223
|
const requirementsSection = requirements.length > 0
|
|
@@ -63,4 +63,4 @@ export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
|
63
63
|
export type LoopControlArtifactV1 = z.infer<typeof LoopControlArtifactV1Schema>;
|
|
64
64
|
export declare function isLoopControlArtifact(artifact: unknown): artifact is LoopControlArtifactV1;
|
|
65
65
|
export declare function parseLoopControlArtifact(artifact: unknown): LoopControlArtifactV1 | null;
|
|
66
|
-
export declare function findLoopControlArtifact(artifacts: readonly unknown[]
|
|
66
|
+
export declare function findLoopControlArtifact(artifacts: readonly unknown[]): LoopControlArtifactV1 | null;
|
|
@@ -35,17 +35,14 @@ function parseLoopControlArtifact(artifact) {
|
|
|
35
35
|
const result = exports.LoopControlArtifactV1Schema.safeParse(artifact);
|
|
36
36
|
return result.success ? result.data : null;
|
|
37
37
|
}
|
|
38
|
-
function findLoopControlArtifact(artifacts
|
|
38
|
+
function findLoopControlArtifact(artifacts) {
|
|
39
39
|
for (let i = artifacts.length - 1; i >= 0; i--) {
|
|
40
40
|
const artifact = artifacts[i];
|
|
41
41
|
if (!isLoopControlArtifact(artifact))
|
|
42
42
|
continue;
|
|
43
43
|
const parsed = parseLoopControlArtifact(artifact);
|
|
44
|
-
if (
|
|
45
|
-
continue;
|
|
46
|
-
if (parsed.loopId === undefined || parsed.loopId === expectedLoopId) {
|
|
44
|
+
if (parsed)
|
|
47
45
|
return parsed;
|
|
48
|
-
}
|
|
49
46
|
}
|
|
50
47
|
return null;
|
|
51
48
|
}
|
package/package.json
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
{
|
|
106
106
|
"id": "phase-4b-loop-decision",
|
|
107
107
|
"title": "Evidence Loop Decision",
|
|
108
|
-
"prompt": "Decide whether the evidence loop should continue.\n\nDecision rules:\n- if `contradictionCount > 0` → continue\n- else if `unresolvedEvidenceGapCount > 0` → continue\n- else if `hasStrongAlternative = true` and the alternative is not meaningfully weaker → continue\n- else if `diagnosisType = inconclusive_but_narrowed` and further evidence is not realistically available → stop with bounded uncertainty\n- else → stop\n\nOutput exactly:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
108
|
+
"prompt": "Decide whether the evidence loop should continue.\n\nDecision rules:\n- if `contradictionCount > 0` → continue\n- else if `unresolvedEvidenceGapCount > 0` → continue\n- else if `hasStrongAlternative = true` and the alternative is not meaningfully weaker → continue\n- else if `diagnosisType = inconclusive_but_narrowed` and further evidence is not realistically available → stop with bounded uncertainty\n- else → stop\n\nOutput exactly:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\"\n }]\n}\n```",
|
|
109
109
|
"requireConfirmation": true,
|
|
110
110
|
"outputContract": {
|
|
111
111
|
"contractRef": "wr.contracts.loop_control"
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
{
|
|
140
140
|
"id": "phase-4c-loop-decision",
|
|
141
141
|
"title": "Loop Exit Decision",
|
|
142
|
-
"prompt": "Provide a loop control artifact.\n\nDecision rules:\n- if `planFindings` is non-empty → continue\n- if `planFindings` is empty → stop, but enumerate what was checked to justify the clean pass\n- if max iterations reached → stop and document remaining concerns\n\nOutput exactly:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
142
|
+
"prompt": "Provide a loop control artifact.\n\nDecision rules:\n- if `planFindings` is non-empty → continue\n- if `planFindings` is empty → stop, but enumerate what was checked to justify the clean pass\n- if max iterations reached → stop and document remaining concerns\n\nOutput exactly:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\"\n }]\n}\n```",
|
|
143
143
|
"requireConfirmation": true,
|
|
144
144
|
"outputContract": {
|
|
145
145
|
"contractRef": "wr.contracts.loop_control"
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
{
|
|
189
189
|
"id": "phase-4c-loop-decision",
|
|
190
190
|
"title": "Synthesis Loop Decision",
|
|
191
|
-
"prompt": "Decide whether the synthesis loop should continue.\n\nDecision rules:\n- if `contradictionCount > 0` → continue\n- else if `coverageUncertainCount > 0` and the uncertainty materially affects the recommendation → continue\n- else if `falsePositiveRiskCount > 0` → continue\n- else if `recommendationDriftDetected = true` → continue\n- else → stop\n\nOutput exactly:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
191
|
+
"prompt": "Decide whether the synthesis loop should continue.\n\nDecision rules:\n- if `contradictionCount > 0` → continue\n- else if `coverageUncertainCount > 0` and the uncertainty materially affects the recommendation → continue\n- else if `falsePositiveRiskCount > 0` → continue\n- else if `recommendationDriftDetected = true` → continue\n- else → stop\n\nOutput exactly:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\"\n }]\n}\n```",
|
|
192
192
|
"requireConfirmation": true,
|
|
193
193
|
"outputContract": {
|
|
194
194
|
"contractRef": "wr.contracts.loop_control"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{
|
|
14
14
|
"id": "init-loop",
|
|
15
15
|
"title": "Initialize Loop",
|
|
16
|
-
"prompt": "Initialize the bounded iteration loop.\n\n**Provide a loop control artifact:**\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
16
|
+
"prompt": "Initialize the bounded iteration loop.\n\n**Provide a loop control artifact:**\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\",\n \"metadata\": {\n \"reason\": \"Starting iteration loop\"\n }\n }]\n}\n```\n\nThe artifact must have:\n- kind: 'wr.loop_control'\n- decision: 'continue' or 'stop'",
|
|
17
17
|
"requireConfirmation": false,
|
|
18
18
|
"outputContract": {
|
|
19
19
|
"contractRef": "wr.contracts.loop_control"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
{
|
|
43
43
|
"id": "decide-continue",
|
|
44
44
|
"title": "Loop Decision",
|
|
45
|
-
"prompt": "Decide whether to continue or stop the loop.\n\n**Provide a loop control artifact:**\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
45
|
+
"prompt": "Decide whether to continue or stop the loop.\n\n**Provide a loop control artifact:**\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\",\n \"metadata\": {\n \"reason\": \"More work needed\",\n \"iterationIndex\": 1\n }\n }]\n}\n```\n\n**Decision logic:**\n- If more work is needed: decision = 'continue'\n- If work is complete: decision = 'stop'\n\nThe artifact must have:\n- kind: 'wr.loop_control'\n- decision: 'continue' or 'stop'",
|
|
46
46
|
"requireConfirmation": true,
|
|
47
47
|
"outputContract": {
|
|
48
48
|
"contractRef": "wr.contracts.loop_control"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
{
|
|
90
90
|
"id": "discovery-loop-decision",
|
|
91
91
|
"title": "Discovery Loop Decision",
|
|
92
|
-
"prompt": "**Provide a loop control decision artifact.**\n\nBased on the discovery analysis above, decide whether to continue gathering requirements or proceed to synthesis.\n\n**Decision logic:**\n- If critical information is still missing (problem unclear, user needs undefined, success criteria absent): decision = 'continue'\n- If discovery is 80%+ complete (clear problem, user needs, success criteria, basic constraints): decision = 'stop'\n\n**Output (exact format):**\nProvide a loop control artifact:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
92
|
+
"prompt": "**Provide a loop control decision artifact.**\n\nBased on the discovery analysis above, decide whether to continue gathering requirements or proceed to synthesis.\n\n**Decision logic:**\n- If critical information is still missing (problem unclear, user needs undefined, success criteria absent): decision = 'continue'\n- If discovery is 80%+ complete (clear problem, user needs, success criteria, basic constraints): decision = 'stop'\n\n**Output (exact format):**\nProvide a loop control artifact:\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\",\n \"metadata\": {\n \"reason\": \"One sentence explaining why continuing or stopping\"\n }\n }]\n}\n```",
|
|
93
93
|
"agentRole": "You are a discovery analyst making an explicit go/no-go decision on whether enough requirements have been gathered.",
|
|
94
94
|
"requireConfirmation": false,
|
|
95
95
|
"outputContract": {
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
{
|
|
419
419
|
"id": "satisfaction-check",
|
|
420
420
|
"title": "Iteration Satisfaction Check & Loop Decision",
|
|
421
|
-
"prompt": "Let's assess your satisfaction with the workflow so far.\n\n**Rate your satisfaction (1-10):**\n- 10: Perfect! Ready to deploy\n- 8-9: Very good, minor tweaks only\n- 6-7: Good foundation, needs refinement\n- 4-5: Major improvements needed\n- 1-3: Significant rework required\n\n**Decision logic:**\n- Score 9+: decision = 'stop' (proceed to completion)\n- Score <9: decision = 'continue' (iterate again, up to 3 times total)\n\nAgent: Set context.satisfactionScore and increment context.iterationCount.\n\n**Provide a loop control artifact:**\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"
|
|
421
|
+
"prompt": "Let's assess your satisfaction with the workflow so far.\n\n**Rate your satisfaction (1-10):**\n- 10: Perfect! Ready to deploy\n- 8-9: Very good, minor tweaks only\n- 6-7: Good foundation, needs refinement\n- 4-5: Major improvements needed\n- 1-3: Significant rework required\n\n**Decision logic:**\n- Score 9+: decision = 'stop' (proceed to completion)\n- Score <9: decision = 'continue' (iterate again, up to 3 times total)\n\nAgent: Set context.satisfactionScore and increment context.iterationCount.\n\n**Provide a loop control artifact:**\n```json\n{\n \"artifacts\": [{\n \"kind\": \"wr.loop_control\",\n \"decision\": \"continue\",\n \"metadata\": {\n \"reason\": \"Satisfaction score X/10 - [brief reason]\"\n }\n }]\n}\n```",
|
|
422
422
|
"agentRole": "You are a quality assessment specialist. Guide the user through evaluating their workflow objectively. Provide a loop control artifact with the decision.",
|
|
423
423
|
"requireConfirmation": false,
|
|
424
424
|
"outputContract": {
|