massgen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMassGen Skill
MassGen Skill
Delegate tasks to your MassGen team.
将任务委派给你的MassGen团队。
Before You Launch
启动前检查
Check that a config exists:
bash
ls .massgen/config.yaml 2>/dev/null || ls ~/.config/massgen/config.yaml 2>/dev/nullIf no config exists, set one up:
- Default (browser): run — user picks models and keys in the browser
uv run massgen --web-quickstart - Headless: read — you discover available backends via
references/config_setup.md, check the user's API keys, discuss preferences, and generate config with--list-backends--quickstart --headless
If config exists — launch immediately. No need to ask questions first.
检查是否存在配置文件:
bash
ls .massgen/config.yaml 2>/dev/null || ls ~/.config/massgen/config.yaml 2>/dev/null如果不存在配置文件,请先完成配置:
- 默认(浏览器方式):运行— 用户可在浏览器中选择模型和密钥
uv run massgen --web-quickstart - 无界面模式:阅读— 你可以通过
references/config_setup.md查看可用后端,核对用户的API密钥,沟通偏好设置,再通过--list-backends生成配置--quickstart --headless
如果配置已存在 —— 直接启动即可,无需提前询问用户。
Important: Only Add What's Asked
重要提示:仅添加用户明确要求的参数
Do NOT add extra flags unless the user explicitly requests them:
- No unless the user asks for diverse approaches
--personas - No unless the user wants detailed decomposition
--plan-depth deep - No unless the user wants speed over quality
--quick
The defaults are good. Let MassGen handle the rest.
除非用户明确要求,否则不要添加额外的flag:
- 不要添加,除非用户要求多样化的解决方案思路
--personas - 不要添加,除非用户需要详细的任务拆解
--plan-depth deep - 不要添加,除非用户优先级是速度而非质量
--quick
默认配置已经足够完善,其余逻辑交给MassGen处理即可。
Quick Dispatch
快速任务分派
1. Detect Mode
1. 检测模式
| User Intent | CLI Flags |
|---|---|
| General task (write, build, research, design) | (default) |
| Review/critique existing work | |
| Plan a feature or project | |
| Plan and auto-execute | |
| Write requirements/spec | |
| Execute an existing plan | |
| Execute against an existing spec | |
| 用户意图 | CLI 标识 |
|---|---|
| 通用任务(写作、搭建、调研、设计) | (默认) |
| 审核/评论现有成果 | |
| 规划功能或项目 | |
| 规划并自动执行 | |
| 编写需求/规格说明 | |
| 执行现有规划 | |
| 基于现有规格说明执行 | |
2. Write Criteria
2. 编写评估标准
Always write opinionated evaluation criteria tailored to the task. Criteria
shape what agents produce, not just how they're scored. Save to a temp file and
pass via . Aim for 4-7 criteria.
--eval-criteriaRequired JSON format — each criterion needs , , and :
textcategoryanti_patternsjson
{
"aspiration": "A site a designer would screenshot for their portfolio",
"criteria": [
{
"text": "Design coherence: Does it feel authored or assembled? ...",
"category": "primary",
"anti_patterns": ["unmodified library defaults", "AI-generic aesthetics"]
},
{
"text": "Content depth: Every section teaches something specific ...",
"category": "standard",
"anti_patterns": ["Wikipedia-summary prose", "filler sections"]
}
]
}Categories: (ONE — where the model needs most push),
(must-pass), (nice-to-have). See for
full guidance on writing effective opinionated criteria.
primarystandardstretchreferences/criteria_guide.mdFor evaluate/plan/spec modes, you can use
instead of writing custom criteria (presets: , , ,
, , , ).
--checklist-criteria-presetevaluationplanningspecpersonadecompositionpromptanalysis始终编写贴合任务的、有明确倾向性的评估标准。评估标准会决定Agent的产出方向,而不仅仅是用于打分。将标准保存到临时文件,通过传入,建议制定4-7条标准。
--eval-criteria必须使用JSON格式 —— 每条标准需要包含、和字段:
textcategoryanti_patternsjson
{
"aspiration": "A site a designer would screenshot for their portfolio",
"criteria": [
{
"text": "Design coherence: Does it feel authored or assembled? ...",
"category": "primary",
"anti_patterns": ["unmodified library defaults", "AI-generic aesthetics"]
},
{
"text": "Content depth: Every section teaches something specific ...",
"category": "standard",
"anti_patterns": ["Wikipedia-summary prose", "filler sections"]
}
]
}分类说明:(仅有1条 —— 模型最需要重点优化的方向)、(必须满足的要求)、(加分项)。编写有效倾向性标准的完整指南可参考。
primarystandardstretchreferences/criteria_guide.md对于评估/规划/规格说明模式,你可以使用代替自定义标准(预设值包括:、、、、、、)。
--checklist-criteria-presetevaluationplanningspecpersonadecompositionpromptanalysis3. Build Prompt
3. 构建Prompt
General: User's task with relevant context.
Evaluate: What to evaluate. Auto-gather git diff, changed files, test
output. Keep it factual — what was built, not your quality opinion. Let
agents discover issues independently.
Plan: Goal + constraints.
Spec: Problem statement + user needs + constraints.
通用任务:用户的任务描述+相关上下文。
评估任务:待评估的内容。自动收集git diff、变更文件、测试输出,内容保持客观 —— 只说明已完成的内容,不要加入你的质量判断,让Agent独立发现问题。
规划任务:目标+约束条件。
规格说明任务:问题描述+用户需求+约束条件。
4. Choose CWD Context
4. 选择工作目录上下文权限
Default to when the task produces files. If the deliverable is a file
(code, docs, config, README, website, etc.), agents need write access. Use
only when agents need to read the codebase for context but their output is
pure text (an answer, review, or analysis) — not files.
rwro| Scenario | Flag |
|---|---|
| Task produces/modifies files in the project (code, docs, configs, etc.) | |
| Task needs codebase context but output is text only (review, analysis, Q&A) | |
| Isolated task, no codebase needed (default) | (omit flag) |
Rule of thumb: if the user says "write", "create", "build", "rewrite",
"update", or "edit" something in the project → .
rw当任务会生成文件时默认使用权限。如果交付物是文件(代码、文档、配置、README、网站等),Agent需要写入权限。仅当Agent需要读取代码库作为上下文,但输出是纯文本(答案、审核意见、分析报告)而非文件时,才使用权限。
rwro| 场景 | 标识 |
|---|---|
| 任务会生成/修改项目中的文件(代码、文档、配置等) | |
| 任务需要代码库上下文但仅输出文本(审核、分析、问答) | |
| 独立任务,不需要代码库上下文(默认) | (省略标识) |
经验法则:如果用户要求在项目中“编写”、“创建”、“搭建”、“重写”、“更新”或“编辑”内容 → 使用。
rw5. Run
5. 运行
Always use the wrapper script:
bash
undefined始终使用封装脚本:
bash
undefinedIsolated task (default, no cwd-context needed)
独立任务(默认,不需要cwd-context)
bash "$SKILL_DIR/scripts/massgen_run.sh"
--mode general
--criteria /tmp/massgen_criteria.json
"Create an SVG of a butterfly mixed with a panda"
--mode general
--criteria /tmp/massgen_criteria.json
"Create an SVG of a butterfly mixed with a panda"
bash "$SKILL_DIR/scripts/massgen_run.sh"
--mode general
--criteria /tmp/massgen_criteria.json
"Create an SVG of a butterfly mixed with a panda"
--mode general
--criteria /tmp/massgen_criteria.json
"Create an SVG of a butterfly mixed with a panda"
Task that writes to the project → rw
需要写入项目的任务 → 使用rw
bash "$SKILL_DIR/scripts/massgen_run.sh"
--mode general --cwd-context rw
--criteria /tmp/massgen_criteria.json
"Rewrite the README with better examples and structure"
--mode general --cwd-context rw
--criteria /tmp/massgen_criteria.json
"Rewrite the README with better examples and structure"
The wrapper includes `--web --no-browser` by default. The run starts
immediately — the user can open http://localhost:8000/ anytime to monitor
progress. **Tell the user about this URL.**
Run in the background. MassGen prints these for tracking:
- `LOG_DIR: <path>` — full run data
- `STATUS: <path>/status.json` — live status
- `ANSWER: <path>` — winning agent's answer.txt
Expect 15-45 minutes for multi-round runs.bash "$SKILL_DIR/scripts/massgen_run.sh"
--mode general --cwd-context rw
--criteria /tmp/massgen_criteria.json
"Rewrite the README with better examples and structure"
--mode general --cwd-context rw
--criteria /tmp/massgen_criteria.json
"Rewrite the README with better examples and structure"
封装脚本默认包含`--web --no-browser`参数,任务会立即启动 —— 用户可以随时打开http://localhost:8000/ 查看进度。**请告知用户这个访问地址。**
后台运行任务,MassGen会输出以下信息用于追踪:
- `LOG_DIR: <path>` —— 完整运行数据
- `STATUS: <path>/status.json` —— 实时状态
- `ANSWER: <path>` —— 胜出Agent的answer.txt文件
多轮迭代任务预计运行15-45分钟。5b. Review Notification (when --cwd-context rw
)
--cwd-context rw5b. 审核通知(当使用--cwd-context rw
时)
--cwd-context rwWhen agents have write access (), automatically add
so the user can review git diffs before changes are applied.
Review requires (the wrapper's default).
--cwd-context rw--web-review--webHeadless (): If the user explicitly requests headless mode
with , skip — changes are applied directly
without a review gate. Warn the user that there will be no diff review.
--no-web--cwd-context rw--web-reviewAfter launching the MassGen run, also launch the review watcher in the
background. Parse from the MassGen output first:
LOG_DIRbash
undefined当Agent拥有写入权限()时,自动添加参数,这样用户可以在变更生效前审核git diff。审核功能需要参数(封装脚本已默认开启)。
--cwd-context rw--web-review--web无界面模式():如果用户明确要求使用无界面模式且开启了,跳过 —— 变更会直接生效,无需审核关卡。请警告用户不会有diff审核环节。
--no-web--cwd-context rw--web-review启动MassGen任务后,同时在后台启动审核监听器。首先从MassGen的输出中解析出:
LOG_DIRbash
undefinedLaunch the watcher (reads LOG_DIR from the MassGen run output)
启动监听器(从MassGen运行输出中读取LOG_DIR)
bash "$SKILL_DIR/scripts/review_watcher.sh" "$LOG_DIR"
The watcher polls `status.json` and prints structured markers when review
is ready:
REVIEW_PENDING
REVIEW_URL: http://localhost:8000/?v=2
REVIEW_API: http://localhost:8000/api/sessions/{id}/review-response
FILES_CHANGED: src/foo.py (M), src/bar.py (A)
END_REVIEW_INFO
When you see `__REVIEW_PENDING__`, tell the user:
> "MassGen has changes ready for review. You can open the WebUI to review
> diffs visually, or tell me which files to approve/reject."
**Two resolution paths:**
1. **Browser**: User opens the REVIEW_URL and approves/rejects in the UI.
2. **Agent (text-based)**: Fetch diffs via `GET /api/sessions/{id}/review`,
show the user a summary, then submit their decision:
```bash
# Approve all
curl -X POST "$REVIEW_API" -H "Content-Type: application/json" \
-d '{"approved": true, "action": "approve"}'
# Approve specific files
curl -X POST "$REVIEW_API" -H "Content-Type: application/json" \
-d '{"approved": true, "approved_files": ["src/foo.py"]}'
# Reject all
curl -X POST "$REVIEW_API" -H "Content-Type: application/json" \
-d '{"approved": false, "action": "reject"}'Either path resolves the review — the other side auto-closes. After
resolution, is printed.
__REVIEW_COMPLETE__ APPROVED=true|falsebash "$SKILL_DIR/scripts/review_watcher.sh" "$LOG_DIR"
监听器会轮询`status.json`,当审核就绪时会打印结构化标记:
REVIEW_PENDING
REVIEW_URL: http://localhost:8000/?v=2
REVIEW_API: http://localhost:8000/api/sessions/{id}/review-response
FILES_CHANGED: src/foo.py (M), src/bar.py (A)
END_REVIEW_INFO
当你看到`__REVIEW_PENDING__`时,告知用户:
> "MassGen已生成待审核的变更。你可以打开WebUI直观查看diff,或者告诉我要批准/驳回哪些文件。"
**两种解决路径:**
1. **浏览器方式**:用户打开REVIEW_URL,在UI中批准/驳回变更。
2. **Agent(文本方式)**:通过`GET /api/sessions/{id}/review`获取diff,向用户展示摘要,然后提交用户的决策:
```bash
# 批准所有变更
curl -X POST "$REVIEW_API" -H "Content-Type: application/json" \
-d '{"approved": true, "action": "approve"}'
# 批准指定文件
curl -X POST "$REVIEW_API" -H "Content-Type: application/json" \
-d '{"approved": true, "approved_files": ["src/foo.py"]}'
# 驳回所有变更
curl -X POST "$REVIEW_API" -H "Content-Type: application/json" \
-d '{"approved": false, "action": "reject"}'任意一种路径完成审核后,另一方会自动关闭。审核完成后会打印。
__REVIEW_COMPLETE__ APPROVED=true|false6. Read Results
6. 读取结果
Read the path from the output. The winning agent's workspace is
always in the directory next to .
ANSWER:workspace/answer.txtWorkspace paths in are best-effort normalized to reference the
adjacent directory. However, always navigate to the
next to as the ground truth — not paths mentioned in the text.
answer.txtworkspace/workspace/answer.txtFor plan mode, is in the workspace.
For spec mode, is in the workspace.
project_plan.jsonproject_spec.json从输出中读取对应的路径,胜出Agent的工作区始终位于同级的目录下。
ANSWER:answer.txtworkspace/answer.txtworkspace/answer.txtworkspace/对于规划模式,会存放在工作区中。
对于规格说明模式,会存放在工作区中。
project_plan.jsonproject_spec.jsonOptional Flags (only when requested)
可选参数(仅用户要求时使用)
| Flag | Purpose |
|---|---|
| One-shot, no voting/refinement |
| Decomposition depth: |
| Deeper strategic reasoning (default: |
| Agent diversity: |
| Give agents read access to codebase |
| Give agents write access to codebase |
| Enable WebUI for watching progress (on by default in wrapper) |
| 标识 | 用途 |
|---|---|
| 单次运行,无投票/优化环节 |
| 拆解深度: |
| 更深层的战略推理(默认: |
| Agent多样性: |
| 授予Agent代码库只读权限 |
| 授予Agent代码库读写权限 |
| 开启WebUI查看进度(封装脚本默认开启) |
Config
配置
MassGen auto-discovers config from or
. See setup instructions above.
.massgen/config.yaml~/.config/massgen/config.yamlMassGen会自动从或读取配置,配置方法见上文说明。
.massgen/config.yaml~/.config/massgen/config.yamlReferences
参考文档
Only consult when the quick dispatch isn't enough:
| File | When |
|---|---|
| Criteria format, tiers, examples |
| Headless config creation |
| Checkpoint loops, living documents, structured eval, plan-evaluate integration |
仅当快速分派流程无法满足需求时查阅:
| 文件 | 使用场景 |
|---|---|
| 评估标准格式、层级、示例 |
| 无界面模式配置创建 |
| 检查点循环、动态文档、结构化评估、规划-评估集成 |