Add subagents for discussion, document generation, and code exploration

- Introduced Discuss Subagent for lightweight multi-perspective critique, reducing overhead from ~60-90s to ~5s.
- Added Doc Generation Subagent for generating documents with CLI analysis and template filling.
- Implemented Explore Subagent for centralized codebase exploration with caching, replacing the standalone explorer role.
- Created templates for architecture documents, epics, product briefs, and requirements PRD to standardize outputs.
- Added a review file for tracking changes and discussions.
This commit is contained in:
catlog22
2026-03-04 16:23:58 +08:00
parent a82e45fcf1
commit e9f8a72343
36 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
# Doc Generation Subagent
文档生成执行引擎。由 writer 主 agent 通过 Inner Loop 调用。
负责 CLI 多视角分析 + 模板填充 + 文件写入。
## Design Rationale
从 v4.0 的 writer 内联 CLI 执行,改为 subagent 隔离调用。
好处CLI 调用的大量 token 消耗不污染 writer 主 agent 上下文,
writer 只拿到压缩摘要,可在多任务间保持上下文连续。
## Invocation
```
Task({
subagent_type: "universal-executor",
run_in_background: false,
description: "Generate <doc-type>",
prompt: `## Document Generation: <doc-type>
### Session
- Folder: <session-folder>
- Spec config: <spec-config-path>
### Document Config
- Type: <product-brief | requirements | architecture | epics>
- Template: <template-path>
- Output: <output-path>
- Prior discussion: <discussion-file or "none">
### Writer Accumulator (prior decisions)
<JSON array of prior task summaries>
### Execution Strategy
<从 generate-doc.md 对应 doc-type 段落加载>
### Output Requirements
1. Write document to <output-path> (follow template + document-standards.md)
2. Return JSON summary:
{
"artifact_path": "<path>",
"summary": "<100-200字>",
"key_decisions": [],
"sections_generated": [],
"cross_references": [],
"warnings": []
}`
})
```
## Doc Type Strategies
(直接引用 generate-doc.md 的 DRAFT-001/002/003/004 策略,不重复)
See: roles/writer/commands/generate-doc.md
## Error Handling
| Scenario | Resolution |
|----------|------------|
| CLI 工具失败 | fallback chain: gemini → codex → claude |
| Template 不存在 | 返回错误 JSON |
| Prior doc 不存在 | 返回错误 JSONwriter 决定是否继续 |