# 策展 · X (Twitter) 🔥🔥

> 📖 本站完整內容索引（documentation index）：[llms.txt](/llms.txt)

> 作者：马东锡 NLP (@dongxi_nlp) · 平台：X (Twitter) · 日期：2026-06-13

> 原始來源：https://x.com/dongxi_nlp/status/2065713612384010332

## 中文摘要

# Agent 的工具箱："/"

Harness 系列文章之 4，斜線（slash）讓 coding agent 超出單純的 prompt box。

> 不是所有的 input，都可以成為 prompt。

每個 coding-agent UI 都從一個簡單想法開始：

輸入請求，發給 model，拿回結果。這是 prompt-box 視角下的 Agent。

普通請求很適合這樣處理：

![此圖展示了在軟體開發流程中，當不同類型的任務請求皆透過單一模型路徑處理時所面臨的控制平面問題。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/8d9dbe5d04a0c14c.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">畫面標題為「HARNESS 04 · CONTROL PLANE」，主題為「Ordinary Work Requests」。
左側方框列出了三項工作請求：
- fix the failing tests
- explain this module
- add a config option

右側方框標題為「MODEL PATH」，下方文字說明：「These are work requests. They can become a prompt.」

底部橫幅文字說明：「The control-plane problem starts when every input uses this same path.」

畫面重點在於說明當多樣化的工作請求（如修復測試、解釋模組、新增設定）全部匯流至同一個模型處理路徑時，會產生控制平面（Control Plane）上的效能或架構問題。</div></details>

但產品級的 coding agent 還有另一類 input：

```markdown
/status、/tools、/reset、/goal pause、/audit
```

這些 input 不該交給 model 當成普通請求來理解。

它們是使用者用來控制 Agent runtime 的 tools。

> Do not send control-plane intent to the model as ordinary chat.

![此圖表展示了名為「The Agent's Toolkit: "/"」的控制平面工具架構，將斜線指令分為四大功能類別。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/acc63466108ce86d.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">圖片標題為「HARNESS 04 · CONTROL PLANE」以及「The Agent's Toolkit: "/"（斜槓即工具）」。右側說明指出，這些輸入用於在提示詞（prompt）生成前控制執行環境，斜線指令是該架構獲取工具的方式。畫面中央為一個斜線「/」圖示，周圍分為四個功能區塊：
1. **SESSION（綠色標籤）**：包含 `/status`、`/memory`、`/reset`，用於檢查或變更本地會話狀態。
2. **GOAL（藍色標籤）**：包含 `/goal`、`/goal pause`，用於使用者擁有的生命週期及模型可見的上下文。
3. **CAPABILITIES（橘色標籤）**：包含 `/tools`、`/skills`、`/mcp`、`/hooks`，用於展示該架構可提供的功能。
4. **DIAGNOSTICS（紅色標籤）**：包含 `/audit`、`/doctor`，用於在本地檢查確定性的架構不變量。</div></details>

## The Naive Prompt Box

Tiny Agent 往往把所有 text 都用同一條路徑處理：

![這張投影片展示了「The Naive Prompt Box」的概念，說明了將原始使用者輸入直接傳遞給模型所帶來的潛在風險。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/bb12d0cd7ed251ed.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">投影片標題為「HARNESS 04 · CONTROL PLANE」以及「The Naive Prompt Box」。
左側區塊列出了處理流程：
- raw user input
- -&gt; append to transcript
- -&gt; build prompt
- -&gt; call model
- -&gt; parse model output

右側區塊標示為「FAILURE MODE」，說明內容為：
「All text becomes model input, including commands that should control the runtime.」

底部橫幅文字為：
「A slash command should not need the model's permission to inspect or steer the harness.」

這張圖說明了在系統設計中，若未將控制指令（如 slash command）與一般使用者輸入分開處理，會導致模型誤將控制指令視為一般對話內容，進而產生安全或邏輯上的失敗模式。</div></details>

這樣很簡單，也會讓產品陷入困境。

- 使用者輸入 /status，model 可能編造一個 status。

- 使用者輸入 /reset，model 可能討論 reset，卻沒有清理 session state。

- 使用者輸入 /goal pause，model 可能把它當成當前 task 裡的 instruction。

- 使用者把 /status 打成 /statsu，model 可能試圖幫忙猜，而非返回 command help。

問題發生在 model quality 之前。Harness 沒有正確 route input。

## Slash Commands Are User Tools

文章 03 提到，model tools 是 contracts。

Slash commands 屬於另一類 tool，它們屬於使用者和 Harness。

它們可以在 model call 出現之前 inspect、steer、reset、pause、diagnose、configure runtime。

一個簡單的 command families 如下：

![此圖表展示了「Slash Command Families」的分類架構，說明如何透過斜線指令來控制系統運行。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/a8277bb8a7590df1.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">圖表標題為「HARNESS 04 · CONTROL PLANE」及「Slash Command Families」。
左側區塊列出了指令分類與對應的斜線指令：
- session: /status /memory /session /reset /help
- tools: /tools
- goal: /goal /goal pause /goal resume /goal clear
- capability: /skills /mcp /hooks
- policy + diagnostics: /permissions /audit /doctor
- future context: /compact

右側區塊標題為「USER TOOLKIT」，說明文字為：「The slash exposes harness controls without turning every action into a prompt.」

底部橫條文字為：「Command families make the runtime inspectable and steerable.」

畫面重點：此圖展示了一套系統指令集架構，旨在透過預定義的斜線指令（Slash Commands）來管理系統狀態、目標設定、工具調用及診斷功能，讓使用者能更有效率地控制運行環境，而無需將所有操作都轉換為自然語言提示詞（prompt）。</div></details>

- 有些 command 產生 local output。

- 有些 command 修改 session state。

- 有些 command 展示 Harness metadata。

- 有些 command 為下一輪 model turn 準備 context。

它們都需要在 prompt construction 之前被 route。

此時的關鍵字已經出來了，那就是

> Input Router

## The Input Router

有用的 coding-agent Harness 有兩個 parser boundary。

第一層處理 user input，後一層處理 model output。

Input router 應該判斷：

![這張簡報圖表說明了系統架構中「輸入路由器（The Input Router）」的處理邏輯與運作流程。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/7d9941ca97114726.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">畫面標題為「HARNESS 04 · CONTROL PLANE」，主題為「The Input Router」。

左側方框列出了處理原始使用者輸入（raw user input）的邏輯流程：
- 若為空（empty?）：忽略（ignore）
- 若為已知斜線指令（known slash command?）：本地處理（handle locally）
- 若為未知斜線指令（unknown slash command?）：回傳指令說明（return command help）
- 若為本地查詢（local query?）：本地回答（answer locally）
- 若為一般請求（normal request?）：準備訊息並呼叫模型（prepare message and call model）

右側方框標題為「ROUTE FIRST」，說明文字為：「The harness decides what kind of input this is before prompt construction.」（在建構提示詞之前，該架構會先判斷輸入的類型。）

底部橫條文字：「User-input parsing and model-output parsing are different boundaries.」（使用者輸入解析與模型輸出解析屬於不同的邊界。）</div></details>

只有最後一條路徑應該進入 agent.ask()。

Prompt box 不再是唯一入口，Harness 擁有自己的 control surface。

> Not Every Input Becomes A prompt

![這是一張展示「輸入路由器（Input Router）」處理邏輯的流程圖，說明在將使用者輸入發送給模型前，如何先行過濾與處理指令。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/9133470d9499f87f.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">該圖表標題為「HARNESS 04 · INPUT ROUTER」以及「Not Every Input Becomes A Prompt」，並註明「Slash commands and local queries should be resolved before the model sees the turn.」。

流程圖邏輯如下：
1. **Raw User Input**（原始使用者輸入）：進入判斷程序。
2. **Empty?**（是否為空）：若為「yes」則導向 **Ignore Locally**（不進行模型呼叫）；若為「no」則進入下一步。
3. **Slash Command?**（是否為斜線指令）：
   - 若為「known」（已知指令）：導向 **Handle Locally**（處理狀態、工具、目標）。
   - 若為「unknown slash」（未知指令）：導向 **Command Help**（不詢問模型）。
   - 若為「no slash」（無斜線）：導向 **Prepare Model Request**（建立應用程式訊息）。
4. **Local Query?**（是否為本地查詢）：若為「yes」則導向 **Local**（立即回應）；若為「no」則回到 **Prepare Model Request**。</div></details>

## The Special Case: /goal

/goal 是最有意思的 slash command，因為它夾在使用者控制（user control）和 model 工作（model work）之間。

> goal 是顯式 session state

![這張投影片展示了「目標控制狀態」（Goal Control State）的架構設計，強調其作為控制平面狀態而非模糊聊天記憶的特性。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/ce063e9ca5c2443d.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">投影片標題為「HARNESS 04 · CONTROL PLANE」以及「Goal Control State」。

左側程式碼區塊內容：
session["goal"] = {
  "objective": "...",
  "status": "active",
  "created_at": "...",
  "updated_at": "...",
  "events": []
}

user controls:
/goal pause /goal resume /goal clear

model tools:
get_goal()
update_goal(status="complete")

右側說明區塊：
標題為「NARROW MUTATION」。
內容為：「The model can see goal context, but the user owns the lifecycle.」

底部橫幅文字：
「Goal state is control-plane state, not fuzzy chat memory.」

畫面重點解讀：該圖表定義了 AI 代理（Agent）系統中「目標」的資料結構與控制機制。它將目標狀態視為明確的控制平面（Control Plane）資料，而非僅是聊天記錄中的模糊上下文，並透過明確的指令（如 pause, resume, clear）與工具函數（get_goal, update_goal）來管理目標的生命週期。</div></details>

User-facing command 控制 lifecycle：

/goal <objective> / /goal pause / /goal resume / /goal complete / /goal clear

```python
/goal <objective> 
/goal pause 
/goal resume 
/goal complete 
/goal clear
```

Model 可以在 prompt 裡看到 goal context。

但 model 不能隨意 create、pause、resume、clear goals。

> get_goal() / update_goal(status="complete")

Goal 可以引導 model，使用者仍然擁有 control state。

Completion 應該依賴 evidence，而非 model 覺得已經完成。

## Diagnostics Should Stay Local

有些 command 應該直接 inspect Harness。

/audit 和 /doctor 是很好的例子。

它們不應該問 model：

> does my session look healthy?

它們應該檢查 deterministic state，例如使用 /audit 或者 /doctor。

![這張簡報說明了在控制平面（Control Plane）中，診斷資訊應保持在本地處理，以避免 AI 代理產生幻覺。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/fa8e9a64a405a302.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">這是一張關於「HARNESS 04 · CONTROL PLANE」的技術簡報，標題為「Diagnostics Stay Local」（診斷資訊保持本地）。

畫面左側列出了 `/audit` 與 `/doctor inspect` 指令所涵蓋的檢查項目：
- session history roles（對話歷史角色）
- tool call / result pairing（工具呼叫與結果配對）
- file-state freshness（檔案狀態時效性）
- tool registry metadata（工具註冊表元數據）
- goal state（目標狀態）
- context projection（上下文投影）
- permission state（權限狀態）
- MCP + hook configuration（MCP 與鉤子配置）

畫面右側標註為「REAL INVARIANTS」，內容為：「The first health check should inspect deterministic harness state.」（首次健康檢查應檢查確定性的 harness 狀態。）

底部橫幅文字強調：「If diagnostics become chat, the agent can hallucinate health.」（如果診斷資訊變成對話形式，代理可能會對健康狀態產生幻覺。）</div></details>

第一步檢查應該在 local 完成。

Diagnostics 作為 local command 時，Harness 可以報告真實的 invariants。

## Why This Changes The Product

一旦有 slash commands，使用者擁有的不只是 prompt box。

使用者可以問：

- 當前 workspace 是哪裡？

- 有哪些 tools 可用？

- 當前 active goal 是什麼？

- 哪些 state 會進入下一輪？

- 上次 edit 之後發生了什麼？

- Harness 內部是否一致？

- 這個 session 應該 reset、pause、resume，還是 compact？

這些是 runtime questions，它們需要 runtime answers。

Slash 後面的 text 屬於 Harness，而非 model。

所以 coding-agent Harness 應該有：

![這張簡報說明了編碼代理（coding-agent）架構中「控制平面（Control Plane）」的設計規則與邊界定義。](https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/9f9ba2e9c32b779c.jpg)

<details class="chart-data"><summary>展開畫面重點</summary><div class="me-note">畫面標題為「HARNESS 04 · CONTROL PLANE」及「Control Plane Rule」。

左側方框列出了「A coding-agent harness needs:」的七項需求：
1. typed input router
2. known local command handlers
3. unknown command help
4. session-state commands
5. diagnostic commands
6. narrow model mutation rules
7. tests proving local commands do not call the model

右側方框標題為「PRODUCT BOUNDARY」，內容為：
「The prompt box asks for work. The slash controls the worker.」

底部橫條文字為：
「The agent's toolkit starts with /.」

畫面重點在於定義編碼代理的控制平面架構，強調透過斜線（/）指令來區分工作請求與系統控制，並要求本地指令處理器需具備獨立性，不應呼叫模型。</div></details>

Prompt box 是使用者請求工作的地方。

Slash 是使用者控制 worker 的地方。

這就是 Agent toolkit 從 / 開始的原因。

## 標籤

Agent, IDE, 教學資源, Harness
