Sharkly Repositories: ให้ Coding Agent ได้โค้ดและ Branch ที่ถูกต้อง

อยากให้ coding agent ของคุณเริ่มต้นจากโค้ดที่ถูกต้องหรือไม่? มาดูว่า Sharkly repositories กำหนด repo และ branch สำหรับทุกครั้งที่รันอย่างไร พร้อมตัวอย่างจริง

Ryan Mitchell

Ryan Mitchell

23 พฤศจิกายน 2026

Sharkly Repositories: ให้ Coding Agent ได้โค้ดและ Branch ที่ถูกต้อง

สรุปสั้น: Sharkly repositories ใช้บอก Agent ว่าแต่ละ run จะเริ่มจาก codebase และ branch ไหน โดยเพิ่ม repository ครั้งเดียวใน Space settings ตั้ง baseline branch เปิดใช้งานบน Agent ที่เขียนโค้ด แล้วเลือก Use temporary directory เพื่อให้ทุก task ได้ clone ใหม่ Git access มาจาก credentials บน Computer ไม่ใช่จาก Sharkly

เมื่อ coding agent ทำงานเสร็จ diff กลับไปอยู่ใน checkout ของสัปดาห์ที่แล้วบน branch ที่เก่า เพราะไม่มีใครบอกว่าควรเริ่มจากโค้ดไหน Sharkly repositories แก้ปัญหานี้ได้: คุณระบุ repository และ branch ครั้งเดียว ทุก run บน Agent นั้นก็จะเริ่มจากจุดเดียวกัน Sharkly ตอนนี้ให้ใช้ฟรีสำหรับทีมเล็ก และคุณตั้งค่าได้ที่ sharkly.ai

เราทำขั้นตอนนี้จริงใน Cancel Anything ซึ่งเป็น CLI ยกเลิก subscription ขนาดเล็กที่ทีมกำลังสร้างอยู่บน Sharkly มี Agent สองตัวเขียนโค้ด: Bolt (engine, บน Claude Code) และ Hex (recipes, บน Codex) เมื่อจบบทแนะนำนี้ คุณจะมี Space repository พร้อม baseline branch มี Agent สองตัวผูกกับมัน และมี run จริงหนึ่งครั้งที่พิสูจน์ว่าการผูกนั้นทำงาน

ก่อนเริ่ม

คุณต้องเตรียมสามอย่าง:

  1. Space สำหรับโปรเจกต์ ของเราคือ Cancel Anything (CAAN)
  2. Computer ที่รัน Sharkly local service ซึ่งเป็นที่อยู่ของ Runtime ของ Agent ดู วิธีทำงานของ Sharkly Computers
  3. Agent ที่มี code Runtime เช่น Claude Code หรือ Codex หากคุณเพิ่งเริ่มใช้ Agent ให้เริ่มจาก อธิบาย Sharkly Agents

คุณยังต้องมีสิทธิ์ admin ของ Space หรือ Organization ด้วย เพราะการจัดการ repository จำกัดเฉพาะผู้ที่มี role นั้น

Sharkly เลือก repository และ branch อย่างไร

Sharkly resolve โค้ดในสองระดับ Space repositories คือค่าเริ่มต้นของทุก task ใน Space ส่วน Agent repositories จะจำกัดหรือแทนที่ค่าเริ่มต้นเหล่านั้นสำหรับ Agent ตัวเดียว หาก Agent มีการผูกไว้ run ของมันจะใช้ค่านั้น หากไม่มี Sharkly จะกลับไปใช้รายการของ Space

สำหรับ branch ลำดับนั้นตายตัว:

  1. checkout ref ที่ระบุชัดเจนสำหรับ run นั้น
  2. branch ของ Agent repository
  3. baseline branch ของ Space repository
  4. default branch ของ remote
Diagram: a task assigned to Bolt resolves its repository from Bolt's bindings or the Space repositories, then picks the branch in order: explicit checkout ref, Agent branch, Space baseline branch main, remote default; the run clones into a fresh temporary directory on the Computer

Cancel Anything ตั้ง branch ครั้งเดียวที่ระดับ Space และปล่อยรายการของ Agent ว่างไว้ เพื่อให้มีแหล่งความจริงเดียว: เปลี่ยน main เป็น release branch ในที่เดียว แล้วทั้งสอง Agent ก็ทำตาม

ขั้นตอนที่ 1: ตรวจสอบการตั้งค่า Git ของ organization

เปิด All settings แล้วไปที่ Git repositories & settings ใต้ Global configuration หน้านี้มีสองส่วน

