給 coding agent 的本地優先儲存庫工作流

把並行的 agent session,變成 驗過、查得到的 Task。

AIT 是一套 CLI:每個程式修改需求都有自己的隔離 worktree、通過檢查的 精確版本,以及不隨 agent session 消失的儲存庫紀錄。Codex、Claude 或其他 coding agent 都能使用。

  • 本地優先
  • 不需要伺服器
  • 不綁 agent
  • 可與 Git 互通

結果示意 · 在互動示範中查看每個步驟

三張卡 → 三條隔離的工作流 本地 · main · ait 1.1.1

每張卡一個獨立 worktree 衝突不會被靜默覆蓋

  1. Card 01 · 加入無障礙密碼顯示控制worktree 1 · agent A · 3 項測試通過 · 乾淨 rebase
    已完成
  2. Card 02 · 抽出 session 驗證器worktree 2 · agent B · 8 項測試通過 · 目標已前進,乾淨 rebase
    rebase → 已完成
  3. Card 03 · 更名 auth 設定鍵worktree 3 · agent C · 與 Card 02 的變更實質重疊
    已停止 · 衝突
Card 03 會停下來,而不是覆蓋 Card 02。

相容的工作會在收尾時乾淨 rebase;不相容的重疊會停在明確的衝突狀態, 等你判斷。機械式 rebase 不證明語意相容,所以儲存庫檢查與人的審查 仍然必要。

ait queue summary哪些卡可以動、哪些在等你 →

走完一個 AIT 任務

一個需求,走到真正完成的 Task。

看 AIT 開啟隔離工作區、驗證一個小修改,再把完成的結果帶回原始專案。

2026-09-07 實際執行 AIT 命令的節錄重播。路徑已簡化;播放時間不代表任務執行效能。
閱讀完整命令紀錄
AIT first-task command recording — 2026-09-07
Actual command output. Absolute example roots are shortened to ~/ait-first-task.
The replay is edited for readability; playback is not an execution-time measurement.

Working directory: ~/ait-first-task
$ ait --version
ait 1.1.2
Exit code: 0

Working directory: ~/ait-first-task
$ node --test tests/baseline.test.mjs
✔ task titles preserve the input order and data (1.168458ms)
✔ the existing board title is unchanged (0.063583ms)
✔ the existing priorities are unchanged (0.046333ms)
ℹ tests 3
ℹ suites 0
ℹ pass 3
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 63.568458
Exit code: 0

Working directory: ~/ait-first-task
$ ait init
Initialized empty AIT repository in ~/ait-first-task/.ait (plan=zh-Hant-TW/concise)
Exit code: 0

Working directory: ~/ait-first-task
$ ait config set --user-name 'AIT Demo'
ait config set
user-name: AIT Demo
Exit code: 0

Working directory: ~/ait-first-task
$ cat docs/sprints/open-tasks.md
# Open tasks [plan-ref: example/open-tasks]

## Intent
Add openTasks(tasks) to src/tasks.mjs. Return a new array of tasks whose done property is not true, preserving order and object references without mutating the input. Keep taskTitles unchanged.

## Constraints
Only edit this Task worktree. Do not edit checks/, remove tests, or add packages. The root agent executes this task without subagents.

