浏览 1.0.0 文档
1.0.0 文档修订 2

附录:.ait/config.json

当前 1.0.0 持久化 Repository 配置的完整约定,包含归属、默认值、生命周期写入方、worktree 覆盖项与恢复边界。

适用人群: 开发者、运维与 Repository 所有者

约定与权威#

.ait/config.json 是 1.0.0 里权威的、持久化的 Repository 配置。它保存 仓库身份与路由、工作流默认值、远程注册信息、Task worktree 放置位置,以及 一小组由 AIT 托管的运行时提示。这一页把当前支持的每个字段和嵌套字段都 列全。

有三个 JSON 面是相关的,但彼此不能互换:

权威与行为
.ait/config.json持久化的仓库级权威。AIT 从规范的 Repository 根目录读这个文件。
.ait-worktree.json某个已物化 worktree 里由 AIT 托管的叠加层。非 null 的叠加值只在那个 worktree 的生效运行时里替换对应的根值。
ait config show --json经过默认值、推导、actor 检测、远程解析和 worktree 叠加之后的生效诊断投影。它不是这两个文件中任何一个的逐字节呈现。

JSON 读取器在改写某个设置时,可能会把不认识的 key 原样保留下来。保留并 不等于支持。别把任意 key 当成扩展点。

安全的修改边界#

只要 1.0.0 提供了拥有某个值的那条命令,就用那条命令:

Code · bash
ait config show --json
ait config set --workflow-mode solo_remote
ait config set --id-namespace-prefix W
ait config unset task-worktree-main-seed-ram-max-bytes
ait remote add origin https://server.example.invalid --default
ait doctor memory-root --json

ait config set 接受十项用户持有的设置,ait config unset 接受八项可选 覆盖项。仓库索引、Line 选择器、远程记录、推导出来的作用域、Plan 绑定的 内部细节、worktree 叠加层和等待提示,都不能通过 ait config set 写。让 拥有它们的那条 AIT 生命周期去写。

如果确实要维护某个只能改文件的高级值,就先停掉并发的 AIT 变更,留一份 可信副本,原子地写入合法 JSON,验证结果之后再继续干活。绝对不要照抄别的 Repository 的 repository_index、远程映射或 worktree 叠加层。

有代表性的根文件#

这份中性样例只是展示常见形状;它不是恢复用的模板。server 分配的索引、 远程元数据、各种路径和身份,都必须来自这个 Repository 自己的生命周期。

Code · json
{
  "repo_name": "sample-project",
  "default_line": "main",
  "current_line": "main",
  "default_remote": "origin",
  "repository_index": 42,
  "remotes": {
    "origin": {
      "remote_id": 1,
      "url": "https://server.example.invalid",
      "repo_name": "sample-project",
      "created_at": "2026-08-17T08:00:00Z"
    }
  },
  "id_namespace_prefix": "W",
  "policy_profile": "prototype",
  "default_author_mode": "ai_with_human_review",
  "workflow_mode": "solo_remote",
  "workflow_default_scope": "remote",
  "task_default_scope": "remote",
  "change_default_scope": "remote",
  "sprint": "on",
  "plan_task_binding": { "mode": "required" },
  "task_worktree": {
    "alias_root": ".ait-worktree-links",
    "main_seed_ram_max_bytes": 8589934592
  }
}

全新初始化#

ait init 会创建 repo_namedefault_linecurrent_line、一个为 null 的 default_remote、一个空的 id_namespace_prefixpolicy_profiledefault_author_modesprintplan_task_binding。在受支持的宿主上, 它还能记录检测到的 task_worktree.memory_root。可选的默认模型之后用 ait config set --default-model <model> 设置。

默认 Line 是 main。没有明确给出 Repository 名时,用规范根目录的目录名。 全新的策略档位是 prototypeteamrelease 之一;它必须和 .ait/policy.yaml 一致。

仓库身份与 Line 选择#

字段JSON 约定归属、缺省与修改方式
repo_name非空字符串。ait init 写入。老仓库里如果缺这个字段,运行时回落到规范根目录的目录名。它不是远程身份。
default_line非空的 Line 名字符串。ait init 写入;缺省时回落到 main。改动由仓库初始化流程负责。
current_line非空的 Line 名字符串。由 AIT 的 Line 操作维护,表示规范根上选中的 Line。缺省时回落到 default_line
default_remote远程名字符串或 nullait remote add ... --default 写入。非 null 的值必须对应 remotes 里的某一项;缺省表示没有默认远程。
repository_index无符号 32 位整数。由 server 分配,ait remote add 负责持久化。一旦存在,1.0.0 就拒绝用新返回的索引替换它。没有公开的 setter。
id_namespace_prefix只含 ASCII 字母或数字的字符串;按大写存储。空值也合法。ait initait config set --id-namespace-prefixait config unset id-namespace-prefix。当前 server 命名空间最多两个字符;用空值,或者用客户端和 server 都接受的值。

