From 9082951519f7aa5dc2e703396d67f2ffb3823078 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Fri, 12 Sep 2025 16:07:17 +0800 Subject: [PATCH] docs: Clarify Gemini CLI marker system and analysis_source assignment logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add explicit analysis_source assignment rules in plan.md (manual/gemini/auto-detected) - Enhance GEMINI_CLI_REQUIRED marker documentation in code-developer.md and execute.md - Specify fixed analysis_source="gemini" setting for plan-deep.md - Add mapping rules from analysis_source values to CLI markers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .claude/agents/code-developer.md | 10 ++++++++-- .claude/commands/workflow/execute.md | 17 ++++++++++++----- .claude/commands/workflow/plan-deep.md | 2 ++ .claude/commands/workflow/plan.md | 10 ++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.claude/agents/code-developer.md b/.claude/agents/code-developer.md index c768da78..47099579 100644 --- a/.claude/agents/code-developer.md +++ b/.claude/agents/code-developer.md @@ -37,12 +37,18 @@ You are a code execution specialist focused on implementing high-quality, produc ``` IF context sufficient for implementation: → Proceed with execution -ELIF context insufficient: - → Use Gemini CLI for codebase analysis +ELIF context insufficient OR task has [GEMINI_CLI_REQUIRED] marker: + → Execute Gemini CLI for codebase analysis (MANDATORY) → Extract patterns and conventions → Proceed with execution ``` +**Gemini CLI Marker System**: +- **[GEMINI_CLI_REQUIRED]**: Mandatory analysis flag + - **Trigger**: Auto-added when task.analysis_source = "gemini" or scope > 3 files + - **Action**: MUST run Gemini CLI first to gather context + - **Purpose**: Ensures code aligns with existing patterns + **Gemini CLI Usage Standards**: Follow unified Gemini CLI guidelines: @~/.claude/workflows/gemini-unified.md diff --git a/.claude/commands/workflow/execute.md b/.claude/commands/workflow/execute.md index b50393d7..f7a6e3fd 100644 --- a/.claude/commands/workflow/execute.md +++ b/.claude/commands/workflow/execute.md @@ -13,9 +13,6 @@ examples: Coordinates multiple agents for executing existing workflow tasks through automatic discovery and intelligent task orchestration. Analyzes workflow folders, checks task statuses, and coordinates agent execution based on discovered plans. ## Core Principles - -**Session Management:** @~/.claude/workflows/workflow-architecture.md -**Agent Orchestration:** @~/.claude/workflows/agent-orchestration-patterns.md ## Execution Philosophy @@ -26,7 +23,15 @@ The intelligent execution approach focuses on: - **Dynamic task orchestration** - Coordinate based on discovered task relationships - **Progress tracking** - Update task status after agent completion -**IMPORTANT**: Gemini context analysis is automatically applied based on discovered task scope and requirements. +**GEMINI_CLI_REQUIRED Marker**: +- **Purpose**: Forces agent to analyze existing codebase before implementation +- **Auto-trigger**: When task.analysis_source = "gemini" OR scope > 3 files +- **Agent Action**: MUST execute Gemini CLI as first step + +**analysis_source 到标记的映射**: +- **"gemini"** → 添加 [GEMINI_CLI_REQUIRED] +- **"auto-detected"** + scope > 3 files → 添加 [GEMINI_CLI_REQUIRED] +- **"manual"** → 不添加标记 ## Execution Flow @@ -60,6 +65,8 @@ Workflow Discovery: - [ ] **TASK-002**: [Agent: code-developer] [GEMINI_CLI_REQUIRED] Implement auth logic (impl-1.2) - [ ] **TASK-003**: [Agent: code-review-agent] Review implementations - [ ] **TASK-004**: Update task statuses and session state + +**Marker Legend**: [GEMINI_CLI_REQUIRED] = Agent must analyze codebase context first ``` ### 3. Agent Context Assignment @@ -130,7 +137,7 @@ For each executable task: - **Risk Awareness**: Alert agents to implementation.context_notes.risks before execution - **Workflow Integration**: Include session state and IMPL_PLAN.md context - **Scope Focus**: Direct agents to specific files from implementation.files[].path -- **Gemini Flags**: Auto-add [GEMINI_CLI_REQUIRED] when analysis_source is "gemini" +- **Gemini Marker**: Auto-add [GEMINI_CLI_REQUIRED] when analysis_source = "gemini" ### 4. Agent Execution & Progress Tracking diff --git a/.claude/commands/workflow/plan-deep.md b/.claude/commands/workflow/plan-deep.md index 464be733..edc2a86b 100644 --- a/.claude/commands/workflow/plan-deep.md +++ b/.claude/commands/workflow/plan-deep.md @@ -85,6 +85,7 @@ Task(action-planning-agent): - Skip PRD processing (no PRD provided) - Skip session inheritance (standalone planning) - Force GEMINI_CLI_REQUIRED flag = true + - Set analysis_source = "gemini" (深度分析固定值) - Generate hierarchical task decomposition - Create detailed IMPL_PLAN.md with subtasks - Generate TODO_LIST.md for tracking @@ -120,6 +121,7 @@ def process_plan_deep_command(input): MANDATORY FLAGS: - GEMINI_CLI_REQUIRED = true + - analysis_source = "gemini" (固定设置) - FORCE_PARALLEL_ANALYSIS = true - SKIP_PRD = true - SKIP_SESSION_INHERITANCE = true diff --git a/.claude/commands/workflow/plan.md b/.claude/commands/workflow/plan.md index 5b9b57c0..5711748a 100644 --- a/.claude/commands/workflow/plan.md +++ b/.claude/commands/workflow/plan.md @@ -83,6 +83,16 @@ The command automatically detects input type: ### Implementation Field Requirements ⚠️ **CRITICAL**: All generated tasks must include detailed implementation guidance +**analysis_source 赋值规则**: +- **"manual"**: 用户提供完整实现细节(包含具体文件、代码片段) +- **"gemini"**: 信息不足,需要 Gemini 分析(缺少文件路径或代码上下文) +- **"auto-detected"**: 系统自动推断实现细节(基于模式识别) + +**判断流程**: +1. **IF** 用户提供文件路径 + 代码片段 → "manual" +2. **ELIF** 系统能推断实现位置 → "auto-detected" +3. **ELSE** → "gemini" (需要深度分析) + **Auto-fill Strategy**: 1. **Sufficient Information**: Auto-fill implementation field based on user input and project context 2. **Insufficient Information**: Mark analysis_source as "gemini" and prompt: