@leejungkiin/awkit 1.0.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +146 -0
  3. package/VERSION +1 -0
  4. package/bin/awf.js +549 -0
  5. package/bin/awk.js +1759 -0
  6. package/core/AGENTS.md +39 -0
  7. package/core/GEMINI.md +202 -0
  8. package/core/GEMINI.md.bak +244 -0
  9. package/core/orchestrator.md +58 -0
  10. package/package.json +46 -0
  11. package/schemas/brain.schema.json +342 -0
  12. package/schemas/preferences.schema.json +95 -0
  13. package/schemas/session.schema.json +112 -0
  14. package/skill-packs/neural-memory/README.md +111 -0
  15. package/skill-packs/neural-memory/pack.json +35 -0
  16. package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
  17. package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
  18. package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
  19. package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
  20. package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
  21. package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
  22. package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
  23. package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
  24. package/skills/adaptive-language/SKILL.md +189 -0
  25. package/skills/ambient-brain/SKILL.md +314 -0
  26. package/skills/ambient-brain/brain-router.md +185 -0
  27. package/skills/ambient-brain/brain-templates.md +201 -0
  28. package/skills/auto-save/SKILL.md +223 -0
  29. package/skills/awf-adaptive-language/SKILL.md +189 -0
  30. package/skills/awf-context-help/SKILL.md +180 -0
  31. package/skills/awf-error-translator/SKILL.md +153 -0
  32. package/skills/awf-session-restore/SKILL.md +270 -0
  33. package/skills/awf-version-tracker/SKILL.md +32 -0
  34. package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
  35. package/skills/beads-manager/SKILL.md +323 -0
  36. package/skills/brainstorm-agent/SKILL.md +295 -0
  37. package/skills/context-help/SKILL.md +180 -0
  38. package/skills/error-translator/SKILL.md +153 -0
  39. package/skills/ios-engineer/SKILL.md +101 -0
  40. package/skills/memory-sync/SKILL.md +378 -0
  41. package/skills/memory-sync/memory-router.md +185 -0
  42. package/skills/memory-sync/memory-templates.md +201 -0
  43. package/skills/orchestrator/SKILL.md +193 -0
  44. package/skills/session-restore/SKILL.md +240 -0
  45. package/templates/CODEBASE.md +80 -0
  46. package/templates/brain.example.json +321 -0
  47. package/templates/preferences.example.json +21 -0
  48. package/templates/project-identity/android.json +28 -0
  49. package/templates/project-identity/backend-nestjs.json +24 -0
  50. package/templates/project-identity/expo.json +27 -0
  51. package/templates/project-identity/ios.json +27 -0
  52. package/templates/project-identity/web-nextjs.json +24 -0
  53. package/templates/session.example.json +53 -0
  54. package/templates/specs/design-template.md +166 -0
  55. package/templates/specs/requirements-template.md +65 -0
  56. package/templates/specs/tasks-template.md +132 -0
  57. package/templates/structures/android.txt +10 -0
  58. package/templates/structures/backend-nestjs.txt +6 -0
  59. package/templates/structures/expo.txt +9 -0
  60. package/templates/structures/ios.txt +9 -0
  61. package/templates/structures/web-nextjs.txt +6 -0
  62. package/templates/workflow_dual_mode_template.md +87 -0
  63. package/workflows/_uncategorized/README.md +339 -0
  64. package/workflows/_uncategorized/ads-creative.md +357 -0
  65. package/workflows/_uncategorized/ads-full-optimization.md +308 -0
  66. package/workflows/_uncategorized/ads-plan.md +247 -0
  67. package/workflows/_uncategorized/ads-user-analysis.md +337 -0
  68. package/workflows/_uncategorized/skill-health.md +35 -0
  69. package/workflows/_uncategorized/skill-rollback.md +35 -0
  70. package/workflows/ads/admob.md +62 -0
  71. package/workflows/ads/ads-analyst.md +201 -0
  72. package/workflows/ads/ads-audit.md +106 -0
  73. package/workflows/ads/ads-optimize.md +97 -0
  74. package/workflows/ads/ads-targeting.md +241 -0
  75. package/workflows/ads/adsExpert.md +160 -0
  76. package/workflows/ads/smali-ads-config.md +400 -0
  77. package/workflows/ads/smali-ads-flow.md +331 -0
  78. package/workflows/ads/smali-ads-interstitial.md +377 -0
  79. package/workflows/ads/smali-ads-native.md +382 -0
  80. package/workflows/context/auto-execution-workflow.md +291 -0
  81. package/workflows/context/auto-implement.md +211 -0
  82. package/workflows/context/codebase-sync.md +163 -0
  83. package/workflows/context/logic-reasoning-workflow.md +260 -0
  84. package/workflows/context/next.md +195 -0
  85. package/workflows/context/recap.md +212 -0
  86. package/workflows/context/save-brain.md +285 -0
  87. package/workflows/context/user-intent-analysis-workflow.md +206 -0
  88. package/workflows/expert/codeExpert.md +126 -0
  89. package/workflows/expert/debugExpert.md +136 -0
  90. package/workflows/expert/planExpert.md +112 -0
  91. package/workflows/git/cloudflare-tunnel.md +135 -0
  92. package/workflows/git/git-commit-workflow.md +75 -0
  93. package/workflows/git/hotfix.md +357 -0
  94. package/workflows/git/release-notes.md +160 -0
  95. package/workflows/git/rollback.md +52 -0
  96. package/workflows/git/smart-git-ops.md +103 -0
  97. package/workflows/lifecycle/brainstorm.md +377 -0
  98. package/workflows/lifecycle/code.md +663 -0
  99. package/workflows/lifecycle/debug.md +116 -0
  100. package/workflows/lifecycle/deploy.md +95 -0
  101. package/workflows/lifecycle/init.md +152 -0
  102. package/workflows/lifecycle/master-code-workflow.md +300 -0
  103. package/workflows/lifecycle/migration.md +196 -0
  104. package/workflows/lifecycle/plan.md +91 -0
  105. package/workflows/lifecycle/refactor.md +165 -0
  106. package/workflows/lifecycle/run.md +52 -0
  107. package/workflows/lifecycle/test.md +91 -0
  108. package/workflows/meta/customize.md +346 -0
  109. package/workflows/meta/file-protection-rules.md +129 -0
  110. package/workflows/meta/help.html +350 -0
  111. package/workflows/meta/project-identity-enforcement.md +180 -0
  112. package/workflows/mobile/app-analysis.md +64 -0
  113. package/workflows/mobile/maestro-qa-workflow.md +470 -0
  114. package/workflows/mobile/maestro-test-workflow.md +84 -0
  115. package/workflows/mobile/structure-clean-architect.md +271 -0
  116. package/workflows/mobile/turbo-mobile-build.md +190 -0
  117. package/workflows/quality/accessibility-audit.md +311 -0
  118. package/workflows/quality/audit.md +217 -0
  119. package/workflows/quality/bug-hunter.md +243 -0
  120. package/workflows/quality/code-janitor.md +209 -0
  121. package/workflows/quality/code-quality-rules.md +132 -0
  122. package/workflows/quality/performance-audit.md +343 -0
  123. package/workflows/quality/project-audit.md +61 -0
  124. package/workflows/quality/self-healing-test.md +192 -0
  125. package/workflows/quality/ui-review.md +130 -0
  126. package/workflows/quality/ux-audit.md +213 -0
  127. package/workflows/quality/visual-debug.md +34 -0
  128. package/workflows/roles/oracle.md +267 -0
  129. package/workflows/roles/product-manager-workflow.md +52 -0
  130. package/workflows/roles/qa-engineer-workflow.md +41 -0
  131. package/workflows/roles/tech-lead-workflow.md +45 -0
  132. package/workflows/roles/ui-ux-designer-workflow.md +42 -0
  133. package/workflows/roles/vibe-coding-master-workflow.md +52 -0
  134. package/workflows/ui/app-screen-analyzer.md +152 -0
  135. package/workflows/ui/create-feature.md +332 -0
  136. package/workflows/ui/create-spec-architect.md +184 -0
  137. package/workflows/ui/design-to-ui.md +308 -0
  138. package/workflows/ui/ui-first-methodology.md +279 -0
  139. package/workflows/ui/visualize.md +298 -0
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: 📊 Tự động phân tích & báo cáo hiệu suất Google Ads hàng ngày (Dual-Mode v5.0)
3
+ ---
4
+
5
+ # WORKFLOW: /ads-audit - The Ads Analyst (Dual-Mode + Beads)
6
+
7
+ > **Mode A (Expert):** `/adsExpert [id]` -> Auto check & create tasks.
8
+ > **Mode B (Guided):** `/ads-audit` -> Chọn Account -> Phân tích -> Hướng dẫn chi tiết.
9
+
10
+ ---
11
+
12
+ ## 🅰️ Expert Mode (Alias)
13
+
14
+ User gõ `/ads-audit --auto` hoặc `/adsExpert` sẽ kích hoạt workflow Expert.
15
+ Xem: `global_workflows/adsExpert.md`.
16
+
17
+ ---
18
+
19
+ ## 🅱️ Guided Mode (Interactive Wizard)
20
+
21
+ ### Phase 1: Context & Selection
22
+ 1. **List Accounts:**
23
+ - Call `mcp-google-ads.list_accounts()`
24
+ - Hiển thị list cho User chọn (nếu chưa chọn).
25
+ 2. **Currency Check:**
26
+ - Call `mcp-google-ads.get_account_currency(id)`
27
+
28
+ ### Phase 2: Data Acquisition (Visible Steps)
29
+ *AI thông báo rõ đang làm gì:*
30
+ 1. "Đang lấy dữ liệu hôm qua..." (`get_campaign_performance(days=1)`)
31
+ 2. "Đang check xu hướng 7 ngày..." (`get_campaign_performance(days=7)`)
32
+ 3. "Đang quét từ khóa lãng phí..." (`run_gaql(...)`)
33
+
34
+ ### Phase 3: Analysis & Insights
35
+ 1. **Vital Signs:**
36
+ - Spend hôm qua vs Trung bình tuần.
37
+ - CPA hôm qua vs Target.
38
+ 2. **Health Check:**
39
+ - Có campaign nào max budget?
40
+ - Có từ khóa rác (High spend, 0 conv)?
41
+
42
+ ### Phase 4: Strategy Menu
43
+ User nhận được tóm tắt và menu chọn hành động:
44
+
45
+ ```markdown
46
+ 📊 **Audit Summary:**
47
+ - Spend Yesterday: 500k (Cao hơn TB 20%)
48
+ - Alerts: ⚠️ 2 Từ khóa rác phát hiện
49
+
50
+ ➡️ **Chiến lược tiếp theo:**
51
+ 1️⃣ 🧹 Dọn dẹp rác ngay (Review & Pause)
52
+ 2️⃣ 📿 Tạo task Beads để xử lý sau
53
+ 3️⃣ 📝 Xem báo cáo đầy đủ
54
+ 4️⃣ 🔍 Phân tích sâu hơn (`/ads-analyst`)
55
+ ```
56
+
57
+ ### Phase 5: Beads Integration
58
+ - Nếu chọn **2 (Create Task)**:
59
+ - AI tự động tạo các tasks:
60
+ - `bd create "Pause Keyword X (Waste 200k)" --label ads`
61
+ - `bd create "Review Campaign Y (CPA too high)" --label ads`
62
+
63
+ ---
64
+
65
+ ## 🔍 GAQL Helper (Ẩn)
66
+
67
+ **Query: Wasted Keywords**
68
+ ```sql
69
+ SELECT keyword_view.resource_name, metrics.cost_micros, metrics.conversions
70
+ FROM keyword_view
71
+ WHERE segments.date WITHIN LAST_30_DAYS
72
+ AND metrics.cost_micros > 500000000 -- >500k VND
73
+ AND metrics.conversions = 0
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 📜 History Tracking Rule (Bắt buộc)
79
+
80
+ Sau khi hoàn thành workflow, AI **PHẢI** ghi log vào file `brain/ads_history_log.md` theo format sau:
81
+
82
+ ```markdown
83
+ ### [YYYY-MM-DD HH:mm] /ads-audit
84
+ - **Action:** [Mô tả ngắn gọn hành động đã làm]
85
+ - **Target:** [Campaign ID / Ad Group / Keyword]
86
+ - **Before:** [Metrics trước khi optimze - optional]
87
+ - **Outcome:** [Kết quả hoặc Hy vọng đạt được]
88
+ ```
89
+
90
+ **Lưu ý:** Nếu file không tồn tại, hãy tạo mới.
91
+
92
+ ---
93
+
94
+ ## 🧠 Brain Logic
95
+
96
+ - **Save Report:** Luôn lưu báo cáo audit vào `reports/ads/audit_[date].md`.
97
+ - **Knowledge:** Nếu phát hiện pattern (vd: Thứ 7 luôn đắt), ghi vào Brain (`brain/ads_insights.md`).
98
+
99
+ ---
100
+
101
+ ## ⚠️ NEXT STEPS:
102
+ ```
103
+ 1️⃣ Optimize ngay (`/ads-optimize`)
104
+ 2️⃣ Làm mới Ads (`/ads-creative`)
105
+ 3️⃣ Check tasks (`/todo`)
106
+ ```
@@ -0,0 +1,97 @@
1
+ ---
2
+ description: 📈 Tối ưu chiến dịch quảng cáo & giảm CPI (Dual-Mode v5.0)
3
+ ---
4
+
5
+ # WORKFLOW: /ads-optimize - The Campaign Optimizer (Dual-Mode)
6
+
7
+ > **Mục tiêu:** Giảm CPI, tăng ROAS thông qua các action cụ thể (Bid, Negative KW, Scaling).
8
+
9
+ ---
10
+
11
+ ## 🅰️ Expert Mode (Auto-Optimize)
12
+
13
+ Sử dụng `/adsExpert [id] --optimize` để tự động thực hiện các tối ưu an toàn:
14
+ - Add Negative Keywords chắc chắn (click spam).
15
+ - Pause Ads có CTR cực thấp (<0.5%).
16
+
17
+ ---
18
+
19
+ ## 🅱️ Guided Mode (Interactive)
20
+
21
+ ### Phase 1: Optimization Goals
22
+ User chọn mục tiêu:
23
+ 1. **Cut Waste:** Giảm tiền lãng phí (Negative KW, Pause bad ads).
24
+ 2. **Scale Up:** Tăng ngân sách cho campaign tốt.
25
+ 3. **Revive:** Cứu campaign đang chết dần.
26
+
27
+ ### Phase 2: Analysis & Suggestions
28
+
29
+ **Scenario 1: Cut Waste**
30
+ - Query: Search Terms with High Spend & 0 Conv.
31
+ - Query: Display Placements with High Spend & 0 Conv.
32
+ - Action: "Thêm [X] từ khóa vào Negative List?"
33
+
34
+ **Scenario 2: Scale Up**
35
+ - Query: Campaigns with CPA < Target & Lost Impression Share (Budget).
36
+ - Action: "Tăng ngân sách Campaign [Name] thêm 20%?"
37
+
38
+ ### Phase 3: Action Execution
39
+ - AI thực hiện thay đổi thông qua MCP (nếu tool hỗ trợ write).
40
+ - Nếu MCP chưa hỗ trợ write (an toàn): -> **Tạo Beads Task hướng dẫn chi tiết.**
41
+
42
+ ### Phase 4: Beads Integration (Task Generation)
43
+
44
+ **Tạo Action Plan trong Beads:**
45
+
46
+ ```bash
47
+ # Example: Cut Waste Plan
48
+ bd create "Ads Optimization: Cut Waste [Date]" --priority 1
49
+ bd create "Add 5 Negative Keywords" --parent [ParentID] --note "burn, hack, free,..."
50
+ bd create "Exclude 10 Mobile App Placements" --parent [ParentID]
51
+
52
+ # Example: Scale Plan
53
+ bd create "Ads Optimization: Scale Up [Date]" --priority 0
54
+ bd create "Increase Budget: Campaign A (+20%)" --parent [ParentID]
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 🔍 GAQL Queries
60
+
61
+ **Find Good Campaigns (Ready to Scale):**
62
+ ```sql
63
+ SELECT campaign.name, metrics.cost_per_conversion, metrics.search_budget_lost_impression_share
64
+ FROM campaign
65
+ WHERE segments.date WITHIN LAST_7_DAYS
66
+ AND metrics.cost_per_conversion < 50000000 -- <50k CPA
67
+ AND metrics.search_budget_lost_impression_share > 0.1 -- Lost >10% due to budget
68
+ ```
69
+
70
+ ---
71
+
72
+ ## 📜 History Tracking Rule (Bắt buộc)
73
+
74
+ Sau khi hoàn thành workflow, AI **PHẢI** ghi log vào file `brain/ads_history_log.md` theo format sau:
75
+
76
+ ```markdown
77
+ ### [YYYY-MM-DD HH:mm] /ads-optimize
78
+ - **Action:** [Mô tả ngắn gọn hành động đã làm, vd: Cut Waste, Scale Up]
79
+ - **Target:** [Campaign ID / Ad Group / Keyword]
80
+ - **Outcome:** [Kết quả hoặc Hy vọng đạt được]
81
+ ```
82
+
83
+ **Lưu ý:** Nếu file không tồn tại, hãy tạo mới.
84
+
85
+ ---
86
+
87
+ ## 🧠 Brain Integration
88
+
89
+ - Lưu "Winning optimization" vào Brain. Ví dụ: "Tăng budget vào Thứ 6 thường hiệu quả".
90
+
91
+ ---
92
+
93
+ ## ⚠️ NEXT STEPS:
94
+ ```
95
+ 1️⃣ Xác nhận task trong Beads (`/todo`)
96
+ 2️⃣ Kiểm tra lại Audit (`/ads-audit`)
97
+ ```
@@ -0,0 +1,241 @@
1
+ ---
2
+ description: 🎯 Tạo nhóm quảng cáo target đúng user
3
+ ---
4
+
5
+ # WORKFLOW: /ads-targeting - The Audience Architect
6
+
7
+ Bạn là **Antigravity Ads Targeting Expert** - chuyên gia tạo nhóm quảng cáo nhắm đúng đối tượng với chi phí thấp.
8
+
9
+ **Nhiệm vụ:** Tạo ad groups tối ưu để thu hút lượt cài đặt chất lượng.
10
+
11
+ ---
12
+
13
+ ## 🎯 Mục tiêu
14
+
15
+ - Tạo ad groups phù hợp với từng đối tượng người dùng
16
+ - Giảm CPI bằng cách target chính xác
17
+ - Tối ưu creative cho từng segment
18
+
19
+ ---
20
+
21
+ ## Giai đoạn 1: Audience Research
22
+
23
+ ### 1.1. User Persona Analysis
24
+ ```
25
+ 📋 Hãy mô tả app của anh/chị:
26
+
27
+ 1️⃣ App category (Games, Productivity, Health, etc.)
28
+ 2️⃣ Problem app giải quyết
29
+ 3️⃣ User lý tưởng (tuổi, giới tính, sở thích)
30
+ 4️⃣ Điểm khác biệt so với đối thủ
31
+
32
+ Gõ số hoặc mô tả chi tiết:
33
+ ```
34
+
35
+ ### 1.2. Data-Driven Segments
36
+ Dựa trên dữ liệu từ Firebase Analytics và Google Play Console:
37
+
38
+ | Segment | Đặc điểm | Potential |
39
+ |---------|----------|-----------|
40
+ | High-Value | LTV cao, retention tốt | ⭐⭐⭐ |
41
+ | Volume | CPI thấp, volume lớn | ⭐⭐ |
42
+ | Emerging | Thị trường mới, đang phát triển | ⭐⭐⭐ |
43
+ | Lookalike | Giống với high-value users | ⭐⭐⭐ |
44
+
45
+ ---
46
+
47
+ ## Giai đoạn 2: Keyword Grouping Strategy
48
+
49
+ ### 2.1. SKAG (Single Keyword Ad Groups)
50
+ Cho từ khóa có volume cao và performance tốt:
51
+ ```
52
+ Ad Group: "meditation app"
53
+ ├── Keyword: [meditation app] (Exact)
54
+ ├── Ad 1: Headline focusing on meditation
55
+ ├── Ad 2: Headline variation
56
+ └── Landing: App store listing
57
+ ```
58
+
59
+ ### 2.2. STAG (Single Theme Ad Groups)
60
+ Cho nhóm từ khóa liên quan:
61
+ ```
62
+ Ad Group: "stress relief"
63
+ ├── Keyword 1: [stress relief app]
64
+ ├── Keyword 2: [anxiety relief app]
65
+ ├── Keyword 3: [calm app]
66
+ ├── Shared Ads focusing on stress relief
67
+ └── Landing: App store listing
68
+ ```
69
+
70
+ ### 2.3. Intent-Based Groups
71
+ | Intent | Keywords | Ad Message |
72
+ |--------|----------|------------|
73
+ | Problem-Aware | "can't sleep", "insomnia help" | Giải quyết vấn đề |
74
+ | Solution-Aware | "sleep app", "meditation app" | So sánh solution |
75
+ | Product-Aware | "[App name]", "[Competitor]" | Ưu điểm app |
76
+
77
+ ---
78
+
79
+ ## Giai đoạn 3: Geographic Targeting
80
+
81
+ ### 3.1. Tier Classification
82
+ Dựa trên dữ liệu conversion và CPI:
83
+
84
+ **Tier 1 (High Priority):**
85
+ - Countries với conversion rate > average
86
+ - CPI trong budget
87
+ - Volume đủ lớn
88
+
89
+ **Tier 2 (Medium Priority):**
90
+ - Countries có potential nhưng chưa test
91
+ - CPI acceptable
92
+ - Emerging markets
93
+
94
+ **Tier 3 (Test):**
95
+ - Countries mới, chưa có data
96
+ - Budget nhỏ để test
97
+ - Potential hidden gems
98
+
99
+ ### 3.2. Language Targeting
100
+ ```
101
+ ✅ Best Practice:
102
+ - Tạo ad groups riêng cho mỗi ngôn ngữ
103
+ - Localize ad copy
104
+ - Localize store listing
105
+
106
+ 📊 Priority Languages (dựa trên data):
107
+ 1. [Language 1] - X% users
108
+ 2. [Language 2] - Y% users
109
+ 3. [Language 3] - Z% users
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Giai đoạn 4: Ad Group Structure
115
+
116
+ ### 4.1. Campaign Structure Template
117
+ ```
118
+ Campaign: [App Name] - Install
119
+ ├── Ad Group: High-Intent Keywords (Exact)
120
+ │ ├── Keywords: [app name], [competitor]
121
+ │ └── Ads: Brand-focused
122
+
123
+ ├── Ad Group: Problem Keywords
124
+ │ ├── Keywords: [problem 1], [problem 2]
125
+ │ └── Ads: Problem-solution focused
126
+
127
+ ├── Ad Group: Solution Keywords
128
+ │ ├── Keywords: [solution 1], [solution 2]
129
+ │ └── Ads: Feature-focused
130
+
131
+ ├── Ad Group: Country-Specific (Tier 1)
132
+ │ ├── Geo: [Country list]
133
+ │ └── Ads: Localized
134
+
135
+ └── Ad Group: Discovery (Broad)
136
+ ├── Keywords: Broad match with Smart Bidding
137
+ └── Budget: Test budget
138
+ ```
139
+
140
+ ### 4.2. Budget Allocation
141
+ | Ad Group Type | % Budget | Goal |
142
+ |---------------|----------|------|
143
+ | High-Intent | 40% | Conversions |
144
+ | Problem/Solution | 30% | Quality users |
145
+ | Geographic | 20% | Expansion |
146
+ | Discovery | 10% | Find new keywords |
147
+
148
+ ---
149
+
150
+ ## Giai đoạn 5: Creative Strategy
151
+
152
+ ### 5.1. Ad Variations per Group
153
+ ```
154
+ Mỗi ad group cần tối thiểu:
155
+ - 2-3 headlines khác nhau
156
+ - 2 descriptions khác nhau
157
+ - Multiple image sizes
158
+
159
+ ✅ Test Framework:
160
+ - Week 1-2: Run all variations
161
+ - Week 3: Analyze performance
162
+ - Week 4: Kill losers, scale winners
163
+ ```
164
+
165
+ ### 5.2. Message Matching
166
+ | Keyword Intent | Headline Focus | Description Focus |
167
+ |----------------|----------------|-------------------|
168
+ | Problem | Giải quyết [Problem] | How app solves it |
169
+ | Solution | [Solution] #1 App | Key features |
170
+ | Competitor | Switch from [X] | Comparison points |
171
+ | Brand | [App Name] Official | Trust + download |
172
+
173
+ ---
174
+
175
+ ## Giai đoạn 6: Implementation
176
+
177
+ ### 6.1. Google Ads Setup Checklist
178
+ - [ ] Campaign created with correct goal
179
+ - [ ] Ad groups structured per template
180
+ - [ ] Keywords added with correct match types
181
+ - [ ] Negative keywords added
182
+ - [ ] Ads created with variations
183
+ - [ ] Bidding strategy selected
184
+ - [ ] Budget allocated
185
+ - [ ] Tracking verified
186
+
187
+ ### 6.2. Output Template
188
+ ```markdown
189
+ # 🎯 Ad Group Setup - [App Name]
190
+
191
+ ## Campaign: [Name]
192
+ - Objective: App Installs
193
+ - Bidding: Target CPI $X.XX
194
+ - Daily Budget: $XX
195
+
196
+ ## Ad Groups Created:
197
+
198
+ ### 1. [Ad Group Name]
199
+ - Keywords: [list]
200
+ - Match Types: [types]
201
+ - Target CPI: $X.XX
202
+ - Ads: [count]
203
+
204
+ ### 2. [Ad Group Name]
205
+ ...
206
+
207
+ ## Negative Keywords Added:
208
+ - [List]
209
+
210
+ ## Next Steps:
211
+ 1. Monitor for 7 days
212
+ 2. Review /ads-analyst
213
+ 3. Optimize based on data
214
+ ```
215
+
216
+ ---
217
+
218
+ ## 📜 History Tracking Rule (Bắt buộc)
219
+
220
+ Sau khi hoàn thành workflow, AI **PHẢI** ghi log vào file `brain/ads_history_log.md` theo format sau:
221
+
222
+ ```markdown
223
+ ### [YYYY-MM-DD HH:mm] /ads-targeting
224
+ - **Action:** [Create Ad Groups]
225
+ - **Target:** [App Name / Campaign: Name]
226
+ - **Output:** [Counts: Ad Groups, Keywords]
227
+ - **Strategy:** [Strategic Note, e.g: SKAG for High Intent]
228
+ ```
229
+
230
+ **Lưu ý:** Nếu file không tồn tại, hãy tạo mới.
231
+
232
+ ---
233
+
234
+ ## ⚠️ NEXT STEPS (Menu số):
235
+ ```
236
+ 1️⃣ Phân tích hiệu suất ad groups → /ads-analyst
237
+ 2️⃣ Tối ưu campaigns hiện tại → /ads-optimize
238
+ 3️⃣ Tạo thêm ad groups cho segment khác
239
+ 4️⃣ Lưu setup template → /save-brain
240
+ 5️⃣ Review creative assets
241
+ ```
@@ -0,0 +1,160 @@
1
+ ---
2
+ description: ⚡ Tối ưu Ads tự động (Expert Mode)
3
+ ---
4
+
5
+ # WORKFLOW: /adsExpert - Instant Ads Optimization
6
+
7
+ > **Expert Mode Only:** Tự động Audit & Optimize tài khoản Google Ads. Không hỏi, chỉ làm & báo cáo. Nội dung phản hồi và báo cáo bằng tiếng Việt
8
+
9
+ ---
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ /adsExpert [account_id] [--auto-fix]
15
+ ```
16
+
17
+ **Examples:**
18
+ ```bash
19
+ /adsExpert 5527743070 # Audit & Report only
20
+ /adsExpert 5527743070 --auto-fix # Pause bad ads/keywords automatically
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Execution Flow
26
+
27
+ ### 1. Data Fetching (Auto)
28
+ *Utilizes `mcp-google-ads`*
29
+
30
+ 1. **Get Currency:** `get_account_currency(customer_id)`
31
+ 2. **Get Performance:**
32
+ - `get_campaign_performance(days=1)` (Yesterday)
33
+ - `get_campaign_performance(days=7)` (Trend)
34
+ - `get_ad_performance(days=30)` (Deep Dive)
35
+
36
+ ### 2. Rule-Based Analysis (Auto)
37
+
38
+ AI tự động check các rules sau:
39
+
40
+ | Rule ID | Name | Condition | Severity |
41
+ |---------|------|-----------|----------|
42
+ | R1 | Wasted Spend | Cost > 200k & Conv = 0 | 🔴 Critical |
43
+ | R2 | High CPA | CPA > 2x Account Avg | 🟠 Warning |
44
+ | R3 | Low CTR | CTR < 1.0% (Search) | 🟡 Info |
45
+ | R4 | Limited Budget | Cost ~= Budget | 🟠 Warning |
46
+ | R5 | Good Mover | ROAS > 2.0 | 🟢 Opportunity |
47
+
48
+ ### 3. Execution (Action)
49
+
50
+ **Without `--auto-fix`:**
51
+ - Tổng hợp lỗi vào Report.
52
+ - Tạo Beads Tasks cho các lỗi R1, R2.
53
+
54
+ **With `--auto-fix`:**
55
+ - **R1 (Wasted Spend):** Auto-pause Keyword/Ad Group.
56
+ - **R2, R3, R4:** Tạo Beads Task.
57
+
58
+ ### 4. Beads Integration
59
+
60
+ ```bash
61
+ # R1: Wasted Spend -> Critical Task
62
+ bd create "Pause Waste: [Keyword] ($$ Spend, 0 Conv)" --label ads-waste --priority 0
63
+
64
+ # R2: High CPA -> Investigation Task
65
+ bd create "Investigate High CPA: [Campaign] (CPA: $$)" --label ads-optimize --priority 1
66
+
67
+ # R5: Good Mover -> Scale Task
68
+ bd create "Scale Up: [Campaign] (ROAS: 2.5)" --label ads-scale --priority 1
69
+ ```
70
+
71
+ ### 5. Report Generation
72
+
73
+ Tạo file: `reports/ads/[date]_expert_audit.md`
74
+
75
+ ```markdown
76
+ # ⚡ Ads Expert Report - [Date]
77
+
78
+ ## 📊 Pulse Check
79
+ - Spend Yesterday: 500,000 VND
80
+ - Conversions: 10 (CPA: 50,000 VND)
81
+ - ROAS: 2.1
82
+
83
+ ## 🚨 Actions Taken (Auto-Fix)
84
+ - Paused Keyword: "free download" (Spent 200k, 0 conv)
85
+
86
+ ## 📿 Beads Tasks Created
87
+ 1. [P0] Pause Waste: "cheat codes" (Spent 150k, 0 conv) #123
88
+ 2. [P1] Investigate High CPA: "Competitor Campaign" #124
89
+ 3. [P1] Scale Up: "Brand Campaign" #125
90
+
91
+ ➡️ **Next:** Review tasks at `/todo`
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 📜 History Tracking Rule (Bắt buộc)
97
+
98
+ Sau khi hoàn thành workflow, AI **PHẢI** ghi log vào file `brain/ads_history_log.md` theo format sau:
99
+
100
+ ```markdown
101
+ ### [YYYY-MM-DD HH:mm] /adsExpert
102
+ - **Action:** [Mô tả ngắn gọn hành động đã làm, vd: Auto-fix, Report Only]
103
+ - **Target:** [Account ID]
104
+ - **Action Details:** [List các hành động auto-fix đã thực hiện]
105
+ ```
106
+
107
+ **Lưu ý:** Nếu file không tồn tại, hãy tạo mới.
108
+
109
+ ---
110
+
111
+ ## Analysis Logic (Internal)
112
+
113
+ ### Wasted Spend Query (GAQL)
114
+ ```sql
115
+ SELECT
116
+ campaign.name,
117
+ ad_group.name,
118
+ keyword_view.resource_name,
119
+ metrics.cost_micros,
120
+ metrics.conversions
121
+ FROM keyword_view
122
+ WHERE
123
+ segments.date DURING LAST_30_DAYS
124
+ AND metrics.cost_micros > 200000000
125
+ AND metrics.conversions = 0
126
+ ```
127
+
128
+ ### High CPA Query (GAQL)
129
+ ```sql
130
+ SELECT
131
+ campaign.name,
132
+ metrics.cost_micros,
133
+ metrics.conversions,
134
+ metrics.cost_per_conversion
135
+ FROM campaign
136
+ WHERE
137
+ segments.date DURING LAST_7_DAYS
138
+ AND metrics.conversions > 0
139
+ ORDER BY metrics.cost_per_conversion DESC
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Error Handling
145
+
146
+ ### API Failures
147
+ - `get_campaign_performance` fail -> Retry 3 times.
148
+ - If fail -> Create Task "Check Google Ads Connection" & Exit.
149
+
150
+ ### No Data
151
+ - If Spend = 0 -> "Account inactive. No optimization needed."
152
+
153
+ ---
154
+
155
+ ## ⚠️ NEXT STEPS (Menu):
156
+ ```
157
+ 1️⃣ Review tasks (`/todo`)
158
+ 2️⃣ Chạy Creative Audit (`/ads-creative`)
159
+ 3️⃣ Chạy Full Audit (`/ads-audit`)
160
+ ```