# ClaudeDevs 推出 ant apply：以 repo 宣告並同步 Claude Managed Agent 資源

> 📖 本站完整內容索引（documentation index）：[llms.txt](/llms.txt)

> 原作者：ClaudeDevs (@ClaudeDevs) · 策展與摘要：EasyVibeCoding · 平台：X (Twitter) · 熱度：🔥🔥🔥🔥 · 日期：2026-09-04

> 原始來源：https://x.com/ClaudeDevs/status/2095651107645145538

## 證據與延伸閱讀

- [ClaudeDevs 推出 ant apply：以 repo 宣告並同步 Claude Managed Agent 資源。](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/apply) — 官方文件 · 最後核對：2026-09-04 · 支持主張：The workflow supports agent, environment, skill, memory-store, and deployment files; interactive create/update plans; claude-lock.json with remote IDs, hashes, organization, and workspace identity; dependency resolution; --dry-run and --yes CI modes; drift blocking with --force and --prune controls; partial-failure lockfile persistence; serialized applies because the lockfile has no concurrency lock; and Workload Identity Federation guidance.
- [ClaudeDevs 推出 ant apply](https://x.com/ClaudeDevs/status/2095651107645145538)
- [媒體展示依序建立與更新資源](https://pbs.twimg.com/amplify_video_thumb/2095650094054068224/img/hvX6SIXBRvLUPici.jpg)

## 中文摘要

ClaudeDevs 推出 ant apply：以 repo 宣告並同步 Claude Managed Agent 資源。

團隊可把 Claude Managed Agent 的設定放進 repo，預覽變更後再同步至遠端資源。

**核心功能** `ant apply` 支援以 YAML、JSON、Markdown 或 skill 目錄宣告下列資源：

- agent、environment、skill、memory-store 與 deployment
- 互動式 create/update plan，執行前會列出新增或更新內容並要求核准
- 以 `claude-lock.json` 記錄遠端 resource ID、雜湊值、organization 與 workspace identity，後續執行會更新原有物件，避免重複建立
- 透過 repo 相對路徑引用資源，並依相依性順序解析、填入實際 ID

**同步與變更控制** 只有被 `claude-lock.json` 追蹤的資源會由 workflow 管理。若遠端資源遭到外部編輯、封存或刪除，正常的 apply 會阻擋同步；`--force` 可覆寫已記錄的 drift，`--prune` 則可移除已不再宣告的資源。部分變更失敗時，lockfile 仍會保存已建立的物件，因此文件要求即使部分失敗也提交 `claude-lock.json`。

**CI 與安全操作** Anthropic 建議在 pull request 執行 `ant apply --dry-run`，合併後執行 `ant apply --yes .`。由於 lockfile 沒有 concurrency lock，同一時間只能執行一個 apply；憑證方面則建議使用 Workload Identity Federation，而不是把 API key 儲存在環境中。來源未說明部分套用後的 rollback 語意，也未列出各資源類型所需的精確 API 權限，這兩點仍需人工查閱文件。

**實際流程** 媒體展示先以 `agents/summarizer.md` 定義 agent，再執行 `ant apply agents/summarizer.md`；首次成功套用會建立 `claude-lock.json` 與遠端 agent。接著將 skill、environment、memory store、其他 agent 與 deployment 放入同一個專案目錄，執行 `ant apply .`，畫面顯示 6 個資源建立、1 個資源未變更。修改 `skills/pr-summary/SKILL.md` 後，相關的 reviewer、lead 與 deployment 也在同一次 apply 中更新，呈現出接近 infrastructure-as-code 的資源 reconciliation，而非一次性的 Agent 建立指令。

<video src="https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/1788510221978-oo4mc5cc.mp4" poster="https://pub-75d4fe1e4e80421b9ecb1245a7ae0d1a.r2.dev/curated/f4839ac7dbd5f6ed.jpg" controls playsinline preload="metadata" style="max-width:100%;height:auto;display:block;margin:1rem 0"></video>
> ant apply 指令執行介面與專案目錄結構

## 媒體內容

**ant apply 指令執行介面與專案目錄結構**

**影片中的 Prompt 與操作**

操作步驟：

1. （00:14）ant apply agents/summarizer.md
2. （00:33）ant apply .

## 標籤

功能更新, CLI, Skills, ant CLI, ant apply, Anthropic
