Skip to content
This repository was archived by the owner on Jul 4, 2026. It is now read-only.

Commit 9016b9e

Browse files
committed
feat: add workflow governance and audit toolchain
Introduce manifest-driven workflow gating, new solution audit capabilities, and stress profile execution fixes while aligning docs/tests with the expanded 20-tool surface. Made-with: Cursor
1 parent 7bee0c2 commit 9016b9e

44 files changed

Lines changed: 1350 additions & 212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dmypy.json
5050
.claude/
5151
.codex/
5252
.opencode/
53+
.cursor/
5354

5455
# Project specific
5556
*.exe

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Features
11+
12+
- 新增题目契约 `autocode.json`(manifest)与 `src/autocode_mcp/workflow/` 读写模型,`problem_create` 自动初始化 manifest 与 `tutorial.md` 草稿。
13+
- `workflow_guard.py` 重构为表驱动门禁,补充 `problem_verify_tests``interactor_build``solution_analyze``validator_select` 的流程约束,并识别交互题路径。
14+
- 新增审计工具:
15+
- `solution_audit_std`
16+
- `solution_audit_brute`
17+
- `solution_analyze` 增强输出:`claimed_complexity`、worst/average、`memory_estimate``risk_notes``recommended_stress_params`
18+
- `stress_test_run` 支持 `stress_profiles` 多轮对拍配置并返回 profile 报告。
19+
- `problem_verify_tests` 支持 `wrong_solution_kill` 检查类型,验证错解是否被测试点杀掉。
20+
- 新增 CLI:`autocode-verify`,用于快速校验题目 manifest 基础完整性。
21+
- 新增验证技能与只读审计 Agent:
22+
- skills: `idea-feasibility``solution-complexity-audit``stress-strategy``testdata-quality``statement-audit`
23+
- agents: `autocode-idea-auditor``autocode-solution-auditor``autocode-package-auditor`
24+
- 新增 `examples/` 下三个金样例目录:`exact-sample``checker-sample``interactive-sample`
25+
826
## [0.9.0] - 2026-04-29
927

1028
### Features

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ AutoCode/
5757
| solution_build | 构建解法 |
5858
| solution_run | 执行解法 |
5959
| solution_analyze | 分析解法复杂度 |
60+
| solution_audit_std | 审计标准解实现质量 |
61+
| solution_audit_brute | 审计暴力解实现质量 |
6062
| validator_build | 构建校验器 |
6163
| validator_select | 选择最佳校验器 |
6264
| generator_build | 构建生成器 |
@@ -66,6 +68,7 @@ AutoCode/
6668
| stress_test_run | 压力测试 |
6769
| problem_create | 初始化题目 |
6870
| problem_generate_tests | 生成测试数据 |
71+
| problem_cleanup_processes | 清理生成残留进程 |
6972
| problem_verify_tests | 验证测试数据质量 |
7073
| problem_validate | 验证题面样例 |
7174
| problem_pack_polygon | 打包为 Polygon 格式 |

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
**基于论文《AutoCode: LLMs as Problem Setters for Competitive Programming》实现的竞赛编程出题辅助 MCP Server。**
99

10-
AutoCode MCP Server 提供 15 个原子工具,让 AI 助手能够创建、验证和测试竞赛编程题目。它负责编译、执行、压力测试和测试数据生成——让 AI 专注于题目设计和解法逻辑。
10+
AutoCode MCP Server 提供 20 个原子工具,让 AI 助手能够创建、验证和测试竞赛编程题目。它负责编译、执行、压力测试和测试数据生成——让 AI 专注于题目设计和解法逻辑。
1111

1212
## 特性
1313

1414
- **Validator-Generator-Checker 框架** — 基于论文实现输入正确性自动验证、多策略测试生成和输出验证
15-
- **15 个原子工具** — 文件操作、解法构建、压力测试、校验器/生成器/检查器构建等
15+
- **20 个原子工具** — 文件操作、解法构建、复杂度分析、解法审计、压力测试、题目校验与打包等
1616
- **testlib.h 支持** — 完整集成竞赛编程标准库,用于校验器、生成器和检查器
1717
- **多策略生成** — 四种生成策略:tiny(穷举)、random(随机)、extreme(边界情况)、tle(诱导超时)
1818
- **压力测试** — 自动比较最优解和暴力解,可配置测试轮数
@@ -181,11 +181,11 @@ Claude 将使用 AutoCode 工具:
181181

