ln-311-agent-reviewer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaths: File paths (,shared/,references/) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.../ln-*
路径: 文件路径(、shared/、references/)是相对于技能仓库根目录的。如果在当前工作目录(CWD)中未找到,请定位到本SKILL.md所在目录,然后向上一级即为仓库根目录。../ln-*
Agent Reviewer (Story)
Agent评审器(Story版)
Runs parallel external agent reviews on validated Story and Tasks, critically verifies suggestions, returns editorial improvements.
对已验证的Story和任务执行并行外部Agent评审,严格验证建议内容,返回编辑优化方案。
Purpose & Scope
目标与范围
- Worker in ln-310 validation pipeline (invoked in Phase 5)
- Run codex-review + gemini-review as background tasks in parallel
- Process results as they arrive (first-finished agent processed immediately)
- Critically verify each suggestion; debate with agent if Claude disagrees
- Return filtered, deduplicated, verified suggestions for Story/Tasks improvement
- Health check + prompt execution in single invocation
- ln-310验证流水线中的工作组件(在第5阶段调用)
- 以后台任务形式并行运行codex-review与gemini-review
- 结果到达即处理(先完成的Agent结果立即处理)
- 严格验证每条建议;若Claude持不同意见,则与Agent展开辩论
- 返回经过筛选、去重、验证的Story/任务优化建议
- 单次调用即可完成健康检查与提示词执行
When to Use
使用时机
- Invoked by ln-310-story-validator Phase 5 (Agent Review)
- After Phase 4 auto-fixes applied, Penalty Points = 0
- Story and Tasks are in their final form before approval
- 由ln-310-story-validator在第5阶段(Agent评审)调用
- 第4阶段自动修复完成后,罚分(Penalty Points)= 0
- Story和任务处于批准前的最终版本状态
Inputs (from parent skill)
输入(来自父技能)
- : Linear Story identifier (e.g., "PROJ-123")
storyId
- : Linear Story的唯一标识(例如:"PROJ-123")
storyId
Workflow
工作流程
MANDATORY READ: Load for Reference Passing Pattern, Review Persistence Pattern, Agent Timeout Policy, and Debate Protocol (Challenge Round 1 + Follow-Up Round).
shared/references/agent_delegation_pattern.md-
Health check:
python shared/agents/agent_runner.py --health-check- Filter output by containing "311"
skill_groups - If 0 agents available -> return
{verdict: "SKIPPED", reason: "no agents available"} - Display: (or similar)
"Agent Health: codex-review OK, gemini-review OK"
- Filter output by
-
Get references: Call Linear MCP-> extract URL + identifier. Call
get_issue(storyId)-> extract child Task URLs/identifiers.list_issues(filter: {parent: {id: storyId}})- If project stores tasks locally (e.g., ) -> use local file paths instead of Linear URLs.
docs/tasks/
- If project stores tasks locally (e.g.,
-
Ensure .agent-review/:
- If exists -> reuse as-is, do NOT recreate
.agent-review/.gitignore - If does NOT exist -> create it +
.agent-review/(content:.agent-review/.gitignore+*)!.gitignore - Create subdirs only if they don't exist
.agent-review/{agent}/ - Do NOT add to project root
.agent-review/.gitignore
- If
-
Build prompt: Read template.
shared/agents/prompt_templates/story_review.md- Replace with
{story_ref}or- Linear: {url}- File: {path} - Replace with bullet list:
{task_refs}per task- {identifier}: {url_or_path} - Save to (one copy per agent — identical content)
.agent-review/{agent}/{identifier}_storyreview_prompt.md
- Replace
-
Run agents (background, process-as-arrive):a) Launch BOTH agents as background Bash tasks (run_in_background=true):
python shared/agents/agent_runner.py --agent codex-review --prompt-file .agent-review/codex/{identifier}_storyreview_prompt.md --output-file .agent-review/codex/{identifier}_storyreview_result.md --cwd {cwd}python shared/agents/agent_runner.py --agent gemini-review --prompt-file .agent-review/gemini/{identifier}_storyreview_prompt.md --output-file .agent-review/gemini/{identifier}_storyreview_result.md --cwd {cwd}
b) When first agent completes (background task notification):- Read its result file from
.agent-review/{agent}/{identifier}_storyreview_result.md - Parse JSON between /
<!-- AGENT_REVIEW_RESULT -->markers<!-- END_AGENT_REVIEW_RESULT --> - Parse from runner JSON output; write
session_id:.agent-review/{agent}/{identifier}_session.json{"agent": "...", "session_id": "...", "review_type": "storyreview", "created_at": "..."} - Proceed to Step 6 (Critical Verification) for this agent's suggestions
c) When second agent completes:- Read its result file, parse suggestions
- Run Step 6 for second batch
- Merge verified suggestions from both agents
d) If an agent fails: log failure, continue with available results -
Critical Verification + Debate (per Debate Protocol in):
shared/references/agent_delegation_pattern.mdFor EACH suggestion from agent results:a) Claude Evaluation: Independently assess — is the issue real? Actionable? Conflicts with project patterns?b) AGREE → accept as-is. DISAGREE/UNCERTAIN → initiate challenge.c) Challenge + Follow-Up (with session resume): Follow Debate Protocol (Challenge Round 1 → Follow-Up Round if not resolved). Resume agent's review session for full context continuity:- Read from
session_id.agent-review/{agent}/{identifier}_session.json - Run with — agent continues in same session, preserving file analysis and reasoning
--resume-session {session_id} - If in result → log warning, result still valid (stateless fallback)
session_resumed: false - = "Story/Tasks"
{review_type} - Challenge files: /
.agent-review/{agent}/{identifier}_storyreview_challenge_{N}_prompt.md_result.md - Follow-up files: /
.agent-review/{agent}/{identifier}_storyreview_followup_{N}_prompt.md_result.md
d) Persist: all challenge and follow-up prompts/results in.agent-review/{agent}/ - Read
-
Aggregate + Return: Collect ACCEPTED suggestions only (after verification + debate). Deduplicate by— keep higher confidence. Filter:
(area, issue)ANDconfidence >= 90. Return JSON with suggestions + agent_stats + debate_log to parent skill. NO cleanup/deletion.impact_percent > 2
必读要求: 加载,参考其中的引用传递模式、评审持久化模式、Agent超时策略,以及辩论协议(第一轮质疑 + 跟进轮次)。
shared/references/agent_delegation_pattern.md-
健康检查: 执行
python shared/agents/agent_runner.py --health-check- 按包含"311"的过滤输出结果
skill_groups - 若可用Agent数量为0 → 返回
{verdict: "SKIPPED", reason: "no agents available"} - 显示内容:(或类似格式)
"Agent健康状态:codex-review正常,gemini-review正常"
- 按包含"311"的
-
获取参考信息: 调用Linear MCP的接口 → 提取URL与唯一标识。调用
get_issue(storyId)→ 提取子任务的URL/唯一标识。list_issues(filter: {parent: {id: storyId}})- 若项目将任务存储在本地(例如:)→ 改用本地文件路径而非Linear URL
docs/tasks/
- 若项目将任务存储在本地(例如:
-
确保.agent-review/目录存在:
- 若已存在 → 直接复用,不要重新创建
.agent-review/.gitignore - 若不存在 → 创建该目录及
.agent-review/(内容为:.agent-review/.gitignore+*)!.gitignore - 仅在子目录不存在时,创建子目录
.agent-review/{agent}/ - 不要将添加到项目根目录的
.agent-review/中.gitignore
- 若
-
构建提示词: 读取模板文件
shared/agents/prompt_templates/story_review.md- 将替换为
{story_ref}或- Linear: {url}- 文件: {path} - 将替换为项目符号列表:每个任务对应
{task_refs}- {唯一标识}: {url或路径} - 将构建好的提示词保存到(每个Agent一份,内容完全相同)
.agent-review/{agent}/{identifier}_storyreview_prompt.md
- 将
-
运行Agent(后台执行,到达即处理):a) 以Bash后台任务形式启动两个Agent():
run_in_background=truepython shared/agents/agent_runner.py --agent codex-review --prompt-file .agent-review/codex/{identifier}_storyreview_prompt.md --output-file .agent-review/codex/{identifier}_storyreview_result.md --cwd {cwd}python shared/agents/agent_runner.py --agent gemini-review --prompt-file .agent-review/gemini/{identifier}_storyreview_prompt.md --output-file .agent-review/gemini/{identifier}_storyreview_result.md --cwd {cwd}
b) 当第一个Agent完成时(后台任务通知):- 从读取结果文件
.agent-review/{agent}/{identifier}_storyreview_result.md - 解析/
<!-- AGENT_REVIEW_RESULT -->标记之间的JSON内容<!-- END_AGENT_REVIEW_RESULT --> - 从运行器的JSON输出中解析,并写入
session_id:.agent-review/{agent}/{identifier}_session.json{"agent": "...", "session_id": "...", "review_type": "storyreview", "created_at": "..."} - 针对该Agent的建议,进入步骤6(严格验证)
c) 当第二个Agent完成时:- 读取其结果文件,解析建议内容
- 对第二批次建议执行步骤6
- 合并两个Agent的已验证建议
d) 若某个Agent执行失败:记录失败日志,继续处理可用结果 -
严格验证 + 辩论(遵循中的辩论协议):
shared/references/agent_delegation_pattern.md针对Agent结果中的每条建议:a) Claude评估: 独立评估——该问题是否真实存在?是否可执行?是否与项目模式冲突?b) 同意 → 直接采纳该建议。不同意/不确定 → 发起质疑c) 质疑 + 跟进(会话续接): 遵循辩论协议(第一轮质疑 → 若未解决则进入跟进轮次)。续接Agent的评审会话以保持上下文连续性:- 从读取
.agent-review/{agent}/{identifier}_session.jsonsession_id - 执行命令时添加参数——Agent将在同一会话中继续,保留文件分析与推理过程
--resume-session {session_id} - 若结果中→ 记录警告,结果依然有效(无状态回退)
session_resumed: false - = "Story/任务"
{review_type} - 质疑相关文件:/
.agent-review/{agent}/{identifier}_storyreview_challenge_{N}_prompt.md_result.md - 跟进相关文件:/
.agent-review/{agent}/{identifier}_storyreview_followup_{N}_prompt.md_result.md
d) 持久化: 所有质疑与跟进的提示词/结果均保存在目录中.agent-review/{agent}/ - 从
-
聚合 + 返回: 仅收集已采纳的建议(经过验证 + 辩论环节后) 按维度去重——保留置信度更高的建议 过滤规则:
(领域, 问题)且confidence >= 90返回包含建议、agent_stats、debate_log的JSON数据给父技能。不执行清理/删除操作impact_percent > 2
Output Format
输出格式
yaml
verdict: STORY_ACCEPTABLE | SUGGESTIONS | SKIPPED
suggestions:
- area: "security | performance | architecture | feasibility | best_practices | risk_analysis"
issue: "What is wrong or could be improved"
suggestion: "Specific change to Story or Tasks"
confidence: 95
impact_percent: 15
source: "codex-review"
resolution: "accepted | accepted_after_debate | accepted_after_followup | rejected"
agent_stats:
- name: "codex-review"
duration_s: 8.2
suggestion_count: 2
accepted_count: 1
challenged_count: 1
followup_count: 1
status: "success | failed | timeout"
debate_log:
- suggestion_summary: "Missing rate limiting on POST /api/users"
agent: "codex-review"
rounds:
- round: 1
claude_position: "Rate limiting exists in nginx config"
agent_decision: "DEFEND"
resolution: "follow_up"
- round: 2
claude_position: "Nginx config covers /api/* routes, agent cited only app-level"
agent_decision: "MODIFY"
resolution: "accepted_after_followup"
final_resolution: "accepted_after_followup"yaml
verdict: STORY_ACCEPTABLE | SUGGESTIONS | SKIPPED
suggestions:
- area: "security | performance | architecture | feasibility | best_practices | risk_analysis"
issue: "What is wrong or could be improved"
suggestion: "Specific change to Story or Tasks"
confidence: 95
impact_percent: 15
source: "codex-review"
resolution: "accepted | accepted_after_debate | accepted_after_followup | rejected"
agent_stats:
- name: "codex-review"
duration_s: 8.2
suggestion_count: 2
accepted_count: 1
challenged_count: 1
followup_count: 1
status: "success | failed | timeout"
debate_log:
- suggestion_summary: "Missing rate limiting on POST /api/users"
agent: "codex-review"
rounds:
- round: 1
claude_position: "Rate limiting exists in nginx config"
agent_decision: "DEFEND"
resolution: "follow_up"
- round: 2
claude_position: "Nginx config covers /api/* routes, agent cited only app-level"
agent_decision: "MODIFY"
resolution: "accepted_after_followup"
final_resolution: "accepted_after_followup"Fallback Rules
回退规则
| Condition | Action |
|---|---|
| Both agents succeed | Aggregate verified suggestions from both |
| One agent fails | Use successful agent's verified suggestions, log failure |
| Both agents fail | Return |
| Parent skill (ln-310) | Falls back to Self-Review (native Claude) |
| 条件 | 操作 |
|---|---|
| 两个Agent均成功执行 | 聚合两个Agent的已验证建议 |
| 一个Agent执行失败 | 使用成功Agent的已验证建议,记录失败日志 |
| 两个Agent均执行失败 | 返回 |
| 父技能(ln-310) | 回退至自评审模式(原生Claude) |
Verdict Escalation
结论升级规则
- No escalation. Suggestions are editorial only — they modify Story/Tasks text.
- Parent skill (ln-310) Gate verdict remains unchanged by agent suggestions.
- 无升级流程。建议仅为编辑层面——仅修改Story/任务的文本内容
- 父技能(ln-310)的 gate 结论不会因Agent建议而改变
Critical Rules
核心规则
- Read-only review — agents must NOT modify project files (enforced by prompt CRITICAL CONSTRAINTS)
- Same prompt to all agents (identical input for fair comparison)
- JSON output schema required from agents (via /
--json)--output-format json - Log all attempts for user visibility (agent name, duration, suggestion count)
- Persist prompts, results, and challenge artifacts in — do NOT delete
.agent-review/{agent}/ - Ensure exists before creating files (only create if
.agent-review/.gitignoreis new).agent-review/ - MANDATORY INVOCATION: Parent skills MUST invoke this skill. Returns SKIPPED gracefully if agents unavailable. Parent must NOT pre-check and skip.
- NO TIMEOUT KILL — WAIT FOR RESPONSE: Do NOT kill agent background tasks. WAIT until agent completes and delivers its response — do NOT proceed without it, do NOT use TaskStop. Agents are instructed to respond within 10 minutes via prompt constraint, but the hard behavior is: wait for completion or crash. Only a hard crash (non-zero exit code, connection error) is treated as failure. TaskStop is FORBIDDEN for agent tasks.
- CRITICAL VERIFICATION: Do NOT trust agent suggestions blindly. Claude MUST independently verify each suggestion and debate if disagreeing. Accept only after verification.
- 只读评审——Agent不得修改项目文件(通过提示词中的核心约束强制执行)
- 所有Agent使用相同的提示词(输入完全一致,确保公平对比)
- 要求Agent返回JSON格式的输出(通过/
--json参数指定)--output-format json - 记录所有尝试操作,便于用户查看(Agent名称、耗时、建议数量)
- 持久化提示词、结果与质疑相关文件至目录——不得删除
.agent-review/{agent}/ - 在创建文件前,确保已存在(仅当
.agent-review/.gitignore为新目录时才创建该文件).agent-review/ - 强制调用要求: 父技能必须调用本技能。若Agent不可用,将优雅返回SKIPPED状态。父技能不得提前检查并跳过调用。
- 禁止超时终止——等待响应: 不得终止Agent的后台任务。必须等待Agent完成并返回响应——不得提前继续流程,不得使用TaskStop。提示词约束中已要求Agent在10分钟内响应,但硬性规则为:等待完成或崩溃。仅当出现严重崩溃(非零退出码、连接错误)时才判定为失败。Agent任务禁止使用TaskStop。
- 严格验证: 不得盲目信任Agent的建议。Claude必须独立验证每条建议,若有不同意见则发起辩论。仅在验证通过后采纳建议。
Definition of Done
完成标准
- All available agents launched as background tasks (or gracefully failed with logged reason)
- Prompts persisted in for each agent
.agent-review/{agent}/ - Raw results persisted in (no cleanup)
.agent-review/{agent}/ - Each suggestion critically verified by Claude; challenges executed for disagreements
- Follow-up rounds executed for suggestions rejected after Round 1 (DEFEND+weak / MODIFY+disagree)
- Challenge and follow-up prompts/results persisted alongside review artifacts
- Accepted suggestions filtered by confidence >= 90 AND impact_percent > 2
- Deduplicated verified suggestions returned to parent skill with verdict, agent_stats, and debate_log
- exists (created only if
.agent-review/.gitignorewas new).agent-review/ - Session files persisted in for debate resume
.agent-review/{agent}/{identifier}_session.json
- 所有可用Agent均已作为后台任务启动(或因不可用而优雅失败,并记录原因)
- 每个Agent的提示词均已持久化至目录
.agent-review/{agent}/ - 原始结果已持久化至目录(未执行清理)
.agent-review/{agent}/ - 每条建议均已由Claude严格验证;对有分歧的建议已执行辩论环节
- 对第一轮质疑后被拒绝的建议已执行跟进轮次(DEFEND+弱支持 / MODIFY+不同意的情况)
- 质疑与跟进的提示词/结果已与评审文件一起持久化
- 已采纳的建议经过过滤(confidence >= 90 且 impact_percent > 2)
- 已去重的已验证建议与verdict、agent_stats、debate_log一起返回给父技能
- 已存在(仅当
.agent-review/.gitignore为新目录时创建).agent-review/ - 会话文件已持久化至,用于辩论续接
.agent-review/{agent}/{identifier}_session.json
Reference Files
参考文件
- Agent delegation pattern:
shared/references/agent_delegation_pattern.md - Prompt template (review):
shared/agents/prompt_templates/story_review.md - Prompt template (challenge):
shared/agents/prompt_templates/challenge_review.md - Agent registry:
shared/agents/agent_registry.json - Agent runner:
shared/agents/agent_runner.py - Challenge schema:
shared/agents/schemas/challenge_review_schema.json
Version: 2.0.0
Last Updated: 2026-02-11
- Agent委托模式:
shared/references/agent_delegation_pattern.md - 评审提示词模板:
shared/agents/prompt_templates/story_review.md - 质疑提示词模板:
shared/agents/prompt_templates/challenge_review.md - Agent注册表:
shared/agents/agent_registry.json - Agent运行器:
shared/agents/agent_runner.py - 质疑 schema:
shared/agents/schemas/challenge_review_schema.json
版本: 2.0.0
最后更新时间: 2026-02-11