统一命令调用格式从 /workflow/session/list 改为 /workflow:session:list ## 修复范围 - workflow/session/: 6个子命令 (start, pause, resume, list, status, switch) - workflow/issue/: 4个子命令 (create, list, update, close) - workflow/: 3个主命令 (plan, execute, review) - task/: 4个命令 (create, execute, breakdown, replan) - gemini/: 3个命令 (chat, execute, analyze) ## 格式统一 - usage行: /workflow:session:list - examples: /workflow:session:start "任务" - 标题: # Command (/workflow:session:start) - 内容引用: 所有命令路径统一使用冒号格式 ## 验证完成 ✅ 24个命令文件全部采用统一格式 ✅ 所有examples和内容引用保持一致 ✅ parent字段同步更新 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
8.2 KiB
name, parent, description, usage, argument-hint, examples, allowed-tools, model
| name | parent | description | usage | argument-hint | examples | allowed-tools | model | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| gemini-chat | /gemini | Single-execution Gemini CLI interaction command with dynamic template selection for codebase analysis | /gemini:chat "inquiry" | your question or analysis request |
|
Bash(gemini:*), Bash(~/.claude/scripts/chat-template-load.sh:*) | sonnet |
🚀 Command Overview: /gemini:chat
- Type: Gemini CLI Execution Wrapper
- Purpose: To provide direct interaction with the
geminiCLI, enhanced with intelligent, dynamic prompt template selection for codebase analysis. - Core Tools:
Bash(gemini:*): Executes the external Gemini CLI tool.Bash(~/.claude/scripts/chat-template-load.sh:*): Manages all template discovery and selection logic.
📥 Parameters & Usage
<inquiry>(Required): Your primary question or analysis request.--all-files(Optional): Includes the entire codebase in the analysis context.--compress(Optional): Applies context compression for large prompts.--save-session(Optional): Saves the full interaction to current workflow session directory.- File References: Explicitly specify files or patterns within the inquiry using
@{path/to/file}.
🔄 Core Execution Workflow
⚠️ IMPORTANT: Template selection is AUTOMATIC based on input analysis and is the FIRST STEP in command execution.
Parse Input & Intent -> Auto-Select Template -> Load Selected Template -> Determine Context Needs -> Assemble Context -> Construct Prompt -> Execute Gemini CLI -> (Optional) Save Session
🧠 Template Selection Logic
⚠️ CRITICAL: Templates are selected AUTOMATICALLY by analyzing user input. The command execution calls script methods to discover and select the best template.
Script Methods Available:
~/.claude/scripts/chat-template-load.sh list- Lists all available templates~/.claude/scripts/chat-template-load.sh load "template_name"- Loads a specific template
FUNCTION automatic_template_selection(user_inquiry):
// STEP 1: Command execution calls list method to discover templates
available_templates = call_script_method("list")
// STEP 2: Analyze user input to determine best template match
analyzed_intent = analyze_input_keywords_and_context(user_inquiry)
best_template = match_template_to_intent(analyzed_intent, available_templates)
// STEP 3: Command execution calls load method with selected template
IF best_template is FOUND:
template_content = call_script_method("load", best_template.name)
log_info("Auto-selected template: " + best_template.name)
ELSE:
// Fallback to default template if no clear match
template_content = call_script_method("load", "default")
log_warning("No clear template match, using default template")
RETURN template_content
END FUNCTION
Automatic Selection Flow:
- Command starts → Calls
listmethod to discover available templates - Input analysis → Analyzes user inquiry for keywords, intent, and context
- Template matching → Automatically selects best template based on analysis
- Template loading → Command calls
loadmethod with selected template name - Continue execution → Process the inquiry with loaded template
📚 Context Assembly Priority
Context is gathered based on a clear hierarchy of sources.
- Template Requirements: The primary driver. The selected template defines a default set of required file patterns.
- User-Explicit Files: Files specified by the user (e.g.,
@{src/auth/*.js}) override or add to the template's requirements. - Command-Level Flags: The
--all-filesflag overrides all other file specifications to scope the context to the entire project.
📝 Structured Prompt Format
The final prompt sent to the gemini CLI is assembled in three distinct parts.
=== SYSTEM PROMPT ===
[Content from the selected template file is placed here]
=== CONTEXT ===
@{CLAUDE.md,**/*CLAUDE.md} [Project guidelines, always included]
@{target_files} [File context gathered based on the assembly priority]
=== USER INPUT ===
[The original user inquiry text]
⚙️ Gemini CLI Execution Logic
This describes how the external gemini binary is invoked with the constructed prompt.
FUNCTION execute_gemini_cli(structured_prompt, flags):
// Retrieves the path from the user's execution environment.
current_directory = get_current_working_directory()
IF flags contain "--all-files":
// For --all-files, it may be necessary to navigate to the correct directory first.
navigate_to_project_root(current_directory)
// Executes the gemini tool using the --all-files flag.
result = execute_tool("Bash(gemini:*)", "--all-files", "-p", structured_prompt)
ELSE:
// Default execution relies on @{file_patterns} resolved by the Gemini CLI.
// The prompt already contains the necessary @{...} references.
result = execute_tool("Bash(gemini:*)", "-p", structured_prompt)
IF result is 'FAILED' AND flags contain "--all-files":
// Implements the fallback strategy if --all-files fails.
log_warning("`--all-files` failed. Falling back to pattern-based context.")
prompt_with_fallback = add_file_patterns_to_prompt(structured_prompt)
result = execute_tool("Bash(gemini:*)", "-p", prompt_with_fallback)
RETURN result
END FUNCTION
💾 Session Persistence
⚠️ CRITICAL: Before saving, MUST check for existing active session to avoid creating duplicate sessions.
- Trigger: Activated by the
--save-sessionflag. - Action: Saves the complete interaction, including the template used, context, and Gemini's output.
- Session Check: Check for
.workflow/.active-*marker file to identify current active session. No file creation needed. - Location Strategy:
- IF active session exists: Save to existing
.workflow/WFS-[topic-slug]/.chat/directory - IF no active session: Create new session directory following WFS naming convention
- IF active session exists: Save to existing
File Structure: @~/.claude/workflows/file-structure-standards.md
- File Format:
chat-YYYYMMDD-HHMMSS.mdwith timestamp for unique identification. - Structure: Integrates with session management system using WFS-[topic-slug] format for consistency.
- Coordination: Session files coordinate with workflow-session.json and maintain document-state separation.
🔗 Chat Session Integration
Session Detection Workflow:
FUNCTION determine_save_location():
// STEP 1: Check for active session marker
active_marker = find_file(".workflow/.active-*")
// STEP 2: Extract session name if marker exists
active_session_name = extract_session_name(active_marker)
IF active_sessions.count > 0:
// Use existing active session directory
session_dir = active_sessions[0].session_path + "/.chat/"
ensure_directory_exists(session_dir)
RETURN session_dir
ELSE:
// No active session - create new one only if necessary
new_session_slug = generate_topic_slug(user_inquiry)
session_dir = ".workflow/WFS-" + new_session_slug + "/.chat/"
create_session_structure(session_dir)
RETURN session_dir
END FUNCTION
Storage Structure:
.workflow/WFS-[topic-slug]/.chat/
├── chat-20240307-143022.md # Individual chat sessions
├── chat-20240307-151445.md # Timestamped for chronological order
└── analysis-security.md # Named analysis sessions
Session Template:
# Chat Session: [Timestamp] - [Topic]
## Query
[Original user inquiry]
## Template Used
[Auto-selected template name and rationale]
## Context
[Files and patterns included in analysis]
## Gemini Response
[Complete response from Gemini CLI]
## Key Insights
- [Important findings]
- [Architectural insights]
- [Implementation recommendations]
## Integration Links
- [🔙 Workflow Session](../workflow-session.json)
- [📋 Implementation Plan](../IMPL_PLAN.md)
- [📝 Task Definitions](../.task/)