{"title":"Quick Start cho LLM Agent","slug":"quick-start-llm","category":"getting-started","summary":"Trong 3 lệnh gọi API: thu hồi tất cả bộ nhớ, lưu một bộ nhớ, tìm kiếm. Quy trình LLM thiết yếu.","audience":["llm"],"tags":["llm","agent","quickstart","memory"],"difficulty":"beginner","updated":"2026-06-27","word_count":512,"read_minutes":3,"llm_context":"Base URL: https://synapse.schaefer.zone\nAuth: Authorization: Bearer YOUR_MIND_KEY (header, required — ?key= DISABLED by default, AUTH_QUERY_KEY_MODE=deny hardened default; 401 + hint)\nALWAYS call /memory/recall at the start of every session.\nWichtigste Befehle: GET /memory/recall, POST /memory, GET /memory/search?q=...\nCategories: identity, preference, fact, project, skill, mistake, context, note, credentials\nPriorities: low, normal, high, critical\nFTS5 search: multiple words = AND, \"phrases\" in quotes, prefix* for prefix search\n","lang":"vi","translated":true,"requested_lang":"vi","content_markdown":"\n# Quick Start cho LLM Agent\n\nBạn mất tất cả bộ nhớ giữa các phiên. Synapse là bộ não ngoài của bạn. Hướng dẫn\nnày cho thấy ba lệnh gọi API thiết yếu mà mọi LLM agent phải biết.\n\n> [!CRITICAL]\n> Gọi `GET /memory/recall` ở ĐẦU mỗi phiên.\n> Không có lệnh gọi này, bạn không có bộ nhớ về ai là người dùng, những gì bạn\n> đã hứa, hoặc những gì bạn đã làm lần trước.\n\n## Bước 1: Thu hồi tất cả bộ nhớ (LUÔN LUÔN ĐẦU TIÊN)\n\n```\nGET /memory/recall\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\nTrả về tóm tắt văn bản thuần có cấu trúc của tất cả bộ nhớ đã lưu. Phân tích\nđiều này để xây dựng lại mô hình tâm trí của bạn về người dùng, dự án của họ và\ntương tác trong quá khứ.\n\nVí dụ phản hồi:\n\n```\nMind: Michael's Mind\nMemories: 12 total (10 verified)\n\n[001] identity (CRITICAL)\n  user_name\n  Michael Schäfer\n  Tags: person, identity\n\n[002] preference (HIGH)\n  communication_style\n  Prefers concise technical responses, no fluff\n  Tags: communication, preference\n\n[003] project (HIGH)\n  project_synapse\n  Synapse v1.5.0 deployed on vps1.schaefer.zone. Admin panel at /admin.\n  Tags: synapse, deployment\n  ...\n```\n\n## Bước 2: Lưu bộ nhớ mới\n\nKhi bạn học được điều gì đáng nhớ:\n\n```\nPOST /memory\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{\n  \"category\": \"fact\",\n  \"key\": \"user_name\",\n  \"content\": \"The user's name is Michael Schäfer\",\n  \"tags\": [\"person\", \"identity\"],\n  \"priority\": \"critical\"\n}\n```\n\n**Danh mục:** `identity`, `preference`, `fact`, `project`, `skill`, `mistake`, `context`, `note`, `credentials`\n\n**Mức ưu tiên:** `low`, `normal`, `high`, `critical`\n\n> [!TIP]\n> Luôn bao gồm trường `key` — một định danh ngắn cho bộ nhớ. Điều này cho phép\n> bạn cập nhật cùng bộ nhớ sau bằng cách POST lại với cùng key.\n\n## Bước 3: Tìm kiếm bộ nhớ cụ thể\n\n```\nGET /memory/search?q=Docker+Swarm\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\n> [!TIP]\n> Cú pháp FTS5: nhiều từ = tìm kiếm AND. Cụm từ trong ngoặc kép: `\"docker swarm\"`.\n> Tìm kiếm tiền tố: `docker*`. Boolean: `docker OR kubernetes`.\n\n## Công cụ mở (Không cần Header xác thực) — tắt theo mặc định\n\nNếu công cụ của bạn chỉ có thể mở URL (không có header tùy chỉnh): tham số `?key=` được\n**tắt** bởi mặc định đã siết `AUTH_QUERY_KEY_MODE=deny` — API chỉ dùng Bearer và `?key=`\ntrả về 401 kèm gợi ý \"Query-param auth (?key=) is disabled\". Chỉ khi một nhà vận hành đặt rõ ràng `allow`:\n\n```\nGET /memory/recall?key=YOUR_MIND_KEY\nPOST /memory?key=YOUR_MIND_KEY (+ JSON body)\nGET /memory/search?key=YOUR_MIND_KEY&q=suchbegriff\n```\n\n> [!WARNING]\n> Chỉ ở chế độ allow, `?key=` mới bị giới hạn 60 yêu cầu/phút. Client Bearer bên ngoài nhận 120 req/min theo danh tính; mạng nội bộ đáng tin cậy không giới hạn. Ưu tiên header Bearer.\n\n## Quy trình phiên hoàn chỉnh\n\n1. **Bắt đầu phiên:** `GET /memory/recall` — tải tất cả bộ nhớ\n2. **Trong khi làm việc:** `GET /memory/search?q=...` — tìm sự kiện cụ thể\n3. **Khi có thông tin mới:** `POST /memory` — lưu nó (với category, key, tags, priority)\n4. **Định kỳ:** `GET /chat/poll` — kiểm tra tin nhắn con người\n5. **Kết thúc phiên:** Lưu bất kỳ học hỏi cuối cùng qua `POST /memory`\n\n## Mẫu phổ biến\n\n### Cập nhật bộ nhớ hiện có\n\nPOST `/memory` với cùng `category` và `key` — bộ nhớ hiện có được cập nhật,\nkhông trùng lặp.\n\n### Lưu trạng thái dự án\n\n```json\n{\n  \"category\": \"project\",\n  \"key\": \"project_synapse_status\",\n  \"content\": \"Synapse v1.5.0 deployed. Next: v1.6.0 with docs system. CI green.\",\n  \"tags\": [\"synapse\", \"deployment\", \"status\"],\n  \"priority\": \"high\"\n}\n```\n\n### Ghi lại lỗi (để bạn không lặp lại)\n\n```json\n{\n  \"category\": \"mistake\",\n  \"key\": \"mistake_npm_version_bump\",\n  \"content\": \"Always bump package.json version after changes — npm publish fails otherwise.\",\n  \"tags\": [\"npm\", \"ci\", \"deployment\"],\n  \"priority\": \"high\"\n}\n```\n\n### Kiểm tra tin nhắn con người\n\n```\nGET /chat/poll\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\nTrả về tin nhắn chưa đọc từ con người. Trả lời với:\n\n```\nPOST /chat/reply\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{\"content\": \"Got it! Working on it now.\"}\n```\n\n## Bước tiếp theo\n\n- [Xác thực](/docs/getting-started/authentication) — Mind Key vs JWT\n- [Tham chiếu Memory API](/docs/api/memory) — tất cả 22 endpoint memory\n- [Chat API](/docs/api/chat) — giao tiếp bất đồng bộ với con người\n- [LLM Cookbook](/docs/llm-cookbook/session-start-pattern) — mẫu thực tế\n","content_html":"<h1>Quick Start cho LLM Agent</h1>\n<p>Bạn mất tất cả bộ nhớ giữa các phiên. Synapse là bộ não ngoài của bạn. Hướng dẫn\nnày cho thấy ba lệnh gọi API thiết yếu mà mọi LLM agent phải biết.</p>\n<div class=\"callout callout-critical\">Gọi `GET /memory/recall` ở ĐẦU mỗi phiên.\nKhông có lệnh gọi này, bạn không có bộ nhớ về ai là người dùng, những gì bạn\nđã hứa, hoặc những gì bạn đã làm lần trước.</div><h2>Bước 1: Thu hồi tất cả bộ nhớ (LUÔN LUÔN ĐẦU TIÊN)</h2>\n<pre><code class=\"hljs language-plaintext\">GET /memory/recall\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><p>Trả về tóm tắt văn bản thuần có cấu trúc của tất cả bộ nhớ đã lưu. Phân tích\nđiều này để xây dựng lại mô hình tâm trí của bạn về người dùng, dự án của họ và\ntương tác trong quá khứ.</p>\n<p>Ví dụ phản hồi:</p>\n<pre><code class=\"hljs language-plaintext\">Mind: Michael&#x27;s Mind\nMemories: 12 total (10 verified)\n\n[001] identity (CRITICAL)\n  user_name\n  Michael Schäfer\n  Tags: person, identity\n\n[002] preference (HIGH)\n  communication_style\n  Prefers concise technical responses, no fluff\n  Tags: communication, preference\n\n[003] project (HIGH)\n  project_synapse\n  Synapse v1.5.0 deployed on vps1.schaefer.zone. Admin panel at /admin.\n  Tags: synapse, deployment\n  ...</code></pre><h2>Bước 2: Lưu bộ nhớ mới</h2>\n<p>Khi bạn học được điều gì đáng nhớ:</p>\n<pre><code class=\"hljs language-plaintext\">POST /memory\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{\n  &quot;category&quot;: &quot;fact&quot;,\n  &quot;key&quot;: &quot;user_name&quot;,\n  &quot;content&quot;: &quot;The user&#x27;s name is Michael Schäfer&quot;,\n  &quot;tags&quot;: [&quot;person&quot;, &quot;identity&quot;],\n  &quot;priority&quot;: &quot;critical&quot;\n}</code></pre><p><strong>Danh mục:</strong> <code>identity</code>, <code>preference</code>, <code>fact</code>, <code>project</code>, <code>skill</code>, <code>mistake</code>, <code>context</code>, <code>note</code>, <code>credentials</code></p>\n<p><strong>Mức ưu tiên:</strong> <code>low</code>, <code>normal</code>, <code>high</code>, <code>critical</code></p>\n<div class=\"callout callout-ok\">Luôn bao gồm trường `key` — một định danh ngắn cho bộ nhớ. Điều này cho phép\nbạn cập nhật cùng bộ nhớ sau bằng cách POST lại với cùng key.</div><h2>Bước 3: Tìm kiếm bộ nhớ cụ thể</h2>\n<pre><code class=\"hljs language-plaintext\">GET /memory/search?q=Docker+Swarm\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><div class=\"callout callout-ok\">Cú pháp FTS5: nhiều từ = tìm kiếm AND. Cụm từ trong ngoặc kép: `\"docker swarm\"`.\nTìm kiếm tiền tố: `docker*`. Boolean: `docker OR kubernetes`.</div><h2>Công cụ mở (Không cần Header xác thực) — tắt theo mặc định</h2>\n<p>Nếu công cụ của bạn chỉ có thể mở URL (không có header tùy chỉnh): tham số <code>?key=</code> được\n<strong>tắt</strong> bởi mặc định đã siết <code>AUTH_QUERY_KEY_MODE=deny</code> — API chỉ dùng Bearer và <code>?key=</code>\ntrả về 401 kèm gợi ý &quot;Query-param auth (?key=) is disabled&quot;. Chỉ khi một nhà vận hành đặt rõ ràng <code>allow</code>:</p>\n<pre><code class=\"hljs language-plaintext\">GET /memory/recall?key=YOUR_MIND_KEY\nPOST /memory?key=YOUR_MIND_KEY (+ JSON body)\nGET /memory/search?key=YOUR_MIND_KEY&amp;q=suchbegriff</code></pre><div class=\"callout callout-warn\">Chỉ ở chế độ allow, `?key=` mới bị giới hạn 60 yêu cầu/phút. Client Bearer bên ngoài nhận 120 req/min theo danh tính; mạng nội bộ đáng tin cậy không giới hạn. Ưu tiên header Bearer.</div><h2>Quy trình phiên hoàn chỉnh</h2>\n<ol>\n<li><strong>Bắt đầu phiên:</strong> <code>GET /memory/recall</code> — tải tất cả bộ nhớ</li>\n<li><strong>Trong khi làm việc:</strong> <code>GET /memory/search?q=...</code> — tìm sự kiện cụ thể</li>\n<li><strong>Khi có thông tin mới:</strong> <code>POST /memory</code> — lưu nó (với category, key, tags, priority)</li>\n<li><strong>Định kỳ:</strong> <code>GET /chat/poll</code> — kiểm tra tin nhắn con người</li>\n<li><strong>Kết thúc phiên:</strong> Lưu bất kỳ học hỏi cuối cùng qua <code>POST /memory</code></li>\n</ol>\n<h2>Mẫu phổ biến</h2>\n<h3>Cập nhật bộ nhớ hiện có</h3>\n<p>POST <code>/memory</code> với cùng <code>category</code> và <code>key</code> — bộ nhớ hiện có được cập nhật,\nkhông trùng lặp.</p>\n<h3>Lưu trạng thái dự án</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;category&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;project&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;key&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;project_synapse_status&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;content&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Synapse v1.5.0 deployed. Next: v1.6.0 with docs system. CI green.&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;status&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;high&quot;</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>Ghi lại lỗi (để bạn không lặp lại)</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;category&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mistake&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;key&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mistake_npm_version_bump&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;content&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Always bump package.json version after changes — npm publish fails otherwise.&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;npm&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;ci&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;high&quot;</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>Kiểm tra tin nhắn con người</h3>\n<pre><code class=\"hljs language-plaintext\">GET /chat/poll\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><p>Trả về tin nhắn chưa đọc từ con người. Trả lời với:</p>\n<pre><code class=\"hljs language-plaintext\">POST /chat/reply\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{&quot;content&quot;: &quot;Got it! Working on it now.&quot;}</code></pre><h2>Bước tiếp theo</h2>\n<ul>\n<li><a href=\"/docs/getting-started/authentication\">Xác thực</a> — Mind Key vs JWT</li>\n<li><a href=\"/docs/api/memory\">Tham chiếu Memory API</a> — tất cả 22 endpoint memory</li>\n<li><a href=\"/docs/api/chat\">Chat API</a> — giao tiếp bất đồng bộ với con người</li>\n<li><a href=\"/docs/llm-cookbook/session-start-pattern\">LLM Cookbook</a> — mẫu thực tế</li>\n</ul>\n","urls":{"html":"/docs/getting-started/quick-start-llm","text":"/docs/getting-started/quick-start-llm?format=text","json":"/docs/getting-started/quick-start-llm?format=json","llm":"/docs/getting-started/quick-start-llm?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"],"wordCount":512,"readMinutes":3,"llmContext":"Base URL: https://synapse.schaefer.zone\nAuth: Authorization: Bearer YOUR_MIND_KEY (header, required — ?key= DISABLED by default, AUTH_QUERY_KEY_MODE=deny hardened default; 401 + hint)\nALWAYS call /memory/recall at the start of every session.\nWichtigste Befehle: GET /memory/recall, POST /memory, GET /memory/search?q=...\nCategories: identity, preference, fact, project, skill, mistake, context, note, credentials\nPriorities: low, normal, high, critical\nFTS5 search: multiple words = AND, \"phrases\" in quotes, prefix* for prefix search\n","requestedLang":"vi","contentMarkdown":"\n# Quick Start cho LLM Agent\n\nBạn mất tất cả bộ nhớ giữa các phiên. Synapse là bộ não ngoài của bạn. Hướng dẫn\nnày cho thấy ba lệnh gọi API thiết yếu mà mọi LLM agent phải biết.\n\n> [!CRITICAL]\n> Gọi `GET /memory/recall` ở ĐẦU mỗi phiên.\n> Không có lệnh gọi này, bạn không có bộ nhớ về ai là người dùng, những gì bạn\n> đã hứa, hoặc những gì bạn đã làm lần trước.\n\n## Bước 1: Thu hồi tất cả bộ nhớ (LUÔN LUÔN ĐẦU TIÊN)\n\n```\nGET /memory/recall\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\nTrả về tóm tắt văn bản thuần có cấu trúc của tất cả bộ nhớ đã lưu. Phân tích\nđiều này để xây dựng lại mô hình tâm trí của bạn về người dùng, dự án của họ và\ntương tác trong quá khứ.\n\nVí dụ phản hồi:\n\n```\nMind: Michael's Mind\nMemories: 12 total (10 verified)\n\n[001] identity (CRITICAL)\n  user_name\n  Michael Schäfer\n  Tags: person, identity\n\n[002] preference (HIGH)\n  communication_style\n  Prefers concise technical responses, no fluff\n  Tags: communication, preference\n\n[003] project (HIGH)\n  project_synapse\n  Synapse v1.5.0 deployed on vps1.schaefer.zone. Admin panel at /admin.\n  Tags: synapse, deployment\n  ...\n```\n\n## Bước 2: Lưu bộ nhớ mới\n\nKhi bạn học được điều gì đáng nhớ:\n\n```\nPOST /memory\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{\n  \"category\": \"fact\",\n  \"key\": \"user_name\",\n  \"content\": \"The user's name is Michael Schäfer\",\n  \"tags\": [\"person\", \"identity\"],\n  \"priority\": \"critical\"\n}\n```\n\n**Danh mục:** `identity`, `preference`, `fact`, `project`, `skill`, `mistake`, `context`, `note`, `credentials`\n\n**Mức ưu tiên:** `low`, `normal`, `high`, `critical`\n\n> [!TIP]\n> Luôn bao gồm trường `key` — một định danh ngắn cho bộ nhớ. Điều này cho phép\n> bạn cập nhật cùng bộ nhớ sau bằng cách POST lại với cùng key.\n\n## Bước 3: Tìm kiếm bộ nhớ cụ thể\n\n```\nGET /memory/search?q=Docker+Swarm\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\n> [!TIP]\n> Cú pháp FTS5: nhiều từ = tìm kiếm AND. Cụm từ trong ngoặc kép: `\"docker swarm\"`.\n> Tìm kiếm tiền tố: `docker*`. Boolean: `docker OR kubernetes`.\n\n## Công cụ mở (Không cần Header xác thực) — tắt theo mặc định\n\nNếu công cụ của bạn chỉ có thể mở URL (không có header tùy chỉnh): tham số `?key=` được\n**tắt** bởi mặc định đã siết `AUTH_QUERY_KEY_MODE=deny` — API chỉ dùng Bearer và `?key=`\ntrả về 401 kèm gợi ý \"Query-param auth (?key=) is disabled\". Chỉ khi một nhà vận hành đặt rõ ràng `allow`:\n\n```\nGET /memory/recall?key=YOUR_MIND_KEY\nPOST /memory?key=YOUR_MIND_KEY (+ JSON body)\nGET /memory/search?key=YOUR_MIND_KEY&q=suchbegriff\n```\n\n> [!WARNING]\n> Chỉ ở chế độ allow, `?key=` mới bị giới hạn 60 yêu cầu/phút. Client Bearer bên ngoài nhận 120 req/min theo danh tính; mạng nội bộ đáng tin cậy không giới hạn. Ưu tiên header Bearer.\n\n## Quy trình phiên hoàn chỉnh\n\n1. **Bắt đầu phiên:** `GET /memory/recall` — tải tất cả bộ nhớ\n2. **Trong khi làm việc:** `GET /memory/search?q=...` — tìm sự kiện cụ thể\n3. **Khi có thông tin mới:** `POST /memory` — lưu nó (với category, key, tags, priority)\n4. **Định kỳ:** `GET /chat/poll` — kiểm tra tin nhắn con người\n5. **Kết thúc phiên:** Lưu bất kỳ học hỏi cuối cùng qua `POST /memory`\n\n## Mẫu phổ biến\n\n### Cập nhật bộ nhớ hiện có\n\nPOST `/memory` với cùng `category` và `key` — bộ nhớ hiện có được cập nhật,\nkhông trùng lặp.\n\n### Lưu trạng thái dự án\n\n```json\n{\n  \"category\": \"project\",\n  \"key\": \"project_synapse_status\",\n  \"content\": \"Synapse v1.5.0 deployed. Next: v1.6.0 with docs system. CI green.\",\n  \"tags\": [\"synapse\", \"deployment\", \"status\"],\n  \"priority\": \"high\"\n}\n```\n\n### Ghi lại lỗi (để bạn không lặp lại)\n\n```json\n{\n  \"category\": \"mistake\",\n  \"key\": \"mistake_npm_version_bump\",\n  \"content\": \"Always bump package.json version after changes — npm publish fails otherwise.\",\n  \"tags\": [\"npm\", \"ci\", \"deployment\"],\n  \"priority\": \"high\"\n}\n```\n\n### Kiểm tra tin nhắn con người\n\n```\nGET /chat/poll\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\nTrả về tin nhắn chưa đọc từ con người. Trả lời với:\n\n```\nPOST /chat/reply\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{\"content\": \"Got it! Working on it now.\"}\n```\n\n## Bước tiếp theo\n\n- [Xác thực](/docs/getting-started/authentication) — Mind Key vs JWT\n- [Tham chiếu Memory API](/docs/api/memory) — tất cả 22 endpoint memory\n- [Chat API](/docs/api/chat) — giao tiếp bất đồng bộ với con người\n- [LLM Cookbook](/docs/llm-cookbook/session-start-pattern) — mẫu thực tế\n","contentHtml":"<h1>Quick Start cho LLM Agent</h1>\n<p>Bạn mất tất cả bộ nhớ giữa các phiên. Synapse là bộ não ngoài của bạn. Hướng dẫn\nnày cho thấy ba lệnh gọi API thiết yếu mà mọi LLM agent phải biết.</p>\n<div class=\"callout callout-critical\">Gọi `GET /memory/recall` ở ĐẦU mỗi phiên.\nKhông có lệnh gọi này, bạn không có bộ nhớ về ai là người dùng, những gì bạn\nđã hứa, hoặc những gì bạn đã làm lần trước.</div><h2>Bước 1: Thu hồi tất cả bộ nhớ (LUÔN LUÔN ĐẦU TIÊN)</h2>\n<pre><code class=\"hljs language-plaintext\">GET /memory/recall\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><p>Trả về tóm tắt văn bản thuần có cấu trúc của tất cả bộ nhớ đã lưu. Phân tích\nđiều này để xây dựng lại mô hình tâm trí của bạn về người dùng, dự án của họ và\ntương tác trong quá khứ.</p>\n<p>Ví dụ phản hồi:</p>\n<pre><code class=\"hljs language-plaintext\">Mind: Michael&#x27;s Mind\nMemories: 12 total (10 verified)\n\n[001] identity (CRITICAL)\n  user_name\n  Michael Schäfer\n  Tags: person, identity\n\n[002] preference (HIGH)\n  communication_style\n  Prefers concise technical responses, no fluff\n  Tags: communication, preference\n\n[003] project (HIGH)\n  project_synapse\n  Synapse v1.5.0 deployed on vps1.schaefer.zone. Admin panel at /admin.\n  Tags: synapse, deployment\n  ...</code></pre><h2>Bước 2: Lưu bộ nhớ mới</h2>\n<p>Khi bạn học được điều gì đáng nhớ:</p>\n<pre><code class=\"hljs language-plaintext\">POST /memory\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{\n  &quot;category&quot;: &quot;fact&quot;,\n  &quot;key&quot;: &quot;user_name&quot;,\n  &quot;content&quot;: &quot;The user&#x27;s name is Michael Schäfer&quot;,\n  &quot;tags&quot;: [&quot;person&quot;, &quot;identity&quot;],\n  &quot;priority&quot;: &quot;critical&quot;\n}</code></pre><p><strong>Danh mục:</strong> <code>identity</code>, <code>preference</code>, <code>fact</code>, <code>project</code>, <code>skill</code>, <code>mistake</code>, <code>context</code>, <code>note</code>, <code>credentials</code></p>\n<p><strong>Mức ưu tiên:</strong> <code>low</code>, <code>normal</code>, <code>high</code>, <code>critical</code></p>\n<div class=\"callout callout-ok\">Luôn bao gồm trường `key` — một định danh ngắn cho bộ nhớ. Điều này cho phép\nbạn cập nhật cùng bộ nhớ sau bằng cách POST lại với cùng key.</div><h2>Bước 3: Tìm kiếm bộ nhớ cụ thể</h2>\n<pre><code class=\"hljs language-plaintext\">GET /memory/search?q=Docker+Swarm\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><div class=\"callout callout-ok\">Cú pháp FTS5: nhiều từ = tìm kiếm AND. Cụm từ trong ngoặc kép: `\"docker swarm\"`.\nTìm kiếm tiền tố: `docker*`. Boolean: `docker OR kubernetes`.</div><h2>Công cụ mở (Không cần Header xác thực) — tắt theo mặc định</h2>\n<p>Nếu công cụ của bạn chỉ có thể mở URL (không có header tùy chỉnh): tham số <code>?key=</code> được\n<strong>tắt</strong> bởi mặc định đã siết <code>AUTH_QUERY_KEY_MODE=deny</code> — API chỉ dùng Bearer và <code>?key=</code>\ntrả về 401 kèm gợi ý &quot;Query-param auth (?key=) is disabled&quot;. Chỉ khi một nhà vận hành đặt rõ ràng <code>allow</code>:</p>\n<pre><code class=\"hljs language-plaintext\">GET /memory/recall?key=YOUR_MIND_KEY\nPOST /memory?key=YOUR_MIND_KEY (+ JSON body)\nGET /memory/search?key=YOUR_MIND_KEY&amp;q=suchbegriff</code></pre><div class=\"callout callout-warn\">Chỉ ở chế độ allow, `?key=` mới bị giới hạn 60 yêu cầu/phút. Client Bearer bên ngoài nhận 120 req/min theo danh tính; mạng nội bộ đáng tin cậy không giới hạn. Ưu tiên header Bearer.</div><h2>Quy trình phiên hoàn chỉnh</h2>\n<ol>\n<li><strong>Bắt đầu phiên:</strong> <code>GET /memory/recall</code> — tải tất cả bộ nhớ</li>\n<li><strong>Trong khi làm việc:</strong> <code>GET /memory/search?q=...</code> — tìm sự kiện cụ thể</li>\n<li><strong>Khi có thông tin mới:</strong> <code>POST /memory</code> — lưu nó (với category, key, tags, priority)</li>\n<li><strong>Định kỳ:</strong> <code>GET /chat/poll</code> — kiểm tra tin nhắn con người</li>\n<li><strong>Kết thúc phiên:</strong> Lưu bất kỳ học hỏi cuối cùng qua <code>POST /memory</code></li>\n</ol>\n<h2>Mẫu phổ biến</h2>\n<h3>Cập nhật bộ nhớ hiện có</h3>\n<p>POST <code>/memory</code> với cùng <code>category</code> và <code>key</code> — bộ nhớ hiện có được cập nhật,\nkhông trùng lặp.</p>\n<h3>Lưu trạng thái dự án</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;category&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;project&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;key&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;project_synapse_status&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;content&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Synapse v1.5.0 deployed. Next: v1.6.0 with docs system. CI green.&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;status&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;high&quot;</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>Ghi lại lỗi (để bạn không lặp lại)</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;category&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mistake&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;key&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;mistake_npm_version_bump&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;content&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Always bump package.json version after changes — npm publish fails otherwise.&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;npm&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;ci&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;high&quot;</span>\n<span class=\"hljs-punctuation\">}</span></code></pre><h3>Kiểm tra tin nhắn con người</h3>\n<pre><code class=\"hljs language-plaintext\">GET /chat/poll\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><p>Trả về tin nhắn chưa đọc từ con người. Trả lời với:</p>\n<pre><code class=\"hljs language-plaintext\">POST /chat/reply\nAuthorization: Bearer YOUR_MIND_KEY\nContent-Type: application/json\n\n{&quot;content&quot;: &quot;Got it! Working on it now.&quot;}</code></pre><h2>Bước tiếp theo</h2>\n<ul>\n<li><a href=\"/docs/getting-started/authentication\">Xác thực</a> — Mind Key vs JWT</li>\n<li><a href=\"/docs/api/memory\">Tham chiếu Memory API</a> — tất cả 22 endpoint memory</li>\n<li><a href=\"/docs/api/chat\">Chat API</a> — giao tiếp bất đồng bộ với con người</li>\n<li><a href=\"/docs/llm-cookbook/session-start-pattern\">LLM Cookbook</a> — mẫu thực tế</li>\n</ul>\n","translationsAvailable":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}