vibes-plug 2.5.0 → 2.14.1

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 (187) hide show
  1. package/.claude/rules/vibes-plug-core.md +32 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +51 -0
  3. package/.cursorrules +42 -0
  4. package/AGENTS.md +37 -7
  5. package/BLUEPRINT.md +319 -217
  6. package/CHANGELOG.md +170 -1
  7. package/CLAUDE.md +70 -0
  8. package/LICENSE +1 -1
  9. package/README.md +611 -415
  10. package/index.js +19 -0
  11. package/package.json +44 -8
  12. package/plugin.json +24 -7
  13. package/scripts/check-anti-slop.js +53 -0
  14. package/scripts/generate_swarm_gif.py +295 -0
  15. package/scripts/install.js +201 -0
  16. package/skills/accessibility-testing-expert/SKILL.md +116 -0
  17. package/skills/ai-llm-integration-expert/SKILL.md +192 -178
  18. package/skills/ai-media-generation-expert/SKILL.md +172 -0
  19. package/skills/ai-prompt-engineering-expert/SKILL.md +134 -0
  20. package/skills/angular-expert/SKILL.md +148 -0
  21. package/skills/anti-slop/SKILL.md +133 -0
  22. package/skills/api-design-expert/SKILL.md +6 -3
  23. package/skills/api-gateway-proxy-expert/SKILL.md +81 -0
  24. package/skills/app-analyzer-optimizer/SKILL.md +6 -3
  25. package/skills/apple-ecosystem-expert/SKILL.md +144 -141
  26. package/skills/astro-framework-expert/SKILL.md +200 -0
  27. package/skills/async-queue-temporal-expert/SKILL.md +189 -26
  28. package/skills/authentication-identity-expert/SKILL.md +78 -181
  29. package/skills/autonomous-red-teamer/SKILL.md +172 -28
  30. package/skills/autonomous-tdd-debugger/SKILL.md +70 -64
  31. package/skills/biome-linter-formatter-expert/SKILL.md +89 -0
  32. package/skills/blockchain-web3-expert/SKILL.md +115 -0
  33. package/skills/bootstrap-to-modern/SKILL.md +9 -6
  34. package/skills/brainstorming/SKILL.md +60 -52
  35. package/skills/browser-automation-expert/SKILL.md +197 -21
  36. package/skills/bun-runtime-expert/SKILL.md +7 -1
  37. package/skills/chatbot-messaging-expert/SKILL.md +114 -0
  38. package/skills/ci-cd-devops-architect/SKILL.md +45 -36
  39. package/skills/cloud-hosting-expert/SKILL.md +7 -1
  40. package/skills/coderabbit/SKILL.md +7 -1
  41. package/skills/compliance-gdpr-privacy-expert/SKILL.md +85 -0
  42. package/skills/cron-scheduler-expert/SKILL.md +303 -297
  43. package/skills/data-pipeline-etl-expert/SKILL.md +84 -0
  44. package/skills/data-telemetry-expert/SKILL.md +7 -1
  45. package/skills/data-visualization-expert/SKILL.md +154 -0
  46. package/skills/database-orm-expert/SKILL.md +165 -294
  47. package/skills/deep-research-analyst/SKILL.md +136 -0
  48. package/skills/dependency-upgrade-migrator/SKILL.md +300 -294
  49. package/skills/design-system-architect/SKILL.md +309 -260
  50. package/skills/desktop-electron-expert/SKILL.md +128 -0
  51. package/skills/documentation-site-expert/SKILL.md +59 -0
  52. package/skills/doku-mcp-server/SKILL.md +7 -1
  53. package/skills/doku-payment-gateway/SKILL.md +7 -1
  54. package/skills/domain-driven-design-expert/SKILL.md +82 -0
  55. package/skills/e2e-testing-expert/SKILL.md +7 -1
  56. package/skills/ecommerce-expert/SKILL.md +87 -0
  57. package/skills/email-notification-expert/SKILL.md +393 -360
  58. package/skills/error-resilience-expert/SKILL.md +506 -479
  59. package/skills/event-driven-architect/SKILL.md +7 -1
  60. package/skills/feature-flag-analytics-expert/SKILL.md +65 -45
  61. package/skills/file-upload-media-expert/SKILL.md +436 -430
  62. package/skills/firebase-security-expert/SKILL.md +7 -1
  63. package/skills/form-validation-expert/SKILL.md +406 -400
  64. package/skills/fullstack-expert/SKILL.md +184 -202
  65. package/skills/gemini-agent-booster/SKILL.md +173 -135
  66. package/skills/geospatial-maps-expert/SKILL.md +80 -0
  67. package/skills/global-a11y-i18n-expert/SKILL.md +7 -1
  68. package/skills/glsl-shader-expert/SKILL.md +158 -69
  69. package/skills/go-programming-expert/SKILL.md +21 -15
  70. package/skills/graph-rag-knowledge-expert/SKILL.md +200 -0
  71. package/skills/graphql-apollo-expert/SKILL.md +113 -107
  72. package/skills/headless-cms-expert/SKILL.md +181 -0
  73. package/skills/hig/SKILL.md +7 -1
  74. package/skills/js-backend-expert/SKILL.md +218 -216
  75. package/skills/legacy-code-translator/SKILL.md +70 -64
  76. package/skills/local-slm-edge-ai-expert/SKILL.md +167 -0
  77. package/skills/logging-error-tracking-expert/SKILL.md +343 -337
  78. package/skills/mcp-server-architect/SKILL.md +308 -194
  79. package/skills/micro-frontend-architect/SKILL.md +111 -105
  80. package/skills/mobile-expo-expert/SKILL.md +8 -2
  81. package/skills/modern-css-native-expert/SKILL.md +189 -0
  82. package/skills/monorepo-architect/SKILL.md +7 -1
  83. package/skills/mpa-orchestrator/SKILL.md +20 -1
  84. package/skills/multi-agent-orchestration/SKILL.md +254 -234
  85. package/skills/multiple-entry-points/SKILL.md +37 -1
  86. package/skills/mvc-expert/SKILL.md +7 -1
  87. package/skills/n8n-automation-expert/SKILL.md +89 -0
  88. package/skills/nextjs-app-router-expert/SKILL.md +148 -0
  89. package/skills/openapi-swagger-codegen-expert/SKILL.md +67 -0
  90. package/skills/payment-gateway-expert/SKILL.md +85 -1
  91. package/skills/pdf-document-generation-expert/SKILL.md +91 -0
  92. package/skills/performance-web-vitals/SKILL.md +7 -1
  93. package/skills/post-quantum-crypto-migrator/SKILL.md +57 -57
  94. package/skills/prd-architect/SKILL.md +182 -201
  95. package/skills/proactive-background-watcher/SKILL.md +67 -61
  96. package/skills/production-ready-hardener/SKILL.md +459 -456
  97. package/skills/pwa-offline-first-expert/SKILL.md +226 -0
  98. package/skills/pydantic-ai-expert/SKILL.md +161 -0
  99. package/skills/python-programming-expert/SKILL.md +407 -401
  100. package/skills/rate-limit-abuse-prevention/SKILL.md +376 -370
  101. package/skills/realtime-collaboration-expert/SKILL.md +55 -1
  102. package/skills/rich-text-editor-expert/SKILL.md +177 -0
  103. package/skills/rust-programming-expert/SKILL.md +7 -1
  104. package/skills/saas-architect/SKILL.md +154 -0
  105. package/skills/saas-billing/SKILL.md +7 -1
  106. package/skills/saas-multi-tenant/SKILL.md +7 -1
  107. package/skills/scalability-clean-code/SKILL.md +7 -1
  108. package/skills/search-engine-expert/SKILL.md +89 -0
  109. package/skills/secure-fuzz-testing/SKILL.md +7 -1
  110. package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -57
  111. package/skills/senior-frontend/SKILL.md +139 -161
  112. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1 -1
  113. package/skills/seo/SKILL.md +41 -17
  114. package/skills/session-memory-manager/SKILL.md +128 -0
  115. package/skills/solidjs-expert/SKILL.md +80 -0
  116. package/skills/spa-orchestrator/SKILL.md +20 -1
  117. package/skills/sse-websocket-streaming-expert/SKILL.md +93 -0
  118. package/skills/state-management-expert/SKILL.md +7 -1
  119. package/skills/supabase-security-expert/SKILL.md +7 -1
  120. package/skills/svelte-sveltekit-expert/SKILL.md +91 -0
  121. package/skills/svg-animation-motion-expert/SKILL.md +115 -0
  122. package/skills/synthetic-data-finetuning-expert/SKILL.md +155 -0
  123. package/skills/tailwind-expert/SKILL.md +88 -136
  124. package/skills/tanstack-query-expert/SKILL.md +7 -1
  125. package/skills/tauri-expert/SKILL.md +7 -1
  126. package/skills/typescript-expert/SKILL.md +12 -6
  127. package/skills/ui-ux-pro-max/SKILL.md +25 -3
  128. package/skills/vector-db-rag-expert/SKILL.md +175 -19
  129. package/skills/vercel-ai-sdk-expert/SKILL.md +181 -0
  130. package/skills/visual-qa-vision-agent/SKILL.md +70 -64
  131. package/skills/voice-ai-realtime-agent/SKILL.md +242 -0
  132. package/skills/vue-frontend-expert/SKILL.md +131 -125
  133. package/skills/wasm-edge-computing-expert/SKILL.md +97 -0
  134. package/skills/web-3d-graphics-expert/SKILL.md +262 -80
  135. package/skills/web-game-engine-expert/SKILL.md +281 -48
  136. package/skills/web-scraper/SKILL.md +157 -207
  137. package/skills/website-design-cloner/SKILL.md +179 -173
  138. package/skills/webxr-ar-vr-expert/SKILL.md +108 -63
  139. package/skills/wordpress-headless-expert/SKILL.md +144 -0
  140. package/skills/zero-to-prod-orchestrator/SKILL.md +65 -38
  141. package/skills/zero-trust-secret-vault/SKILL.md +87 -39
  142. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  143. package/.github/workflows/publish.yml +0 -20
  144. package/CONTRIBUTING.md +0 -199
  145. package/SECURITY.md +0 -21
  146. package/banner.png +0 -0
  147. package/skills/ai-cost-token-optimizer/SKILL.md +0 -52
  148. package/skills/asisten_ramah/SKILL.md +0 -41
  149. package/skills/auto-doc-updater/SKILL.md +0 -214
  150. package/skills/autonomous-chaos-monkey/SKILL.md +0 -63
  151. package/skills/autonomous-swarm-director/SKILL.md +0 -69
  152. package/skills/edge-serverless-db-expert/SKILL.md +0 -43
  153. package/skills/hyper-context-synthesizer/SKILL.md +0 -55
  154. package/skills/llm-cost-arbitrage-router/SKILL.md +0 -59
  155. package/skills/mcp-client-orchestrator/SKILL.md +0 -70
  156. package/skills/mobile-push-notification-expert/SKILL.md +0 -51
  157. package/skills/monday-design-aesthetic/SKILL.md +0 -67
  158. package/skills/project-context-mapper/SKILL.md +0 -79
  159. package/skills/saas-mvp-launcher/SKILL.md +0 -241
  160. package/skills/saas-transformer/SKILL.md +0 -489
  161. package/skills/saas-transformer/references/billing_integration_guide.md +0 -401
  162. package/skills/self-evolving-memory-graph/SKILL.md +0 -75
  163. package/skills/senior-fullstack/SKILL.md +0 -167
  164. package/skills/senior-fullstack/references/architecture_patterns.md +0 -160
  165. package/skills/senior-fullstack/references/development_workflows.md +0 -222
  166. package/skills/senior-fullstack/references/tech_stack_guide.md +0 -190
  167. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +0 -114
  168. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +0 -114
  169. package/skills/senior-fullstack/scripts/project_scaffolder.py +0 -114
  170. package/skills/seo-aeo-landing-page-writer/SKILL.md +0 -97
  171. package/skills/seo-geo/SKILL.md +0 -188
  172. package/skills/session-context-loader/SKILL.md +0 -77
  173. package/skills/session-handoff-resume/SKILL.md +0 -158
  174. package/skills/skill_baru/SKILL.md +0 -172
  175. package/skills/supabase-migration/SKILL.md +0 -45
  176. package/skills/token-saver/SKILL.md +0 -119
  177. package/skills/ui-components-expert/SKILL.md +0 -280
  178. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  179. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  180. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  181. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  182. package/skills/ui_ux_expert/SKILL.md +0 -125
  183. package/skills/vibe-code-gardener/SKILL.md +0 -181
  184. package/vibes-swarm-demo.gif +0 -0
  185. /package/skills/{saas-transformer → saas-architect}/references/feature_gating_patterns.md +0 -0
  186. /package/skills/{saas-transformer → saas-architect}/references/saas_transformation_checklist.md +0 -0
  187. /package/skills/{saas-transformer → saas-architect}/scripts/saas_transformation_scanner.py +0 -0
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: accessibility-testing-expert
3
+ description: "Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web."
4
+ author: "Roedy Rustam"
5
+ ---
6
+
7
+ # Accessibility Testing Expert (2026 Edition)
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Orchestration & Integration
17
+ - **`global-a11y-i18n-expert`**: Core WCAG rules, ARIA patterns, and internationalization standards.
18
+ - **`e2e-testing-expert`**: Integrating automated accessibility assertions into Playwright/Vitest CI suites.
19
+ - **`ui-components-expert`**: Accessible component primitives (Radix UI, Base UI, ARIA patterns).
20
+ - **`visual-qa-vision-agent`**: Visual audits for focus rings, contrast ratios, and layout flow.
21
+
22
+ ### Description
23
+ Production guide for automated, semi-automated, and manual web accessibility (a11y) testing. Covers WCAG 2.2 Level AA/AAA compliance validation using `@axe-core/playwright`, Pa11y, Google Lighthouse CI, screen reader verification (NVDA, VoiceOver), keyboard navigation audits, focus management, and color contrast compliance.
24
+
25
+ ### Trigger Conditions
26
+ - Running automated accessibility test suites in CI/CD pipelines.
27
+ - Auditing web apps for WCAG 2.1 / 2.2 Level AA compliance and legal accessibility requirements (ADA, EAA).
28
+ - Debugging keyboard traps, missing ARIA labels, or broken screen reader navigation.
29
+ - Writing test cases for focus trapping in modals and custom dialogs.
30
+
31
+ ---
32
+
33
+ ### Core Testing Workflows
34
+
35
+ #### 1. Automated A11y Testing with Playwright & Axe-Core
36
+ ```typescript
37
+ import { test, expect } from '@playwright/test';
38
+ import AxeBuilder from '@axe-core/playwright';
39
+
40
+ test.describe('Accessibility Automated Audits', () => {
41
+ test('homepage should have zero critical or serious a11y violations', async ({ page }) => {
42
+ await page.goto('/');
43
+
44
+ const accessibilityScanResults = await new AxeBuilder({ page })
45
+ .withTags(['wcag2a', 'wcag2aa', 'wcag22aa'])
46
+ .disableRules(['color-contrast']) // If tested separately
47
+ .analyze();
48
+
49
+ expect(accessibilityScanResults.violations).toEqual([]);
50
+ });
51
+
52
+ test('modal dialog should trap focus and pass a11y audit', async ({ page }) => {
53
+ await page.goto('/dashboard');
54
+ await page.click('button#open-modal');
55
+
56
+ // Verify modal is open and focused
57
+ const modal = page.locator('[role="dialog"]');
58
+ await expect(modal).toBeVisible();
59
+
60
+ const modalAudit = await new AxeBuilder({ page })
61
+ .include('[role="dialog"]')
62
+ .analyze();
63
+
64
+ expect(modalAudit.violations).toEqual([]);
65
+
66
+ // Verify keyboard escape closes modal
67
+ await page.keyboard.press('Escape');
68
+ await expect(modal).toBeHidden();
69
+ });
70
+ });
71
+ ```
72
+
73
+ #### 2. Automated Pa11y CI Configuration (`.pa11yci.json`)
74
+ ```json
75
+ {
76
+ "defaults": {
77
+ "standard": "WCAG2AA",
78
+ "timeout": 15000,
79
+ "runners": ["axe", "htmlcs"],
80
+ "ignore": [
81
+ "WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Abs"
82
+ ]
83
+ },
84
+ "urls": [
85
+ "http://localhost:3000/",
86
+ "http://localhost:3000/login",
87
+ "http://localhost:3000/pricing",
88
+ "http://localhost:3000/docs"
89
+ ]
90
+ }
91
+ ```
92
+
93
+ #### 3. Keyboard & Screen Reader Verification Checklist
94
+ - **Tab Navigation**: All interactive elements (`<button>`, `<a>`, `<input>`) can receive focus in logical reading order.
95
+ - **Focus Indicators**: Visible, high-contrast focus rings (`outline: 2px solid var(--focus-color)` with `outline-offset`).
96
+ - **No Keyboard Traps**: Focus can enter and leave components using only `Tab`, `Shift+Tab`, and `Esc`.
97
+ - **Landmarks**: Proper semantic tags (`<header>`, `<nav>`, `<main>`, `<footer>`, `<aside>`).
98
+ - **ARIA Attributes**: `aria-expanded`, `aria-controls`, `aria-haspopup`, and `aria-live` updated dynamically.
99
+
100
+ ---
101
+
102
+ <a name="bahasa-indonesia"></a>
103
+ ## Bahasa Indonesia
104
+
105
+ ### Integrasi Orkestrasi
106
+ - **`global-a11y-i18n-expert`**: Pedoman standar WCAG, pola ARIA, dan aksesibilitas internasional.
107
+ - **`e2e-testing-expert`**: Integrasi pengujian aksesibilitas otomatis ke pipeline Playwright CI.
108
+ - **`ui-components-expert`**: Validasi aksesibilitas komponen headless dan desain UI.
109
+
110
+ ### Deskripsi
111
+ Panduan produksi untuk pengujian aksesibilitas web (a11y) otomatis dan manual. Memastikan kepatuhan terhadap standar WCAG 2.2 Level AA/AAA menggunakan `@axe-core/playwright`, Pa11y, Lighthouse CI, pengujian screen reader, navigasi keyboard, dan kontras warna.
112
+
113
+ ### Kondisi Pemicu
114
+ - Menjalankan audit aksesibilitas otomatis di pipeline CI/CD.
115
+ - Memverifikasi kepatuhan hukum aksesibilitas (WCAG 2.2, ADA, EAA).
116
+ - Menguji alur keyboard dan pembaca layar (screen reader) pada komponen kompleks seperti modal dan dropdown.
@@ -1,180 +1,194 @@
1
- ---
2
- name: ai-llm-integration-expert
3
- description: "Expert guide for integrating Large Language Models (LLMs), Model Context Protocol (MCP), RAG architecture, vector databases, and AI agents / Panduan ahli untuk integrasi LLM, Model Context Protocol (MCP), arsitektur RAG, vector database, dan agen AI."
4
- author: vibes-plug-swarm
5
- ---
6
-
7
- # AI & LLM Integration Expert (2026 Edition)
8
-
9
- [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
-
11
- ---
12
-
13
- <a name="english"></a>
14
- ## English
15
-
16
- ### Description
17
- Production-grade guidelines for integrating AI, Model Context Protocol (MCP), and Large Language Models (LLMs) into modern applications. Covers RAG pipelines, vector embeddings, real-time token streaming, agentic tool execution, memory architectures, prompt caching, and multi-model orchestration.
18
-
19
- ### Trigger Conditions
20
- - Integrating frontier models: **OpenAI GPT-4o / GPT-4.1 / GPT-5**, **Anthropic Claude 3.7 / Claude 4 Sonnet/Opus**, **Google Gemini 3.1 Pro/Flash/Ultra**, or open-source models (DeepSeek-V3/R2, Llama 4, Qwen 3).
21
- - Implementing **Model Context Protocol (MCP)** server or client integrations (MCP 1.9+).
22
- - Building AI chatbots, copilots, or **autonomous AI agent workflows** (LangGraph, OpenAI Agents SDK, Google ADK, Mastra.ai, Vercel AI SDK 4.x/5.x).
23
- - Building **agentic memory** systems (short-term, long-term, episodic) using Mem0, MemGPT, or Supabase-backed memory stores.
24
- - Implementing RAG with vector databases (Supabase `pgvector` HNSW, Qdrant, Pinecone, Weaviate).
25
- - Handling real-time AI token streaming via **SSE**, **Web Streams**, or **WebSockets**.
26
- - Designing AI agents with **tool-calling**, **computer use** (browser/OS automation), or **code interpreter** capabilities.
27
-
28
- ### Model Capability Matrix (2026)
29
-
30
- | Provider | Model | Context | Strengths |
31
- |---|---|---|---|
32
- | OpenAI | GPT-4o / GPT-4.1 | 128K | Multimodal, tool-calling, speed |
33
- | OpenAI | GPT-5 | 1M+ | Reasoning, agentic tasks |
34
- | Anthropic | Claude 4 Sonnet | 200K | Coding, long documents, Computer Use |
35
- | Anthropic | Claude 4 Opus | 200K | Complex reasoning, deep analysis |
36
- | Google | Gemini 3.1 Flash | 2M | Speed, cost efficiency, multimodal |
37
- | Google | Gemini 3.1 Pro | 2M | Code, reasoning, deep research |
38
- | Meta | Llama 4 Scout/Maverick | 512K | Open-source, self-hosted |
39
- | DeepSeek | V3 / R2 | 128K | Code, math, cost-efficient |
40
-
41
- ### Core Architecture Guidelines
42
-
43
- #### 1. Model Context Protocol (MCP) Integration (v1.9+)
44
- Standardize agent-tool interactions using MCP. The 2026 standard adds **Streamable HTTP transport** alongside stdio/SSE:
45
- - **MCP Servers**: Expose tools, resources, and prompt templates over JSON-RPC 2.0.
46
- - **Streamable HTTP**: New default transport for cloud-hosted MCP servers — supports bidirectional streaming without long-polling.
47
- - **Security & Scope**: Validate all incoming parameters with Zod schemas. Enforce strict authorization boundaries before executing tool calls.
48
- - **Tool namespacing**: Use `domain/action` naming (`files/read`, `db/query`) to avoid collisions in multi-server environments.
49
-
50
- #### 2. AI Agents SDK Landscape (2026)
51
- Choose the right agentic framework based on your needs:
52
-
53
- | Framework | Best For | Key Feature |
54
- |---|---|---|
55
- | **OpenAI Agents SDK** | GPT-5 native agents | Handoffs, guardrails, tracing built-in |
56
- | **Google ADK** | Gemini-powered agents | Multi-agent, streaming, Vertex AI integration |
57
- | **LangGraph** | Complex stateful workflows | Graph-based, human-in-the-loop, any LLM |
58
- | **Mastra.ai** | TypeScript-first agents | Built-in memory, evals, RAG |
59
- | **Vercel AI SDK 5.x** | Streaming UI + agents | RSC streaming, multi-provider, tool-calling |
60
-
61
- #### 3. Agentic Memory Architecture
62
- Production AI agents require persistent memory across sessions:
63
- - **Short-term (In-context)**: Pass recent conversation turns in the prompt window.
64
- - **Long-term (Vector Store)**: Store user preferences and past interactions as embeddings in `pgvector` or Qdrant; retrieve with semantic similarity.
65
- - **Episodic (Episodic Memory)**: Use **Mem0** or **MemGPT** to give agents human-like recall — automatically summarizes and indexes past interactions.
66
- - **Structured (Knowledge Graph)**: Use a graph DB (Neo4j, Kuzu) for entity relationships and factual memory.
67
-
68
- #### 4. Advanced RAG (Retrieval-Augmented Generation) Pipeline
69
- Build a production-grade RAG pipeline with hybrid search:
70
- 1. **Ingestion**: Chunk documents (500-1000 tokens, 10% overlap, respect semantic headings).
71
- 2. **Embedding**: Use `text-embedding-3-large` (OpenAI), `gemini-embedding-004` (Google), or `nomic-embed-text` (open-source).
72
- 3. **Storage & Hybrid Search**: PostgreSQL `pgvector` (HNSW index) or Qdrant. Combine vector cosine similarity with BM25 full-text search for hybrid retrieval.
73
- 4. **Reranking**: Apply cross-encoder reranker (Cohere Rerank 3, FlashRank) on top-K results.
74
- 5. **Generation**: Inject top contextual snippets into the system prompt with source citations.
75
-
76
- #### 5. Prompt Caching (Cost Optimization)
77
- Reduce costs by 80-90% on repeated long prompts using provider-native caching:
78
- - **Anthropic**: Automatic prompt caching for prompts > 1024 tokens (marked with `cache_control: {"type": "ephemeral"}`).
79
- - **OpenAI**: Automatic prefix caching for prompts > 1024 tokens in GPT-4o and later models.
80
- - **Google**: Context caching in Gemini API via `cachedContent` for large system prompts or documents.
81
-
82
- #### 6. Streaming Responses & Vercel AI SDK 5.x
83
- - **Backend (Next.js/Bun/FastAPI)**: Pipe stream chunks via Web Streams API or SSE.
84
- - **Frontend (React)**: Use Vercel AI SDK `useChat` / `useCompletion` for zero perceived latency.
85
- - **RSC Streaming**: Use AI SDK 5.x `streamUI` to stream React components from the server — agent-rendered UI.
86
-
87
- #### 7. Computer Use & Browser Agents
88
- Modern agents can control browsers and operating systems:
89
- - **Anthropic Computer Use**: Claude 4 can take screenshots and control mouse/keyboard (ideal for browser automation).
90
- - **Browser-Use**: Open-source library for browser-controlling agents with any LLM.
91
- - **Playwright MCP Server**: Expose a full browser to AI agents via MCP tools (`navigate`, `click`, `screenshot`).
92
-
93
- #### 8. Structured Output & Tool Calling
94
- - Use native Tool/Function Calling APIs with strict JSON schemas via Zod (`zodResponseFormat`).
95
- - Prefer **structured output mode** over prompt engineering for JSON — guaranteed schema conformance.
96
- - Support reasoning models (DeepSeek-R2, Gemini 3.1 Pro Thinking, Claude 4 extended thinking) by separating internal `<think>` tokens from client-facing output.
97
-
98
- #### 9. Cost & Rate Limit Management
99
- - Monitor token consumption per session; store metrics in telemetry tables.
100
- - Implement **semantic caching** using Redis + vector similarity to skip redundant model queries.
101
- - Use **batch APIs** (OpenAI Batch, Anthropic Message Batches) for async, high-volume workloads at 50% cost reduction.
102
-
103
- #### 10. Skill Orchestration & Handoff
104
- - **Upstream Orchestrator**: Executes during **Phase 4** of `zero-to-prod-orchestrator` or after AI decision lock in `brainstorming`.
105
- - **MCP Server Architecture**: Delegate custom MCP server creation to `mcp-server-architect` and payment tools to `doku-mcp-server`.
106
- - **Multi-Agent & Swarm Workflows**: Delegate complex agent state graphs to `multi-agent-orchestration` and Gemini long-context optimization to `gemini-agent-booster`.
107
- - **Vector DB & Hybrid Search**: Delegate pgvector indexing and hybrid search tuning to `vector-db-rag-expert`.
108
- - **Token Budget & FinOps**: Delegate API cost optimization and prompt caching strategies to `ai-cost-token-optimizer`.
109
-
110
- ---
111
-
112
- <a name="bahasa-indonesia"></a>
113
- ## Bahasa Indonesia
114
-
115
- ### Deskripsi
116
- Panduan tingkat produksi untuk mengintegrasikan AI, Model Context Protocol (MCP), dan LLM ke dalam aplikasi modern. Mencakup pipeline RAG, streaming token real-time, eksekusi tool agen AI, arsitektur memori, prompt caching, dan orkestrasi multi-model.
117
-
118
- ### Kondisi Pemicu
119
- - Mengintegrasikan model frontier: GPT-4.1 / GPT-5, Claude 4 Sonnet/Opus, Gemini 3.1 Pro/Flash, atau model open-source (Llama 4, DeepSeek-V3/R2).
120
- - Mengimplementasikan server/klien MCP (v1.9+ dengan Streamable HTTP transport).
121
- - Membangun chatbot AI, copilot, atau alur kerja agen otonom (OpenAI Agents SDK, Google ADK, LangGraph, Mastra.ai).
122
- - Membangun sistem **memori agentik** (jangka pendek, jangka panjang, episodik) menggunakan Mem0 atau pgvector.
123
- - Mengimplementasikan RAG dengan vector database.
124
- - Merancang agen AI dengan tool-calling, Computer Use, atau code interpreter.
125
-
126
- ### Panduan Arsitektur Inti
127
-
128
- #### 1. Integrasi MCP (v1.9+)
129
- Standarisasi interaksi agen-tool menggunakan MCP. Standar 2026 menambahkan **Streamable HTTP transport** — transport default baru untuk MCP server yang di-host di cloud, mendukung streaming dua arah tanpa long-polling.
130
-
131
- #### 2. Ekosistem Agents SDK (2026)
132
- - **OpenAI Agents SDK**: Handoffs, guardrails, dan tracing bawaan untuk agen berbasis GPT-5.
133
- - **Google ADK**: Multi-agen, streaming, integrasi Vertex AI untuk agen Gemini.
134
- - **LangGraph**: Alur kerja stateful berbasis graph dengan dukungan human-in-the-loop.
135
- - **Mastra.ai**: Framework TypeScript-first dengan memori, evaluasi, dan RAG bawaan.
136
- - **Vercel AI SDK 5.x**: Streaming UI + agen dengan dukungan multi-provider dan RSC.
137
-
138
- #### 3. Arsitektur Memori Agentik
139
- - **Jangka Pendek**: Riwayat percakapan recent dalam context window.
140
- - **Jangka Panjang (Vector Store)**: Preferensi dan interaksi masa lalu sebagai embedding di pgvector atau Qdrant.
141
- - **Episodik**: Gunakan Mem0 atau MemGPT untuk recall mirip manusia — otomatis merangkum dan mengindeks interaksi lalu.
142
- - **Terstruktur (Knowledge Graph)**: Gunakan graph DB (Neo4j, Kuzu) untuk relasi entitas dan memori faktual.
143
-
144
- #### 4. Pipeline RAG Lanjutan
145
- 1. Chunking dokumen (500-1000 token, 10% overlap).
146
- 2. Embedding dengan `text-embedding-3-large` atau `gemini-embedding-004`.
147
- 3. Penyimpanan & pencarian hibrida: pgvector (HNSW) + BM25.
148
- 4. Reranking dengan Cohere Rerank 3 atau FlashRank.
149
- 5. Injeksi konteks terbaik ke system prompt.
150
-
151
- #### 5. Prompt Caching (Optimasi Biaya)
152
- Kurangi biaya 80-90% dengan caching prompt panjang:
153
- - **Anthropic**: Caching otomatis untuk prompt > 1024 token.
154
- - **OpenAI**: Prefix caching otomatis di GPT-4o ke atas.
155
- - **Google**: Context caching di Gemini API via `cachedContent`.
156
-
157
- #### 6. Streaming & Vercel AI SDK 5.x
158
- Gunakan `useChat` / `useCompletion` untuk zero perceived latency di sisi klien. Gunakan `streamUI` di AI SDK 5.x untuk stream komponen React dari server (agent-rendered UI).
159
-
160
- #### 7. Computer Use & Browser Agents
161
- Claude 4 dapat mengambil screenshot dan mengontrol mouse/keyboard. Gunakan **Browser-Use** atau **Playwright MCP Server** untuk memberi agen kontrol atas browser.
162
-
163
- #### 8. Output Terstruktur & Tool Calling
164
- Gunakan mode structured output (bukan prompt engineering) untuk jaminan kesesuaian skema JSON. Gunakan Zod (`zodResponseFormat`) untuk validasi type-safe.
165
-
166
- #### 9. Manajemen Biaya
167
- - Pantau konsumsi token per sesi di tabel telemetri.
168
- - Terapkan semantic caching dengan Redis + vektor.
169
- - Gunakan Batch API (OpenAI / Anthropic) untuk workload async volume tinggi dengan biaya 50% lebih hemat.
170
-
171
- #### 10. Orkestrasi Skill & Serah Terima
172
- - **Orkestrator Utama**: Dieksekusi pada **Fase 4** dari `zero-to-prod-orchestrator` atau setelah finalisasi arsitektur AI di `brainstorming`.
173
- - **Arsitektur MCP Server**: Delegasikan pembuatan MCP server ke `mcp-server-architect` dan integrasi pembayaran ke `doku-mcp-server`.
174
- - **Multi-Agent & Swarm Workflows**: Delegasikan alur state graph kompleks ke `multi-agent-orchestration` dan optimasi long-context Gemini ke `gemini-agent-booster`.
175
- - **Vector DB & Hybrid Search**: Delegasikan indeks pgvector dan pencarian hibrida ke `vector-db-rag-expert`.
176
- - **Token Budget & FinOps**: Delegasikan optimasi biaya API dan caching prompt ke `ai-cost-token-optimizer`.
177
-
1
+ ---
2
+ name: ai-llm-integration-expert
3
+ version: "2.8.0"
4
+ description: "Expert guide for integrating Large Language Models (LLMs), Model Context Protocol (MCP v1.x), hybrid reasoning models, RAG architecture, vector databases, and AI agents / Panduan ahli untuk integrasi LLM, Model Context Protocol (MCP), model hybrid reasoning, arsitektur RAG, vector database, dan agen AI."
5
+ author: "Roedy Rustam"
6
+ ---
7
+
8
+ # AI & LLM Integration Expert (2026 Edition)
9
+
10
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
11
+
12
+ ---
13
+
14
+ <a name="english"></a>
15
+ ## English
16
+
17
+ ### Description
18
+ Production-grade guidelines for integrating AI, Model Context Protocol (MCP), hybrid reasoning models, and Large Language Models (LLMs) into modern software architectures. Covers hybrid reasoning token streaming, Streamable HTTP MCP transports, agentic memory architectures, native context caching, RAG pipelines, and multi-model orchestration.
19
+
20
+ ### Trigger Conditions
21
+ - Integrating frontier reasoning models: Anthropic Claude 3.7 Sonnet (Hybrid/Extended Thinking), Google Gemini 3.8 Flash / 3.1 Pro (Thinking Mode), OpenAI o1 / o3 / o3-mini / GPT-4.5 / GPT-4o, DeepSeek-R1 / V3, or open-source weights (Llama 4, Qwen 2.5/3 Coder).
22
+ - Implementing Model Context Protocol (MCP) server or client integrations with Streamable HTTP transport or MCP Sampling.
23
+ - Building AI chatbots, copilots, or autonomous AI agent workflows (LangGraph, OpenAI Agents SDK, Google ADK, Mastra.ai, Vercel AI SDK 5.x/6.x).
24
+ - Managing streaming reasoning tokens (`<think>` chunks) separately from final output in user interfaces.
25
+ - Implementing hybrid RAG with vector databases (Supabase pgvector HNSW, Qdrant, Pinecone) and cross-encoder rerankers.
26
+ - Building agentic memory systems (short-term, long-term semantic, episodic) using Mem0 or vector stores.
27
+ - Implementing cost optimization with provider-native Context Caching (Gemini `cachedContent`, Anthropic ephemeral prompt cache, OpenAI prefix cache).
28
+
29
+ ### Model Capability Matrix (2026)
30
+
31
+ | Provider | Model | Context | Reasoning Type | Primary Strength |
32
+ |---|---|---|---|---|
33
+ | Anthropic | Claude 3.7 Sonnet | 200K | Hybrid Thinking (Standard + Extended) | Code generation, complex reasoning, Computer Use |
34
+ | Anthropic | Claude 3.5 / 4 Opus | 200K | Deep Deliberation | Deep architectural synthesis, policy analysis |
35
+ | Google | Gemini 3.8 Flash | 1M–2M | Flash Thinking (Configurable Budget) | Ultra-low latency, multimodal live, high-frequency loops |
36
+ | Google | Gemini 3.1 / 3.5 Pro | 2M | Extended Reasoning | Needle-in-a-haystack, long-context repos, deep research |
37
+ | OpenAI | o3 / o3-mini | 200K | Native Test-Time Reasoning | Math, competitive coding, formal logic verification |
38
+ | OpenAI | GPT-4.5 / GPT-4o | 128K | Direct Instruction & Fast Tooling | Low-latency voice, structured JSON, tool-calling |
39
+ | DeepSeek | DeepSeek-R1 | 128K | Open Reasoning (Distill & MoE) | State-of-the-art open weights reasoning, math, coding |
40
+ | DeepSeek | DeepSeek-V3 | 128K | General Multimodal / Text | High throughput, extremely cost-efficient coding |
41
+ | Qwen | Qwen 2.5 / 3 Coder | 128K | Open Source Code Specialist | Self-hosted coding agent, local copilot integration |
42
+
43
+ ### Core Architecture Guidelines
44
+
45
+ #### 1. Hybrid Reasoning & Streaming Token Handling
46
+ Modern frontier models emit internal thinking/reasoning tokens during test-time compute:
47
+ - **Thinking Token Separation**: Separate internal `<think>` or reasoning chunks from conversational output. Stream reasoning into collapsible UI accordion blocks while presenting clean output to the user.
48
+ - **Vercel AI SDK 5.x/6.x Integration**:
49
+ ```typescript
50
+ import { streamText } from 'ai';
51
+ import { anthropic } from '@ai-sdk/anthropic';
52
+
53
+ const result = streamText({
54
+ model: anthropic('claude-3-7-sonnet-20250219'),
55
+ providerOptions: {
56
+ anthropic: {
57
+ thinking: { type: 'enabled', budgetTokens: 4096 },
58
+ },
59
+ },
60
+ prompt: 'Refactor this distributed consensus engine...',
61
+ });
62
+
63
+ // Access reasoning stream alongside main text
64
+ for await (const part of result.fullStream) {
65
+ if (part.type === 'reasoning') {
66
+ process.stdout.write(`[Thinking]: ${part.textDelta}`);
67
+ } else if (part.type === 'text-delta') {
68
+ process.stdout.write(part.textDelta);
69
+ }
70
+ }
71
+ ```
72
+
73
+ #### 2. Model Context Protocol (MCP) — Streamable HTTP & Sampling
74
+ Standardize all agent-tool and agent-host communications using MCP specifications:
75
+ - **Streamable HTTP Transport**: Modern cloud deployments use Streamable HTTP (bidirectional JSON-RPC streaming over HTTP POST/SSE hybrid) instead of fragile stdio connections.
76
+ - **MCP Sampling**: Allow MCP servers to request LLM completions back from the host client, enabling nested agentic tools without distributing API keys to tool servers.
77
+ - **Authorization & Security**: Enforce OAuth 2.1 scoped bearer tokens on remote MCP endpoints. Validate all incoming tool inputs using strict Zod schemas.
78
+
79
+ #### 3. Agentic Memory Architecture
80
+ Production AI agents require multi-layered memory:
81
+ - **In-Context Working Memory**: Pass recent turn messages within the prompt window.
82
+ - **Long-Term Semantic Memory**: Embed user preferences and facts using pgvector (HNSW index) or Qdrant; perform cosine similarity searches.
83
+ - **Episodic Memory (Mem0 / MemGPT)**: Automatically synthesize session checkpoints and index past user decisions for human-like recall.
84
+ - **Knowledge Graph Memory**: Maintain structured entity-relationship triples (using Graph DB or relational junction tables) for multi-hop relationship retrieval.
85
+
86
+ #### 4. Advanced RAG & Late Chunking Pipeline
87
+ Build high-precision RAG pipelines:
88
+ 1. **Document Ingestion**: Chunk semantically (500–1000 tokens) with 10% overlap, or apply *Late Chunking* (chunking after full document contextual embedding).
89
+ 2. **Embeddings**: Utilize `text-embedding-3-large`, `gemini-embedding-004`, or local `bge-large-en-v1.5`.
90
+ 3. **Hybrid Search**: Combine dense vector cosine similarity with sparse BM25 / PostgreSQL `tsvector` queries.
91
+ 4. **Cross-Encoder Reranking**: Reorder top-K candidates using Cohere Rerank 3 or FlashRank before feeding into the prompt.
92
+ 5. **Context Window vs RAG Decision**: If document sets fit comfortably under 200k tokens and are queried repeatedly, prefer **Native Context Caching** over RAG chunking to eliminate retrieval boundary errors.
93
+
94
+ #### 5. FinOps, Context Caching & Dynamic Model Routing
95
+ - **Native Context Caching**: Store static system prompts or large codebases in cache (>32k tokens) to reduce costs by up to 90% (Anthropic ephemeral cache, OpenAI prefix cache, Gemini `cachedContent`).
96
+ - **Dynamic Model Router**: Route queries based on complexity scoring (prompt length, required schema, reasoning requirements):
97
+ ```typescript
98
+ export function selectOptimalModel(promptLength: number, taskType: 'classification' | 'reasoning' | 'summary') {
99
+ if (taskType === 'classification' || promptLength < 500) {
100
+ return 'gemini-3.8-flash'; // High speed, minimal cost
101
+ }
102
+ return 'gemini-3.1-pro'; // Deep reasoning
103
+ }
104
+ ```
105
+ - **Semantic Caching**: Hash query vector embeddings into Redis / vector DB to return cached completions for semantically identical questions before calling LLM APIs.
106
+ - **Tenant Token Quotas**: Implement per-tenant token budgeting and alert thresholds to prevent cost overruns.
107
+
108
+ #### 6. Structured Output & Guardrails
109
+ - Utilize native Structured Outputs (`response_format: { type: "json_schema" }`) guaranteed by model token-level grammar masks.
110
+ - Use Zod schemas to define tool parameters and final structured entities.
111
+ - Implement rate limiting, circuit breakers, and semantic caching (Redis / Upstash vector cache) to prevent runaway recursive tool loops.
178
112
 
179
113
  ## Orchestration & Integration
180
- - Integrates with ai-cost-token-optimizer, multi-agent-orchestration, and vector-db-rag-expert.
114
+ - **`mcp-server-architect`**: Delegate custom MCP server implementation, client consumption, schema definitions, and transport adapters.
115
+ - **`multi-agent-orchestration`**: Delegate complex multi-agent state graphs, swarm workflows, and supervisor patterns.
116
+ - **`gemini-agent-booster`**: Delegate Gemini 3.x long-context optimization, Multimodal Live API, and thinking budget controls.
117
+ - **`ai-prompt-engineering-expert`**: Delegate advanced prompt design, few-shot calibration, automated Promptfoo evals, and system prompt testing.
118
+ - **`vector-db-rag-expert`**: Delegate pgvector HNSW indexing and hybrid retrieval fine-tuning.
119
+ - **`zero-to-prod-orchestrator`**: Executes this skill during Phase 4 architecture and implementation.
120
+
121
+ ---
122
+
123
+ <a name="bahasa-indonesia"></a>
124
+ ## Bahasa Indonesia
125
+
126
+ ### Deskripsi
127
+ Panduan tingkat produksi untuk mengintegrasikan AI, Model Context Protocol (MCP), model hybrid reasoning, dan Large Language Models (LLM) ke dalam arsitektur perangkat lunak modern. Mencakup penanganan streaming token penalaran, transport MCP Streamable HTTP, arsitektur memori agentik, context caching native, pipeline RAG, dan orkestrasi multi-model.
128
+
129
+ ### Kondisi Pemicu
130
+ - Mengintegrasikan model frontier reasoning: Anthropic Claude 3.7 Sonnet (Hybrid/Extended Thinking), Google Gemini 3.8 Flash / 3.1 Pro (Thinking Mode), OpenAI o1 / o3 / o3-mini / GPT-4.5 / GPT-4o, DeepSeek-R1 / V3, atau bobot open-source (Llama 4, Qwen 2.5/3 Coder).
131
+ - Mengimplementasikan server atau klien Model Context Protocol (MCP) dengan transport Streamable HTTP atau MCP Sampling.
132
+ - Membangun chatbot AI, copilot, atau workflow agen otonom (LangGraph, OpenAI Agents SDK, Google ADK, Mastra.ai, Vercel AI SDK 5.x/6.x).
133
+ - Mengelola streaming token penalaran (`<think>`) secara terpisah dari output akhir pada tampilan antarmuka pengguna.
134
+ - Mengimplementasikan RAG hibrida dengan database vektor (Supabase pgvector HNSW, Qdrant, Pinecone) dan reranker cross-encoder.
135
+ - Membangun sistem memori agentik (jangka pendek, semantik jangka panjang, episodik) menggunakan Mem0 atau vector store.
136
+ - Menerapkan optimasi biaya dengan Context Caching native provider (Gemini `cachedContent`, Anthropic ephemeral prompt cache, OpenAI prefix cache).
137
+
138
+ ### Matriks Kapabilitas Model (2026)
139
+
140
+ | Provider | Model | Konteks | Tipe Penalaran | Keunggulan Utama |
141
+ |---|---|---|---|---|
142
+ | Anthropic | Claude 3.7 Sonnet | 200K | Hybrid Thinking (Standar + Diperpanjang) | Generasi kode, penalaran kompleks, Computer Use |
143
+ | Anthropic | Claude 3.5 / 4 Opus | 200K | Deliberasi Mendalam | Sintesis arsitektur mendalam, analisis kebijakan |
144
+ | Google | Gemini 3.8 Flash | 1M–2M | Flash Thinking (Budget Terkonfigurasi) | Latensi ultra-rendah, multimodal live, loop cepat |
145
+ | Google | Gemini 3.1 / 3.5 Pro | 2M | Extended Reasoning | Needle-in-a-haystack, repo konteks panjang, riset |
146
+ | OpenAI | o3 / o3-mini | 200K | Test-Time Reasoning Native | Matematika, competitive coding, verifikasi logika |
147
+ | OpenAI | GPT-4.5 / GPT-4o | 128K | Instruksi Langsung & Tooling Cepat | Suara latensi rendah, JSON terstruktur, tool calling |
148
+ | DeepSeek | DeepSeek-R1 | 128K | Open Reasoning (Distill & MoE) | Penalaran open weights terdepan, matematika, koding |
149
+ | DeepSeek | DeepSeek-V3 | 128K | Teks & Multimodal Umum | Throughput tinggi, sangat hemat biaya untuk coding |
150
+ | Qwen | Qwen 2.5 / 3 Coder | 128K | Spesialis Kode Open Source | Agen coding mandiri / self-hosted, copilot lokal |
151
+
152
+ ### Panduan Arsitektur Inti
153
+
154
+ #### 1. Hybrid Reasoning & Penanganan Token Streaming
155
+ Model frontier modern menghasilkan token pemikiran (*thinking tokens*) selama proses penalaran:
156
+ - **Pemisahan Token Pemikiran**: Pisahkan blok `<think>` dari output teks akhir. Alirkan proses pemikiran ke dalam accordion UI yang dapat dibuka/tutup, sementara output utama disajikan dengan bersih kepada user.
157
+ - **Integrasi Vercel AI SDK 5.x/6.x**: Gunakan event listener `reasoning` pada stream untuk menangkap proses pemikiran model secara terpisah dari `text-delta`.
158
+
159
+ #### 2. Model Context Protocol (MCP) — Streamable HTTP & Sampling
160
+ Standarisasi seluruh komunikasi agen-ke-tool dan agen-ke-host menggunakan spesifikasi MCP:
161
+ - **Streamable HTTP Transport**: Standar cloud modern yang mendukung streaming dua arah JSON-RPC via HTTP POST/SSE hybrid tanpa ketergantungan koneksi stdio lokal.
162
+ - **MCP Sampling**: Memberikan izin kepada server MCP untuk meminta inferensi LLM kembali ke klien host, memungkinkan alat agentik modular tanpa membagikan API key sensitif.
163
+ - **Keamanan & Otorisasi**: Wajibkan bearer token berbasis OAuth 2.1 pada endpoint MCP publik dan validasi skema input dengan Zod.
164
+
165
+ #### 3. Arsitektur Memori Agentik
166
+ - **Memori Kerja In-Context**: Teruskan histori interaksi terbaru di jendela konteks.
167
+ - **Memori Semantik Jangka Panjang**: Simpan fakta dan preferensi pengguna di pgvector (indeks HNSW) atau Qdrant dengan pencarian kesamaan kosinus.
168
+ - **Memori Episodik (Mem0 / MemGPT)**: Sintesiskan ringkasan sesi secara berkala agar agen memiliki daya ingat historis jangka panjang.
169
+ - **Memori Graph Pengetahuan**: Hubungkan entitas relasional dalam basis data graf untuk kueri multi-langkah (*multi-hop reasoning*).
170
+
171
+ #### 4. Pipeline RAG Lanjutan & Late Chunking
172
+ 1. **Ingesti Dokumen**: Bagi dokumen secara semantik (500–1000 token, 10% overlap) atau gunakan metode *Late Chunking*.
173
+ 2. **Embedding**: Gunakan `text-embedding-3-large` atau `gemini-embedding-004`.
174
+ 3. **Pencarian Hibrida**: Kombinasikan dense vector cosine similarity dengan sparse keyword BM25 / PostgreSQL full-text search.
175
+ 4. **Cross-Encoder Reranking**: Susun ulang kandidat terbaik menggunakan Cohere Rerank 3 atau FlashRank sebelum diteruskan ke system prompt.
176
+ 5. **Keputusan Cache vs RAG**: Jika dokumen stabil dan berada di bawah 200k token, utamakan **Context Caching Native** daripada RAG chunking untuk menghindari hilangnya konteks di perbatasan potongan teks.
177
+
178
+ #### 5. FinOps, Context Caching & Routing Model Dinamis
179
+ - **Context Caching Native**: Simpan prompt sistem atau repositori besar di cache (>32k token) via API `cachedContent` Gemini, ephemeral cache Anthropic, atau prefix cache OpenAI untuk menghemat hingga 90% biaya.
180
+ - **Router Model Dinamis**: Arahkan kueri secara cerdas (tugas klasifikasi/parsing ke Flash, penalaran mendalam ke Pro/Opus).
181
+ - **Semantic Caching**: Simpan embedding kueri di Redis / Vector DB untuk menyajikan jawaban cache pada pertanyaan identik tanpa memanggil ulang API LLM.
182
+ - **Kuota & Anggaran Token**: Terapkan batas konsumsi token harian per pengguna/penyewa guna mencegah pembengkakan biaya.
183
+
184
+ #### 6. Output Terstruktur & Guardrails
185
+ - Manfaatkan mode Structured Outputs native model dengan skema Zod untuk menjamin integritas JSON.
186
+ - Terapkan rate limiting, circuit breaker, dan semantic caching (Redis / Upstash) untuk mencegah pemanggilan tool secara rekursif tak berujung.
187
+
188
+ ## Integrasi Orkestrasi
189
+ - **`mcp-server-architect`**: Delegasikan pembuatan server MCP kustom, konsumsi klien, definisi skema, dan transport adapter.
190
+ - **`multi-agent-orchestration`**: Delegasikan alur kerja graph multi-agen, topologi swarm, dan pattern supervisor.
191
+ - **`gemini-agent-booster`**: Delegasikan optimasi long-context Gemini 3.x, Multimodal Live API, dan kontrol thinking budget.
192
+ - **`ai-prompt-engineering-expert`**: Delegasikan desain prompt lanjutan, kalibrasi few-shot, evaluasi Promptfoo, dan pengujian prompt.
193
+ - **`vector-db-rag-expert`**: Delegasikan tuning indeks HNSW pgvector dan pencarian hibrida.
194
+ - **`zero-to-prod-orchestrator`**: Mengeksekusi skill ini pada Fase 4 perancangan arsitektur dan implementasi.