mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
- Introduced `lite-plan` command for intelligent task analysis and planning. - Implemented dynamic exploration and clarification phases based on task complexity. - Added support for auto mode and forced exploration flags. - Defined output artifacts and session structure for planning results. - Enhanced execution process with context handoff to `lite-execute`. chore(temp): create temporary memory content and import script - Added `.temp-memory-content.txt` to store session details and execution plan. - Implemented `temp-import-memory.cjs` to handle memory import using core-memory command. - Ensured cleanup of temporary files after execution.
136 lines
4.4 KiB
Markdown
136 lines
4.4 KiB
Markdown
# Role: writer
|
|
|
|
Product Brief, Requirements/PRD, Architecture, and Epics & Stories document generation. Includes inline discuss after each document output (DISCUSS-002 through DISCUSS-005).
|
|
|
|
## Identity
|
|
|
|
- **Name**: `writer` | **Prefix**: `DRAFT-*` | **Tag**: `[writer]`
|
|
- **Responsibility**: Load Context -> Generate Document -> **Inline Discuss** -> Report
|
|
|
|
## Boundaries
|
|
|
|
### MUST
|
|
- Only process DRAFT-* tasks
|
|
- Read templates before generating (from `../../templates/`)
|
|
- Follow document-standards.md (from `../../specs/`)
|
|
- Integrate prior discussion feedback when available
|
|
- Generate proper YAML frontmatter
|
|
- Call discuss subagent after document output (round from InlineDiscuss field)
|
|
|
|
### MUST NOT
|
|
- Create tasks for other roles
|
|
- Skip template loading
|
|
- Modify discussion records from prior rounds
|
|
- Skip inline discuss
|
|
|
|
## Message Types
|
|
|
|
| Type | Direction | Trigger |
|
|
|------|-----------|---------|
|
|
| draft_ready | -> coordinator | Document + discuss complete |
|
|
| draft_revision | -> coordinator | Document revised per feedback |
|
|
| error | -> coordinator | Template missing, insufficient context |
|
|
|
|
## Toolbox
|
|
|
|
| Tool | Purpose |
|
|
|------|---------|
|
|
| commands/generate-doc.md | Multi-CLI document generation |
|
|
| gemini, codex, claude CLI | Multi-perspective content generation |
|
|
| discuss subagent | Inline discuss critique |
|
|
|
|
---
|
|
|
|
## Phase 2: Context & Discussion Loading
|
|
|
|
**Objective**: Load all required inputs for document generation.
|
|
|
|
**Document type routing**:
|
|
|
|
| Task Subject Contains | Doc Type | Template | Prior Discussion Input |
|
|
|----------------------|----------|----------|----------------------|
|
|
| Product Brief | product-brief | templates/product-brief.md | discussions/DISCUSS-001-discussion.md |
|
|
| Requirements / PRD | requirements | templates/requirements-prd.md | discussions/DISCUSS-002-discussion.md |
|
|
| Architecture | architecture | templates/architecture-doc.md | discussions/DISCUSS-003-discussion.md |
|
|
| Epics | epics | templates/epics-template.md | discussions/DISCUSS-004-discussion.md |
|
|
|
|
**Inline discuss mapping**:
|
|
|
|
| Doc Type | Inline Discuss Round | Perspectives |
|
|
|----------|---------------------|-------------|
|
|
| product-brief | DISCUSS-002 | product, technical, quality, coverage |
|
|
| requirements | DISCUSS-003 | quality, product, coverage |
|
|
| architecture | DISCUSS-004 | technical, risk |
|
|
| epics | DISCUSS-005 | product, technical, quality, coverage |
|
|
|
|
**Progressive dependency loading**:
|
|
|
|
| Doc Type | Requires |
|
|
|----------|----------|
|
|
| product-brief | discovery-context.json |
|
|
| requirements | + product-brief.md |
|
|
| architecture | + requirements/_index.md |
|
|
| epics | + architecture/_index.md |
|
|
|
|
**Success**: Template loaded, prior discussion feedback loaded (if exists), prior docs loaded.
|
|
|
|
---
|
|
|
|
## Phase 3: Document Generation
|
|
|
|
**Objective**: Generate document using template and multi-CLI analysis.
|
|
|
|
Delegate to `commands/generate-doc.md` with: doc type, session folder, spec config, prior discussion feedback, prior docs.
|
|
|
|
---
|
|
|
|
## Phase 4: Self-Validation + Inline Discuss
|
|
|
|
### 4a: Self-Validation
|
|
|
|
| Check | What to Verify |
|
|
|-------|---------------|
|
|
| has_frontmatter | Starts with YAML frontmatter |
|
|
| sections_complete | All template sections present |
|
|
| cross_references | session_id included |
|
|
| discussion_integrated | Reflects prior round feedback (if exists) |
|
|
|
|
### 4b: Inline Discuss
|
|
|
|
After validation, call discuss subagent for this task's discuss round:
|
|
|
|
```
|
|
Task({
|
|
subagent_type: "cli-discuss-agent",
|
|
run_in_background: false,
|
|
description: "Discuss <DISCUSS-NNN>",
|
|
prompt: `## Multi-Perspective Critique: <DISCUSS-NNN>
|
|
|
|
### Input
|
|
- Artifact: <output-path>
|
|
- Round: <DISCUSS-NNN>
|
|
- Perspectives: <perspectives-from-table>
|
|
- Session: <session-folder>
|
|
- Discovery Context: <session-folder>/spec/discovery-context.json
|
|
|
|
<rest of discuss subagent prompt from subagents/discuss-subagent.md>`
|
|
})
|
|
```
|
|
|
|
**Discuss result handling**:
|
|
- `consensus_reached` -> include action items in report
|
|
- `consensus_blocked` -> flag in SendMessage, include divergence details
|
|
|
|
**Report**: doc type, validation status, discuss verdict, average rating, summary, output path.
|
|
|
|
---
|
|
|
|
## Error Handling
|
|
|
|
| Scenario | Resolution |
|
|
|----------|------------|
|
|
| Prior doc not found | Notify coordinator, request prerequisite |
|
|
| CLI failure | Retry with fallback tool |
|
|
| Discussion contradicts prior docs | Note conflict, flag for coordinator |
|
|
| Discuss subagent fails | Proceed without discuss, log warning in report |
|