Global Git settings กำหนด commit identity ที่ทุก Space สืบทอด: Commit author name, Commit author email และ Co-authored-by trailer ของเราใช้ "Agent user name & Agent name" เป็น author อ่านอีเมลจาก git config ของ Computer และเปิด trailer ไว้ เพื่อให้ทุก commit ของ agent ถูกระบุว่าเป็นของ agent

ด้านล่างคือ Space Git repositories & settings ซึ่งแสดง panel แบบยุบได้หนึ่งอันต่อหนึ่ง Space เนื้อหาเหมือนกับหน้าตั้งค่าของแต่ละ Space ดังนั้นคุณจัดการทุก Space ได้จากที่นี่

Organization settings, Git repositories & settings: Global Git settings with commit author name, commit author email and the Co-authored-by trailer, and one collapsible panel per Space

ดูที่ช่อง author ก่อน หากทีมของคุณรีวิว commit ของ agent การมีชื่อ agent อยู่ใน author name จะทำให้อ่าน git log เข้าใจได้ในพริบตา

ขั้นตอนที่ 2: เพิ่ม Space repository และ baseline branch

เปิด settings ของ Space (ของเราคือ Spaces → Cancel Anything) แล้วเลื่อนลงไปที่ Git repositories & settings คลิก Add repository แล้วกรอกสามช่อง:

  • Repository URL: clone URL แบบ HTTPS หรือ SSH
  • Baseline branch: เลือก Manual input แล้วพิมพ์ main ปล่อยว่างไว้เพื่อใช้ default branch ของ remote
  • Description: หนึ่งบรรทัดที่บอกคนและ Agent ว่าโค้ดนี้คืออะไร ของเราเขียนว่า "The Cancel Anything CLI: recipe runner, recipes/, tests/. Start every task from main."

คลิก Save ตอนนี้ repository จะแสดงเป็นแถวพร้อมเมนู Repository actions (Edit, Delete repository)

Edit repository dialog in the Cancel Anything Space settings: the repository URL, a description agents read, and the baseline branch set to main

อ่านหมายเหตุ Access credentials ที่ด้านล่างของ dialog Agent เข้าถึง repository ด้วย Git credentials บน Computer ที่มันรันอยู่ Sharkly เก็บแค่ URL ไม่ได้เก็บ token ห้ามวาง token หรือ private key ลงใน task, comment, Agent instruction หรือ Skill เด็ดขาด

ขั้นตอนที่ 3: เปิดใช้งาน repository บน Bolt และ Hex

เปิด Agent คลิก Settings แล้วขยาย Git repositories & settings ใต้ Git repositories · From this space คุณจะเห็นทุก Space repository พร้อมสวิตช์

เปิดสวิตช์ของ Cancel Anything repository Enable all จะเปิดทุก Space repository พร้อมกัน ส่วน Auto-enable when the space adds repos กำหนดว่า Space repository ใหม่จะลงบน Agent นี้โดยอัตโนมัติหรือไม่ เราเปิดไว้ปิด ดังนั้นการเพิ่ม repo ทีหลังจึงเป็นการเลือกอย่างตั้งใจต่อ Agent

Bolt's Git repositories & settings panel: the Space repository listed under From this space with its switch on, plus Enable all and Auto-enable when the space adds repos

ทำซ้ำบน Hex ตัวเลขข้างชื่อ section (1) บอกว่ามีกี่ repository ที่ Agent จะใช้

ขั้นตอนที่ 4: ให้แต่ละ run ได้ directory ใหม่

ใน settings ของ Agent เปิด Computer, Runtime & Working directory แล้วตั้ง default working directory เป็น Use temporary directory จากนั้นแต่ละ run จะได้ task directory แยกต่างหากพร้อมสำเนา repository ใหม่ เริ่มจาก baseline branch

นี่คือการตั้งค่าที่ทำให้การผูกมีผล ในโหมด Specified directory Agent จะทำงานในโฟลเดอร์ local ที่คุณเลือก และสถานะปัจจุบันของโฟลเดอร์นั้นเป็นตัวตัดสิน กฎของ working directory อธิบายทั้งสองโหมดไว้อย่างละเอียด

ขั้นตอนที่ 5: ทดสอบการเข้าถึงด้วย run แบบ read-only

ก่อนมอบงานจริงให้ Bolt เราเปิด task ตรวจสอบหนึ่งรายการ CAAN-21 และมอบหมายให้ Bolt task ขอแค่ข้อมูลเท่านั้น ไม่มีการเปลี่ยนแปลง:

Report the primary language, package manager and closest test command.
Also report:
- the absolute path of the working directory
- git rev-parse --abbrev-ref HEAD, git log -1 --oneline,
  git remote get-url origin (path only)