策略、溯源与本地评审人默认值#

字段JSON 约定归属、缺省与修改方式
policy_profileprototypeteamreleaseait init 选定;它必须等于 .ait/policy.yaml 里的策略 ID。别只改一边。
default_author_modehuman_onlyhuman_with_ai_assistai_with_human_reviewai_only_experimentalait initait config setait config unset。缺省时解析为 ai_with_human_review
default_model存在时为非空字符串。ait config set --default-modelait config unset default-model 会删掉它。缺省时报告为 null。
user_name存在时为非空字符串。ait config setunset。这是必需评审或自动功能性 Task 评审所用的唯一配置身份。
user_email存在时为非空字符串。ait config setunset。用于非 Task 评审的 actor 身份展示面。
task_review布尔值:true 表示必需;false 表示自动。ait config set --task-review requiredait config set --task-review automatic 会把这个词转成上面的布尔值。缺省时解析为自动。

生效的 actor 也可能来自 AIT_NATIVE_ACTOR。所以 ait config show --json 显示出来的生效值,可能和存下来的身份字段不一样。

工作流预设的联动#

设整套预设,别单独去改它下面那些从属字段:

workflow_mode存储的作用域值
solo_localworkflow_default_scopetask_default_scopechange_default_scope 都是 local
solo_remoteworkflow_default_scopetask_default_scopechange_default_scope 都是 remote
team_remoteworkflow_default_scopetask_default_scopechange_default_scope 都是 remote

ait config set --workflow-mode <value> 会写 workflow_mode 和那三个作用域 字段。除非同一条命令里带了 --sprint off,否则它还会写 sprint: "on"plan_task_binding.mode: "required"

字段JSON 约定归属、缺省与修改方式
workflow_modesolo_localsolo_remoteteam_remoteait config set --workflow-mode。缺省或不自洽时,生效投影由各作用域和 Plan 绑定推导得出,可能报成 custom
workflow_default_scopelocalremote由工作流预设写入。缺省时解析为 local
task_default_scopelocalremote由工作流预设写入。缺省时继承 workflow_default_scope
change_default_scopelocalremote由工作流预设写入。缺省时继承 workflow_default_scope
sprintonoffait initait config set --sprint。只要它存在,它就是 Plan 绑定的生效权威。
plan_task_binding.modeoffadvisorystrictrequired当前的公开写入方在 sprint 开启时写 required,关闭时写 off。如果 sprint 缺省,就由这个对象提供生效模式;两者都缺省时,1.0.0 会预置 required

改这些默认值,不会搬动或改写已有的 Task、Change、Plan 绑定或 worktree。 已经开始的工作,按它开始时记录下来的那份约定走完。

远程映射#

remotes 是一个以本地远程名为 key 的对象。它的公开写入方是 ait remote add

字段JSON 约定归属与行为
remoteskey 为非空远程名的对象。缺省表示没有注册过远程。每个 value 都必须是对象。
remotes.<name>.remote_id有符号整数。AIT 分配下一个本地序号。老条目没有这个字段时,按它在映射中确定性的序号读取,但当前写入都会带上它。
remotes.<name>.url非空字符串。传给 ait remote add 的必填 server 基础 URL。
remotes.<name>.repo_name非空字符串,或缺省。AIT 记录用于 server 注册的规范 Repository 目录名。
remotes.<name>.created_atRFC 3339 时间戳字符串。AIT 记录注册时间。老记录可能没有。

远程 URL 可能暴露内网拓扑。它是路由数据,不是凭据。认证 token 属于进程的 机密边界,不该放在这个文件里。

task_worktree 对象与 AIT_RAM#

字段JSON 约定归属、缺省与修改方式
task_worktree对象或 nullait init 可以补上检测到的 memory root 数据。缺省时仍然允许宿主探测和回落到持久磁盘。
task_worktree.memory_root.kindmacos_ram_volumelinux_memory_rootwindows_ramdisk必须和宿主一致,也要和 ait doctor memory-root --json 期望的证明一致。
task_worktree.memory_root.root非空路径字符串。内存支撑的根目录。由运维维护;用绝对路径,诊断和恢复时才不会有歧义。
task_worktree.memory_root.volume_name非空字符串,或缺省。仅 macOS 用的卷标。其他 kind 会忽略它。macOS 上缺省时,AIT 可以从挂载点的 basename 推导。
task_worktree.memory_root.sector_count正整数,或缺省。macOS RAM 盘容量,以 512 字节扇区计。缺省时用 16,777,216 个扇区,正好 8 GiB。其他 kind 会忽略它。
task_worktree.ephemeral_root非空路径字符串,或缺省。只能改文件的 Task 运行时根目录。相对路径从规范的 Repository 根解析。缺省时,只要有可用的有效 memory root,就据此推导运行时位置。
task_worktree.alias_root非空路径字符串,或缺省。ait config set --task-worktree-alias-root;相对路径从 Repository 根解析。缺省时用 .ait-worktree-links
task_worktree.main_seed_ram_max_bytes非负整数,或缺省。ait config setait config unset task-worktree-main-seed-ram-max-bytes。缺省表示没有配置 Snapshot 大小的截断线;它不代表物理内存无上限。

