LEAP
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format + human-in-loop REPL). Use when editing code in an existing git repo via an LLM, when you need to converge a change to 2-5 files, pick an edit format that fits
$ npx -y skills add agentsope/SkillAlchemy --skill agentsop-aider --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/agentsop-aiderContext preview
The summary Claude sees to decide when to auto-load this skill.
SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format + human-in-loop REPL). Use when editing code in an existing git repo via an LLM, when you need to converge a change to 2-5 files, pick an edit format that fits
name: agentsop-aider version: 1.0.0 description: >- SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format + human-in-loop REPL). Use when editing code in an existing git repo via an LLM, when you need to converge a change to 2-5 files, pick an edit format that fits the model, run architect+editor mode, or wire an auto-test loop. domain: terminal-based AI pair programming, git-native code editing source: aider.chat docs + Paul Gauthier's blog + leaderboards audience: coder-agents and human engineers who edit code via LLMs
> 一句话:Aider 是“**git 工作树 + tree-sitter 仓库地图 + 编辑格式 + 人类在环 REPL**”的四元组。理解这四个原语,剩下的都是配置。
下列任一情形成立时,按本 SOP 进入 Aider 工作模式:
**不应激活的反面信号**:见 §6 反模式与边界。
+------------------+ +------------------+ +------------------+ +------------------+ | 1. Git working | | 2. Tree-sitter | | 3. Edit format | | 4. REPL loop | | tree | | repo-map | | (wire proto) | | (你在环里) | | | | | | | | | | - per-edit | | - symbol-level | | - diff / udiff | | - /ask /code | | commit | | summary | | / whole / | | /architect | | - /undo | | - PageRank over | | patch | | - 每轮人手确认 | | - dirty 文件 | | import graph | | - 模型适配选择 | | - 不自主 | | 先 commit 再编 | | - 动态预算 | | - JSON 是反模式 | | | +------------------+ +------------------+ +------------------+ +------------------+
四者缺一不可:
| 层 | 内容 | 谁能改 | |---|---|---| | 系统提示 + 编辑格式说明 | Aider 固化 | Aider | | 只读上下文 | repo-map + `/read` 文件 + CONVENTIONS.md | 你(通过 `--read`) | | 读写上下文 | `/add` 的文件 | LLM **只能编辑**这里的文件 |
> **铁律**:LLM 只允许编辑 `/add`-ed 的文件。这是 Aider 的安全边界。模型“改错了文件”几乎总是因为该文件没 `/add` 或你 `/add` 了太多无关文件。
> "Above about 25k tokens of context, most models start to become distracted." [aider.chat/docs/troubleshooting/edit-errors.html]
把这条当硬约束:超过 25k tokens,编辑准确率断崖式下降。`/tokens` 持续监控。
repo-map 是 **tree-sitter 提取的符号清单**(类、函数、签名),用 PageRank 在源文件依赖图上排序,**塞给 LLM 当地图**。这不是 embedding 检索。
为什么不用 embeddings:
预算是**动态**的:你不 `/add` 任何文件时,map 占用大;`/add` 了正确文件后,map 自动缩小,省下的 token 给真正的代码。
| 格式 | 谁用 | 强项 | 弱项 | |---|---|---|---| | `whole` | 弱模型 / GPT-3.5 / 应急回退 | 解析最稳,无 merge 错误 | 贵;4k 输出上限会截断 | | `diff` (SEARCH/REPLACE) | GPT-4o, Sonnet, 多数强模型 | token 高效 | SEARCH 块必须字节匹配 | | `diff-fenced` | Gemini 系列 | 路径放在 fence 内 | 非主流 | | `udiff` | GPT-4 Turbo (1106) | 模仿 patch 程序的严格性,降低 laziness | 提示更重 | | `patch` | GPT-4.1 (OpenAI patch 协议) | 多动作鲁棒 | 模型特定 | | `editor-diff` / `editor-whole` | architect 模式的 editor 子模型 | 提示更瘦,专注编辑 | 仅在 architect 下有意义 |
Aider 已经对常见模型选好默认值;**只有出现编辑错误时才覆盖**。
> ⇒ **不要**把代码编辑包进 JSON tool-call。所有模型在 Aider 的实测里都因此变差,包括 Sonnet(详见 §5 案例 6 与引文)。
# 0. 在 git 仓库根目录。stash 或 commit 在途修改。 git status # 1. 选模型(榜单当前前列:gpt-5, claude-3.7-sonnet, o3-pro, gemini-2.5-pro) # [aider.chat/docs/leaderboards/] # 2. 最小启动 — 让 repo-map 帮 LLM 自己找路 aider # 3. 范围已知 — 直接预加 + 风格文件 aider src/auth.py tests/test_auth.py --read CONVENTIONS.md # 4. 强思考 + 廉价编辑(architect 模式) aider --architect --model o1-preview --editor-model gpt-4o # 5. 自动测试回路 aider --test-cmd "pytest -x" --auto-test # 6. 巨型 monorepo cd packages/feature-foo && aider --subtree-only # 并维护 .aiderignore
不知道改哪个文件? → /ask which files implement <feature>? (LLM 用 repo-map 回答) → /add 它命名的文件(只加这些) 知道改哪个文件? → 启动时 CLI 直接传,或 /add path/to/file.py 需要参考但不允许改的文件(schema, config, conventions)? → /read path/to/ref.md
铁律重申:**少 `/add`,敢 `/drop`**。`/tokens` 看现状。
> /ask 当前的 auth 怎么实现?如果改成 JWT 会有什么破坏? < [模型基于 repo-map + 已 /add 的文件作答] > /ask 那我们用 PyJWT 还是 authlib?给出权衡。 < [...] > /code 按刚才讨论的方案,把 sessions 改成 JWT。 < [模型给出 diff] [Aider 自动应用 → 自动 git commit] > /test pytest < [失败时模型看到输出并尝试修复]
> "Break your goal down into bite sized steps. Do them one at a time." [aider.chat/docs/usage/tips.html]
何时开启:**你最好的 reasoner 编辑能力差**(典型:o1-preview 单独跑 79.7%,搭配 Sonnet 当 editor 拉到 82.7% [aider.chat/2024/09/26/architect.html])。
| 组合 | Polyglot Pass@2 | 备注 | |---|---|---| | o1-preview (architect) + o1-mini (editor, whole) | 85% | SOTA 当时;慢,不适合交互 | | o1-preview + Sonnet | 82.7% | "entirely practical" | | Sonnet + Sonnet | 80.5% | 比单跑 77.4% 高 | | GPT-4o + GPT-4o | 75.2% | 比单跑 71.4% 高 |
启用:`--architect` 或 `/architect`。Aider 自动把 editor 切到 `editor-diff` / `editor-whole`。
/lint # 默认 --auto-lint 已开 /test pytest -x # 失败时输出回填到 chat /run npm run typecheck # 输出可选择性回填 /diff # 看上一轮的 diff
> "Aider will try and fix any errors if the command returns a non-zero exit code." [aider.chat/docs/usage/lint-test.html]
formatter 注意:把会重写文件并返回非零的 formatter 包装在双跑脚本里(第一遍 format,第二遍验证)。
| 症状 | 操作 | |---|---| | `/token
Turn people, methods, and experience into installable, reusable agent skills. SkillAlchemy is an open-world agent skill creation system that turns underspecified skill briefs and open-world sources into installable, reusable agent skills.
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
Lens — Add a cognitive lens to any problem. It accepts a task description and produces an enhanced description that surfaces hidden dimensions, prerequisites,…
Cross-framework enhancement overlay for choosing a multi-agent topology BEFORE writing any agent. A binary-question rubric — is single-agent + tools enough? do…
Screens biomedical / life-science papers for signs of data fabrication, image manipulation, and statistical anomalies, using the detection techniques distilled…
Universal discipline for any LM-driven loop — agent retries, plan-act-observe, multi-agent handoffs, optimiser passes, test-fix cycles. Encodes the one rule…
Decision rubric for when an LM agent should write-and-run code (Program-of-Thought / code interpreter) versus reason in natural language: classify each step as…