- whether git fetch --dry-run succeeds
Done when: a short report is on this task and nothing in the repository changed.

Bolt เสร็จใน 78 วินาที มัน clone Space repository ลง temporary directory ใหม่ พบ TypeScript บน Node 20 ใช้ npm และ npm test และรายงานว่า HEAD อยู่ที่ commit เดียวกับ remote main git fetch --dry-run สำเร็จ ซึ่งพิสูจน์ว่า credentials ของ Computer อ่าน remote ได้

CAAN-21, the read-only access check assigned to Bolt: the task description, its properties, and Bolt's conversation marked Needs your review

ผลลัพธ์จริง

เมื่อพิสูจน์การเข้าถึงได้แล้ว เรามอบหมาย CAAN-6 ให้ Bolt: สร้าง cancel-anything check ซึ่งเป็นคำสั่ง nightly ที่เปิดหน้าต่างยกเลิกของแต่ละ recipe ในสถานะ logged out และยืนยันว่าปุ่มแรกมีอยู่จริง

Bolt รัน sharkly repo checkout ใน temporary directory ว่างเปล่า ได้ main มา เขียนคำสั่งและ test ของมัน และ push branch เพื่อรีวิว gate ของมันผ่าน 18 จาก 18 test typecheck สะอาด และ check ตรวจพบ recipe ที่ตั้งใจทำให้เสียพร้อม exit code 1 แล้ว Bolt ก็ย้าย task ไปที่ QA

ทั้งสอง run เริ่มจาก repository และ branch เดียวกัน และไม่มีอันไหนแตะโฟลเดอร์ที่คนใช้งานอยู่

สิ่งที่ผิดพลาดกับเรา

ตอนแรกการผูกไม่มีผลอะไรเลย Bolt ถูกตั้งให้ใช้ specified local directory ดังนั้น run ของมันจึงใช้โฟลเดอร์นั้นต่อไป การเปลี่ยนไปใช้ Use temporary directory แก้ไขได้ใน run ถัดไป หากเจอ "Agent หาโค้ดไม่เจอ" หรือแก้ไข checkout ผิดที่ ให้ตรวจสอบ working directory mode ก่อนสิ่งอื่น

"ไม่มี branches" เป็นไปไม่ได้จริง ๆ task ตรวจสอบของเราบอกว่า "no branches" แต่ sharkly repo checkout --ref main สร้าง local branch ชื่อ sharkly-agent/<agent>/<task> เสมอ มันชี้ไปที่ main ไม่มี commit และไม่ถูก push เขียนกฎ read-only ของคุณว่า "no commits, no pushes" แทน

ไม่มีการเชื่อมต่อ GitHub ระดับ org การติดตั้ง GitHub app ของเรารองรับ Sharkly organization อื่นอยู่แล้ว ดังนั้นอันนี้จึงแสดงว่าไม่มี GitHub organization เชื่อมต่ออยู่ repository ยังใช้งานได้ เพราะการ clone ใช้ Git credentials บน Computer ส่วน GitHub integration สำคัญกับการ sync issue ซึ่งกล่าวถึงใน การมอบหมาย GitHub issue ให้ AI agent ไม่ใช่การเข้าถึง repository

default branch ผิด หาก run ไปลงบน branch เก่า ให้อ่านลำดับจากบนลงล่าง: ref ที่ระบุชัดเจนหรือ branch ระดับ Agent ชนะ baseline ของ Space ล้างรายการของ Agent เพื่อกลับไปใช้ Space

อีกสองวิธีที่ทีมใช้ repositories

ทีมที่ใช้ monorepo เพิ่ม Space repository หนึ่งอันและมอบทั้งหมดให้แต่ละ Agent แล้วจำกัดขอบเขตด้วยคำสั่ง (Bolt ดูแล src/ ส่วน Hex ดูแล recipes/) มี baseline branch เดียว มีหลาย Agent ไม่ต้องผูกต่อ Agent

agency ที่มี repo ของลูกค้า เพิ่ม repository หนึ่งอันต่อลูกค้าหนึ่งรายใน Space และเปิดเฉพาะอันที่ถูกต้องบน Agent ของลูกค้ารายนั้น ด้วย Auto-enable ที่ปิดไว้ repo ของลูกค้าใหม่จะไม่ไปถึง Agent ผิดตัวโดยไม่ตั้งใจ เอกสาร Git worktree อธิบายโมเดลการแยกส่วนที่ทำให้ run แบบขนานปลอดภัย

