From 1d18655c493a7c9ce10a23752fe408c1e9aaf551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AI=E4=B8=8D=E6=AD=A2=E8=AF=AD?= <12096460+jnMetaCode@users.noreply.github.com> Date: Tue, 29 Sep 2026 07:29:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?docs:=20=E5=88=B7=E6=96=B0=20Aider/Kiro/Tra?= =?UTF-8?q?e/OpenClaw=20=E8=BF=87=E6=97=B6=E4=BF=A1=E6=81=AF=EF=BC=882026-?= =?UTF-8?q?09=20=E6=A0=B8=E5=AE=9E=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 模型 ID:替换已下线的 claude-sonnet-4-20250514 / deepseek-chat / qwen2.5-coder,改用 provider/model 写法 - Aider:修正 dirty-commits 行为描述、删除不存在的 --max-reflections / --commit-prefix / /lint-cmd none, 修正 repo map 与 editor-model 说明,更新安装方式、star 数,补充维护状态与 use_temperature 配置,注明 Gemini CLI 个人用户停服 - Kiro:steering 改为 inclusion 四种模式,hooks 改为 .kiro/hooks/*.json 新格式,更新 GA、登录方式、Spec 工作流、价格与 2026 新增能力 - Trae:移除免费 Claude 说法,更新 TraeCode/TRAE Work 改名、国际版价格、Agent/MCP/Rules 说明,区分 trae.cn 国内版 - OpenClaw:配置键改为 agents.defaults.model.primary,更新 models set / automations / channels / --dev 用法、 Node 版本、Skills 加载优先级、ClawHub 域名、基金会托管与 star 数 --- aider/README.en.md | 54 +++++++++++++----- aider/README.md | 54 +++++++++++++----- aider/templates/aider.conf.yml | 12 ++-- kiro/README.en.md | 82 ++++++++++++++++++++-------- kiro/README.md | 82 ++++++++++++++++++++-------- kiro/templates/steering-always.md | 2 +- openclaw/README.en.md | 91 +++++++++++++++++-------------- openclaw/README.md | 91 +++++++++++++++++-------------- pitfalls/aider.en.md | 36 ++++++------ pitfalls/aider.md | 36 ++++++------ trae/README.en.md | 62 ++++++++++++++------- trae/README.md | 62 ++++++++++++++------- trae/templates/project_rules.md | 4 ++ 13 files changed, 428 insertions(+), 240 deletions(-) diff --git a/aider/README.en.md b/aider/README.en.md index 486c3d3..699bf13 100644 --- a/aider/README.en.md +++ b/aider/README.en.md @@ -3,6 +3,8 @@ # Aider Best Practices > Aider is an open-source CLI AI coding tool. Its defining feature is being **Git-native** — every change is auto-committed, with built-in version control support. It works with virtually all major LLMs (Claude, GPT, DeepSeek, Qwen, local models), making it the most flexible AI coding CLI out there. +> +> ⚠️ **Maintenance status (verified 2026-09)**: the latest PyPI release is still 0.86.2 (published 2026-02-12), and the last GitHub commit was around 2026-05 — development has clearly slowed. There is **no native MCP support**. Built-in model metadata lags behind new model releases, so newer models need a bit of manual config (see "New model config" below). --- @@ -12,7 +14,7 @@ |---------|-------------|----------| | **Chat Modes** | `code` / `ask` / `architect` | Different modes for different tasks | | **Auto Git Commits** | Every change auto-committed | Roll back anytime | -| **Map Mode** | Auto-indexes project structure | Understand large codebases | +| **Repo Map** | Extracts key symbols and their definition lines (signatures), graph-ranked by references | Understand large codebases | | **Multi-Model Support** | Claude/GPT/DeepSeek/Ollama etc. | Flexible selection, cost control | | **Lint & Test** | Built-in code checking and testing | Auto-verify after changes | @@ -23,7 +25,9 @@ ### Installation ```bash -pip install aider-chat +python -m pip install aider-install && aider-install +# Or: uv tool install --force --python python3.12 --with pip aider-chat@latest +# Or: pipx install aider-chat # Set an API key (pick one) export ANTHROPIC_API_KEY=sk-xxx # Claude @@ -37,16 +41,18 @@ export DEEPSEEK_API_KEY=sk-xxx # DeepSeek cd /your/project aider -# Specify a model -aider --model claude-sonnet-4-5 +# Specify a model (pass the latest Claude model ID explicitly) +aider --model anthropic/claude-sonnet-5-5 # Use DeepSeek (cheaper) -aider --model deepseek/deepseek-chat +aider --model deepseek/deepseek-v4-pro # Use a local model (free) -aider --model ollama/qwen2.5-coder +aider --model ollama/qwen3-coder ``` +> The built-in aliases are outdated: `--model sonnet` → `claude-sonnet-4-6`, `--model opus` → `claude-opus-4-7`, and `--model deepseek` still points to `deepseek/deepseek-chat`, which was retired on 2026-07-24. Always spell out the full model ID. + ### Three Chat Modes ```bash @@ -108,23 +114,25 @@ git log --oneline # View Aider's commit history git diff HEAD~1 # See the last change git revert HEAD # Not happy? One-command rollback -# Set a custom commit prefix -aider --commit-prefix "[ai] " +# Mark AI commits: a Co-authored-by trailer is added by default; tune it with the --attribute-* flags +aider --attribute-commit-message-author # Prefix commit messages for AI changes with "aider: " +# Customize the commit message style +aider --commit-prompt "Write commit messages in Conventional Commits format" ``` ### 4. Multi-Model Strategy ```bash # Complex architecture design — use the strongest model -aider --model claude-sonnet-4-5 +aider --model anthropic/claude-opus-5-5 /architect Design a microservices split plan # Daily coding — use a cost-effective model -aider --model deepseek/deepseek-chat +aider --model deepseek/deepseek-v4-pro /code Implement user-service according to the plan # Code review — use a free local model -aider --model ollama/qwen2.5-coder +aider --model ollama/qwen3-coder /ask Any issues with this code? ``` @@ -136,7 +144,7 @@ aider --model ollama/qwen2.5-coder ```yaml # .aider.conf.yml -model: claude-sonnet-4-5 +model: anthropic/claude-sonnet-5-5 auto-commits: true auto-lint: true auto-test: true @@ -144,6 +152,20 @@ test-cmd: pytest lint-cmd: ruff check ``` +### New Model Config — `.aider.model.settings.yml` + +Aider sends a `temperature` parameter by default, but newer Claude models (Sonnet 5.5, Opus 5.5, etc.) reject non-default temperature values with a 400 error. Add this to your project root or home directory: + +```yaml +# .aider.model.settings.yml +- name: anthropic/claude-sonnet-5-5 + edit_format: diff + use_repo_map: true + use_temperature: false +``` + +For models missing from Aider's built-in metadata, you'll get an "unknown context window" warning on startup. It's usually safe to ignore, or you can fill it in via `.aider.model.metadata.json`. + ### Lint + Test Automation ```yaml @@ -183,16 +205,18 @@ git push -u origin feature/add-notifications | Cost control | 3/3 (free models available) | 1/3 | 3/3 | | Best for | Flexibility, saving money, Git power users | Complex Agent tasks | Large codebase analysis | +> Gemini CLI stopped serving individual/free users (including Google AI Pro/Ultra subscribers) on 2026-06-18. Enterprise licenses and paid API keys still work; the official migration path for individuals is Antigravity CLI. The "Cost control" row no longer applies to individual users. + --- ## Common Pitfalls | Pitfall | Description | Solution | |---------|-------------|----------| -| Auto-commit swallows WIP | Auto-commit sweeps your unstaged changes into the commit | `git stash` before session, or use a dedicated branch | +| Auto-commit commits your edits too | If a file Aider is about to edit has your uncommitted changes, it first commits them separately (`--dirty-commits` is on by default) | Commit/`git stash` yourself before the session, use `--no-dirty-commits`, or work on a dedicated branch | | `/add` misses deps | Incomplete context, AI guesses from filenames | Have it `/ask` list dependencies first, then `/add` all of them | | Model-switch quality drop | Cheaper model → cliff drop in output quality | Switch by task type; return to Claude for complex work | -| Lint loop burns tokens | `auto-lint` retries failing checks via LLM | `--max-reflections 3`, use `--fix` linters | +| Lint loop burns tokens | `auto-lint` retries failing checks via LLM | Use `--fix` linters; if it still loops, turn it off with `--no-auto-lint` | 👉 **Deep dive**: [Aider Pitfalls](../pitfalls/aider.en.md) — 7 real-world traps, each with Symptom / Cause / Recovery / Prevention @@ -209,5 +233,5 @@ git push -u origin feature/add-notifications ## Further Reading - [Aider Official Docs](https://aider.chat/docs/) -- [Aider GitHub](https://github.com/Aider-AI/aider) (42k+ stars) +- [Aider GitHub](https://github.com/Aider-AI/aider) (49k+ stars) - [superpowers-zh](https://github.com/jnMetaCode/superpowers-zh) — Skills methodology (also supports Aider) diff --git a/aider/README.md b/aider/README.md index 41b66c9..bdab362 100644 --- a/aider/README.md +++ b/aider/README.md @@ -1,6 +1,8 @@ # Aider 最佳实践 > Aider 是一个开源的 CLI AI 编程工具,核心特色是 **Git 原生** — 每次修改自动提交,天然支持版本控制。支持几乎所有主流 LLM(Claude、GPT、DeepSeek、Qwen、本地模型),是最灵活的 AI 编程 CLI。 +> +> ⚠️ **维护状态(2026-09 核实)**:PyPI 最新版仍是 0.86.2(2026-02-12 发布),GitHub 最后一次提交在 2026-05 左右,更新明显放缓;目前**没有原生 MCP 支持**。内置模型元数据跟不上新模型发布,用新模型时要自己补配置(见下文「新模型配置」)。 --- @@ -10,7 +12,7 @@ |------|------|------| | **Chat 模式** | `code` / `ask` / `architect` | 不同任务用不同模式 | | **自动 Git 提交** | 每次修改自动 commit | 随时可以回滚 | -| **Map 模式** | 自动索引项目结构 | 理解大代码库 | +| **Repo Map** | 提取关键符号和定义行(签名),按引用关系图排序 | 理解大代码库 | | **多模型支持** | Claude/GPT/DeepSeek/Ollama 等 | 灵活选择,控制成本 | | **Lint & Test** | 内置代码检查和测试 | 修改后自动验证 | @@ -21,7 +23,9 @@ ### 安装 ```bash -pip install aider-chat +python -m pip install aider-install && aider-install +# 也可以:uv tool install --force --python python3.12 --with pip aider-chat@latest +# 或:pipx install aider-chat # 设置 API Key(选一个) export ANTHROPIC_API_KEY=sk-xxx # Claude @@ -35,16 +39,18 @@ export DEEPSEEK_API_KEY=sk-xxx # DeepSeek cd /your/project aider -# 指定模型 -aider --model claude-sonnet-4-5 +# 指定模型(用 --model 写明最新 Claude 模型 ID) +aider --model anthropic/claude-sonnet-5-5 # 用 DeepSeek(便宜) -aider --model deepseek/deepseek-chat +aider --model deepseek/deepseek-v4-pro # 用本地模型(免费) -aider --model ollama/qwen2.5-coder +aider --model ollama/qwen3-coder ``` +> 注意内置别名已经过时:`--model sonnet` → `claude-sonnet-4-6`,`--model opus` → `claude-opus-4-7`,`--model deepseek` 仍指向已于 2026-07-24 下线的 `deepseek/deepseek-chat`。建议始终写完整模型 ID。 + ### 三种 Chat 模式 ```bash @@ -106,23 +112,25 @@ git log --oneline # 看 Aider 的提交记录 git diff HEAD~1 # 看最后一次修改 git revert HEAD # 不满意?一键回滚 -# 设置自定义提交前缀 -aider --commit-prefix "[ai] " +# 区分 AI 提交:默认已加 Co-authored-by trailer,可用 --attribute-* 系列开关调整 +aider --attribute-commit-message-author # AI 改动的 commit message 加 "aider: " 前缀 +# 自定义 commit message 风格 +aider --commit-prompt "用中文写 Conventional Commits 格式的提交信息" ``` ### 4. 多模型策略 ```bash # 复杂架构设计 — 用最强模型 -aider --model claude-sonnet-4-5 +aider --model anthropic/claude-opus-5-5 /architect 设计微服务拆分方案 # 日常编码 — 用性价比模型 -aider --model deepseek/deepseek-chat +aider --model deepseek/deepseek-v4-pro /code 按方案实现 user-service # 代码审查 — 用免费本地模型 -aider --model ollama/qwen2.5-coder +aider --model ollama/qwen3-coder /ask 看看这段代码有没有问题 ``` @@ -134,7 +142,7 @@ aider --model ollama/qwen2.5-coder ```yaml # .aider.conf.yml -model: claude-sonnet-4-5 +model: anthropic/claude-sonnet-5-5 auto-commits: true auto-lint: true auto-test: true @@ -142,6 +150,20 @@ test-cmd: pytest lint-cmd: ruff check ``` +### 新模型配置 — `.aider.model.settings.yml` + +Aider 默认会发 `temperature` 参数,而新一代 Claude(Sonnet 5.5、Opus 5.5 等)会拒绝非默认的 temperature,直接 400 报错。在项目根目录或 home 目录加: + +```yaml +# .aider.model.settings.yml +- name: anthropic/claude-sonnet-5-5 + edit_format: diff + use_repo_map: true + use_temperature: false +``` + +Aider 内置元数据里没有的模型,启动时会提示未知上下文窗口,一般可以忽略,也可以在 `.aider.model.metadata.json` 里补上。 + ### Lint + Test 自动化 ```yaml @@ -181,16 +203,18 @@ git push -u origin feature/add-notifications | 成本控制 | ★★★(可用免费模型) | ★☆☆ | ★★★ | | 适合 | 灵活、省钱、Git 重度用户 | 复杂 Agent 任务 | 大代码库分析 | +> Gemini CLI 已于 2026-06-18 停止为个人/免费用户(含 Google AI Pro/Ultra 订阅)提供服务,企业授权和付费 API Key 仍可用;个人用户官方迁移路径是 Antigravity CLI。表中「成本控制」一栏对个人用户已不适用。 + --- ## 常见陷阱 | 陷阱 | 说明 | 解决 | |------|------|------| -| auto-commit 吃变更 | 自动提交把你未 stage 的工作一起吞了 | 会话前 `git stash`,或开独立分支 | +| auto-commit 顺手提交你的改动 | Aider 要改的文件里如果有你没提交的改动,它会先把这些改动单独 commit 一次(`--dirty-commits` 默认开) | 会话前自己先 commit/`git stash`,或 `--no-dirty-commits`,或开独立分支 | | /add 漏依赖 | 上下文不全,AI 靠文件名脑补 | 让它先 /ask 列出所有依赖再 /add | | 模型切换质量塌 | 切到便宜模型后产出质量断崖下跌 | 分任务类型切,复杂任务回 Claude | -| lint 循环烧 token | auto-lint 失败反复让 LLM 修 | `--max-reflections 3`,lint 用 `--fix` 模式 | +| lint 循环烧 token | auto-lint 失败反复让 LLM 修 | lint 用 `--fix` 模式;修不好就 `--no-auto-lint` 先关掉 | 👉 **深度展开版**:[Aider 陷阱合集](../pitfalls/aider.md) — 7 个真实踩坑场景,每个带症状 / 根因 / 出坑 / 预防 @@ -207,5 +231,5 @@ git push -u origin feature/add-notifications ## 延伸阅读 - [Aider 官方文档](https://aider.chat/docs/) -- [Aider GitHub](https://github.com/Aider-AI/aider)(42k+ star) +- [Aider GitHub](https://github.com/Aider-AI/aider)(49k+ star) - [superpowers-zh](https://github.com/jnMetaCode/superpowers-zh) — Skills 方法论(也支持 Aider) diff --git a/aider/templates/aider.conf.yml b/aider/templates/aider.conf.yml index 6cec068..eea565c 100644 --- a/aider/templates/aider.conf.yml +++ b/aider/templates/aider.conf.yml @@ -2,15 +2,17 @@ # 复制到项目根目录,命名为 .aider.conf.yml # 模型配置 -model: claude-sonnet-4-5 +model: anthropic/claude-sonnet-5-5 # 新 Claude 模型需在 .aider.model.settings.yml 设 use_temperature: false # 其他选择: -# model: deepseek/deepseek-chat # 便宜,适合日常编码 -# model: ollama/qwen2.5-coder # 免费,需要本地跑 Ollama +# model: deepseek/deepseek-v4-pro # 便宜,适合日常编码(别用 deepseek 别名,它仍指向已下线的 deepseek-chat) +# model: ollama/qwen3-coder # 免费,需要本地跑 Ollama # model: gpt-4o # OpenAI # Git 配置 -auto-commits: true # 每次修改自动 commit -commit-prefix: "[ai] " # commit 前缀,方便区分人工和 AI 修改 +auto-commits: true # 每次修改自动 commit(只提交 Aider 改过的文件) +dirty-commits: true # 要改的文件里有你未提交的改动时,先单独 commit 一次 +attribute-commit-message-author: true # AI 改动的 commit message 加 "aider: " 前缀,方便区分人工和 AI 修改 +# commit-prompt: "用中文写 Conventional Commits 格式的提交信息" # 自定义 commit message 生成提示 # 代码质量 auto-lint: true # 修改后自动跑 linter diff --git a/kiro/README.en.md b/kiro/README.en.md index d79774f..eb2b608 100644 --- a/kiro/README.en.md +++ b/kiro/README.en.md @@ -2,7 +2,7 @@ # Kiro Best Practices -> Kiro is an AI IDE from AWS. Its defining feature is **Spec-driven Development** — instead of having AI write code directly, it first generates requirement specs, design docs, and test cases. You review and approve the spec, then Kiro implements accordingly. Well suited for team collaboration and projects that demand high-quality deliverables. +> Kiro is an AI IDE from AWS. Its defining feature is **Spec-driven Development** — instead of having AI write code directly, it first generates requirement specs, design docs, and an implementation task list. You review and approve the spec, then Kiro implements accordingly. Well suited for team collaboration and projects that demand high-quality deliverables. Generally available since 2025-11-17, it now spans IDE, CLI, Web, Mobile, and Crew. --- @@ -12,8 +12,28 @@ |---------|-------------|----------| | **Spec** | Requirement specification document | AI writes the spec first, implements after approval | | **Steering** | `.kiro/steering/*.md` | Project-level rules and guidelines | -| **Hooks** | Automated triggers | Auto-validate/test on file save | +| **Hooks** | Event triggers in `.kiro/hooks/*.json` | Auto-validate/test after the agent edits files | | **Agent** | Background autonomous execution | Completes complex tasks automatically | +| **MCP** | Supported in IDE / CLI / Web | Connect external tools and data sources | + +### New in 2026 + +- **Kiro CLI / Web / Mobile**: the same agent harness in your terminal, browser, and phone +- **Kiro Crew** (2026-08-04): an open-source (Apache 2.0) background-agent workspace that runs on Kiro CLI and reuses your existing `.kiro` config — good for async migrations, ticket triage, PR follow-ups +- **Powers**: on-demand capability packs with built-in domain knowledge that extend the agent +- **AGENTS.md**: supported; place it in the workspace root or `~/.kiro/steering/`, always included + +### Pricing + +| Plan | Price | Monthly credits | +|------|-------|-----------------| +| Free | $0 | 50 | +| Pro | $20/mo | 1,000 | +| Pro+ | $40/mo | 2,000 | +| Pro Max | $100/mo | 5,000 | +| Power | $200/mo | 10,000 | + +Paid plans bill overage at $0.04/credit; unused credits don't roll over. See [kiro.dev/pricing](https://kiro.dev/pricing/) for the latest. --- @@ -21,7 +41,7 @@ ### Installation -Download from [kiro.dev](https://kiro.dev). Requires an AWS or GitHub account to log in. Currently in preview. +Download from [kiro.dev](https://kiro.dev). Sign in with GitHub, Google, AWS Builder ID, or an organization identity (IAM Identity Center / external IdP). ### Steering Files — Project Configuration @@ -29,7 +49,7 @@ Create rule files under `.kiro/steering/`: ```markdown --- -mode: always +inclusion: always --- # Project Rules @@ -51,10 +71,13 @@ Java 17 + Spring Boot 3 + MyBatis Plus + MySQL 8 - Constants: UPPER_SNAKE_CASE ``` -Steering supports three modes: -- `always` — Loaded for every conversation -- `globs: ["*.java"]` — Loaded only when working with matching files -- `manual` — Manually activated +Steering uses the `inclusion` frontmatter field to control loading — four modes: +- `inclusion: always` — Loaded for every conversation (default) +- `inclusion: fileMatch` + `fileMatchPattern: "**/*.java"` — Loaded only when working with matching files (an array also works) +- `inclusion: manual` — Referenced on demand with `#file-name` (or via `/`) in chat +- `inclusion: auto` + `name` / `description` — The agent decides whether to load it based on the description + +Global steering lives in `~/.kiro/steering/` and applies to every workspace. ### Spec-Driven Development @@ -62,12 +85,13 @@ Kiro's workflow differs from other tools: ``` 1. You describe the requirement -2. Kiro generates a Spec (requirements + technical design + test cases) +2. Kiro generates a Spec: requirements.md (bugfix.md for a Bugfix Spec) + design.md + tasks.md 3. You review and revise the Spec -4. Once confirmed, Kiro implements step by step according to the Spec -5. After each step, related tests run automatically +4. Once confirmed, Kiro works through tasks.md task by task, with live progress ``` +Specs come in several workflows: **Requirements-First** (requirements, then design), **Design-First** (settle the technical approach first), **Quick Spec** (requirements/design/tasks in one pass with no approval gates), and **Bugfix Spec** for systematically diagnosing and fixing bugs. + This is slower than "just write the code," but produces higher quality output. Especially good for: - Team collaboration (Specs can be reviewed) - Complex features (think it through before building) @@ -93,26 +117,40 @@ Generate the Spec first. I'll confirm before you implement. ### 2. Leverage Hooks for Auto-Validation +Each hook file is a standalone JSON file under `.kiro/hooks/` (kebab-case name, e.g. `java-verify.json`): + ```json -// .kiro/hooks.json { - "on-save": { - "*.java": "mvn compile -q", - "*.test.java": "mvn test -pl ${module} -q" - } + "version": "v1", + "hooks": [ + { + "name": "Compile on save", + "trigger": "PostFileSave", + "matcher": "\\.java$", + "action": { "type": "command", "command": "mvn compile -q" } + }, + { + "name": "Test on test save", + "trigger": "PostFileSave", + "matcher": "Test\\.java$", + "action": { "type": "command", "command": "mvn test -q" } + } + ] } ``` -Auto-compiles on every Java file save, auto-runs tests on test file save. +Auto-compiles whenever the agent saves a Java file, auto-runs tests when it saves a test file. Note: file triggers only respond to **changes made by the agent** — saving manually in the editor doesn't fire them. Besides `command`, `action.type` can be `agent` (inject a prompt to steer the agent). + +Available triggers: Prompt Submit, Agent Stop, Session Start (IDE), Agent Spawn (CLI), Pre/Post Tool Use, File Create / Save / Delete, and Pre/Post Task Execution (around spec tasks). In JSON they're PascalCase, with file triggers prefixed by `Post` (e.g. `PostFileSave`) — see the [Hooks docs](https://kiro.dev/docs/hooks/) for exact names. ### 3. Organize Steering by Module ``` .kiro/steering/ -├── always.md # Global rules (always) -├── api.md # API rules (globs: src/controller/**) -├── database.md # Database rules (globs: src/mapper/**) -└── testing.md # Testing rules (globs: src/test/**) +├── always.md # Global rules (inclusion: always) +├── api.md # API rules (fileMatch: src/controller/**) +├── database.md # Database rules (fileMatch: src/mapper/**) +└── testing.md # Testing rules (fileMatch: src/test/**) ``` --- @@ -123,7 +161,7 @@ Auto-compiles on every Java file save, auto-runs tests on test file save. |-----------|------|-------------|--------| | Core philosophy | Spec first | Agent execution | IDE completion | | Best for | Team collaboration, high-quality delivery | Individual high-velocity development | Daily coding | -| Rules system | Steering (three modes) | CLAUDE.md + Skills | Rules (globs) | +| Rules system | Steering (four modes) + AGENTS.md | CLAUDE.md + Skills | Rules (globs) | | Development flow | Requirements -> Spec -> Implementation -> Verification | Requirements -> Implementation -> Verification | Requirements -> Implementation | | AWS integration | 3/3 | 1/3 | 1/3 | diff --git a/kiro/README.md b/kiro/README.md index b8622c6..371bbec 100644 --- a/kiro/README.md +++ b/kiro/README.md @@ -1,6 +1,6 @@ # Kiro 最佳实践 -> Kiro 是 AWS 推出的 AI IDE,核心特色是 **Spec-driven Development**(规格驱动开发)。不是让 AI 直接写代码,而是先生成需求规格、设计文档,确认后再按规格实现。适合团队协作和需要高质量交付的场景。 +> Kiro 是 AWS 推出的 AI IDE,核心特色是 **Spec-driven Development**(规格驱动开发)。不是让 AI 直接写代码,而是先生成需求规格、设计文档,确认后再按规格实现。适合团队协作和需要高质量交付的场景。2025-11-17 起正式 GA,现已覆盖 IDE、CLI、Web、Mobile 和 Crew 多个入口。 --- @@ -10,8 +10,28 @@ |------|------|------| | **Spec** | 需求规格文档 | AI 先写规格,确认后再写代码 | | **Steering** | `.kiro/steering/*.md` | 项目级规则和指引 | -| **Hooks** | 自动化触发器 | 文件保存时自动验证/测试 | +| **Hooks** | `.kiro/hooks/*.json` 事件触发器 | Agent 改完文件后自动验证/测试 | | **Agent** | 后台自主执行 | 复杂任务自动完成 | +| **MCP** | IDE / CLI / Web 均支持 | 接入外部工具和数据源 | + +### 2026 新增 + +- **Kiro CLI / Web / Mobile**:同一套 agent 能力覆盖终端、浏览器和手机 +- **Kiro Crew**(2026-08-04):开源(Apache 2.0)的后台 agent 工作空间,基于 Kiro CLI 运行,可复用现有 `.kiro` 配置,适合异步跑迁移、工单分诊、PR 跟进等任务 +- **Powers**:自带领域知识、按需激活的能力包,扩展 agent +- **AGENTS.md**:支持该标准,放在工作区根目录或 `~/.kiro/steering/`,始终加载 + +### 价格 + +| 套餐 | 价格 | 每月 credits | +|------|------|-------------| +| Free | $0 | 50 | +| Pro | $20/月 | 1,000 | +| Pro+ | $40/月 | 2,000 | +| Pro Max | $100/月 | 5,000 | +| Power | $200/月 | 10,000 | + +付费套餐超额按 $0.04/credit 计费,未用完的 credits 不结转。以 [kiro.dev/pricing](https://kiro.dev/pricing/) 为准。 --- @@ -19,7 +39,7 @@ ### 安装 -从 [kiro.dev](https://kiro.dev) 下载安装。需要 AWS 账号或 GitHub 账号登录。目前处于预览阶段。 +从 [kiro.dev](https://kiro.dev) 下载安装。可用 GitHub、Google、AWS Builder ID 或组织身份(IAM Identity Center / 外部 IdP)登录。 ### Steering 文件 — 项目配置 @@ -27,7 +47,7 @@ ```markdown --- -mode: always +inclusion: always --- # 项目规则 @@ -49,10 +69,13 @@ Java 17 + Spring Boot 3 + MyBatis Plus + MySQL 8 - 常量 UPPER_SNAKE_CASE ``` -Steering 支持三种模式: -- `always` — 每次对话都加载 -- `globs: ["*.java"]` — 只在操作匹配文件时加载 -- `manual` — 手动激活 +Steering 用 frontmatter 的 `inclusion` 字段控制加载方式,共四种模式: +- `inclusion: always` — 每次对话都加载(默认) +- `inclusion: fileMatch` + `fileMatchPattern: "**/*.java"` — 只在操作匹配文件时加载(也可写成数组) +- `inclusion: manual` — 在对话里用 `#文件名`(或输入 `/` 选择)手动引用 +- `inclusion: auto` + `name` / `description` — 由 agent 根据描述判断是否需要加载 + +全局 steering 放在 `~/.kiro/steering/`,对所有工作区生效。 ### Spec 驱动开发 @@ -60,12 +83,13 @@ Kiro 的工作流和其他工具不同: ``` 1. 你描述需求 -2. Kiro 生成 Spec(需求规格 + 技术设计 + 测试用例) +2. Kiro 生成 Spec:requirements.md(Bugfix Spec 则是 bugfix.md)+ design.md + tasks.md 3. 你审查和修改 Spec -4. 确认后 Kiro 按 Spec 逐步实现 -5. 每步实现后自动运行相关测试 +4. 确认后 Kiro 按 tasks.md 逐个任务实现,实时显示进度 ``` +Spec 有几种工作流:**Requirements-First**(先需求后设计)、**Design-First**(先定技术方案)、**Quick Spec**(一次生成需求/设计/任务,不设审批关卡),以及专门排查修复 bug 的 **Bugfix Spec**。 + 这比"直接写代码"慢,但产出质量更高,特别适合: - 团队协作(Spec 可以 review) - 复杂功能(先想清楚再动手) @@ -91,26 +115,40 @@ Kiro 的工作流和其他工具不同: ### 2. 利用 Hooks 自动验证 +Hook 是 `.kiro/hooks/` 下的独立 JSON 文件(文件名 kebab-case,如 `java-verify.json`): + ```json -// .kiro/hooks.json { - "on-save": { - "*.java": "mvn compile -q", - "*.test.java": "mvn test -pl ${module} -q" - } + "version": "v1", + "hooks": [ + { + "name": "Compile on save", + "trigger": "PostFileSave", + "matcher": "\\.java$", + "action": { "type": "command", "command": "mvn compile -q" } + }, + { + "name": "Test on test save", + "trigger": "PostFileSave", + "matcher": "Test\\.java$", + "action": { "type": "command", "command": "mvn test -q" } + } + ] } ``` -每次保存 Java 文件自动编译,保存测试文件自动跑测试。 +Agent 每次保存 Java 文件自动编译,保存测试文件自动跑测试。注意:文件类触发器只响应 **agent 做的修改**,你在编辑器里手动保存不会触发。`action.type` 除了 `command` 还可以是 `agent`(给 agent 注入一段提示词)。 + +可用触发器:Prompt Submit、Agent Stop、Session Start(IDE)、Agent Spawn(CLI)、Pre/Post Tool Use、File Create / Save / Delete、Pre/Post Task Execution(Spec 任务前后)。JSON 里写 PascalCase,文件类的带 `Post` 前缀(如 `PostFileSave`),完整写法见 [Hooks 文档](https://kiro.dev/docs/hooks/)。 ### 3. Steering 按模块配置 ``` .kiro/steering/ -├── always.md # 全局规则(always) -├── api.md # API 规则(globs: src/controller/**) -├── database.md # 数据库规则(globs: src/mapper/**) -└── testing.md # 测试规则(globs: src/test/**) +├── always.md # 全局规则(inclusion: always) +├── api.md # API 规则(fileMatch: src/controller/**) +├── database.md # 数据库规则(fileMatch: src/mapper/**) +└── testing.md # 测试规则(fileMatch: src/test/**) ``` --- @@ -121,7 +159,7 @@ Kiro 的工作流和其他工具不同: |------|------|-------------|--------| | 核心理念 | Spec 先行 | Agent 执行 | IDE 补全 | | 适合 | 团队协作、高质量交付 | 个人高效开发 | 日常编码 | -| 规则系统 | Steering(三种模式) | CLAUDE.md + Skills | Rules(globs) | +| 规则系统 | Steering(四种模式)+ AGENTS.md | CLAUDE.md + Skills | Rules(globs) | | 开发流程 | 需求→规格→实现→验证 | 需求→实现→验证 | 需求→实现 | | AWS 集成 | ★★★ | ★☆☆ | ★☆☆ | diff --git a/kiro/templates/steering-always.md b/kiro/templates/steering-always.md index a3261d7..66bfeb0 100644 --- a/kiro/templates/steering-always.md +++ b/kiro/templates/steering-always.md @@ -1,5 +1,5 @@ --- -mode: always +inclusion: always --- # 项目规则 diff --git a/openclaw/README.en.md b/openclaw/README.en.md index 706a764..7d77f4c 100644 --- a/openclaw/README.en.md +++ b/openclaw/README.en.md @@ -2,7 +2,9 @@ # OpenClaw Best Practices -> OpenClaw is an open-source AI personal assistant framework (330k+ GitHub Stars). Its defining features are **local execution + multi-platform connectivity + autonomous task execution**. It's not just a chatbot — it can browse the web, read and write files, execute commands, and schedule cron jobs. Supports Claude, GPT, DeepSeek, local models, and more. +> OpenClaw is an open-source AI personal assistant framework (390k+ GitHub Stars). Its defining features are **local execution + multi-platform connectivity + autonomous task execution**. It's not just a chatbot — it can browse the web, read and write files, execute commands, and schedule cron jobs. Supports Claude, GPT, DeepSeek, local models, and more. +> +> The project is now stewarded by the **OpenClaw Foundation** (a US 501(c)(3) non-profit) and remains MIT-licensed; versions are now date-based (e.g. `v2026.9.6`). --- @@ -11,10 +13,10 @@ | Concept | Description | Use Case | |---------|-------------|----------| | **Gateway** | Background-resident WebSocket gateway | Route messages, manage Agents | -| **Channel** | Messaging platform connection | Connect WeChat, Telegram, Slack, Discord, etc. | +| **Channel** | Messaging platform connection (30+) | Connect Telegram, Slack, Discord, Feishu/Lark (official plugin), WeChat (external plugin), etc. | | **Skill** | Capability module defined in `SKILL.md` | Teach AI how to do things (similar to Claude Code Skills) | | **Agent** | Independent AI workspace | Different tasks use different Agents | -| **Cron** | Scheduled task scheduler | Automate recurring work | +| **Automations** | Scheduled task scheduler (alias of the `cron` command) | Automate recurring work | | **Tool** | Built-in tools (browser, filesystem, shell) | Give AI "hands" to execute operations | --- @@ -36,7 +38,7 @@ openclaw --version openclaw doctor ``` -System requirements: Node.js 22.14+ (24 recommended) +System requirements: Node.js 24.16+ or 26.1+ (26 recommended). The installer script detects and installs Node if needed. On Windows, use PowerShell: `iwr -useb https://openclaw.ai/install.ps1 | iex` ### Initialization @@ -57,17 +59,21 @@ Config file is located at `~/.openclaw/openclaw.json` (JSON5 format, comments su ```json5 { - // Model settings - "models": { - "default": "claude-sonnet-4-20250514", - // Or use DeepSeek to save money - // "default": "deepseek/deepseek-chat", + // Model settings (provider/model format) + "agents": { + "defaults": { + "model": { + "primary": "anthropic/claude-sonnet-5-5", + // Or use DeepSeek to save money + // "primary": "deepseek/deepseek-v4-pro", + "fallbacks": ["deepseek/deepseek-v4-pro"], + }, + }, }, - // Channels (enable as needed) + // Channels (enable as needed; WebChat is built into core via the Control UI, no config needed) "channels": { "telegram": { "enabled": true }, - "webchat": { "enabled": true }, }, } ``` @@ -100,19 +106,23 @@ You are a senior code reviewer. When asked to review code: 5. Provide specific fix suggestions with code examples ``` -Skills load from three locations (highest to lowest priority): +Skills load from these locations (highest to lowest priority; for duplicate names the highest source wins): ``` -project-dir/skills/ -> Project-level (highest priority) -~/.openclaw/skills/ -> Global-level -built-in skills/ -> Default (lowest priority) +/skills/ -> Workspace skills (highest priority) +/.agents/skills/ -> Project agent skills +~/.agents/skills/ -> Personal agent skills +/skills/ -> Managed/locally installed skills +/agents//agent/workshop-skills/ -> Workshop skills +bundled skills -> Shipped with the install +skills.load.extraDirs + plugin skills -> Extra directories (lowest priority) ``` Install community Skills: ```bash # Install from ClawHub -openclaw skills install +openclaw skills install @owner/ # List installed Skills openclaw skills list @@ -124,32 +134,32 @@ openclaw skills list # List available models openclaw models list -# Set default model -openclaw models set default claude-sonnet-4-20250514 +# Set default model (writes agents.defaults.model) +openclaw models set anthropic/claude-sonnet-5-5 -# Use Claude for complex tasks -openclaw models set default claude-sonnet-4-20250514 +# Use Claude Opus for complex tasks +openclaw models set anthropic/claude-opus-5-5 # Use DeepSeek for casual chat (cheaper) -openclaw models set default deepseek/deepseek-chat +openclaw models set deepseek/deepseek-v4-pro # Use a local model for free -openclaw models set default ollama/qwen2.5-coder +openclaw models set ollama/qwen3-coder ``` ### 3. Automated Tasks -OpenClaw supports cron scheduling for automation: +OpenClaw supports scheduled tasks (Automations). `openclaw automations` and `openclaw cron` are the same command, and `create` is an alias for `add`: ```bash # Send a codebase health report every day at 9 AM -openclaw cron add "0 9 * * *" "Check project code quality and send me a report" +openclaw automations create "0 9 * * *" "Check project code quality and send me a report" --name "Code health daily" # Send a weekly summary every Monday morning -openclaw cron add "0 9 * * 1" "Summarize last week's Git commits and PRs into a weekly report" +openclaw automations create "0 9 * * 1" "Summarize last week's Git commits and PRs into a weekly report" --name "Weekly report" # List all scheduled tasks -openclaw cron list +openclaw automations list ``` ### 4. Multi-Channel Collaboration @@ -159,7 +169,6 @@ OpenClaw's unique advantage is connecting multiple messaging platforms: ```bash # Add channels openclaw channels add telegram -openclaw channels add webchat # Check channel status openclaw channels status @@ -167,7 +176,7 @@ openclaw channels status Use cases: - **Telegram** — Send messages to AI from anywhere to execute tasks -- **WebChat** — Browser UI for complex interactions +- **WebChat** — Built into core (Control UI), a browser UI for complex interactions; no `channels add` needed - **Slack / Lark** — Team collaboration with AI as a team member --- @@ -195,10 +204,10 @@ openclaw agents delete old-project |---------|---------| | `openclaw onboard` | Interactive setup | | `openclaw gateway start/stop/status` | Manage gateway | -| `openclaw channels add/remove/status` | Manage messaging channels | -| `openclaw models list/set` | Manage models | -| `openclaw skills list/install` | Manage Skills | -| `openclaw cron add/list` | Scheduled tasks | +| `openclaw channels add/remove/status/login/logout/logs` | Manage messaging channels | +| `openclaw models list/set/status` | Manage models | +| `openclaw skills list/install/update` | Manage Skills | +| `openclaw automations create/list` (alias `cron`) | Scheduled tasks | | `openclaw agents list/add/delete` | Manage Agent workspaces | | `openclaw doctor` | Health check and diagnostics | | `openclaw logs` | View gateway logs | @@ -212,8 +221,8 @@ openclaw doctor # View real-time logs openclaw logs -# Development mode (more debug info) -openclaw gateway --dev +# Development mode (--dev is a global flag: isolates state under ~/.openclaw-dev, gateway port 19001) +openclaw --dev gateway ``` --- @@ -225,10 +234,10 @@ openclaw gateway --dev | Type | AI Agent framework | CLI coding assistant | AI IDE | | Core use case | Multi-platform automation | Code writing and refactoring | Daily coding | | Runtime | Background daemon (Gateway) | On-demand | Embedded in IDE | -| Messaging platforms | 20+ platforms | Terminal only | IDE only | +| Messaging platforms | 30+ platforms | Terminal only | IDE only | | Model support | Claude/GPT/DeepSeek/local | Claude only | Multi-model | | Skills | SKILL.md | .claude/skills/ | Rules | -| Scheduled tasks | Built-in Cron | No | No | +| Scheduled tasks | Built-in Automations | No | No | | Open source | Yes (MIT) | No | No | | Best for | Automation, multi-platform, all-in-one assistant | Professional coding | Daily coding | @@ -240,11 +249,11 @@ openclaw gateway --dev | Pitfall | Description | Solution | |---------|-------------|----------| -| Node version too old | Requires 22.14+ | `nvm install 24` | +| Node version too old | Requires 24.16+ or 26.1+ | `nvm install 26` | | Gateway fails to start | Port conflict or config error | Run `openclaw doctor` to diagnose | | Skill not taking effect | Path or format incorrect | Check `SKILL.md` frontmatter for name and description | | Model API errors | API key not set or balance depleted | Run `openclaw models status` to check | -| Channel disconnected | Network or auth issue | `openclaw channels status` + `openclaw channels reconnect` | +| Channel disconnected | Network or auth issue | Diagnose with `openclaw channels status` / `openclaw channels logs`; if needed, re-authenticate with `openclaw channels logout` + `openclaw channels login` | --- @@ -252,13 +261,13 @@ openclaw gateway --dev | Template | Purpose | |----------|---------| -| [code-reviewer.md](templates/code-reviewer.md) | Code review Skill template, copy to `~/.openclaw/skills/` or project `skills/` directory | +| [code-reviewer.md](templates/code-reviewer.md) | Code review Skill template, copy to `/skills/code-reviewer/SKILL.md` or `~/.agents/skills/code-reviewer/SKILL.md` | --- ## Further Reading - [OpenClaw Official Docs](https://docs.openclaw.ai) -- [OpenClaw GitHub](https://github.com/openclaw/openclaw) (338k+ stars) -- [ClawHub — Skill Marketplace](https://clawhub.com) +- [OpenClaw GitHub](https://github.com/openclaw/openclaw) (390k+ stars) +- [ClawHub — Skill Marketplace](https://clawhub.ai) - [superpowers-zh](https://github.com/jnMetaCode/superpowers-zh) — Skills methodology (also supports OpenClaw) diff --git a/openclaw/README.md b/openclaw/README.md index aef3060..d631d6d 100644 --- a/openclaw/README.md +++ b/openclaw/README.md @@ -1,6 +1,8 @@ # OpenClaw 最佳实践 -> OpenClaw 是一个开源的 AI 个人助手框架(33 万+ GitHub Stars),核心特色是 **本地运行 + 多平台连接 + 自主执行任务**。它不只是聊天机器人,而是能浏览网页、读写文件、执行命令、调度定时任务的 AI Agent。支持 Claude、GPT、DeepSeek、本地模型等多种 LLM。 +> OpenClaw 是一个开源的 AI 个人助手框架(39 万+ GitHub Stars),核心特色是 **本地运行 + 多平台连接 + 自主执行任务**。它不只是聊天机器人,而是能浏览网页、读写文件、执行命令、调度定时任务的 AI Agent。支持 Claude、GPT、DeepSeek、本地模型等多种 LLM。 +> +> 项目现由 **OpenClaw Foundation**(美国 501(c)(3) 非营利组织)托管,保持 MIT 许可;版本号改为日期格式(如 `v2026.9.6`)。 --- @@ -9,10 +11,10 @@ | 概念 | 说明 | 用途 | |------|------|------| | **Gateway** | 后台常驻的 WebSocket 网关 | 路由消息、管理 Agent | -| **Channel** | 消息平台连接 | 接入 WeChat、Telegram、Slack、Discord 等 | +| **Channel** | 消息平台连接(30+) | 接入 Telegram、Slack、Discord、飞书(官方插件)、微信(外部插件)等 | | **Skill** | `SKILL.md` 定义的能力模块 | 教 AI 怎么做事(类似 Claude Code 的 Skills) | | **Agent** | 独立的 AI 工作空间 | 不同任务用不同 Agent | -| **Cron** | 定时任务调度 | 自动化周期性工作 | +| **Automations** | 定时任务调度(`cron` 命令的别名) | 自动化周期性工作 | | **Tool** | 内置工具(浏览器、文件、Shell) | 让 AI 有"手"去执行操作 | --- @@ -34,7 +36,7 @@ openclaw --version openclaw doctor ``` -系统要求:Node.js 22.14+(推荐 24) +系统要求:Node.js 24.16+ 或 26.1+(推荐 26)。安装脚本会自动检测并安装 Node。Windows 可用 PowerShell:`iwr -useb https://openclaw.ai/install.ps1 | iex` ### 初始化 @@ -55,17 +57,21 @@ openclaw gateway start ```json5 { - // 模型设置 - "models": { - "default": "claude-sonnet-4-20250514", - // 也可以用 DeepSeek 省钱 - // "default": "deepseek/deepseek-chat", + // 模型设置(provider/model 格式) + "agents": { + "defaults": { + "model": { + "primary": "anthropic/claude-sonnet-5-5", + // 也可以用 DeepSeek 省钱 + // "primary": "deepseek/deepseek-v4-pro", + "fallbacks": ["deepseek/deepseek-v4-pro"], + }, + }, }, - // 频道(按需开启) + // 频道(按需开启;WebChat 内置在核心的 Control UI 里,不用单独配置) "channels": { "telegram": { "enabled": true }, - "webchat": { "enabled": true }, }, } ``` @@ -98,19 +104,23 @@ user-invocable: true 5. 给出具体修改建议,附带代码示例 ``` -Skills 的三个加载位置(优先级从高到低): +Skills 的加载位置(优先级从高到低,同名 Skill 以高优先级为准): ``` -项目目录/skills/ → 项目级(最高优先级) -~/.openclaw/skills/ → 全局级 -内置 skills/ → 默认(最低优先级) +/skills/ → 工作区 Skills(最高优先级) +/.agents/skills/ → 项目级 agent Skills +~/.agents/skills/ → 个人 agent Skills +/skills/ → 托管/本地安装的 Skills +/agents//agent/workshop-skills/ → Workshop Skills +内置 Skills → 随安装包附带 +skills.load.extraDirs + 插件 Skills → 额外目录(最低优先级) ``` 安装社区 Skill: ```bash # 从 ClawHub 安装 -openclaw skills install +openclaw skills install @owner/ # 查看已安装的 Skills openclaw skills list @@ -122,32 +132,32 @@ openclaw skills list # 查看可用模型 openclaw models list -# 设置默认模型 -openclaw models set default claude-sonnet-4-20250514 +# 设置默认模型(写入 agents.defaults.model) +openclaw models set anthropic/claude-sonnet-5-5 -# 复杂任务用 Claude -openclaw models set default claude-sonnet-4-20250514 +# 复杂任务用 Claude Opus +openclaw models set anthropic/claude-opus-5-5 # 日常对话用 DeepSeek(便宜) -openclaw models set default deepseek/deepseek-chat +openclaw models set deepseek/deepseek-v4-pro # 完全免费用本地模型 -openclaw models set default ollama/qwen2.5-coder +openclaw models set ollama/qwen3-coder ``` ### 3. 自动化任务 -OpenClaw 支持 Cron 定时任务,适合自动化: +OpenClaw 支持定时任务(Automations),适合自动化。`openclaw automations` 和 `openclaw cron` 是同一个命令,`create` 是 `add` 的别名: ```bash # 每天早上 9 点发送代码库健康报告 -openclaw cron add "0 9 * * *" "检查项目代码质量,生成报告发送给我" +openclaw automations create "0 9 * * *" "检查项目代码质量,生成报告发送给我" --name "代码健康日报" # 每周一早上发送周报摘要 -openclaw cron add "0 9 * * 1" "汇总上周的 Git 提交和 PR,生成周报" +openclaw automations create "0 9 * * 1" "汇总上周的 Git 提交和 PR,生成周报" --name "周报" # 查看所有定时任务 -openclaw cron list +openclaw automations list ``` ### 4. 多频道协作 @@ -157,7 +167,6 @@ OpenClaw 的独特优势是连接多个消息平台: ```bash # 添加频道 openclaw channels add telegram -openclaw channels add webchat # 查看频道状态 openclaw channels status @@ -165,7 +174,7 @@ openclaw channels status 应用场景: - **Telegram** — 随时随地发消息让 AI 执行任务 -- **WebChat** — 浏览器界面做复杂交互 +- **WebChat** — 核心内置(Control UI),浏览器界面做复杂交互,无需 `channels add` - **Slack/飞书** — 团队协作,AI 作为团队成员 --- @@ -193,10 +202,10 @@ openclaw agents delete old-project |------|------| | `openclaw onboard` | 交互式初始化 | | `openclaw gateway start/stop/status` | 管理网关 | -| `openclaw channels add/remove/status` | 管理消息频道 | -| `openclaw models list/set` | 管理模型 | -| `openclaw skills list/install` | 管理 Skills | -| `openclaw cron add/list` | 定时任务 | +| `openclaw channels add/remove/status/login/logout/logs` | 管理消息频道 | +| `openclaw models list/set/status` | 管理模型 | +| `openclaw skills list/install/update` | 管理 Skills | +| `openclaw automations create/list`(别名 `cron`) | 定时任务 | | `openclaw agents list/add/delete` | 管理 Agent 工作空间 | | `openclaw doctor` | 健康检查和诊断 | | `openclaw logs` | 查看网关日志 | @@ -210,8 +219,8 @@ openclaw doctor # 查看实时日志 openclaw logs -# 开发模式(更多调试信息) -openclaw gateway --dev +# 开发模式(--dev 是全局参数:状态隔离到 ~/.openclaw-dev,网关端口 19001) +openclaw --dev gateway ``` --- @@ -223,10 +232,10 @@ openclaw gateway --dev | 类型 | AI Agent 框架 | CLI 编程助手 | AI IDE | | 核心场景 | 多平台自动化 | 代码编写和重构 | 日常编码 | | 运行方式 | 后台常驻(Gateway) | 按需启动 | IDE 内嵌 | -| 消息平台 | 20+ 平台 | 仅终端 | 仅 IDE | +| 消息平台 | 30+ 平台 | 仅终端 | 仅 IDE | | 模型支持 | Claude/GPT/DeepSeek/本地 | 仅 Claude | 多模型 | | Skills | SKILL.md | .claude/skills/ | Rules | -| 定时任务 | ✅ 内置 Cron | ❌ | ❌ | +| 定时任务 | ✅ 内置 Automations | ❌ | ❌ | | 开源 | ✅(MIT) | ❌ | ❌ | | 适合 | 自动化、多平台、全能助手 | 专业编程 | 日常编码 | @@ -238,11 +247,11 @@ openclaw gateway --dev | 陷阱 | 说明 | 解决 | |------|------|------| -| Node 版本不够 | 需要 22.14+ | `nvm install 24` | +| Node 版本不够 | 需要 24.16+ 或 26.1+ | `nvm install 26` | | Gateway 启动失败 | 端口被占用或配置错误 | `openclaw doctor` 诊断 | | Skill 不生效 | 路径或格式不对 | 检查 `SKILL.md` frontmatter 的 name 和 description | | 模型 API 报错 | Key 未设置或余额不足 | `openclaw models status` 检查 | -| 频道连接断开 | 网络或认证问题 | `openclaw channels status` + `openclaw channels reconnect` | +| 频道连接断开 | 网络或认证问题 | `openclaw channels status` / `openclaw channels logs` 定位,必要时 `openclaw channels logout` + `openclaw channels login` 重新认证 | --- @@ -250,13 +259,13 @@ openclaw gateway --dev | 模板 | 用途 | |------|------| -| [code-reviewer.md](templates/code-reviewer.md) | 代码审查 Skill 模板,复制到 `~/.openclaw/skills/` 或项目 `skills/` 目录 | +| [code-reviewer.md](templates/code-reviewer.md) | 代码审查 Skill 模板,复制到 `/skills/code-reviewer/SKILL.md` 或 `~/.agents/skills/code-reviewer/SKILL.md` | --- ## 延伸阅读 - [OpenClaw 官方文档](https://docs.openclaw.ai) -- [OpenClaw GitHub](https://github.com/openclaw/openclaw)(338k+ stars) -- [ClawHub — Skill 市场](https://clawhub.com) +- [OpenClaw GitHub](https://github.com/openclaw/openclaw)(390k+ stars) +- [ClawHub — Skill 市场](https://clawhub.ai) - [superpowers-zh](https://github.com/jnMetaCode/superpowers-zh) — Skills 方法论(也支持 OpenClaw) diff --git a/pitfalls/aider.en.md b/pitfalls/aider.en.md index bbfd409..3abe027 100644 --- a/pitfalls/aider.en.md +++ b/pitfalls/aider.en.md @@ -8,27 +8,27 @@ --- -## Pitfall 1: Auto-Commit Swallows Your Working Tree Changes +## Pitfall 1: Auto-Commit Also Commits Your Half-Finished Edits **Symptom** -- You have uncommitted changes across several files -- You ask Aider to modify an unrelated file -- After generating code, it auto-commits — and **your unstaged changes get bundled into that commit** +- You're halfway through editing `user.py`, not committed yet +- You ask Aider to modify `user.py` too +- `git log` now shows **two** new commits: one with your half-done edits (with an AI-generated message), and one with Aider's change **Cause** -Aider defaults to `auto-commits: true`. Its commit scope is the entire working tree diff — it doesn't distinguish "yours" from "mine." It assumes "change = commit." +Aider defaults to `auto-commits: true` and only commits **the files it edited** — it won't touch other files. But `--dirty-commits` is also on by default: if a file it's about to edit already has your uncommitted changes, it **commits those changes separately first**, then commits its own edit. The goal is to keep your work apart from the AI's so either can be rolled back — the cost is that your half-finished work lands in history as a real commit. **Recovery** ```bash -git reset HEAD~1 # Undo last commit, files back to working tree -git status # Separate yours from Aider's -# Manually commit what should be committed, discard the rest +git log --oneline -3 # Find the "your changes" commit and Aider's commit +git reset --soft HEAD~2 # Undo both commits, changes stay staged +git status # Separate yours from Aider's, re-commit as you like ``` **Prevention** Pick one: -1. **`git stash` before the session**: hide your WIP so Aider's commit stays clean -2. **Disable auto-commit**: `aider --no-auto-commits`, or `auto-commits: false` in `.aider.conf.yml` +1. **Commit or `git stash` yourself before the session**: a clean tree keeps Aider's commits clean +2. **Turn the behavior off**: `aider --no-dirty-commits` (stop committing pre-existing changes), or `--no-auto-commits` / `auto-commits: false` in `.aider.conf.yml` 3. **Dedicated branch**: `git checkout -b feature/xxx` before launching Aider --- @@ -41,7 +41,7 @@ Pick one: - Runtime: `TypeError` **Cause** -Aider only reads files that are explicitly `/add`-ed. Map mode indexes structure (names + positions) but **not contents**. Dependencies not added → AI guesses from names. +Aider only reads files **in full** when they are explicitly `/add`-ed. The repo map extracts each file's key symbols and definition lines (function/class signatures), graph-ranked by references, but it's capped by the `map-tokens` budget, so only the most relevant slice fits — and it **never includes function bodies**. A dependency that isn't added and doesn't make it into the map → AI guesses from names. **Recovery** ``` @@ -85,9 +85,9 @@ LLMs vary wildly in instruction-following. Same `/architect design a WebSocket n Tier in `.aider.conf.yml`: ```yaml -model: claude-sonnet-4-5 # Primary -weak-model: deepseek/deepseek-chat # Weak tasks (commit messages, simple completion) -editor-model: claude-haiku-4-5 # Editor-mode completion +model: anthropic/claude-sonnet-5-5 # Primary +weak-model: deepseek/deepseek-v4-pro # Weak tasks (commit messages, chat history summaries) +editor-model: anthropic/claude-haiku-4-5 # In architect mode, turns the plan into concrete file edits ``` Or switch **by task type**: @@ -109,17 +109,17 @@ Or switch **by task type**: - A single session burns 5× expected tokens **Cause** -Aider's auto-lint/test retries "if it fails, let the LLM try again." If the problem isn't code-fixable (environment, dependencies), it'll retry until it hits the retry cap. Each retry costs tokens. +Aider's auto-lint/test retries "if it fails, let the LLM try again." If the problem isn't code-fixable (environment, dependencies), it'll retry until it hits the built-in reflection cap (a fixed value with no command-line flag). Each retry costs tokens. **Recovery** ``` /undo # Roll back this round -/lint-cmd none # Temporarily disable auto-lint +# Exit and relaunch with aider --no-auto-lint (or auto-lint: false in .aider.conf.yml) # Fix the real problem (environment/config), then re-enable ``` **Prevention** -- Cap retries: `aider --max-reflections 3` +- The retry count isn't configurable, so keep failures from reaching the LLM in the first place - Use auto-fixing linters so the linter resolves what it can before handing to AI: ```yaml @@ -149,7 +149,7 @@ Exit and relaunch Aider — the map rebuilds. Or in-session: ``` /reset # Clear session context -/map-refresh # Re-scan project structure (if your version supports it) +/map-refresh # Force a repo map refresh ``` **Prevention** diff --git a/pitfalls/aider.md b/pitfalls/aider.md index eb6cf0e..8d0dd67 100644 --- a/pitfalls/aider.md +++ b/pitfalls/aider.md @@ -6,27 +6,27 @@ --- -## 陷阱 1:自动 commit 吃进了你的工作树变更 +## 陷阱 1:自动 commit 把你没写完的改动也提交了 **症状** -- 你在项目里改了几个文件还没 commit -- 让 Aider 改一个别的文件 -- 它生成代码后自动 commit,把你**未 stage 的变更也一起打包提交** +- 你在 `user.py` 里改了一半还没 commit +- 让 Aider 也改 `user.py` +- `git log` 一看多了**两个** commit:一个是你那半截改动(commit message 还是 AI 生成的),一个才是 Aider 的修改 **根因** -Aider 默认开启 `auto-commits: true`。它 commit 的范围是整个工作树 diff,不区分"我改的"和"用户改的"。Aider 觉得"改完就提交"是好事,不知道你有别的工作正在进行。 +Aider 默认开启 `auto-commits: true`,只提交**它自己编辑过的文件**,不会碰其他文件。但 `--dirty-commits` 也默认开启:如果它要改的文件里已经有你未提交的改动,它会**先把这些改动单独 commit 一次**,再提交自己的修改——目的是把你的工作和 AI 的修改分开,方便回滚。代价是你没写完的半成品被当成一个正式 commit 进了历史。 **出坑** ```bash -git reset HEAD~1 # 取消最后一次 commit,文件回到工作树 -git status # 核对哪些是你的、哪些是 Aider 的 -# 手动 commit 该 commit 的,丢弃该丢的 +git log --oneline -3 # 找到"你的改动"那个 commit 和 Aider 的 commit +git reset --soft HEAD~2 # 两个 commit 都撤回到暂存区,改动还在 +git status # 核对哪些是你的、哪些是 Aider 的,重新组织提交 ``` **预防** 三选一: -1. **开会话前先 `git stash`**:把你未完成的工作藏起来,Aider 的 commit 才干净 -2. **关闭自动 commit**:`aider --no-auto-commits`,或在 `.aider.conf.yml` 里 `auto-commits: false` +1. **开会话前自己先 commit 或 `git stash`**:工作树干净,Aider 的 commit 才干净 +2. **关掉这两个行为**:`aider --no-dirty-commits`(不再替你提交已有改动),或 `--no-auto-commits` / `.aider.conf.yml` 里 `auto-commits: false` 3. **开独立 feature 分支**:`git checkout -b feature/xxx` 再开 Aider,弄脏也只是脏分支 --- @@ -39,7 +39,7 @@ git status # 核对哪些是你的、哪些是 Aider 的 - 跑起来 `TypeError` **根因** -Aider 只把 `/add` 过的文件真正**读进上下文**。Map 模式会索引项目结构(名字+位置),但**不读内容**。依赖文件没 `/add`,AI 只能基于文件名猜。 +Aider 只把 `/add` 过的文件**完整读进上下文**。Repo Map 会提取各文件的关键符号和定义行(函数/类签名),并按引用关系图排序,但受 `map-tokens` 预算限制,只放得下最相关的一部分,**不包含函数体实现**。依赖文件没 `/add`,又恰好没进 Map,AI 只能靠名字猜。 **出坑** ``` @@ -83,9 +83,9 @@ Aider 只把 `/add` 过的文件真正**读进上下文**。Map 模式会索引 配置分层(`.aider.conf.yml`): ```yaml -model: claude-sonnet-4-5 # 主模型 -weak-model: deepseek/deepseek-chat # 弱任务(commit message、简单补全) -editor-model: claude-haiku-4-5 # 编辑器补全 +model: anthropic/claude-sonnet-5-5 # 主模型 +weak-model: deepseek/deepseek-v4-pro # 弱任务(commit message、聊天记录摘要) +editor-model: anthropic/claude-haiku-4-5 # architect 模式下负责把方案落成具体文件编辑 ``` 或**按任务类型**切: @@ -107,17 +107,17 @@ editor-model: claude-haiku-4-5 # 编辑器补全 - 一次对话下来 token 消耗是预期的 5 倍 **根因** -Aider 的 auto-lint/test 是 "失败就让 LLM 再改一次"。如果问题根本不是代码能修好的(比如环境配置、依赖版本),它会永远修不好,一直重试直到达到默认上限。每次重试都烧 token。 +Aider 的 auto-lint/test 是 "失败就让 LLM 再改一次"。如果问题根本不是代码能修好的(比如环境配置、依赖版本),它会永远修不好,一直重试直到达到内置的反思上限(固定值,没有命令行参数可调)。每次重试都烧 token。 **出坑** ``` /undo # 回滚本轮修改 -/lint-cmd none # 临时关掉 auto-lint +# 退出后用 aider --no-auto-lint 重开(或 .aider.conf.yml 里 auto-lint: false) # 手动修根本问题(环境、配置),再打开 auto-lint ``` **预防** -- 限制重试次数(`aider --max-reflections 3`) +- 重试次数没法调,所以要让失败尽量少进 LLM - lint 命令用 `--fix` 模式让 linter 先尝试自动修复,而不是报错扔给 AI: ```yaml @@ -147,7 +147,7 @@ Map 模式的索引在**会话开始时生成**,会话中如果 git 层面大 或者在会话里: ``` /reset # 清空会话上下文 -/map-refresh # 重新扫描项目结构(取决于版本是否支持) +/map-refresh # 强制刷新 repo map ``` **预防** diff --git a/trae/README.en.md b/trae/README.en.md index c2c79af..36af743 100644 --- a/trae/README.en.md +++ b/trae/README.en.md @@ -2,7 +2,12 @@ # Trae Best Practices -> Trae is an AI IDE by ByteDance (based on VS Code), offering **free access to Claude and GPT models**. Developer-friendly for the Chinese market — Chinese UI, direct access in China, and generous free quotas. Great for getting started with AI coding and budget-conscious teams. +> Trae is an AI IDE by ByteDance (based on VS Code) with a free tier. Developer-friendly for the Chinese market — Chinese UI, plus a separate edition for mainland China. Great for getting started with AI coding and budget-conscious teams. +> +> ⚠️ **Key changes in 2025-2026**: +> - **No more Claude**: after Anthropic restricted Chinese-controlled companies from using Claude in 2025-09, Trae removed all Claude models. +> - **Renamed**: the IDE was renamed **TraeCode** in 2026-08; the former SOLO was renamed **TRAE Work** on 2026-06-09. trae.ai now offers two downloads: TraeCode and TraeWork. +> - **Two editions**: the international [trae.ai](https://trae.ai) and the mainland [trae.cn](https://www.trae.cn) are separate products; the mainland edition uses domestic models and is directly reachable in China (check trae.cn for its current model list). --- @@ -10,10 +15,11 @@ | Concept | Description | Use Case | |---------|-------------|----------| -| **Builder** | Agent mode, autonomously completes tasks | Complex tasks, cross-file changes | +| **Agent** | Built-in Agent (called Builder in older versions) + custom agents (prompt + tools + MCP), plus SOLO Coder | Complex tasks, cross-file changes | | **Chat** | Sidebar conversation | Q&A, understanding code | | **Completion** | Inline code completion | Daily coding | -| **Rules** | `.trae/rules/` | Project-level rules | +| **Rules** | Any `.md` under `.trae/rules/` | Project-level rules | +| **MCP** | One-click add from the MCP marketplace, or project-level `.trae/mcp.json` | Connect external tools | | **@ References** | `@file` `@folder` `@web` | Pinpoint context precisely | --- @@ -22,15 +28,26 @@ ### Installation -Download from [trae.ai](https://trae.ai). Supports macOS / Windows / Linux. +Download TraeCode from [trae.ai](https://trae.ai) (users in mainland China can use [trae.cn](https://www.trae.cn)). Supports macOS / Windows / Linux. -After signing up you can start using it right away — **no API key needed**. +After signing up you can start using it right away — **no API key needed**. International pricing (see [trae.ai/pricing](https://www.trae.ai/pricing) for the latest): + +| Plan | Price | Notes | +|------|-------|-------| +| Free | $0 | Auto mode only (model picked for you), limited usage, 5,000 completions/month | +| Pro | $20/month | Auto + all models, unlimited completions | +| Pro+ | $60/month | Higher usage | +| Ultra | $200/month | Highest usage | ### Rules — Project Rules -Create `.trae/rules/project_rules.md`: +Create `.trae/rules/project_rules.md` (any `.md` under `.trae/rules/` is read, recursively through subfolders up to three levels deep): ```markdown +--- +alwaysApply: true +--- + # Project Rules ## Tech Stack @@ -48,12 +65,14 @@ React + TypeScript + Ant Design + UmiJS - Variable names in English ``` -### Builder — Agent Mode +`alwaysApply: true` in the frontmatter means the rule always applies; alternatively use `globs` (applies to matching files) or `description` (the AI decides when it applies). If your project already has `AGENTS.md` / `CLAUDE.md`, turn on "Include AGENTS.md / CLAUDE.md in context" under Settings > Rules to reuse them. + +### Agent Mode -Builder is Trae's Agent, similar to Cursor's Composer: +Agent is Trae's autonomous execution mode (called Builder in older versions), similar to Cursor's Agent. Besides the built-in Agent, you can create custom agents with their own prompts, toolsets, and MCP servers: ``` -Use Builder mode. +Use Agent mode. Reference the pattern in src/pages/user/list.tsx, create a new order list page at src/pages/order/list.tsx. Requirements: @@ -67,16 +86,16 @@ Requirements: ## Prompting Tips -### 1. Making the Most of Free Models +### 1. Match Mode and Model to the Task -Trae provides Claude and GPT for free. Allocate wisely: +The Free plan only offers Auto mode (Trae picks the model); Pro and above let you choose models manually. Allocate wisely: ``` -# Complex tasks — use Claude -Builder mode + Claude: refactor the entire auth module +# Complex tasks — Agent mode + the strongest model available to you +Agent mode: refactor the entire auth module -# Simple tasks — use GPT -Chat mode + GPT: explain this code / write a comment +# Simple tasks — Chat mode, Auto is fine +Chat mode: explain this code / write a comment ``` ### 2. Chinese-Friendly @@ -108,9 +127,9 @@ that shows order item details when expanded. | Dimension | Trae | Cursor | |-----------|------|--------| -| Price | **Free** (includes Claude/GPT) | $20/month | +| Price | Free tier (Auto mode only); Pro $20/month | $20/month | | Chinese support | 3/3 (Chinese UI) | 1/3 (English only) | -| Access in China | 3/3 (direct access) | 1/3 (requires proxy) | +| Access in China | 3/3 (direct access via the trae.cn edition) | 1/3 (requires proxy) | | Agent capabilities | 2/3 | 3/3 | | Rules system | 2/3 | 3/3 (glob-based on-demand loading) | | Extension ecosystem | 2/3 (VS Code compatible) | 3/3 (VS Code compatible) | @@ -122,9 +141,9 @@ that shows order item details when expanded. | Pitfall | Description | Solution | |---------|-------------|----------| -| Builder runs slow | Free models may queue | Use Builder for non-urgent tasks, Chat for urgent ones | -| Model switching | Different models excel at different things | Claude for complex, GPT for simple | -| Rules not working | Wrong file path or format | Ensure files are under `.trae/rules/` in Markdown format | +| Agent runs slow | The Free plan uses the standard queue and may wait | Use Agent for non-urgent tasks, Chat for urgent ones; or upgrade to a paid plan (fast queue) | +| Can't find Claude | Claude was removed in 2025-09 | Use another available model; switch tools if you must have Claude | +| Rules not working | Wrong file path, nesting depth, or frontmatter | Ensure files are under `.trae/rules/` (max three subfolder levels), in `.md` format; check `alwaysApply` / `globs` | --- @@ -138,5 +157,6 @@ that shows order item details when expanded. ## Further Reading -- [Trae Official Website](https://trae.ai) +- [Trae Official Website](https://trae.ai) (mainland edition: [trae.cn](https://www.trae.cn)) +- [Trae Official Docs](https://docs.trae.ai) - [superpowers-zh](https://github.com/jnMetaCode/superpowers-zh) — Skills methodology (also supports Trae) diff --git a/trae/README.md b/trae/README.md index d462ba4..c6c2a9c 100644 --- a/trae/README.md +++ b/trae/README.md @@ -1,6 +1,11 @@ # Trae 最佳实践 -> Trae 是字节跳动推出的 AI IDE(基于 VS Code),主打**免费使用 Claude 和 GPT 模型**。对中国开发者友好——界面支持中文、国内网络直连、免费额度充足。适合入门 AI 编程和预算敏感的团队。 +> Trae 是字节跳动推出的 AI IDE(基于 VS Code),有免费档可用。对中国开发者友好——界面支持中文,另有面向国内的独立版本。适合入门 AI 编程和预算敏感的团队。 +> +> ⚠️ **2025-2026 重要变化**: +> - **不再提供 Claude**:2025-09 Anthropic 限制中国控股企业使用 Claude 后,Trae 已下架全部 Claude 模型。 +> - **改名**:IDE 于 2026-08 更名为 **TraeCode**;原 SOLO 于 2026-06-09 更名为 **TRAE Work**。trae.ai 现在提供 TraeCode 和 TraeWork 两个下载。 +> - **两个版本**:国际版 [trae.ai](https://trae.ai) 与国内版 [trae.cn](https://www.trae.cn) 是独立产品,国内版接入国内模型、国内网络直连(可用模型以国内版官网为准)。 --- @@ -8,10 +13,11 @@ | 概念 | 说明 | 用途 | |------|------|------| -| **Builder** | Agent 模式,自主完成任务 | 复杂任务、跨文件修改 | +| **Agent** | 内置 Agent(旧版中叫 Builder)+ 自定义 Agent(提示词 + 工具 + MCP),另有 SOLO Coder | 复杂任务、跨文件修改 | | **Chat** | 侧边栏对话 | 问答、理解代码 | | **补全** | 行内代码补全 | 日常编码 | -| **Rules** | `.trae/rules/` | 项目级规则 | +| **Rules** | `.trae/rules/` 下任意 `.md` | 项目级规则 | +| **MCP** | MCP 市场一键添加,或项目级 `.trae/mcp.json` | 接入外部工具 | | **@引用** | `@file` `@folder` `@web` | 精确指定上下文 | --- @@ -20,15 +26,26 @@ ### 安装 -从 [trae.ai](https://trae.ai) 下载安装,支持 macOS / Windows / Linux。 +从 [trae.ai](https://trae.ai) 下载 TraeCode(国内用户可用 [trae.cn](https://www.trae.cn)),支持 macOS / Windows / Linux。 -注册后直接可用,**不需要自己的 API Key**。 +注册后直接可用,**不需要自己的 API Key**。国际版价格(以 [trae.ai/pricing](https://www.trae.ai/pricing) 为准): + +| 套餐 | 价格 | 说明 | +|------|------|------| +| Free | $0 | 仅 Auto 模式(自动选模型),用量有限,补全 5,000 次/月 | +| Pro | $20/月 | Auto + 全部模型,补全不限 | +| Pro+ | $60/月 | 更高用量 | +| Ultra | $200/月 | 最高用量 | ### Rules — 项目规则 -创建 `.trae/rules/project_rules.md`: +创建 `.trae/rules/project_rules.md`(`.trae/rules/` 下任意 `.md` 都会被读取,支持子目录递归,最多三层): ```markdown +--- +alwaysApply: true +--- + # 项目规则 ## 技术栈 @@ -46,12 +63,14 @@ React + TypeScript + Ant Design + UmiJS - 变量名用英文 ``` -### Builder — Agent 模式 +frontmatter 里 `alwaysApply: true` 表示始终生效;也可以改用 `globs`(匹配文件时生效)或 `description`(由 AI 判断何时生效)。已有 `AGENTS.md` / `CLAUDE.md` 的项目,可以在设置 > Rules 里打开「将 AGENTS.md / CLAUDE.md 包含在上下文中」直接复用。 + +### Agent 模式 -Builder 是 Trae 的 Agent,类似 Cursor 的 Composer: +Agent 是 Trae 的自主执行模式(旧版中叫 Builder),类似 Cursor 的 Agent。除了内置 Agent,还可以自定义 Agent(配置提示词、工具集和 MCP Server): ``` -用 Builder 模式。 +用 Agent 模式。 参考 src/pages/user/list.tsx 的写法, 新建一个 src/pages/order/list.tsx 订单列表页。 要求: @@ -65,16 +84,16 @@ Builder 是 Trae 的 Agent,类似 Cursor 的 Composer: ## 提示词技巧 -### 1. 利用免费模型 +### 1. 按任务分配模式和模型 -Trae 免费提供 Claude 和 GPT,合理分配: +Free 档只有 Auto 模式(由 Trae 自动选模型);Pro 及以上可手动选模型。合理分配: ``` -# 复杂任务 — 用 Claude -Builder 模式 + Claude:重构整个认证模块 +# 复杂任务 — Agent 模式 + 最强的可选模型 +Agent 模式:重构整个认证模块 -# 简单任务 — 用 GPT -Chat 模式 + GPT:解释这段代码 / 写个注释 +# 简单任务 — Chat 模式,Auto 即可 +Chat 模式:解释这段代码 / 写个注释 ``` ### 2. 中文友好 @@ -106,9 +125,9 @@ Trae 对国内常用组件库支持好: | 维度 | Trae | Cursor | |------|------|--------| -| 价格 | **免费**(含 Claude/GPT) | $20/月 | +| 价格 | 有免费档(仅 Auto 模式);Pro $20/月 | $20/月 | | 中文支持 | ★★★(界面中文) | ★☆☆(纯英文) | -| 国内网络 | ★★★(直连) | ★☆☆(需要代理) | +| 国内网络 | ★★★(国内版 trae.cn 直连) | ★☆☆(需要代理) | | Agent 能力 | ★★☆ | ★★★ | | Rules 系统 | ★★☆ | ★★★(globs 按需加载) | | 插件生态 | ★★☆(VS Code 兼容) | ★★★(VS Code 兼容) | @@ -120,9 +139,9 @@ Trae 对国内常用组件库支持好: | 陷阱 | 说明 | 解决 | |------|------|------| -| Builder 执行慢 | 免费模型可能排队 | 非紧急任务用 Builder,急的用 Chat | -| 模型切换 | 不同模型擅长不同事 | 复杂用 Claude,简单用 GPT | -| Rules 不生效 | 文件路径或格式不对 | 确保在 `.trae/rules/` 下,Markdown 格式 | +| Agent 执行慢 | Free 档走标准队列,可能排队 | 非紧急任务用 Agent,急的用 Chat;或升级付费档(快速队列) | +| 找不到 Claude | 2025-09 起已下架 Claude | 用其他可选模型;非用 Claude 不可就换工具 | +| Rules 不生效 | 文件路径、嵌套层级或 frontmatter 不对 | 确保在 `.trae/rules/` 下(子目录最多三层),`.md` 格式,检查 `alwaysApply` / `globs` | --- @@ -136,5 +155,6 @@ Trae 对国内常用组件库支持好: ## 延伸阅读 -- [Trae 官方网站](https://trae.ai) +- [Trae 官方网站](https://trae.ai)(国内版:[trae.cn](https://www.trae.cn)) +- [Trae 官方文档](https://docs.trae.ai) - [superpowers-zh](https://github.com/jnMetaCode/superpowers-zh) — Skills 方法论(也支持 Trae) diff --git a/trae/templates/project_rules.md b/trae/templates/project_rules.md index 6e3140c..f7134ee 100644 --- a/trae/templates/project_rules.md +++ b/trae/templates/project_rules.md @@ -1,3 +1,7 @@ +--- +alwaysApply: true +--- + # 项目规则 ## 项目背景 From 3857066493459f22da2c114932fb70e1264b4712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AI=E4=B8=8D=E6=AD=A2=E8=AF=AD?= <12096460+jnMetaCode@users.noreply.github.com> Date: Tue, 29 Sep 2026 07:30:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?docs(aider):=20=E5=8F=8D=E6=80=9D=E4=B8=8A?= =?UTF-8?q?=E9=99=90=E5=86=99=E6=98=8E=E6=BA=90=E7=A0=81=E5=80=BC=20max=5F?= =?UTF-8?q?reflections=20=3D=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pitfalls/aider.en.md | 2 +- pitfalls/aider.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pitfalls/aider.en.md b/pitfalls/aider.en.md index 3abe027..48dab23 100644 --- a/pitfalls/aider.en.md +++ b/pitfalls/aider.en.md @@ -109,7 +109,7 @@ Or switch **by task type**: - A single session burns 5× expected tokens **Cause** -Aider's auto-lint/test retries "if it fails, let the LLM try again." If the problem isn't code-fixable (environment, dependencies), it'll retry until it hits the built-in reflection cap (a fixed value with no command-line flag). Each retry costs tokens. +Aider's auto-lint/test retries "if it fails, let the LLM try again." If the problem isn't code-fixable (environment, dependencies), it'll retry until it hits the built-in reflection cap (hard-coded `max_reflections = 3` in the source, no command-line flag). Each retry costs tokens. **Recovery** ``` diff --git a/pitfalls/aider.md b/pitfalls/aider.md index 8d0dd67..36ca86d 100644 --- a/pitfalls/aider.md +++ b/pitfalls/aider.md @@ -107,7 +107,7 @@ editor-model: anthropic/claude-haiku-4-5 # architect 模式下负责把方案 - 一次对话下来 token 消耗是预期的 5 倍 **根因** -Aider 的 auto-lint/test 是 "失败就让 LLM 再改一次"。如果问题根本不是代码能修好的(比如环境配置、依赖版本),它会永远修不好,一直重试直到达到内置的反思上限(固定值,没有命令行参数可调)。每次重试都烧 token。 +Aider 的 auto-lint/test 是 "失败就让 LLM 再改一次"。如果问题根本不是代码能修好的(比如环境配置、依赖版本),它会永远修不好,一直重试直到达到内置的反思上限(源码写死 `max_reflections = 3`,没有命令行参数可调)。每次重试都烧 token。 **出坑** ``` From b6e7f153e4a75c1b853ab2889779d6a721b8c4f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AI=E4=B8=8D=E6=AD=A2=E8=AF=AD?= <12096460+jnMetaCode@users.noreply.github.com> Date: Tue, 29 Sep 2026 07:31:00 +0800 Subject: [PATCH 3/3] =?UTF-8?q?ci:=20lychee=20=E6=8E=92=E9=99=A4=E4=BB=85?= =?UTF-8?q?=E5=AF=B9=E5=A4=A7=E9=99=86=20IP=20=E5=BC=80=E6=94=BE=E7=9A=84?= =?UTF-8?q?=20trae.cn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .lychee.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.lychee.toml b/.lychee.toml index b573be8..1d917b1 100644 --- a/.lychee.toml +++ b/.lychee.toml @@ -51,6 +51,8 @@ exclude = [ # 对 CI 爬虫返回 403 的站点(人工访问正常) "^https?://platform\\.openai\\.com", + # 仅对中国大陆 IP 开放 + "^https?://(www\\.)?trae\\.cn", # QQ 链接跳转 "^https?://qm\\.qq\\.com",