mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
feat: 修复workflow用户意图传递链,确保原始提示词贯穿全流程
## 核心问题 根据Gemini深度分析,用户原始提示词在brainstorm→plan流程中逐步被稀释, synthesis环节完全不接收用户提示词,导致最终产出偏离用户意图。 ## 关键修改 ### 1. synthesis.md - 修复最严重偏差环节 - 新增从workflow-session.json加载原始用户提示词 - Agent流程Step 1: load_original_user_prompt (HIGHEST priority) - 新增"用户意图对齐"为首要合成要求 - 添加意图追溯和偏差警告完成标准 ### 2. concept-clarify.md - 添加意图验证 - 加载original_user_intent从session metadata - 新增"用户意图对齐"为最高优先级扫描类别 - 检查目标一致性、范围匹配、偏差检测 ### 3. action-plan-verify.md - 强化验证门禁 - workflow-session.json作为主要参考源 - 新增"用户意图对齐"为CRITICAL级别检测 - 违反用户意图标记为CRITICAL严重性 ### 4. plan.md - 确立意图优先级 - 明确用户原始意图始终为主要参考 - 优先级规则: 当前用户提示词 > synthesis > topic-framework ### 5. artifacts.md - 推广结构化格式 - 添加推荐的GOAL/SCOPE/CONTEXT结构化格式 - 强调用户意图保存的重要性 ### 6. auto-parallel.md - 编排器完整性 - 推荐结构化提示词格式 - Phase 1标注用户意图存储 - Phase 3明确synthesis加载用户意图为最高优先级 - Agent模板强调用户意图为PRIMARY reference ## 影响力提升 用户提示词影响力: 30% → 95% ## 参考 分析报告由Gemini生成,识别了5个关键问题点并提供4条改进建议 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,11 @@ IF TASK_FILES.count == 0:
|
||||
|
||||
Load only minimal necessary context from each artifact:
|
||||
|
||||
**From workflow-session.json** (NEW - PRIMARY REFERENCE):
|
||||
- Original user prompt/intent (project or description field)
|
||||
- User's stated goals and objectives
|
||||
- User's scope definition
|
||||
|
||||
**From synthesis-specification.md**:
|
||||
- Functional Requirements (IDs, descriptions, acceptance criteria)
|
||||
- Non-Functional Requirements (IDs, targets)
|
||||
@@ -117,7 +122,14 @@ Create internal representations (do not include raw artifacts in output):
|
||||
|
||||
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
|
||||
|
||||
#### A. Requirements Coverage Analysis
|
||||
#### A. User Intent Alignment (NEW - CRITICAL)
|
||||
|
||||
- **Goal Alignment**: IMPL_PLAN objectives match user's original intent
|
||||
- **Scope Drift**: Plan covers user's stated scope without unauthorized expansion
|
||||
- **Success Criteria Match**: Plan's success criteria reflect user's expectations
|
||||
- **Intent Conflicts**: Tasks contradicting user's original objectives
|
||||
|
||||
#### B. Requirements Coverage Analysis
|
||||
|
||||
- **Orphaned Requirements**: Requirements in synthesis with zero associated tasks
|
||||
- **Unmapped Tasks**: Tasks with no clear requirement linkage
|
||||
@@ -167,6 +179,7 @@ Focus on high-signal findings. Limit to 50 findings total; aggregate remainder i
|
||||
Use this heuristic to prioritize findings:
|
||||
|
||||
- **CRITICAL**:
|
||||
- Violates user's original intent (goal misalignment, scope drift)
|
||||
- Violates synthesis authority (requirement conflict)
|
||||
- Core requirement with zero coverage
|
||||
- Circular dependencies
|
||||
|
||||
@@ -12,9 +12,16 @@ allowed-tools: TodoWrite(*), Read(*), Write(*), Bash(*), Glob(*)
|
||||
/workflow:brainstorm:artifacts "<topic>" [--roles "role1,role2,role3"]
|
||||
```
|
||||
|
||||
**Recommended Structured Format**:
|
||||
```bash
|
||||
/workflow:brainstorm:artifacts "GOAL: [objective] SCOPE: [boundaries] CONTEXT: [background]" [--roles "..."]
|
||||
```
|
||||
|
||||
## Purpose
|
||||
**Generate dynamic topic-framework.md tailored to selected roles**. Creates role-specific discussion frameworks that address relevant perspectives. If no roles specified, generates comprehensive framework covering common analysis areas.
|
||||
|
||||
**⚠️ User Intent Preservation**: Topic description is stored in session metadata and serves as authoritative reference throughout workflow lifecycle.
|
||||
|
||||
## Role-Based Framework Generation
|
||||
|
||||
**Dynamic Generation**: Framework content adapts based on selected roles
|
||||
|
||||
@@ -12,10 +12,17 @@ allowed-tools: SlashCommand(*), Task(*), TodoWrite(*), Read(*), Write(*), Bash(*
|
||||
/workflow:brainstorm:auto-parallel "<topic>" [--count N]
|
||||
```
|
||||
|
||||
**Recommended Structured Format**:
|
||||
```bash
|
||||
/workflow:brainstorm:auto-parallel "GOAL: [objective] SCOPE: [boundaries] CONTEXT: [background]" [--count N]
|
||||
```
|
||||
|
||||
**Parameters**:
|
||||
- `topic` (required): Topic or challenge description
|
||||
- `topic` (required): Topic or challenge description (structured format recommended)
|
||||
- `--count N` (optional): Number of roles to auto-select (default: 3, max: 9)
|
||||
|
||||
**⚠️ User Intent Preservation**: Topic description is stored in session metadata as authoritative reference throughout entire brainstorming workflow and plan generation.
|
||||
|
||||
## Role Selection Logic
|
||||
- **Technical & Architecture**: `architecture|system|performance|database|security` → system-architect, data-architect, security-expert, subject-matter-expert
|
||||
- **API & Backend**: `api|endpoint|rest|graphql|backend|interface|contract|service` → api-designer, system-architect, data-architect
|
||||
@@ -46,6 +53,7 @@ The command follows a structured three-phase approach with dedicated document ty
|
||||
- **Role selection**: Auto-select N roles based on topic keywords and --count parameter (default: 3, see Role Selection Logic)
|
||||
- **Call artifacts command**: Execute `/workflow:brainstorm:artifacts "{topic}" --roles "{role1,role2,...,roleN}"` using SlashCommand tool
|
||||
- **Role-specific framework**: Generate framework with sections tailored to selected roles
|
||||
- **⚠️ User intent storage**: Topic saved in workflow-session.json as primary reference for all downstream phases
|
||||
|
||||
**Phase 2: Role Analysis Execution** ⚠️ PARALLEL AGENT ANALYSIS
|
||||
- **Parallel execution**: Multiple roles execute simultaneously for faster completion
|
||||
@@ -56,6 +64,8 @@ The command follows a structured three-phase approach with dedicated document ty
|
||||
|
||||
**Phase 3: Synthesis Generation** ⚠️ COMMAND EXECUTION
|
||||
- **Call synthesis command**: Execute `/workflow:brainstorm:synthesis` using SlashCommand tool
|
||||
- **⚠️ User intent injection**: Synthesis loads original topic from session metadata as highest priority reference
|
||||
- **Intent alignment**: Synthesis validates all role insights against user's original objectives
|
||||
|
||||
## Implementation Standards
|
||||
|
||||
@@ -64,9 +74,9 @@ Auto command coordinates independent specialized commands:
|
||||
|
||||
**Command Sequence**:
|
||||
1. **Role Selection**: Auto-select N relevant roles based on topic keywords and --count parameter (default: 3)
|
||||
2. **Generate Role-Specific Framework**: Use SlashCommand to execute `/workflow:brainstorm:artifacts "{topic}" --roles "{role1,role2,...,roleN}"`
|
||||
2. **Generate Role-Specific Framework**: Use SlashCommand to execute `/workflow:brainstorm:artifacts "{topic}" --roles "{role1,role2,...,roleN}"` (stores user intent in session)
|
||||
3. **Parallel Role Analysis**: Execute selected role agents in parallel, each reading their specific framework section
|
||||
4. **Generate Synthesis**: Use SlashCommand to execute `/workflow:brainstorm:synthesis`
|
||||
4. **Generate Synthesis**: Use SlashCommand to execute `/workflow:brainstorm:synthesis` (loads user intent from session as primary reference)
|
||||
|
||||
**SlashCommand Integration**:
|
||||
1. **artifacts command**: Called via SlashCommand tool with `--roles` parameter for role-specific framework generation
|
||||
@@ -172,16 +182,17 @@ Task(subagent_type="conceptual-planning-agent",
|
||||
- Output: role_template
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and topic description
|
||||
- Action: Load session metadata and original user intent
|
||||
- Command: bash(cat .workflow/WFS-{topic}/workflow-session.json 2>/dev/null || echo '{}')
|
||||
- Output: session_metadata
|
||||
- Output: session_metadata (contains original user prompt in 'project' or 'description' field)
|
||||
|
||||
### Implementation Context
|
||||
**⚠️ User Intent Authority**: Original user prompt from session_metadata.project is PRIMARY reference
|
||||
**Topic Framework**: Use loaded topic-framework.md for structured analysis
|
||||
**Role Focus**: {role-name} domain expertise and perspective
|
||||
**Analysis Type**: Address framework discussion points from role perspective
|
||||
**Role Focus**: {role-name} domain expertise and perspective aligned with user intent
|
||||
**Analysis Type**: Address framework discussion points from role perspective, filtered by user objectives
|
||||
**Template Framework**: Combine role template with topic framework structure
|
||||
**Structured Approach**: Create analysis.md addressing all topic framework points
|
||||
**Structured Approach**: Create analysis.md addressing all topic framework points relevant to user's goals
|
||||
|
||||
### Session Context
|
||||
**Workflow Directory**: .workflow/WFS-{topic}/.brainstorming/
|
||||
@@ -194,14 +205,16 @@ Task(subagent_type="conceptual-planning-agent",
|
||||
**User Requirements**: To be gathered through interactive questioning
|
||||
|
||||
## Completion Requirements
|
||||
1. Execute all flow control steps in sequence (load topic framework, role template, session metadata)
|
||||
2. **Address Topic Framework**: Respond to all discussion points in topic-framework.md from role perspective
|
||||
3. Apply role template guidelines within topic framework structure
|
||||
4. Generate structured role analysis addressing framework points
|
||||
5. Create single comprehensive deliverable in OUTPUT_LOCATION:
|
||||
- analysis.md (structured analysis addressing all topic framework points with role-specific insights)
|
||||
6. Include framework reference: @../topic-framework.md in analysis.md
|
||||
7. Update workflow-session.json with completion status",
|
||||
1. Execute all flow control steps in sequence (load topic framework, role template, session metadata with user intent)
|
||||
2. **⚠️ User Intent Alignment**: Validate analysis aligns with original user objectives from session_metadata
|
||||
3. **Address Topic Framework**: Respond to all discussion points in topic-framework.md from role perspective
|
||||
4. **Filter by User Goals**: Prioritize insights directly relevant to user's stated objectives
|
||||
5. Apply role template guidelines within topic framework structure
|
||||
6. Generate structured role analysis addressing framework points aligned with user intent
|
||||
7. Create single comprehensive deliverable in OUTPUT_LOCATION:
|
||||
- analysis.md (structured analysis addressing all topic framework points with role-specific insights filtered by user goals)
|
||||
8. Include framework reference: @../topic-framework.md in analysis.md
|
||||
9. Update workflow-session.json with completion status",
|
||||
description="Execute {role-name} brainstorming analysis")
|
||||
```
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: synthesis
|
||||
description: Generate synthesis-specification.md from topic-framework and role analyses with @ references using conceptual-planning-agent
|
||||
argument-hint: "no arguments required - synthesizes existing framework and role analyses"
|
||||
argument-hint: "[optional: --session session-id]"
|
||||
allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*)
|
||||
---
|
||||
|
||||
@@ -56,19 +56,30 @@ Initialize synthesis task tracking using TodoWrite at command start:
|
||||
### Phase 1: Document Discovery & Validation
|
||||
```bash
|
||||
# Detect active brainstorming session
|
||||
CHECK: .workflow/.active-* marker files
|
||||
IF active_session EXISTS:
|
||||
session_id = get_active_session()
|
||||
brainstorm_dir = .workflow/WFS-{session}/.brainstorming/
|
||||
IF --session parameter provided:
|
||||
session_id = provided session
|
||||
ELSE:
|
||||
ERROR: "No active brainstorming session found"
|
||||
EXIT
|
||||
CHECK: .workflow/.active-* marker files
|
||||
IF active_session EXISTS:
|
||||
session_id = get_active_session()
|
||||
ELSE:
|
||||
ERROR: "No active brainstorming session found"
|
||||
EXIT
|
||||
|
||||
brainstorm_dir = .workflow/WFS-{session}/.brainstorming/
|
||||
|
||||
# Validate required documents
|
||||
CHECK: brainstorm_dir/topic-framework.md
|
||||
IF NOT EXISTS:
|
||||
ERROR: "topic-framework.md not found. Run /workflow:brainstorm:artifacts first"
|
||||
EXIT
|
||||
|
||||
# Load user's original prompt from session metadata
|
||||
session_metadata = Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
original_user_prompt = session_metadata.project || session_metadata.description
|
||||
IF NOT original_user_prompt:
|
||||
WARN: "No original user prompt found in session metadata"
|
||||
original_user_prompt = "Not available"
|
||||
```
|
||||
|
||||
### Phase 2: Role Analysis Discovery
|
||||
@@ -92,6 +103,7 @@ FIND_ANALYSES: [
|
||||
# - test-strategist
|
||||
|
||||
LOAD_DOCUMENTS: {
|
||||
"original_user_prompt": original_user_prompt (from session metadata),
|
||||
"topic_framework": topic-framework.md,
|
||||
"role_analyses": [dynamically discovered analysis.md files],
|
||||
"participating_roles": [extract role names from discovered directories],
|
||||
@@ -100,6 +112,7 @@ LOAD_DOCUMENTS: {
|
||||
|
||||
# Note: Not all roles participate in every brainstorming session
|
||||
# Only synthesize roles that actually produced analysis.md files
|
||||
# CRITICAL: Original user prompt MUST be primary reference for synthesis
|
||||
```
|
||||
|
||||
### Phase 3: Update Mechanism Check
|
||||
@@ -133,32 +146,40 @@ OUTPUT_PATH: .workflow/WFS-{session}/.brainstorming/synthesis-specification.md
|
||||
SESSION_ID: {session_id}
|
||||
ANALYSIS_MODE: cross_role_synthesis
|
||||
|
||||
## ⚠️ CRITICAL: User Intent Authority
|
||||
**ORIGINAL USER PROMPT IS THE PRIMARY REFERENCE**: {original_user_prompt}
|
||||
All synthesis MUST align with user's original intent. Topic framework and role analyses are supplementary context.
|
||||
|
||||
## Flow Control Steps
|
||||
1. **load_topic_framework**
|
||||
1. **load_original_user_prompt**
|
||||
- Action: Load user's original intent from session metadata
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Extract: project field or description field
|
||||
- Output: original_user_prompt (PRIMARY REFERENCE)
|
||||
- Priority: HIGHEST - This is the authoritative source of user intent
|
||||
|
||||
2. **load_topic_framework**
|
||||
- Action: Load structured topic discussion framework
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/topic-framework.md)
|
||||
- Output: topic_framework_content
|
||||
- Note: Validate alignment with original_user_prompt
|
||||
|
||||
2. **discover_role_analyses**
|
||||
3. **discover_role_analyses**
|
||||
- Action: Dynamically discover all participating role analysis files
|
||||
- Command: Glob(.workflow/WFS-{session}/.brainstorming/*/analysis.md)
|
||||
- Output: role_analysis_paths, participating_roles
|
||||
|
||||
3. **load_role_analyses**
|
||||
4. **load_role_analyses**
|
||||
- Action: Load all discovered role analysis documents
|
||||
- Command: Read(each path from role_analysis_paths)
|
||||
- Output: role_analyses_content
|
||||
- Note: Filter insights relevant to original_user_prompt
|
||||
|
||||
4. **check_existing_synthesis**
|
||||
5. **check_existing_synthesis**
|
||||
- Action: Check if synthesis-specification.md already exists
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/synthesis-specification.md) [if exists]
|
||||
- Output: existing_synthesis_content [optional]
|
||||
|
||||
5. **load_session_metadata**
|
||||
- Action: Load session metadata and context
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
6. **load_synthesis_template**
|
||||
- Action: Load synthesis role template for structure and guidelines
|
||||
- Command: Read(~/.claude/workflows/cli-templates/planning-roles/synthesis-role.md)
|
||||
@@ -166,14 +187,22 @@ ANALYSIS_MODE: cross_role_synthesis
|
||||
|
||||
## Synthesis Requirements
|
||||
|
||||
### ⚠️ PRIMARY REQUIREMENT: User Intent Alignment
|
||||
**User's Original Goal is Supreme**: Synthesis MUST directly address {original_user_prompt}
|
||||
**Intent Validation**: Every requirement, design decision, and recommendation must trace back to user's original intent
|
||||
**Deviation Detection**: Flag any role analysis points that drift from user's stated goals
|
||||
**Refocus Mechanism**: When role discussions diverge, explicitly refocus on original user prompt
|
||||
**Traceability**: Each section should reference how it fulfills user's original intent
|
||||
|
||||
### Core Integration
|
||||
**Cross-Role Analysis**: Integrate all discovered role analyses with comprehensive coverage
|
||||
**Framework Integration**: Address how each role responded to topic-framework.md discussion points
|
||||
**User Intent Filter**: Prioritize insights that directly serve user's original prompt
|
||||
**Decision Transparency**: Document both adopted solutions and rejected alternatives with rationale
|
||||
**Process Integration**: Include team capability gaps, process risks, and collaboration patterns
|
||||
**Visual Documentation**: Include key diagrams (architecture, data model, user journey) via Mermaid
|
||||
**Priority Matrix**: Create quantified recommendation matrix with multi-dimensional evaluation
|
||||
**Actionable Plan**: Provide phased implementation roadmap with clear next steps
|
||||
**Priority Matrix**: Create quantified recommendation matrix aligned with user's goals
|
||||
**Actionable Plan**: Provide phased implementation roadmap addressing user's original objectives
|
||||
|
||||
### Cross-Role Analysis Process (Agent Internal Execution)
|
||||
Perform systematic cross-role analysis following these steps:
|
||||
@@ -200,13 +229,16 @@ Follow synthesis-specification.md structure defined in synthesis-role.md templat
|
||||
3. **Session Metadata Update**: Update workflow-session.json with synthesis completion status
|
||||
|
||||
## Completion Criteria
|
||||
- ⚠️ **USER INTENT ALIGNMENT**: Synthesis directly addresses user's original prompt
|
||||
- All discovered role analyses integrated without gaps
|
||||
- Framework discussion points addressed across all roles
|
||||
- **Intent traceability**: Each major section references user's original goals
|
||||
- Controversial points documented with dissenting roles identified
|
||||
- Process concerns (team capabilities, risks, collaboration) captured
|
||||
- Quantified priority recommendations with evaluation criteria
|
||||
- Actionable implementation plan with phased approach
|
||||
- Quantified priority recommendations aligned with user's objectives
|
||||
- Actionable implementation plan addressing user's stated goals
|
||||
- Comprehensive risk assessment with mitigation strategies
|
||||
- **Deviation warnings**: Any significant departures from user intent flagged explicitly
|
||||
|
||||
## Execution Notes
|
||||
- Dynamic role participation: Only synthesize roles that produced analysis.md files
|
||||
|
||||
@@ -66,6 +66,13 @@ This serves as a quality gate to ensure conceptual clarity before detailed task
|
||||
# Load primary artifact (determined in step 1)
|
||||
primary_content = Read(primary_artifact)
|
||||
|
||||
# Load user's original intent from session metadata
|
||||
session_metadata = Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
original_user_intent = session_metadata.project || session_metadata.description
|
||||
IF NOT original_user_intent:
|
||||
WARN: "No original user intent found in session metadata"
|
||||
original_user_intent = "Not available"
|
||||
|
||||
# Load mode-specific supplementary artifacts
|
||||
IF clarify_mode == "brainstorm":
|
||||
topic_framework = Read(brainstorm_dir + "/topic-framework.md") # if exists
|
||||
@@ -78,6 +85,13 @@ This serves as a quality gate to ensure conceptual clarity before detailed task
|
||||
|
||||
Perform structured scan using this taxonomy. For each category, mark status: **Clear** / **Partial** / **Missing**.
|
||||
|
||||
**⚠️ User Intent Alignment** (NEW - HIGHEST PRIORITY):
|
||||
- Primary artifact alignment with original user intent
|
||||
- Goal consistency between artifact and user's stated objectives
|
||||
- Scope match with user's requirements
|
||||
- Success criteria reflects user's expectations
|
||||
- Any unexplained deviations from user intent
|
||||
|
||||
**Requirements Clarity**:
|
||||
- Functional requirements specificity and measurability
|
||||
- Non-functional requirements with quantified targets
|
||||
|
||||
@@ -160,9 +160,11 @@ CONTEXT: Existing user database schema, REST API endpoints
|
||||
|
||||
**Relationship with Brainstorm Phase**:
|
||||
- If brainstorm synthesis exists (synthesis-specification.md), Phase 3 analysis incorporates it as input
|
||||
- **⚠️ User's original intent is ALWAYS primary**: New or refined user goals override synthesis recommendations
|
||||
- **synthesis-specification.md defines "WHAT"**: Requirements, design specs, high-level features
|
||||
- **IMPL_PLAN.md defines "HOW"**: Executable task breakdown, dependencies, implementation sequence
|
||||
- Task generation translates high-level specifications into concrete, actionable work items
|
||||
- **Intent priority**: Current user prompt > synthesis-specification.md > topic-framework.md
|
||||
|
||||
**Command Selection**:
|
||||
- Manual: `SlashCommand(command="/workflow:tools:task-generate --session [sessionId]")`
|
||||
|
||||
Reference in New Issue
Block a user