-
Notifications
You must be signed in to change notification settings - Fork 4
AgentTarget Installation and Integration zh CN
语言: English · 简体中文
MCP 统一了运行时通信,却没有统一每种 Agent 的 MCP 配置位置、Skills、Hooks、Instructions 或权限。LWC 因此定义统一 AgentTarget 接口,并为每种支持的 host 手写 adapter。
所有已注册 Target 都是强适配:LWC 会实现该 host 和作用域存在的每一项稳定官方文件 surface。“强”不代表在官方声明不支持、UI 管理或仅 preview 的位置发明私有格式。
LWC 注册 12 个 Target:
claude Claude Code
cursor Cursor
codex Codex
opencode OpenCode
hermes Hermes Agent
gemini Gemini CLI
antigravity Antigravity
kiro Kiro
copilot-vscode VS Code with GitHub Copilot Chat
copilot-cli GitHub Copilot CLI
copilot-jetbrains JetBrains IDEs with GitHub Copilot
pi Pi Agent
每个单元格依次表示 全局 / 当前项目。
| Target | MCP | Skill | Instructions | Lifecycle Hook | Permissions |
|---|---|---|---|---|---|
| Claude Code | installed / installed | installed / installed | installed / installed | installed / installed | installed / installed |
| Cursor | installed / installed | installed / installed | user_managed / installed | installed / installed | not_applicable / not_applicable |
| Codex | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| OpenCode | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| Hermes Agent | installed / unsupported | installed / unsupported | installed / installed | installed / unsupported | not_applicable / not_applicable |
| Gemini CLI | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| Antigravity | installed / installed | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
| Kiro | installed / installed | installed / installed | installed / installed | configured_preview / configured_preview | user_managed / user_managed |
| Copilot VS Code | installed / installed | installed / installed | user_managed / installed | unsupported / configured_preview | user_managed / user_managed |
| Copilot CLI | installed / installed | installed / installed | installed / installed | installed / installed | user_managed / user_managed |
| Copilot JetBrains | installed / user_managed | configured_preview / configured_preview | user_managed / configured_preview | unsupported / unsupported | user_managed / user_managed |
| Pi Agent | extension_bridge / extension_bridge | installed / installed | installed / installed | installed / installed | not_applicable / not_applicable |
configured_preview 表示 LWC 会写入 host 官方文档规定的预览 surface,并明确报告该生命周期。user_managed 表示没有稳定官方文件可供安全自动安装;unsupported 表示所选作用域没有该 host 能力。
Pi 没有内置 MCP 配置,因此通过官方 extension bridge 提供 LWC 集成,不会假装存在 native MCP 文件。
lwc agent install安装器会:
- 检测已经安装的 Agent;
- 默认选中检测结果;
- 允许用户编辑 Target 列表;
- 让用户选择
global或local; - 验证
PATH中存在兼容的全局lwc; - 通过各自官方 adapter 安装;
- 保存 ownership receipt,用于刷新与卸载。
全局安装配置用户级 Agent;本地安装只写当前项目中该 host 官方支持的 surface。
--yes 表示“使用检测结果与默认值”,不表示“安装全部 Target”:
lwc agent install --yes它选择已检测 Agent,并默认使用全局位置。安装明确集合时:
lwc agent install \
--target codex,claude,pi \
--location global \
--yes只有确实需要全部 12 项集成时才使用 --target all。安装不用的 Target 只会增加配置面,不会带来收益。
lwc agent install --print-config codex --location global--print-config 会把所选 Target 的 MCP、Hook、Skill 和 Instruction 指引输出到标准输出,不写任何文件。它适合配置审核、受管理环境,以及部分配置由 UI 管理的 host。
根据不同 adapter,安装过程可能写入:
- 一项运行
lwc serve --mcp的lwcMCP entry; - 完整
using-lwcSkill bundle; - 官方 instruction 文件中的一段 marker-bounded 指导;
- native lifecycle Hook 配置;
- OpenCode、Antigravity 或 Pi 使用的官方 plugin/extension bridge;
- Claude Code 官方权限模型支持的 MCP permissions。
安装器还会迁移 LWC 拥有的旧版独立 CodeGraph entry。CodeGraph 继续通过 lwc_explore 使用,不会留下重复 MCP 服务。
lwc agent status --target auto --location global状态会分别报告 Target 检测结果与集成状态。常见值包括:
-
installed:receipt 版本与全部已跟踪安装后 hash 一致; -
modified:某个已跟踪文件在安装后发生变化; -
not_installed:不存在当前 LWC receipt; -
unsupported:Target 或位置没有官方集成作用域。
响应还会报告 MCP、Skills、Instructions、Hook、permissions、配置路径,以及 host 是否被检测到或已经配置。
不能把 modified 当作覆盖用户变更的授权。Drift 可能是有意修改,刷新前应检查 Target 路径。
lwc agent refresh --target codex,claude,pi --location globalRefresh 会重新运行相同 adapter,替换 owned Skill 文件与 marker block,并去重 owned MCP 和 Hook entry。没有 drift 时,刷新前后保持逐字节一致。
Claude prompt Hook 的选择会从安装 receipt 保留;刷新不会静默推翻先前的 --no-prompt-hook 决定。
lwc agent uninstall \
--target codex,claude,pi \
--location global \
--yesReceipt 会保存原始内容、权限模式、安装后 hash、owned MCP 元数据和创建目录。卸载只会删除或恢复仍与 LWC-owned 状态匹配的文件与片段,保留外部 entry 和后续用户修改。
多个 Target receipt 共用文件时,只在 ownership 允许后恢复。目录也只有为空时才会删除。
Agent 集成只要求:
-
PATH中存在兼容的全局lwc; - Agent 官方用户目录或项目目录;
- 在当前目录正常工作时不需要导出
LWC_PROJECT_ROOT; - 不需要
LWC=/private/path/to/lwc别名; - 不需要安装 AMC;
- 不从维护者 HOME 复制任何文件。
只有明确操作另一个已授权项目根时,才需要显式 LWC_PROJECT_ROOT。
安装 Agent 集成不会启用项目图。下一次受支持边界触发 Hook 时会报告 readiness。实质任务需要缺失图能力时,Agent 使用可移植四选一文本只询问一次,并且只初始化获批能力。
文档图 Work 与 CodeGraph 项目索引需要独立验收。Agent 集成成功不能隐藏图初始化失败,图已经就绪也不代表 Agent 配置成功。
AgentTarget 安装只有满足以下条件才算完成:
- 明确了目标 Target 和 global/local 位置;
-
status报告adaptation=strong以及准确的各 surface 模式; - MCP entry 名为
lwc,且没有重复 CodeGraph server; - Skill、Instructions 和 Hook 通过 host 官方机制加载;
- 没有用户 drift 时,重复 refresh 逐字节幂等;
- 卸载恢复安装前状态,且没有删除外部内容;
- 不需要维护者本机路径或私有工具。
LWC Wiki
- Home · 首页
- Project overview · 项目简介
- Basic concepts · 基本概念
- Use cases · 应用场景
- Installation and upgrades · 安装与升级
- Quick start · 快速开始
- Persistent memory · 持久记忆体系
- Agent workflow and memory policy · Agent 工作流与主动记忆策略
- Sources and ingestion · 来源与知识整合
- Wiki pages and provenance · Wiki 页面与来源证明
- Search and context · 搜索与上下文载入
- Document knowledge graph · 文档知识图(记忆图网)
- Code graph · 代码图
- Word graph · 词图
- Tags and strong context · 标签与强上下文
- Document conversion · 文档转换
-
MCP server and
lwc_explore· MCP 服务与lwc_explore - Skills, Hooks, and Instructions · Skills、Hooks 与 Instructions
- AgentTarget installation · AgentTarget 安装与集成
- Changesets · Changeset 原子变更
- Work system · Work 任务系统
- Checkpoints and rollback · Checkpoint、恢复与回滚
- Read-only Viewer · 只读可视化界面
- Architecture overview · 总体架构
- Storage and data model · 存储与数据模型
- Retrieval and indexing · 检索与索引设计
- Graph projection and performance · 图投影与性能设计
- MCP, Hooks, and AgentTarget design · MCP、Hook 与 AgentTarget 设计
- Safety and trust boundaries · 安全模型与信任边界
- Maintenance and diagnostics · 维护与诊断
- Troubleshooting and FAQ · 故障排查与常见问题
- Migration and compatibility · 迁移与版本兼容
- Support and issue reporting · 获取帮助与问题反馈
- CLI and configuration reference · CLI 与配置参考
- JSON output and error contract · JSON 输出与错误契约
- Limits and glossary · 系统限制与术语表
- Contributing and development · 贡献与开发指南
- Testing and release process · 测试与发布流程
- Wiki style guide · Wiki 编写规范