{"title":"Quick Start สำหรับ LLM Agent","slug":"quick-start-llm","category":"getting-started","summary":"ใน 3 API call: recall memory ทั้งหมด, เก็บใหม่, ค้นหา — workflow LLM ที่จำเป็น","audience":["llm"],"tags":["llm","agent","quickstart","memory"],"difficulty":"beginner","updated":"2026-06-27","word_count":236,"read_minutes":1,"llm_context":"Base URL: https://synapse.schaefer.zone\nAuth: Authorization: Bearer YOUR_MIND_KEY (header) OR ?key=YOUR_MIND_KEY (query)\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":"th","translated":true,"requested_lang":"th","content_markdown":"\n# Quick Start สำหรับ LLM Agent\n\nคุณสูญเสีย memory ทั้งหมดระหว่าง session Synapse เป็นสมองภายนอกของคุณ คู่มือนี้แสดงสาม API call ที่จำเป็นซึ่ง LLM agent ทุกตัวต้องรู้\n\n> [!CRITICAL]\n> เรียก `GET /memory/recall` ที่จุดเริ่มต้นของทุก session\n> หากไม่เรียกนี้ คุณไม่มี memory ว่าผู้ใช้เป็นใคร, สัญญาอะไรไว้ หรือกำลังทำงานอะไรครั้งที่แล้ว\n\n## ขั้นตอนที่ 1: Recall memory ทั้งหมด (ต้องทำก่อนเสมอ)\n\n```\nGET /memory/recall\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\nส่งกลับสรุปแบบ plain-text ที่มีโครงสร้างของ memory ที่เก็บไว้ทั้งหมด แยกวิเคราะห์นี้เพื่อ rebuild mental model ของผู้ใช้, โปรเจกต์ และการโต้ตอบในอดีต\n\nตัวอย่าง response:\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## ขั้นตอนที่ 2: เก็บ memory ใหม่\n\nเมื่อคุณเรียนรู้สิ่งที่คุ้มค่าจดจำ:\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**Category:** `identity`, `preference`, `fact`, `project`, `skill`, `mistake`, `context`, `note`, `credentials`\n\n**Priority:** `low`, `normal`, `high`, `critical`\n\n> [!TIP]\n> ใส่ฟิลด์ `key` เสมอ — identifier สั้น ๆ สำหรับ memory นี่ช่วยให้คุณอัปเดต memory เดิมในภายหลังโดย POST ซ้ำด้วย key เดียวกัน\n\n## ขั้นตอนที่ 3: ค้นหา memory เฉพาะ\n\n```\nGET /memory/search?q=Docker+Swarm\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\n> [!TIP]\n> ไวยากรณ์ FTS5: หลายคำ = AND search Phrase ในเครื่องหมายคำพูด: `\"docker swarm\"` ค้นหา prefix: `docker*` Boolean: `docker OR kubernetes`\n\n## เครื่องมือแบบเปิด URL (ไม่มี Auth Header)\n\nหากเครื่องมือของคุณเปิด URL ได้อย่างเดียว (ไม่มี custom header) ให้ใช้พารามิเตอร์ `?key=`:\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> `?key=` จำกัดที่ 60 request/นาที Bearer header ไม่จำกัด ใช้ Bearer header เมื่อใดก็ตามที่ทำได้\n\n## Workflow Session แบบสมบูรณ์\n\n1. **เริ่ม session:** `GET /memory/recall` — โหลด memory ทั้งหมด\n2. **ระหว่างทำงาน:** `GET /memory/search?q=...` — หา fact เฉพาะ\n3. **เมื่อมีข้อมูลใหม่:** `POST /memory` — เก็บ (พร้อม category, key, tag, priority)\n4. **เป็นคาบ:** `GET /chat/poll` — ตรวจข้อความจาก human\n5. **สิ้นสุด session:** เก็บสิ่งที่เรียนรู้สุดท้ายผ่าน `POST /memory`\n\n## รูปแบบทั่วไป\n\n### อัปเดต memory ที่มีอยู่\n\nPOST `/memory` ด้วย `category` และ `key` เดิม — memory ที่มีอยู่จะถูกอัปเดต ไม่ซ้ำ\n\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### บันทึก mistake (เพื่อไม่ทำซ้ำ)\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### ตรวจข้อความจาก human\n\n```\nGET /chat/poll\nAuthorization: Bearer YOUR_MIND_KEY\n```\n\nส่งกลับข้อความที่ยังไม่ได้อ่านจาก human ตอบกลับด้วย:\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## ขั้นตอนถัดไป\n\n- [Authentication](/docs/getting-started/authentication) — Mind Key vs JWT\n- [Memory API reference](/docs/api/memory) — memory endpoint ทั้ง 22\n- [Chat API](/docs/api/chat) — การสื่อสารแบบ asynchronous กับ human\n- [LLM Cookbook](/docs/llm-cookbook/session-start-pattern) — รูปแบบปฏิบัติ\n","content_html":"<h1>Quick Start สำหรับ LLM Agent</h1>\n<p>คุณสูญเสีย memory ทั้งหมดระหว่าง session Synapse เป็นสมองภายนอกของคุณ คู่มือนี้แสดงสาม API call ที่จำเป็นซึ่ง LLM agent ทุกตัวต้องรู้</p>\n<div class=\"callout callout-critical\">เรียก `GET /memory/recall` ที่จุดเริ่มต้นของทุก session\nหากไม่เรียกนี้ คุณไม่มี memory ว่าผู้ใช้เป็นใคร, สัญญาอะไรไว้ หรือกำลังทำงานอะไรครั้งที่แล้ว</div><h2>ขั้นตอนที่ 1: Recall memory ทั้งหมด (ต้องทำก่อนเสมอ)</h2>\n<pre><code class=\"hljs language-plaintext\">GET /memory/recall\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><p>ส่งกลับสรุปแบบ plain-text ที่มีโครงสร้างของ memory ที่เก็บไว้ทั้งหมด แยกวิเคราะห์นี้เพื่อ rebuild mental model ของผู้ใช้, โปรเจกต์ และการโต้ตอบในอดีต</p>\n<p>ตัวอย่าง response:</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>ขั้นตอนที่ 2: เก็บ memory ใหม่</h2>\n<p>เมื่อคุณเรียนรู้สิ่งที่คุ้มค่าจดจำ:</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>Category:</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>Priority:</strong> <code>low</code>, <code>normal</code>, <code>high</code>, <code>critical</code></p>\n<div class=\"callout callout-ok\">ใส่ฟิลด์ `key` เสมอ — identifier สั้น ๆ สำหรับ memory นี่ช่วยให้คุณอัปเดต memory เดิมในภายหลังโดย POST ซ้ำด้วย key เดียวกัน</div><h2>ขั้นตอนที่ 3: ค้นหา memory เฉพาะ</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\">ไวยากรณ์ FTS5: หลายคำ = AND search Phrase ในเครื่องหมายคำพูด: `\"docker swarm\"` ค้นหา prefix: `docker*` Boolean: `docker OR kubernetes`</div><h2>เครื่องมือแบบเปิด URL (ไม่มี Auth Header)</h2>\n<p>หากเครื่องมือของคุณเปิด URL ได้อย่างเดียว (ไม่มี custom header) ให้ใช้พารามิเตอร์ <code>?key=</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\">`?key=` จำกัดที่ 60 request/นาที Bearer header ไม่จำกัด ใช้ Bearer header เมื่อใดก็ตามที่ทำได้</div><h2>Workflow Session แบบสมบูรณ์</h2>\n<ol>\n<li><strong>เริ่ม session:</strong> <code>GET /memory/recall</code> — โหลด memory ทั้งหมด</li>\n<li><strong>ระหว่างทำงาน:</strong> <code>GET /memory/search?q=...</code> — หา fact เฉพาะ</li>\n<li><strong>เมื่อมีข้อมูลใหม่:</strong> <code>POST /memory</code> — เก็บ (พร้อม category, key, tag, priority)</li>\n<li><strong>เป็นคาบ:</strong> <code>GET /chat/poll</code> — ตรวจข้อความจาก human</li>\n<li><strong>สิ้นสุด session:</strong> เก็บสิ่งที่เรียนรู้สุดท้ายผ่าน <code>POST /memory</code></li>\n</ol>\n<h2>รูปแบบทั่วไป</h2>\n<h3>อัปเดต memory ที่มีอยู่</h3>\n<p>POST <code>/memory</code> ด้วย <code>category</code> และ <code>key</code> เดิม — memory ที่มีอยู่จะถูกอัปเดต ไม่ซ้ำ</p>\n<h3>เก็บสถานะโปรเจกต์</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>บันทึก mistake (เพื่อไม่ทำซ้ำ)</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>ตรวจข้อความจาก human</h3>\n<pre><code class=\"hljs language-plaintext\">GET /chat/poll\nAuthorization: Bearer YOUR_MIND_KEY</code></pre><p>ส่งกลับข้อความที่ยังไม่ได้อ่านจาก human ตอบกลับด้วย:</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>ขั้นตอนถัดไป</h2>\n<ul>\n<li><a href=\"/docs/getting-started/authentication\">Authentication</a> — Mind Key vs JWT</li>\n<li><a href=\"/docs/api/memory\">Memory API reference</a> — memory endpoint ทั้ง 22</li>\n<li><a href=\"/docs/api/chat\">Chat API</a> — การสื่อสารแบบ asynchronous กับ human</li>\n<li><a href=\"/docs/llm-cookbook/session-start-pattern\">LLM Cookbook</a> — รูปแบบปฏิบัติ</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"]}