agent-oss-contribute

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent 开源贡献全流程

Agent Open Source Contribution Full Workflow

面向 Agent / LLM / MCP 类开源仓库的一条流水线,六个阶段。用户没点名时,从当前对话能判断走到哪一步,就只做那一步;不要搜完项目自动改代码,也不要没方案就提 PR,也不要提完 PR 自动写总结。
回复语言跟随用户;用户未指定时默认中文。技术专有名词保留英文。只输出当前阶段规定的结构。
A six-phase pipeline for Agent / LLM / MCP open-source repositories. When the user doesn't specify a phase, infer it from the current conversation and run only that phase; don't search a project and auto-edit code, don't open a PR without a plan, and don't auto-write a summary after a PR.
Response language follows the user; default to Chinese if not specified. Keep technical terms in English. Output only the structure required for the current phase.

阶段路由

Phase Routing

用户在做什么进入先读
搜可贡献项目 / 找开源仓库 / 没给
REPO_URL
但想贡献
阶段 0 发现references/discover.md
给了
REPO_URL
/ 找 PR 方向 / Issue 筛选 / 架构缺陷
阶段 1 分析references/analysis.md 和 references/architecture-dimensions.md
从 Top 3 里选定一条 / 要技术方案 / 问题边界 / 实现步骤阶段 2 方案references/design.md
粘贴了选定方案并要落地 / 技术方案实现 / 先定义接口阶段 3 落地references/implementation.md
提交 PR / 开 PR / 按 feat/fix 发 PR阶段 4 提 PRreferences/pull-request.md
产出 PR 总结 / 已提 PR 复盘 / 给了 PR 地址或之前提过的项目阶段 5 总结references/summary.md
一次只跑一个阶段,跑完停下来等用户。用户明确说「一次做完」时:无
REPO_URL
先阶段 0 并停下让用户选仓库;有
REPO_URL
才从阶段 1 往后走,且阶段 2 的方案仍要先给用户看过。阶段 5 不随「一次做完」自动跑,除非用户同时要求总结。
缺关键输入就问,不要用虚构仓库或虚构方案硬跑。
What the user is doingEnterRead first
Searching for contributable projects / looking for open-source repos / no
REPO_URL
but wants to contribute
Phase 0 Discoveryreferences/discover.md
Provided
REPO_URL
/ looking for PR direction / issue triage / architecture flaws
Phase 1 Analysisreferences/analysis.md and references/architecture-dimensions.md
Picked one from Top 3 / wants technical plan / problem scope / implementation stepsPhase 2 Designreferences/design.md
Pasted the selected plan and wants implementation / technical solution implementation / define interfaces firstPhase 3 Implementationreferences/implementation.md
Submitting PR / open PR / sending PR with feat/fixPhase 4 Pull Requestreferences/pull-request.md
Producing PR summary / reviewing submitted PR / given PR URL or previously mentioned projectPhase 5 Summaryreferences/summary.md
Run only one phase at a time, then stop and wait for the user. When the user explicitly says "do it all in one go": without
REPO_URL
, run Phase 0 first and stop for the user to pick a repo; with
REPO_URL
, proceed from Phase 1 onward, and the Phase 2 plan must still be reviewed by the user first. Phase 5 is not auto-run with "do it all in one go" unless the user also asks for a summary.
Ask for missing key inputs; don't force-run with fabricated repos or plans.

共用输入

Shared Inputs