สรุปเช็กลิสต์

  • [ ] Global Git settings: ตรวจสอบ commit author และ Co-authored-by trailer แล้ว
  • [ ] เพิ่ม Space repository พร้อม URL, description และ baseline branch แล้ว
  • [ ] เปิดใช้งาน repository บนทุก Agent ที่เขียนโค้ดแล้ว
  • [ ] ตั้ง Use temporary directory บน Agent เหล่านั้นแล้ว
  • [ ] Computer clone และ fetch ได้ (run แบบ read-only หนึ่งครั้งพิสูจน์ได้)
  • [ ] ไม่มี token ใน task, comment หรือ instruction

ตั้งค่าใน Space ของคุณเองที่ app.sharkly.ai แล้วมอบหมาย read-only check อย่าง CAAN-21 ให้ Agent ก่อนการ build จริงครั้งแรก หากคุณเริ่มจากศูนย์ เริ่มต้นใช้งาน Sharkly จะพาไปดู workspace ทั้งหมด และ หน้าฟีเจอร์ Agents แสดงว่า repository อยู่ตรงไหน

FAQ

Sharkly repositories คืออะไร?

คือ Git repository ที่ผูกกับ Space หรือ Agent ใช้บอกแต่ละ run ว่าจะ clone codebase ไหนและเริ่มจาก branch ใด

Agent จำเป็นต้องมีการผูก repository ของตัวเองไหม?

ไม่จำเป็น หากไม่มี Agent bindings run จะกลับไปใช้ Space repositories เพิ่ม Agent bindings เฉพาะเมื่อต้องการจำกัดหรือแทนที่รายการของ Space

Sharkly เลือก branch อย่างไร?

checkout ref ที่ระบุชัดเจนชนะก่อน จากนั้น branch ของ Agent repository, baseline branch ของ Space และ default branch ของ remote ตามลำดับ

Git credentials มาจากไหน?

จาก Computer ที่ Agent รันอยู่: SSH keys, HTTPS credentials หรือการตั้งค่าอื่นที่ local service ใช้ได้ Sharkly เก็บแค่ URL

ต้องมี GitHub integration ถึงจะใช้ repositories ได้ไหม?

ไม่ต้อง run ของเรา clone และ push ได้โดยไม่มีการเชื่อมต่อ GitHub ระดับ org integration นี้ใช้สำหรับ sync issue เข้าเป็น task

ทำไม Agent ถึงเพิกเฉยต่อ repository ที่ฉันเพิ่มไป?

ตรวจสอบ working directory mode ในโหมด Specified directory Agent จะใช้โฟลเดอร์ local นั้น ส่วน Use temporary directory จะให้แต่ละ run ได้ clone ใหม่

สำรวจเพิ่มเติม

ทำไม AI Agents ถึงล้มเหลว: ความฉลาดไม่ใช่จุดคอขวด

ทำไม AI Agents ถึงล้มเหลว: ความฉลาดไม่ใช่จุดคอขวด

สงสัยไหมว่าทำไม AI agent ถึงล้มเหลวทั้งที่โมเดลฉลาดพอ? มาทำความเข้าใจสามช่องว่างที่ทำให้ทีมเอเจนต์หยุดชะงัก และวิธีที่บอร์ดที่ใช้ร่วมกันช่วยปิดช่องว่างเหล่านี้

23 พฤศจิกายน 2026

เวลาทำงานของ Sharkly Agent: เลื่อนการรัน Agent ไปช่วงออฟพีก

เวลาทำงานของ Sharkly Agent: เลื่อนการรัน Agent ไปช่วงออฟพีก

อยากให้งานของเอเจนต์ที่ใช้เวลานานรอไปทำตอนกลางคืนไหม มาดูว่าคิวตามเวลาทำงานของเอเจนต์ Sharkly ทำงานนอกช่วงเวลาเร่งด่วนอย่างไร และ Run now จัดการงานเร่งด่วนอย่างไร

23 พฤศจิกายน 2026

Sharkly งานย่อยและงานที่เชื่อมโยง: หยุดการทำงานของเอเจนต์จนกว่าขั้นตอนก่อนหน้าจะเสร็จสิ้น

Sharkly งานย่อยและงานที่เชื่อมโยง: หยุดการทำงานของเอเจนต์จนกว่าขั้นตอนก่อนหน้าจะเสร็จสิ้น

งานหนึ่งใหญ่เกินกว่าจะให้เอเจนต์รันเพียงครั้งเดียวใช่ไหม? เรียนรู้ว่า Sharkly sub-tasks และ blocking links ช่วยแบ่งงานและควบคุมแต่ละขั้นตอนให้รอจนกว่าขั้นตอนสุดท้ายจะเสร็จได้อย่างไร

23 พฤศจิกายน 2026