refactor: PEP8 compliance - directory rename and code formatting (#425)

* fix(orchestration): add WebFetch auto-trigger for infrastructure configuration

Problem: Infrastructure configuration changes (e.g., Traefik port settings)
were being made based on assumptions without consulting official documentation,
violating the 'Evidence > assumptions' principle in PRINCIPLES.md.

Solution:
- Added Infrastructure Configuration Validation section to MODE_Orchestration.md
- Auto-triggers WebFetch for infrastructure tools (Traefik, nginx, Docker, etc.)
- Enforces MODE_DeepResearch activation for investigation
- BLOCKS assumption-based configuration changes

Testing: Verified WebFetch successfully retrieves Traefik official docs (port 80 default)

This prevents production outages from infrastructure misconfiguration by ensuring
all technical recommendations are backed by official documentation.

* feat: Add PM Agent (Project Manager Agent) for seamless orchestration

Introduces PM Agent as the default orchestration layer that coordinates
all sub-agents and manages workflows automatically.

Key Features:
- Default orchestration: All user interactions handled by PM Agent
- Auto-delegation: Intelligent sub-agent selection based on task analysis
- Docker Gateway integration: Zero-token baseline with dynamic MCP loading
- Self-improvement loop: Automatic documentation of patterns and mistakes
- Optional override: Users can specify sub-agents explicitly if desired

Architecture:
- Agent spec: SuperClaude/Agents/pm-agent.md
- Command: SuperClaude/Commands/pm.md
- Updated docs: README.md (15→16 agents), agents.md (new Orchestration category)

User Experience:
- Default: PM Agent handles everything (seamless, no manual routing)
- Optional: Explicit --agent flag for direct sub-agent access
- Both modes available simultaneously (no user downside)

Implementation Status:
-  Specification complete
-  Documentation complete
-  Prototype implementation needed
-  Docker Gateway integration needed
-  Testing and validation needed

Refs: kazukinakai/docker-mcp-gateway (IRIS MCP Gateway integration)

* feat: Add Agent Orchestration rules for PM Agent default activation

Implements PM Agent as the default orchestration layer in RULES.md.

Key Changes:
- New 'Agent Orchestration' section (CRITICAL priority)
- PM Agent receives ALL user requests by default
- Manual override with @agent-[name] bypasses PM Agent
- Agent Selection Priority clearly defined:
  1. Manual override → Direct routing
  2. Default → PM Agent → Auto-delegation
  3. Delegation based on keywords, file types, complexity, context

User Experience:
- Default: PM Agent handles everything (seamless)
- Override: @agent-[name] for direct specialist access
- Transparent: PM Agent reports delegation decisions

This establishes PM Agent as the orchestration layer while
respecting existing auto-activation patterns and manual overrides.

Next Steps:
- Local testing in agiletec project
- Iteration based on actual behavior
- Documentation updates as needed

* refactor(pm-agent): redesign as self-improvement meta-layer

Problem Resolution:
PM Agent's initial design competed with existing auto-activation for task routing,
creating confusion about orchestration responsibilities and adding unnecessary complexity.

Design Change:
Redefined PM Agent as a meta-layer agent that operates AFTER specialist agents
complete tasks, focusing on:
- Post-implementation documentation and pattern recording
- Immediate mistake analysis with prevention checklists
- Monthly documentation maintenance and noise reduction
- Pattern extraction and knowledge synthesis

Two-Layer Orchestration System:
1. Task Execution Layer: Existing auto-activation handles task routing (unchanged)
2. Self-Improvement Layer: PM Agent meta-layer handles documentation (new)

Files Modified:
- SuperClaude/Agents/pm-agent.md: Complete rewrite with meta-layer design
  - Category: orchestration → meta
  - Triggers: All user interactions → Post-implementation, mistakes, monthly
  - Behavioral Mindset: Continuous learning system
  - Self-Improvement Workflow: BEFORE/DURING/AFTER/MISTAKE RECOVERY/MAINTENANCE

- SuperClaude/Core/RULES.md: Agent Orchestration section updated
  - Split into Task Execution Layer + Self-Improvement Layer
  - Added orchestration flow diagram
  - Clarified PM Agent activates AFTER task completion

- README.md: Updated PM Agent description
  - "orchestrates all interactions" → "ensures continuous learning"

- Docs/User-Guide/agents.md: PM Agent section rewritten
  - Section: Orchestration Agent → Meta-Layer Agent
  - Expertise: Project orchestration → Self-improvement workflow executor
  - Examples: Task coordination → Post-implementation documentation

- PR_DOCUMENTATION.md: Comprehensive PR documentation added
  - Summary, motivation, changes, testing, breaking changes
  - Two-layer orchestration system diagram
  - Verification checklist

Integration Validated:
Tested with agiletec project's self-improvement-workflow.md:
 PM Agent aligns with existing BEFORE/DURING/AFTER/MISTAKE RECOVERY phases
 Complements (not competes with) existing workflow
 agiletec workflow defines WHAT, PM Agent defines WHO executes it

Breaking Changes: None
- Existing auto-activation continues unchanged
- Specialist agents unaffected
- User workflows remain the same
- New capability: Automatic documentation and knowledge maintenance

Value Proposition:
Transforms SuperClaude into a continuously learning system that accumulates
knowledge, prevents recurring mistakes, and maintains fresh documentation
without manual intervention.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: add Claude Code conversation history management research

Research covering .jsonl file structure, performance impact, and retention policies.

Content:
- Claude Code .jsonl file format and message types
- Performance issues from GitHub (memory leaks, conversation compaction)
- Retention policies (consumer vs enterprise)
- Rotation recommendations based on actual data
- File history snapshot tracking mechanics

Source: Moved from agiletec project (research applicable to all Claude Code projects)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add Development documentation structure

Phase 1: Documentation Structure complete

- Add Docs/Development/ directory for development documentation
- Add ARCHITECTURE.md - System architecture with PM Agent meta-layer
- Add ROADMAP.md - 5-phase development plan with checkboxes
- Add TASKS.md - Daily task tracking with progress indicators
- Add PROJECT_STATUS.md - Current status dashboard and metrics
- Add pm-agent-integration.md - Implementation guide for PM Agent mode

This establishes comprehensive documentation foundation for:
- System architecture understanding
- Development planning and tracking
- Implementation guidance
- Progress visibility

Related: #pm-agent-mode #documentation #phase-1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: PM Agent session lifecycle and PDCA implementation

Phase 2: PM Agent Mode Integration (Design Phase)

Commands/pm.md updates:
- Add "Always-Active Foundation Layer" concept
- Add Session Lifecycle (Session Start/During Work/Session End)
- Add PDCA Cycle (Plan/Do/Check/Act) automation
- Add Serena MCP Memory Integration (list/read/write_memory)
- Document auto-activation triggers

Agents/pm-agent.md updates:
- Add Session Start Protocol (MANDATORY auto-activation)
- Add During Work PDCA Cycle with example workflows
- Add Session End Protocol with state preservation
- Add PDCA Self-Evaluation Pattern
- Add Documentation Strategy (temp → patterns/mistakes)
- Add Memory Operations Reference

Key Features:
- Session start auto-activation for context restoration
- 30-minute checkpoint saves during work
- Self-evaluation with think_about_* operations
- Systematic documentation lifecycle
- Knowledge evolution to CLAUDE.md

Implementation Status:
-  Design complete (Commands/pm.md, Agents/pm-agent.md)
-  Implementation pending (Core components)
-  Serena MCP integration pending

Salvaged from mistaken development in ~/.claude directory

Related: #pm-agent-mode #session-lifecycle #pdca-cycle #phase-2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: disable Serena MCP auto-browser launch

Disable web dashboard and GUI log window auto-launch in Serena MCP server
to prevent intrusive browser popups on startup. Users can still manually
access the dashboard at http://localhost:24282/dashboard/ if needed.

Changes:
- Add CLI flags to Serena run command:
  - --enable-web-dashboard false
  - --enable-gui-log-window false
- Ensures Git-tracked configuration (no reliance on ~/.serena/serena_config.yml)
- Aligns with AIRIS MCP Gateway integration approach

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: rename directories to lowercase for PEP8 compliance

- Rename superclaude/Agents -> superclaude/agents
- Rename superclaude/Commands -> superclaude/commands
- Rename superclaude/Core -> superclaude/core
- Rename superclaude/Examples -> superclaude/examples
- Rename superclaude/MCP -> superclaude/mcp
- Rename superclaude/Modes -> superclaude/modes

This change follows Python PEP8 naming conventions for package directories.

* style: fix PEP8 violations and update package name to lowercase

Changes:
- Format all Python files with black (43 files reformatted)
- Update package name from 'SuperClaude' to 'superclaude' in pyproject.toml
- Fix import statements to use lowercase package name
- Add missing imports (timedelta, __version__)
- Remove old SuperClaude.egg-info directory

PEP8 violations reduced from 2672 to 701 (mostly E501 line length due to black's 88 char vs flake8's 79 char limit).

* docs: add PM Agent development documentation

Add comprehensive PM Agent development documentation:
- PM Agent ideal workflow (7-phase autonomous cycle)
- Project structure understanding (Git vs installed environment)
- Installation flow understanding (CommandsComponent behavior)
- Task management system (current-tasks.md)

Purpose: Eliminate repeated explanations and enable autonomous PDCA cycles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(pm-agent): add self-correcting execution and warning investigation culture

## Changes

### superclaude/commands/pm.md
- Add "Self-Correcting Execution" section with root cause analysis protocol
- Add "Warning/Error Investigation Culture" section enforcing zero-tolerance for dismissal
- Define error detection protocol: STOP → Investigate → Hypothesis → Different Solution → Execute
- Document anti-patterns (retry without understanding) and correct patterns (research-first)

### docs/Development/hypothesis-pm-autonomous-enhancement-2025-10-14.md
- Add PDCA workflow hypothesis document for PM Agent autonomous enhancement

## Rationale

PM Agent must never retry failed operations without understanding root causes.
All warnings and errors require investigation via context7/WebFetch/documentation
to ensure production-quality code and prevent technical debt accumulation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(installer): add airis-mcp-gateway MCP server option

## Changes

- Add airis-mcp-gateway to MCP server options in installer
- Configuration: GitHub-based installation via uvx
- Repository: https://github.com/oraios/airis-mcp-gateway
- Purpose: Dynamic MCP Gateway for zero-token baseline and on-demand tool loading

## Implementation

Added to setup/components/mcp.py self.mcp_servers dictionary with:
- install_method: github
- install_command: uvx test installation
- run_command: uvx runtime execution
- required: False (optional server)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: kazuki <kazuki@kazukinoMacBook-Air.local>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
kazuki nakai
2025-10-14 12:17:09 +09:00
committed by GitHub
parent 302c5851b1
commit 050d5ea2ab
194 changed files with 9698 additions and 3693 deletions

View File

@@ -0,0 +1,272 @@
# SuperClaude MCP 服务器指南 🔌
## 概览
MCP模型上下文协议服务器通过专业工具扩展 Claude Code 的能力。SuperClaude 集成了 6 个 MCP 服务器,并为 Claude 提供指令,告诉它何时根据您的任务激活它们。
### 🔍 现实检查
- **MCP 服务器是什么**:提供附加工具的外部 Node.js 进程
- **它们不是什么**:内置的 SuperClaude 功能
- **激活如何工作**Claude 读取指令,根据上下文使用适当的服务器
- **它们提供什么**:扩展 Claude Code 本地能力的真实工具
**核心服务器:**
- **context7**:官方库文档和模式
- **sequential-thinking**:多步推理和分析
- **magic**:现代 UI 组件生成
- **playwright**:浏览器自动化和 E2E 测试
- **morphllm-fast-apply**:基于模式的代码转换
- **serena**:语义代码理解和项目内存
## 快速开始
**设置验证**MCP 服务器会自动激活。有关安装和故障排除,请参阅 [安装指南](../Getting-Started/installation.md) 和 [故障排除](../Reference/troubleshooting.md)。
**自动激活逻辑:**
| 请求包含 | 激活的服务器 |
|-----------------|------------------|
| 库导入、API 名称 | **context7** |
| `--think`、调试 | **sequential-thinking** |
| `component``UI`、前端 | **magic** |
| `test``e2e``browser` | **playwright** |
| 多文件编辑、重构 | **morphllm-fast-apply** |
| 大型项目、会话 | **serena** |
## 服务器详情
### context7 📚
**目的**:官方库文档访问
**触发器**:导入语句、框架关键词、文档请求
**要求**Node.js 16+,无需 API 密钥
```bash
# 自动激活
/sc:implement "React authentication system"
# → 提供官方 React 模式
# 手动激活
/sc:analyze auth-system/ --c7
```
### sequential-thinking 🧠
**目的**:结构化多步推理和系统分析
**触发器**:复杂调试、`--think` 标志、架构分析
**要求**Node.js 16+,无需 API 密钥
```bash
# 自动激活
/sc:troubleshoot "API performance issues"
# → 启用系统性根因分析
# 手动激活
/sc:analyze --think-hard architecture/
```
### magic ✨
**目的**:从 21st.dev 模式生成现代 UI 组件
**触发器**UI 请求、`/ui` 命令、组件开发
**要求**Node.js 16+TWENTYFIRST_API_KEY
```bash
# 自动激活
/sc:implement "responsive dashboard component"
# → 使用现代模式生成可访问的 UI
# API 密钥设置
export TWENTYFIRST_API_KEY="your_key_here"
```
### playwright 🎭
**目的**:真实浏览器自动化和 E2E 测试
**触发器**浏览器测试、E2E 场景、视觉验证
**要求**Node.js 16+,无需 API 密钥
```bash
# 自动激活
/sc:test --type e2e "user login flow"
# → 启用浏览器自动化测试
# 手动激活
/sc:validate "accessibility compliance" --play
```
### morphllm-fast-apply 🔄
**目的**:高效的基于模式的代码转换
**触发器**:多文件编辑、重构、框架迁移
**要求**Node.js 16+MORPH_API_KEY
```bash
# 自动激活
/sc:improve legacy-codebase/ --focus maintainability
# → 在文件中应用一致的模式
# API 密钥设置
export MORPH_API_KEY="your_key_here"
```
### serena 🧭
**目的**:带有项目内存的语义代码理解
**触发器**:符号操作、大型代码库、会话管理
**要求**Python 3.9+、uv 包管理器,无需 API 密钥
```bash
# 自动激活
/sc:load existing-project/
# → 构建项目理解和内存
# 手动激活
/sc:refactor "extract UserService" --serena
```
## 配置
**MCP 配置文件 (`~/.claude.json`)**
```json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
},
"sequential-thinking": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
},
"magic": {
"command": "npx",
"args": ["@21st-dev/magic"],
"env": {"TWENTYFIRST_API_KEY": "${TWENTYFIRST_API_KEY}"}
},
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
},
"morphllm-fast-apply": {
"command": "npx",
"args": ["@morph-llm/morph-fast-apply"],
"env": {"MORPH_API_KEY": "${MORPH_API_KEY}"}
},
"serena": {
"command": "uvx",
"args": ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "ide-assistant"]
}
}
}
```
## 使用模式
**服务器控制:**
```bash
# 启用特定服务器
/sc:analyze codebase/ --c7 --seq
# 禁用所有 MCP 服务器
/sc:implement "simple function" --no-mcp
# 启用所有服务器
/sc:design "complex architecture" --all-mcp
```
**多服务器协调:**
```bash
# 全栈开发
/sc:implement "e-commerce checkout"
# → Sequential工作流分析
# → Context7支付模式
# → MagicUI 组件
# → Serena代码组织
# → PlaywrightE2E 测试
```
## 故障排除
**常见问题:**
- **无服务器连接**:检查 Node.js`node --version`(需要 v16+
- **Context7 失败**:清除缓存:`npm cache clean --force`
- **Magic/Morphllm 错误**:在没有 API 密钥时是预期的(付费服务)
- **服务器超时**:重启 Claude Code 会话
**快速修复:**
```bash
# 重置连接
# 重启 Claude Code 会话
# 检查依赖
node --version # 应该显示 v16+
# 不使用 MCP 测试
/sc:command --no-mcp
# 检查配置
ls ~/.claude.json
```
**API 密钥配置:**
```bash
# 用于 Magic 服务器UI 生成所需)
export TWENTYFIRST_API_KEY="your_key_here"
# 用于 Morphllm 服务器(批量转换所需)
export MORPH_API_KEY="your_key_here"
# 添加到 shell 配置文件以保持持久
echo 'export TWENTYFIRST_API_KEY="your_key"' >> ~/.bashrc
echo 'export MORPH_API_KEY="your_key"' >> ~/.bashrc
```
**环境变量使用:**
-`TWENTYFIRST_API_KEY` - Magic MCP 服务器功能所需
-`MORPH_API_KEY` - Morphllm MCP 服务器功能所需
- ❌ 文档中的其他环境变量 - 仅作示例,框架中不使用
- 📝 两者都是付费服务 API 密钥,框架在没有它们的情况下也可以工作
## 服务器组合
**无 API 密钥(免费)**
- context7 + sequential-thinking + playwright + serena
**1 个 API 密钥**
- 添加 magic 用于专业 UI 开发
**2 个 API 密钥**
- 添加 morphllm-fast-apply 用于大规模重构
**常见工作流:**
- **学习**context7 + sequential-thinking
- **Web 开发**magic + context7 + playwright
- **企业重构**serena + morphllm + sequential-thinking
- **复杂分析**sequential-thinking + context7 + serena
## 集成
**与 SuperClaude 命令:**
- 分析命令自动使用 Sequential + Serena
- 实现命令使用 Magic + Context7
- 测试命令使用 Playwright + Sequential
**与行为模式:**
- 头脑风暴模式Sequential 用于发现
- 任务管理Serena 用于持久化
- 编排模式:最佳服务器选择
**性能控制:**
- 基于系统负载的自动资源管理
- 并发控制:`--concurrency N` (1-15)
- 在约束条件下基于优先级的服务器选择
## 相关资源
**必读资料:**
- [命令指南](commands.md) - 激活 MCP 服务器的命令
- [快速开始指南](../Getting-Started/quick-start.md) - MCP 设置指南
**高级使用:**
- [行为模式](modes.md) - 模式-MCP 协调
- [智能体指南](agents.md) - 智能体-MCP 集成
- [会话管理](session-management.md) - Serena 工作流
**技术参考:**
- [示例手册](../Reference/examples-cookbook.md) - MCP 工作流模式
- [技术架构](../Developer-Guide/technical-architecture.md) - 集成详情