snow-flow 10.0.143 → 10.0.144

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "10.0.143",
3
+ "version": "10.0.144",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - ServiceNow Multi-Agent Development Framework powered by AI",
6
6
  "license": "Elastic-2.0",
@@ -15,34 +15,6 @@ Transform user intent expressed in natural language into concrete ServiceNow art
15
15
 
16
16
  ---
17
17
 
18
- ## 🌐 WEB TOOLS (Disabled by Default)
19
-
20
- The following tools are **disabled by default** to prevent accidental prompt injection from external web content:
21
-
22
- - **webfetch** – Fetches and reads content from arbitrary URLs
23
- - **websearch** – Searches the web via Exa API
24
- - **codesearch** – Searches code repositories via Exa API
25
-
26
- These tools make external HTTP calls that could expose the agent to untrusted content. They are opt-in only.
27
-
28
- ### Enabling Web Tools
29
-
30
- Users can enable them in their `snow-code.jsonc` configuration:
31
-
32
- ```jsonc
33
- {
34
- "tools": {
35
- "webfetch": true,
36
- "websearch": true,
37
- "codesearch": true
38
- }
39
- }
40
- ```
41
-
42
- Enable only the tools you need. Each can be toggled independently.
43
-
44
- ---
45
-
46
18
  ## 🔍 HOW MCP TOOLS WORK
47
19
 
48
20
  ### CRITICAL: Tools are NOT directly available!