182182
### 验证安装
183183

184-
配置完成后,重启 MCP 客户端并检查工具是否可用。你应该能看到 15 个工具,包括 `solution_build``validator_build``generator_build` 等。
184+
配置完成后,重启 MCP 客户端并检查工具是否可用。你应该能看到 20 个工具,包括 `solution_build``solution_audit_std``problem_verify_tests``problem_cleanup_processes` 等。
185185

186186
## 工具参考
187187

188-
AutoCode 提供 15 个原子工具,分为 7 组。所有工具返回统一格式:
188+
AutoCode 提供 20 个原子工具,分为 8 组。所有工具返回统一格式:
189189

190190
```json
191191
{
@@ -208,6 +208,9 @@ AutoCode 提供 15 个原子工具,分为 7 组。所有工具返回统一格
208208
|------|------|----------|
209209
| `solution_build` | 编译解法代码 | `problem_dir`, `solution_type` ("sol"/"brute"), `code` |
210210
| `solution_run` | 执行已编译的解法 | `problem_dir`, `solution_type`, `input_data`, `timeout` |
211+
| `solution_analyze` | 分析解法复杂度与风险 | `problem_dir`, `solution_type`, `claimed_complexity` |
212+
| `solution_audit_std` | 审计标准解正确性与质量 | `problem_dir`, `source_path/code`, `constraints` |
213+
| `solution_audit_brute` | 审计暴力解可作为对拍基准 | `problem_dir`, `source_path/code`, `constraints` |
211214

212215
### 校验器工具
213216

@@ -246,8 +249,10 @@ AutoCode 提供 15 个原子工具,分为 7 组。所有工具返回统一格
246249
| 工具 | 描述 | 关键参数 |
247250
|------|------|----------|
248251
| `problem_create` | 初始化题目目录 | `problem_dir`, `problem_name` |
252+
| `problem_validate` | 验证题面样例与答案一致性 | `problem_dir`, `statement_path`, `sol_name` |
249253
| `problem_generate_tests` | 生成最终测试数据(最终数据集中 extreme/tle 至少占一半,候选不足时尽量满足) | `problem_dir`, `test_count`, `answer_ext`, `resume`, `hard_timeout_seconds` |
250254
| `problem_verify_tests` | 验证测试数据质量(含 extreme/tle 占比硬校验) | `problem_dir`, `tests_dir`, `verify_types` |
255+
| `problem_cleanup_processes` | 清理生成任务残留进程与状态 | `problem_dir`, `kill_all_generators` |
251256
| `problem_pack_polygon` | 打包为 Polygon 格式 | `problem_dir`, `time_limit`, `memory_limit` |
252257

253258
## 工作流教程:A+B 问题

agents/autocode-idea-auditor.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: autocode-idea-auditor
3+
description: Readonly auditor for problem idea feasibility and verification readiness.
4+
skills:
5+
- idea-feasibility
6+
model: inherit
7+
---
8+
9+
你是只读审计 Agent,不负责写代码。
10+
11+
职责:
12+
13+
1. 审核题意是否可判定、可验证、可生成可复现数据。
14+
2. 列出阻塞问题与必须补充的约束。
15+
3. 给出进入实现前的最小前置清单。
16+
17+
输出要求:
18+
19+
- 第一行给 `decision: go|no_go`
20+
-`blocking_issues``required_clarifications``next_actions` 三段输出。
21+
- 每条问题都要给“为什么会阻塞”。
22+
- 不给代码实现建议,只给约束与流程建议。

agents/autocode-package-auditor.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: autocode-package-auditor
3+
description: Readonly auditor before packaging, checks statement, tests, wrong solutions, and manifest consistency.
4+
skills:
5+
- statement-audit
6+
- testdata-quality
7+
model: inherit
8+
---
9+
10+
你是打包前只读审计 Agent。
11+
12+
职责:
13+
14+
1. 检查题面/题解/样例与 `sol` 一致性。
15+
2. 检查最终测试数据质量与错解杀伤。
16+
3. 仅当验证通过时建议进入 `problem_pack_polygon`
17+
18+
输出要求:
19+
20+
- 必须给出 `decision: go|no_go` 结论。
21+
- `decision=no_go` 时列出阻塞项与最短修复路径。
22+
- `decision=go` 时附上已满足的验证证据清单(validate/verify/tests)。
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: autocode-solution-auditor
3+
description: Readonly auditor for std/brute complexity and stress strategy.
4+
skills:
5+
- solution-complexity-audit
6+
- stress-strategy
7+
model: inherit
8+
---
9+
10+
你是只读审计 Agent,不直接改代码。
11+
12+
职责:
13+
14+
1. 审核 std 与 brute 的正确性假设和复杂度风险。
15+
2. 基于 brute 能力建议多轮对拍参数。
16+
3. 输出结构化风险报告与后续 MCP 调用建议。
17+
18+
输出要求:
19+
20+
- 第一行给 `decision: go|no_go`
21+
- 必须引用 `solution_analyze``solution_audit_std``solution_audit_brute` 结论。
22+
- 风险按严重度排序:`critical` / `major` / `minor`
23+
- 明确给出下一步 `stress_test_run` 参数建议(可直接执行)。

agents/autocode-workflow.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: autocode-workflow
33
description: Coordinates AutoCode problem creation and enforces the full validator-generator-checker workflow. Use proactively for any competitive programming problem-setting task.
44
skills:
55
- autocode-workflow
6+
- idea-feasibility
7+
- solution-complexity-audit
8+
- stress-strategy
9+
- statement-audit
10+
- testdata-quality
611
model: inherit
712
---
813

@@ -18,10 +23,12 @@ Always work through this sequence unless the task is explicitly outside problem
1823
4. `validator_build`
1924
5. `generator_build`
2025
6. `stress_test_run`
21-
7. `checker_build` when the problem requires a non-exact checker
22-
8. `problem_validate`
23-
9. `problem_generate_tests`
24-
10. `problem_pack_polygon`
26+
7. `problem_validate`
27+
8. `checker_build` when the problem requires a non-exact checker (non-interactive)
28+
9. `interactor_build` when the problem is interactive
29+
10. `problem_generate_tests`
30+
11. `problem_verify_tests`
31+
12. `problem_pack_polygon`
2532

2633
When the user asks for a later step directly, explain which prerequisite step is missing and complete the missing work first.
2734

@@ -30,3 +37,14 @@ When running `problem_generate_tests`, enforce test quality: final test data sho
3037
For long-running `problem_generate_tests`, warn that new user messages can interrupt MCP execution. If interrupted, prefer resuming with checkpoint (`resume=true`) rather than restarting from scratch.
3138

3239
Treat hook feedback as authoritative. If a hook denies a tool call, fix the workflow gap instead of retrying the same call.
40+
41+
Use auditor agents when needed:
42+
- `autocode-idea-auditor` before major implementation
43+
- `autocode-solution-auditor` after std/brute are available
44+
- `autocode-package-auditor` before final packaging
45+
46+
Execution style requirements:
47+
- Always report current completed step and next required step.
48+
- Prefer MCP structured results over assumptions from file presence.
49+
- If any gate fails, stop progression and provide a fix-first plan.
50+
- Use the unified decision contract in status summaries: `decision=go|no_go`, `blocking_issues`, `next_actions`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"schema_version": "1.0",
3+
"problem_name": "Checker Sample",
4+
"interactive": false,
5+
"time_limit_ms": 2000,
6+
"memory_limit_mb": 256,
7+
"statement_path": "statements/README.md",
8+
"tutorial_path": "statements/tutorial.md",
9+
"solutions": [
10+
{"name": "sol", "role": "main", "language": "cpp", "path": "solutions/sol.cpp"},
11+
{"name": "brute", "role": "brute", "language": "cpp", "path": "solutions/brute.cpp"},
12+
{"name": "wrong-greedy", "role": "wrong", "language": "cpp", "path": "solutions/wrong-greedy.cpp", "expected": "fail"}
13+
],
14+
"case_plan": [
15+
{"name": "tiny-1", "type": "1", "seed": 1, "group": "sanity"},
16+
{"name": "random-1", "type": "2", "seed": 2, "group": "coverage"},
17+
{"name": "extreme-1", "type": "3", "seed": 3, "group": "limit"},
18+
{"name": "tle-1", "type": "4", "seed": 4, "group": "limit"}
19+
]
20+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Checker Sample
2+
3+
多解/特殊判题示例题面(占位)。

0 commit comments

Comments
 (0)