字段说明
REPO_URL
GitHub 仓库 URL;阶段 0 不需要
PR_URL
GitHub PR URL(
.../pull/N
);阶段 5 优先用它定位项目
LOCAL_PATH
本地仓库根;缺省用当前任务工作目录(本仓库 evals 未指定时 clone 到仓库根
test/
)
ARTIFACT_ROOT
中间产物根目录;缺省为
<当前任务工作目录>/artifacts
(本仓库 evals 时即
<仓库根>/test/artifacts
)
技术栈未给则用:Python、TypeScript、React、MCP 集成、LangChain.js
目标周期未给则用:2 周
当前任务工作目录:本阶段开始时进程的工作目录(cwd / workspace root)。不绑定任何特定编辑器或 Agent 产品;用户显式给出
ARTIFACT_ROOT
时以用户为准。
本仓库跑 skill 测试 /
evals/
时:工作目录、fixture、以及未给出
LOCAL_PATH
时的 clone 目标,均为技能集合仓库根下的
test/
(已 gitignore,不要提交其中内容)。日常使用仍以用户 cwd /
LOCAL_PATH
/
ARTIFACT_ROOT
为准。
阶段 1–4 工作目录必须是目标仓库。阶段 3、4 禁止改别的 repo。阶段 5 不要求切到目标仓库,且禁止改任何仓库代码。
FieldDescription
REPO_URL
GitHub repo URL; not needed for Phase 0
PR_URL
GitHub PR URL (
.../pull/N
); Phase 5 uses it to locate the project first
LOCAL_PATH
Local repo root; default is the current task working directory (in this repo's evals, clone to repo root
test/
when unspecified)
ARTIFACT_ROOT
Artifact root directory; default is
<current task working directory>/artifacts
(in this repo's evals,
<repo root>/test/artifacts
)
Tech stackIf not given, use: Python, TypeScript, React, MCP integration, LangChain.js
Target cycleIf not given, use: 2 weeks
Current task working directory: the process working directory at the start of this phase (cwd / workspace root). Not tied to any specific editor or Agent product; if the user explicitly provides
ARTIFACT_ROOT
, use theirs.
When running skill tests /
evals/
in this repo: the working directory, fixtures, and clone target when
LOCAL_PATH
is not given are all under
test/
in the skill collection repo root (gitignored, don't commit its contents). Daily use follows user's cwd /
LOCAL_PATH
/
ARTIFACT_ROOT
.
Phases 1–4 must run in the target repo working directory. Phases 3 and 4 must not modify other repos. Phase 5 doesn't require switching to the target repo and must not modify any repo code.

中间产物落盘

Artifact Persistence

每个阶段在回复用户的同时,必须把该阶段完整输出写入
ARTIFACT_ROOT
(默认
<当前任务工作目录>/artifacts
;本仓库 evals 时为
<仓库根>/test/artifacts
)。聊天输出与落盘内容一致;先写文件再结束本阶段。路径一律相对
ARTIFACT_ROOT
书写与落盘;回复用户时可附绝对路径方便打开。
阶段相对
ARTIFACT_ROOT
的路径
规则
0 发现
search/<YYYYMMDD-HHMMSS>.md
每次搜索新建一个文件,文件名用执行时刻本地时间
1 分析
project/<owner>-<repo>/analysis.md
项目目录不存在则创建;已有则覆盖
2 方案
project/<owner>-<repo>/design.md
同上
3 落地
project/<owner>-<repo>/implementation.md
同上(改动摘要 + 提交计划 + 验证结果)
4 提 PR
project/<owner>-<repo>/pull-request.md
同上(标题、正文草稿、最终 PR URL)
5 总结
summary/<owner>-<repo>/<pr名>.md
项目目录不存在则创建;同一 PR 再跑则覆盖
  • <owner>-<repo>
    取自
    REPO_URL
    (如
    https://github.com/langchain-ai/langchainjs
    →
    langchain-ai-langchainjs
    )。
  • <pr名>
    规则见 references/summary.md(优先
    {number}-{slug}
    )。
  • 阶段 1–4 的产物只写在对应
    project/
    目录下,不要写到别的项目文件夹。
  • 阶段 0 只写
    search/
    ,不要在
    project/
    下建目录。
  • 阶段 5 只写
    summary/
    ,不要覆盖
    project/
    里的中间产物。
  • 禁止写死某台机器的绝对路径(如
    /Users/...
    );禁止写死某产品专用目录。
  • 落盘失败(权限/路径不存在)时:先建缺的目录再写;仍失败则把错误告诉用户,不要假装已保存。
Each phase, while replying to the user, must write the full output of this phase to
ARTIFACT_ROOT
(default
<current task working directory>/artifacts
; in this repo's evals
<repo root>/test/artifacts
). Chat output and saved content must match; write the file before ending the phase. All paths are written and saved relative to
ARTIFACT_ROOT
; you may include absolute paths in replies for convenience.
PhasePath relative to
ARTIFACT_ROOT
Rule
0 Discovery
search/<YYYYMMDD-HHMMSS>.md
Create a new file per search; filename uses local time at execution
1 Analysis
project/<owner>-<repo>/analysis.md
Create project directory if missing; overwrite if exists
2 Design
project/<owner>-<repo>/design.md
Same as above
3 Implementation
project/<owner>-<repo>/implementation.md
Same (change summary + commit plan + verification results)
4 Pull Request
project/<owner>-<repo>/pull-request.md
Same (title, draft body, final PR URL)
5 Summary
summary/<owner>-<repo>/<pr-name>.md
Create project directory if missing; overwrite if same PR rerun
  • <owner>-<repo>
    is derived from
    REPO_URL
    (e.g.
    https://github.com/langchain-ai/langchainjs
    →
    langchain-ai-langchainjs
    ).
  • <pr-name>
    rules see references/summary.md (prefer
    {number}-{slug}
    ).
  • Artifacts for Phases 1–4 are written only in the corresponding
    project/
    directory, not in other project folders.
  • Phase 0 writes only to
    search/
    , don't create directories under
    project/
    .
  • Phase 5 writes only to
    summary/
    , don't overwrite intermediate artifacts in
    project/
    .
  • Don't hardcode machine-specific absolute paths (e.g.
    /Users/...
    ); don't hardcode product-specific directories.
  • If persistence fails (permission/path missing): create missing directories first then write; if it still fails, tell the user the error, don't pretend it was saved.

