@exaudeus/workrail 3.39.0 → 3.41.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.
- package/dist/cli/commands/init.js +0 -3
- package/dist/cli-worktrain.js +58 -26
- package/dist/cli.js +0 -18
- package/dist/config/app-config.d.ts +0 -16
- package/dist/config/app-config.js +0 -14
- package/dist/config/config-file.js +0 -3
- package/dist/console-ui/assets/index-CQt4UhPB.js +28 -0
- package/dist/console-ui/assets/index-DGj8EsFR.css +1 -0
- package/dist/console-ui/index.html +2 -2
- package/dist/coordinators/pr-review.d.ts +23 -1
- package/dist/coordinators/pr-review.js +224 -5
- package/dist/daemon/daemon-events.d.ts +9 -1
- package/dist/daemon/soul-template.d.ts +2 -2
- package/dist/daemon/soul-template.js +11 -1
- package/dist/daemon/workflow-runner.d.ts +17 -3
- package/dist/daemon/workflow-runner.js +401 -28
- package/dist/di/container.js +1 -25
- package/dist/di/tokens.d.ts +0 -3
- package/dist/di/tokens.js +0 -3
- package/dist/engine/engine-factory.js +0 -1
- package/dist/infrastructure/console-defaults.d.ts +1 -0
- package/dist/infrastructure/console-defaults.js +4 -0
- package/dist/infrastructure/session/index.d.ts +0 -1
- package/dist/infrastructure/session/index.js +1 -3
- package/dist/manifest.json +124 -124
- package/dist/mcp/handlers/session.d.ts +1 -0
- package/dist/mcp/handlers/session.js +61 -13
- package/dist/mcp/output-schemas.d.ts +10 -10
- package/dist/mcp/server.js +1 -18
- package/dist/mcp/tools.d.ts +12 -12
- package/dist/mcp/transports/http-entry.js +0 -2
- package/dist/mcp/transports/stdio-entry.js +1 -2
- package/dist/mcp/types.d.ts +0 -2
- package/dist/trigger/daemon-console.d.ts +2 -0
- package/dist/trigger/daemon-console.js +1 -1
- package/dist/trigger/trigger-listener.d.ts +2 -0
- package/dist/trigger/trigger-listener.js +3 -1
- package/dist/trigger/trigger-router.d.ts +4 -3
- package/dist/trigger/trigger-router.js +13 -5
- package/dist/trigger/trigger-store.js +17 -4
- package/dist/types/workflow-source.d.ts +0 -1
- package/dist/types/workflow-source.js +3 -6
- package/dist/types/workflow.d.ts +1 -1
- package/dist/types/workflow.js +1 -2
- package/dist/v2/durable-core/domain/artifact-contract-validator.js +66 -0
- package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.d.ts +25 -0
- package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.js +31 -0
- package/dist/v2/durable-core/schemas/artifacts/index.d.ts +3 -1
- package/dist/v2/durable-core/schemas/artifacts/index.js +14 -1
- package/dist/v2/durable-core/schemas/artifacts/review-verdict.d.ts +41 -0
- package/dist/v2/durable-core/schemas/artifacts/review-verdict.js +30 -0
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +236 -236
- package/dist/v2/durable-core/schemas/session/events.d.ts +50 -50
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
- package/dist/v2/durable-core/schemas/session/manifest.d.ts +4 -4
- package/dist/v2/durable-core/schemas/session/outputs.d.ts +8 -8
- package/dist/v2/usecases/console-routes.d.ts +2 -1
- package/dist/v2/usecases/console-routes.js +207 -5
- package/dist/v2/usecases/console-service.js +14 -0
- package/dist/v2/usecases/console-types.d.ts +1 -0
- package/docs/authoring.md +16 -16
- package/docs/design/coordinator-artifact-protocol-design-candidates.md +155 -0
- package/docs/design/coordinator-artifact-protocol-design-review.md +103 -0
- package/docs/design/coordinator-artifact-protocol-implementation-plan.md +259 -0
- package/docs/design/coordinator-message-queue-drain-plan.md +241 -0
- package/docs/design/coordinator-message-queue-drain-review.md +120 -0
- package/docs/design/coordinator-message-queue-drain.md +289 -0
- package/docs/design/shaping-workflow-external-research.md +119 -0
- package/docs/discovery/late-bound-goals-impl-plan.md +147 -0
- package/docs/discovery/late-bound-goals-review.md +82 -0
- package/docs/discovery/late-bound-goals.md +118 -0
- package/docs/discovery/steer-endpoint-design-candidates.md +288 -0
- package/docs/discovery/steer-endpoint-design-review-findings.md +104 -0
- package/docs/discovery/steer-endpoint-implementation-plan.md +284 -0
- package/docs/ideas/backlog.md +447 -97
- package/docs/ideas/design-candidates-console-session-tree-impl.md +64 -0
- package/docs/ideas/design-candidates-session-tree-view.md +196 -0
- package/docs/ideas/design-review-findings-console-session-tree-impl.md +75 -0
- package/docs/ideas/design-review-findings-session-tree-view.md +88 -0
- package/docs/ideas/implementation_plan_session_tree_view.md +238 -0
- package/package.json +2 -1
- package/spec/authoring-spec.json +16 -16
- package/spec/shape.schema.json +178 -0
- package/spec/workflow-tags.json +232 -47
- package/workflows/coding-task-workflow-agentic.json +491 -480
- package/workflows/mr-review-workflow.agentic.v2.json +5 -1
- package/workflows/wr.shaping.json +182 -0
- package/dist/console-ui/assets/index-3oXZ_A9m.js +0 -28
- package/dist/console-ui/assets/index-8dh0Psu-.css +0 -1
- package/dist/infrastructure/session/DashboardHeartbeat.d.ts +0 -8
- package/dist/infrastructure/session/DashboardHeartbeat.js +0 -39
- package/dist/infrastructure/session/DashboardLockRelease.d.ts +0 -2
- package/dist/infrastructure/session/DashboardLockRelease.js +0 -29
- package/dist/infrastructure/session/HttpServer.d.ts +0 -60
- package/dist/infrastructure/session/HttpServer.js +0 -912
- package/workflows/coding-task-workflow-agentic.lean.v2.json +0 -648
- package/workflows/coding-task-workflow-agentic.v2.json +0 -324
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "coding-task-workflow-agentic",
|
|
3
|
-
"name": "Agentic Task Dev Workflow (v2)",
|
|
4
|
-
"version": "2.0.0",
|
|
5
|
-
"description": "Use this to implement a software feature or task. Follows a plan-then-execute approach with architecture decisions, invariant tracking, and final verification.",
|
|
6
|
-
"about": "## Agentic Coding Task Workflow\n\nThis workflow structures the full lifecycle of a software implementation task: from understanding and classifying the work, through architecture decisions and incremental implementation, to final verification and handoff.\n\n### What it does\n\nThe workflow guides an AI agent through a disciplined plan-then-execute process. It begins by analyzing the task to determine complexity, risk, and the right level of rigor (QUICK, STANDARD, or THOROUGH). For non-trivial tasks, it then gathers codebase context, surfaces invariants and non-goals, generates competing design candidates, and selects an approach before writing a single line of code. Implementation proceeds slice by slice, with built-in verification gates after each slice. A final integration verification pass confirms acceptance criteria are met before handoff.\n\n### When to use it\n\nUse this workflow whenever you are implementing a feature, fixing a non-trivial bug, or making an architectural change in a real codebase. It is especially valuable when:\n- The task touches multiple files or systems\n- There is meaningful risk of regressions or invariant violations\n- You want the agent to surface trade-offs and commit to a reasoned design decision rather than guessing\n- You need a resumable, auditable record of what was decided and why\n\nFor quick one-liner fixes or very small changes, the workflow includes a fast path that skips heavyweight planning.\n\n### What it produces\n\n- An `implementation_plan.md` artifact covering the selected approach, vertical slices, test design, and philosophy alignment\n- A `spec.md` for large or high-risk tasks, capturing observable behavior and acceptance criteria\n- Step-level notes in WorkRail that serve as a durable execution log\n- A PR-ready handoff summary with acceptance criteria status, invariant proofs, and follow-up tickets\n\n### How to get good results\n\n- Provide a clear task description and at least partial acceptance criteria before starting\n- If you have coding philosophy or project conventions configured in session rules or Memory MCP, the workflow will apply them automatically as a design lens\n- Let the workflow classify complexity and rigor itself; override only if the classification is clearly wrong\n- For large or high-risk tasks, review the architecture decision step before implementation begins",
|
|
7
|
-
"examples": [
|
|
8
|
-
"Implement JWT refresh token rotation in the auth service",
|
|
9
|
-
"Fix the race condition in the cache invalidation path when concurrent writes occur",
|
|
10
|
-
"Refactor the payment flow to use a Result type instead of throwing exceptions",
|
|
11
|
-
"Add pagination support to the messaging inbox API endpoint"
|
|
12
|
-
],
|
|
13
|
-
"recommendedPreferences": {
|
|
14
|
-
"recommendedAutonomy": "guided",
|
|
15
|
-
"recommendedRiskPolicy": "conservative"
|
|
16
|
-
},
|
|
17
|
-
"preconditions": [
|
|
18
|
-
"User provides a task description or equivalent objective.",
|
|
19
|
-
"Agent has codebase read access and can run the tools needed for analysis and validation.",
|
|
20
|
-
"A deterministic validation path exists (tests, build, or an explicit verification strategy).",
|
|
21
|
-
"If the task touches critical paths, rollback or containment strategy can be defined."
|
|
22
|
-
],
|
|
23
|
-
"clarificationPrompts": [
|
|
24
|
-
"What are the acceptance criteria and explicit non-goals?",
|
|
25
|
-
"What invariants must not change?",
|
|
26
|
-
"Are there rollout, migration, or environment constraints?",
|
|
27
|
-
"Are there existing repo patterns or examples that must be followed?"
|
|
28
|
-
],
|
|
29
|
-
"metaGuidance": [
|
|
30
|
-
"DEFAULT BEHAVIOR: self-execute with tools. Only ask the user for business decisions, missing external artifacts, or permissions you cannot resolve.",
|
|
31
|
-
"V2 DURABILITY: use output.notesMarkdown as the primary durable record. Do NOT mirror execution state into CONTEXT.md or any markdown checkpoint file.",
|
|
32
|
-
"ARTIFACT STRATEGY: `implementation_plan.md` is the only default human-facing artifact for non-small tasks. `spec.md` or `design.md` are optional and should be created only when they materially improve handoff or reviewability.",
|
|
33
|
-
"MAIN AGENT OWNS EXECUTION: the main agent owns strategy, decisions, synthesis, and implementation. Delegate only specific cognitive routines via the WorkRail Executor when the step explicitly tells you to.",
|
|
34
|
-
"SUBAGENT MODEL: use the WorkRail Executor only. Do not refer to or rely on named Builder/Researcher identities.",
|
|
35
|
-
"AUDITOR MODEL: prefer delegation for auditing, challenge, simulation, and ideation. Do not hand off full task ownership.",
|
|
36
|
-
"PARALLELISM: when reads, audits, or delegations are independent, run them in parallel inside the phase. Parallelize cognition; serialize synthesis and canonical writes.",
|
|
37
|
-
"PHILOSOPHY LENS: apply the user's coding philosophy as the active evaluation lens. Flag violations by principle name, not as generic feedback. If principles conflict, surface the tension explicitly instead of silently choosing.",
|
|
38
|
-
"PHILOSOPHY CHECKS: watch for immutability, architectural fixes over patches, illegal states unrepresentable, explicit domain types, reduced path explosion, type safety, exhaustiveness, and errors as data.",
|
|
39
|
-
"PHILOSOPHY CHECKS (cont): validate at boundaries, fail fast on invariant violations, prefer determinism and small pure functions, use data-driven control flow, DI at boundaries, YAGNI with discipline, and atomicity.",
|
|
40
|
-
"PHILOSOPHY CHECKS (cont): treat graceful degradation, observability, fakes over mocks, and focused interfaces as first-class review concerns.",
|
|
41
|
-
"VERTICAL SLICES: plan and implement as independently reviewable and verifiable slices. Parallelize only when targets do not overlap.",
|
|
42
|
-
"VALIDATION: prefer compile-time safety and deterministic verification. Use tests and type/build validation as the first-line proof.",
|
|
43
|
-
"TRIGGERS: WorkRail can only react to explicit fields the agent emits. Use narrow observable fields, not hidden introspection, to decide when fresh cognitive review is needed.",
|
|
44
|
-
"DRIFT HANDLING: when reality diverges from the plan, update the plan artifact and re-audit deliberately rather than accumulating undocumented drift.",
|
|
45
|
-
"NEVER COMMIT MARKDOWN FILES UNLESS USER EXPLICITLY ASKS."
|
|
46
|
-
],
|
|
47
|
-
"steps": [
|
|
48
|
-
{
|
|
49
|
-
"id": "phase-0-triage-and-mode",
|
|
50
|
-
"title": "Phase 0: Triage (Complexity • Risk • PR Strategy)",
|
|
51
|
-
"prompt": "Analyze the task and choose the right rigor.\n\nClassify:\n- `taskComplexity`: Small / Medium / Large\n- `riskLevel`: Low / Medium / High\n- `rigorMode`: QUICK / STANDARD / THOROUGH\n- `automationLevel`: High / Medium / Low\n- `prStrategy`: SinglePR / MultiPR\n- `maxParallelism`: 0 / 3 / 4\n\nDecision guidance:\n- QUICK: small, low-risk, clear path, little ambiguity\n- STANDARD: medium scope or moderate risk\n- THOROUGH: large scope, architectural uncertainty, or high-risk change\n\nParallelism guidance:\n- QUICK: no delegation by default\n- STANDARD: few delegation moments, but allow multiple parallel executors at each moment\n- THOROUGH: same pattern, but with one extra delegation moment and broader parallel validation\n\nAlso capture `userRules` from the active session instructions and explicit philosophy. Keep them as a focused list of concrete, actionable rules.\n\nSet these keys in the next `continue_workflow` call's `context` object: `taskComplexity`, `riskLevel`, `rigorMode`, `automationLevel`, `prStrategy`, `maxParallelism`, `userRules`.\n\nAsk the user to confirm only if the rigor or PR strategy materially affects delivery expectations.\n\nAlso set in the context object: one sentence describing what you are trying to accomplish (e.g. \"implement OAuth refresh token rotation\", \"review PR #47 before merge\"). This populates the session title in the Workspace console immediately.",
|
|
52
|
-
"requireConfirmation": true
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"id": "phase-0b-minimum-inputs-gate",
|
|
56
|
-
"title": "Phase 0b: Minimum Inputs Gate",
|
|
57
|
-
"prompt": "If critical information is missing, ask only for the minimum required to proceed.\n\nAsk for:\n- acceptance criteria or expected behavior (if absent)\n- non-goals (if unclear)\n- environment or permission constraints (if they materially block progress)\n- pointers to relevant code areas only if codebase search cannot answer it\n\nDo NOT ask questions you can resolve with tools.",
|
|
58
|
-
"requireConfirmation": {
|
|
59
|
-
"or": [
|
|
60
|
-
{
|
|
61
|
-
"var": "automationLevel",
|
|
62
|
-
"equals": "Low"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"var": "automationLevel",
|
|
66
|
-
"equals": "Medium"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"id": "phase-1-context-and-invariants",
|
|
73
|
-
"title": "Phase 1: Context + Invariants (Notes-First, Parallel-Aware)",
|
|
74
|
-
"runCondition": {
|
|
75
|
-
"var": "taskComplexity",
|
|
76
|
-
"not_equals": "Small"
|
|
77
|
-
},
|
|
78
|
-
"prompt": "Build the minimum complete understanding needed to design correctly.\n\nDo the main context gathering yourself using tools. Read independent files in parallel when possible.\n\nDeliverable:\n- key entry points and call chain sketch\n- relevant files/modules/functions\n- existing repo patterns with concrete file references\n- testing strategy already present in the repo\n- risks and unknowns\n- explicit invariants and non-goals\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `contextSummary`\n- `candidateFiles`\n- `invariants`\n- `nonGoals`\n- `openQuestions`\n- `contextUnknownCount`\n- `contextAuditNeeded`\n\nRules:\n- answer your own questions with tools whenever possible\n- only keep true human-decision questions in `openQuestions`\n- keep `openQuestions` bounded to the minimum necessary\n- set `contextUnknownCount` to the number of unresolved technical unknowns that still matter\n- set `contextAuditNeeded` to true if understanding still feels incomplete or the call chain is still too fuzzy\n\nMode-adaptive audit:\n- QUICK: no delegation; self-check only\n- STANDARD: if `contextAuditNeeded = true` or risk is High and delegation is available, spawn TWO WorkRail Executors SIMULTANEOUSLY running `routine-context-gathering` with focus=COMPLETENESS and focus=DEPTH, then synthesize both outputs before finishing this step\n- THOROUGH: if delegation is available, spawn TWO WorkRail Executors SIMULTANEOUSLY running `routine-context-gathering` with focus=COMPLETENESS and focus=DEPTH, then synthesize both outputs before finishing this step",
|
|
79
|
-
"requireConfirmation": false
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"id": "phase-1b-retriage-after-context",
|
|
83
|
-
"title": "Phase 1b: Re-Triage After Context",
|
|
84
|
-
"runCondition": {
|
|
85
|
-
"var": "taskComplexity",
|
|
86
|
-
"not_equals": "Small"
|
|
87
|
-
},
|
|
88
|
-
"prompt": "Reassess the initial triage now that context is real instead of hypothetical.\n\nReview:\n- `contextUnknownCount`\n- number of systems/components actually involved\n- number of critical invariants discovered\n- whether the task now looks broader or riskier than Phase 0 suggested\n\nDo:\n- confirm or adjust `taskComplexity`\n- confirm or adjust `riskLevel`\n- confirm or adjust `rigorMode`\n- confirm or adjust `maxParallelism`\n\nRules:\n- upgrade rigor if the real architecture surface or uncertainty is larger than expected\n- downgrade only if the task is genuinely simpler than it first appeared\n- if you change the mode, explain why using concrete evidence from the context gathering step\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `taskComplexity`\n- `riskLevel`\n- `rigorMode`\n- `maxParallelism`\n- `retriageChanged` (true/false)",
|
|
89
|
-
"requireConfirmation": {
|
|
90
|
-
"or": [
|
|
91
|
-
{
|
|
92
|
-
"var": "retriageChanged",
|
|
93
|
-
"equals": true
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"var": "automationLevel",
|
|
97
|
-
"equals": "Low"
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"id": "phase-2-architecture-decision",
|
|
104
|
-
"title": "Phase 2: Architecture Decision (Generate • Compare • Challenge • Select)",
|
|
105
|
-
"runCondition": {
|
|
106
|
-
"var": "taskComplexity",
|
|
107
|
-
"not_equals": "Small"
|
|
108
|
-
},
|
|
109
|
-
"prompt": "Make the architecture decision in one coherent phase instead of serializing every thinking mode into a separate step.\n\nPart A — Prepare a neutral fact packet:\n- problem statement\n- acceptance criteria\n- non-goals\n- invariants\n- constraints\n- `userRules`\n- relevant files / pattern examples\n- current risks and unknowns\n\nPart B — Generate candidate plans:\n- QUICK: self-generate at least 3 genuinely different approaches\n- STANDARD: if delegation is available, spawn TWO or THREE WorkRail Executors SIMULTANEOUSLY running `routine-plan-generation` with different perspectives (for example simplicity, maintainability, pragmatic)\n- THOROUGH: if delegation is available, spawn THREE or FOUR WorkRail Executors SIMULTANEOUSLY running `routine-plan-generation` with different perspectives (for example simplicity, maintainability, architecture-first, rollback-safe)\n\nPart C — Diversity gate before commitment:\n- assign each candidate plan a short `candidatePlanFamily` label\n- check whether the candidates are materially different in shape, not just wording\n- if all candidates cluster on the same pattern family, generate at least one more plan from a deliberately different perspective before selecting\n- set `candidateDiversityAdequate = true|false`\n\nPart D — Compare candidate plans:\n- invariant fit\n- philosophy alignment (`userRules` as active lens)\n- risk profile\n- implementation shape\n- likely reviewability / PR shape\n\nPart E — Challenge the best one or two:\n- STANDARD: optionally challenge the leading candidate with ONE WorkRail Executor running `routine-hypothesis-challenge`\n- THOROUGH: challenge the top 1-2 candidate plans using ONE or TWO WorkRail Executors running `routine-hypothesis-challenge`\n\nPart F — Decide:\nSet these keys in the next `continue_workflow` call's `context` object:\n- `approaches`\n- `alternativesConsideredCount`\n- `candidatePlanFamilies`\n- `candidateDiversityAdequate`\n- `hasRunnerUp`\n- `selectedApproach`\n- `runnerUpApproach`\n- `architectureRationale`\n- `keyRiskToMonitor`\n- `pivotTriggers`\n- `architectureConfidenceBand`\n\nRules:\n- the main agent owns the final decision\n- subagents generate candidate plans; they do not decide the winner\n- if the challenged leading candidate no longer looks best, switch deliberately rather than defending sunk cost",
|
|
110
|
-
"requireConfirmation": {
|
|
111
|
-
"or": [
|
|
112
|
-
{
|
|
113
|
-
"var": "automationLevel",
|
|
114
|
-
"equals": "Low"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"var": "taskComplexity",
|
|
118
|
-
"equals": "Large"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"var": "riskLevel",
|
|
122
|
-
"equals": "High"
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"id": "phase-3-plan-and-test-design",
|
|
129
|
-
"title": "Phase 3: Slice, Plan, and Test Design",
|
|
130
|
-
"runCondition": {
|
|
131
|
-
"var": "taskComplexity",
|
|
132
|
-
"not_equals": "Small"
|
|
133
|
-
},
|
|
134
|
-
"prompt": "Create or update the human-facing implementation artifact: `implementation_plan.md`.\n\nThis phase combines slicing, plan drafting, philosophy alignment, and test design.\n\nThe plan must include:\n1. Problem statement\n2. Acceptance criteria\n3. Non-goals\n4. Applied `userRules` and philosophy-driven constraints\n5. Invariants\n6. Selected approach + rationale + runner-up\n7. Vertical slices\n8. Work packages only when they improve execution or enable safe parallelism\n9. Test design\n10. Risk register\n11. PR packaging strategy\n12. Philosophy alignment per slice:\n - [principle] → [satisfied / tension / violated + 1-line why]\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `implementationPlan`\n- `slices`\n- `testDesign`\n- `estimatedPRCount`\n- `followUpTickets` (initialize if needed)\n- `unresolvedUnknownCount`\n- `planConfidenceBand`\n\nRules:\n- keep `implementation_plan.md` concrete enough for another engineer to implement without guessing\n- use work packages only when they create real clarity; do not over-fragment work\n- use the user's coding philosophy as the primary planning lens, and name tensions explicitly\n- set `unresolvedUnknownCount` to the number of still-open issues that would materially affect implementation quality\n- set `planConfidenceBand` to Low / Medium / High based on how ready the plan actually is",
|
|
135
|
-
"requireConfirmation": false
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"id": "phase-4-plan-iterations",
|
|
139
|
-
"type": "loop",
|
|
140
|
-
"title": "Phase 4: Plan Audit Loop (Audit → Refocus → Decide)",
|
|
141
|
-
"runCondition": {
|
|
142
|
-
"var": "taskComplexity",
|
|
143
|
-
"not_equals": "Small"
|
|
144
|
-
},
|
|
145
|
-
"loop": {
|
|
146
|
-
"type": "while",
|
|
147
|
-
"conditionSource": {
|
|
148
|
-
"kind": "artifact_contract",
|
|
149
|
-
"contractRef": "wr.contracts.loop_control",
|
|
150
|
-
"loopId": "plan_audit_loop"
|
|
151
|
-
},
|
|
152
|
-
"maxIterations": 5
|
|
153
|
-
},
|
|
154
|
-
"body": [
|
|
155
|
-
{
|
|
156
|
-
"id": "phase-4a-plan-audit",
|
|
157
|
-
"title": "Plan Audit (Correctness + Philosophy + Regression)",
|
|
158
|
-
"prompt": "Audit the plan before implementation.\n\nAlways perform:\n- completeness / missing work\n- weak assumptions and risks\n- invariant coverage\n- slice boundary quality\n- philosophy alignment against `userRules`\n- regression check against `resolvedFindings` (if present)\n\nPhilosophy rules:\n- flag findings by principle name\n- Red / Orange findings go into `planFindings`\n- Yellow tensions are informational only and do NOT block loop exit\n- if no philosophy principles are configured, say so explicitly and continue\n\nRegression check:\n- if `resolvedFindings` is non-empty, verify previous resolutions still hold\n- if a previously resolved issue has reappeared, add a Critical regression finding\n\nMode-adaptive delegation:\n- QUICK: self-audit only\n- STANDARD: if delegation is available, spawn THREE WorkRail Executors SIMULTANEOUSLY running `routine-plan-analysis`, `routine-hypothesis-challenge`, and `routine-philosophy-alignment`; include `routine-execution-simulation` only when runtime or state-flow risk is material\n- THOROUGH: if delegation is available, spawn FOUR WorkRail Executors SIMULTANEOUSLY running `routine-plan-analysis`, `routine-hypothesis-challenge`, `routine-execution-simulation`, and `routine-philosophy-alignment`\n\nParallel-output synthesis rules:\n- if 2+ auditors flag the same issue, treat it as high priority by default\n- if one auditor flags a concern no one else sees, investigate it but do not automatically block unless it is clearly severe\n- if outputs conflict, document the conflict explicitly and resolve it before finalizing `planFindings`\n- if philosophy review yields Red findings and no stronger conflicting evidence exists, they must remain blocking\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `planFindings`\n- `planAmendments`\n- `planConfidence`\n- `cleanSlateDivergence`\n- `planFindingsCountBySeverity`\n- `philosophyFindingsCountBySeverity`\n- `auditConsensusLevel`\n\nRules:\n- use the main agent as synthesizer and final decision-maker\n- do not delegate sequentially when the audit routines are independent",
|
|
159
|
-
"requireConfirmation": false
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"id": "phase-4b-refocus",
|
|
163
|
-
"title": "Refocus Plan and Track Resolved Findings",
|
|
164
|
-
"prompt": "Apply plan amendments and refocus.\n\nDo:\n- update `implementation_plan.md` to incorporate `planAmendments`\n- update `slices` if the plan shape changed\n- extract out-of-scope work into `followUpTickets`\n- maintain `resolvedFindings` as an array of { finding, resolution, iteration }\n- cap `resolvedFindings` at 10 entries, dropping oldest first\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `resolvedFindings`\n- `followUpTickets`\n\nRule:\n- do not silently accept plan drift; if the audit changed the shape of the work, reflect it in the plan artifact immediately",
|
|
165
|
-
"requireConfirmation": false
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"id": "phase-4c-loop-decision",
|
|
169
|
-
"title": "Loop Exit Decision",
|
|
170
|
-
"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```",
|
|
171
|
-
"requireConfirmation": true,
|
|
172
|
-
"outputContract": {
|
|
173
|
-
"contractRef": "wr.contracts.loop_control"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"id": "phase-5-planning-ready-gate",
|
|
180
|
-
"title": "Phase 5: Planning Ready Gate",
|
|
181
|
-
"runCondition": {
|
|
182
|
-
"var": "taskComplexity",
|
|
183
|
-
"not_equals": "Small"
|
|
184
|
-
},
|
|
185
|
-
"prompt": "Verify that planning is complete enough to start implementation.\n\nRequired checks:\n- selected approach and rationale exist\n- runner-up exists\n- pivot triggers are concrete enough to act on\n- slices are defined with scope, verification, and boundaries\n- `implementation_plan.md` reflects the current intended work\n- no unresolved planning gaps remain that would block implementation\n- `alternativesConsideredCount` shows real exploration happened\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `planningGaps`\n- `planningComplete`\n\nRule:\n- if any gap can be fixed immediately, fix it now and do not carry it forward as a gap\n- only stop for user input when a true decision is missing",
|
|
186
|
-
"requireConfirmation": {
|
|
187
|
-
"or": [
|
|
188
|
-
{
|
|
189
|
-
"var": "automationLevel",
|
|
190
|
-
"equals": "Low"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"var": "taskComplexity",
|
|
194
|
-
"equals": "Large"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"var": "riskLevel",
|
|
198
|
-
"equals": "High"
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"id": "phase-6-small-task-fast-path",
|
|
205
|
-
"title": "Phase 6: Small Task Fast Path",
|
|
206
|
-
"runCondition": {
|
|
207
|
-
"var": "taskComplexity",
|
|
208
|
-
"equals": "Small"
|
|
209
|
-
},
|
|
210
|
-
"prompt": "For Small tasks:\n- confirm target locations and relevant patterns with tools\n- implement the smallest correct change\n- verify with tests/build or a deterministic check\n- apply the user's coding philosophy as the active review lens before finalizing\n- provide a concise PR-ready summary\n\nDo not create heavyweight planning artifacts unless risk unexpectedly grows.",
|
|
211
|
-
"requireConfirmation": false
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"id": "phase-7-implement-slices",
|
|
215
|
-
"type": "loop",
|
|
216
|
-
"title": "Phase 7: Implement Slice-by-Slice",
|
|
217
|
-
"runCondition": {
|
|
218
|
-
"var": "taskComplexity",
|
|
219
|
-
"not_equals": "Small"
|
|
220
|
-
},
|
|
221
|
-
"loop": {
|
|
222
|
-
"type": "forEach",
|
|
223
|
-
"items": "slices",
|
|
224
|
-
"itemVar": "currentSlice",
|
|
225
|
-
"indexVar": "sliceIndex",
|
|
226
|
-
"maxIterations": 20
|
|
227
|
-
},
|
|
228
|
-
"body": [
|
|
229
|
-
{
|
|
230
|
-
"id": "phase-7a-slice-preflight",
|
|
231
|
-
"title": "Slice Preflight",
|
|
232
|
-
"prompt": "Before implementing slice `{{currentSlice.name}}`, verify:\n- pivot triggers have not fired\n- the plan assumptions are still fresh enough\n- target files and symbols still match the plan\n- the slice remains reviewable and bounded\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `pivotTriggered`\n- `pivotSeverity`\n- `pivotReturnPhase`\n- `slicePlanStale`\n- `validationFailed`\n\nIf drift or invalid assumptions are discovered, stop and return to planning deliberately rather than coding through it.",
|
|
233
|
-
"requireConfirmation": {
|
|
234
|
-
"or": [
|
|
235
|
-
{
|
|
236
|
-
"var": "pivotTriggered",
|
|
237
|
-
"equals": true
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"var": "slicePlanStale",
|
|
241
|
-
"equals": true
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"var": "validationFailed",
|
|
245
|
-
"equals": true
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"id": "phase-7b-implement-slice",
|
|
252
|
-
"title": "Implement Slice",
|
|
253
|
-
"prompt": "Implement slice `{{currentSlice.name}}`.\n\nMain-agent-first rules:\n- the main agent owns implementation\n- do not hand off slice ownership to a Builder identity\n- if you need specialized help, delegate only targeted cognitive routines via the WorkRail Executor (for example challenge, simulation, philosophy review, or plan analysis), not the whole slice\n- read independent files in parallel when possible\n- implement incrementally and keep the slice within its intended boundary\n- apply the user's coding philosophy as the active implementation lens\n\nDuring implementation, explicitly track whether the slice required:\n- a new special-case (`specialCaseIntroduced`)\n- an unplanned abstraction (`unplannedAbstractionIntroduced`)\n\nIf this slice uses work packages, use them as guidance, not ceremony.",
|
|
254
|
-
"requireConfirmation": false
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
"id": "phase-7c-verify-slice",
|
|
258
|
-
"title": "Verify Slice",
|
|
259
|
-
"prompt": "Verify slice `{{currentSlice.name}}`.\n\nAlways:\n- run planned verification commands\n- update or add tests when needed\n- ensure invariants still hold\n- check philosophy-alignment regressions introduced by the implementation\n\nFresh-eye validation triggers:\n- if `specialCaseIntroduced = true`\n- if `unplannedAbstractionIntroduced = true`\n- if this slice touched unexpected files\n- if runtime behavior still feels uncertain\n\nMode-adaptive validation:\n- QUICK: self-verify unless a fresh-eye trigger fires\n- STANDARD: if delegation is available and any fresh-eye trigger fires, spawn TWO or THREE WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge`, `routine-execution-simulation`, and optionally `routine-philosophy-alignment`\n- THOROUGH + high-risk or any fresh-eye trigger: if delegation is available, spawn FOUR WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge`, `routine-execution-simulation`, `routine-plan-analysis`, and `routine-philosophy-alignment`\n\nParallel-output synthesis rules:\n- if 2+ validators independently raise the same serious concern, treat it as blocking by default\n- if exactly one validator raises a concern, attempt to understand and resolve it before escalating\n- if validators disagree, record the disagreement explicitly and prefer the safer path when uncertainty remains high\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `sliceVerified`\n- `verificationFindings`\n- `verificationFailed`\n- `verificationApprovalRequired`\n- `verificationRetried`\n- `verificationConcernCount`\n- `verificationConsensusLevel`\n\nRule:\n- if 2+ independent validators raise serious concerns, stop and return to planning or ask the user which path to take",
|
|
260
|
-
"requireConfirmation": {
|
|
261
|
-
"or": [
|
|
262
|
-
{
|
|
263
|
-
"var": "verificationApprovalRequired",
|
|
264
|
-
"equals": true
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"var": "verificationFailed",
|
|
268
|
-
"equals": true
|
|
269
|
-
}
|
|
270
|
-
]
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"id": "phase-7d-drift-and-pr-gate",
|
|
275
|
-
"title": "Drift and PR Gate",
|
|
276
|
-
"prompt": "After a verified slice:\n- compare actual changed scope against the slice plan\n- if the slice drifted, update `implementation_plan.md` immediately and record the reason in notes\n- if `prStrategy = MultiPR`, stop here with a concise PR package for user review before continuing\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `planDrift`\n- `rulesDrift`\n- `changedFilesOutsidePlannedScope`\n- `scopeDriftDetected`\n\nRule:\n- do not rely on markdown sidecar state; notesMarkdown is the durable recap and `implementation_plan.md` is the human artifact",
|
|
277
|
-
"requireConfirmation": {
|
|
278
|
-
"or": [
|
|
279
|
-
{
|
|
280
|
-
"var": "prStrategy",
|
|
281
|
-
"equals": "MultiPR"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"var": "planDrift",
|
|
285
|
-
"equals": true
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
"var": "rulesDrift",
|
|
289
|
-
"equals": true
|
|
290
|
-
}
|
|
291
|
-
]
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
]
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
"id": "phase-8-integration-verification",
|
|
298
|
-
"title": "Phase 8: Integration Verification",
|
|
299
|
-
"runCondition": {
|
|
300
|
-
"var": "taskComplexity",
|
|
301
|
-
"not_equals": "Small"
|
|
302
|
-
},
|
|
303
|
-
"prompt": "Perform final integration verification.\n\nRequired:\n- verify acceptance criteria\n- map invariants to concrete proof (tests, build results, explicit reasoning)\n- run whole-task validation commands\n- identify any invariant violations or regressions\n- confirm the implemented result still aligns with the user's coding philosophy, naming any tensions explicitly\n- review cumulative drift across all slices, not just the current one\n- check whether repeated small compromises added up to a larger pattern problem\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `integrationVerificationPassed`\n- `integrationVerificationFailed`\n- `integrationVerificationFindings`\n- `regressionDetected`\n- `invariantViolations`\n- `crossSliceDriftDetected`",
|
|
304
|
-
"requireConfirmation": {
|
|
305
|
-
"or": [
|
|
306
|
-
{
|
|
307
|
-
"var": "integrationVerificationFailed",
|
|
308
|
-
"equals": true
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
"var": "regressionDetected",
|
|
312
|
-
"equals": true
|
|
313
|
-
}
|
|
314
|
-
]
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
"id": "phase-9-final-handoff",
|
|
319
|
-
"title": "Phase 9: Final Handoff",
|
|
320
|
-
"prompt": "Provide final validation and handoff.\n\nInclude:\n- acceptance criteria status\n- invariant status\n- test/build summary\n- concise PR/MR description draft (why, test plan, rollout notes)\n- follow-up tickets\n- any philosophy tensions accepted intentionally and why\n\nRules:\n- keep the final handoff concise and executive-level\n- `implementation_plan.md` should only be updated if slices or boundaries changed during execution\n- do not auto-merge or push unless the user explicitly asks",
|
|
321
|
-
"requireConfirmation": true
|
|
322
|
-
}
|
|
323
|
-
]
|
|
324
|
-
}
|