1010 concurrencyPolicy : Forbid
1111 successfulHistoryLimit : 5
1212 failedHistoryLimit : 1
13-
13+
1414 operationTemplate :
1515 spec :
1616 mode : Pipeline
@@ -33,31 +33,35 @@ spec:
3333 and makes scaling decisions based on CloudWatch performance metrics.
3434 userPrompt : |
3535 You are analyzing an XSQLInstance resource for potential RDS scaling needs.
36-
36+
3737 SCALING ANALYSIS CRITERIA:
3838 1. Check performance metrics in status.performanceMetrics
3939 2. Check current instanceClass in spec.parameters.instanceClass
4040 3. Check if analysis was done recently (intelligent-scaling annotations)
41-
41+
4242 RATE LIMITING:
4343 - Skip analysis if "intelligent-scaling/last-analyzed" annotation exists and is < 5 minutes old
4444 - Only proceed if no recent analysis or if metrics show significant changes
45-
45+
4646 SCALING TRIGGERS (conservative for cost control):
47- - CPU > 85%: scale up instance class
48- - FreeableMemory < 15%: scale up for memory pressure
49- - DatabaseConnections > 85% of max: scale up for connection pressure
50-
51- INSTANCE CLASS PROGRESSION:
52- db.t3.micro → db.t3.small → db.t3.medium → db.t3.large
53-
47+ - SCALE UP: CPU > 85%, Memory < 15%, Connections > 85%
48+ - SCALE DOWN: CPU < 20% AND Memory > 60% AND Connections < 30% for sustained period
49+
50+ INSTANCE CLASS PROGRESSION (bidirectional):
51+ db.t3.micro ↔ db.t3.small ↔ db.t3.medium ↔ db.t3.large
52+
53+ DOWNSCALING SAFETY:
54+ - Only scale down if ALL conditions met for sustained period
55+ - Check last-scaled annotation to prevent frequent changes
56+ - Ensure minimum 15-minute cooldown between scaling events
57+
5458 REQUIRED OUTPUT FORMAT:
5559 You must output the XSQLInstance resource in JSON format with ONLY the fields that need to be patched.
56-
60+
5761 If scaling is needed:
5862 {
5963 "apiVersion": "aws.platform.upbound.io/v1alpha1",
60- "kind": "XSQLInstance",
64+ "kind": "XSQLInstance",
6165 "metadata": {
6266 "name": "<exact-resource-name>",
6367 "annotations": {
@@ -71,10 +75,10 @@ spec:
7175 }
7276 }
7377 }
74-
78+
7579 If no scaling is needed:
7680 {
77- "apiVersion": "aws.platform.upbound.io/v1alpha1",
81+ "apiVersion": "aws.platform.upbound.io/v1alpha1",
7882 "kind": "XSQLInstance",
7983 "metadata": {
8084 "name": "<exact-resource-name>",
@@ -84,10 +88,10 @@ spec:
8488 }
8589 }
8690 }
87-
91+
8892 Rules:
8993 - Use the exact resource name from the input
90- - Only include fields that need to be updated
94+ - Only include fields that need to be updated
9195 - Use current timestamp in ISO8601 format
9296 - Provide brief, clear reasoning in annotations
9397 - Output only the JSON, no explanatory text
@@ -101,4 +105,4 @@ spec:
101105 namespace : crossplane-system
102106 name : claude
103107 retryLimit : 3
104- schedule : ' */10 * * * *' # Run every 10 minute for testing
108+ schedule : ' */2 * * * *' # Run every 2 minutes for demo
0 commit comments