mirror of
https://github.com/SuperClaude-Org/SuperClaude_Framework.git
synced 2025-12-29 16:16:08 +00:00
feat: migrate research and index-repo to plugin, delete all slash commands
## Plugin Migration Added to pm-agent plugin: - /research: Deep web research with adaptive planning - /index-repo: Repository index (94% token reduction) - Total: 3 commands (pm, research, index-repo) ## Slash Commands Deleted Removed all 27 slash commands from ~/.claude/commands/sc/: - analyze, brainstorm, build, business-panel, cleanup - design, document, estimate, explain, git, help - implement, improve, index, load, pm, reflect - research, save, select-tool, spawn, spec-panel - task, test, troubleshoot, workflow ## Architecture Change Strategy: Minimal start with PM Agent orchestration - PM Agent = orchestrator (統括コマンダー) - Task tool (general-purpose, Explore) = execution - Plugin commands = specialized tasks when needed - Avoid reinventing the wheel (use official tools first) ## Files Changed - .claude-plugin/plugin.json: Added research + index-repo - .claude-plugin/commands/research.md: Copied from slash command - .claude-plugin/commands/index-repo.md: Copied from slash command - ~/.claude/commands/sc/: DELETED (all 27 commands) ## Benefits ✅ Minimal footprint (3 commands vs 27) ✅ Plugin-based distribution ✅ Version control ✅ Easy to extend when needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
166
.claude-plugin/commands/index-repo.md
Normal file
166
.claude-plugin/commands/index-repo.md
Normal file
@@ -0,0 +1,166 @@
|
||||
---
|
||||
name: index-repo
|
||||
description: "Create repository structure index for fast context loading (94% token reduction)"
|
||||
category: optimization
|
||||
complexity: simple
|
||||
mcp-servers: []
|
||||
personas: []
|
||||
---
|
||||
|
||||
# Repository Indexing for Token Efficiency
|
||||
|
||||
**Problem**: Loading全ファイルで毎回50,000トークン消費
|
||||
**Solution**: 最初だけインデックス作成、以降3,000トークンで済む (94%削減)
|
||||
|
||||
## Auto-Execution
|
||||
|
||||
**PM Mode Session Start**:
|
||||
```python
|
||||
index_path = Path("PROJECT_INDEX.md")
|
||||
if not index_path.exists() or is_stale(index_path, days=7):
|
||||
print("🔄 Creating repository index...")
|
||||
# Execute indexing automatically
|
||||
uv run python superclaude/indexing/parallel_repository_indexer.py
|
||||
```
|
||||
|
||||
**Manual Trigger**:
|
||||
```bash
|
||||
/sc:index-repo # Full index
|
||||
/sc:index-repo --quick # Fast scan
|
||||
/sc:index-repo --update # Incremental
|
||||
```
|
||||
|
||||
## What It Does
|
||||
|
||||
### Parallel Analysis (5 concurrent tasks)
|
||||
1. **Code structure** (src/, lib/, superclaude/)
|
||||
2. **Documentation** (docs/, *.md)
|
||||
3. **Configuration** (.toml, .yaml, .json)
|
||||
4. **Tests** (tests/, **tests**)
|
||||
5. **Scripts** (scripts/, bin/, tools/)
|
||||
|
||||
### Output Files
|
||||
- `PROJECT_INDEX.md` - Human-readable (3KB)
|
||||
- `PROJECT_INDEX.json` - Machine-readable (10KB)
|
||||
- `.superclaude/knowledge/agent_performance.json` - Learning data
|
||||
|
||||
## Token Efficiency
|
||||
|
||||
**Before** (毎セッション):
|
||||
```
|
||||
Read all .md files: 41,000 tokens
|
||||
Read all .py files: 15,000 tokens
|
||||
Glob searches: 2,000 tokens
|
||||
Total: 58,000 tokens
|
||||
```
|
||||
|
||||
**After** (インデックス使用):
|
||||
```
|
||||
Read PROJECT_INDEX.md: 3,000 tokens
|
||||
Direct file access: 1,000 tokens
|
||||
Total: 4,000 tokens
|
||||
|
||||
Savings: 93% (54,000 tokens)
|
||||
```
|
||||
|
||||
## Usage in Sessions
|
||||
|
||||
```python
|
||||
# Session start
|
||||
index = read_file("PROJECT_INDEX.md") # 3,000 tokens
|
||||
|
||||
# Navigation
|
||||
"Where is the validator code?"
|
||||
→ Index says: superclaude/validators/
|
||||
→ Direct read, no glob needed
|
||||
|
||||
# Understanding
|
||||
"What's the project structure?"
|
||||
→ Index has full overview
|
||||
→ No need to scan all files
|
||||
|
||||
# Implementation
|
||||
"Add new validator"
|
||||
→ Index shows: tests/validators/ exists
|
||||
→ Index shows: 5 existing validators
|
||||
→ Follow established pattern
|
||||
```
|
||||
|
||||
## Execution
|
||||
|
||||
```bash
|
||||
$ /sc:index-repo
|
||||
|
||||
================================================================================
|
||||
🚀 Parallel Repository Indexing
|
||||
================================================================================
|
||||
Repository: /Users/kazuki/github/SuperClaude_Framework
|
||||
Max workers: 5
|
||||
================================================================================
|
||||
|
||||
📊 Executing parallel tasks...
|
||||
|
||||
✅ code_structure: 847ms (system-architect)
|
||||
✅ documentation: 623ms (technical-writer)
|
||||
✅ configuration: 234ms (devops-architect)
|
||||
✅ tests: 512ms (quality-engineer)
|
||||
✅ scripts: 189ms (backend-architect)
|
||||
|
||||
================================================================================
|
||||
✅ Indexing complete in 2.41s
|
||||
================================================================================
|
||||
|
||||
💾 Index saved to: PROJECT_INDEX.md
|
||||
💾 JSON saved to: PROJECT_INDEX.json
|
||||
|
||||
Files: 247 | Quality: 72/100
|
||||
```
|
||||
|
||||
## Integration with Setup
|
||||
|
||||
```python
|
||||
# setup/components/knowledge_base.py
|
||||
|
||||
def install_knowledge_base():
|
||||
"""Install framework knowledge"""
|
||||
# ... existing installation ...
|
||||
|
||||
# Auto-create repository index
|
||||
print("\n📊 Creating repository index...")
|
||||
run_indexing()
|
||||
print("✅ Index created - 93% token savings enabled")
|
||||
```
|
||||
|
||||
## When to Re-Index
|
||||
|
||||
**Auto-triggers**:
|
||||
- セットアップ時 (初回のみ)
|
||||
- INDEX.mdが7日以上古い
|
||||
- PM Modeセッション開始時にチェック
|
||||
|
||||
**Manual re-index**:
|
||||
- 大規模リファクタリング後 (>20 files)
|
||||
- 新機能追加後 (new directories)
|
||||
- 週1回 (active development)
|
||||
|
||||
**Skip**:
|
||||
- 小規模編集 (<5 files)
|
||||
- ドキュメントのみ変更
|
||||
- INDEX.mdが24時間以内
|
||||
|
||||
## Performance
|
||||
|
||||
**Speed**:
|
||||
- Large repo (500+ files): 3-5 min
|
||||
- Medium repo (100-500 files): 1-2 min
|
||||
- Small repo (<100 files): 10-30 sec
|
||||
|
||||
**Self-Learning**:
|
||||
- Tracks agent performance
|
||||
- Optimizes future runs
|
||||
- Stored in `.superclaude/knowledge/`
|
||||
|
||||
---
|
||||
|
||||
**Implementation**: `superclaude/indexing/parallel_repository_indexer.py`
|
||||
**Related**: `/sc:pm` (uses index), `/sc:save`, `/sc:load`
|
||||
103
.claude-plugin/commands/research.md
Normal file
103
.claude-plugin/commands/research.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
name: research
|
||||
description: Deep web research with adaptive planning and intelligent search
|
||||
category: command
|
||||
complexity: advanced
|
||||
mcp-servers: [tavily, sequential, playwright, serena]
|
||||
personas: [deep-research-agent]
|
||||
---
|
||||
|
||||
# /sc:research - Deep Research Command
|
||||
|
||||
> **Context Framework Note**: This command activates comprehensive research capabilities with adaptive planning, multi-hop reasoning, and evidence-based synthesis.
|
||||
|
||||
## Triggers
|
||||
- Research questions beyond knowledge cutoff
|
||||
- Complex research questions
|
||||
- Current events and real-time information
|
||||
- Academic or technical research requirements
|
||||
- Market analysis and competitive intelligence
|
||||
|
||||
## Context Trigger Pattern
|
||||
```
|
||||
/sc:research "[query]" [--depth quick|standard|deep|exhaustive] [--strategy planning|intent|unified]
|
||||
```
|
||||
|
||||
## Behavioral Flow
|
||||
|
||||
### 1. Understand (5-10% effort)
|
||||
- Assess query complexity and ambiguity
|
||||
- Identify required information types
|
||||
- Determine resource requirements
|
||||
- Define success criteria
|
||||
|
||||
### 2. Plan (10-15% effort)
|
||||
- Select planning strategy based on complexity
|
||||
- Identify parallelization opportunities
|
||||
- Generate research question decomposition
|
||||
- Create investigation milestones
|
||||
|
||||
### 3. TodoWrite (5% effort)
|
||||
- Create adaptive task hierarchy
|
||||
- Scale tasks to query complexity (3-15 tasks)
|
||||
- Establish task dependencies
|
||||
- Set progress tracking
|
||||
|
||||
### 4. Execute (50-60% effort)
|
||||
- **Parallel-first searches**: Always batch similar queries
|
||||
- **Smart extraction**: Route by content complexity
|
||||
- **Multi-hop exploration**: Follow entity and concept chains
|
||||
- **Evidence collection**: Track sources and confidence
|
||||
|
||||
### 5. Track (Continuous)
|
||||
- Monitor TodoWrite progress
|
||||
- Update confidence scores
|
||||
- Log successful patterns
|
||||
- Identify information gaps
|
||||
|
||||
### 6. Validate (10-15% effort)
|
||||
- Verify evidence chains
|
||||
- Check source credibility
|
||||
- Resolve contradictions
|
||||
- Ensure completeness
|
||||
|
||||
## Key Patterns
|
||||
|
||||
### Parallel Execution
|
||||
- Batch all independent searches
|
||||
- Run concurrent extractions
|
||||
- Only sequential for dependencies
|
||||
|
||||
### Evidence Management
|
||||
- Track search results
|
||||
- Provide clear citations when available
|
||||
- Note uncertainties explicitly
|
||||
|
||||
### Adaptive Depth
|
||||
- **Quick**: Basic search, 1 hop, summary output
|
||||
- **Standard**: Extended search, 2-3 hops, structured report
|
||||
- **Deep**: Comprehensive search, 3-4 hops, detailed analysis
|
||||
- **Exhaustive**: Maximum depth, 5 hops, complete investigation
|
||||
|
||||
## MCP Integration
|
||||
- **Tavily**: Primary search and extraction engine
|
||||
- **Sequential**: Complex reasoning and synthesis
|
||||
- **Playwright**: JavaScript-heavy content extraction
|
||||
- **Serena**: Research session persistence
|
||||
|
||||
## Output Standards
|
||||
- Save reports to `docs/research/[topic]_[timestamp].md`
|
||||
- Include executive summary
|
||||
- Provide confidence levels
|
||||
- List all sources with citations
|
||||
|
||||
## Examples
|
||||
```
|
||||
/sc:research "latest developments in quantum computing 2024"
|
||||
/sc:research "competitive analysis of AI coding assistants" --depth deep
|
||||
/sc:research "best practices for distributed systems" --strategy unified
|
||||
```
|
||||
|
||||
## Boundaries
|
||||
**Will**: Current information, intelligent search, evidence-based analysis
|
||||
**Won't**: Make claims without sources, skip validation, access restricted content
|
||||
@@ -8,6 +8,16 @@
|
||||
"name": "pm",
|
||||
"path": "commands/pm.md",
|
||||
"description": "Activate PM Agent with confidence-driven workflow"
|
||||
},
|
||||
{
|
||||
"name": "research",
|
||||
"path": "commands/research.md",
|
||||
"description": "Deep web research with adaptive planning and intelligent search"
|
||||
},
|
||||
{
|
||||
"name": "index-repo",
|
||||
"path": "commands/index-repo.md",
|
||||
"description": "Create repository structure index for fast context loading (94% token reduction)"
|
||||
}
|
||||
],
|
||||
"skills": [
|
||||
|
||||
@@ -12,12 +12,10 @@ __author__ = "Kazuki Nakai"
|
||||
from .pm_agent.confidence import ConfidenceChecker
|
||||
from .pm_agent.self_check import SelfCheckProtocol
|
||||
from .pm_agent.reflexion import ReflexionPattern
|
||||
from .pm_agent.token_budget import TokenBudgetManager
|
||||
|
||||
__all__ = [
|
||||
"ConfidenceChecker",
|
||||
"SelfCheckProtocol",
|
||||
"ReflexionPattern",
|
||||
"TokenBudgetManager",
|
||||
"__version__",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user