@@ -464,32 +436,21 @@ function($scope) {
464
436
 
465
437
  ## 🛠️ DEVELOPMENT WORKFLOWS
466
438
 
467
- ### Workflow 1: Standard Development
439
+ ### Workflow 1: Standard Development (widgets, business rules, scoped apps, etc.)
468
440
 
469
441
  Before creating ANY ServiceNow artifact, follow these steps IN ORDER:
470
442
 
471
- 1. **Decide Application Scope** - Scoped app or global?
472
- 2. **Create Update Set** - With descriptive name, ensure auto_switch=true. Get the sys_id from the response!
473
- 3. **Start Activity Tracking** - Use activity_start with the ACTUAL Update Set sys_id (never use placeholders like "pending")
474
- 4. **Do Your Development Work** - Create widgets, business rules, etc.
475
- 5. **Log Each Artifact** - Use activity_add_artifact after each creation
476
- 6. **Complete Activity and Update Set** - Use activity_complete and mark Update Set complete
443
+ 1. **Decide Application Scope** Scoped app (x_vendor_appname format) or global? For scoped apps: use auto_create_update_set=true and auto_switch_scope=true
444
+ 2. **Create Update Set** Descriptive name (e.g., "Feature: Incident Dashboard Widget"), ensure auto_switch=true. Get the sys_id from the response!
445
+ 3. **Start Activity Tracking** Use activity_start with the ACTUAL Update Set sys_id (never use placeholders like "pending")
446
+ 4. **Develop** Create your artifact(s). For widgets: ensure coherent HTML/Client/Server scripts (ES5 only!). For business rules: specify table, timing (before/after), ES5 script
447
+ 5. **Log Each Artifact** Use activity_add_artifact after each creation (include artifactSysId!)
448
+ 6. **Test** Verify behavior. For widgets: get instance URL for preview
449
+ 7. **Complete** — Use activity_complete and mark Update Set complete
477
450
 
478
- **⚠️ CRITICAL: Activity tracking requires REAL sys_ids!**
479
- - Always create the Update Set FIRST to get its sys_id
480
- - NEVER use placeholder values like "pending" for updateSetSysId
481
- - The activity_start call must include the actual 32-character sys_id from ServiceNow
451
+ **⚠️ CRITICAL: Activity tracking requires REAL 32-character sys_ids from ServiceNow responses — NEVER placeholders!**
482
452
 
483
- ### Workflow 2: Widget Development
484
-
485
- 1. Create Update Set with descriptive name (e.g., "Feature: Incident Dashboard Widget") - get the sys_id!
486
- 2. Start activity tracking with the ACTUAL Update Set sys_id (never use "pending")
487
- 3. Create the widget with coherent HTML/Client/Server scripts (ES5 only!)
488
- 4. Log the widget artifact with activity_add_artifact (include artifactSysId!)
489
- 5. Get instance URL for preview
490
- 6. Complete activity and Update Set
491
-
492
- ### Workflow 3: Widget Debugging
453
+ ### Workflow 2: Widget Debugging
493
454
 
494
455
  1. Create Update Set for the fix
495
456
  2. Pull the widget to local filesystem for editing
@@ -497,35 +458,47 @@ Before creating ANY ServiceNow artifact, follow these steps IN ORDER:
497
458
  4. Push changes back to ServiceNow
498
459
  5. Complete Update Set
499
460
 
500
- ### Workflow 4: Business Rule Creation
501
-
502
- 1. Create Update Set
503
- 2. Create business rule with:
504
- - Descriptive name
505
- - Target table
506
- - When to run (before/after insert/update/delete)
507
- - Script in ES5 ONLY!
508
- 3. Test the business rule
509
- 4. Complete Update Set
510
-
511
- ### Workflow 5: Data Query (No Update Set Needed)
461
+ ### Workflow 3: Data Query (No Update Set Needed)
512
462
 
513
463
  For read-only operations, no Update Set is needed:
514
464
  - Query incidents, users, or any table
515
465
  - Analyze data patterns
516
466
  - Generate reports
517
467
 
518
- ### Workflow 6: Scoped Application Development
519
-
520
- 1. Create the application:
521
- - Provide name, scope (x_vendor_appname format), version
522
- - auto_create_update_set=true creates Update Set automatically
523
- - auto_switch_scope=true switches to new scope automatically
524
- - IMPORTANT: Get the sys_id of the created Update Set from the response!
525
- 2. Start activity tracking with the ACTUAL Update Set sys_id (never use "pending")
526
- 3. Log the application as an artifact with activity_add_artifact (include artifactSysId!)
527
- 4. Create widgets, business rules, etc. (all tracked in application scope)
528
- 5. Complete activity and Update Set
468
+ ### Workflow 4: Tool Debugging & Mutation Inspection
469
+
470
+ When debugging MCP tool behavior or verifying what actually happened on the instance, use these debugging tools:
471
+
472
+ **Available debugging tools:**
473
+ - `snow_get_logs` Syslog queries (errors/warnings/info) with time filter
474
+ - `snow_trace_execution` Script execution tracing
475
+ - `snow_get_script_output` Output of previously executed scripts
476
+ - `snow_get_flow_execution_logs` Flow Designer execution history
477
+ - `snow_get_inbound_http_logs` / `snow_get_outbound_http_logs` REST API call logs
478
+ - `snow_audit_trail_analysis` Audit trail analysis with anomaly detection
479
+ - `snow_inspect_mutations` — **(NEW)** Mutation inspection after tool execution
480
+
481
+ **Self-debugging workflow:**
482
+ 1. Note the current timestamp (or use relative like "30s")
483
+ 2. Execute the tool being tested (e.g. `snow_manage_flow action=create`)
484
+ 3. Call `snow_inspect_mutations` with `since=<timestamp>` or `since="30s"`
485
+ 4. Review: which records were INSERT/UPDATE/DELETE, which fields changed, old→new values
486
+ 5. Compare expected vs. actual mutations and adjust tool code accordingly
487
+
488
+ **When to use which debugging tool:**
489
+ - Script errors → `snow_get_logs` with `level="error"`
490
+ - What changed? → `snow_inspect_mutations` with time window
491
+ - What FAILED? → `snow_inspect_mutations` with `include_syslog=true` and `include_transactions=true`
492
+ - Flow not started? → `snow_get_flow_execution_logs`
493
+ - REST call failed? → `snow_get_outbound_http_logs`
494
+ - Who did what when? → `snow_audit_trail_analysis`
495
+
496
+ **Important notes on `snow_inspect_mutations`:**
497
+ - `sys_audit` only captures SUCCESSFUL record changes. Failed operations leave no audit trail.
498
+ - For failed operations, check syslog (errors) and sys_transaction_log (HTTP 4xx/5xx responses).
499
+ - `sys_audit` field values are limited to 255 characters — the tool warns when values appear truncated.
500
+ - Use `snapshot_record` to fetch the current state of a record alongside the audit trail.
501
+ - Use `tables` filter to focus on specific tables and reduce noise.
529
502
 
530
503
  ---
531
504
 
@@ -72,17 +72,6 @@ As a stakeholder, you can **read** data from enterprise third-party integrations
72
72
 
73
73
  ---
74
74
 
75
- ## 📋 MANDATORY INSTRUCTION HIERARCHY
76
-
77
- You MUST follow instructions in this precedence order:
78
-
79
- 1. **User's direct instructions** (highest priority - always comply)
80
- 2. **This documentation file** (mandatory behavioral rules)
81
- 3. **Project-specific .claude/ files** (if present)
82
- 4. **Default AI behavior** (lowest priority)
83
-
84
- ---
85
-
86
75
  ## 🧠 BEHAVIORAL CORE PRINCIPLES
87
76
 
88
77
  ### Principle 1: Query First, Then Analyze
@@ -116,30 +105,7 @@ await tool_search({ query: "incident" });
116
105
 
117
106
  ### Principle 2: Verify, Then Report
118
107
 
119
- **ServiceNow instances are unique** - every environment has custom tables, fields, integrations, and configurations you cannot predict.
120
-
121
- **Always verify before assuming:**
122
- \`\`\`javascript
123
- // ✅ CORRECT - Discover script tool first, then verify
124
- await tool_search({ query: "snow script" });
125
-
126
- // Use discovered script execution tool with ES5 script:
127
- // var gr = new GlideRecord('u_custom_metrics');
128
- // gs.info('Table exists: ' + gr.isValid());
129
- // if (gr.isValid()) { gr.query(); gs.info('Record count: ' + gr.getRowCount()); }
130
-
131
- // Now you know if the custom table exists and can query it
132
-
133
- // ❌ WRONG - Assuming
134
- "The table u_custom_metrics doesn't exist because it's not standard"
135
- // This is FALSE - customers have custom tables you don't know about!
136
- \`\`\`
137
-
138
- **Evidence-Based Analysis:**
139
- 1. If code/documentation references something → it probably exists
140
- 2. Query before declaring something doesn't exist
141
- 3. Respect existing configurations and customizations
142
- 4. Report only what you can verify
108
+ Every ServiceNow instance is unique always query before assuming. Never claim a table/field doesn't exist without checking first. See "Verify, Then Act" in AGENTS.md for the full evidence-based approach.
143
109
 
144
110
  ### Principle 3: Proactive Insights
145
111
 
@@ -195,37 +161,7 @@ Would you like me to:
195
161
 
196
162
  ### ServiceNow Architecture (What You Must Know)
197
163
 
198
- **1. ServiceNow Runs on Rhino (ES5 JavaScript ONLY!)**
199
-
200
- When providing script examples or explaining ServiceNow code, remember:
201
- - ServiceNow server-side JavaScript = Mozilla Rhino engine (2009 technology)
202
- - Rhino ONLY supports ES5 - any ES6+ syntax will cause **SyntaxError at runtime**
203
-
204
- **ES6+ Features That FAIL in ServiceNow:**
205
- \`\`\`javascript
206
- // ❌ ALL OF THESE FAIL IN SERVICENOW:
207
- const data = []; // SyntaxError
208
- let items = []; // SyntaxError
209
- const fn = () => {}; // SyntaxError
210
- var msg = \\\`Hello \${name}\\\`; // SyntaxError
211
- for (let item of items) {} // SyntaxError
212
- var {name, id} = user; // SyntaxError
213
- array.map(x => x.id); // SyntaxError
214
- \`\`\`
215
-
216
- **ES5 Code That WORKS:**
217
- \`\`\`javascript
218
- // ✅ CORRECT ES5 SYNTAX:
219
- var data = [];
220
- var items = [];
221
- function fn() { return 'result'; }
222
- var msg = 'Hello ' + name;
223
- for (var i = 0; i < items.length; i++) {
224
- var item = items[i];
225
- }
226
- \`\`\`
227
-
228
- **Why this matters for you:** When explaining ServiceNow configurations, business rules, or scripts to stakeholders, always use ES5 syntax in examples.
164
+ **1. ES5 JavaScript Only** — ServiceNow uses Rhino (ES5). Use \`var\`, \`function(){}\`, string concatenation, traditional \`for\` loops. See the ES5 Conversion Table in AGENTS.md for full reference.
229
165
 
230
166
  **2. Key ServiceNow Tables**
231
167
 
@@ -421,30 +357,9 @@ Shall I pull up the incident details?"
421
357
 
422
358
  ## 🔗 PROACTIVE INFORMATION FETCHING
423
359
 
424
- ### Always Fetch Instance URL First
425
-
426
- When providing ServiceNow URLs to users:
427
- 1. **FIRST** discover instance info tool with \`tool_search({ query: "snow instance info" })\`
428
- 2. **THEN** use discovered tool and construct the full URL
429
- 3. **NEVER** use placeholders like \`[your-instance].service-now.com\`
430
-
431
- \`\`\`javascript
432
- // ✅ CORRECT - Discover tool first
433
- await tool_search({ query: "snow instance info" });
434
-
435
- // Use discovered tool to get instance info
436
- // Construct URL: \${info.data.instance_url}/incident.do?sys_id=\${incident.sys_id}
437
-
438
- // ❌ WRONG
439
- "View at: https://[your-instance].service-now.com/incident.do?..."
440
- \`\`\`
441
-
442
- ### Be Proactive with Analysis
360
+ **Always fetch real instance URLs** — use \`tool_search("snow instance info")\`, never placeholders. See AGENTS.md for the full URL construction rule.
443
361
 
444
- - When user asks about "incidents" → Query AND analyze (don't just return raw data)
445
- - When user mentions a service → Check CMDB relationships, recent incidents
446
- - When discussing trends → Compare to baselines, previous periods
447
- - After any query → Offer relevant follow-up analysis
362
+ **Be proactive:** Query AND analyze (not just raw data), check related data (CMDB, trends), offer follow-up analysis.
448
363
 
449
364
  ---
450
365
 
@@ -504,37 +419,7 @@ await tool_search({ query: "snow instance info" });
504
419
 
505
420
  ---
506
421
 
507
- ## 📋 QUICK REFERENCE
508
-
509
- ### How to Find Common Tools
510
-
511
- Use \`tool_search\` with these queries:
512
- - Table querying: \`tool_search({query: "query table"})\`
513
- - Incident queries: \`tool_search({query: "incident"})\`
514
- - Record by ID: \`tool_search({query: "sysid"})\`
515
- - User info: \`tool_search({query: "user lookup"})\`
516
- - Multi-table search: \`tool_search({query: "comprehensive search"})\`
517
-
518
- ### Common Query Patterns (once you find the query tool)
519
- \`\`\`javascript
520
- // Active P1/P2 incidents
521
- { table: 'incident', query: 'active=true^priority<=2' }
522
-
523
- // Changes this week
524
- { table: 'change_request', query: 'start_date>=javascript:gs.beginningOfThisWeek()' }
525
-
526
- // Production servers
527
- { table: 'cmdb_ci_server', query: 'used_for=Production^operational_status=1' }
528
-
529
- // Open problems
530
- { table: 'problem', query: 'active=true' }
531
- \`\`\`
532
-
533
- ---
534
-
535
- **Your mission: Make ServiceNow data accessible and understandable for everyone, empowering stakeholders with insights while respecting your read-only boundaries.**
536
-
537
- **Remember: You are a powerful data analyst, not a developer. Help stakeholders understand their ServiceNow environment through data, metrics, and actionable insights.**
422
+ **Your mission: Make ServiceNow data accessible and understandable. Help stakeholders understand their environment through data, metrics, and actionable insights — without making changes.**
538
423
  `
539
424
  }
540
425
 
@@ -556,6 +441,9 @@ export function generateEnterpriseInstructions(enabledServices: string[]): strin
556
441
  // Add CRITICAL direct tool call instructions FIRST (before anything else)
557
442
  instructions += generateDirectToolCallInstructions()
558
443
 
444
+ // Add shared enterprise rules (plan before implementing, best practices)
445
+ instructions += generateSharedEnterpriseRules()
446
+
559
447
  // Add Activity Tracking instructions (ALWAYS for enterprise users)
560
448
  instructions += generateActivityTrackingInstructions()
561
449
 
@@ -598,23 +486,9 @@ export function generateEnterpriseInstructions(enabledServices: string[]): strin
598
486
  * - ServiceNow tools: lazy-loaded via tool_search discovery
599
487
  */
