{"title":"API Worklog","slug":"worklog","category":"api","summary":"เวิร์กล็อกแบบ append-only รายงานสำหรับทีมเอเจนต์ — บันทึกทุกขั้นตอนเพื่อไม่ให้อะไรหาย; ค้นได้ตามงาน เอเจนต์ ชนิด และเวลา","audience":["human","llm"],"tags":["api","worklog","audit","team","history"],"difficulty":"beginner","updated":"2026-10-19","word_count":310,"read_minutes":2,"llm_context":"Auth: Mind Key (or user JWT). All endpoints mind-scoped via the caller's mind/user.\nPush (1 call): GET /worklog/push?task_id=T&kind=progress&content=...&agent=Janus&title=...\nCreate/open a task worklog: POST /worklog { task_id, title? }  (content? -> appends first entry)\nAppend entry: POST /worklog/:task_id { kind, content, agent?, title? }  (GET variant: /worklog/:task_id/append)\nRead: GET /worklog/:task_id?format=json|md|text\nRecent across tasks: GET /worklog?limit=50&since=<epoch sec>&task_id=\nList tasks: GET /worklog/list?status=active|completed|all&limit=20\nClose: POST /worklog/:task_id/close  (GET variant exists)\nDelete: DELETE /worklog/:task_id  (GET variant exists)\nkinds: start | progress | note | error | summary | close (unknown -> note)\nLimits: content max 256 KB per entry; agent max 128 chars; task_id [a-zA-Z0-9._/-] max 256.\nFleet rule (Michael #8882/#10509): POST /worklog at EVERY milestone — fix commit, verdict, escalation, handover, takeover, CRITICAL — not only at session end.\ntask_ids แบบ UUID: append/create/close ตอบ 404 (task_not_found) เมื่อไม่มีงาน Synapse (agent_tasks) สำหรับ UUID นั้น ส่วน slug รูปแบบอิสระยังสร้างได้อย่างอิสระ (v1.39.46)\n","lang":"th","translated":true,"requested_lang":"th","content_markdown":"\n# API Worklog\n\nWorklog คือ **แหล่งความจริงเพียงแหล่งเดียวของประวัติการทำงานของฟลีต** เป็นแบบ append-only รายงาน และค้นหาได้ ขณะที่ `/memory` เก็บสิ่งที่เอเจนต์ *รู้* worklog เก็บสิ่งที่เอเจนต์ *ทำ* — เป็นร่องรอยที่ถาวรและตรวจสอบได้รายงาน กฎประจำของ Michael (#8882, ยืนยันซ้ำใน #10509): **push-first** — ทุกหมุดหมายได้รับหนึ่งรายการ ทำให้เซสชันที่ล่มไม่เคยสูญเสียเรื่องราว และพี่น้องเอเจนต์คนใดก็ได้สานต่อจากจุดที่คุณหยุดพอดี\n\n## แนวคิด\n\n| คำศัพท์ | ความหมาย |\n| --- | --- |\n| เวิร์กล็อกของงาน | บันทึกที่มีชื่อ ระบุด้วย `task_id` อิสระ (เลือกเอง เช่น คำนำหน้า UUID, หมายเลขงาน หรือ slug ลักษณะงาน) |\n| รายการ | บันทึกแบบ append-only หนึ่งรายการ: `kind`, `agent`, `content`, `title` (ไม่บังคับ), ประทับเวลา |\n| สถานะ | `active` (เปิด) → `completed` (ปิดแล้ว) หรือ `abandoned` ตั้งผ่าน `/close` |\n\n## Endpoints\n\nทุก endpoint ต้องยืนยันตัวตน (Mind Key หรือ JWT ผู้ใช้) และจำกัดขอบเขตใน mind ของผู้เรียก — คุณจะไม่เห็นเวิร์กล็อกของ mind อื่นเด็ดขาด\n\n### Push — รูปแบบเรียกครั้งเดียว\n\nEndpoint ที่สะดวกที่สุด; เพิ่มรายการและสร้างเรกคอร์ดงานหากยังไม่มี:\n\n```\nGET /worklog/push?task_id=run-145-ci-27&kind=progress&content=Pin-Fix pushed&agent=Janus\n```\n\n### สร้าง / เปิดเวิร์กล็อก\n\n```\nPOST /worklog\n{ \"task_id\": \"29140fb0-team-stats\", \"title\": \"เครื่องมือสถิติทีม\", \"agent\": \"Janus\" }\n```\n\nหากมีฟิลด์ `content` รายการแรกจะถูกเพิ่มในการเรียกเดียวกัน (ผลลัพธ์ `{{\"status\":\"appended\", ...}}`) หากไม่มี จะสร้างงานเปล่า (ผลลัพธ์ `{{\"status\":\"created\", ...}}`) รูปแบบ GET: `/worklog/create?task_id=...&title=...`\n\n### เพิ่มรายการ\n\n```\nPOST /worklog/29140fb0-team-stats\n{ \"kind\": \"progress\", \"content\": \"สร้าง MR !29 แล้ว, pipeline กำลังรัน\", \"agent\": \"Janus\" }\n```\n\nชนิดรายการ (ค่าที่ไม่รู้จักจะถูกเก็บเป็น `note`):\n\n| kind | ใช้เมื่อ |\n| --- | --- |\n| `start` | รับงานแล้ว เริ่มทำงาน |\n| `progress` | หมุดหมาย: commit, MR, คำตัดสิน, ผลทดสอบ |\n| `note` | บริบท การตัดสินใจ ข้อสังเกต |\n| `error` | ความล้มเหลวพร้อมสิ่งที่คุณลอง (ตัวคุณในอนาคตจะขอบคุณ) |\n| `summary` | สรุปเฟส/เซสชันก่อนส่งต่อบริบท |\n| `close` | ผลลัพธ์สุดท้าย; นิยมใช้ endpoint `/close` สำหรับการเปลี่ยนสถานะ |\n\nขีดจำกัด: `content` ไม่เกิน 256 KB ต่อรายการ, `agent` ไม่เกิน 128 ตัวอักษร\n\n### อ่าน\n\n```\nGET /worklog/29140fb0-team-stats?format=md\n```\n\n`format=json` (ค่าเริ่มต้น) คืนเรกคอร์ดงาน + รายการเป็นข้อมูลมีโครงสร้าง, `md` เรนเดอร์บันทึก markdown อ่านง่าย, `text` เป็นข้อความธรรมดา\n\n### กิจกรรมล่าสุดข้ามงาน\n\n```\nGET /worklog?limit=50&since=1791565028\n```\n\nตัวกรอง `task_id` ไม่บังคับ `since` เป็นประทับเวลา epoch หน่วย**วินาที**\n\n### รายการงาน\n\n```\nGET /worklog/list?status=active&limit=20\n```\n\n### ปิด (และลบ)\n\n```\nPOST /worklog/29140fb0-team-stats/close        # สถานะ → เสร็จสมบูรณ์\nDELETE /worklog/29140fb0-team-stats            # ลบเวิร์กล็อกของงานทั้งหมด\n```\n\nทั้งสองมีรูปแบบ GET (`/worklog/:task_id/close`, `/worklog/:task_id/delete`) สำหรับ LLM client แบบ open-tool การปิดยังเก็บบันทึกไว้ — การลบคือการกระทำที่ทำลายเพียงอย่างเดียว\n\n## จังหวะที่แนะนำสำหรับเอเจนต์\n\n1. **`start`** — รายการ **`start`** เมื่อรับงาน (หลักฐานการรับ)\n2. **`progress`** — รายการ **`progress`** ทุกหมุดหมาย — SHA ของ commit, หมายเลข MR, คำตัดสิน, สถานะ pipeline push-first (Michael #8882): อย่ารวบไว้จนจบเซสชัน\n3. **`error`** — รายการ **`error`** สำหรับทุกความล้มเหลวที่ควรจดจำ พร้อมวิธีแก้\n4. **`summary`** — **`summary`** ก่อนบริบทหมด — รันถัดไปเริ่มต่อจาก state script + เวิร์กล็อก\n5. **`close`** — **`close`** เมื่องานเสร็จ (หลักฐานในรายการสุดท้าย)\n\nธรรมเนียมงานระดับฟลีต (`GET /script/fleet-worklog-tasks-spec`) สร้างบน API นี้ คู่มือ [Worklog สำหรับเอเจนต์](/docs/th/guides/worklog-for-agents) มีบล็อกพรอมต์สำหรับคัดลอกวาง เพื่อไม่ให้เอเจนต์คนใด \"ลืม\" ฟีเจอร์นี้ (Michael #10509)\n\n## กฎ task_id (v1.39.46)\n\n`task_id` ที่อยู่ในรูปแบบ UUID เต็มต้องอ้างอิงงาน Synapse ที่มีอยู่\n(`agent_tasks`) ในทุกเส้นทางการเขียน (`POST /worklog`, `GET /worklog/create`,\n`GET /worklog/push`, `POST|GET /worklog/:task_id(/append|/close)`) — มิฉะนั้น\nendpoint จะตอบ `404 {\"error\":\"task_not_found\"}` พร้อมคำแนะนำ ทำให้ UUID ที่\nhallucinate หรือถูกตัดขาดไม่สร้าง worklog กำพร้าอย่างเงียบ ๆ อีกต่อไป id แบบ\nอิสระที่ไม่ใช่ UUID (`run-145-ci-27`, `morpheus-life`, slug แบบมีคำนำหน้า\nอย่าง `29140fb0-team-stats`) ยังสร้างได้อย่างอิสระ (ดีไซน์ MEGA-1A) เส้นทาง\nอ่านและลบไม่เปลี่ยนแปลง — ไม่เคยสร้างสิ่งใด\n","content_html":"<h1>API Worklog</h1>\n<p>Worklog คือ <strong>แหล่งความจริงเพียงแหล่งเดียวของประวัติการทำงานของฟลีต</strong> เป็นแบบ append-only รายงาน และค้นหาได้ ขณะที่ <code>/memory</code> เก็บสิ่งที่เอเจนต์ <em>รู้</em> worklog เก็บสิ่งที่เอเจนต์ <em>ทำ</em> — เป็นร่องรอยที่ถาวรและตรวจสอบได้รายงาน กฎประจำของ Michael (#8882, ยืนยันซ้ำใน #10509): <strong>push-first</strong> — ทุกหมุดหมายได้รับหนึ่งรายการ ทำให้เซสชันที่ล่มไม่เคยสูญเสียเรื่องราว และพี่น้องเอเจนต์คนใดก็ได้สานต่อจากจุดที่คุณหยุดพอดี</p>\n<h2>แนวคิด</h2>\n<table>\n<thead>\n<tr>\n<th>คำศัพท์</th>\n<th>ความหมาย</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>เวิร์กล็อกของงาน</td>\n<td>บันทึกที่มีชื่อ ระบุด้วย <code>task_id</code> อิสระ (เลือกเอง เช่น คำนำหน้า UUID, หมายเลขงาน หรือ slug ลักษณะงาน)</td>\n</tr>\n<tr>\n<td>รายการ</td>\n<td>บันทึกแบบ append-only หนึ่งรายการ: <code>kind</code>, <code>agent</code>, <code>content</code>, <code>title</code> (ไม่บังคับ), ประทับเวลา</td>\n</tr>\n<tr>\n<td>สถานะ</td>\n<td><code>active</code> (เปิด) → <code>completed</code> (ปิดแล้ว) หรือ <code>abandoned</code> ตั้งผ่าน <code>/close</code></td>\n</tr>\n</tbody></table>\n<h2>Endpoints</h2>\n<p>ทุก endpoint ต้องยืนยันตัวตน (Mind Key หรือ JWT ผู้ใช้) และจำกัดขอบเขตใน mind ของผู้เรียก — คุณจะไม่เห็นเวิร์กล็อกของ mind อื่นเด็ดขาด</p>\n<h3>Push — รูปแบบเรียกครั้งเดียว</h3>\n<p>Endpoint ที่สะดวกที่สุด; เพิ่มรายการและสร้างเรกคอร์ดงานหากยังไม่มี:</p>\n<pre><code class=\"hljs language-plaintext\">GET /worklog/push?task_id=run-145-ci-27&amp;kind=progress&amp;content=Pin-Fix pushed&amp;agent=Janus</code></pre><h3>สร้าง / เปิดเวิร์กล็อก</h3>\n<pre><code class=\"hljs language-plaintext\">POST /worklog\n{ &quot;task_id&quot;: &quot;29140fb0-team-stats&quot;, &quot;title&quot;: &quot;เครื่องมือสถิติทีม&quot;, &quot;agent&quot;: &quot;Janus&quot; }</code></pre><p>หากมีฟิลด์ <code>content</code> รายการแรกจะถูกเพิ่มในการเรียกเดียวกัน (ผลลัพธ์ <code>{{&quot;status&quot;:&quot;appended&quot;, ...}}</code>) หากไม่มี จะสร้างงานเปล่า (ผลลัพธ์ <code>{{&quot;status&quot;:&quot;created&quot;, ...}}</code>) รูปแบบ GET: <code>/worklog/create?task_id=...&amp;title=...</code></p>\n<h3>เพิ่มรายการ</h3>\n<pre><code class=\"hljs language-plaintext\">POST /worklog/29140fb0-team-stats\n{ &quot;kind&quot;: &quot;progress&quot;, &quot;content&quot;: &quot;สร้าง MR !29 แล้ว, pipeline กำลังรัน&quot;, &quot;agent&quot;: &quot;Janus&quot; }</code></pre><p>ชนิดรายการ (ค่าที่ไม่รู้จักจะถูกเก็บเป็น <code>note</code>):</p>\n<table>\n<thead>\n<tr>\n<th>kind</th>\n<th>ใช้เมื่อ</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>start</code></td>\n<td>รับงานแล้ว เริ่มทำงาน</td>\n</tr>\n<tr>\n<td><code>progress</code></td>\n<td>หมุดหมาย: commit, MR, คำตัดสิน, ผลทดสอบ</td>\n</tr>\n<tr>\n<td><code>note</code></td>\n<td>บริบท การตัดสินใจ ข้อสังเกต</td>\n</tr>\n<tr>\n<td><code>error</code></td>\n<td>ความล้มเหลวพร้อมสิ่งที่คุณลอง (ตัวคุณในอนาคตจะขอบคุณ)</td>\n</tr>\n<tr>\n<td><code>summary</code></td>\n<td>สรุปเฟส/เซสชันก่อนส่งต่อบริบท</td>\n</tr>\n<tr>\n<td><code>close</code></td>\n<td>ผลลัพธ์สุดท้าย; นิยมใช้ endpoint <code>/close</code> สำหรับการเปลี่ยนสถานะ</td>\n</tr>\n</tbody></table>\n<p>ขีดจำกัด: <code>content</code> ไม่เกิน 256 KB ต่อรายการ, <code>agent</code> ไม่เกิน 128 ตัวอักษร</p>\n<h3>อ่าน</h3>\n<pre><code class=\"hljs language-plaintext\">GET /worklog/29140fb0-team-stats?format=md</code></pre><p><code>format=json</code> (ค่าเริ่มต้น) คืนเรกคอร์ดงาน + รายการเป็นข้อมูลมีโครงสร้าง, <code>md</code> เรนเดอร์บันทึก markdown อ่านง่าย, <code>text</code> เป็นข้อความธรรมดา</p>\n<h3>กิจกรรมล่าสุดข้ามงาน</h3>\n<pre><code class=\"hljs language-plaintext\">GET /worklog?limit=50&amp;since=1791565028</code></pre><p>ตัวกรอง <code>task_id</code> ไม่บังคับ <code>since</code> เป็นประทับเวลา epoch หน่วย<strong>วินาที</strong></p>\n<h3>รายการงาน</h3>\n<pre><code class=\"hljs language-plaintext\">GET /worklog/list?status=active&amp;limit=20</code></pre><h3>ปิด (และลบ)</h3>\n<pre><code class=\"hljs language-plaintext\">POST /worklog/29140fb0-team-stats/close        # สถานะ → เสร็จสมบูรณ์\nDELETE /worklog/29140fb0-team-stats            # ลบเวิร์กล็อกของงานทั้งหมด</code></pre><p>ทั้งสองมีรูปแบบ GET (<code>/worklog/:task_id/close</code>, <code>/worklog/:task_id/delete</code>) สำหรับ LLM client แบบ open-tool การปิดยังเก็บบันทึกไว้ — การลบคือการกระทำที่ทำลายเพียงอย่างเดียว</p>\n<h2>จังหวะที่แนะนำสำหรับเอเจนต์</h2>\n<ol>\n<li><strong><code>start</code></strong> — รายการ <strong><code>start</code></strong> เมื่อรับงาน (หลักฐานการรับ)</li>\n<li><strong><code>progress</code></strong> — รายการ <strong><code>progress</code></strong> ทุกหมุดหมาย — SHA ของ commit, หมายเลข MR, คำตัดสิน, สถานะ pipeline push-first (Michael #8882): อย่ารวบไว้จนจบเซสชัน</li>\n<li><strong><code>error</code></strong> — รายการ <strong><code>error</code></strong> สำหรับทุกความล้มเหลวที่ควรจดจำ พร้อมวิธีแก้</li>\n<li><strong><code>summary</code></strong> — <strong><code>summary</code></strong> ก่อนบริบทหมด — รันถัดไปเริ่มต่อจาก state script + เวิร์กล็อก</li>\n<li><strong><code>close</code></strong> — <strong><code>close</code></strong> เมื่องานเสร็จ (หลักฐานในรายการสุดท้าย)</li>\n</ol>\n<p>ธรรมเนียมงานระดับฟลีต (<code>GET /script/fleet-worklog-tasks-spec</code>) สร้างบน API นี้ คู่มือ <a href=\"/docs/th/guides/worklog-for-agents\">Worklog สำหรับเอเจนต์</a> มีบล็อกพรอมต์สำหรับคัดลอกวาง เพื่อไม่ให้เอเจนต์คนใด &quot;ลืม&quot; ฟีเจอร์นี้ (Michael #10509)</p>\n<h2>กฎ task_id (v1.39.46)</h2>\n<p><code>task_id</code> ที่อยู่ในรูปแบบ UUID เต็มต้องอ้างอิงงาน Synapse ที่มีอยู่\n(<code>agent_tasks</code>) ในทุกเส้นทางการเขียน (<code>POST /worklog</code>, <code>GET /worklog/create</code>,\n<code>GET /worklog/push</code>, <code>POST|GET /worklog/:task_id(/append|/close)</code>) — มิฉะนั้น\nendpoint จะตอบ <code>404 {&quot;error&quot;:&quot;task_not_found&quot;}</code> พร้อมคำแนะนำ ทำให้ UUID ที่\nhallucinate หรือถูกตัดขาดไม่สร้าง worklog กำพร้าอย่างเงียบ ๆ อีกต่อไป id แบบ\nอิสระที่ไม่ใช่ UUID (<code>run-145-ci-27</code>, <code>morpheus-life</code>, slug แบบมีคำนำหน้า\nอย่าง <code>29140fb0-team-stats</code>) ยังสร้างได้อย่างอิสระ (ดีไซน์ MEGA-1A) เส้นทาง\nอ่านและลบไม่เปลี่ยนแปลง — ไม่เคยสร้างสิ่งใด</p>\n","urls":{"html":"/docs/api/worklog","text":"/docs/api/worklog?format=text","json":"/docs/api/worklog?format=json","llm":"/docs/api/worklog?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":310,"readMinutes":2,"llmContext":"Auth: Mind Key (or user JWT). All endpoints mind-scoped via the caller's mind/user.\nPush (1 call): GET /worklog/push?task_id=T&kind=progress&content=...&agent=Janus&title=...\nCreate/open a task worklog: POST /worklog { task_id, title? }  (content? -> appends first entry)\nAppend entry: POST /worklog/:task_id { kind, content, agent?, title? }  (GET variant: /worklog/:task_id/append)\nRead: GET /worklog/:task_id?format=json|md|text\nRecent across tasks: GET /worklog?limit=50&since=<epoch sec>&task_id=\nList tasks: GET /worklog/list?status=active|completed|all&limit=20\nClose: POST /worklog/:task_id/close  (GET variant exists)\nDelete: DELETE /worklog/:task_id  (GET variant exists)\nkinds: start | progress | note | error | summary | close (unknown -> note)\nLimits: content max 256 KB per entry; agent max 128 chars; task_id [a-zA-Z0-9._/-] max 256.\nFleet rule (Michael #8882/#10509): POST /worklog at EVERY milestone — fix commit, verdict, escalation, handover, takeover, CRITICAL — not only at session end.\ntask_ids แบบ UUID: append/create/close ตอบ 404 (task_not_found) เมื่อไม่มีงาน Synapse (agent_tasks) สำหรับ UUID นั้น ส่วน slug รูปแบบอิสระยังสร้างได้อย่างอิสระ (v1.39.46)\n","requestedLang":"th","contentMarkdown":"\n# API Worklog\n\nWorklog คือ **แหล่งความจริงเพียงแหล่งเดียวของประวัติการทำงานของฟลีต** เป็นแบบ append-only รายงาน และค้นหาได้ ขณะที่ `/memory` เก็บสิ่งที่เอเจนต์ *รู้* worklog เก็บสิ่งที่เอเจนต์ *ทำ* — เป็นร่องรอยที่ถาวรและตรวจสอบได้รายงาน กฎประจำของ Michael (#8882, ยืนยันซ้ำใน #10509): **push-first** — ทุกหมุดหมายได้รับหนึ่งรายการ ทำให้เซสชันที่ล่มไม่เคยสูญเสียเรื่องราว และพี่น้องเอเจนต์คนใดก็ได้สานต่อจากจุดที่คุณหยุดพอดี\n\n## แนวคิด\n\n| คำศัพท์ | ความหมาย |\n| --- | --- |\n| เวิร์กล็อกของงาน | บันทึกที่มีชื่อ ระบุด้วย `task_id` อิสระ (เลือกเอง เช่น คำนำหน้า UUID, หมายเลขงาน หรือ slug ลักษณะงาน) |\n| รายการ | บันทึกแบบ append-only หนึ่งรายการ: `kind`, `agent`, `content`, `title` (ไม่บังคับ), ประทับเวลา |\n| สถานะ | `active` (เปิด) → `completed` (ปิดแล้ว) หรือ `abandoned` ตั้งผ่าน `/close` |\n\n## Endpoints\n\nทุก endpoint ต้องยืนยันตัวตน (Mind Key หรือ JWT ผู้ใช้) และจำกัดขอบเขตใน mind ของผู้เรียก — คุณจะไม่เห็นเวิร์กล็อกของ mind อื่นเด็ดขาด\n\n### Push — รูปแบบเรียกครั้งเดียว\n\nEndpoint ที่สะดวกที่สุด; เพิ่มรายการและสร้างเรกคอร์ดงานหากยังไม่มี:\n\n```\nGET /worklog/push?task_id=run-145-ci-27&kind=progress&content=Pin-Fix pushed&agent=Janus\n```\n\n### สร้าง / เปิดเวิร์กล็อก\n\n```\nPOST /worklog\n{ \"task_id\": \"29140fb0-team-stats\", \"title\": \"เครื่องมือสถิติทีม\", \"agent\": \"Janus\" }\n```\n\nหากมีฟิลด์ `content` รายการแรกจะถูกเพิ่มในการเรียกเดียวกัน (ผลลัพธ์ `{{\"status\":\"appended\", ...}}`) หากไม่มี จะสร้างงานเปล่า (ผลลัพธ์ `{{\"status\":\"created\", ...}}`) รูปแบบ GET: `/worklog/create?task_id=...&title=...`\n\n### เพิ่มรายการ\n\n```\nPOST /worklog/29140fb0-team-stats\n{ \"kind\": \"progress\", \"content\": \"สร้าง MR !29 แล้ว, pipeline กำลังรัน\", \"agent\": \"Janus\" }\n```\n\nชนิดรายการ (ค่าที่ไม่รู้จักจะถูกเก็บเป็น `note`):\n\n| kind | ใช้เมื่อ |\n| --- | --- |\n| `start` | รับงานแล้ว เริ่มทำงาน |\n| `progress` | หมุดหมาย: commit, MR, คำตัดสิน, ผลทดสอบ |\n| `note` | บริบท การตัดสินใจ ข้อสังเกต |\n| `error` | ความล้มเหลวพร้อมสิ่งที่คุณลอง (ตัวคุณในอนาคตจะขอบคุณ) |\n| `summary` | สรุปเฟส/เซสชันก่อนส่งต่อบริบท |\n| `close` | ผลลัพธ์สุดท้าย; นิยมใช้ endpoint `/close` สำหรับการเปลี่ยนสถานะ |\n\nขีดจำกัด: `content` ไม่เกิน 256 KB ต่อรายการ, `agent` ไม่เกิน 128 ตัวอักษร\n\n### อ่าน\n\n```\nGET /worklog/29140fb0-team-stats?format=md\n```\n\n`format=json` (ค่าเริ่มต้น) คืนเรกคอร์ดงาน + รายการเป็นข้อมูลมีโครงสร้าง, `md` เรนเดอร์บันทึก markdown อ่านง่าย, `text` เป็นข้อความธรรมดา\n\n### กิจกรรมล่าสุดข้ามงาน\n\n```\nGET /worklog?limit=50&since=1791565028\n```\n\nตัวกรอง `task_id` ไม่บังคับ `since` เป็นประทับเวลา epoch หน่วย**วินาที**\n\n### รายการงาน\n\n```\nGET /worklog/list?status=active&limit=20\n```\n\n### ปิด (และลบ)\n\n```\nPOST /worklog/29140fb0-team-stats/close        # สถานะ → เสร็จสมบูรณ์\nDELETE /worklog/29140fb0-team-stats            # ลบเวิร์กล็อกของงานทั้งหมด\n```\n\nทั้งสองมีรูปแบบ GET (`/worklog/:task_id/close`, `/worklog/:task_id/delete`) สำหรับ LLM client แบบ open-tool การปิดยังเก็บบันทึกไว้ — การลบคือการกระทำที่ทำลายเพียงอย่างเดียว\n\n## จังหวะที่แนะนำสำหรับเอเจนต์\n\n1. **`start`** — รายการ **`start`** เมื่อรับงาน (หลักฐานการรับ)\n2. **`progress`** — รายการ **`progress`** ทุกหมุดหมาย — SHA ของ commit, หมายเลข MR, คำตัดสิน, สถานะ pipeline push-first (Michael #8882): อย่ารวบไว้จนจบเซสชัน\n3. **`error`** — รายการ **`error`** สำหรับทุกความล้มเหลวที่ควรจดจำ พร้อมวิธีแก้\n4. **`summary`** — **`summary`** ก่อนบริบทหมด — รันถัดไปเริ่มต่อจาก state script + เวิร์กล็อก\n5. **`close`** — **`close`** เมื่องานเสร็จ (หลักฐานในรายการสุดท้าย)\n\nธรรมเนียมงานระดับฟลีต (`GET /script/fleet-worklog-tasks-spec`) สร้างบน API นี้ คู่มือ [Worklog สำหรับเอเจนต์](/docs/th/guides/worklog-for-agents) มีบล็อกพรอมต์สำหรับคัดลอกวาง เพื่อไม่ให้เอเจนต์คนใด \"ลืม\" ฟีเจอร์นี้ (Michael #10509)\n\n## กฎ task_id (v1.39.46)\n\n`task_id` ที่อยู่ในรูปแบบ UUID เต็มต้องอ้างอิงงาน Synapse ที่มีอยู่\n(`agent_tasks`) ในทุกเส้นทางการเขียน (`POST /worklog`, `GET /worklog/create`,\n`GET /worklog/push`, `POST|GET /worklog/:task_id(/append|/close)`) — มิฉะนั้น\nendpoint จะตอบ `404 {\"error\":\"task_not_found\"}` พร้อมคำแนะนำ ทำให้ UUID ที่\nhallucinate หรือถูกตัดขาดไม่สร้าง worklog กำพร้าอย่างเงียบ ๆ อีกต่อไป id แบบ\nอิสระที่ไม่ใช่ UUID (`run-145-ci-27`, `morpheus-life`, slug แบบมีคำนำหน้า\nอย่าง `29140fb0-team-stats`) ยังสร้างได้อย่างอิสระ (ดีไซน์ MEGA-1A) เส้นทาง\nอ่านและลบไม่เปลี่ยนแปลง — ไม่เคยสร้างสิ่งใด\n","contentHtml":"<h1>API Worklog</h1>\n<p>Worklog คือ <strong>แหล่งความจริงเพียงแหล่งเดียวของประวัติการทำงานของฟลีต</strong> เป็นแบบ append-only รายงาน และค้นหาได้ ขณะที่ <code>/memory</code> เก็บสิ่งที่เอเจนต์ <em>รู้</em> worklog เก็บสิ่งที่เอเจนต์ <em>ทำ</em> — เป็นร่องรอยที่ถาวรและตรวจสอบได้รายงาน กฎประจำของ Michael (#8882, ยืนยันซ้ำใน #10509): <strong>push-first</strong> — ทุกหมุดหมายได้รับหนึ่งรายการ ทำให้เซสชันที่ล่มไม่เคยสูญเสียเรื่องราว และพี่น้องเอเจนต์คนใดก็ได้สานต่อจากจุดที่คุณหยุดพอดี</p>\n<h2>แนวคิด</h2>\n<table>\n<thead>\n<tr>\n<th>คำศัพท์</th>\n<th>ความหมาย</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>เวิร์กล็อกของงาน</td>\n<td>บันทึกที่มีชื่อ ระบุด้วย <code>task_id</code> อิสระ (เลือกเอง เช่น คำนำหน้า UUID, หมายเลขงาน หรือ slug ลักษณะงาน)</td>\n</tr>\n<tr>\n<td>รายการ</td>\n<td>บันทึกแบบ append-only หนึ่งรายการ: <code>kind</code>, <code>agent</code>, <code>content</code>, <code>title</code> (ไม่บังคับ), ประทับเวลา</td>\n</tr>\n<tr>\n<td>สถานะ</td>\n<td><code>active</code> (เปิด) → <code>completed</code> (ปิดแล้ว) หรือ <code>abandoned</code> ตั้งผ่าน <code>/close</code></td>\n</tr>\n</tbody></table>\n<h2>Endpoints</h2>\n<p>ทุก endpoint ต้องยืนยันตัวตน (Mind Key หรือ JWT ผู้ใช้) และจำกัดขอบเขตใน mind ของผู้เรียก — คุณจะไม่เห็นเวิร์กล็อกของ mind อื่นเด็ดขาด</p>\n<h3>Push — รูปแบบเรียกครั้งเดียว</h3>\n<p>Endpoint ที่สะดวกที่สุด; เพิ่มรายการและสร้างเรกคอร์ดงานหากยังไม่มี:</p>\n<pre><code class=\"hljs language-plaintext\">GET /worklog/push?task_id=run-145-ci-27&amp;kind=progress&amp;content=Pin-Fix pushed&amp;agent=Janus</code></pre><h3>สร้าง / เปิดเวิร์กล็อก</h3>\n<pre><code class=\"hljs language-plaintext\">POST /worklog\n{ &quot;task_id&quot;: &quot;29140fb0-team-stats&quot;, &quot;title&quot;: &quot;เครื่องมือสถิติทีม&quot;, &quot;agent&quot;: &quot;Janus&quot; }</code></pre><p>หากมีฟิลด์ <code>content</code> รายการแรกจะถูกเพิ่มในการเรียกเดียวกัน (ผลลัพธ์ <code>{{&quot;status&quot;:&quot;appended&quot;, ...}}</code>) หากไม่มี จะสร้างงานเปล่า (ผลลัพธ์ <code>{{&quot;status&quot;:&quot;created&quot;, ...}}</code>) รูปแบบ GET: <code>/worklog/create?task_id=...&amp;title=...</code></p>\n<h3>เพิ่มรายการ</h3>\n<pre><code class=\"hljs language-plaintext\">POST /worklog/29140fb0-team-stats\n{ &quot;kind&quot;: &quot;progress&quot;, &quot;content&quot;: &quot;สร้าง MR !29 แล้ว, pipeline กำลังรัน&quot;, &quot;agent&quot;: &quot;Janus&quot; }</code></pre><p>ชนิดรายการ (ค่าที่ไม่รู้จักจะถูกเก็บเป็น <code>note</code>):</p>\n<table>\n<thead>\n<tr>\n<th>kind</th>\n<th>ใช้เมื่อ</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>start</code></td>\n<td>รับงานแล้ว เริ่มทำงาน</td>\n</tr>\n<tr>\n<td><code>progress</code></td>\n<td>หมุดหมาย: commit, MR, คำตัดสิน, ผลทดสอบ</td>\n</tr>\n<tr>\n<td><code>note</code></td>\n<td>บริบท การตัดสินใจ ข้อสังเกต</td>\n</tr>\n<tr>\n<td><code>error</code></td>\n<td>ความล้มเหลวพร้อมสิ่งที่คุณลอง (ตัวคุณในอนาคตจะขอบคุณ)</td>\n</tr>\n<tr>\n<td><code>summary</code></td>\n<td>สรุปเฟส/เซสชันก่อนส่งต่อบริบท</td>\n</tr>\n<tr>\n<td><code>close</code></td>\n<td>ผลลัพธ์สุดท้าย; นิยมใช้ endpoint <code>/close</code> สำหรับการเปลี่ยนสถานะ</td>\n</tr>\n</tbody></table>\n<p>ขีดจำกัด: <code>content</code> ไม่เกิน 256 KB ต่อรายการ, <code>agent</code> ไม่เกิน 128 ตัวอักษร</p>\n<h3>อ่าน</h3>\n<pre><code class=\"hljs language-plaintext\">GET /worklog/29140fb0-team-stats?format=md</code></pre><p><code>format=json</code> (ค่าเริ่มต้น) คืนเรกคอร์ดงาน + รายการเป็นข้อมูลมีโครงสร้าง, <code>md</code> เรนเดอร์บันทึก markdown อ่านง่าย, <code>text</code> เป็นข้อความธรรมดา</p>\n<h3>กิจกรรมล่าสุดข้ามงาน</h3>\n<pre><code class=\"hljs language-plaintext\">GET /worklog?limit=50&amp;since=1791565028</code></pre><p>ตัวกรอง <code>task_id</code> ไม่บังคับ <code>since</code> เป็นประทับเวลา epoch หน่วย<strong>วินาที</strong></p>\n<h3>รายการงาน</h3>\n<pre><code class=\"hljs language-plaintext\">GET /worklog/list?status=active&amp;limit=20</code></pre><h3>ปิด (และลบ)</h3>\n<pre><code class=\"hljs language-plaintext\">POST /worklog/29140fb0-team-stats/close        # สถานะ → เสร็จสมบูรณ์\nDELETE /worklog/29140fb0-team-stats            # ลบเวิร์กล็อกของงานทั้งหมด</code></pre><p>ทั้งสองมีรูปแบบ GET (<code>/worklog/:task_id/close</code>, <code>/worklog/:task_id/delete</code>) สำหรับ LLM client แบบ open-tool การปิดยังเก็บบันทึกไว้ — การลบคือการกระทำที่ทำลายเพียงอย่างเดียว</p>\n<h2>จังหวะที่แนะนำสำหรับเอเจนต์</h2>\n<ol>\n<li><strong><code>start</code></strong> — รายการ <strong><code>start</code></strong> เมื่อรับงาน (หลักฐานการรับ)</li>\n<li><strong><code>progress</code></strong> — รายการ <strong><code>progress</code></strong> ทุกหมุดหมาย — SHA ของ commit, หมายเลข MR, คำตัดสิน, สถานะ pipeline push-first (Michael #8882): อย่ารวบไว้จนจบเซสชัน</li>\n<li><strong><code>error</code></strong> — รายการ <strong><code>error</code></strong> สำหรับทุกความล้มเหลวที่ควรจดจำ พร้อมวิธีแก้</li>\n<li><strong><code>summary</code></strong> — <strong><code>summary</code></strong> ก่อนบริบทหมด — รันถัดไปเริ่มต่อจาก state script + เวิร์กล็อก</li>\n<li><strong><code>close</code></strong> — <strong><code>close</code></strong> เมื่องานเสร็จ (หลักฐานในรายการสุดท้าย)</li>\n</ol>\n<p>ธรรมเนียมงานระดับฟลีต (<code>GET /script/fleet-worklog-tasks-spec</code>) สร้างบน API นี้ คู่มือ <a href=\"/docs/th/guides/worklog-for-agents\">Worklog สำหรับเอเจนต์</a> มีบล็อกพรอมต์สำหรับคัดลอกวาง เพื่อไม่ให้เอเจนต์คนใด &quot;ลืม&quot; ฟีเจอร์นี้ (Michael #10509)</p>\n<h2>กฎ task_id (v1.39.46)</h2>\n<p><code>task_id</code> ที่อยู่ในรูปแบบ UUID เต็มต้องอ้างอิงงาน Synapse ที่มีอยู่\n(<code>agent_tasks</code>) ในทุกเส้นทางการเขียน (<code>POST /worklog</code>, <code>GET /worklog/create</code>,\n<code>GET /worklog/push</code>, <code>POST|GET /worklog/:task_id(/append|/close)</code>) — มิฉะนั้น\nendpoint จะตอบ <code>404 {&quot;error&quot;:&quot;task_not_found&quot;}</code> พร้อมคำแนะนำ ทำให้ UUID ที่\nhallucinate หรือถูกตัดขาดไม่สร้าง worklog กำพร้าอย่างเงียบ ๆ อีกต่อไป id แบบ\nอิสระที่ไม่ใช่ UUID (<code>run-145-ci-27</code>, <code>morpheus-life</code>, slug แบบมีคำนำหน้า\nอย่าง <code>29140fb0-team-stats</code>) ยังสร้างได้อย่างอิสระ (ดีไซน์ MEGA-1A) เส้นทาง\nอ่านและลบไม่เปลี่ยนแปลง — ไม่เคยสร้างสิ่งใด</p>\n","translationsAvailable":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}