## Major Changes ### Gemini CLI Integration (google-gemini/gemini-cli#11228) - Migrate from wrapper scripts to native Gemini CLI v0.11.0-nightly - Remove `-p` flag requirement for prompt strings - Deprecate `gemini-wrapper` and `qwen-wrapper` scripts - Update all commands and workflows to use direct CLI syntax ### Command Syntax Updates - **Before**: `gemini -p "CONTEXT: @**/* prompt"` - **After**: `gemini "CONTEXT: @**/* prompt"` - Apply to all 70+ command files and workflow templates - Maintain backward compatibility for Qwen fallback ### File Pattern Migration - Replace `@{CLAUDE.md}` with `@CLAUDE.md` - Replace `@{**/*}` with `@**/*` - Update all file references to use direct @ notation - Remove legacy brace syntax across all documentation ### Documentation Improvements - Reorganize `intelligent-tools-strategy.md` structure - Add Quick Start section with decision matrix - Enhance `--include-directories` best practices - Add comprehensive command templates and examples - Improve navigation with clearer section hierarchy ### Files Modified (75+ files) - Commands: All CLI commands updated (cli/, workflow/, task/, memory/) - Workflows: Core strategy files and templates - Agents: CLI execution agent and doc generator - Templates: Planning roles and tech stack guides ## Breaking Changes - Gemini CLI v0.11.0-nightly or later required - Old wrapper scripts no longer supported - Legacy `@{pattern}` syntax deprecated ## Migration Guide Users should: 1. Update Gemini CLI to v0.11.0-nightly or later 2. Remove `-p` flag from existing commands 3. Update file patterns from `@{pattern}` to `@pattern` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
7.5 KiB
name, description, argument-hint, allowed-tools, examples
| name | description | argument-hint | allowed-tools | examples | ||
|---|---|---|---|---|---|---|
| load | Load project memory by delegating to agent, returns structured core content package for subsequent operations | [--tool gemini|qwen] "task context description" | Task(*), Bash(*) |
|
Memory Load Command (/memory:load)
1. Overview
The memory:load command delegates to a general-purpose agent to analyze the project and return a structured "Core Content Pack". This pack is loaded into the main thread's memory, providing essential context for subsequent agent operations while minimizing token consumption.
Core Philosophy:
- Agent-Driven: Fully delegates execution to general-purpose agent
- Read-Only Analysis: Does not modify code, only extracts context
- Structured Output: Returns standardized JSON content package
- Memory Optimization: Package loaded directly into main thread memory
- Token Efficiency: CLI analysis executed within agent to save tokens
2. Parameters
-
"task context description"(Required): Task description to guide context extraction- Example: "在当前前端基础上开发用户认证功能"
- Example: "重构支付模块API"
- Example: "修复数据库查询性能问题"
-
--tool <gemini|qwen>(Optional): Specify CLI tool for agent to use (default: gemini)- gemini: Large context window, suitable for complex project analysis
- qwen: Alternative to Gemini with similar capabilities
3. Agent-Driven Execution Flow
The command fully delegates to general-purpose agent, which autonomously:
- Analyzes Project Structure: Executes
get_modules_by_depth.shto understand architecture - Loads Documentation: Reads CLAUDE.md, README.md and other key docs
- Extracts Keywords: Derives core keywords from task description
- Discovers Files: Uses MCP code-index or rg/find to locate relevant files
- CLI Deep Analysis: Executes Gemini/Qwen CLI for deep context analysis
- Generates Content Package: Returns structured JSON core content package
4. Core Content Package Structure
Output Format - Loaded into main thread memory for subsequent use:
{
"task_context": "在当前前端基础上开发用户认证功能",
"keywords": ["前端", "用户", "认证", "auth", "login"],
"project_summary": {
"architecture": "TypeScript + React frontend with Vite build system",
"tech_stack": ["React", "TypeScript", "Vite", "TailwindCSS"],
"key_patterns": [
"State management via Context API",
"Functional components with Hooks pattern",
"API calls encapsulated in custom hooks"
]
},
"relevant_files": [
{
"path": "src/components/Auth/LoginForm.tsx",
"relevance": "Existing login form component",
"priority": "high"
},
{
"path": "src/contexts/AuthContext.tsx",
"relevance": "Authentication state management context",
"priority": "high"
},
{
"path": "CLAUDE.md",
"relevance": "Project development standards",
"priority": "high"
}
],
"integration_points": [
"Must integrate with existing AuthContext",
"Follow component organization pattern: src/components/[Feature]/",
"API calls should use src/hooks/useApi.ts wrapper"
],
"constraints": [
"Maintain backward compatibility",
"Follow TypeScript strict mode",
"Use existing UI component library"
]
}
5. Agent Invocation
Task(
subagent_type="general-purpose",
description="Load project memory: ${task_description}",
prompt=`
## Mission: Load Project Memory Context
**Task Context**: "${task_description}"
**Mode**: Read-only analysis
**Tool**: ${tool || 'gemini'}
## Execution Steps
### Step 1: Foundation Analysis
1. **Project Structure**
\`\`\`bash
bash(~/.claude/scripts/get_modules_by_depth.sh)
\`\`\`
2. **Core Documentation**
\`\`\`javascript
Read(CLAUDE.md)
Read(README.md)
\`\`\`
### Step 2: Keyword Extraction & File Discovery
1. Extract core keywords from task description
2. Discover relevant files using MCP code-index or rg:
\`\`\`javascript
// Prefer MCP tools
mcp__code-index__find_files(pattern="*{keyword}*")
mcp__code-index__search_code_advanced(pattern="{keyword}", context_lines=2)
// Fallback: use rg
bash(rg -l "{keyword}" --type ts --type md)
\`\`\`
### Step 3: Deep Analysis via CLI
Execute Gemini/Qwen CLI for deep analysis (saves main thread tokens):
\`\`\`bash
cd . && ~/.claude/scripts/${tool}-wrapper -p "
PURPOSE: Extract project core context for task: ${task_description}
TASK: Analyze project architecture, tech stack, key patterns, relevant files
MODE: analysis
CONTEXT: @CLAUDE.md,README.md @${discovered_files}
EXPECTED: Structured project summary and integration point analysis
RULES:
- Focus on task-relevant core information
- Identify key architecture patterns and technical constraints
- Extract integration points and development standards
- Output concise, structured format
"
\`\`\`
### Step 4: Generate Core Content Package
Generate structured JSON content package (format shown above)
**Required Fields**:
- task_context: Original task description
- keywords: Extracted keyword array
- project_summary: Architecture, tech stack, key patterns
- relevant_files: File list with path, relevance, priority
- integration_points: Integration guidance
- constraints: Development constraints
### Step 5: Return Content Package
Return JSON content package as final output for main thread to load into memory.
## Quality Checklist
Before returning:
- [ ] Valid JSON format
- [ ] All required fields complete
- [ ] relevant_files contains 3-10 files minimum
- [ ] project_summary accurately reflects architecture
- [ ] integration_points clearly specify integration paths
- [ ] keywords accurately extracted (3-8 keywords)
- [ ] Content concise, avoiding redundancy (< 5KB total)
`
)
6. Usage Examples
Example 1: Load Context for New Feature
/memory:load "在当前前端基础上开发用户认证功能"
Agent Execution:
- Analyzes project structure (
get_modules_by_depth.sh) - Reads CLAUDE.md, README.md
- Extracts keywords: ["前端", "用户", "认证", "auth"]
- Uses MCP to search relevant files
- Executes Gemini CLI for deep analysis
- Returns core content package
Returned Package (loaded into memory):
{
"task_context": "在当前前端基础上开发用户认证功能",
"keywords": ["前端", "认证", "auth", "login"],
"project_summary": { ... },
"relevant_files": [ ... ],
"integration_points": [ ... ],
"constraints": [ ... ]
}
Example 2: Using Qwen Tool
/memory:load --tool qwen -p "重构支付模块API"
Agent uses Qwen CLI for analysis, returns same structured package.
Example 3: Bug Fix Context
/memory:load "修复登录验证错误"
Returns core context related to login validation, including test files and validation logic.
Memory Persistence
- Session-Scoped: Content package valid for current session
- Subsequent Reference: All subsequent agents/commands can access
- Reload Required: New sessions need to re-execute /memory:load
8. Notes
- Read-Only: Does not modify any code, pure analysis
- Token Optimization: CLI analysis executed within agent, saves main thread tokens
- Memory Loading: Returned JSON loaded directly into main thread memory
- Subsequent Use: Other commands/agents can reference this package for development
- Session-Level: Content package valid for current session