aider-delegate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Aider Delegate

Aider 任务委托

You are the orchestrator. Hand a bounded coding task to a separate implementer - Aider - then review what it produced and land it yourself. You write the brief and own the judgment; Aider does the typing in its own run; you verify and commit.
The loop needs only a shell command and file access, so any comparable orchestrator can drive it.
你是协调者。将一个明确的编码任务交给独立的实现者——Aider,然后审核其产出并自行落地。你编写任务简报并负责判断;Aider在独立运行中完成代码编写;你负责验证并提交。
该流程仅需要shell命令和文件访问权限,因此任何类似的协调工具都可以驱动它。

The one thing to know about Aider

关于Aider必须了解的一点

Aider commits by default. Two of its defaults would destroy the reviewable diff this skill exists to produce:
  • --auto-commits
    (default
    True
    ) - Aider commits its own edits after each exchange.
  • --dirty-commits
    (default
    True
    ) - Aider commits your pre-existing uncommitted work before it starts editing.
The relay always passes
--no-auto-commits
and
--no-dirty-commits
, and neither is configurable through it. If you ever drive
aider
by hand instead of through the relay, pass both yourself, or the work lands as commits you never reviewed. The relay also passes
--no-gitignore
, because Aider otherwise writes
.aider*
into
.gitignore
on startup and dirties the tree you are about to read.
Aider默认会提交代码。它的两个默认设置会破坏本技能旨在生成的可审核diff:
  • --auto-commits
    (默认值
    True
    )——Aider在每次交互后自动提交自己的编辑内容。
  • --dirty-commits
    (默认值
    True
    )——Aider在开始编辑前,会提交已有的未提交工作。
中继工具始终会传递
--no-auto-commits
--no-dirty-commits
,且这两个参数无法通过中继工具配置。如果你手动运行
aider
而非通过中继工具,请自行传递这两个参数,否则工作会以你从未审核过的提交形式落地。中继工具还会传递
--no-gitignore
,因为否则Aider会在启动时将
.aider*
写入
.gitignore
,弄脏你即将读取的工作树。

When NOT to use this

请勿使用本技能的场景

  • The task is small enough to do inline; delegation overhead is not worth it.
  • The
    aider
    CLI is not installed, or no model is configured for it.
  • You want the implementer to manage its own commits. Aider can, but this skill deliberately turns that off - the diff is the deliverable.
  • 任务小到可以直接完成;委托的开销不值得。
  • 未安装
    aider
    CLI,或未为其配置模型。
  • 你希望实现者自行管理提交。Aider可以做到,但本技能特意关闭了该功能——diff是交付成果。

Prerequisites (check once)

前置条件(检查一次)

  1. Install Aider -
    python -m pip install aider-chat
    , or the standalone installer from the Aider install docs.
  2. Configure a model. Aider reads provider keys from the environment (
    OPENAI_API_KEY
    ,
    ANTHROPIC_API_KEY
    , …) or its own config; see Aider's model docs.
  3. Confirm
    aider --version
    succeeds.
  4. Work in, or point
    --cd
    at, the target git repository.
  1. 安装Aider——执行
    python -m pip install aider-chat
    ,或从Aider 安装文档获取独立安装程序。
  2. 配置模型。Aider从环境变量(
    OPENAI_API_KEY
    ANTHROPIC_API_KEY
    ……)或自身配置文件读取服务商密钥;详见Aider 模型文档
  3. 确认
    aider --version
    执行成功。
  4. 在目标git仓库中工作,或通过
    --cd
    指定目标git仓库路径。

Choose the model

选择模型

Aider uses its own configured model when
--model
is omitted. Pass
--model <name>
to pick another.
当省略
--model
参数时,Aider使用自身配置的模型。传递
--model <name>
参数可选择其他模型。

Local and self-hosted models

本地与自托管模型

Aider talks to any OpenAI-compatible endpoint, so this is also the skill for delegating to a model running on the user's own hardware - llama.cpp's server, Ollama, vLLM, LM Studio, or anything else that serves the same API. Pair
--model
with
--api-base
:
bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo \
  --model openai/<served-model-name> --api-base http://127.0.0.1:<port>/v1
Three things differ from a hosted provider:
  • The
    openai/
    prefix is required.
    It tells Aider to speak the OpenAI protocol to your endpoint; the part after it is whatever name your server reports, not a provider catalog name.
  • A placeholder key is still needed. Export any non-empty
    OPENAI_API_KEY
    . The client library requires the header even when the server ignores its value.
  • Ask for a smaller edit format. Local models often fail Aider's default
    diff
    format, which requires exact search/replace blocks.
    --edit-format whole
    trades tokens for reliability; keep the brief's scope tight with
    --file
    so whole-file rewrites stay cheap.