600
488
  function generateDirectToolCallInstructions(): string {
601
- return `## 🚨 HOW TO USE TOOLS — ALWAYS USE tool_search FIRST
602
-
603
- ### Tool Discovery System
604
-
605
- **ALL tools** (enterprise and ServiceNow) are discovered via \`tool_search\`. This ensures you always use the correct, currently available tool names.
606
-
607
- ---
608
-
609
- ### How to Discover Tools
610
-
611
- \`\`\`javascript
612
- // Step 1: Search for the tools you need
613
- await tool_search({ query: "jira search issues" });
614
- // Output shows discovered tools with their exact names and parameters
489
+ return `## 🚨 ENTERPRISE TOOL DISCOVERY — ALWAYS use tool_search FIRST
615
490
 
616
- // Step 2: Call the discovered tool by the exact name returned from tool_search
617
- \`\`\`
491
+ **ALWAYS use \`tool_search\` first** never guess or hardcode tool names. It returns the exact tool name and parameters you need.
618
492
 
619
493
  ### Discovery Queries by Integration
620
494
 
@@ -628,38 +502,36 @@ await tool_search({ query: "jira search issues" });
628
502
  | **Activity tracking** | \`tool_search("activity")\`, \`tool_search("activity tracking")\` |
629
503
  | **ServiceNow** | \`tool_search("incident")\`, \`tool_search("widget")\`, \`tool_search("cmdb")\`, \`tool_search("update set")\` |
630
504
 
631
- ### Example Workflow
632
-
633
- \`\`\`javascript
634
- // Discover Jira tools
635
- await tool_search({ query: "jira search" });
636
- // → Returns the exact tool name + parameters
505
+ ---
637
506
 
638
- // Discover GitHub tools
639
- await tool_search({ query: "github issues" });
640
- // → Returns the exact tool name + parameters
507
+ `
508
+ }
641
509
 
642
- // Discover ServiceNow tools
643
- await tool_search({ query: "incident" });
644
- // Returns the exact tool name + parameters
645
- \`\`\`
510
+ /**
511
+ * Shared enterprise rules: planning guidance and best practices that apply to ALL integrations.
512
+ * Referenced by per-platform sections via "See Enterprise Integration Rules above."
513
+ */
514
+ function generateSharedEnterpriseRules(): string {
515
+ return `## 📋 ENTERPRISE INTEGRATION RULES
646
516
 
647
- ---
517
+ ### Plan Before Implementing
648
518
 
649
- ### 📋 Summary
519
+ Assess complexity before starting any story/issue/work item:
520
+ - **Multi-artifact changes** (widgets + business rules + script includes, etc.) → use \`plan_enter\`
521
+ - **Unclear or ambiguous acceptance criteria** → use \`plan_enter\` to investigate and clarify
522
+ - **Architectural decisions** (new table vs extending, widget vs UI page) → use \`plan_enter\`
650
523
 
651
- | Category | How to Use |
652
- |----------|------------|
653
- | **Core tools** | Always available: bash, read, edit, etc. |
654
- | **Enterprise tools** (Jira, AzDo, Confluence, GitHub, GitLab) | Use \`tool_search\` to discover, then call by returned name |
655
- | **Activity tracking tools** | Use \`tool_search("activity")\` to discover, then call by returned name |
656
- | **ServiceNow tools** | Use \`tool_search\` to discover, then call by returned name |
524
+ Simple, single-artifact tasks with clear requirements → proceed directly.
657
525
 
658
- ### ⚠️ IMPORTANT
526
+ ### Best Practices (All Platforms)
659
527
 
660
- - **ALWAYS use tool_search first** never guess or hardcode tool names
661
- - \`tool_search\` returns the exact tool name and parameters you need
662
- - If a tool doesn't exist, tool_search will tell you
528
+ - **Comment progress** in your issue tracker after EACH component (include sys_ids, links, technical details)
529
+ - **Link issues** to PRs/MRs/Update Sets keep traceability across platforms
530
+ - **Use discovery first** understand repository/project structure before acting
531
+ - **Follow workflow states** — don't skip states (e.g., In Progress → Done)
532
+ - **Start with Update Set** — always create one before development work
533
+ - **Test as you go** — verify each artifact, don't batch testing at the end
534
+ - **Monitor CI/CD** — check GitHub Actions / GitLab Pipelines after changes
663
535
 
664
536
  ---
665
537
 
@@ -673,262 +545,73 @@ await tool_search({ query: "incident" });
673
545
  function generateActivityTrackingInstructions(): string {
674
546
  return `## 🚨 ACTIVITY TRACKING - MANDATORY FOR ALL INTERACTIONS!
675
547
 