## Acceptance
Add a focused regression test for done true, false, missing, empty input, preserved order and identity. Run node --test tests/*.test.mjs and node checks/first-task.mjs before Task finish; verify acceptance again in the original directory afterward.

- [ ] Add non-mutating openTasks and focused tests. [ref: open-tasks]
Exit code: 0

Working directory: ~/ait-first-task
$ ait task start --from 'docs/sprints/open-tasks.md#open-tasks' --intent 'Add openTasks without mutating input'
ait task start
task: LT-0001
title: Add non-mutating openTasks and focused tests
next: cd ~/ait-first-task/.ait-worktree-links/lt-0001
Exit code: 0

Working directory: ~/ait-first-task/.ait-worktree-links/lt-0001
$ node --test tests/baseline.test.mjs tests/open-tasks.test.mjs
✔ task titles preserve the input order and data (1.041042ms)
✔ the existing board title is unchanged (0.053041ms)
✔ the existing priorities are unchanged (0.048583ms)
✔ openTasks returns unfinished tasks without changing input or objects (1.224417ms)
ℹ tests 4
ℹ suites 0
ℹ pass 4
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 63.11
Exit code: 0

Working directory: ~/ait-first-task/.ait-worktree-links/lt-0001
$ node checks/first-task.mjs
FIRST_TASK_ACCEPTED
Exit code: 0

Working directory: ~/ait-first-task/.ait-worktree-links/lt-0001
$ ait snapshot create LT-0001 --message 'Add non-mutating openTasks'
ait snapshot create
snapshot_id: SNP-0B558114ECDB
task_id: LT-0001
line_name: feature/lt-0001
parent_snapshot_id: SNP-2B43A5F97E11
message: Add non-mutating openTasks
Exit code: 0

Working directory: ~/ait-first-task/.ait-worktree-links/lt-0001
$ ait task finish LT-0001 --local
finished: LT-0001 -> main @ SNP-0B558114ECDB
closed: task, worktree, line, sprint
title: Add non-mutating openTasks and focused tests
Exit code: 0

Working directory: ~/ait-first-task
$ node --test tests/baseline.test.mjs tests/open-tasks.test.mjs
✔ task titles preserve the input order and data (0.987959ms)
✔ the existing board title is unchanged (0.050417ms)
✔ the existing priorities are unchanged (0.042292ms)
✔ openTasks returns unfinished tasks without changing input or objects (0.963875ms)
ℹ tests 4
ℹ suites 0
ℹ pass 4
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 61.445542
Exit code: 0

Working directory: ~/ait-first-task
$ node checks/first-task.mjs
FIRST_TASK_ACCEPTED
Exit code: 0

Working directory: ~/ait-first-task
$ ait blame src/tasks.mjs --line 7
target: current line main
resolved snapshot: SNP-0B558114ECDB
path: src/tasks.mjs
blame parent: SNP-2B43A5F97E11
range: 7-7

7         SNP-0B558114ECDB task=LT-0001 confidence=durable_snapshot_binding
Exit code: 0

Implementation recorded in the completed Task:
// Small, existing behavior to preserve while adding your first feature.
export function taskTitles(tasks) {
  return tasks.map((task) => task.title);
}

export function openTasks(tasks) {
  return tasks.filter((task) => task.done !== true);
}

Bound sprint after Task finish:
# Open tasks [plan-ref: example/open-tasks]

## Intent
Add openTasks(tasks) to src/tasks.mjs. Return a new array of tasks whose done property is not true, preserving order and object references without mutating the input. Keep taskTitles unchanged.

## Constraints
Only edit this Task worktree. Do not edit checks/, remove tests, or add packages. The root agent executes this task without subagents.

## Acceptance
Add a focused regression test for done true, false, missing, empty input, preserved order and identity. Run node --test tests/*.test.mjs and node checks/first-task.mjs before Task finish; verify acceptance again in the original directory afterward.

- [x] Add non-mutating openTasks and focused tests. [ref: open-tasks]
34.95% / 36.28% 比 Git linked-worktree 流程少用的 provider tokens

兩場各 200-session GPT-5.6 Sol campaign · 每種流程每場皆 100/100 通過驗收 · 查看範圍與證據

為什麼不直接用 worktree 就好?

worktree 隔離的是檔案。AIT 從需求一路管到日後的回歸。

並行執行早就很普遍了。真正缺的那一層,是一份持久的定義:每個 agent 被要求做什麼、哪個結果通過了、以及它如何併入更新的工作。

只有 worktree

隔離有用,但協調沒做完

  • 建立一份獨立的 checkout。
  • 任務身分、檢查、rebase 與清理,全都留給周邊工具。
  • 事後追查通常止於一個 commit。

AIT Task

一個受管的結果,帶完整生命週期

  • 綁定需求、隔離的 worktree、檢查,以及被接受的版本。
  • 重新檢查目標、乾淨 rebase 可相容的工作,或在真正衝突時停下。
  • ait blame 把出問題的那一行,連回它的版本與當初記錄的意圖。

一個需求,一個受控結果

Agent 執行工作流;成果與紀錄留在你手上。

  1. 01提需求

    用自然語言說清楚結果與限制。

  2. 02隔離

    Task 取得一個專用的可寫 worktree。

  3. 03驗證

    檢查結果綁在真正通過的精確版本。

  4. 04安全完成

    乾淨修改由 AIT 更新;發生衝突就明確停止。

  5. 05日後追查

    責任版本與當初記錄的意圖始終相連。

從一個儲存庫開始

安裝 1.1.1、執行 ait init,然後照常對你的 agent 下需求。

預設工作流全程留在本地,不啟動任何伺服器。

多個 Task 並行時,如何保持清楚?

每張任務卡都有自己的意圖、工作區與檢查。相容的修改可以完成,實質衝突則停止並保留工作;日後透過版本紀錄追查問題。

三條 Task 路徑串起任務定義、隔離 worktree、測試審查與整合。兩條路徑更新 main;一條在衝突時停止。Binary DB 保存紀錄,供 ait blame 追溯責任版本。
流程示意:完成的兩個 Task 清理工作區;發生衝突的 Task 保留工作以供修正。乾淨 rebase 本身不證明語意正確。

開啟完整工作流說明圖 →