给 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 并行时,如何保持清楚?

每张任务卡都有自己的意图、工作区与检查。兼容的修改可以完成,实质冲突则停止并保留工作;日后通过版本记录追查问题。

打开完整工作流说明图(繁体中文)→