A local endpoint that is not running looks like a hang, not an error: Aider retries the connection until the relay's
--timeout
watchdog fires and reports
status: "timeout"
. Confirm the server is up before dispatching a long brief.
Aider可与任何OpenAI兼容的端点通信,因此本技能也适用于委托给用户本地硬件运行的模型——llama.cpp的服务器、Ollama、vLLM、LM Studio,或任何提供相同API的服务。将
--model
--api-base
配合使用:
bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo \
  --model openai/<served-model-name> --api-base http://127.0.0.1:<port>/v1
与托管服务商相比,有三点不同:
  • 必须添加
    openai/
    前缀
    。它告知Aider向你的端点使用OpenAI协议;前缀后的部分是你的服务器报告的名称,而非服务商目录中的名称。
  • 仍需要占位符密钥。导出任意非空的
    OPENAI_API_KEY
    。即使服务器忽略该值,客户端库仍要求此请求头。
  • 请求更小的编辑格式。本地模型通常无法处理Aider默认的
    diff
    格式,该格式需要精确的搜索/替换块。
    --edit-format whole
    以消耗更多token为代价提升可靠性;通过
    --file
    参数严格限制简报范围,使全文件重写的成本可控。
未运行的本地端点会导致任务挂起而非报错:Aider会重试连接,直到中继工具的
--timeout
监控触发并返回
status: "timeout"
。在发送长简报前,请确认服务器已启动。

Staying offline

保持离线状态

No account or provider registration is involved: Aider is a pip install, the endpoint is yours, and
OPENAI_API_KEY
only has to be non-empty. The relay pins the flags that would otherwise reach the network on their own -
--no-check-update
,
--no-analytics
(Aider's own default is
random
, which opts some sessions in by itself), and
--no-detect-urls
, without which Aider offers to scrape any URL in the brief and
--yes-always
accepts that offer silently.
--no-suggest-shell-commands
closes the remaining path by which a run could reach the network without being asked to. What stays outside the relay's control is the brief itself: instructions that tell Aider to install a package or call an API will still be carried out, and
--auto-lint
runs the repository's own tooling. Offline here means nothing in the dispatch path reaches out on its own - not that a sandbox is stopping it.
无需账户或服务商注册:Aider是一个pip包,端点由你自己掌控,且
OPENAI_API_KEY
只需非空即可。中继工具会固定那些可能主动联网的标志——
--no-check-update
--no-analytics
(Aider自身默认值为
random
,会随机将部分会话纳入统计),以及
--no-detect-urls
,否则Aider会主动抓取简报中的任何URL,而
--yes-always
会静默接受该请求。
--no-suggest-shell-commands
关闭了剩余可能主动联网的路径。但中继工具无法控制简报本身:如果指令要求Aider安装包或调用API,仍会执行;
--auto-lint
会运行仓库自身的工具。此处的“离线”指调度路径中没有组件会主动联网——而非通过沙箱阻止联网。

The loop

流程

Run these five steps per task. Steps 1, 4, and 5 require judgment; 2 and 3 are mechanical.
每个任务执行以下五个步骤。步骤1、4、5需要判断;步骤2和3是机械操作。

1. Write the brief

1. 编写简报

Aider sees only the text you send plus the files in its editing scope - no chat history or shared context. Include the goal, current state, what to change, what to leave untouched, the project's actual gates, and a report contract. Keep one task per brief. See references/writing-the-brief.md.
Aider只能看到你发送的文本及其编辑范围内的文件——没有聊天历史或共享上下文。请包含目标、当前状态、需要修改的内容、需要保留的内容、项目的实际验收标准,以及报告约定。每个简报对应一个任务。详见references/writing-the-brief.md

2. Dispatch

2. 调度

Use the bundled helper. It wraps Aider's headless
--message-file
mode, captures the run, and writes
result.json
. (
<skill-dir>
is the installed folder containing this
SKILL.md
.)
bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo
使用内置的辅助工具。它封装了Aider的无头模式
--message-file
,捕获运行过程并写入
result.json
。(
<skill-dir>
是包含本
SKILL.md
的安装目录。)
bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo

choose a model: add --model <name>

选择模型: 添加 --model <name>

point at an OpenAI-compatible server: add --api-base <url>

指定OpenAI兼容服务器: 添加 --api-base <url>

scope the edit surface: add --file <path> (repeatable), --read <path> for context only

