@exaudeus/workrail 3.6.1 → 3.7.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/manifest.json
CHANGED
|
@@ -1014,8 +1014,8 @@
|
|
|
1014
1014
|
"bytes": 59
|
|
1015
1015
|
},
|
|
1016
1016
|
"mcp/transports/stdio-entry.js": {
|
|
1017
|
-
"sha256": "
|
|
1018
|
-
"bytes":
|
|
1017
|
+
"sha256": "a8ee8c153aa907b928053d4ddf3fe5d3848caef34c82435bf1c2abd918fd8acd",
|
|
1018
|
+
"bytes": 4989
|
|
1019
1019
|
},
|
|
1020
1020
|
"mcp/transports/transport-mode.d.ts": {
|
|
1021
1021
|
"sha256": "1c59128ab0174bd2a113fff17521e6339ca367f2b8980c2f2c164ec393c10518",
|
|
@@ -35,7 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.startStdioServer = startStdioServer;
|
|
37
37
|
const server_js_1 = require("../server.js");
|
|
38
|
-
const
|
|
38
|
+
const container_js_1 = require("../../di/container.js");
|
|
39
|
+
const tokens_js_1 = require("../../di/tokens.js");
|
|
39
40
|
const INITIAL_ROOTS_TIMEOUT_MS = 1000;
|
|
40
41
|
async function fetchInitialRootsWithTimeout(server) {
|
|
41
42
|
return Promise.race([
|
|
@@ -74,10 +75,31 @@ async function startStdioServer() {
|
|
|
74
75
|
.catch(() => {
|
|
75
76
|
console.error('[Roots] Client does not support roots/list; workspace context will use server CWD fallback');
|
|
76
77
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const shutdownEvents = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ShutdownEvents);
|
|
79
|
+
const processSignals = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessSignals);
|
|
80
|
+
const terminator = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessTerminator);
|
|
81
|
+
processSignals.on('SIGINT', () => shutdownEvents.emit({ kind: 'shutdown_requested', signal: 'SIGINT' }));
|
|
82
|
+
processSignals.on('SIGTERM', () => shutdownEvents.emit({ kind: 'shutdown_requested', signal: 'SIGTERM' }));
|
|
83
|
+
processSignals.on('SIGHUP', () => shutdownEvents.emit({ kind: 'shutdown_requested', signal: 'SIGHUP' }));
|
|
84
|
+
process.stdin.on('end', () => {
|
|
85
|
+
console.error('[MCP] stdin closed, initiating shutdown');
|
|
86
|
+
shutdownEvents.emit({ kind: 'shutdown_requested', signal: 'SIGHUP' });
|
|
87
|
+
});
|
|
88
|
+
let shutdownStarted = false;
|
|
89
|
+
shutdownEvents.onShutdown((event) => {
|
|
90
|
+
if (shutdownStarted)
|
|
91
|
+
return;
|
|
92
|
+
shutdownStarted = true;
|
|
93
|
+
void (async () => {
|
|
94
|
+
try {
|
|
95
|
+
console.error(`[Shutdown] Requested by ${event.signal}. Stopping services...`);
|
|
96
|
+
await ctx.httpServer?.stop();
|
|
97
|
+
terminator.terminate({ kind: 'success' });
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.error('[Shutdown] Error while stopping services:', err);
|
|
101
|
+
terminator.terminate({ kind: 'failure' });
|
|
102
|
+
}
|
|
103
|
+
})();
|
|
81
104
|
});
|
|
82
|
-
(0, shutdown_hooks_js_1.wireStdinShutdown)();
|
|
83
105
|
}
|
package/package.json
CHANGED
package/spec/mcp-api-v1.0.md
CHANGED
|
@@ -175,20 +175,17 @@ Retrieves workflow information with configurable detail level. Supports progress
|
|
|
175
175
|
"jsonrpc": "2.0",
|
|
176
176
|
"id": 2,
|
|
177
177
|
"result": {
|
|
178
|
-
"id": "coding-task-workflow-
|
|
179
|
-
"name": "
|
|
180
|
-
"description": "
|
|
178
|
+
"id": "coding-task-workflow-agentic",
|
|
179
|
+
"name": "Lean Agentic Coding Task Workflow",
|
|
180
|
+
"description": "Lean workflow for executing coding tasks with scoped design, bounded delegation, and explicit verification.",
|
|
181
181
|
"version": "0.1.0",
|
|
182
|
-
"preconditions": ["
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"totalSteps": 8,
|
|
182
|
+
"preconditions": ["Task description is available and any required codebase or artifact access is accessible to the agent."],
|
|
183
|
+
"metaGuidance": ["Stay outcome-focused and evidence-based throughout the task."],
|
|
184
|
+
"totalSteps": 14,
|
|
186
185
|
"firstStep": {
|
|
187
|
-
"id": "phase-0-
|
|
188
|
-
"title": "Phase 0:
|
|
189
|
-
"prompt": "
|
|
190
|
-
"agentRole": "You are a technical assessment specialist...",
|
|
191
|
-
"guidance": ["Be thorough in your analysis"],
|
|
186
|
+
"id": "phase-0-understand-and-classify",
|
|
187
|
+
"title": "Phase 0: Understand & Classify",
|
|
188
|
+
"prompt": "Understand this before you touch anything....",
|
|
192
189
|
"requireConfirmation": true
|
|
193
190
|
}
|
|
194
191
|
}
|
|
@@ -201,14 +198,13 @@ Retrieves workflow information with configurable detail level. Supports progress
|
|
|
201
198
|
"jsonrpc": "2.0",
|
|
202
199
|
"id": 2,
|
|
203
200
|
"result": {
|
|
204
|
-
"id": "coding-task-workflow-
|
|
205
|
-
"name": "
|
|
206
|
-
"description": "
|
|
201
|
+
"id": "coding-task-workflow-agentic",
|
|
202
|
+
"name": "Lean Agentic Coding Task Workflow",
|
|
203
|
+
"description": "Lean workflow for executing coding tasks with scoped design, bounded delegation, and explicit verification.",
|
|
207
204
|
"version": "0.1.0",
|
|
208
|
-
"preconditions": ["
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"totalSteps": 8
|
|
205
|
+
"preconditions": ["Task description is available and any required codebase or artifact access is accessible to the agent."],
|
|
206
|
+
"metaGuidance": ["Stay outcome-focused and evidence-based throughout the task."],
|
|
207
|
+
"totalSteps": 14
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
210
|
```
|
|
@@ -1,521 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "coding-task-workflow-with-loops",
|
|
3
|
-
"name": "Excellent Adaptive Coding Workflow with Devil's Advocate Review",
|
|
4
|
-
"version": "0.8.0",
|
|
5
|
-
"description": "Comprehensive AI coding workflow with bidirectional re-triage, deep analysis, intelligent clarification, devil's advocate review, automation levels, failure bounds, tool fallbacks, and context documentation for production-ready development.",
|
|
6
|
-
|
|
7
|
-
"preconditions": [
|
|
8
|
-
"User has a clear task description (e.g., from Jira, a dev doc, or a BRD).",
|
|
9
|
-
"The agent has access to necessary tools like `grep`, file readers/editors, and a terminal for commands.",
|
|
10
|
-
"The agent has access to the relevant codebase files.",
|
|
11
|
-
"Git repository is recommended for version control and commits (workflow degrades gracefully if unavailable)."
|
|
12
|
-
],
|
|
13
|
-
"metaGuidance": [
|
|
14
|
-
"**FUNCTION DEFINITIONS:** fun updateDecisionLog() = 'Update Decision Log in CONTEXT.md: file paths/ranges, excerpts, why important, outcome impact. Limit 3-5 files/decision.'",
|
|
15
|
-
"fun useTools() = 'Use tools to verify—never guess. Expand file reads to imports/models/interfaces/classes/deps. Trace all dependencies.'",
|
|
16
|
-
"fun createFile(filename) = 'Use edit_file to create/update {filename}. NEVER output full content in chat—only summarize. If fails, request user help & log command.'",
|
|
17
|
-
"fun applyUserRules() = 'Apply & reference user-defined rules, patterns & preferences. Document alignment in Decision Log. Explain rule influence in decisions.'",
|
|
18
|
-
"fun matchPatterns() = 'Use codebase_search/grep to find similar patterns. Reference Decision Log patterns. Match target area unless user rules override.'",
|
|
19
|
-
"fun addResumptionJson(phase) = 'Update CONTEXT.md with: 1) workflow_get (id: coding-task-workflow-with-loops, mode: preview), 2) workflow_next JSON with workflowId, completedSteps up to {phase}, all continue_workflow context keys.'",
|
|
20
|
-
"fun gitCommit(type, msg) = 'If git available: commit with {type}: {msg}. If unavailable: log in CONTEXT.md with timestamp.'",
|
|
21
|
-
"fun verifyImplementation() = '1) Test coverage >80%, 2) Run full test suite, 3) Self-review. Max 2 attempts before failure protocol.'",
|
|
22
|
-
"fun checkAutomation(action) = 'High: auto-{action} if confidence >8. Medium: request confirmation. Low: extra confirmations.'",
|
|
23
|
-
"fun trackProgress(completed, current) = '✅ Completed: {completed}, 🔄 Current: {current}, ⏳ Remaining phases, 📁 Files created.'",
|
|
24
|
-
"This workflow follows the ANALYZE -> CLARIFY -> PREP -> IMPLEMENT -> VERIFY pattern with bidirectional dynamic re-triage capabilities.",
|
|
25
|
-
"Deep codebase analysis occurs early to inform intelligent requirements clarification and all subsequent planning phases.",
|
|
26
|
-
"Dynamic re-triage allows complexity upgrades and safe downgrades based on new insights from analysis and clarifications.",
|
|
27
|
-
"Automation levels (Low/Medium/High) control confirmation requirements to balance autonomy with safety.",
|
|
28
|
-
"Failure bounds prevent resource waste: word limits (2000), step tracking (>20), and escalation protocols.",
|
|
29
|
-
"Context documentation is maintained throughout to enable seamless handoffs between chat sessions, with updates triggered by progress milestones, failures, or user interventions.",
|
|
30
|
-
"For specialized tasks (e.g., debugging), call sub-workflows via workflow_get tool when available.",
|
|
31
|
-
"Limit all documentation outputs to 2000 words max; use bullet points for scannability.",
|
|
32
|
-
"Output markdown content in response; use read_file/edit_file tools to create/update actual files if available, else request user upload.",
|
|
33
|
-
"Align with custom instructions: Use --quiet flags for commands; output to files; prefer workflows for debugging.",
|
|
34
|
-
"Human approval is required after the Devil's Advocate review and before final completion.",
|
|
35
|
-
"Each implementation step should be a small, logical, and committable chunk of work.",
|
|
36
|
-
"The agent should never guess or assume. Always ask for clarification or use tools to find missing information.",
|
|
37
|
-
"If you fail to get test results or other tool outputs on the first attempt, ask the user to run it manually.",
|
|
38
|
-
"Document all user interventions, change requests, and feedback immediately in context documentation to ensure continuity.",
|
|
39
|
-
"**Git Fallback:** If git unavailable/fails, skip commits/branches, log changes in CONTEXT.md with timestamps. Warn at phase-6. Document file mods for manual VC.",
|
|
40
|
-
"**Git Error Handling:** Use run_terminal_cmd for git operations; if fails, output exact command for user manual execution. Never halt workflow due to git unavailability.",
|
|
41
|
-
"Persist variables across steps via context/external state/response metadata. Reset flags (e.g., proposedDowngrade) after confirmation.",
|
|
42
|
-
"Use safe git: feature branches, commit on success, clear messages, revert on fail. Log hashes in CONTEXT.md for traceability.",
|
|
43
|
-
"Maintain existing coding conventions and architectural patterns found in the codebase.",
|
|
44
|
-
"COMMIT STRATEGY: Auto-commit after successful steps for High automation; suggest for Medium/Low. Use conventional format: type(scope): description. Commit at milestones and after verification passes.",
|
|
45
|
-
"When you see function calls like updateDecisionLog() or createFile(spec.md), refer to the function definitions above for full instructions.",
|
|
46
|
-
"For resumption: Include function definitions in CONTEXT.md so new sessions understand these references. Always provide explicit workflow_get and workflow_next instructions.",
|
|
47
|
-
"Auto-advance: after completing each step, immediately get the next step; only pause for explicit requireConfirmation or missing critical inputs."
|
|
48
|
-
],
|
|
49
|
-
"steps": [
|
|
50
|
-
{
|
|
51
|
-
"id": "phase-0-intelligent-triage",
|
|
52
|
-
"title": "Phase 0: Intelligent Task Triage & Complexity Analysis",
|
|
53
|
-
"prompt": "**ANALYZE**: Evaluate the provided task for complexity indicators:\n\n**Small Path Indicators:**\n- Single function changes or minor refactoring\n- Clear bug fixes with obvious solutions\n- Simple configuration changes\n- Low risk of side effects\n- Well-defined, narrow scope\n\n**Medium Path Indicators:**\n- Multi-file changes or moderate features\n- Standard development work\n- Some unknowns but manageable scope\n- Moderate complexity with clear boundaries\n- Requires planning but not architectural analysis\n\n**Large Path Indicators:**\n- Architectural changes or major features\n- Unfamiliar codebase areas\n- High complexity or significant risk\n- Multiple system interactions\n- Requires deep analysis and careful planning\n\n**IMPLEMENT**: \n1. Analyze the task description for the above indicators\n2. Recommend a complexity level (Small/Medium/Large) with detailed reasoning\n3. Set the taskComplexity context variable\n4. Ask user if they agree or want to override your classification\n5. For Medium tasks, ask: \"Would you like optional deep codebase analysis?\" (sets requestDeepAnalysis context variable)\n6. Ask: \"What automation level would you prefer? High (auto-approve low-risk decisions), Medium (standard confirmations), or Low (extra confirmations for safety)?\" (sets automationLevel context variable)\n\n**VERIFY**: Confirm the complexity classification, optional analysis preferences, and automation level before proceeding.",
|
|
54
|
-
"agentRole": "You are a technical assessment specialist with expertise in evaluating software development complexity. Your role is to accurately classify tasks based on technical risk, scope, and architectural impact. Be thorough in your analysis while remaining decisive and clear in your recommendations.",
|
|
55
|
-
"guidance": [
|
|
56
|
-
"Be thorough in your analysis - this determines the entire workflow path",
|
|
57
|
-
"Consider both technical complexity and business risk",
|
|
58
|
-
"When in doubt, err on the side of more thorough analysis (higher complexity)",
|
|
59
|
-
"Always allow human override of your classification",
|
|
60
|
-
"Set these keys in the next `continue_workflow` call's `context` object that will be used for conditional step execution and automation",
|
|
61
|
-
"Automation levels: High=auto-approve confidence >8, Medium=standard, Low=extra confirmations"
|
|
62
|
-
],
|
|
63
|
-
"requireConfirmation": true
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"id": "phase-0b-user-rules-identification",
|
|
67
|
-
"title": "Phase 0b: Identify Relevant User Rules",
|
|
68
|
-
"prompt": "**OBJECTIVE:** Review and explicitly list all user-defined rules, preferences, and patterns that are relevant to this task.\n\n**ACTIONS:**\n1. **Check for user rules** in:\n - User preferences/settings\n - Project documentation\n - Previous instructions or context\n - Memory/knowledge base\n\n2. **Categorize rules by type:**\n - **Architecture:** Design patterns, system structure preferences\n - **Coding Standards:** Naming conventions, code style, formatting\n - **Libraries/Frameworks:** Preferred tools, banned dependencies\n - **Testing:** Test structure, coverage requirements, frameworks\n - **Documentation:** Comment styles, doc generation preferences\n - **Git/Version Control:** Commit message formats, branching strategies\n - **Other:** Any project-specific guidelines\n\n3. **Filter for relevance:** Only list rules that apply to this specific task\n\n4. **Create explicit list:** Format as a clear, numbered list that will be referenced throughout the workflow\n\n**OUTPUT EXAMPLE:**\n```\nRelevant User Rules for this task:\n1. Architecture: Use dependency injection pattern\n2. Architecture: Prefer immutability patterns\n3. Coding: Use camelCase for functions, PascalCase for classes\n4. Libraries: Prefer native solutions over external dependencies\n5. Testing: Minimum 80% coverage, use Jest framework\n6. Git: Use conventional commits format\n```\n\n**Set these as `userRules` context variable for reference in all subsequent steps.**",
|
|
69
|
-
"agentRole": "You are a meticulous requirements analyst focused on capturing and clarifying all user-defined constraints and preferences. Your role is to ensure no important rule or preference is overlooked.",
|
|
70
|
-
"guidance": [
|
|
71
|
-
"This step runs for ALL complexity levels (Small, Medium, Large)",
|
|
72
|
-
"Be thorough but concise - capture the essence of each rule",
|
|
73
|
-
"If no explicit rules exist, note that and proceed with standard practices",
|
|
74
|
-
"These rules will be referenced throughout the workflow",
|
|
75
|
-
"Update this list if new rules are discovered during the workflow"
|
|
76
|
-
],
|
|
77
|
-
"requireConfirmation": false
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"id": "phase-0c-overview-gathering",
|
|
81
|
-
"runCondition": {
|
|
82
|
-
"or": [
|
|
83
|
-
{"var": "taskComplexity", "equals": "Large"},
|
|
84
|
-
{
|
|
85
|
-
"and": [
|
|
86
|
-
{"var": "taskComplexity", "equals": "Medium"},
|
|
87
|
-
{"var": "requestDeepAnalysis", "equals": true}
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
"title": "Phase 0c: High-Level Architecture Overview",
|
|
93
|
-
"prompt": "Before deep analysis, gather a high-level overview of the codebase architecture to guide subsequent focused explorations.\n\n**OVERVIEW TASKS:**\n1. **Project Structure:** Use `list_dir` to map the directory structure and identify key areas\n2. **Entry Points:** Use `grep_search` and `read_file` to locate and understand main entry points (e.g., main.ts, index.js, app.js)\n3. **Configuration:** Read package.json, tsconfig.json, or similar files to understand dependencies and setup\n4. **Key Patterns:** Use `grep_search` to identify architectural patterns (e.g., dependency injection, MVC, microservices)\n5. **Task Relevance:** Note which modules/areas seem most relevant to the current task\n\n**OUTPUT REQUIREMENTS:**\n- Summarize the overall architecture in 500 words or less\n- Identify 3-5 key areas that warrant deeper investigation for this task\n- Note any discovered patterns that align with or conflict with user rules\n- Set `architectureOverview` context variable with your findings\n\n**Start the Decision Log:** createFile(CONTEXT.md) and updateDecisionLog() with top 3-5 files, why important, how they'll guide analysis.\n\n**Remember:** useTools() for every architectural insight.",
|
|
94
|
-
"agentRole": "You are an architectural scout mapping the codebase landscape. Your role is to quickly identify the project's structure, key patterns, and areas relevant to the task at hand. You excel at using tools efficiently to build a mental map that will guide deeper exploration.",
|
|
95
|
-
"guidance": [
|
|
96
|
-
"This step provides context for more focused deep dives",
|
|
97
|
-
"Use tools liberally but efficiently - broad strokes first",
|
|
98
|
-
"The overview should inform where to focus in subsequent analysis",
|
|
99
|
-
"Start the Decision Log that will be maintained throughout the workflow",
|
|
100
|
-
"Note alignment/conflicts with user rules from the start"
|
|
101
|
-
],
|
|
102
|
-
"requireConfirmation": false
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"id": "phase-small-prep",
|
|
106
|
-
"runCondition": {"var": "taskComplexity", "equals": "Small"},
|
|
107
|
-
"title": "Phase Small: Preparation and Simplified Execution",
|
|
108
|
-
"prompt": "For this Small task, perform quick preparation before implementation:\n\n**QUICK PREP:**\n1. **Verify Assumptions:** Use tools (e.g., list_dir, grep_search) to confirm:\n - Target files exist where expected\n - Functions/components mentioned are present\n - Dependencies are available\n\n2. **Complexity Check:** If you discover:\n - Unexpected dependencies or architectural complexity\n - Multiple integration points\n - Significant testing requirements\n **ESCALATE:** Recommend upgrading via re-triage (set proposedUpgrade=true) and pause for user confirmation.\n\n3. **Simple Plan:** Otherwise, create a brief plan with 2-5 discrete steps:\n - What will be changed\n - How it will be tested\n - Expected outcomes\n\n**ESCAPE HATCH:** If complexities arise during this prep, recommend upgrading to Medium/Large via phase-2b re-triage rather than proceeding with insufficient analysis.\n\n**Report your findings as a simple checklist:**\nChecklist example:\n- [✅] File `src/utils.js` exists (verified via list_dir)\n- [✅] Function `calculateTotal()` found (verified via grep_search)\n- [✅] Dependencies confirmed in package.json\n- [✅] Simple 3-step plan created\n\nProceed to implementation if all checks pass, otherwise recommend re-triage.",
|
|
109
|
-
"agentRole": "You are an efficient task executor specializing in low-complexity work. Your strength is quickly validating assumptions and creating lightweight plans while maintaining awareness of when tasks exceed their initial scope. You excel at recognizing when to escalate rather than proceeding with insufficient analysis.",
|
|
110
|
-
"guidance": [
|
|
111
|
-
"This is a mini-version of PREP->IMPLEMENT->VERIFY for Small tasks",
|
|
112
|
-
"Use available tools to verify basic assumptions quickly",
|
|
113
|
-
"Escape to phase-2b re-triage if complexities are discovered",
|
|
114
|
-
"Keep the plan simple but actionable",
|
|
115
|
-
"Better to escalate than to proceed with insufficient preparation"
|
|
116
|
-
],
|
|
117
|
-
"requireConfirmation": false
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"id": "phase-small-implement",
|
|
121
|
-
"runCondition": {"var": "taskComplexity", "equals": "Small"},
|
|
122
|
-
"title": "Phase Small: Simple Implementation",
|
|
123
|
-
"prompt": "Execute the simple plan you created in the preparation phase.\n\n**IMPLEMENTATION:**\n1. Review user rules from Phase 0b\n2. Work through your 2-5 step plan\n3. applyUserRules() in all changes\n4. Write basic tests as needed\n5. Verify each change works\n\n**GUIDELINES:**\n- matchPatterns() from codebase\n- Keep changes focused and minimal\n- If complexity emerges, recommend upgrade to Medium/Large\n- gitCommit(type, message) after success\n\n**VERIFICATION:**\n- Run relevant tests\n- Quick self-review\n- Ensure objectives met\n- Confirm applyUserRules()\n\nThis is streamlined for genuinely simple tasks.",
|
|
124
|
-
"agentRole": "You are implementing a simple, low-risk task. Execute efficiently while maintaining quality. If unexpected complexity arises, escalate rather than proceeding with inadequate rigor.",
|
|
125
|
-
"guidance": [
|
|
126
|
-
"Execute the plan from phase-small-prep",
|
|
127
|
-
"Keep implementation lightweight but correct",
|
|
128
|
-
"Escalate if complexity exceeds Small task scope",
|
|
129
|
-
"Single commit at the end for all changes"
|
|
130
|
-
],
|
|
131
|
-
"requireConfirmation": false
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"id": "phase-1-multi-analysis",
|
|
135
|
-
"type": "loop",
|
|
136
|
-
"title": "Phase 1: Multi-Step Focused Codebase Analysis",
|
|
137
|
-
"runCondition": {
|
|
138
|
-
"or": [
|
|
139
|
-
{"var": "taskComplexity", "equals": "Large"},
|
|
140
|
-
{
|
|
141
|
-
"and": [
|
|
142
|
-
{"var": "taskComplexity", "equals": "Medium"},
|
|
143
|
-
{"var": "requestDeepAnalysis", "equals": true}
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
},
|
|
148
|
-
"loop": {
|
|
149
|
-
"type": "for",
|
|
150
|
-
"count": 4,
|
|
151
|
-
"maxIterations": 4,
|
|
152
|
-
"iterationVar": "analysisStep"
|
|
153
|
-
},
|
|
154
|
-
"body": [
|
|
155
|
-
{
|
|
156
|
-
"id": "phase-1-step-structure",
|
|
157
|
-
"title": "Analysis Step 1/4: Structure",
|
|
158
|
-
"prompt": "**STEP 1: STRUCTURAL MAPPING**\\n\\nBuild on phase-0c overview, dive deeper into structure:\\n\\n1. Module organization (packages/services)\\n2. Core components (controllers/services/models)\\n3. Architectural patterns from overview\\n4. File naming conventions\\n5. Code organization\\n\\n**Actions:** useTools() with list_dir, grep_search (class/interface/export), read 2-3 files\\n\\n**Output (400 words):**\\n- Structure summary\\n- User rules alignment\\n- Areas for next steps\\n\\nupdateDecisionLog() with 3-5 key files",
|
|
159
|
-
"agentRole": "You are conducting focused analysis step 1 of 4. Your expertise lies in understanding code structure and organization. Use tools extensively and never make assumptions.",
|
|
160
|
-
"guidance": [
|
|
161
|
-
"This is step 1 of a 4-step analysis process",
|
|
162
|
-
"Each step builds on the previous findings",
|
|
163
|
-
"Use tools liberally - verify everything",
|
|
164
|
-
"Update the Decision Log with key discoveries",
|
|
165
|
-
"Respect word limits to prevent context bloat",
|
|
166
|
-
"Note alignment/conflicts with user rules"
|
|
167
|
-
],
|
|
168
|
-
"runCondition": {"var": "analysisStep", "equals": 1},
|
|
169
|
-
"requireConfirmation": false
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"id": "phase-1-step-modules",
|
|
173
|
-
"title": "Analysis Step 2/4: Modules",
|
|
174
|
-
"prompt": "**STEP 2: TASK-RELEVANT MODULES**\\n\\nFocus on task-specific modules:\\n\\n1. Target areas from mapping\\n2. Core business logic\\n3. Data models (interfaces/types/schemas)\\n4. API contracts\\n5. Pattern implementation\\n\\n**Actions:** useTools() and matchPatterns() with codebase_search, read complete files (with imports), trace flows\\n\\n**Output (400 words):**\\n- Module responsibilities\\n- Patterns to match\\n- Integration points\\n\\nupdateDecisionLog() with core logic files",
|
|
175
|
-
"agentRole": "You are conducting focused analysis step 2 of 4. Your expertise lies in identifying and analyzing task-specific components. Use tools extensively and never make assumptions.",
|
|
176
|
-
"guidance": [
|
|
177
|
-
"This is step 2 of a 4-step analysis process",
|
|
178
|
-
"Each step builds on the previous findings",
|
|
179
|
-
"Use tools liberally - verify everything",
|
|
180
|
-
"Update the Decision Log with key discoveries",
|
|
181
|
-
"Respect word limits to prevent context bloat",
|
|
182
|
-
"Note alignment/conflicts with user rules"
|
|
183
|
-
],
|
|
184
|
-
"runCondition": {"var": "analysisStep", "equals": 2},
|
|
185
|
-
"requireConfirmation": false
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"id": "phase-1-step-dependencies",
|
|
189
|
-
"title": "Analysis Step 3/4: Dependencies",
|
|
190
|
-
"prompt": "**STEP 3: DEPENDENCIES & FLOWS**\\n\\nTrace dependencies and execution:\\n\\n1. Import mapping\\n2. Data flow tracing\\n3. Integration points\\n4. Side effects\\n5. Testing patterns\\n\\n**Actions:** useTools() to follow imports, find test files, trace error handling\\n\\n**Output (400 words):**\\n- Dependency map\\n- Integration challenges\\n- Testing strategies\\n- Risk indicators\\n\\nupdateDecisionLog() with dependencies and test approaches",
|
|
191
|
-
"agentRole": "You are conducting focused analysis step 3 of 4. Your expertise lies in tracing dependencies and system flows. Use tools extensively and never make assumptions.",
|
|
192
|
-
"guidance": [
|
|
193
|
-
"This is step 3 of a 4-step analysis process",
|
|
194
|
-
"Each step builds on the previous findings",
|
|
195
|
-
"Use tools liberally - verify everything",
|
|
196
|
-
"Update the Decision Log with key discoveries",
|
|
197
|
-
"Respect word limits to prevent context bloat",
|
|
198
|
-
"Note alignment/conflicts with user rules"
|
|
199
|
-
],
|
|
200
|
-
"runCondition": {"var": "analysisStep", "equals": 3},
|
|
201
|
-
"requireConfirmation": false
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"id": "phase-1-step-patterns",
|
|
205
|
-
"title": "Analysis Step 4/4: Patterns",
|
|
206
|
-
"prompt": "**STEP 4: PATTERN DISCOVERY**\\n\\nIdentify established patterns relevant to the task type. Analyze if this is a pattern-heavy task (tests, telemetry, logging, APIs, UI components).\\n\\n**Actions:** useTools() extensively - codebase_search for concepts, grep_search for pattern markers, read_file for full examples\\n\\n**Output (400 words):**\\n- Pattern types discovered\\n- Reference implementations (with file paths)\\n- Key conventions to follow\\n- Pattern alignment recommendations\\n\\nupdateDecisionLog() with pattern templates and reference files",
|
|
207
|
-
"agentRole": "You are conducting focused analysis step 4 of 4. Your expertise lies in discovering and documenting established implementation patterns for the specific task type. Use tools extensively and never make assumptions.",
|
|
208
|
-
"guidance": [
|
|
209
|
-
"This is step 4 of a 4-step analysis process",
|
|
210
|
-
"Each step builds on the previous findings",
|
|
211
|
-
"Use tools liberally - verify everything",
|
|
212
|
-
"Update the Decision Log with key discoveries",
|
|
213
|
-
"Respect word limits to prevent context bloat",
|
|
214
|
-
"Note alignment/conflicts with user rules",
|
|
215
|
-
"TASK TYPE ANALYSIS: Determine if this is adding tests (find test utilities, mocking patterns), telemetry/analytics (find tracking implementations, event schemas), logging/monitoring (find log formats, monitoring integrations), API endpoints (find route patterns, validation, error handling), UI components (find component patterns, styling conventions), or other pattern-heavy work",
|
|
216
|
-
"PATTERN SEARCH STRATEGY: Use codebase_search with queries like 'How is [telemetry|testing|logging|API] implemented?'. Use grep_search for pattern markers (e.g., track, analytics, test, describe, log). Find 3-5 reference implementations similar to your task. Look for shared utilities, helpers, or base classes. Check for pattern documentation in README or docs",
|
|
217
|
-
"PATTERN EXTRACTION: Document file structure and naming conventions, common imports and dependencies, implementation approach (functional vs class-based), error handling patterns, configuration patterns, and testing approach for this type of feature",
|
|
218
|
-
"PATTERN VALIDATION: List discovered patterns with file references. Note any conflicting patterns or multiple approaches. Ask user: 'Found these pattern examples: [list files]. Should I follow these patterns, or are there other preferred examples?' Set establishedPatterns context variable",
|
|
219
|
-
"FOCUS ON REUSABILITY: Patterns help avoid reinventing the wheel. Look especially for utility functions, base classes, shared components, or established conventions that should be followed"
|
|
220
|
-
],
|
|
221
|
-
"runCondition": {"var": "analysisStep", "equals": 4},
|
|
222
|
-
"requireConfirmation": false
|
|
223
|
-
}
|
|
224
|
-
],
|
|
225
|
-
"requireConfirmation": false
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"id": "phase-2-informed-clarification",
|
|
229
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
230
|
-
"title": "Phase 2: Informed Requirements Clarification",
|
|
231
|
-
"prompt": "Based on your deep understanding of the codebase from Phase 1, you are now in a position to ask intelligent, targeted questions to clarify the requirements. Your codebase analysis may have revealed ambiguities, missing details, or potential issues that weren't apparent from the initial task description.\n\n**Your goal is to ask specific, informed questions that will lead to a clear, unambiguous specification. Consider:**\n\n1. **Technical Ambiguities:** Are there aspects of the task that could be implemented in multiple ways given the existing architecture? Which approach is preferred?\n\n2. **Integration Questions:** How should the new functionality integrate with existing systems, APIs, or workflows you discovered?\n\n3. **Scope Boundaries:** Given the existing codebase structure, what should be included/excluded from this task?\n\n4. **Convention Alignment:** Should the implementation follow existing patterns you observed, or is this an opportunity to establish new patterns?\n\n5. **Edge Cases:** What should happen in edge cases that are now apparent given the existing data models and business logic?\n\n6. **Dependencies:** Are there existing components, services, or data that the task should leverage or avoid?\n\n7. **Testing Strategy:** Given the existing test patterns, what level and type of testing is expected?\n\n8. **Complexity Concerns:** Based on your analysis, are there risk factors that might indicate this task is more complex than initially classified?\n\n**Present 3-7 well-formulated questions that will significantly improve the clarity and implementability of the final specification.**",
|
|
232
|
-
"agentRole": "You are a senior business analyst and technical consultant specializing in requirements elicitation. Your expertise lies in translating deep technical understanding into precise business questions that eliminate ambiguity and prevent costly rework. You excel at identifying the critical gaps between initial requirements and implementation reality.",
|
|
233
|
-
"guidance": [
|
|
234
|
-
"This step is automatically skipped for Small tasks based on complexity classification",
|
|
235
|
-
"Ask questions that could only be formulated after understanding the codebase",
|
|
236
|
-
"Focus on questions that will significantly impact the specification and implementation approach",
|
|
237
|
-
"Avoid generic questions - make them specific to the codebase and task at hand",
|
|
238
|
-
"Present questions in a clear, prioritized manner",
|
|
239
|
-
"Include questions about potential complexity changes based on your analysis"
|
|
240
|
-
],
|
|
241
|
-
"requireConfirmation": {
|
|
242
|
-
"or": [
|
|
243
|
-
{"var": "automationLevel", "equals": "Low"},
|
|
244
|
-
{"var": "automationLevel", "equals": "Medium"}
|
|
245
|
-
]
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
"id": "phase-2b-dynamic-retriage",
|
|
250
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
251
|
-
"title": "Phase 2b: Dynamic Complexity Re-Triage",
|
|
252
|
-
"prompt": "Based on your codebase analysis and requirements clarification, re-evaluate the initial complexity classification. New insights may have revealed:\n\n- Hidden architectural dependencies\n- Unforeseen integration complexities\n- Risk factors not apparent in the initial description\n- Scope expansion based on clarified requirements\n- Technical constraints that increase difficulty\n- **OR existing utilities/patterns that simplify the task**\n\n**EVALUATE:**\n1. Review the original taskComplexity classification\n2. Consider new information from codebase analysis and clarifications\n3. Assess if the complexity should be upgraded (e.g., Medium → Large) OR downgraded (e.g., Large → Medium)\n4. Provide detailed reasoning for any recommended changes\n\n**If you recommend upgrading complexity:**\n- Clearly explain what new insights led to this recommendation\n- Describe the additional risks or complexity discovered\n- Justify why the higher complexity path would be beneficial\n- Ask for user confirmation to change the taskComplexity context variable\n\n**If you recommend downgrading complexity:**\n- Set proposedDowngrade context variable to true\n- Clearly explain what existing utilities, patterns, or simplified scope led to this recommendation\n- Provide evidence of reduced risk and scope\n- Require user confirmation and evidence of reduced risk unless automationLevel=High and confidence >8\n- Justify why the lower complexity path is safe and appropriate\n\n**If current classification remains appropriate:**\n- Briefly confirm the classification is still accurate\n- Proceed without requesting changes\n\n**Note:** Both upgrades and downgrades are allowed with proper justification to ensure optimal workflow efficiency.",
|
|
253
|
-
"agentRole": "You are a senior technical risk assessor specializing in project complexity evaluation. Your expertise lies in identifying hidden risks and complexity factors that emerge during analysis phases, as well as recognizing when tasks are simpler than initially assessed. You excel at making decisive recommendations to ensure projects follow the appropriate rigor level.",
|
|
254
|
-
"guidance": [
|
|
255
|
-
"This step allows both upgrading and downgrading complexity based on new insights",
|
|
256
|
-
"Only change complexity if there are clear, justifiable reasons",
|
|
257
|
-
"For downgrades, set proposedDowngrade flag and require explicit user approval unless automationLevel=High and confidence >8",
|
|
258
|
-
"Be specific about what new information led to the reassessment",
|
|
259
|
-
"If changing complexity, the workflow will continue with the new complexity path",
|
|
260
|
-
"Downgrades must be justified with evidence of reduced risk/scope",
|
|
261
|
-
"Reset proposedDowngrade to false after user confirmation or rejection"
|
|
262
|
-
],
|
|
263
|
-
"requireConfirmation": {
|
|
264
|
-
"or": [
|
|
265
|
-
{"var": "automationLevel", "equals": "Low"},
|
|
266
|
-
{"var": "automationLevel", "equals": "Medium"},
|
|
267
|
-
{"var": "proposedDowngrade", "equals": true}
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"id": "phase-3-specification",
|
|
273
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
274
|
-
"title": "Phase 3: Create Specification",
|
|
275
|
-
"prompt": "Create a precise specification from Phase 1 analysis, Phase 2 clarifications, and any re-triage insights.\n\n**Spec Sections:**\n- Task Description [from clarifications]\n- Key Objectives & Success Criteria\n- Scope and Constraints\n\n**Must Include:**\n- Existing patterns/conventions from analysis\n- System integration approach\n- Impact on components/workflows\n- Testing/quality alignment\n- Phase 2 decisions\n- Complexity insights\n- applyUserRules()\n- matchPatterns()\n\n**Actions:**\n- createFile(spec.md)\n- updateDecisionLog()\n- Sanity check complexity level",
|
|
276
|
-
"agentRole": "You are a senior business analyst and technical lead specializing in requirement gathering and scope definition. Your goal is to produce a clear, comprehensive `spec.md` file that leverages your deep understanding of the existing codebase and incorporates all clarified requirements to serve as an unambiguous foundation for design and implementation.",
|
|
277
|
-
"guidance": [
|
|
278
|
-
"Provide a complete task description based on all previous analysis and clarifications",
|
|
279
|
-
"The output of this step should be the content for `spec.md`",
|
|
280
|
-
"This step is automatically skipped for Small tasks based on the complexity classification",
|
|
281
|
-
"Leverage your codebase analysis and clarifications to ensure the specification is precise and implementable",
|
|
282
|
-
"Reference specific decisions made during the clarification phase",
|
|
283
|
-
"Consider any complexity changes from the re-triage phase"
|
|
284
|
-
],
|
|
285
|
-
"requireConfirmation": false
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
"id": "phase-3b-create-context-doc",
|
|
289
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
290
|
-
"title": "Phase 3b: Create Context Documentation",
|
|
291
|
-
"prompt": "Create CONTEXT.md capturing workflow progress. High automation: 1000 words; else 2000.\n\n**Include Sections:**\n\n1. ORIGINAL TASK CONTEXT\n- Task description, complexity level, re-triage decisions, automation level\n\n2. USER RULES AND PREFERENCES\n- Rules from Phase 0b, task impact, new discoveries\n\n3. CODEBASE ANALYSIS SUMMARY\n- Patterns, components, testing, dependencies, complexity indicators\n\n4. DECISION LOG\n- Phase 0c: Files/patterns/impact\n- Phase 1: Key files per sub-step\n- Phase 2: Clarification decisions\n- Phase 3: Spec influences\n\n5. CLARIFICATIONS AND DECISIONS\n- Q&A, resolved ambiguities, scope, technical approach\n\n6. SPECIFICATION SUMMARY\n- Objectives, constraints, design principles, integration\n\n7. WORKFLOW PROGRESS\n- trackProgress(0-3b, Phase 4)\n- ⏳ Remaining: 4-7\n- 📋 Context vars set\n\n8. RESUMPTION INSTRUCTIONS\n**How to Resume:**\n1. Call workflow_get with id: \"coding-task-workflow-with-loops\", mode: \"preview\"\n2. Call workflow_next with the JSON from addResumptionJson(phase-3b)\n3. Include function definitions from metaGuidance for reference\n\n9. HANDOFF INSTRUCTIONS\n- Files to attach: spec.md, CONTEXT.md\n- Key files from Decision Log\n- Critical decisions\n\ncreateFile(CONTEXT.md)",
|
|
292
|
-
"agentRole": "You are a meticulous technical documentation specialist with expertise in creating comprehensive project handoff documents. Your role is to capture all critical context in a way that enables seamless continuity across different team members or chat sessions. You excel at synthesizing complex technical information into clear, actionable documentation.",
|
|
293
|
-
"guidance": [
|
|
294
|
-
"This step is automatically skipped for Small tasks",
|
|
295
|
-
"Create a document that would allow a completely new agent to pick up the work seamlessly",
|
|
296
|
-
"Include specific file paths, component names, and technical details discovered",
|
|
297
|
-
"Reference all key decisions made in previous phases",
|
|
298
|
-
"Make the progress tracking section very clear for workflow continuation",
|
|
299
|
-
"Consider this document as critical as the specification itself",
|
|
300
|
-
"Use bullet points for scannability; limit to word count based on automation level"
|
|
301
|
-
],
|
|
302
|
-
"requireConfirmation": false
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"id": "phase-4-architectural-design",
|
|
306
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
307
|
-
"title": "Phase 4: Architectural Design",
|
|
308
|
-
"prompt": "Create architectural design from spec.md, analysis, and requirements.\n\n**Design Sections:**\n1. High-Level Approach (builds on patterns)\n2. Component Breakdown (new/modified)\n3. Data Models (schemas/structures)\n4. API Contracts (follow conventions)\n5. Key Interactions (components diagram)\n6. Integration Points\n7. Phase 2 Decisions Impact\n8. Complexity Factors\n9. Pattern Alignment (cite files)\n10. applyUserRules()\n\n**Actions:**\n- matchPatterns()\n- useTools()\n- createFile(design.md)\n- updateDecisionLog()",
|
|
309
|
-
"agentRole": "You are a software architect specializing in translating business requirements into robust and scalable technical designs that seamlessly integrate with existing systems. Your task is to create a clear and comprehensive `design.md` that leverages existing architectural patterns while introducing necessary changes and incorporating all clarified requirements.",
|
|
310
|
-
"guidance": [
|
|
311
|
-
"The `design.md` should be detailed enough for an engineer to write an implementation plan from it.",
|
|
312
|
-
"This step is automatically skipped for Small tasks.",
|
|
313
|
-
"Ensure the design builds upon and aligns with the existing codebase architecture identified in your analysis",
|
|
314
|
-
"Reference specific clarification decisions that influenced the design",
|
|
315
|
-
"Consider complexity factors identified during re-triage"
|
|
316
|
-
],
|
|
317
|
-
"requireConfirmation": false
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
"id": "phase-5-planning",
|
|
321
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
322
|
-
"title": "Phase 5: Create Detailed Implementation Plan",
|
|
323
|
-
"prompt": "Create detailed implementation_plan.md from spec.md, design.md, analysis.\n\n**Plan Sections:**\n1. Goal Clarification - understanding from spec/clarifications\n2. applyUserRules() - how plan follows user patterns\n3. Pattern Matching Strategy - existing code templates per step\n4. Impact Assessment - affected parts, deps, risks\n5. Implementation Strategy - discrete steps with rationale/I/O\n6. Testing Strategy - follow existing patterns (cite files)\n7. Failure Handling - test fails, tool issues\n8. Final Review Checklist - completion criteria\n\n**Actions:**\n- matchPatterns() for each step\n- useTools() to find examples\n- createFile(implementation_plan.md)\n- updateDecisionLog()",
|
|
324
|
-
"agentRole": "You are an experienced technical architect and project planner with expertise in breaking down complex development tasks into manageable, logical phases. Your strength is creating detailed, actionable plans that minimize risk while maximizing development efficiency and code quality, all while working within existing system constraints and incorporating all clarified requirements.",
|
|
325
|
-
"guidance": [
|
|
326
|
-
"The agent will now proceed to critique its own plan in the next step. Withhold your final approval until after that critique.",
|
|
327
|
-
"This step is automatically skipped for Small tasks based on the complexity classification",
|
|
328
|
-
"Leverage your codebase analysis and clarified requirements to ensure the plan works within existing architectural constraints",
|
|
329
|
-
"Reference how clarified requirements influenced the planning decisions",
|
|
330
|
-
"Include explicit failure handling protocols and quantitative metrics where applicable"
|
|
331
|
-
],
|
|
332
|
-
"requireConfirmation": false
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
"id": "phase-5b-devil-advocate-review",
|
|
336
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
337
|
-
"title": "Phase 5b: Devil's Advocate Plan Review",
|
|
338
|
-
"prompt": "Your task is to perform a 'devil's advocate' review of the implementation plan you just created in Phase 5. The objective is not to discard the plan, but to rigorously stress-test it and make it stronger. Your critique must be balanced and evidence-based.\n\nAnalyze the plan through the following lenses. For every point you make (positive or negative), you must cite specific evidence from the plan, the codebase analysis, clarified requirements, or the initial task description.\n\n1. **Hidden Assumptions:** What assumptions does this plan make about the codebase, user behavior, or existing data that might be incorrect?\n2. **Potential Risks & Unintended Side Effects:** What is the biggest risk of this plan? Could it impact performance, security, or another feature in a negative way?\n3. **Overlooked Complexities or Edge Cases:** What specific edge cases (e.g., empty states, invalid inputs, race conditions) does the plan fail to explicitly address?\n4. **Alternative Approaches:** Briefly propose at least one alternative technical approach. What are the pros and cons of the alternative versus the current plan?\n5. **Plan Strengths:** To ensure a balanced review, explicitly state the strongest parts of the plan. What aspects are well-thought-out and likely to succeed?\n\nConclude with a balanced summary. If you found issues, provide concrete suggestions for how to amend the plan. Finally, **set the confidenceScore variable to your 1-10 rating** for the plan *if* your suggestions are implemented.",
|
|
339
|
-
"agentRole": "You are a skeptical but fair senior principal engineer with 15+ years of experience in critical system development. Your role is to identify potential failure points, hidden assumptions, and overlooked complexities in technical plans. You excel at constructive criticism that strengthens plans rather than destroys them. Approach this with the rigor of a senior engineer reviewing a mission-critical system design.",
|
|
340
|
-
"guidance": [
|
|
341
|
-
"This is a critical thinking step. The agent's goal is to find weaknesses in its *own* prior work to improve it. This is a sign of a high-functioning process.",
|
|
342
|
-
"Evaluate the agent's points. Not all 'risks' it identifies may be realistic. Use your judgment to decide which suggestions to incorporate into the plan.",
|
|
343
|
-
"After this review, you can ask the agent to create a final, amended version of the plan before you give your final approval to proceed with implementation.",
|
|
344
|
-
"This step is automatically skipped for Small tasks based on the complexity classification",
|
|
345
|
-
"CRITICAL: Set confidenceScore variable (1-10) in your response",
|
|
346
|
-
"For automationLevel=High with confidenceScore >8, auto-approve if no critical risks identified"
|
|
347
|
-
],
|
|
348
|
-
"requireConfirmation": {
|
|
349
|
-
"or": [
|
|
350
|
-
{"var": "automationLevel", "equals": "Low"},
|
|
351
|
-
{"var": "automationLevel", "equals": "Medium"},
|
|
352
|
-
{"and": [
|
|
353
|
-
{"var": "automationLevel", "equals": "High"},
|
|
354
|
-
{"var": "confidenceScore", "lt": 8}
|
|
355
|
-
]}
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
"id": "phase-5c-finalize-plan",
|
|
361
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
362
|
-
"title": "Phase 5c: Finalize Implementation Plan",
|
|
363
|
-
"prompt": "Review initial `implementation_plan.md` from Phase 5 and Devil's Advocate critique from Phase 5b. Create final, consolidated plan incorporating valid feedback.\n\n**Output:**\n- Final implementation_plan.md\n- List valuable but out-of-scope suggestions as future tickets\n\ncreateFile(implementation_plan.md) with final version.",
|
|
364
|
-
"agentRole": "You are a pragmatic technical project manager. Your goal is to synthesize feedback, make decisive trade-offs, and produce a final, actionable plan that is ready for execution.",
|
|
365
|
-
"guidance": [
|
|
366
|
-
"This is the final plan that will be executed. Ensure it is clear, actionable, and reflects the best path forward.",
|
|
367
|
-
"The list of out-of-scope items helps capture valuable ideas without derailing the current task."
|
|
368
|
-
],
|
|
369
|
-
"requireConfirmation": {
|
|
370
|
-
"or": [
|
|
371
|
-
{"var": "automationLevel", "equals": "Low"},
|
|
372
|
-
{"var": "automationLevel", "equals": "Medium"}
|
|
373
|
-
]
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
"id": "phase-5d-plan-sanity-check",
|
|
378
|
-
"runCondition": { "var": "taskComplexity", "not_equals": "Small" },
|
|
379
|
-
"title": "Phase 5d: Plan Sanity Check",
|
|
380
|
-
"prompt": "Before starting implementation, perform a sanity check on the final `implementation_plan.md`. Your goal is to use your tools to quickly verify the plan's core assumptions against the current codebase. This is not a deep analysis, but a quick check for obvious errors.\n\nFor the key files, functions, classes, or APIs mentioned in the plan, perform the following checks:\n1. **Existence Check:** Use tools like `grep_search` or `list_dir` to confirm that the files and primary functions/classes you plan to modify actually exist where you expect them to.\n2. **Signature/API Check (if applicable):** Briefly check the function signatures or API endpoints you intend to use. Do they match the plan's assumptions? For example, if the plan assumes a function takes two arguments, verify that.\n3. **Dependency Check:** If the plan relies on a specific library or module being available, quickly verify its presence (e.g., check `package.json`, `requirements.txt`, etc.).\n\n**If tools are unavailable, note fallback and proceed with manual verification request.**\n\n**Report your findings as a simple checklist:**\nChecklist example:\n- [✅] File `src/example.js` exists (verified via list_dir)\n- [✅] Function `calculateTotal()` found in `src/utils.js` (verified via grep_search)\n- [✅] Dependency `moment` is listed in `package.json`\n\nIf any check fails (❌), briefly explain the discrepancy and ask the user if the plan needs to be revised before proceeding.",
|
|
381
|
-
"agentRole": "You are a pragmatic QA engineer double-checking a plan before the development team starts work. Your job is to be quick, efficient, and focused on verifying concrete facts using tools. You are not re-evaluating the plan's logic, only its tangible connection to the codebase.",
|
|
382
|
-
"guidance": [
|
|
383
|
-
"This is a quick verification step, not a full re-analysis. The goal is to catch glaring errors before implementation begins.",
|
|
384
|
-
"Use your code-browsing tools (grep_search, list_dir) to validate the plan's assumptions.",
|
|
385
|
-
"If tools fail, fall back to alternatives like file_search or request manual verification",
|
|
386
|
-
"If a check fails, it's crucial to pause and get human confirmation before proceeding with a potentially flawed plan."
|
|
387
|
-
],
|
|
388
|
-
"requireConfirmation": false
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
"id": "phase-5e-update-context-doc",
|
|
392
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
393
|
-
"title": "Phase 5e: Update Context Documentation with Final Plans",
|
|
394
|
-
"prompt": "Update CONTEXT.md with Phases 4-5 work. checkAutomation(summary): 500 words for High, else full.\n\n**Add/Update Sections:**\n\n4. DECISION LOG (EXPANDED)\n- Phase 4 Design: Files/patterns shaping architecture\n- Phase 5 Planning: Code examples for implementation\n- Pattern Matches: Template files\n\n5. ARCHITECTURAL DESIGN SUMMARY\n- Approach & rationale\n- Components added/modified\n- Integration points\n- Design decisions\n- Pattern alignment\n\n6. IMPLEMENTATION PLAN OVERVIEW\n- Goals & success criteria\n- Strategy overview\n- Risks & mitigation\n- Testing approach\n- Failure handling\n\n7. DEVILS ADVOCATE INSIGHTS\n- Concerns addressed\n- Plan improvements\n- Confidence score\n- Out-of-scope items\n\n8. WORKFLOW PROGRESS\n- trackProgress(0-5e, Implementation)\n- ⏳ Remaining: 6, 7\n- 📁 Files: spec/design/plan/CONTEXT.md\n\n9. RESUMPTION INSTRUCTIONS\n**How to Resume:**\n1. Call workflow_get with id: \"coding-task-workflow-with-loops\", mode: \"preview\"\n2. Call workflow_next with the JSON from addResumptionJson(phase-5e)\n3. Include function definitions from metaGuidance for reference\n\n10. IMPLEMENTATION READINESS\n- Sanity check results\n- Verified files/deps\n- Key files to re-read\n\ncreateFile(CONTEXT.md) with bullets for scannability.",
|
|
395
|
-
"agentRole": "You are a meticulous technical documentation specialist focused on maintaining comprehensive project context. Your expertise lies in synthesizing complex planning work into clear, actionable documentation that enables seamless workflow continuation.",
|
|
396
|
-
"guidance": [
|
|
397
|
-
"This step is automatically skipped for Small tasks",
|
|
398
|
-
"Maintain the scannable structure while adding substantial new planning context",
|
|
399
|
-
"Ensure all critical planning decisions are captured for potential handoffs",
|
|
400
|
-
"Update progress tracking to reflect the current state accurately",
|
|
401
|
-
"Consider this update as crucial as the original context document creation",
|
|
402
|
-
"Limit output based on automation level; use bullet points for readability",
|
|
403
|
-
"After updating CONTEXT.md, commit the planning completion: 'docs(planning): finalize implementation plan and context' (auto-commit for High automation, suggest for Medium/Low)"
|
|
404
|
-
],
|
|
405
|
-
"requireConfirmation": false
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
"id": "phase-6-count-steps",
|
|
409
|
-
"title": "Phase 6 Preparation: Count Implementation Steps",
|
|
410
|
-
"prompt": "Before starting the implementation loop, count the discrete implementation steps in the approved `implementation_plan.md`.\n\n**Your task:**\n1. Read the implementation_plan.md\n2. Count each discrete, actionable step from the Implementation Strategy section\n3. Set `totalImplementationSteps` to the count (e.g., 8)\n\n**What counts as a step:**\n- Each bullet point or numbered item that represents a concrete implementation task\n- Each item that would result in a code change or file creation\n- Each item that could be a logical git commit\n\n**Example:**\nIf the plan has:\n- Create user model\n- Add authentication service\n- Implement validation\n- Write tests\n\nThen set `totalImplementationSteps` = 4\n\n**IMPORTANT:** Only count, don't extract or store the steps. You'll read them directly from the plan during implementation.",
|
|
411
|
-
"agentRole": "You are preparing the implementation phase by counting the steps to enable progress tracking.",
|
|
412
|
-
"guidance": [
|
|
413
|
-
"Count only actionable implementation steps",
|
|
414
|
-
"Don't include meta-tasks like 'review' or 'document'",
|
|
415
|
-
"This enables progress tracking without bloating context"
|
|
416
|
-
],
|
|
417
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
418
|
-
"requireConfirmation": false
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
"id": "phase-6-iterative-implementation",
|
|
422
|
-
"type": "loop",
|
|
423
|
-
"title": "Phase 6: Iterative Implementation Loop (PREP -> IMPLEMENT -> VERIFY)",
|
|
424
|
-
"runCondition": {"var": "taskComplexity", "not_equals": "Small"},
|
|
425
|
-
"loop": {
|
|
426
|
-
"type": "for",
|
|
427
|
-
"count": "totalImplementationSteps",
|
|
428
|
-
"indexVar": "currentStepNumber",
|
|
429
|
-
"maxIterations": 25
|
|
430
|
-
},
|
|
431
|
-
"body": [
|
|
432
|
-
{
|
|
433
|
-
"id": "phase-6-prep",
|
|
434
|
-
"title": "PREP: Prepare for Step {{currentStepNumber + 1}}",
|
|
435
|
-
"prompt": "**PREPARATION PHASE for Step {{currentStepNumber + 1}}/{{totalImplementationSteps}}**\n\nBefore implementing this step, you must first PREPARE:\n\n1. **Read implementation_plan.md** and locate step #{{currentStepNumber + 1}}\n2. **Extract step details**: Note the title, description, and expected outputs\n3. **Confirm prerequisites**: Verify the previous step (if any) was completed correctly\n4. **Validate current state**: Ensure the plan for this step is still valid in the current codebase\n5. **List requirements**: Identify all required inputs, files, or dependencies\n\n**BRANCH SETUP (first iteration only):** If this is the first implementation step ({{currentStepNumber}} === 0):\n- Check git availability with 'git status'\n- If available, create feature branch: 'git checkout -b wip-[unique-task-id]'\n- Track the featureBranch variable for later use\n- If git unavailable: Skip branching, log in CONTEXT.md\n\n**Do not proceed if anything is unclear or missing.**",
|
|
436
|
-
"agentRole": "You are preparing to implement a specific step from the plan. Be meticulous in verifying all prerequisites are met before proceeding.",
|
|
437
|
-
"guidance": [
|
|
438
|
-
"This is step {{currentStepNumber + 1}} of {{totalImplementationSteps}} total implementation steps",
|
|
439
|
-
"Read the step directly from implementation_plan.md",
|
|
440
|
-
"Focus only on preparation - implementation comes next",
|
|
441
|
-
"If this is the first step, handle git branch setup"
|
|
442
|
-
],
|
|
443
|
-
"requireConfirmation": false
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
"id": "phase-6-implement",
|
|
447
|
-
"title": "IMPLEMENT: Execute Step {{currentStepNumber + 1}}",
|
|
448
|
-
"prompt": "**IMPLEMENTATION PHASE for Step {{currentStepNumber + 1}}/{{totalImplementationSteps}}**\n\nNow implement the step you just prepared for:\n\n**Instructions:**\n1. Re-read step #{{currentStepNumber + 1}} from implementation_plan.md\n2. Focus only on this single step\n3. useTools() to make code changes\n4. Follow quality standards\n5. Adapt to unexpected discoveries\n6. createFile() for ALL code changes\n\n**Remember:** applyUserRules() and matchPatterns() throughout.\n\n**Progress Tracking:**\n- This is step {{currentStepNumber + 1}} of {{totalImplementationSteps}}\n- If we've done > 20 steps total, pause for user intervention\n\n**CONTEXT UPDATES:** If this is every 3rd step ({{currentStepNumber + 1}} % 3 === 0):\n- Update CONTEXT.md\n- addResumptionJson(phase-6-implement)\n- updateDecisionLog()\n- List files modified with line ranges\n\n",
|
|
449
|
-
"agentRole": "You are implementing a specific step from the approved plan. Focus on precise execution while maintaining code quality.",
|
|
450
|
-
"guidance": [
|
|
451
|
-
"Implement only what this step requires",
|
|
452
|
-
"Track progress for potential intervention",
|
|
453
|
-
"Update context documentation every 3 steps"
|
|
454
|
-
],
|
|
455
|
-
"requireConfirmation": false
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
"id": "phase-6-verify",
|
|
459
|
-
"title": "VERIFY: Validate Step {{currentStepNumber + 1}}",
|
|
460
|
-
"prompt": "**VERIFICATION PHASE for Step {{currentStepNumber + 1}}/{{totalImplementationSteps}}**\n\nVerify the implementation is complete and correct:\n\n**Required:** verifyImplementation()\n\n**COMMIT Decision (if all passes):**\n- checkAutomation(commit)\n- gitCommit(type, scope: description)\n- If git unavailable: Log in CONTEXT.md\n\n**FAILURE PROTOCOL:** If verification fails after 2 attempts:\n1. Do not try a third time\n2. Fall back to alternative tools\n3. updateDecisionLog() with failure details\n4. Present summary and recommendations\n5. Set 'verificationFailed' context variable to true\n\n",
|
|
461
|
-
"agentRole": "You are verifying the implementation meets all quality standards. Be thorough but respect failure bounds.",
|
|
462
|
-
"guidance": [
|
|
463
|
-
"All three verification steps must pass",
|
|
464
|
-
"Track failure attempts (max 2)",
|
|
465
|
-
"Commit only after successful verification",
|
|
466
|
-
"Update context on failures"
|
|
467
|
-
],
|
|
468
|
-
"runCondition": { "var": "verificationFailed", "not_equals": true },
|
|
469
|
-
"requireConfirmation": false
|
|
470
|
-
}
|
|
471
|
-
],
|
|
472
|
-
"requireConfirmation": false
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
"id": "phase-6b-refinement-check",
|
|
476
|
-
"title": "Phase 6b: Agile Refinement Check",
|
|
477
|
-
"prompt": "After completing a chunk of implementation, evaluate if refinements are needed based on new insights. Set 'needsRefinement' context variable to true if updates to spec, design, or plan are required. If true, proceed to refinement steps; else, continue implementation or move to final review.",
|
|
478
|
-
"agentRole": "Agile refinement checker",
|
|
479
|
-
"runCondition": {"var": "implementationInProgress", "equals": true},
|
|
480
|
-
"requireConfirmation": true
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
"id": "phase-6c-update-spec",
|
|
484
|
-
"title": "Phase 6c: Update Specification",
|
|
485
|
-
"prompt": "Based on implementation insights, update spec.md with necessary changes. Justify updates and get user confirmation.",
|
|
486
|
-
"agentRole": "Specification updater",
|
|
487
|
-
"runCondition": {"var": "needsRefinement", "equals": true},
|
|
488
|
-
"requireConfirmation": true
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
"id": "phase-6d-update-design",
|
|
492
|
-
"title": "Phase 6d: Update Design",
|
|
493
|
-
"prompt": "Update design.md based on new insights. Maintain alignment with codebase.",
|
|
494
|
-
"agentRole": "Design updater",
|
|
495
|
-
"runCondition": {"var": "needsRefinement", "equals": true},
|
|
496
|
-
"requireConfirmation": true
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
"id": "phase-6e-update-plan",
|
|
500
|
-
"title": "Phase 6e: Update Implementation Plan",
|
|
501
|
-
"prompt": "Revise implementation_plan.md incorporating refinements. Reset 'needsRefinement' to false after updates.",
|
|
502
|
-
"agentRole": "Plan updater",
|
|
503
|
-
"runCondition": {"var": "needsRefinement", "equals": true},
|
|
504
|
-
"requireConfirmation": true
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
"id": "phase-7-final-review",
|
|
508
|
-
"title": "Phase 7: Final Review & Completion",
|
|
509
|
-
"prompt": "Perform final review against **'Final Review Checklist'** from `implementation_plan.md`.\n\n**Validate:** applyUserRules() compliance throughout. For each checklist item, provide confirmation and evidence.\n\n**Additional validation:**\n- User rules/preferences compliance\n- Architectural patterns match specs\n- Naming conventions and code style\n- Library/framework usage\n- matchPatterns() verification\n\n**Final commit:**\n- gitCommit(feat|fix|refactor, final implementation - summary)\n- Include metrics in body\n- checkAutomation(commit)\n\n**Branch cleanup (if git):**\n1. Merge: git checkout main && git merge --squash [featureBranch]\n2. Delete: git branch -d [featureBranch]\n3. checkAutomation(merge) with confidence >8\n4. Pause for conflicts\n5. Log in CONTEXT.md if no git\n\n**Update CONTEXT.md final sections:**\n\n## 9. COMPLETE DECISION LOG\nFull updateDecisionLog() with all files, patterns, user rules, design decisions\n\n## 10. FINAL STATUS\n- trackProgress(ALL, Complete)\n- ✅ Tests passing (metrics)\n- ✅ Checklist validated\n- ✅ applyUserRules() verified\n- 📁 Files modified (line ranges)\n- 📋 Known issues\n- 📜 Git history\n\n## 11. FINAL RESUMPTION\n**How to Resume (if needed for extensions):**\n1. Call workflow_get with id: \"coding-task-workflow-with-loops\", mode: \"preview\"\n2. Call workflow_next with the JSON from addResumptionJson(phase-7-final-review)\n**Note:** Task complete. This is for future extensions or follow-up work.\n\n## 12. HANDOFF\n- Accomplishments with file refs\n- Architecture decisions\n- Patterns established/followed\n- Follow-up recommendations\n\ncreateFile(CONTEXT.md) with final content.",
|
|
510
|
-
"agentRole": "You are a quality assurance specialist and technical lead responsible for final project validation and comprehensive handoff documentation. Your expertise lies in comprehensive system testing, requirement verification, and ensuring deliverables meet all specified criteria while creating documentation that enables seamless future maintenance.",
|
|
511
|
-
"guidance": [
|
|
512
|
-
"This is the final quality check. Ensure the agent's summary and checklist validation align with your understanding of the completed work.",
|
|
513
|
-
"The final CONTEXT.md update should serve as a complete project archive",
|
|
514
|
-
"Include specific details that would help future developers understand and maintain the work",
|
|
515
|
-
"Ensure all promised deliverables have been completed and documented",
|
|
516
|
-
"Include quantitative metrics and validation results in the final status"
|
|
517
|
-
],
|
|
518
|
-
"requireConfirmation": true
|
|
519
|
-
}
|
|
520
|
-
]
|
|
521
|
-
}
|