Theme / v0.5.0

CatDesk

把 ChatGPT Web 變成本地 Coding Agent

實戰範例

第一次對話:讓 ChatGPT 認識你的專案

連接器設定完成後的第一次對話。請 ChatGPT 用 catdesk_instruction、read 與 search 探索一個新專案,並理解它到底「看」到了什麼。

第一次對話:讓 ChatGPT 認識你的專案

你剛裝好 CatDesk、把連接器(Custom Connector)接上 ChatGPT Web,終端機裡的 TUI 也顯示出 MCP Server URL 了。現在的問題很實際:ChatGPT 根本不認識你的專案,直接叫它改程式碼只會得到一段憑空想像的答案。

這篇範例帶你走一次標準的「破冰對話」:讓 ChatGPT 自己讀說明、讀檔案、搜尋程式碼,把專案的長相建立起來。


情境

你 clone 了一個同事留下的 Node.js 專案 order-service,從沒打開過。你打開終端機,在專案根目錄執行 catdesk,選擇 Control Computer 模式,然後開了一個全新的 ChatGPT 對話。

目標

讓 ChatGPT 在不依賴你口頭描述的情況下,自己讀完專案結構,並回報:這個專案做什麼、入口在哪、訂單查詢的邏輯寫在哪個檔案。

步驟一:確認 Custom instructions 已就位

第一次設定連接器時,你應該已經把官方建議的這段加進 ChatGPT 的 Custom instructions:

CatDesk is a coding tool and a custom connector. Always use CatDesk
if the user wants to do anything related to file operations. Always
call catdesk_instruction after list_resources, and follow the
instructions it contains.

這段話的作用是讓 ChatGPT 遇到檔案操作就自動改用 CatDesk,並且在每次對話開始先呼叫 catdesk_instruction 取得使用說明。

步驟二:給 ChatGPT 的 prompt

I just connected CatDesk and I'm in a new repo called order-service.
Explore the project:
1. Call catdesk_instruction first, and check if there is an AGENTS.md
   anywhere it looks for.
2. Read package.json and the main entry file.
3. Search for where order lookup logic lives (something like
   getOrderById).
Then summarize: what this project does, its entry point, and which
file contains the order lookup logic.

CatDesk 工具呼叫序列

ChatGPT 收到訊息後,CatDesk 端會出現類似這樣的一串工具呼叫(Tool Call):

1. list_resources
2. catdesk_instruction
3. read(paths: ["package.json", "src/index.ts", "AGENTS.md"])
4. search(pattern: "getOrderById")
5. read(paths: ["src/orders/service.ts"])

注意第 3 步:read 支援一次讀多個檔案,ChatGPT 通常會批次讀,而不是一個一個慢慢叫。

ChatGPT 到底「看」到了什麼

理解這一點,之後除錯會省很多力氣:

  • catdesk_instruction 回傳 CatDesk 的使用說明,並且每次呼叫時依序檢查三個位置的 AGENTS.md:工作區根目錄(Workspace root)、~/.catdesk/AGENTS.md~/.codex/AGENTS.md。找到的專案規範會一併餵給 ChatGPT。
  • readsearch 都以工作區為根路徑。路徑超出工作區會被拒絕,所以 ChatGPT 看不到也不動得了你電腦的其他地方。
  • search 底層依序嘗試 rg、grep、內建掃描器。裝了 ripgrep 搜尋最快,但沒裝也能用。

結果與重點

ChatGPT 最後回報:order-service 是一個 Express 訂單服務,入口在 src/index.ts,訂單查詢邏輯集中在 src/orders/service.tsgetOrderById()。你沒有貼過任何一行程式碼。

三個重點帶走:

  • 每個新專案的第一句話,都值得花一次對話做探索,不要跳過。
  • 想讓 ChatGPT 預先理解專案慣例,把 AGENTS.md 放在工作區根目錄最有效。
  • 對話是靠工具呼叫換來的認知,認知越多、後續修改越準,但也會消耗內容視窗,大專案記得開新對話(見範例 003)。