限制编辑范围: 添加 --file <path>(可重复),--read <path>仅用于获取上下文

dry run, no files modified: add --read-only

试运行,不修改文件: 添加 --read-only

continue the previous chat: add --resume-last (delta brief only)

继续之前的对话: 添加 --resume-last (仅传递增量简报)

hard time limit (watchdog): add --timeout 2h (the 30m default suits short runs; implementation briefs routinely need 1-2h)

硬时间限制(监控): 添加 --timeout 2h (默认30分钟适合短任务;实现类简报通常需要1-2小时)

see all options: node .../relay.mjs --help

查看所有选项: node .../relay.mjs --help


The child process's cwd pins the workspace. The brief is delivered with `--message-file`, so it never
rides argv: it stays out of the host process list and clear of the OS argument size cap. The relay
writes artifacts under the system temp dir by default and never commits. See
[references/dispatch-and-poll.md](references/dispatch-and-poll.md).

子进程的当前工作目录固定为工作区。简报通过`--message-file`传递,因此不会出现在命令行参数中:它不会进入主机进程列表,也不会受限于OS的参数大小限制。中继工具默认将产物写入系统临时目录,且不会提交代码。详见[references/dispatch-and-poll.md](references/dispatch-and-poll.md)。

3. Wait for completion

3. 等待完成

The helper blocks until Aider finishes. Run it with the orchestrator's background-command facility, or background it in the shell and poll for
result.json
. A pre-run usage error exits 2 and writes no result; a missing
aider
exits 127 and writes
status: "aider_unavailable"
.
Trust process state and the working tree over a progress display. Completion means the process exited and
result.json
exists. Aider's report is the
finalMessage
field in
result.json
(also printed in full on stdout between the report markers).
Aider exits 0 even when it never reached a model, so the relay scans the run for Aider's own endpoint and authentication errors and reports
status: "failed"
when it finds one. Treat a
failed
status with an
error
mentioning the endpoint as a configuration problem, not a coding failure.
辅助工具会阻塞直到Aider完成。使用协调者的后台命令功能运行它,或在shell中将其置于后台并轮询
result.json
。预运行的使用错误会以状态码2退出且不写入结果;找不到
aider
会以状态码127退出并写入
status: "aider_unavailable"
信任进程状态和工作树而非进度显示。完成意味着进程已退出且
result.json
存在。Aider的报告位于
result.json
finalMessage
字段(也会完整打印在stdout的报告标记之间)。
即使未连接到模型,Aider也会以状态码0退出,因此中继工具会扫描运行日志,查找Aider自身的端点和认证错误,并在发现时报告
status: "failed"
。如果
failed
状态的
error
字段提及端点,请将其视为配置问题而非编码失败。

4. Review - do not trust the self-report

4. 审核——不要相信自我报告

Treat Aider's final message and gate claims as claims:
  • Re-run the project's gates yourself.
  • Read the diff against the brief, starting with
    touchedFiles
    .
  • Run relevant guard skills if installed.
  • Round-trip migrations and grep for dangling references after removals or renames.
Aider's
--auto-lint
is on by default, so it may have already run a linter and fixed its own complaints. That is Aider's lint, not your gates - run yours anyway. See references/review-and-land.md.
将Aider的最终消息和验收标准声明视为待验证的主张:
  • 自行运行项目的验收标准。
  • 根据简报审核diff,从
    touchedFiles
    开始。
  • 如果已安装相关守卫技能,请运行它们。
  • 在删除或重命名后,往返迁移并 grep 查找悬空引用。
Aider默认开启
--auto-lint
,因此它可能已运行过代码检查工具并修复了自身的问题。但这是Aider的检查,而非你的验收标准——请务必运行你自己的检查。详见references/review-and-land.md

5. Land it

5. 落地

The implementer edits the working tree; the orchestrator commits. Commit only after the gates pass and the diff holds. If rework is needed, send a delta brief with
--resume-last
, then review again.
实现者编辑工作树;协调者提交代码。仅当验收标准通过且diff符合要求时再提交。如果需要返工,请使用
--resume-last
发送增量简报,然后再次审核。

Autonomy and permissions

自主性与权限

