retire-machine
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRetire machine
退役机器
Take a machine out of use without losing work and without leaving anything that still trusts it. The reverse of : that skill gives a machine keys, sessions and settings, and this one takes them away again, in an order that keeps the machine reachable until the last step. The user deletes the machine at the provider; an agent never does, since deletion can't be undone.
/set-up-machine让机器退出使用,同时不丢失工作,也不留下任何仍然信任它的资源。它与 相反:后者为机器提供密钥、会话和设置,而本 skill 会按特定顺序再次移除这些内容,使机器在最后一步之前始终可访问。机器由用户在服务商处删除;Agent 绝不代为删除,因为删除操作无法撤销。
/set-up-machineParameters
参数
- : where agent sessions run, e.g.
<session-host>. It is also how the agent reaches the machine.herdr - : how a notification reaches the user. Its configuration may list the machine as a sender.
<notification-method>
- :Agent 会话运行的位置,例如
<session-host>。这也是 Agent 访问该机器的方式。herdr - :通知到达用户的方式。其配置可能将该机器列为发件人。
<notification-method>
Steps
步骤
- Read the record. Find what the user wrote about the machine: in their workstation repo, which the pointer names, read every file that names it, any checklist for deleting it, and the issue that retires it. Note the machine that replaces it, if any.
~/.config/agents/source.md- When the pointer records no workstation repo: ask the user once where they keep notes on the machine, or go on from what the machine itself shows.
- Take stock, without changing anything. Read the session host's state first: its workspaces, panes and agents. Read a pane's output; never send it keys or a prompt, and never start a stopped agent, since a resumed session reloads its whole context. Then open a new workspace on the machine for your own commands, so you don't type into a pane someone else uses. Collect:
- Work: every git repository in the home folder, with its uncommitted files, unpushed commits, stashes and branches without an upstream. A repository without a remote counts as unpushed.
- Files outside repositories: the visible entries in the home folder and application data under .
~/.local/share - Services: containers and their volumes, listening ports, enabled system and user services, cron jobs and timers. A web service can run unnoticed for weeks: for port 80 or 443, read the proxy config for the name it serves.
- What points at the machine: domain names, including names built from the IP such as ; allow-lists; the tailnet device; SSH keys and deploy keys on GitHub; tokens created for it; and on the user's other machines, the session host's saved machine, the notification method's sender list,
<ip>.sslip.ioand~/.ssh/config.known_hosts
- Propose one plan with a line per item found: keep it (and where it goes), move it to the replacement, or let it go. Ask the user once for the items you can't decide from the record. Ask also whether to keep a provider snapshot. A snapshot costs a little each month, but a closed plan line may not be orderable again.
- Save what the plan keeps or moves, before anything is stopped, and check that each copy arrived.
- Disconnect in this order. The session host's saved machine goes last, because it is how you reach the machine.
- Stop the services the plan lets go.
- Take the machine off the tailnet: on the machine, then check the device is gone in the admin console.
tailscale logout - Remove it from the notification method's sender list and from on the user's other machines. Remove its host keys with
~/.ssh/config.ssh-keygen -R <host> - Give the user the commands that revoke its access to their accounts: its SSH key and deploy keys on GitHub (, then
gh ssh-key list), and each token created for it. The rule table refuses these commands to agents, since they change who can reach the account.gh ssh-key delete <id> - Close your workspace on the machine, then remove the saved machine: for Herdr, , with the 32-character id
herdr machine remove <id>prints, since the label is refused.herdr machine list
- Hand over the delete. Give the user the provider's console link and say what to do: take the snapshot if the plan keeps one, then delete the server. A stopped server is still billed; only deletion ends the bill. The user confirms when it's done.
- Record the retirement, as its own change, in each file step 1 found: say the machine is retired, with the date and where its work went, and drop or mark it where a file lists machines. Close the issue that retires it.
- Check after the user deletes it: the host no longer answers SSH, and the provider's console lists no server. Report what was saved where, what was let go, and anything left for the user.
- 读取记录。 查找用户关于该机器的记录:在 指针所指向的工作站仓库中,读取所有提及该机器的文件、任何删除检查清单,以及用于退役该机器的 issue。记下替代该机器的新机器(如有)。
~/.config/agents/source.md- 当指针未记录工作站仓库时: 向用户询问一次其机器记录的存放位置,或根据机器自身显示的信息继续。
- 盘点,不做任何更改。 先读取会话主机的状态,包括其 workspace、pane 和 Agent。读取 pane 的输出;绝不向它发送按键或 prompt,也绝不启动已停止的 Agent,因为恢复会话会重新加载全部上下文。然后在该机器上新建一个 workspace,供你执行自己的命令,避免误输入其他人正在使用的 pane。收集:
- 工作内容: home 文件夹中的每个 git 仓库,包括未提交的文件、未推送的 commit、stash,以及没有 upstream 的 branch。没有 remote 的仓库也视为存在未推送内容。
- 仓库之外的文件: home 文件夹中的可见条目,以及 下的 application data。
~/.local/share - 服务: 容器及其卷、监听端口、已启用的系统服务和用户服务、cron job 和 timer。Web 服务可能在无人注意的情况下持续运行数周:对于端口 80 或 443,应读取 proxy 配置,确认其承载的域名。
- 指向该机器的内容: 域名,包括基于 IP 构建的域名(如 );allow-list;tailnet 中的设备;GitHub 上的 SSH key 和 deploy key;为该机器创建的 token;以及用户其他机器上的会话主机保存的机器、notification method 的发件人列表、
<ip>.sslip.io和~/.ssh/config。known_hosts
- 提出一份计划,每个发现的项目占一行:保留(以及保存到哪里)、迁移到替代机器,或放弃。对于无法从记录中判断的项目,一次性向用户询问。同时询问是否保留服务商快照。快照每月会收取少量费用,但已关闭的套餐条目可能无法再次订购。
- 保存计划中要保留或迁移的内容,在停止任何服务之前完成,并检查每个副本是否已成功到达目标位置。
- 按顺序断开连接。 会话主机中保存的机器必须最后移除,因为这是 Agent 访问该机器的途径。
- 停止计划中允许放弃的服务。
- 将机器从 tailnet 中移除:在机器上运行 ,然后在管理控制台中确认设备已消失。
tailscale logout - 从 notification method 的发件人列表及用户其他机器的 中删除该机器。使用
~/.ssh/config删除其 host key。ssh-keygen -R <host> - 将撤销其账户访问权限的命令交给用户:其 SSH key 和 GitHub 上的 deploy key(先运行 ,再运行
gh ssh-key list),以及为该机器创建的每个 token。规则表禁止 Agent 执行这些命令,因为它们会改变谁有权访问账户。gh ssh-key delete <id> - 关闭你在该机器上的 workspace,然后移除保存的机器:对于 Herdr,运行 ,使用
herdr machine remove <id>输出的 32 个字符的 id,因为标签形式会被拒绝。herdr machine list
- 移交删除操作。 向用户提供服务商的控制台链接并说明操作方式:如果计划中保留快照,则先创建快照,然后删除服务器。已停止的服务器仍会计费;只有删除才会终止计费。用户完成后进行确认。
- 记录退役情况,将其作为一项独立更改,写入第 1 步找到的每个文件:注明机器已退役、退役日期以及其工作迁移到哪里;如果某个文件列出了机器,则删除该条目或进行标记。关闭用于退役该机器的 issue。
- 检查用户删除后的状态:主机不再响应 SSH,服务商控制台也不再列出该服务器。报告内容的保存位置、被放弃的内容,以及仍需用户处理的事项。