setup-code-maintenance-bot

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Set Up a Code Maintenance Bot

设置代码维护机器人

Turn the user's maintenance intent into a runnable Paperclip routine with a named agent, accessible repository and skill, bounded work, and inspectable PRs. The maintenance skill supplies the domain judgment: test auditing, documentation upkeep, dependency maintenance, refactoring, or another chosen task.
If asked only to draft instructions or a setup plan, produce that artifact and stop before provisioning or running anything. Do not perform the maintenance while setting up the bot. An immediate trial is a separate choice from scheduling.
将用户的维护意图转化为一个可运行的 Paperclip routine,其中包含具名 Agent、可访问的仓库和 skill、范围受限的工作以及可审查的 PR。
维护 skill 提供领域判断:测试审计、文档维护、依赖维护、重构或所选的其他任务。
如果仅要求起草说明或设置计划,则产出相应内容,并在配置或运行任何内容之前停止。设置机器人时不得执行维护。立即试运行与定时调度是两个独立选项。

1. Establish the destination and agent

1. 确定目标 instance 和 Agent

Start with the instance and agent choices, using answers already supplied:
  • Instance: show a clickable, verified Paperclip web URL and ask which instance to use. If none is known, ask for its URL; never assume localhost, the instance used in an earlier task, or the first connected tool.
  • Company: resolve the company within that instance; ask if ambiguous.
  • Agent: list accessible, suitable agents with names and links, and offer use an existing agent or create a new agent. Do not silently choose.
Example, after resolving the actual URL: “Use Paperclip, company Acme? Which agent should own this: an existing agent or a new one?”
For a new agent, resolve its name, harness/adapter, provider and model, AI connection/account, execution environment, reporting line, and budget. Present available compatible choices from the selected instance. Distinguish the AI connection from repository credentials. For an existing agent, inspect these settings and preserve them unless the requested maintenance needs an authorized change. Keep maintenance-specific instructions in the routine, not by replacing an existing agent's role.
Read references/paperclip-api.md for authentication, discovery, connection binding, hiring, and exact provisioning calls. If the API is unavailable or not working and browser access is available, use the selected instance's Paperclip UI to perform the same setup. Verify the instance and company, honor UI approval gates, and inspect the saved agent and routine after saving. Reconcile any partially completed API setup before creating through the browser so the fallback does not duplicate resources. Resolve access against the selected instance before collecting secrets or making writes.
先根据已提供的回答确定 instance 和 Agent 选项:
  • Instance: 显示一个可点击且已验证的 Paperclip Web URL,并询问要使用哪个 instance。如果尚不知晓任何 instance,则询问其 URL;绝不能擅自假定为 localhost、之前任务使用的 instance 或第一个连接的工具。
  • Company: 在该 instance 中确定 company;如果存在歧义,则询问。
  • Agent: 列出可访问且合适的 Agent,并附上名称和链接,提供使用现有 Agent或创建新 Agent选项。不得在未告知的情况下自行选择。
解析出实际 URL 后的示例:“使用 Paperclip,company Acme?这个任务应由哪个 Agent 负责:现有 Agent 还是新建 Agent?”
对于新 Agent,需要确定其名称、harness/adapter、provider 和 model、AI connection/account、执行环境、汇报关系和预算。展示所选 instance 中可用的兼容选项。明确区分 AI connection 与仓库凭据。对于现有 Agent,检查这些设置并予以保留,除非所请求的维护需要进行获得授权的变更。将维护专属说明保留在 routine 中,而不是替换现有 Agent 的职责。
阅读 references/paperclip-api.md,了解身份验证、资源发现、连接绑定、Agent 招聘及准确的配置调用。如果 API 不可用或无法正常工作,但可以使用浏览器,则通过所选 instance 的 Paperclip UI 执行相同设置。验证 instance 和 company,遵守 UI 审批关卡,并在保存后检查已保存的 Agent 和 routine。在转用浏览器创建之前,先核对并修正任何部分完成的 API 设置,避免回退方案重复创建资源。收集密钥或执行写入操作之前,先针对所选 instance 验证访问权限。

2. Resolve the maintenance contract

2. 确定维护约定

Ask only for missing choices; group related questions rather than presenting a long questionnaire. Discover actual projects and skills before offering them.
ChoiceResolve before activation
RepositoryProject, repository URL, target branch, execution workspace/environment
WorkMaintenance goal, exact skill/source, included areas and exclusions
TriggerTimer with local time and IANA timezone; webhook event/source; or manual/API
LimitsPer-run time/cost limit, maximum PRs per run, outstanding-PR cap
DeliveryPR target and reviewer/owner; draft or ready; required verification
LifecycleMonitor and revise PRs until checks pass; owner and continuation path for blocked work
“Every night” still needs a time and timezone. Propose a concrete time if useful, but do not infer one silently. A reasonable starting proposal is one coherent PR per run, a bounded timebox, no automatic merging, and no new work once the agreed outstanding-PR cap is reached. These are proposals, not fixed product limits.
Resolve the skill at a source the execution environment can actually read. A file in this chat's checkout is not proof it exists in a remote worker. Verify the committed target-branch path and all referenced resources, or install and assign the company skill. Record the chosen source/version policy. Never replace an unavailable requested skill with a loosely similar task silently.
仅询问尚缺失的选项;将相关问题分组,而不是抛出一长串问卷。在提供选项前,先查找实际可用的项目和 skill。
选项启用前需确定
仓库项目、仓库 URL、目标分支、执行工作区/环境
工作维护目标、准确的 skill/来源、纳入范围和排除项
触发器带本地时间和 IANA 时区的定时器;webhook 事件/来源;或手动/API
限制每次运行的时间/成本上限、每次运行最多创建的 PR 数、未结 PR 上限
交付PR 目标分支和审核人/负责人;草稿或就绪状态;必需的验证
生命周期监控并修订 PR,直到 checks 通过;受阻工作的负责人和后续处理路径
“每晚”仍需指定时间和时区。必要时可以提出一个具体时间,但不得默默推断。一个合理的初始方案是:每次运行生成一个内容连贯的 PR、采用有界 timebox、不自动合并,并在达到约定的未结 PR 上限后不再开始新工作。这些只是建议,并非固定的产品限制。
在执行环境实际可读取的来源处确定 skill。当前对话 checkout 中的文件并不能证明远程 worker 中存在该文件。验证已提交到目标分支的路径及所有引用资源,或安装并分配 company skill。记录所选的来源/版本策略。绝不能在不告知的情况下,用仅是相似的任务替代不可用的所请求 skill。