内存放置是在创建新的 Task worktree 时评估的。严格大于所配置 main seed 上限 的 Snapshot,会走 Repository 内部的持久存储。除此之外,AIT 能用就用经过 校验的受支持 RAM 根,用不了就回落到 Repository 内部的持久存储。完整的 隔离、容量和恢复行为见 并行 Task 隔离

由 AIT 托管的运行字段#

字段JSON 约定归属、缺省与行为
worktree_name非空字符串,或缺省。AIT 会临时把规范根绑定到某个活动的受管 worktree,并在清理时解除绑定。别手改它。
workflow_ready_poll_seconds数字。AIT 从最近的远程历史里学出一个取整后的就绪等待估计值。为正的生效值会被夹到 5 到 900 秒之间;0 表示尝试过引导但没有可用样本。缺省表示没有缓存的估计值。
workflow_land_poll_seconds数字。同样是 AIT 持有的估计值,用于远程 Land 完成。它有同样的 5 到 900 秒生效边界和 0 引导标记。

这些等待值只是给用户反馈用的提示,不是就绪、策略或超时方面的权威。删掉 或改掉它们,并不会让某个操作完成。

已有文件里的兼容字段#

这些字段可以留在升级过来的仓库里。这里写出来是为了让备份或审计看得懂; 别把它们加进全新的 1.0.0 文件。

字段JSON 约定当前 1.0.0 里的含义
repo_id早期的不透明字符串。保留的兼容数据。当前 server 的路由身份是 repository_index;不得用 repo_id 来选定远程权威。
snapshot_binary_db_storage已有的标量值。当前运行时一律使用 Binary DB layout 1,忽略这个选择器的取值。不写它,存储行为完全一样。
plan_binary_db_storage已有的标量值。对 Plan 权威同样是固定的 layout 1 行为。
remote_sync_binary_db_storage已有的标量值。对远程同步权威同样是固定的 layout 1 行为。
plan_task_binding_mode早期的标量模式。只被一条有界的兼容路径使用。当前配置读写的是 plan_task_binding.mode;别把这个标量加进新文件。

完整的 worktree 叠加层#

AIT 会在受管 worktree 里创建 .ait-worktree.json,并把其中每个非 null 的 值叠加到根配置之上,只对那个 worktree 生效。Task worktree 会用到下面这些 字段:

字段JSON 约定含义
worktree_name非空字符串。稳定的、AIT 持有的物化名称和清理身份。
current_line非空的 Line 名字符串。在这个 worktree 里选中的 Task 功能 Line。
repo_root绝对路径字符串。规范的 Repository 根,它的 .ait 权威通过受管链接共享出来。
workspace_root绝对路径字符串。物理 worktree 根。它可以和面向用户的别名路径不同。
created_atRFC 3339 时间戳字符串。物化时间。
materialized_snapshot_idSnapshot ID 字符串,或缺省。当前恢复进这个 worktree 的 Snapshot;AIT 会在 restore 和 rebase 操作之后更新它。

这个叠加层是归属元数据,不是可搬运的用户画像。别复制它、别编辑它,也别 把受管的 .ait 链接换成另一个权威。

验证、备份与恢复#

做完一次受支持的改动之后,把生效投影和相关子系统都验一遍:

Code · bash
ait config show --json
ait remote list --json
ait status --json
ait doctor memory-root --json

备份整个 .ait 权威,不要只备份 config.json。这个文件里有 server 分配 的仓库索引和远程路由,把本地权威重新接回已有的异地副本要靠它们。分享 诊断信息之前,先把 server URL、本地路径、姓名和邮箱地址脱敏掉。这个文件 里不应该出现密码、bearer token 或集成用的机密。

万一本地权威丢了,别指望对着一个同名的已有 server Repository 跑 ait remote add 就能重新挂上。作为已保存本地权威的一部分,先恢复可信的 repository_indexdefault_remoteremotes 路由数据,用 ait config show --jsonait repo show --remote origin --json 验证, 然后先预览 ait remote recover-head --remote origin,再考虑加 --apply。如果确切的已保存路由恢复不了,就停下来,别去造一个替代权威。

相关#

Version authority

Checked against the exact 1.0.0 source

This page is public documentation, not a second product contract. Use the exact source and distribution contract for release authority.

Owning component Snapshots
  • ait-coreSNP-B06A48DA0245
  • ait-serverSNP-E90456E6425E
  • ait-runnerSNP-6B0A1BB3AFAD
  • ait-pythonSNP-973E3BFAF3DE
  • ait-nodeSNP-F962CC66AA62