阶段门闩

Phase Gates

  • 0 → 1:用户从发现结果里选了一个仓库(或自己给了
    REPO_URL
    )。
  • 1 → 2:用户点了分析 Top 3 中的一条,或自己给出等价方向。
  • 2 → 3:方案里的选定方案、问题边界、成功标准、文件清单、实现步骤已经齐,且用户确认可以落地。
  • 3 → 4:代码已按方案落地并验证过;用户明确说提交 / 开 PR。未要求时不要
    git commit
    /
    push
    /
    gh pr create
    。
  • 4 → 5:用户明确要总结,或给出已提 PR 的项目 /
    PR_URL
    。阶段 4 结束后不要自动写 summary。阶段 5 可从新会话直接进入,不要求本会话跑过 0–4。
  • 0 → 1: The user selected a repo from discovery results (or provided their own
    REPO_URL
    ).
  • 1 → 2: The user picked one from the analysis Top 3, or gave an equivalent direction.
  • 2 → 3: The selected plan, problem scope, success criteria, file list, and implementation steps are complete, and the user confirmed implementation.
  • 3 → 4: Code has been implemented and verified according to the plan; the user explicitly says commit / open PR. Don't
    git commit
    /
    push
    /
    gh pr create
    unless asked.
  • 4 → 5: The user explicitly asks for a summary, or provides the submitted PR project /
    PR_URL
    . Don't auto-write a summary after Phase 4. Phase 5 can be entered directly from a new session; it doesn't require Phases 0–4 in the same session.

硬约束

Hard Constraints

  • 阶段 0 必须跑
    scripts/discover_repos.py
    ,禁止用记忆编造仓库榜;必须传
    --artifact-root
    与
    --user-language
    ;用户口头过滤条件必须译成脚本参数。项目描述必须用用户语言,覆盖做什么 / 解决的问题 / 适用场景;下载量、使用分、排名以脚本为准,禁止改排名或编造用量。
  • 每阶段结束必须落盘(见「中间产物落盘」),禁止只回复不写文件。
  • 先读该仓库的真实文件和 Issue,再用训练记忆。路径用仓库内相对路径。
  • 贡献范围必须能在约 2 周内完成,禁止「重写编排层」这类方向。
  • 阶段 3、4:最小侵入、向后兼容、风格与仓库一致;新第三方依赖必须先问用户。阶段 5 不改代码。
  • 阶段 4 的 commit type 只用:
    feat
    /
    fix
    /
    refactor
    /
    test
    /
    docs
    。
  • 阶段 4 的 PR body:禁止自造 checklist /
    Test plan
    ,禁止追加任何 AI/编辑器署名 footer。
  • 阶段 5:star 数、PR 正文、中间产物必须来自
    gh
    或
    ARTIFACT_ROOT
    已存文件;禁止编造分析来源与仓库数据。
  • Phase 0 must run
    scripts/discover_repos.py
    , and is forbidden from fabricating repo rankings from memory; must pass
    --artifact-root
    and
    --user-language
    ; user verbal filters must be translated into script parameters. Project descriptions must be in the user's language, covering what it does / problems solved / applicable scenarios; downloads, usage scores, and rankings come from the script, and rankings or usage must not be fabricated.
  • Each phase must persist artifacts (see "Artifact Persistence"); no replies without writing files.
  • Read the repo's real files and Issues first, then use training memory. Use repo-relative paths.
  • Contribution scope must be completable in about 2 weeks; directions like "rewrite the orchestration layer" are forbidden.
  • Phases 3, 4: minimal intrusion, backward compatible, consistent with repo style; new third-party dependencies must be asked first. Phase 5 doesn't change code.
  • Phase 4 commit types only:
    feat
    /
    fix
    /
    refactor
    /
    test
    /
    docs
    .
  • Phase 4 PR body: forbidden to fabricate checklist /
    Test plan
    , forbidden to append any AI/editor attribution footer.
  • Phase 5: star counts, PR body, and artifacts must come from
    gh
    or files already stored in
    ARTIFACT_ROOT
    ; don't fabricate analysis sources or repo data.