SWE-CC
收藏资源简介:
SWE-CC 是一个基准,用于衡量编码智能体在解决真实问题时是否遵循仓库贡献政策,包括代码和测试风格、测试工作流、提交和拉取请求约定、AI 辅助披露等。它包含来自 12 个 SWE-bench Verified 仓库贡献者文档的 823 条政策,每条政策都被编译为确定性检查函数;还包含基于 SWE-bench Verified 构建的 500 个端到端贡献任务,要求修复问题、提交并撰写拉取请求。该基准支持 Native 和 Consolidated 两种政策提供设置,并可与任意智能体配合使用。
SWE-CC 数据集概述
基本信息
- 名称:Correct Code, Broken Contributions? SWE-CC: Benchmarking Repository Policy Compliance for Coding Agents
- 数据集详情页:
https://github.com/dangtruong01/swe-cc-arxiv - 论文 PDF:
https://github.com/dangtruong01/swe-cc-arxiv/raw/main/paper/SWE-CC.pdf - 许可证:代码采用 MIT License(
https://github.com/dangtruong01/swe-cc-arxiv/blob/main/LICENSE);rules/下政策文本和原始来源引用各项目贡献者文档,并保留在各项目许可证下;任务源自 SWE-bench Verified。 - 关键词:coding agents、software engineering benchmarks、repository policies、contribution compliance。
目标与检查范围
- SWE-CC 衡量 coding agents 在解决真实 issue 时是否遵循仓库贡献政策。
- 贡献政策包括:代码与测试风格、测试工作流、提交与 pull-request 约定、AI 辅助披露。
- 检查对象包括 agent 的轨迹,以及 agent 交付的 commits、patches、pull-request 文本。
数据规模与构成
- 823 条政策,来自 12 个 SWE-bench Verified 仓库的贡献者文档。
- 每条政策编译为确定性 checker function,评分时无 LLM judge。
- 500 个端到端贡献任务,基于 SWE-bench Verified:修复 issue、commit、写 pull request。
- 两种政策提供设置:
- Native:agent 被指向项目文档,必须自行找到政策。
- Consolidated:政策作为单个文件挂载到容器中。
- 支持任意 agent:为 mini-SWE-agent 和 OpenHands 提供现成 runners;其他 agent 可使用普通 JSON trajectory 格式。
主要结果
| Agent scaffold | Native resolve | Native compliance | Consolidated resolve | Consolidated compliance |
|---|---|---|---|---|
| mini-SWE-agent | 81.7% | 55.7% | 81.4% | 64.4% |
| OpenHands | 83.9% | 58.2% | 83.1% | 67.0% |
- 结果在四个评估模型上平均。
- 当前 agents 解决大多数任务,但满足的适用仓库政策明显更少。
- 直接提供政策可提高 compliance,但最佳平均 compliance rate 仍为 67.0%。
- Native 提供治理政策文档位置并要求 agent 检索;Consolidated 直接提供提取后的政策。
- 完整模型级结果见论文,可用
python paper/make_tables.py --only table3从发布结果重新生成。
可复现内容
- 在新 agent 上运行 benchmark:包含 tasks、policy corpora、checker code、tests、prompt additions、runner configurations;quick start 可评分一个完整示例轨迹。
- 重新计算论文结果表和数据衍生图:
paper/results/包含 8,000 次实验运行的结果,包括 709,376 条 per-policy verdicts;命令和文件格式见https://github.com/dangtruong01/swe-cc-arxiv/blob/main/paper/README.md。 - 重复实验:包含 scaffold setup、模型配置模板、sweep scripts;重复全部运行需要模型服务、Docker、SWE-bench images 以及大量时间和计算。
未包含内容与限制
- 8,000 条完整历史轨迹未包含。
- 导出的结果支持重算论文聚合结果,但不能独立重新评分每个历史 agent 动作。
- 一个完整示例轨迹包含在
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/examples/。 - 独立 checker-audit ratings 不在本 release 中;论文描述了验证过程与结果。
安装与快速开始
Python 3.11。
bash python3.11 -m venv .venv && source .venv/bin/activate pip install -r requirements.txt -e . pytest -q
- 安装
swe-cc命令,等同于python -m compliance。 - 需要 editable mode(
-e),因为 checkers 从 package 旁的rules/读取 policy corpora。 - 评分仅使用标准库;
requirements.txt固定 test 和 plotting 依赖。
快速开始:
bash scripts/quickstart.sh
- 对
examples/中一个已存 agent run 按 SymPy 的 142 条政策评分,并检查 verdicts 是否与存储值一致。 - 打印一个任务的 task-prompt additions,并汇总 results 目录。
- 首次需要网络克隆 SymPy git history(blobless,约 70 MB),以便 checkers 重建 agent 修改的文件。
评分运行与指标
bash swe-cc check <trajectory.json> --project sympy --setting native --jsonl rows.jsonl swe-cc retrieval <trajectory.json> --project sympy
每个政策有一个 outcome:
| outcome | 含义 |
|---|---|
pass / fail |
政策适用于 agent 工作,并满足或违反 |
not_triggered |
agent 工作未使该政策进入范围 |
withheld |
政策适用,但运行缺少判断证据(例如文件无法解析) |
- Triggering rate = (pass + fail + withheld) / all policies
- Compliance rate = pass / (pass + fail)
- 应同时报告两个指标;做得更少的 agent 触发更少政策,可能看起来更合规。
评估自己的 agent
- 任意 agent:运行
data/tasks.jsonl中任务,加入scripts/render_task.py的 prompt 文本;agent 开始前运行harness/probe.sh,结束后运行harness/collect.sh,并将每次运行写成 plain JSON trajectory;用swe-cc check run.json --scaffold own-agent --project <name>评分;完整协议见https://github.com/dangtruong01/swe-cc-arxiv/blob/main/docs/evaluate-your-agent.md。 - mini-SWE-agent 或 OpenHands:每个都有一个脚本串起 agent run → functional grading(SWE-bench harness)→ compliance grading → summary。
bash frameworks/setup.sh all cp models/gpt-5.6-luna.conf models/my-model.conf MODELS=my-model CASES=sweeps/smoke.txt sweeps/run_mini_swe_agent.sh MODELS=my-model sweeps/run_mini_swe_agent.sh MODELS=my-model sweeps/run_openhands.sh
- 需要 Docker、SWE-bench images(按需拉取)和模型提供方 API key。
- Runs 输出到
runs/,结果到results/:runs.csv、verdicts.csv.gz、policies.csv。 - 重跑脚本会从停止处继续。
- 汇总 results 目录:
bash python scripts/summarize.py results python scripts/summarize.py results --by category
基准目录内容
| 路径 | 内容 |
|---|---|
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/rules/<prefix>/ |
每个项目的政策语料库:分类工作簿、冻结提取、来源清单、原始来源、运行日志、CONTRIBUTING_RULES.md(Consolidated-setting 文件) |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/compliance/ |
Checker functions(https://github.com/dangtruong01/swe-cc-arxiv/tree/main/compliance/rules/<prefix>/)和评分库:evidence bundles、trajectory adapters、metrics |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/tests/ |
Unit tests,包含每个 checker 的 satisfied / violated / not-triggered 案例 |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/data/ |
500 个任务(https://github.com/dangtruong01/swe-cc-arxiv/blob/main/data/tasks.jsonl)和 task-prompt additions(https://github.com/dangtruong01/swe-cc-arxiv/tree/main/data/prompts/) |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/harness/ |
在 agent 容器内运行的 probe 和 collect scripts |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/frameworks/ |
mini-SWE-agent 和 OpenHands runners,以及 own-agent adapter config |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/models/ |
模型配置(论文使用的四个作为模板) |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/sweeps/ |
任务列表(全部 500;1-task smoke test)和每个 scaffold 一个脚本 |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/tools/ |
批量 compliance scoring、functional re-grading、corpus acceptance checks |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/scripts/ |
quickstart.sh、render_task.py、export_results.py、summarize.py |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/examples/ |
一个完整 agent run 及其预期 verdicts |
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/paper/ |
论文实验相关内容 |
https://github.com/dangtruong01/swe-cc-arxiv/blob/main/DATASHEET.md |
Composition、collection、intended use 和 limitations |
项目前缀映射
| prefix | project |
|---|---|
astropy |
astropy |
django |
django |
matplotlib |
matplotlib |
scikit-learn |
scikit-learn |
mwaskom |
seaborn |
pallets |
flask |
psf |
requests |
pydata |
xarray |
pylint-dev |
pylint |
pytest-dev |
pytest |
sphinx-doc |
sphinx |
sympy |
sympy |
政策提取与扩展
- 提取程序与 rubrics 先用 Django 和 SymPy 开发,之后应用于其他十个仓库。
- Django 和 SymPy 的最终分类工作簿、政策文件、checkers 已包含。
- 标准化 source manifests、frozen extraction files、raw-source bundles、run logs 记录其他十个仓库的后续自动处理;这四类文件不适用于 Django 或 SymPy。
- 扩展到新仓库:政策提取流程位于
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/rule-extraction/,包括 workflow、launcher prompt、两个 labelling rubrics、source-discovery script。 tools/corpus.py和tools/audit_rules.py检查新 corpus。- Checkers 按
https://github.com/dangtruong01/swe-cc-arxiv/blob/main/docs/checker-authoring.md编写;tools/scaffold_checkers.py从 corpus 生成 stubs。 - 仓库由
rules/<prefix>/repo.conf加 corpus、compliance/rules/下 checker package、compliance/cli.py中RULE_MODULES条目组成。
论文复现
https://github.com/dangtruong01/swe-cc-arxiv/tree/main/paper/ 保存论文 8,000 次运行的导出结果(四模型、两 scaffold、两 setting)和再生结果衍生表/图脚本。
引用
bibtex @misc{dang2027swecc, title = {Correct Code, Broken Contributions? {SWE-CC}: Benchmarking Repository Policy Compliance for Coding Agents}, author = {Dang, Truong Hai and Goh, Rayner and Le-Cong, Thanh and Huo, Yintong}, year = {2027}, url = {https://github.com/dangtruong01/swe-cc-arxiv} }