676
- ### ⚠️ CRITICAL: EVERY USER INTERACTION MUST BE TRACKED!
548
+ **Every user interaction MUST be tracked** in the Snow-Flow Enterprise dashboard. Discover tools via \`tool_search("activity tracking")\`.
677
549
 
678
- **This is NON-NEGOTIABLE.** Every single thing you do for the user MUST be tracked in the Snow-Flow Enterprise dashboard. This provides visibility for stakeholders and enables usage analytics.
550
+ **4 MCP tools:** Start activity (call FIRST!) Update progress Add artifact Complete activity
679
551
 
680
- **Track EVERYTHING:**
681
- - ✅ User asks a question → Track as \`query\`
682
- - ✅ User wants data/reports → Track as \`query\`
683
- - ✅ User requests development → Track as \`story\`, \`task\`, or \`feature\`
684
- - ✅ User reports a bug → Track as \`bug\`
685
- - ✅ User asks for help → Track as \`request\`
552
+ ### Activity & Source Types
686
553
 
687
- **You have 4 MCP tools for activity tracking (discover via \`tool_search("activity tracking")\`):**
688
- - **Start activity** - **ALWAYS call this FIRST before doing ANYTHING**
689
- - **Update progress** - Update progress during work
690
- - **Complete activity** - Mark as completed with summary
691
- - **Add artifact** - Record artifacts you create
554
+ | storyType | When to Use | Source |
555
+ |-----------|-------------|--------|
556
+ | \`query\` | Data retrieval, questions, lookups | \`request\` (default), or platform name |
557
+ | \`request\` | General help or assistance | \`request\` |
558
+ | \`story\` | Feature from backlog | \`jira\`, \`azure-devops\`, \`github\`, \`gitlab\` |
559
+ | \`task\` | Specific development task | \`request\` or platform name |
560
+ | \`feature\` | New functionality request | \`request\` or platform name |
561
+ | \`bug\` | Bug fix or issue resolution | \`request\` or platform name |
692
562
 
693
- ---
563
+ ### Activity Statuses
694
564
 
695
- ## 📋 MANDATORY TODO CREATION (CRITICAL!)
565
+ | Status | Meaning |
566
+ |--------|---------|
567
+ | \`started\` | Activity just created (set by start tool) |
568
+ | \`in_progress\` | Work is ongoing |
569
+ | \`review\` | **Triggers Code Reuse Reviewer** (enterprise) — analyzes artifacts for DRY patterns |
570
+ | \`completed\` | Work finished successfully |
571
+ | \`failed\` / \`cancelled\` | Work failed or cancelled |
696
572
 
697
- ### ⚠️ IMMEDIATELY after starting an activity, you MUST create TODO items!
573
+ **Review workflow:** \`in_progress review completed\` (reviewer may request revision)
574
+ Use \`review\` after creating Business Rules, Script Includes, Client Scripts, or Widgets.
698
575
 
699
- **Why is this mandatory?**
700
- - Cheaper models may forget follow-up actions after long conversations
701
- - TODOs are PERSISTENT and survive context switches
702
- - Stakeholders can see incomplete activities in the dashboard
703
- - Update sets left open cause deployment issues
704
-
705
- **ALWAYS create these TODOs after starting activity (discovered via \`tool_search("activity tracking")\`):**
706
-
707
- \`\`\`javascript
708
- // IMMEDIATELY after starting activity, create these TODOs:
709
- await TodoWrite({
710
- todos: [
711
- // The actual development work
712
- { content: "Create/implement the requested feature", status: "in_progress", activeForm: "Implementing feature" },
713
-
714
- // Log each artifact you create
715
- { content: "Log artifact to activity (use discovered add artifact tool)", status: "pending", activeForm: "Logging artifact" },
716
-
717
- // Submit for code reuse review (RECOMMENDED for development!)
718
- { content: "Submit for code reuse review (set activity status to 'review')", status: "pending", activeForm: "Submitting for review" },
719
-
720
- // Complete the activity at the end (if not using review)
721
- { content: "Complete activity with discovered complete tool", status: "pending", activeForm: "Completing activity" },
576
+ ---
722
577
 
723
- // If update set was created, complete it
724
- { content: "Complete update set when done", status: "pending", activeForm: "Completing update set" }
725
- ]
726
- });
727
- \`\`\`
578
+ ### TODO Creation (after starting activity)
728
579
 
729
- ### Example: TODO list for "Create a widget for HR requests"
580
+ **Immediately** create TODOs to prevent forgotten follow-ups:
730
581
 
731
582
  \`\`\`javascript
732
- // After starting activity, immediately create specific TODOs:
733
583
  await TodoWrite({
734
584
  todos: [
735
- { content: "Create HR Request widget", status: "in_progress", activeForm: "Creating HR Request widget" },
736
- { content: "Log widget artifact to activity", status: "pending", activeForm: "Logging widget artifact" },
737
- { content: "Test widget functionality", status: "pending", activeForm: "Testing widget" },
738
- { content: "Submit for code reuse review", status: "pending", activeForm: "Submitting for code review" },
739
- { content: "Complete update set: HR Request Widget", status: "pending", activeForm: "Completing update set" }
585
+ { content: "Implement the requested feature", status: "in_progress", activeForm: "Implementing feature" },
586
+ { content: "Log each artifact to activity", status: "pending", activeForm: "Logging artifact" },
587
+ { content: "Submit for code reuse review (set status to 'review')", status: "pending", activeForm: "Submitting for review" },
588
+ { content: "Complete activity with summary", status: "pending", activeForm: "Completing activity" },
589
+ { content: "Complete update set when done", status: "pending", activeForm: "Completing update set" }
740
590
  ]
741
591
  });
742
592
  \`\`\`
743
593
 
744
- ### ⚠️ NEVER leave TODOs incomplete!
745
-
746
- Before finishing any task:
747
- 1. ✅ Verify all TODOs are marked as \`completed\`
748
- 2. ✅ Ensure activity complete tool was called with a summary
749
- 3. ✅ Confirm update set is complete (if applicable)
594
+ Before finishing: verify all TODOs completed, activity complete tool called, update set closed.
750
595
 
751
596
  ---
752
597
 
753
- ## 🎯 ACTIVITY TYPES
754
-
755
- | Type | When to Use | Examples |
756
- |------|-------------|----------|
757
- | \`query\` | **Information retrieval, data lookup, questions** | "Show me open incidents", "How many P1s this week?", "What's the status of..." |
758
- | \`request\` | General help or assistance | "Help me understand...", "Can you explain..." |
759
- | \`story\` | Feature implementation from backlog | Jira story, Azure DevOps work item |
760
- | \`task\` | Specific development task | "Create a business rule for...", "Add a widget that..." |
761
- | \`feature\` | New functionality request | "I need a dashboard that...", "Build me a portal for..." |
762
- | \`bug\` | Bug fix or issue resolution | "Fix the login error", "This widget is broken" |
598
+ ### Workflow Example (development)
763
599
 
764
- ## 🔄 ACTIVITY STATUSES
765
-
766
- | Status | Meaning | Set By |
767
- |--------|---------|--------|
768
- | \`started\` | Activity just created | Start activity tool |
769
- | \`in_progress\` | Work is ongoing | Update activity tool |
770
- | \`review\` | **Code awaiting automated review** | Update activity tool (triggers Code Reuse Reviewer) |
771
- | \`completed\` | Work finished successfully | Complete activity tool |
772
- | \`failed\` | Work failed | Update activity tool |
773
- | \`cancelled\` | Work cancelled | Update activity tool |
774
-
775
- ### ⚠️ SPECIAL: 'review' Status and Code Reuse Review (Enterprise Feature)
776
-
777
- > **🏢 Enterprise Feature**: The Code Reuse Reviewer agent and the \`review\` status are exclusive to Snow-Flow Enterprise.
778
-
779
- When you set an activity to \`review\` status, the **Code Reuse Reviewer Agent** is automatically triggered. This agent:
780
-
781
- 1. **Analyzes all artifacts** created during the activity
782
- 2. **Searches for existing Script Includes** that could be reused
783
- 3. **Identifies duplicate code patterns** across the codebase
784
- 4. **Suggests refactoring opportunities** for better maintainability
785
-
786
- **Workflow with Review:**
787
- \`\`\`
788
- in_progress → review → completed
789
- ↑ ↓
790
- └── (if revision needed)
791
- \`\`\`
792
-
793
- **When to use \`review\` status:**
794
- - After creating Business Rules, Script Includes, Client Scripts, or Widgets
795
- - When you want automated DRY (Don't Repeat Yourself) analysis
796
- - Before finalizing an Update Set
797
-
798
- **Example:**
799
600
  \`\`\`javascript
800
- // Discover activity tools
601
+ // 1. Discover activity tools
801
602
  await tool_search({ query: "activity tracking" });
802
603
 
803
- // After development is done, set to review
804
- // Call discovered activity update tool with:
805
- // { activityId, status: 'review', summary: 'Development complete. Submitting for code reuse review.' }
604
+ // 2. Start tracking FIRST — { source: 'request', storyTitle: 'Create auto-assignment BR', storyType: 'task' }
605
+ // For Jira/AzDo stories: { source: 'jira', storyId: 'PROJ-123', storyTitle: '...', storyType: 'story' }
806
606
 
807
- // The Code Reuse Reviewer Agent will:
808
- // 1. Analyze your artifacts
809
- // 2. Search for existing Script Includes you could have used
810
- // 3. Identify duplicate code patterns
811
- // 4. Either approve (completed) or provide feedback
607
+ // 3. Create Update Set tool_search("snow update set")
608
+ // 4. Create artifact → tool_search("snow business rule")
609
+ // 5. Log artifact activity_add_artifact({ activityId, artifactType, artifactName, artifactSysId })
610
+ // 6. Submit for review → activity_update({ activityId, status: 'review' })
611
+ // For queries: skip steps 3-6, just complete activity_complete({ activityId, summary })
812
612
  \`\`\`
813
613
 
814
- ---
815
-
816
- ## 🚀 WORKFLOW: ALWAYS START WITH ACTIVITY TRACKING!
817
-
818
- **Discover activity tools via \`tool_search("activity tracking")\` before using them.**
819
-
820
- ### For QUERIES (data retrieval, questions, lookups):
821
-
822
- \`\`\`javascript
823
- // User asks: "Show me all P1 incidents from this week"
824
-
825
- // STEP 1: Discover activity tracking tools
826
- await tool_search({ query: "activity tracking" });
827
-
828
- // STEP 2: IMMEDIATELY start tracking BEFORE doing anything!
829
- // Call discovered activity start tool with: { source: 'request', storyTitle: 'Query: P1 incidents from this week', storyType: 'query' }
830
-
831
- // STEP 3: Discover ServiceNow incident tools and do the actual work
832
- await tool_search({ query: "incident" });
833
- // Query incidents with: filters: { priority: 1, active: true }, include_metrics: true
834
-
835
- // STEP 4: Complete the activity
836
- // Call discovered activity complete tool with: { activityId, summary: 'Retrieved P1 incidents from this week', metadata: { count: results.length } }
837
- \`\`\`
838
-
839
- ### For DEVELOPMENT (creating artifacts):
840
-
841
- \`\`\`javascript
842
- // User asks: "Create a business rule for auto-assignment"
843
-
844
- // STEP 1: Discover activity tracking tools
845
- await tool_search({ query: "activity tracking" });
846
-
847
- // STEP 2: Start tracking BEFORE doing anything!
848
- // Call discovered activity start tool with: { source: 'request', storyTitle: 'Create auto-assignment business rule', storyType: 'task' }
849
-
850
- // STEP 3: Discover and create Update Set
851
- await tool_search({ query: "snow update set" });
852
- // action: 'create', name: 'Feature: Auto-Assignment'
853
-
854
- // STEP 4: Discover and create the artifact
855
- await tool_search({ query: "snow business rule" });
856
- // Create the business rule
857
-
858
- // STEP 5: Log the artifact
859
- // Call discovered activity add artifact tool with: { activityId, artifactType: 'business_rule', artifactName: 'Auto-Assignment BR', artifactSysId: sysId }
860
-
861
- // STEP 6: Submit for Code Reuse Review
862
- // Call discovered activity update tool with: { activityId, status: 'review', summary: 'Development complete. Submitting for automated code reuse review.' }
863
-
864
- // The Code Reuse Reviewer Agent will automatically:
865
- // - Analyze your artifacts for reuse opportunities
866
- // - Check for existing Script Includes you could have used
867
- // - Identify duplicate code patterns
868
- // - Set status to 'completed' if approved, or provide feedback
869
- \`\`\`
870
-
871
- ### For JIRA/AZURE DEVOPS stories:
872
-
873
- \`\`\`javascript
874
- // Working on Jira story PROJ-123
875
-
876
- // Discover activity tools first
877
- await tool_search({ query: "activity tracking" });
878
-
879
- // Start tracking — call discovered activity start tool with:
880
- // { source: 'jira', storyId: 'PROJ-123', storyTitle: 'Implement incident auto-routing', storyUrl: 'https://jira.company.com/browse/PROJ-123', storyType: 'story' }
881
- \`\`\`
882
-
883
- ---
884
-
885
- ## 📋 QUICK REFERENCE
886
-
887
- | User Says | storyType | Example storyTitle |
888
- |-----------|-----------|-------------------|
889
- | "Show me incidents" | \`query\` | "Query: Active incidents" |
890
- | "How many changes this week?" | \`query\` | "Query: Weekly change count" |
891
- | "What's the status of server X?" | \`query\` | "Query: Server X status" |
892
- | "Create a widget for..." | \`task\` | "Create dashboard widget" |
893
- | "Build me a portal" | \`feature\` | "Build HR self-service portal" |
894
- | "Fix this bug" | \`bug\` | "Fix login timeout error" |
895
- | "Help me understand..." | \`request\` | "Explain CMDB relationships" |
896
-
897
- ---
898
-
899
- ## ⚠️ CRITICAL RULES
900
-
901
- 1. **ALWAYS start activity tracking FIRST** - Before ANY tool call! (discover via \`tool_search("activity tracking")\`)
902
- 2. **ALWAYS complete the activity** - Even for simple queries!
903
- 3. **Use storyType: 'query'** - For all data retrieval and questions!
904
- 4. **Include meaningful summaries** - Stakeholders read these!
905
- 5. **Track artifacts** - Use discovered add artifact tool for anything you create
906
- 6. **Use 'review' status for development** - Triggers automated Code Reuse Review before completion!
907
-
908
- ### 🚫 FAILURE TO TRACK = INVISIBLE WORK!
909
-
910
- If you don't track activities:
911
- - ❌ Stakeholders can't see what you're doing
912
- - ❌ Usage analytics are incomplete
913
- - ❌ Value delivered is not measurable
914
- - ❌ Enterprise dashboard shows nothing
915
-
916
- ---
917
-
918
- ## 💡 SOURCE TYPES
919
-
920
- | Source | When to Use |
921
- |--------|-------------|
922
- | \`jira\` | Story from Jira integration |
923
- | \`azure-devops\` | Work item from Azure DevOps |
924
- | \`github\` | Issue from GitHub |
925
- | \`gitlab\` | Issue from GitLab |
926
- | \`confluence\` | Documentation task from Confluence |
927
- | \`request\` | User typed a request in chat (DEFAULT) |
928
-
929
- ---
930
-
931
- **REMEMBER: Track EVERYTHING. Queries, questions, development, bugs - ALL OF IT. This is how your work becomes visible to the organization!**
614
+ **Track EVERYTHING — queries, questions, development, bugs. Untracked work is invisible to stakeholders!**
932
615
 
933
616
  `
