关于 remote-work
remote-work 用于在 Azure 虚拟机上运行 amplihack 任务。它根据任务复杂度和区域偏好选择虚拟机规格,并指导命令执行与结果查看。
主要功能
- 01识别任务与区域
- 02推荐虚拟机规格
- 03构造远程执行命令
- 04指导执行与查看结果
- 05提供错误处理建议
适用场景
- 01转移耗时较长的任务
- 02在指定 Azure 区域执行工作
- 03将工作分配到多台机器
- 04隔离实验性任务
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ rysweet/ amplihack --skill remote-work安装后在 Claude Code 中输入/remote-work确认已加载。
详细介绍
远程工作技能
使用 /amplihack:remote 命令在远程 Azure VM 上执行 amplihack 任务。
适用场景
在以下情况下使用此技能:
- 在远程 VM 上运行长时间任务
- 利用更强大的 Azure 计算资源
- 在多台机器上分配工作
- 隔离实验性或高风险工作
- 在特定 Azure 区域工作
工作原理
当你提出以下请求时:
- “远程运行此任务”
- “在 eastus VM 上执行”
- “将此任务转交给 Azure”
- “使用远程机器执行此任务”
我会:
- 提取任务描述
- 检测区域偏好(如果提到)
- 根据任务复杂度推荐合适的 VM 规格
- 使用适当的选项执行
/amplihack:remote - 指引你访问结果
区域检测
我会自动从你的请求中检测 Azure 区域:
- “eastus”、“east us” → --region eastus
- “westus”、“west us” → --region westus
- “centralus” → --region centralus
- (以及其他 Azure 区域)
VM 规格建议
根据任务复杂度关键词:
小型(规格 s):快速分析、简单修复
- 关键词:“quick”、“simple”、“small”、“analyze”
- 规格:s(8GB RAM)
中型(规格 m):标准开发工作
- 关键词:“implement”、“feature”、“refactor”
- 规格:m(64GB RAM)- 默认
大型(规格 l):复杂重构、大型代码库
- 关键词:“large”、“comprehensive”、“complex”、“entire codebase”
- 规格:l(128GB RAM)
超大型(规格 xl):高强度计算任务
- 关键词:“intensive”、“heavy”、“massive”
- 规格:xl(256GB RAM)
操作说明
激活后:
-
解析用户请求,提取:
- 任务描述
- 区域偏好(如果提到)
- 用于确定 VM 规格的复杂度提示
-
根据关键词确定 VM 规格:
- 除非关键词另有提示,否则默认使用“m”
- 简单或快速任务使用“s”
- 大型或复杂任务使用“l”
- 高强度或超大型任务使用“xl”
-
构造命令:
/amplihack:remote --region {region} --vm-size {size} auto "{task}"如果未提及区域,则省略 --region(使用 azlin 默认值)
-
使用 SlashCommand 工具执行命令
-
指引用户进行后续操作:
- 结果位于
~/.amplihack/.claude/runtime/logs/remote/ - Git 分支位于
remote-exec/命名空间中 - 如何查看日志并整合更改
- 结果位于
示例
示例 1:指定区域的简单任务
用户:“在 eastus VM 上远程运行此分析”
你的回复:
I'll execute this analysis on a remote Azure VM in eastus.
Detected:
- Task: analysis work
- Region: eastus
- Size: s (small - suitable for analysis)
Executing: /amplihack:remote --region eastus --vm-size s auto "analysis work"
然后使用 SlashCommand 工具执行该命令。
示例 2:大型重构
用户:“我需要将这项全面重构任务转交给 Azure,使用 westus2”
你的回复:
I'll execute this comprehensive refactoring on a remote Azure VM in westus2.
Detected:
- Task: comprehensive refactoring
- Region: westus2
- Size: l (large - for comprehensive work)
Executing: /amplihack:remote --region westus2 --vm-size l auto "comprehensive refactoring"
示例 3:未指定区域
用户:“远程运行此任务”
你的回复:
I'll execute this task on a remote Azure VM using your default region.
Detected:
- Task: [extract from context]
- Region: default (from azlin config)
- Size: m (medium - standard)
Executing: /amplihack:remote --vm-size m auto "[task]"
整合结果
执行完成后,指引用户:
Remote execution complete!
Results:
- Logs: .claude/runtime/logs/remote/
- Branches: Check `git branch -r | grep remote-exec`
- Integration: Review changes and merge if ready
To view logs:
cat .claude/runtime/logs/remote/remote-exec-*.log
To merge remote changes:
git fetch
git merge remote-exec/main
错误处理
如果命令失败,说明常见问题:
检测到机密信息: “远程执行已阻止——仓库中发现机密信息。请移除硬编码的机密信息,并改用 .env 文件。”
Azlin 尚未配置:
“Azlin 尚未配置。请运行:azlin configure”
超时:
“任务超时。VM 已保留,供检查使用。使用 azlin connect <vm-name> 进行调查。”
最佳实践
提醒用户:
- 远程执行前确保 git 状态干净
- 使用
.env存放机密信息(切勿硬编码) - 使用
azlin list监控 Azure 费用 - 调试后使用
azlin kill <vm-name>清理 VM
Token 预算
- 核心说明:约 1,200 个 token
- 示例和指南:约 400 个 token
- 总计:约 1,600 个 token(远低于 2,000 的限制)
另请参阅
/amplihack:remote- 直接命令接口- Azlin 文档:https://github.com/rysweet/azlin
- 远程执行模块:
~/.amplihack/.claude/tools/amplihack/remote/README.md
评论
支持 Markdown