3. Prepare the configuration

3. 准备配置

Use references/run-instructions.md to write the complete routine description. It becomes the task given to the worker; “run maintenance” or a bare skill name is insufficient.
Inspect existing agents and routines to avoid duplicates. Match by company, repository, task/skill, and trigger; names alone are not identities. Reuse the requested agent. If an equivalent routine exists, show it and resolve whether to reuse or change it rather than creating another nightly job.
Show a compact summary with the instance link, agent choice, connection/harness, repository, skill, trigger/timezone, limits, PR behavior, and readiness gaps. Proceed within the user's existing setup authorization once choices are settled; ask only for unresolved choices or required product approvals. Draft-only scope never authorizes creation. Honor server approval gates without bypassing them.
使用 references/run-instructions.md 编写完整的 routine 描述。它会成为交给 worker 的任务;仅写“运行维护”或只提供 skill 名称是不够的。
检查现有 Agent 和 routine 以避免重复。按 company、仓库、任务/skill 和触发器进行匹配;不能仅凭名称判断身份。复用用户指定的 Agent。如果存在等效 routine,应展示它并确定是复用还是修改,而不是再创建一个每晚任务。
显示一份紧凑摘要,涵盖 instance 链接、Agent 选择、connection/harness、仓库、skill、触发器/时区、限制、PR 行为和就绪缺口。选项确定后,在用户已有的设置授权范围内继续;仅询问尚未确定的选项或必需的产品审批。仅处于草稿状态的范围绝不授权创建。遵守服务端审批关卡,不得绕过。

4. Provision, verify, and activate

4. 配置、验证并启用

Follow the API reference or equivalent browser UI in order: acquire authorized access, provision/reuse the agent, make the skill available, create the routine paused, add its trigger disabled, and read everything back. Record returned IDs as each step succeeds. Resume partial setup from those records; an ambiguous response is not a reason to blindly repeat creation.
Verify the agent is runnable and can use its selected connection, repository, skill, and PR credentials in the actual execution environment. A successful adapter probe alone does not prove Git push/PR permission. Keep the routine paused if a hire approval, credential, workspace, or skill is unresolved. Do not change shared project defaults just to make this bot work.
Enable the trigger and activate the routine only when readiness and scheduling authorization are established. Use Paperclip's routine trigger as the clock; do not add a second agent timer or a desktop automation for the same work. Run a maintenance trial only if requested. Read back the saved schedule and next run time; distinguish configured scheduling from an observed successful run.
按照 API 参考文档或等效的浏览器 UI 依次执行:获取授权访问、配置或复用 Agent、确保 skill 可用、以暂停状态创建 routine、以禁用状态添加触发器,然后回读并核验全部已保存配置。每一步成功后记录返回的 ID。根据这些记录从部分完成的设置处继续;响应不明确并不能成为盲目重复创建的理由。
验证 Agent 可运行,并能在实际执行环境中使用所选 connection、仓库、skill 和 PR 凭据。仅成功探测 adapter 并不能证明具备 Git push/PR 权限。如果 Agent 审批、凭据、工作区或 skill 尚未解决,则保持 routine 暂停。不要为了让机器人运行而更改共享项目默认设置。
只有在就绪状态和调度授权均已确立后,才能启用触发器并激活 routine。将 Paperclip 的 routine trigger 作为时钟;不要为同一工作再添加第二个 Agent 定时器或桌面自动化。仅在用户要求时运行维护试运行。回读已保存的调度计划和下次运行时间;应区分“已配置调度”与“已观察到成功运行”。

5. Hand off

5. 交付结果

Return links to the instance, agent, routine, and project; the selected skill; the trigger and timezone; active/paused state; limits and PR policy; readiness evidence and remaining gaps. If trialed, link the run issue and resulting PR or no-change result. Explain how to pause the routine and which owner handles follow-up. Never report a draft, pending hire, or paused routine as running.
返回 instance、Agent、routine 和项目的链接;所选 skill;触发器和时区;启用/暂停状态;限制和 PR 策略;就绪证据及剩余缺口。如果进行了试运行,提供运行 issue 及生成的 PR 或无变更结果的链接。说明如何暂停 routine,以及由哪个负责人处理后续事项。绝不能把草稿、待审批的新聘 Agent 或已暂停的 routine 报告为正在运行。