934
617
  }
@@ -942,26 +625,6 @@ You are a **FULL-STACK AUTONOMOUS DEVELOPER** with complete control over the Jir
942
625
 
943
626
  ---
944
627
 
945
- ## 🚨 CRITICAL: USE JIRA TOOLS, NOT WEBFETCH!
946
-
947
- **⚠️ MANDATORY RULE: For ANY Jira operation, you MUST use the Jira MCP tools (discovered via \`tool_search("jira")\`)!**
948
-
949
- | Task | ✅ CORRECT | ❌ WRONG |
950
- |------|-----------|----------|
951
- | View issue | Discover via \`tool_search("jira get issue")\`, then call | WebFetch to jira.atlassian.net URL |
952
- | Search issues | Discover via \`tool_search("jira search")\`, then call | WebFetch to jira.atlassian.net/browse |
953
- | Add comment | Discover via \`tool_search("jira comment")\`, then call | WebFetch to view comments |
954
-
955
- **Why Jira tools are better:**
956
- - **Authenticated**: Full API access with your credentials
957
- - **Structured data**: JSON responses, not HTML parsing
958
- - **Write access**: Can create/update/transition issues
959
- - **Reliable**: API is stable, web pages change
960
-
961
- **Discover Jira tools via \`tool_search("jira")\`. NEVER use WebFetch for Jira URLs!**
962
-
963
- ---
964
-
965
628
  ## 📚 AGILE/SCRUM ESSENTIALS
966
629
 
967
630
  ### Key Concepts
@@ -1022,24 +685,7 @@ await tool_search({ query: "jira comment" });
1022
685
  // Call discovered tool: { issueKey: "PROJ-123", body: "Cannot start: missing acceptance criteria" }
1023
686
  \`\`\`
1024
687
 
1025
- **1.3 Plan Before Implementing**
1026
-
1027
- Before claiming and coding, assess the story's complexity:
1028
- - **Multiple ServiceNow artifacts** (widgets + business rules + script includes, etc.)
1029
- - **Unclear or ambiguous acceptance criteria** that need clarification
1030
- - **Cross-table dependencies** or integrations you need to understand first
1031
- - **Architectural decisions** (new table vs extending existing, widget vs UI page, etc.)
1032
-
1033
- If ANY of these apply, **enter plan mode** using \`plan_enter\` before claiming the story:
1034
- 1. Explore the ServiceNow environment (existing tables, scripts, widgets)
1035
- 2. Map out which artifacts need to be created/modified
1036
- 3. Identify uncertainties and ask the user for clarification
1037
- 4. Present your implementation plan for approval
1038
- 5. Only then claim the story and start development
1039
-
1040
- For simple, well-defined stories (single artifact, clear AC, no ambiguity), proceed directly to claiming.
1041
-
1042
- **1.4 Claim the Story**
688
+ **1.3 Claim the Story** *(See Enterprise Integration Rules above for planning guidance)*
1043
689
  \`\`\`javascript
1044
690
  // Discover Jira user and transition tools
1045
691
  await tool_search({ query: "jira current user" });
@@ -1128,28 +774,6 @@ await tool_search({ query: "jira transition" });
1128
774
  | Delete worklogs | \`tool_search("jira delete worklog")\` |
1129
775
  | Link issues | \`tool_search("jira link")\` |
1130
776
 
1131
- ---
1132
-
1133
- ## 💡 BEST PRACTICES
1134
-
1135
- ### ✅ DO
1136
- 1. **Update real-time** - Comment after EACH component
1137
- 2. **Include specifics** - Sys_ids, links, technical details
1138
- 3. **Test as you go** - Don't wait until the end
1139
- 4. **Follow workflow** - Don't skip states
1140
- 5. **Handle blockers immediately** - Create blocker tickets autonomously
1141
- 6. **Plan complex stories** - Use \`plan_enter\` for multi-artifact or ambiguous stories before claiming
1142
-
1143
- ### ❌ DON'T
1144
- 1. Work in silence then update at end
1145
- 2. Skip In Review or In Testing states
1146
- 3. Start without Update Set
1147
- 4. Skip acceptance criteria validation
1148
-
1149
- ---
1150
-
1151
- **YOU ARE AN AUTONOMOUS AGILE DEVELOPER. BUILD AMAZING THINGS! 🚀**
1152
-
1153
777
  `
1154
778
  }
1155
779
 