The relay passes
--yes-always
, Aider's own term for auto-confirming every prompt, because a headless run cannot answer one. Understand what that consents to in advance. Auto-confirmation applies to every prompt Aider would otherwise raise, and Aider's prompts are not limited to file edits: left at its defaults it also offers to run shell commands it has suggested, and
--yes-always
would accept those with nobody reading them. The relay therefore pins
--no-suggest-shell-commands
, which removes that path.
What remains is not a sandbox, and nothing here pretends otherwise. Aider has no permission modes and no isolation: within its file scope it edits freely, and
--auto-lint
(on by default) runs whatever linter the repository configures. A brief that tells Aider to run a command still gets a command run. Delegation is the authorization; if a run must not be able to touch the host, run it in a container or a throwaway worktree, because no flag in this relay will give you that.
File selection is not a security boundary.
--file
,
--read
, and
--subtree-only
set what Aider puts in its chat context, which is a scoping and token-cost decision. They do not confine what it can reach. See references/writing-the-brief.md.
--read-only
maps to Aider's
--dry-run
, which performs the run without modifying files. The relay does not independently verify that claim - it reports what
git status --porcelain
shows and warns if a
--read-only
run left the tree changed.
touchedFiles
and the diff, not a flag, are the guarantee.
中继工具会传递
--yes-always
,这是Aider对所有提示自动确认的术语,因为无头运行无法响应提示。请提前了解这会自动同意哪些操作。自动确认适用于Aider所有可能弹出的提示,且Aider的提示不限于文件编辑:默认情况下,它还会提议运行自己建议的shell命令,而
--yes-always
会无人审核就接受这些命令。因此中继工具固定了
--no-suggest-shell-commands
,关闭了这条路径。
剩余的并非沙箱,本技能也不会假装是。Aider没有权限模式或隔离机制:在其文件范围内可自由编辑,且默认开启的
--auto-lint
会运行仓库配置的任何代码检查工具。如果简报要求Aider运行命令,该命令仍会被执行。委托即授权;如果运行不能接触主机,请在容器或临时工作树中执行,因为本中继工具的任何标志都无法提供这种隔离。
文件选择不是安全边界
--file
--read
--subtree-only
用于设置Aider的聊天上下文范围,这是一个范围界定和token成本的决策。它们无法限制Aider可访问的范围。详见references/writing-the-brief.md
--read-only
对应Aider的
--dry-run
,即执行运行但不修改文件。中继工具不会独立验证这一主张——它会报告
git status --porcelain
的结果,并在
--read-only
运行后工作树发生变化时发出警告。保证来自
touchedFiles
和diff,而非标志。

Resume

恢复会话

Aider has no session ids. Its resume unit is the chat history file it keeps in the repository (
.aider.chat.history.md
), so
--resume-last
maps to Aider's
--restore-chat-history
and
--history-file
pins a specific one. Because that history lives in the repo, resume is per-worktree, not per-user: two clones of the same project do not share it.
Aider没有会话ID。它的恢复单元是保存在仓库中的聊天历史文件(
.aider.chat.history.md
),因此
--resume-last
对应Aider的
--restore-chat-history
--history-file
用于指定特定的历史文件。由于该历史文件存储在仓库中,恢复是基于工作树而非用户的:同一项目的两个克隆不会共享该历史。

Authorization model

授权模型

Delegation is something the human opts into. Once they have ("run this queue", "proceed"), committing verified, gate-passing work is the agreed contract. Two limits remain: surface, don't absorb (report Aider's design decisions, defensible-but-unasked turns, and non-blocking nitpicks) and stop for scope changes (if correct completion needs going beyond the brief, ask instead of expanding the mandate). See references/review-and-land.md.
委托是人类主动选择的操作。一旦用户选择(“运行此队列”、“继续”),提交经过验证、符合验收标准的工作就是约定的契约。仍有两个限制:展示而非吸收(报告Aider的设计决策、合理但未被要求的变更,以及非阻塞性的小问题)和范围变更时停止(如果正确完成任务需要超出简报范围,请先询问用户而非扩大任务范围)。详见references/review-and-land.md

References

参考资料

  • references/writing-the-brief.md - structure, report contract, real gates, file scope, and delta briefs.
  • references/dispatch-and-poll.md - flags, artifacts,
    result.json
    , polling, and failure recovery.
  • references/review-and-land.md - review checklist, the commit boundary, and rework through Aider's chat history.
  • references/multi-task-queues.md - sequential queues, constraint carry-forward, progress tracking, and the final coherence pass.
  • references/writing-the-brief.md - 结构、报告约定、实际验收标准、文件范围和增量简报。
  • references/dispatch-and-poll.md - 标志、产物、
    result.json
    、轮询和故障恢复。
  • references/review-and-land.md - 审核清单、提交边界和通过Aider聊天历史进行返工。
  • references/multi-task-queues.md - 顺序队列、约束传递、进度跟踪和最终一致性检查。