Theme / v2.1.15

Chat On Steroids

把 ChatGPT 對話變成會寫程式、會派工的本地開發環境

工作流組合

本地編碼迴圈:用 ChatGPT 對話寫完一個功能

單一對話、單一任務的日常開發流程——核准資料夾、開場讀專案、先要計畫再動手、批次跑指令、長指令用 session 續接,最後驗收收尾。適合第一次把 CoS 用進日常工作的人。

本地編碼迴圈:用 ChatGPT 對話寫完一個功能

這個工作流涵蓋「單一對話、單一任務」的完整開發迴圈:從核准專案資料夾、讓 ChatGPT 讀懂專案,到修改、測試、驗收。目標是讓你第一次就把 CoS 用成日常習慣,而不是一次性的玩具。

⚠️ 安全提醒:exec_command 不受核准資料夾限制——它用你的一般使用者權限在整台機器上執行。起步請從 Read-only 或小範圍任務開始,詳見工具表面與權限與外掛生態、安全邊界與責任使用。


步驟 1:前置檢查

  • CoS 已安裝並開啟(安裝與啟動)。
  • Core connector 已在 ChatGPT 建好並連上(連接 ChatGPT 與 companion extension)。
  • companion extension 已載入,配對自動完成。
  • 模型清單怪怪的話,先按 Reload ChatGPT models——picker 反映的是你帳號當下可用的模型。

步驟 2:核准這個專案,決定權限檔位

在 Settings → Workspace 核准本專案資料夾,並檢視 Core 工具權限:

  • 只是要「讀懂、出計畫」→ 用 Read-only。
  • 要真的改檔案、跑測試 → 開啟對應權限;記得 exec_command 的邊界不在資料夾上。

步驟 3:開場——先讓它讀專案,再談任務

開一個新對話,先建立事實基礎,不要直接下指令:

Read the project in the approved folder:
1. List the top level and read README.md and package.json.
2. Find the main entry point and the test runner configuration.
3. Report: what this project does, how tests are run, and where the
   feature I care about lives. Do not modify anything yet.

此時你會看到 read(可一次多路徑)與 find/exec_command 的呼叫;模型應該給你一份「專案地圖+測試指令」。

步驟 4:一次一個小任務,先要計畫

把任務切成可以在一個對話內完成的大小,並要求先給計畫——update_plan 會把計畫顯示在介面上:

Task: add input validation to the /orders endpoint.
First give me a short plan with the exact files and the test command.
Then wait for my go-ahead.

確認計畫合理再放行。計畫有問題就在這裡改,比改程式便宜。

步驟 5:動手——patch 與批次指令

放行後,模型通常會:

  1. 用 apply_patch 送出 V4A patch(多檔會先 preflight;create/edit/move/delete 權限各自檢查)。
  2. 用 exec_command 跑測試。相關的檢查請它合併成一批:cmds 最多 20 條、共用一個 shell session,變數與工作目錄會延續,一次 round trip 完成——這是官方刻意設計的便宜路徑。
Run the checks in one batch: lint, the unit tests for orders, and the
type check. Stop and report if the first non-zero exit shows a real failure.

步驟 6:長指令(dev server、build)用 session 續接

啟動長時間程序時,exec_command 會回傳一個 session_id;後續用 write_stdin 續接,空字串就是輪詢(有新輸出就回來):

Start the dev server in the background and give me its session_id.
Then poll it in short rounds and tell me when it is ready to accept requests.

驗證完成後請它停掉程序,不要把 server 留在背景。

步驟 7:驗收與收尾

一個任務結束時,要求三件事:

Before we finish:
1. Summarize every file changed and why.
2. Run the full test command one last time and paste the result.
3. List anything you did NOT verify, and any risk you see.

「沒驗證的事」比「看起來沒問題」有價值——這是防止幻覺驗收的最小紀律。

步驟 8:撞到天花板之前,先換氣

  • context 快滿、對話開始變鈍時,用 Compact & Resume 換一個新 provider 對話、把同一 session 重新綁上去;任務與 worker 歷史會跟著走。
  • 如果收到 provider 的限制或政策警告:停手,關掉該工作流的 Goal/Loop,照 provider 的流程處理——不要靠新對話或新模型繞過去。

下一步