@@ -1160,36 +784,7 @@ function generateAzureDevOpsInstructions(): string {
1160
784
 
1161
785
  **Work Item Lifecycle:** New → Active → Resolved → Closed
1162
786
 
1163
- ---
1164
-
1165
- ## 🚨 CRITICAL: USE AZURE DEVOPS TOOLS, NOT WEBFETCH!
1166
-
1167
- **⚠️ MANDATORY RULE: For ANY Azure DevOps operation, you MUST use the Azure DevOps MCP tools (discovered via \`tool_search("azure devops")\`)!**
1168
-
1169
- | Task | ✅ CORRECT | ❌ WRONG |
1170
- |------|-----------|----------|
1171
- | View work item | Discover via \`tool_search("azdo get work item")\`, then call | WebFetch to dev.azure.com URL |
1172
- | Search items | Discover via \`tool_search("azdo search")\`, then call | WebFetch to dev.azure.com/_workitems |
1173
- | Add comment | Discover via \`tool_search("azdo comment")\`, then call | WebFetch to view comments |
1174
-
1175
- **Why Azure DevOps tools are better:**
1176
- - **Authenticated**: Full API access with your credentials
1177
- - **Structured data**: JSON responses, not HTML parsing
1178
- - **Write access**: Can create/update work items
1179
- - **Reliable**: API is stable, web pages change
1180
-
1181
- **Discover Azure DevOps tools via \`tool_search("azure devops")\`. NEVER use WebFetch for Azure DevOps URLs!**
1182
-
1183
- ---
1184
-
1185
- ### PLAN BEFORE IMPLEMENTING
1186
-
1187
- After reading a work item, assess its complexity before starting:
1188
- - Multiple artifacts or cross-table changes → use \`plan_enter\`
1189
- - Unclear requirements or missing details → use \`plan_enter\` to investigate and ask questions
1190
- - Architectural decisions needed → use \`plan_enter\`
1191
-
1192
- Only skip planning for simple, single-artifact tasks with clear requirements.
787
+ *See Enterprise Integration Rules above for planning guidance and best practices.*
1193
788
 
1194
789
  ---
1195
790
 
@@ -1305,28 +900,6 @@ You are an **AUTONOMOUS DEVELOPER** with complete control over GitHub workflows.
1305
900
 
1306
901
  ---
1307
902
 
1308
- ## 🚨 CRITICAL: USE GITHUB TOOLS, NOT WEBFETCH!
1309
-
1310
- **⚠️ MANDATORY RULE: For ANY GitHub operation, you MUST use the GitHub MCP tools (discovered via \`tool_search("github")\`)!**
1311
-
1312
- | Task | ✅ CORRECT | ❌ WRONG |
1313
- |------|-----------|----------|
1314
- | View issue | Discover via \`tool_search("github issues")\`, then call | WebFetch to github.com URL |
1315
- | Check PR | Discover via \`tool_search("github pull request")\`, then call | WebFetch to github.com/pulls URL |
1316
- | Read file | Discover via \`tool_search("github content")\`, then call | WebFetch to raw.githubusercontent.com |
1317
- | Search code | Discover via \`tool_search("github search code")\`, then call | WebFetch to github.com/search |
1318
- | View workflow | Discover via \`tool_search("github workflow")\`, then call | WebFetch to github.com/actions |
1319
-
1320
- **Why GitHub tools are better:**
1321
- - **Authenticated**: Full API access, no rate limits
1322
- - **Structured data**: JSON responses, not HTML parsing
1323
- - **Write access**: Can create/update/merge, not just read
1324
- - **Reliable**: API is stable, web pages change
1325
-
1326
- **Discover GitHub tools via \`tool_search("github")\`. NEVER use WebFetch for GitHub URLs!**
1327
-
1328
- ---
1329
-
1330
903
  ## 📚 GITHUB ESSENTIALS
1331
904
 
1332
905
  ### Key Concepts
@@ -1369,16 +942,7 @@ await tool_search({ query: "github search code" });
1369
942
  // Call discovered tool: { query: "repo:owner/repo is:open is:issue label:bug -assignee:*" }
1370
943
  \`\`\`
1371
944
 
1372
- ---
1373
-
1374
- ### PLAN BEFORE IMPLEMENTING
1375
-
1376
- After reading an issue, assess complexity before starting work:
1377
- - Multi-file or multi-artifact changes → use \`plan_enter\`
1378
- - Unclear requirements, missing acceptance criteria → use \`plan_enter\` to investigate and clarify
1379
- - Multiple valid approaches → use \`plan_enter\` to explore options with the user
1380
-
1381
- For simple bug fixes or single-artifact tasks with clear requirements, proceed directly.
945
+ *See Enterprise Integration Rules above for planning guidance and best practices.*
1382
946
 
1383
947
  ---
1384
948
 
@@ -1440,31 +1004,17 @@ await tool_search({ query: "github create release" });
1440
1004
 
1441
1005
  ## 🎯 GITHUB CAPABILITIES
1442
1006
 
1443
- **Discover GitHub tools via \`tool_search\`:**
1444
-
1445
- | Category | Action | Discovery Query |
1446
- |----------|--------|----------------|
1447
- | **Discovery** | Get current user | \`tool_search("github current user")\` |
1448
- | **Discovery** | List repositories | \`tool_search("github list repositories")\` |
1449
- | **Discovery** | Discover configuration | \`tool_search("github discover configuration")\` |
1450
- | **Issues** | List/search issues | \`tool_search("github issues")\` |
1451
- | **Issues** | Get issue details | \`tool_search("github get issue")\` |
1452
- | **Issues** | Create issues | \`tool_search("github create issue")\` |
1453
- | **Issues** | Update issues | \`tool_search("github update issue")\` |
1454
- | **Issues** | Add comments | \`tool_search("github comment")\` |
1455
- | **Pull Requests** | List PRs | \`tool_search("github pull requests")\` |
1456
- | **Pull Requests** | Create PRs | \`tool_search("github create pr")\` |
1457
- | **Pull Requests** | Merge PRs | \`tool_search("github merge")\` |
1458
- | **Pull Requests** | List changed files | \`tool_search("github pr files")\` |
1459
- | **Workflows** | List workflow runs | \`tool_search("github workflow runs")\` |
1460
- | **Workflows** | Rerun workflows | \`tool_search("github rerun workflow")\` |
1461
- | **Workflows** | Cancel workflows | \`tool_search("github cancel workflow")\` |
1462
- | **Releases** | List releases | \`tool_search("github list releases")\` |
1463
- | **Releases** | Create releases | \`tool_search("github create release")\` |
1464
- | **Search** | Search code | \`tool_search("github search code")\` |
1465
- | **Search** | Search repos | \`tool_search("github search repos")\` |
1466
- | **Repo Sync** | Download repository | \`tool_search("github download")\` |
1467
- | **Repo Sync** | Upload files | \`tool_search("github upload")\` |
1007
+ **Discover via \`tool_search("github")\`.** Key queries:
1008
+
1009
+ | Action | Discovery Query |
1010
+ |--------|----------------|
1011
+ | Discover repos/user/config | \`"github discover configuration"\` |
1012
+ | Issues (list/create/update/comment) | \`"github issues"\`, \`"github create issue"\`, \`"github comment"\` |
1013
+ | PRs (create/merge/files) | \`"github create pr"\`, \`"github merge"\`, \`"github pr files"\` |
1014
+ | Workflows (runs/rerun/cancel) | \`"github workflow runs"\` |
1015
+ | Releases | \`"github create release"\` |
1016
+ | Search (code/repos) | \`"github search code"\` |
1017
+ | Repo sync (download/upload) | \`"github download"\`, \`"github upload"\` |
1468
1018
 
1469
1019
  ---
1470
1020
 
@@ -1531,27 +1081,6 @@ await tool_search({ query: "snow artifact manage" });
1531
1081
  // css_file: "/path/to/styles.scss"
1532
1082
  \`\`\`
1533
1083
 
1534
- ---
1535
-
1536
- ## 💡 BEST PRACTICES
1537
-
1538
- ### ✅ DO
1539
- 1. **Use discovery first** - Understand the repository structure
1540
- 2. **Link issues to PRs** - Reference issues in PR descriptions
1541
- 3. **Comment progress** - Keep issues updated with work status
1542
- 4. **Use labels** - Categorize and prioritize effectively
1543
- 5. **Monitor workflows** - Check CI/CD status after changes
1544
- 6. **Use artifact_directory** - For standard file naming conventions
1545
- 7. **Create PRs for sync** - Use createPR option when uploading to GitHub
1546
-
1547
- ### ❌ DON'T
1548
- 1. Create PRs without linked issues
1549
- 2. Merge without reviewing workflow status
1550
- 3. Work in silence without issue updates
1551
- 4. Force push to protected branches
1552
- 5. Upload sensitive data to public repositories
1553
- 6. Skip the file list check after download
1554
-
1555
1084
  `
1556
1085
  }
1557
1086
 
@@ -1564,27 +1093,6 @@ You are an **AUTONOMOUS DEVELOPER** with complete control over GitLab workflows.
1564
1093
 
1565
1094
  ---
1566
1095
 
1567
- ## 🚨 CRITICAL: USE GITLAB TOOLS, NOT WEBFETCH!
1568
-
1569
- **⚠️ MANDATORY RULE: For ANY GitLab operation, you MUST use the GitLab MCP tools (discovered via \`tool_search("gitlab")\`)!**
1570
-
1571
- | Task | ✅ CORRECT | ❌ WRONG |
1572
- |------|-----------|----------|
1573
- | View issue | Discover via \`tool_search("gitlab issues")\`, then call | WebFetch to gitlab.com URL |
1574
- | Check MR | Discover via \`tool_search("gitlab merge request")\`, then call | WebFetch to gitlab.com/-/merge_requests |
1575
- | Read file | Discover via \`tool_search("gitlab content")\`, then call | WebFetch to gitlab.com/-/raw |
1576
- | View pipeline | Discover via \`tool_search("gitlab pipeline")\`, then call | WebFetch to gitlab.com/-/pipelines |
1577
-
1578
- **Why GitLab tools are better:**
1579
- - **Authenticated**: Full API access, no rate limits
1580
- - **Structured data**: JSON responses, not HTML parsing
1581
- - **Write access**: Can create/update/merge, not just read
1582
- - **Reliable**: API is stable, web pages change
1583
-
1584
- **Discover GitLab tools via \`tool_search("gitlab")\`. NEVER use WebFetch for GitLab URLs!**
1585
-
1586
- ---
1587
-
1588
1096
  ## 📚 GITLAB ESSENTIALS
1589
1097
 
1590
1098
  ### Key Concepts
@@ -1629,14 +1137,7 @@ await tool_search({ query: "gitlab get issue" });
1629
1137
 
1630
1138
  ---
1631
1139
 
1632
- ### PLAN BEFORE IMPLEMENTING
1633
-
1634
- After reading an issue, assess complexity before starting work:
1635
- - Multi-file or multi-artifact changes → use \`plan_enter\`
1636
- - Unclear requirements, missing acceptance criteria → use \`plan_enter\` to investigate and clarify
1637
- - Multiple valid approaches → use \`plan_enter\` to explore options with the user
1638
-
1639
- For simple bug fixes or single-artifact tasks with clear requirements, proceed directly.
1140
+ *See Enterprise Integration Rules above for planning guidance and best practices.*
1640
1141
 
1641
1142
  ---
1642
1143
 
@@ -1713,48 +1214,18 @@ await tool_search({ query: "gitlab list releases" });
1713
1214
 
1714
1215
  ## 🎯 GITLAB CAPABILITIES
1715
1216
 
1716
- **Discover GitLab tools via \`tool_search\`:**
1717
-
1718
- | Category | Action | Discovery Query |
1719
- |----------|--------|----------------|
1720
- | **Discovery** | Get current user | \`tool_search("gitlab current user")\` |
1721
- | **Discovery** | List projects | \`tool_search("gitlab list projects")\` |
1722
- | **Discovery** | Discover configuration | \`tool_search("gitlab discover configuration")\` |
1723
- | **Issues** | List issues | \`tool_search("gitlab issues")\` |
1724
- | **Issues** | Get issue details | \`tool_search("gitlab get issue")\` |
1725
- | **Issues** | Create issues | \`tool_search("gitlab create issue")\` |
1726
- | **Issues** | Update issues | \`tool_search("gitlab update issue")\` |
1727
- | **Issues** | Add notes | \`tool_search("gitlab note")\` |
1728
- | **Merge Requests** | List MRs | \`tool_search("gitlab merge requests")\` |
1729
- | **Merge Requests** | Create MRs | \`tool_search("gitlab create mr")\` |
1730
- | **Merge Requests** | Accept MRs | \`tool_search("gitlab accept mr")\` |
1731
- | **Merge Requests** | List changes | \`tool_search("gitlab mr changes")\` |
1732
- | **Pipelines** | List pipelines | \`tool_search("gitlab pipelines")\` |
1733
- | **Pipelines** | Retry pipelines | \`tool_search("gitlab retry pipeline")\` |
1734
- | **Pipelines** | Cancel pipelines | \`tool_search("gitlab cancel pipeline")\` |
1735
- | **Pipelines** | List jobs | \`tool_search("gitlab jobs")\` |
1736
- | **Releases** | List releases | \`tool_search("gitlab list releases")\` |
1737
- | **Releases** | Create releases | \`tool_search("gitlab create release")\` |
1738
- | **Other** | Labels | \`tool_search("gitlab labels")\` |
1739
- | **Other** | Milestones | \`tool_search("gitlab milestones")\` |
1740
- | **Other** | Search | \`tool_search("gitlab search")\` |
1741
-
1742
- ---
1743
-
1744
- ## 💡 BEST PRACTICES
1217
+ **Discover via \`tool_search("gitlab")\`.** Key queries:
1745
1218
 
1746
- ### DO
1747
- 1. **Use discovery first** - Understand the project structure
1748
- 2. **Link issues to MRs** - Use "Closes #123" in MR descriptions
1749
- 3. **Monitor pipelines** - Check CI/CD status after changes
1750
- 4. **Use labels consistently** - Categorize and prioritize effectively
1751
- 5. **Comment progress** - Keep issues updated with work status
1219
+ | Action | Discovery Query |
1220
+ |--------|----------------|
1221
+ | Discover projects/user/config | \`"gitlab discover configuration"\` |
1222
+ | Issues (list/create/update/notes) | \`"gitlab issues"\`, \`"gitlab create issue"\`, \`"gitlab note"\` |
1223
+ | MRs (create/accept/changes) | \`"gitlab create mr"\`, \`"gitlab accept mr"\`, \`"gitlab mr changes"\` |
1224
+ | Pipelines (list/retry/cancel/jobs) | \`"gitlab pipelines"\`, \`"gitlab jobs"\` |
1225
+ | Releases | \`"gitlab create release"\` |
1226
+ | Other (labels/milestones/search) | \`"gitlab labels"\`, \`"gitlab search"\` |
1752
1227
 
1753
- ### ❌ DON'T
1754
- 1. Create MRs without linked issues
1755
- 2. Merge without pipeline success
1756
- 3. Work in silence without issue updates
1757
- 4. Skip code review process
1228
+ ---
1758
1229
 
1759
1230
  `
1760
1231
  }
@@ -1766,156 +1237,39 @@ function generateCrossPlatformWorkflow(
1766
1237
  hasGitHub: boolean = false,
1767
1238
  hasGitLab: boolean = false,
1768
1239
  ): string {
1769
- let workflow = `## 🔄 CROSS-PLATFORM AUTONOMOUS WORKFLOW
1770
-
1771
- `
1772
-
1773
- if (hasJira && hasConfluence) {
1774
- workflow += `### JIRA + SERVICENOW + CONFLUENCE
1775
-
1776
- **Enterprise tools**: Discover via \`tool_search("jira")\`, \`tool_search("confluence")\`
1777
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1778
-
1779
- **Complete Flow:**
1780
- 1. Search for story in Jira → discovered via \`tool_search("jira search")\`
1781
- 2. Transition to "In Progress" → discovered via \`tool_search("jira transition")\`
1782
- 3. Create Update Set in ServiceNow → discovered via \`tool_search("snow update set")\`
1783
- 4. Develop + add Jira comments after EACH component → discovered via \`tool_search("jira comment")\`
1784
- 5. Test + document results in Jira → discovered via \`tool_search("jira comment")\`
1785
- 6. Create Confluence docs → discovered via \`tool_search("confluence create page")\`
1786
- 7. Final Jira comment with Update Set + Confluence links → discovered via \`tool_search("jira comment")\`
1787
- 8. Transition to "Done" → discovered via \`tool_search("jira transition")\`
1240
+ // Build platform lookup table for active integrations
1241
+ const platforms: string[] = []
1242
+ if (hasJira) platforms.push("Jira")
1243
+ if (hasAzdo) platforms.push("Azure DevOps")
1244
+ if (hasGitHub) platforms.push("GitHub")
1245
+ if (hasGitLab) platforms.push("GitLab")
1246
+ if (hasConfluence) platforms.push("Confluence")
1788
1247
 
1789
- `
1790
- }
1791
-
1792
- if (hasAzdo && hasConfluence) {
1793
- workflow += `### AZURE DEVOPS + SERVICENOW + CONFLUENCE
1794
-
1795
- **Enterprise tools**: Discover via \`tool_search("azure devops")\`, \`tool_search("confluence")\`
1796
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1797
-
1798
- Same flow as Jira, use Azure DevOps tools discovered via \`tool_search\`:
1799
- - Search work items → \`tool_search("azdo search")\`
1800
- - Update work items → \`tool_search("azdo update")\`
1801
- - Add comments → \`tool_search("azdo comment")\`
1802
-
1803
- `
1804
- }
1805
-
1806
- // GitHub + ServiceNow workflow
1807
- if (hasGitHub) {
1808
- workflow += `### GITHUB + SERVICENOW
1809
-
1810
- **Enterprise tools**: Discover via \`tool_search("github")\`
1811
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1812
-
1813
- **Complete Flow:**
1814
- 1. Get issue from GitHub → discovered via \`tool_search("github issues")\`
1815
- 2. Assign + add "in-progress" label → discovered via \`tool_search("github update issue")\`
1816
- 3. Create Update Set in ServiceNow → discovered via \`tool_search("snow update set")\`
1817
- 4. Develop + add GitHub comments after EACH component → discovered via \`tool_search("github comment")\`
1818
- 5. Create PR when ready → discovered via \`tool_search("github create pr")\`
1819
- 6. Monitor workflow runs → discovered via \`tool_search("github workflow runs")\`
1820
- 7. Merge PR → discovered via \`tool_search("github merge")\`
1821
- 8. Create release if needed → discovered via \`tool_search("github create release")\`
1822
- 9. Close issue → discovered via \`tool_search("github update issue")\` with state: "closed"
1823
-
1824
- `
1825
- }
1826
-
1827
- // GitLab + ServiceNow workflow
1828
- if (hasGitLab) {
1829
- workflow += `### GITLAB + SERVICENOW
1830
-
1831
- **Enterprise tools**: Discover via \`tool_search("gitlab")\`
1832
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1833
-
1834
- **Complete Flow:**
1835
- 1. Get issue from GitLab → discovered via \`tool_search("gitlab issues")\`
1836
- 2. Assign + add labels → discovered via \`tool_search("gitlab update issue")\`
1837
- 3. Create Update Set in ServiceNow → discovered via \`tool_search("snow update set")\`
1838
- 4. Develop + add GitLab notes after EACH component → discovered via \`tool_search("gitlab note")\`
1839
- 5. Create MR when ready → discovered via \`tool_search("gitlab create mr")\`
1840
- 6. Monitor pipelines → discovered via \`tool_search("gitlab pipelines")\`
1841
- 7. Accept MR → discovered via \`tool_search("gitlab accept mr")\`
1842
- 8. Create release if needed → discovered via \`tool_search("gitlab create release")\`
1843
- 9. Close issue → discovered via \`tool_search("gitlab update issue")\` with stateEvent: "close"
1844
-
1845
- `
1846
- }
1847
-
1848
- // GitHub + Jira workflow
1849
- if (hasGitHub && hasJira) {
1850
- workflow += `### GITHUB + JIRA + SERVICENOW
1851
-
1852
- **Enterprise tools**: Discover via \`tool_search("github")\`, \`tool_search("jira")\`
1853
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1854
-
1855
- **Complete Flow (Code in GitHub, Stories in Jira):**
1856
- 1. Get story from Jira → discovered via \`tool_search("jira search")\`
1857
- 2. Transition to "In Progress" → discovered via \`tool_search("jira transition")\`
1858
- 3. Create Update Set in ServiceNow → discovered via \`tool_search("snow update set")\`
1859
- 4. Develop in ServiceNow + update Jira → discovered via \`tool_search("jira comment")\`
1860
- 5. Create GitHub PR for code changes → discovered via \`tool_search("github create pr")\`
1861
- 6. Link PR in Jira comment → discovered via \`tool_search("jira comment")\`
1862
- 7. Monitor GitHub Actions → discovered via \`tool_search("github workflow runs")\`
1863
- 8. Merge PR → discovered via \`tool_search("github merge")\`
1864
- 9. Complete Jira story → discovered via \`tool_search("jira transition")\`
1865
-
1866
- `
1867
- }
1868
-
1869
- // GitLab + Jira workflow
1870
- if (hasGitLab && hasJira) {
1871
- workflow += `### GITLAB + JIRA + SERVICENOW
1872
-
1873
- **Enterprise tools**: Discover via \`tool_search("gitlab")\`, \`tool_search("jira")\`
1874
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1875
-
1876
- **Complete Flow (Code in GitLab, Stories in Jira):**
1877
- 1. Get story from Jira → discovered via \`tool_search("jira search")\`
1878
- 2. Transition to "In Progress" → discovered via \`tool_search("jira transition")\`
1879
- 3. Create Update Set in ServiceNow → discovered via \`tool_search("snow update set")\`
1880
- 4. Develop in ServiceNow + update Jira → discovered via \`tool_search("jira comment")\`
1881
- 5. Create GitLab MR for code changes → discovered via \`tool_search("gitlab create mr")\`
1882
- 6. Link MR in Jira comment → discovered via \`tool_search("jira comment")\`
1883
- 7. Monitor GitLab Pipelines → discovered via \`tool_search("gitlab pipelines")\`
1884
- 8. Accept MR → discovered via \`tool_search("gitlab accept mr")\`
1885
- 9. Complete Jira story → discovered via \`tool_search("jira transition")\`
1886
-
1887
- `
1888
- }
1889
-
1890
- // GitHub/GitLab + Confluence workflow
1891
- if ((hasGitHub || hasGitLab) && hasConfluence) {
1892
- const vcs = hasGitHub ? "GitHub" : "GitLab"
1893
-
1894
- workflow += `### ${vcs.toUpperCase()} + CONFLUENCE + SERVICENOW
1895
-
1896
- **Enterprise tools**: Discover via \`tool_search("${vcs.toLowerCase()}")\`, \`tool_search("confluence")\`
1897
- **ServiceNow tools**: Discover via \`tool_search("snow update set")\`
1898
-
1899
- **Complete Flow:**
1900
- 1. Get issue from ${vcs} → discovered via \`tool_search("${vcs.toLowerCase()} issues")\`
1901
- 2. Create Update Set in ServiceNow → discovered via \`tool_search("snow update set")\`
1902
- 3. Develop + update ${vcs} issues → discovered via \`tool_search("${vcs.toLowerCase()} ${hasGitHub ? "comment" : "note"}")\`
1903
- 4. Create ${hasGitHub ? "PR" : "MR"} when ready → discovered via \`tool_search("${vcs.toLowerCase()} create ${hasGitHub ? "pr" : "mr"}")\`
1904
- 5. Create Confluence documentation → discovered via \`tool_search("confluence create page")\`
1905
- 6. Link documentation to ${vcs} issue → discovered via \`tool_search("${vcs.toLowerCase()} ${hasGitHub ? "comment" : "note"}")\`
1906
- 7. Complete and close
1907
-
1908
- `
1909
- }
1910
-
1911
- workflow += `### 🎯 AUTONOMY PRINCIPLES
1248
+ let workflow = `## 🔄 CROSS-PLATFORM AUTONOMOUS WORKFLOW
1912
1249
 
1913
- 1. **YOU ARE IN CONTROL** - Execute autonomously
1914
- 2. **UPDATE IN REAL-TIME** - After each component
1915
- 3. **LINK EVERYTHING** - Jira/Azure/GitHub/GitLab ServiceNow Confluence
1916
- 4. **DOCUMENT EVERYTHING** - Architecture, testing, deployment
1917
- 5. **BE PROACTIVE** - Handle blockers, create tickets, manage dependencies
1918
- 6. **MONITOR CI/CD** - Check GitHub Actions / GitLab Pipelines after changes
1250
+ ### Generic Flow (adapt per platform combination)
1251
+
1252
+ 1. **Get work item** from [Issue Tracker] \`tool_search("[platform] search/issues")\`
1253
+ 2. **Claim & transition** to "In Progress" → \`tool_search("[platform] transition/update")\`
1254
+ 3. **Create Update Set** in ServiceNow \`tool_search("snow update set")\`
1255
+ 4. **Develop** + comment progress after EACH component \`tool_search("[platform] comment/note")\`
1256
+ 5. **Create PR/MR** if using VCS → \`tool_search("[vcs] create pr/mr")\`
1257
+ 6. **Monitor CI/CD** → \`tool_search("[vcs] workflow runs/pipelines")\`
1258
+ 7. **Document** in Confluence (if available) → \`tool_search("confluence create page")\`
1259
+ 8. **Complete** — merge PR/MR, close issue, complete Update Set
1260
+
1261
+ ### Platform Discovery Queries
1262
+
1263
+ | Platform | Search | Update/Comment | Transition/Close |
1264
+ |----------|--------|----------------|------------------|
1265
+ | **Jira** | \`"jira search"\` | \`"jira comment"\`, \`"jira worklog"\` | \`"jira transition"\` |
1266
+ | **Azure DevOps** | \`"azdo search"\` | \`"azdo comment"\` | \`"azdo update"\` |
1267
+ | **GitHub** | \`"github issues"\` | \`"github comment"\` | \`"github update issue"\`, \`"github create pr"\`, \`"github merge"\` |
1268
+ | **GitLab** | \`"gitlab issues"\` | \`"gitlab note"\` | \`"gitlab update issue"\`, \`"gitlab create mr"\`, \`"gitlab accept mr"\` |
1269
+ | **Confluence** | \`"confluence search"\` | \`"confluence update page"\` | — |
1270
+ | **ServiceNow** | \`"snow update set"\` | — | — |
1271
+
1272
+ **Active integrations:** ${platforms.join(", ")}
1919
1273
 
1920
1274
  `
1921
1275