Loading...
Loading...
Compare original and translation side by side
explorations/cache-index.jsonexplorations/cache-index.json+-------------------------------------------------------------+
| Team Lifecycle Orchestrator |
| Phase 1 -> Phase 2 -> Phase 3 -> Phase 4 -> Phase 5 |
| Require Init Dispatch Coordinate Report |
+----------+------------------------------------------------+--+
|
+-----+------+----------+-----------+-----------+
v v v v v
+---------+ +---------+ +---------+ +---------+ +---------+
| Phase 1 | | Phase 2 | | Phase 3 | | Phase 4 | | Phase 5 |
| Require | | Init | | Dispatch| | Coord | | Report |
+---------+ +---------+ +---------+ +---------+ +---------+
| | | ||| |
params session tasks agents summary
/ | \
spawn wait close
/ | \
+------+ +-------+ +--------+
|agent1| |agent2 | |agent N |
+------+ +-------+ +--------+
| | |
(may call discuss/explore subagents internally) event (phase advance / user resume)
|
v
[Orchestrator]
+-- read state file
+-- find ready tasks (pending + all blockers completed)
+-- spawn agent(s) for ready task(s)
+-- wait(agent_ids, timeout)
+-- process results (consensus routing, artifacts)
+-- update state file
+-- close completed agents
+-- fast-advance: immediately spawn next if linear successor
+-- yield (wait for next event or user command)+-------------------------------------------------------------+
| Team Lifecycle Orchestrator |
| Phase 1 -> Phase 2 -> Phase 3 -> Phase 4 -> Phase 5 |
| Require Init Dispatch Coordinate Report |
+----------+------------------------------------------------+--+
|
+-----+------+----------+-----------+-----------+
v v v v v
+---------+ +---------+ +---------+ +---------+ +---------+
| Phase 1 | | Phase 2 | | Phase 3 | | Phase 4 | | Phase 5 |
| Require | | Init | | Dispatch| | Coord | | Report |
+---------+ +---------+ +---------+ +---------+ +---------+
| | | ||| |
params session tasks agents summary
/ | \
spawn wait close
/ | \
+------+ +-------+ +--------+
|agent1| |agent2 | |agent N |
+------+ +-------+ +--------+
| | |
(may call discuss/explore subagents internally) event (phase advance / user resume)
|
v
[Orchestrator]
+-- read state file
+-- find ready tasks (pending + all blockers completed)
+-- spawn agent(s) for ready task(s)
+-- wait(agent_ids, timeout)
+-- process results (consensus routing, artifacts)
+-- update state file
+-- close completed agents
+-- fast-advance: immediately spawn next if linear successor
+-- yield (wait for next event or user command)| Agent | Role File | Responsibility | Pattern |
|---|---|---|---|
| analyst | ~/.codex/agents/analyst.md | Seed analysis, context gathering, DISCUSS-001 | 2.8 Inline Subagent |
| writer | ~/.codex/agents/writer.md | Document generation, DISCUSS-002 to DISCUSS-005 | 2.8 Inline Subagent |
| planner | ~/.codex/agents/planner.md | Multi-angle exploration, plan generation | 2.9 Cached Exploration |
| executor | ~/.codex/agents/executor.md | Code implementation | 2.1 Standard |
| tester | ~/.codex/agents/tester.md | Test-fix cycles | 2.3 Deep Interaction |
| reviewer | ~/.codex/agents/reviewer.md | Code review + spec quality, DISCUSS-006 | 2.8 Inline Subagent |
| architect | ~/.codex/agents/architect.md | Architecture consulting (on-demand) | 2.1 Standard |
| fe-developer | ~/.codex/agents/fe-developer.md | Frontend implementation | 2.1 Standard |
| fe-qa | ~/.codex/agents/fe-qa.md | Frontend QA, GC loop | 2.3 Deep Interaction |
All agent role files MUST be deployed tobefore use. Pattern 2.8 = agent internally spawns discuss subagent for multi-perspective critique. Pattern 2.9 = agent uses shared explore cache before work. Pattern 2.3 = orchestrator may use send_input for iterative correction loops.~/.codex/agents/
| Agent | 角色文件 | 职责 | 模式 |
|---|---|---|---|
| analyst | ~/.codex/agents/analyst.md | 初始分析、上下文收集、DISCUSS-001 | 2.8 内联子Agent |
| writer | ~/.codex/agents/writer.md | 文档生成、DISCUSS-002 到 DISCUSS-005 | 2.8 内联子Agent |
| planner | ~/.codex/agents/planner.md | 多维度探索、方案生成 | 2.9 缓存探索 |
| executor | ~/.codex/agents/executor.md | 代码实现 | 2.1 标准 |
| tester | ~/.codex/agents/tester.md | 测试-修复循环 | 2.3 深度交互 |
| reviewer | ~/.codex/agents/reviewer.md | 代码评审 + 规格质量校验、DISCUSS-006 | 2.8 内联子Agent |
| architect | ~/.codex/agents/architect.md | 架构咨询(按需调用) | 2.1 标准 |
| fe-developer | ~/.codex/agents/fe-developer.md | 前端实现 | 2.1 标准 |
| fe-qa | ~/.codex/agents/fe-qa.md | 前端QA、GC循环 | 2.3 深度交互 |
所有Agent角色文件使用前必须部署到目录下。 模式2.8 = Agent内部生成讨论子Agent完成多视角评审。 模式2.9 = Agent工作前会使用共享探索缓存。 模式2.3 = 编排器可使用send_input实现迭代修正循环。~/.codex/agents/
| Subagent | Agent File | Callable By | Purpose |
|---|---|---|---|
| discuss | ~/.codex/agents/discuss-agent.md | analyst, writer, reviewer | Multi-perspective critique via CLI tools |
| explore | ~/.codex/agents/explore-agent.md | analyst, planner, any agent | Codebase exploration with shared cache |
spawn_agent| 子Agent | Agent文件 | 可调用方 | 用途 |
|---|---|---|---|
| discuss | ~/.codex/agents/discuss-agent.md | analyst, writer, reviewer | 通过CLI工具完成多视角评审 |
| explore | ~/.codex/agents/explore-agent.md | analyst, planner, 任意Agent | 带共享缓存的代码库探索 |
spawn_agentwait()| Condition | Action |
|---|---|
| 1 ready task, simple linear successor, no checkpoint | Immediately |
| Multiple ready tasks (parallel window) | Spawn all ready tasks in batch, then |
| No ready tasks, other agents still running | Yield, wait for those agents to complete |
| No ready tasks, nothing running | Pipeline complete, proceed to Phase 5 |
| Checkpoint task completed (e.g., QUALITY-001) | Pause, output checkpoint message, wait for user |
wait()| 条件 | 操作 |
|---|---|
| 1个就绪任务,简单线性后继,无检查点 | 立即为下一个任务执行 |
| 多个就绪任务(并行窗口) | 批量生成所有就绪任务对应的Agent,然后统一等待结果 |
| 无就绪任务,仍有其他Agent在运行 | 让出资源,等待这些Agent完成 |
| 无就绪任务,无运行中Agent | 流水线完成,进入第五阶段 |
| 检查点任务完成(如QUALITY-001) | 暂停,输出检查点消息,等待用户操作 |
DISCUSS_RESULT:
- verdict: <consensus_reached | consensus_blocked>
- severity: <HIGH | MEDIUM | LOW>
- average_rating: <N>/5
- divergences: <summary>
- action_items: <list>
- recommendation: <revise | proceed-with-caution | escalate>
- discussion_path: <path-to-discussion-record>| Verdict | Severity | Orchestrator Action |
|---|---|---|
| consensus_reached | - | Proceed normally, fast-advance to next task |
| consensus_blocked | LOW | Treat as reached with notes, proceed normally |
| consensus_blocked | MEDIUM | Log warning to |
| consensus_blocked | HIGH | Create revision task (see below) OR pause for user |
| consensus_blocked | HIGH (DISCUSS-006) | Always pause for user decision (final sign-off gate) |
// Add revision entry to state file
const revisionTask = {
id: "<original-task-id>-R1",
owner: "<same-agent-role>",
blocked_by: [],
description: "Revision of <original-task-id>: address consensus-blocked divergences.\n"
+ "Session: <session-dir>\n"
+ "Original artifact: <artifact-path>\n"
+ "Divergences: <divergence-details>\n"
+ "Action items: <action-items-from-discuss>\n"
+ "InlineDiscuss: <same-round-id>",
status: "pending",
is_revision: true
}
// Max 1 revision per task. If already revised once, pause for user.
if (stateHasRevision(originalTaskId)) {
// Pause pipeline, ask user
} else {
// Insert revision task into state, spawn agent
}DISCUSS_RESULT:
- verdict: <consensus_reached | consensus_blocked>
- severity: <HIGH | MEDIUM | LOW>
- average_rating: <N>/5
- divergences: <summary>
- action_items: <list>
- recommendation: <revise | proceed-with-caution | escalate>
- discussion_path: <path-to-discussion-record>| 结论 | 严重等级 | 编排器操作 |
|---|---|---|
| 达成共识 | - | 正常推进,快速进入下一个任务 |
| 共识阻塞 | 低 | 视为附带备注的达成共识,正常推进 |
| 共识阻塞 | 中 | 在 |
| 共识阻塞 | 高 | 创建修订任务(见下文)或者暂停等待用户处理 |
| 共识阻塞 | 高(DISCUSS-006) | 始终暂停等待用户决策(最终签署关卡) |
// Add revision entry to state file
const revisionTask = {
id: "<original-task-id>-R1",
owner: "<same-agent-role>",
blocked_by: [],
description: "Revision of <original-task-id>: address consensus-blocked divergences.\n"
+ "Session: <session-dir>\n"
+ "Original artifact: <artifact-path>\n"
+ "Divergences: <divergence-details>\n"
+ "Action items: <action-items-from-discuss>\n"
+ "InlineDiscuss: <same-round-id>",
status: "pending",
is_revision: true
}
// Max 1 revision per task. If already revised once, pause for user.
if (stateHasRevision(originalTaskId)) {
// Pause pipeline, ask user
} else {
// Insert revision task into state, spawn agent
}| Phase | File | Summary |
|---|---|---|
| Phase 1 | phases/01-requirement-clarification.md | Parse user input, detect mode, frontend auto-detection, gather parameters |
| Phase 2 | phases/02-team-initialization.md | Create session directory, initialize state file, wisdom, explore cache |
| Phase 3 | phases/03-task-chain-creation.md | Build pipeline task chain based on mode, write to state file |
| Phase 4 | phases/04-pipeline-coordination.md | Main spawn/wait/close loop, fast-advance, consensus routing, checkpoints |
| Phase 5 | phases/05-completion-report.md | Summarize results, list artifacts, offer next steps |
| 阶段 | 文件 | 概述 |
|---|---|---|
| 阶段1 | phases/01-requirement-clarification.md | 解析用户输入、检测模式、前端自动识别、收集参数 |
| 阶段2 | phases/02-team-initialization.md | 创建会话目录、初始化状态文件、知识库、探索缓存 |
| 阶段3 | phases/03-task-chain-creation.md | 基于模式构建流水线任务链,写入状态文件 |
| 阶段4 | phases/04-pipeline-coordination.md | 核心生成/等待/关闭循环、快速推进、共识路由、检查点处理 |
| 阶段5 | phases/05-completion-report.md | 结果汇总、产出物列表、下一步建议 |
.workflow/.team/TLS-*/team-session.jsonstatus: "active"status: "paused".workflow/.team/TLS-*/team-session.jsonactivepausedRESEARCH-001(+D1) -> DRAFT-001(+D2) -> DRAFT-002(+D3) -> DRAFT-003(+D4) -> DRAFT-004(+D5) -> QUALITY-001(+D6)(+DN)RESEARCH-001(+D1) -> DRAFT-001(+D2) -> DRAFT-002(+D3) -> DRAFT-003(+D4) -> DRAFT-004(+D5) -> QUALITY-001(+D6)(+DN)PLAN-001 -> IMPL-001 -> TEST-001 || REVIEW-001PLAN-001 -> IMPL-001 -> TEST-001 || REVIEW-001[Spec pipeline: RESEARCH-001 -> DRAFT-001 -> ... -> QUALITY-001]
|
CHECKPOINT: pause for user confirmation
|
PLAN-001(blockedBy: QUALITY-001) -> IMPL-001 -> TEST-001 || REVIEW-001[Spec pipeline: RESEARCH-001 -> DRAFT-001 -> ... -> QUALITY-001]
|
CHECKPOINT: pause for user confirmation
|
PLAN-001(blockedBy: QUALITY-001) -> IMPL-001 -> TEST-001 || REVIEW-001PLAN-001 -> DEV-FE-001 -> QA-FE-001PLAN-001 -> DEV-FE-001 -> QA-FE-001PLAN-001 -> IMPL-001 || DEV-FE-001 -> TEST-001 || QA-FE-001 -> REVIEW-001PLAN-001 -> IMPL-001 || DEV-FE-001 -> TEST-001 || QA-FE-001 -> REVIEW-001[Spec pipeline] -> PLAN-001 -> IMPL-001 || DEV-FE-001 -> TEST-001 || QA-FE-001 -> REVIEW-001[Spec pipeline] -> PLAN-001 -> IMPL-001 || DEV-FE-001 -> TEST-001 || QA-FE-001 -> REVIEW-001| Task ID | Agent | Phase | Dependencies | Description | Inline Discuss |
|---|---|---|---|---|---|
| RESEARCH-001 | analyst | spec | (none) | Seed analysis and context gathering | DISCUSS-001 |
| DRAFT-001 | writer | spec | RESEARCH-001 | Generate Product Brief | DISCUSS-002 |
| DRAFT-002 | writer | spec | DRAFT-001 | Generate Requirements/PRD | DISCUSS-003 |
| DRAFT-003 | writer | spec | DRAFT-002 | Generate Architecture Document | DISCUSS-004 |
| DRAFT-004 | writer | spec | DRAFT-003 | Generate Epics and Stories | DISCUSS-005 |
| QUALITY-001 | reviewer | spec | DRAFT-004 | 5-dimension spec quality + sign-off | DISCUSS-006 |
| PLAN-001 | planner | impl | (none or QUALITY-001) | Multi-angle exploration and planning | - |
| IMPL-001 | executor | impl | PLAN-001 | Code implementation | - |
| TEST-001 | tester | impl | IMPL-001 | Test-fix cycles | - |
| REVIEW-001 | reviewer | impl | IMPL-001 | 4-dimension code review | - |
| DEV-FE-001 | fe-developer | impl | PLAN-001 | Frontend implementation | - |
| QA-FE-001 | fe-qa | impl | DEV-FE-001 | 5-dimension frontend QA | - |
| 任务ID | Agent | 阶段 | 依赖 | 描述 | 内联讨论 |
|---|---|---|---|---|---|
| RESEARCH-001 | analyst | 规格定义 | 无 | 初始分析和上下文收集 | DISCUSS-001 |
| DRAFT-001 | writer | 规格定义 | RESEARCH-001 | 生成产品简介 | DISCUSS-002 |
| DRAFT-002 | writer | 规格定义 | DRAFT-001 | 生成需求/PRD | DISCUSS-003 |
| DRAFT-003 | writer | 规格定义 | DRAFT-002 | 生成架构文档 | DISCUSS-004 |
| DRAFT-004 | writer | 规格定义 | DRAFT-003 | 生成史诗和用户故事 | DISCUSS-005 |
| QUALITY-001 | reviewer | 规格定义 | DRAFT-004 | 5维度规格质量校验 + 签署 | DISCUSS-006 |
| PLAN-001 | planner | 实现 | 无或QUALITY-001 | 多维度探索和规划 | - |
| IMPL-001 | executor | 实现 | PLAN-001 | 代码实现 | - |
| TEST-001 | tester | 实现 | IMPL-001 | 测试-修复循环 | - |
| REVIEW-001 | reviewer | 实现 | IMPL-001 | 4维度代码评审 | - |
| DEV-FE-001 | fe-developer | 实现 | PLAN-001 | 前端实现 | - |
| QA-FE-001 | fe-qa | 实现 | DEV-FE-001 | 5维度前端QA | - |
Beat Cycle (single beat)
======================================================================
Event Orchestrator Agents
----------------------------------------------------------------------
advance/resume --> +- read state file ------+
| find ready tasks |
| spawn agent(s) --------+--> [Agent A] executes
| wait(ids, timeout) ----+--> [Agent B] executes
+- process results -------+ |
| update state file | |
| close agents | |
+- yield -----------------+ |
|
next beat <--- result from wait() <-------------------+
======================================================================
Fast-Advance (skips full yield for linear successors)
======================================================================
[Agent A] completes via wait()
+- 1 ready task? simple linear successor?
| YES -> spawn Agent B immediately, enter wait() again
| NO -> yield, wait for user/event
======================================================================Beat Cycle (single beat)
======================================================================
Event Orchestrator Agents
----------------------------------------------------------------------
advance/resume --> +- read state file ------+
| find ready tasks |
| spawn agent(s) --------+--> [Agent A] executes
| wait(ids, timeout) ----+--> [Agent B] executes
+- process results -------+ |
| update state file | |
| close agents | |
+- yield -----------------+ |
|
next beat <--- result from wait() <-------------------+
======================================================================
Fast-Advance (skips full yield for linear successors)
======================================================================
[Agent A] completes via wait()
+- 1 ready task? simple linear successor?
| YES -> spawn Agent B immediately, enter wait() again
| NO -> yield, wait for user/event
======================================================================Spec-only (6 beats, was 12 in v3)
-------------------------------------------------------
Beat 1 2 3 4 5 6
| | | | | |
R1+D1 --> W1+D2 --> W2+D3 --> W3+D4 --> W4+D5 --> Q1+D6
^ ^
pipeline sign-off
start pause
R=RESEARCH W=DRAFT(writer) Q=QUALITY D=DISCUSS(inline)
Impl-only (3 beats, with parallel window)
-------------------------------------------------------
Beat 1 2 3
| | +----+----+
PLAN --> IMPL --> TEST || REVIEW <-- parallel window
+----+----+
pipeline
done
Full-lifecycle (9 beats)
-------------------------------------------------------
Beat 1-6: [Spec pipeline as above]
|
Beat 6 (Q1+D6 done): CHECKPOINT -- user confirms then resume
|
Beat 7 8 9
PLAN --> IMPL --> TEST || REVIEW
Fullstack (with dual parallel windows)
-------------------------------------------------------
Beat 1 2 3 4
| +----+----+ +----+----+ |
PLAN --> IMPL || DEV-FE --> TEST || QA-FE --> REVIEW
^ ^ ^
parallel 1 parallel 2 sync barrierSpec-only (6 beats, was 12 in v3)
-------------------------------------------------------
Beat 1 2 3 4 5 6
| | | | | |
R1+D1 --> W1+D2 --> W2+D3 --> W3+D4 --> W4+D5 --> Q1+D6
^ ^
pipeline sign-off
start pause
R=RESEARCH W=DRAFT(writer) Q=QUALITY D=DISCUSS(inline)
Impl-only (3 beats, with parallel window)
-------------------------------------------------------
Beat 1 2 3
| | +----+----+
PLAN --> IMPL --> TEST || REVIEW <-- parallel window
+----+----+
pipeline
done
Full-lifecycle (9 beats)
-------------------------------------------------------
Beat 1-6: [Spec pipeline as above]
|
Beat 6 (Q1+D6 done): CHECKPOINT -- user confirms then resume
|
Beat 7 8 9
PLAN --> IMPL --> TEST || REVIEW
Fullstack (with dual parallel windows)
-------------------------------------------------------
Beat 1 2 3 4
| +----+----+ +----+----+ |
PLAN --> IMPL || DEV-FE --> TEST || QA-FE --> REVIEW
^ ^ ^
parallel 1 parallel 2 sync barrier| Trigger | Position | Behavior |
|---|---|---|
| Spec-to-impl transition | QUALITY-001 completed | Pause, output "SPEC PHASE COMPLETE", wait for user |
| GC loop max reached | QA-FE max 2 rounds | Stop iteration, report current QA state |
| Pipeline stall | No ready + no running | Check for missing tasks, report to user |
| DISCUSS-006 HIGH severity | Final sign-off | Always pause for user decision |
| 触发条件 | 位置 | 行为 |
|---|---|---|
| 规格到实现的过渡 | QUALITY-001完成 | 暂停,输出「SPEC阶段完成」,等待用户操作 |
| GC循环达到最大次数 | QA-FE最多2轮 | 停止迭代,报告当前QA状态 |
| 流水线停滞 | 无就绪任务 + 无运行中任务 | 检查是否缺失任务,向用户报告 |
| DISCUSS-006高严重等级 | 最终签署环节 | 始终暂停等待用户决策 |
| Check | Condition | Resolution |
|---|---|---|
| Agent unresponsive | wait() timeout on active agent | Close agent, reset task to pending, respawn |
| Pipeline deadlock | No ready + no running + has pending | Inspect blocked_by chains, report blockage to user |
| GC loop exceeded | DEV-FE / QA-FE iteration > 2 rounds | Terminate loop, output latest QA report |
| Fast-advance orphan | Task is "in_progress" in state but agent closed | Reset to pending, respawn |
| 检查项 | 条件 | 解决方案 |
|---|---|---|
| Agent无响应 | 运行中Agent的wait()超时 | 关闭Agent,将任务重置为待处理,重新生成 |
| 流水线死锁 | 无就绪任务 + 无运行中任务 + 有待处理任务 | 检查阻塞依赖链,向用户报告阻塞详情 |
| GC循环超限 | DEV-FE/QA-FE迭代超过2轮 | 终止循环,输出最新QA报告 |
| 快速推进孤儿任务 | 状态中标记为「进行中」但Agent已关闭 | 重置为待处理,重新生成 |
const agentId = spawn_agent({
message: `const agentId = spawn_agent({
message: `
---
---.workflow/.team/TLS-<slug>-<date>/
+-- team-session.json # Pipeline state (replaces TaskCreate/TaskList)
+-- spec/ # Spec artifacts
| +-- spec-config.json
| +-- discovery-context.json
| +-- product-brief.md
| +-- requirements/
| +-- architecture/
| +-- epics/
| +-- readiness-report.md
| +-- spec-summary.md
+-- discussions/ # Discussion records (written by discuss subagent)
+-- plan/ # Plan artifacts
| +-- plan.json
| +-- tasks/ # Detailed task specs
+-- explorations/ # Shared explore cache
| +-- cache-index.json # { angle -> file_path }
| +-- explore-<angle>.json
+-- architecture/ # Architect assessments + design-tokens.json
+-- analysis/ # Analyst design-intelligence.json (UI mode)
+-- qa/ # QA audit reports
+-- wisdom/ # Cross-task knowledge accumulation
| +-- learnings.md # Patterns and insights
| +-- decisions.md # Architecture and design decisions
| +-- conventions.md # Codebase conventions
| +-- issues.md # Known risks and issues
+-- .msg/ # Message bus (UI integration)
| +-- meta.json # Pipeline metadata (stages, roles, team_name)
| +-- messages.jsonl # NDJSON event log
+-- shared-memory.json # Cross-agent state.workflow/.team/TLS-<slug>-<date>/
+-- team-session.json # Pipeline state (replaces TaskCreate/TaskList)
+-- spec/ # Spec artifacts
| +-- spec-config.json
| +-- discovery-context.json
| +-- product-brief.md
| +-- requirements/
| +-- architecture/
| +-- epics/
| +-- readiness-report.md
| +-- spec-summary.md
+-- discussions/ # Discussion records (written by discuss subagent)
+-- plan/ # Plan artifacts
| +-- plan.json
| +-- tasks/ # Detailed task specs
+-- explorations/ # Shared explore cache
| +-- cache-index.json # { angle -> file_path }
| +-- explore-<angle>.json
+-- architecture/ # Architect assessments + design-tokens.json
+-- analysis/ # Analyst design-intelligence.json (UI mode)
+-- qa/ # QA audit reports
+-- wisdom/ # Cross-task knowledge accumulation
| +-- learnings.md # Patterns and insights
| +-- decisions.md # Architecture and design decisions
| +-- conventions.md # Codebase conventions
| +-- issues.md # Known risks and issues
+-- .msg/ # Message bus (UI integration)
| +-- meta.json # Pipeline metadata (stages, roles, team_name)
| +-- messages.jsonl # NDJSON event log
+-- shared-memory.json # Cross-agent state{
"session_id": "TLS-<slug>-<date>",
"mode": "<spec-only | impl-only | full-lifecycle | fe-only | fullstack | full-lifecycle-fe>",
"scope": "<project description>",
"status": "<active | paused | completed>",
"started_at": "<ISO8601>",
"updated_at": "<ISO8601>",
"tasks_total": 0,
"tasks_completed": 0,
"pipeline": [
{
"id": "RESEARCH-001",
"owner": "analyst",
"status": "pending | in_progress | completed | failed",
"blocked_by": [],
"description": "...",
"inline_discuss": "DISCUSS-001",
"agent_id": null,
"artifact_path": null,
"discuss_verdict": null,
"discuss_severity": null,
"started_at": null,
"completed_at": null,
"revision_of": null,
"revision_count": 0
}
],
"active_agents": [],
"completed_tasks": [],
"revision_chains": {},
"wisdom_entries": [],
"checkpoints_hit": [],
"gc_loop_count": 0
}{
"session_id": "TLS-<slug>-<date>",
"mode": "<spec-only | impl-only | full-lifecycle | fe-only | fullstack | full-lifecycle-fe>",
"scope": "<project description>",
"status": "<active | paused | completed>",
"started_at": "<ISO8601>",
"updated_at": "<ISO8601>",
"tasks_total": 0,
"tasks_completed": 0,
"pipeline": [
{
"id": "RESEARCH-001",
"owner": "analyst",
"status": "pending | in_progress | completed | failed",
"blocked_by": [],
"description": "...",
"inline_discuss": "DISCUSS-001",
"agent_id": null,
"artifact_path": null,
"discuss_verdict": null,
"discuss_severity": null,
"started_at": null,
"completed_at": null,
"revision_of": null,
"revision_count": 0
}
],
"active_agents": [],
"completed_tasks": [],
"revision_chains": {},
"wisdom_entries": [],
"checkpoints_hit": [],
"gc_loop_count": 0
}.msg/team_msgtype: "state_update".msg/team_msgtype: "state_update"{
"status": "active",
"pipeline_mode": "<mode>",
"pipeline_stages": ["role1", "role2", "..."],
"roles": ["coordinator", "role1", "role2", "..."],
"team_name": "lifecycle",
"role_state": {
"<role>": {
"status": "completed",
"task_id": "TASK-ID",
"_updated_at": "<ISO8601>"
}
},
"updated_at": "<ISO8601>"
}| Mode | pipeline_stages |
|---|---|
| spec-only | |
| impl-only | |
| fe-only | |
| fullstack | |
| full-lifecycle | |
| full-lifecycle-fe | |
{
"status": "active",
"pipeline_mode": "<mode>",
"pipeline_stages": ["role1", "role2", "..."],
"roles": ["coordinator", "role1", "role2", "..."],
"team_name": "lifecycle",
"role_state": {
"<role>": {
"status": "completed",
"task_id": "TASK-ID",
"_updated_at": "<ISO8601>"
}
},
"updated_at": "<ISO8601>"
}| 模式 | pipeline_stages |
|---|---|
| 仅规格定义 | |
| 仅实现 | |
| 仅前端 | |
| 全栈 | |
| 全生命周期 | |
| 全生命周期含前端 | |
{"id":"MSG-001","ts":"<ISO8601>","from":"coordinator","to":"coordinator","type":"state_update","summary":"Session initialized","data":{...}}
{"id":"MSG-002","ts":"<ISO8601>","from":"analyst","to":"coordinator","type":"impl_complete","summary":"RESEARCH-001 completed","data":{...}}state_updateimpl_completeimpl_progresstest_resultreview_resulterrorshutdown{"id":"MSG-001","ts":"<ISO8601>","from":"coordinator","to":"coordinator","type":"state_update","summary":"Session initialized","data":{...}}
{"id":"MSG-002","ts":"<ISO8601>","from":"analyst","to":"coordinator","type":"impl_complete","summary":"RESEARCH-001 completed","data":{...}}state_updateimpl_completeimpl_progresstest_resultreview_resulterrorshutdownteam-session.jsonteam-session.json| Command | Action |
|---|---|
| Output execution status graph (read-only, no advancement) |
| Check agent states, advance pipeline |
| New session request | Phase 0 detects, enters normal Phase 1-5 flow |
[orchestrator] Pipeline Status
[orchestrator] Mode: <mode> | Progress: <completed>/<total> (<percent>%)
[orchestrator] Execution Graph:
Spec Phase: (if applicable)
[V RESEARCH-001(+D1)] -> [V DRAFT-001(+D2)] -> [>>> DRAFT-002(+D3)]
-> [o DRAFT-003(+D4)] -> [o DRAFT-004(+D5)] -> [o QUALITY-001(+D6)]
Impl Phase: (if applicable)
[o PLAN-001]
+- BE: [o IMPL-001] -> [o TEST-001] -> [o REVIEW-001]
+- FE: [o DEV-FE-001] -> [o QA-FE-001]
V=completed >>>=running o=pending .=not created
[orchestrator] Active Agents:
> <task-id> (<agent-role>) - running <elapsed>
[orchestrator] Ready to spawn: <task-ids>
[orchestrator] Commands: 'resume' to advance | 'check' to refresh| 命令 | 操作 |
|---|---|
| 输出执行状态图(只读,不推进流程) |
| 检查Agent状态,推进流水线 |
| 新会话请求 | 阶段0检测到后,进入正常的1-5阶段流程 |
[orchestrator] Pipeline Status
[orchestrator] Mode: <mode> | Progress: <completed>/<total> (<percent>%)
[orchestrator] Execution Graph:
Spec Phase: (if applicable)
[V RESEARCH-001(+D1)] -> [V DRAFT-001(+D2)] -> [>>> DRAFT-002(+D3)]
-> [o DRAFT-003(+D4)] -> [o DRAFT-004(+D5)] -> [o QUALITY-001(+D6)]
Impl Phase: (if applicable)
[o PLAN-001]
+- BE: [o IMPL-001] -> [o TEST-001] -> [o REVIEW-001]
+- FE: [o DEV-FE-001] -> [o QA-FE-001]
V=completed >>>=running o=pending .=not created
[orchestrator] Active Agents:
> <task-id> (<agent-role>) - running <elapsed>
[orchestrator] Ready to spawn: <task-ids>
[orchestrator] Commands: 'resume' to advance | 'check' to refresh| Phase | Timeout | On Timeout |
|---|---|---|
| Phase 1 (requirements) | None (interactive) | N/A |
| Phase 2 (init) | 60s | Fail with error |
| Phase 3 (dispatch) | 60s | Fail with error |
| Phase 4 per agent | 15 min (spec agents), 30 min (impl agents) | Send convergence request via |
| Phase 5 (report) | 60s | Output partial report |
send_inputsend_input({
id: <agent-id>,
message: `| 阶段 | 超时时间 | 超时处理 |
|---|---|---|
| 阶段1(需求) | 无(交互模式) | N/A |
| 阶段2(初始化) | 60秒 | 报错失败 |
| 阶段3(分发) | 60秒 | 报错失败 |
| 阶段4单Agent | 15分钟(规格类Agent),30分钟(实现类Agent) | 通过 |
| 阶段5(报告) | 60秒 | 输出部分报告 |
send_inputsend_input({
id: <agent-id>,
message: `undefinedundefined// Close all active agents
for (const agentEntry of state.active_agents) {
try {
close_agent({ id: agentEntry.agent_id })
} catch (e) {
// Agent already closed, ignore
}
}
// Update state file
state.status = "completed" // or "aborted"
state.updated_at = new Date().toISOString()
// Write state file// Close all active agents
for (const agentEntry of state.active_agents) {
try {
close_agent({ id: agentEntry.agent_id })
} catch (e) {
// Agent already closed, ignore
}
}
// Update state file
state.status = "completed" // or "aborted"
state.updated_at = new Date().toISOString()
// Write state file| Scenario | Detection | Resolution |
|---|---|---|
| Agent timeout | wait() returns timed_out | send_input convergence request, retry wait 2 min, then close + reset task |
| Agent crash / unexpected close | wait() returns error status | Reset task to pending, respawn agent (max 3 retries) |
| 3+ failures on same task | Retry count in state file | Pause pipeline, report to user |
| Fast-advance orphan | Task in_progress but no active agent and > 5 min elapsed | Reset to pending, respawn |
| Consensus blocked HIGH | DISCUSS_RESULT parsed from agent output | Create revision task (max 1) or pause |
| Consensus blocked HIGH on DISCUSS-006 | Same as above but final sign-off round | Always pause for user |
| Revision also blocked | Revision task returns blocked HIGH | Pause pipeline, escalate to user |
| Session file corrupt | JSON parse error | Attempt recovery from last known good state, or report error |
| Pipeline stall | No ready + no running + has pending | Inspect blocked_by, report blockage details |
| Unknown agent output format | TASK_COMPLETE not found in wait result | Log warning, attempt to extract status, mark as partial |
| Duplicate task in state | Task ID already exists during dispatch | Skip creation, log warning |
| Missing dependency | blocked_by references non-existent task | Log error, halt pipeline |
| 场景 | 检测方式 | 解决方案 |
|---|---|---|
| Agent超时 | wait()返回timed_out | 发送收敛请求,重试等待2分钟,然后关闭+重置任务 |
| Agent崩溃/意外关闭 | wait()返回错误状态 | 将任务重置为待处理,重新生成Agent(最多重试3次) |
| 同一任务失败超过3次 | 状态文件中的重试计数 | 暂停流水线,向用户报告 |
| 快速推进孤儿任务 | 任务标记为进行中但无活跃Agent且已运行超过5分钟 | 重置为待处理,重新生成 |
| 共识阻塞高严重等级 | 从Agent输出解析到DISCUSS_RESULT | 创建修订任务(最多1次)或暂停 |
| DISCUSS-006共识阻塞高严重等级 | 同上但属于最终签署环节 | 始终暂停等待用户处理 |
| 修订任务仍阻塞 | 修订任务返回高严重等级阻塞 | 暂停流水线,升级给用户处理 |
| 会话文件损坏 | JSON解析错误 | 尝试从最后已知的正常状态恢复,或报告错误 |
| 流水线停滞 | 无就绪任务 + 无运行中任务 + 有待处理任务 | 检查阻塞依赖,报告阻塞详情 |
| 未知Agent输出格式 | wait()结果中未找到TASK_COMPLETE | 记录警告,尝试提取状态,标记为部分完成 |
| 状态中存在重复任务 | 分发阶段发现任务ID已存在 | 跳过创建,记录警告 |
| 缺失依赖 | blocked_by引用不存在的任务 | 记录错误,暂停流水线 |
| Signal | Detection | Pipeline Upgrade |
|---|---|---|
| FE keywords in description | Match: component, page, UI, React, Vue, CSS, HTML, Tailwind, Svelte, Next.js, Nuxt, shadcn, design system | impl-only -> fe-only or fullstack |
| BE keywords also present | Match: API, database, server, endpoint, backend, middleware | impl-only -> fullstack |
| FE framework in project | Detect react/vue/svelte/next in package.json | full-lifecycle -> full-lifecycle-fe |
| 信号 | 检测规则 | 流水线升级 |
|---|---|---|
| 描述中存在前端关键词 | 匹配:component, page, UI, React, Vue, CSS, HTML, Tailwind, Svelte, Next.js, Nuxt, shadcn, design system | 仅实现 -> 仅前端或全栈 |
| 同时存在后端关键词 | 匹配:API, database, server, endpoint, backend, middleware | 仅实现 -> 全栈 |
| 项目中存在前端框架 | 检测package.json中存在react/vue/svelte/next | 全生命周期 -> 全生命周期含前端 |
| Agent | After Task | Discuss Round | Perspectives |
|---|---|---|---|
| analyst | RESEARCH-001 | DISCUSS-001 | product, risk, coverage |
| writer | DRAFT-001 | DISCUSS-002 | product, technical, quality, coverage |
| writer | DRAFT-002 | DISCUSS-003 | quality, product, coverage |
| writer | DRAFT-003 | DISCUSS-004 | technical, risk |
| writer | DRAFT-004 | DISCUSS-005 | product, technical, quality, coverage |
| reviewer | QUALITY-001 | DISCUSS-006 | all 5 (product, technical, quality, risk, coverage) |
// Agent spawns discuss subagent internally
const discussId = spawn_agent({
message: `| Agent | 完成任务后 | 讨论轮次 | 评审视角 |
|---|---|---|---|
| analyst | RESEARCH-001 | DISCUSS-001 | 产品、风险、覆盖度 |
| writer | DRAFT-001 | DISCUSS-002 | 产品、技术、质量、覆盖度 |
| writer | DRAFT-002 | DISCUSS-003 | 质量、产品、覆盖度 |
| writer | DRAFT-003 | DISCUSS-004 | 技术、风险 |
| writer | DRAFT-004 | DISCUSS-005 | 产品、技术、质量、覆盖度 |
| reviewer | QUALITY-001 | DISCUSS-006 | 全部5项(产品、技术、质量、风险、覆盖度) |
// Agent spawns discuss subagent internally
const discussId = spawn_agent({
message: `
---
---explorations/// Agent spawns explore subagent internally
const exploreId = spawn_agent({
message: `explorations/// Agent spawns explore subagent internally
const exploreId = spawn_agent({
message: `
**Cache lookup rules**:
| Condition | Action |
|-----------|--------|
| Exact angle match exists in cache-index.json | Return cached result |
| No match | Execute exploration, cache result |
| Cache file missing but index has entry | Remove stale entry, re-explore |
---
**缓存查询规则**:
| 条件 | 操作 |
|-----------|--------|
| cache-index.json中存在精确的角度匹配 | 返回缓存结果 |
| 无匹配 | 执行探索,缓存结果 |
| 索引有对应条目但缓存文件缺失 | 删除过期条目,重新探索 |
---wisdom/<session-dir>/wisdom/
+-- learnings.md # Patterns and insights discovered
+-- decisions.md # Architecture and design decisions made
+-- conventions.md # Codebase conventions identified
+-- issues.md # Known risks and issues flaggedwisdom/<session-dir>/wisdom/
+-- learnings.md # 发现的模式和洞察
+-- decisions.md # 做出的架构和设计决策
+-- conventions.md # 识别出的代码库规范
+-- issues.md # 标记的已知风险和问题| Allowed | Prohibited |
|---|---|
| Agent processes only its own prefix tasks | Processing other agents' tasks |
| Agent communicates results via TASK_COMPLETE output | Direct agent-to-agent communication |
| Agent calls discuss/explore subagents internally | Agent modifying orchestrator state file |
| Agent writes artifacts to its designated directory | Agent writing to other agents' directories |
| Agent reads wisdom files and shared-memory.json | Agent deleting or overwriting other agents' artifacts |
| 允许操作 | 禁止操作 |
|---|---|
| Agent仅处理自身前缀的任务 | 处理其他Agent的任务 |
| Agent通过TASK_COMPLETE输出传递结果 | Agent之间直接通信 |
| Agent内部调用discuss/explore子Agent | Agent修改编排器的状态文件 |
| Agent将产出物写入指定目录 | Agent写入其他Agent的目录 |
| Agent读取知识库文件和shared-memory.json | Agent删除或覆盖其他Agent的产出物 |
Round 1: DEV-FE-001 -> QA-FE-001
QA-FE verdict: NEEDS_FIX?
YES -> Round 2: DEV-FE-002(blocked_by: QA-FE-001) -> QA-FE-002(blocked_by: DEV-FE-002)
QA-FE-002 verdict: NEEDS_FIX?
YES -> max rounds reached (2), stop loop, report current state
NO -> proceed to next pipeline step
NO -> proceed to next pipeline stepRound 1: DEV-FE-001 -> QA-FE-001
QA-FE verdict: NEEDS_FIX?
YES -> Round 2: DEV-FE-002(blocked_by: QA-FE-001) -> QA-FE-002(blocked_by: DEV-FE-002)
QA-FE-002 verdict: NEEDS_FIX?
YES -> max rounds reached (2), stop loop, report current state
NO -> proceed to next pipeline step
NO -> proceed to next pipeline step| Mode | Total Tasks | First Task | Checkpoint |
|---|---|---|---|
| spec-only | 6 | RESEARCH-001 | None (QUALITY-001 is final) |
| impl-only | 4 | PLAN-001 | None |
| fe-only | 3 (+GC) | PLAN-001 | None |
| fullstack | 6 | PLAN-001 | None |
| full-lifecycle | 10 | RESEARCH-001 | After QUALITY-001 |
| full-lifecycle-fe | 12 (+GC) | RESEARCH-001 | After QUALITY-001 |
| 模式 | 总任务数 | 首个任务 | 检查点 |
|---|---|---|---|
| 仅规格定义 | 6 | RESEARCH-001 | 无(QUALITY-001是最终步骤) |
| 仅实现 | 4 | PLAN-001 | 无 |
| 仅前端 | 3(+GC循环) | PLAN-001 | 无 |
| 全栈 | 6 | PLAN-001 | 无 |
| 全生命周期 | 10 | RESEARCH-001 | QUALITY-001完成后 |
| 全生命周期含前端 | 12(+GC循环) | RESEARCH-001 | QUALITY-001完成后 |
| Resource | Path (relative to skill) | Usage |
|---|---|---|
| Document Standards | specs/document-standards.md | YAML frontmatter, naming, structure |
| Quality Gates | specs/quality-gates.md | Per-phase quality gates |
| Product Brief Template | templates/product-brief.md | DRAFT-001 |
| Requirements Template | templates/requirements-prd.md | DRAFT-002 |
| Architecture Template | templates/architecture-doc.md | DRAFT-003 |
| Epics Template | templates/epics-template.md | DRAFT-004 |
| 资源 | 路径(相对于skill) | 用途 |
|---|---|---|
| 文档标准 | specs/document-standards.md | YAML frontmatter、命名、结构规范 |
| 质量关卡 | specs/quality-gates.md | 各阶段质量门限 |
| 产品简介模板 | templates/product-brief.md | DRAFT-001 |
| 需求模板 | templates/requirements-prd.md | DRAFT-002 |
| 架构文档模板 | templates/architecture-doc.md | DRAFT-003 |
| 史诗模板 | templates/epics-template.md | DRAFT-004 |
wait()send_input()send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })wait()send_input()send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })