kazuki nakai 050d5ea2ab
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>
2025-10-14 08:47:09 +05:30

11 KiB

SuperClaude Flags Guide 🏁

Most flags activate automatically - Claude Code reads behavioral instructions to engage appropriate contexts based on keywords and patterns in your requests.

Essential Auto-Activation Flags (90% of Use Cases)

Core Analysis Flags

Flag When Activated What It Does
--think 5+ files OR complex analysis Standard structured analysis (~4K tokens)
--think-hard Architectural analysis, system dependencies Deep analysis (~10K tokens) with enhanced tools
--ultrathink Critical system redesign, legacy modernization Maximum depth analysis (~32K tokens) with all tools

MCP Server Flags

Flag Server Purpose Auto-Triggers
--c7 / --context7 Context7 Official docs, framework patterns Library imports, framework questions
--seq / --sequential Sequential Multi-step reasoning, debugging Complex debugging, system design
--magic Magic UI component generation /ui commands, frontend keywords
--play / --playwright Playwright Browser testing, E2E validation Testing requests, visual validation
--chrome / --devtools Chrome DevTools Performance analysis, debugging Performance auditing, debugging, layout issues
--tavily Tavily Web search, real-time info Web search requests, research queries
--morph / --morphllm Morphllm Bulk transformations, pattern edits Bulk operations, style enforcement
--serena Serena Project memory, symbol operations Symbol operations, large codebases

Behavioral Mode Flags

Flag When Activated What It Does
--brainstorm Vague requests, exploration keywords Collaborative discovery mindset
--introspect Self-analysis, error recovery Expose reasoning process with transparency
--task-manage >3 steps, complex scope Orchestrate through delegation
--orchestrate Multi-tool operations, performance needs Optimize tool selection and parallel execution
--token-efficient / --uc Context >75%, efficiency needs Symbol-enhanced communication, 30-50% reduction

Execution Control Flags

Flag When Activated What It Does
--loop "improve", "polish", "refine" keywords Iterative enhancement cycles
--safe-mode Production, >85% resource usage Maximum validation, conservative execution
--validate Risk >0.7, production environment Pre-execution risk assessment
--delegate >7 directories OR >50 files Sub-agent parallel processing

Command-Specific Flags

Analysis Command Flags (/sc:analyze)

Flag Purpose Values
--focus Target specific domain security, performance, quality, architecture
--depth Analysis thoroughness quick, deep
--format Output format text, json, report

Build Command Flags (/sc:build)

Flag Purpose Values
--type Build configuration dev, prod, test
--clean Clean before build Boolean
--optimize Enable optimizations Boolean
--verbose Detailed output Boolean

Design Command Flags (/sc:design)

Flag Purpose Values
--type Design target architecture, api, component, database
--format Output format diagram, spec, code

Explain Command Flags (/sc:explain)

Flag Purpose Values
--level Complexity level basic, intermediate, advanced
--format Explanation style text, examples, interactive
--context Domain context Any domain (e.g., react, security)

Improve Command Flags (/sc:improve)

Flag Purpose Values
--type Improvement focus quality, performance, maintainability, style, security
--safe Conservative approach Boolean
--interactive User guidance Boolean
--preview Show without executing Boolean

Task Command Flags (/sc:task)

Flag Purpose Values
--strategy Task approach systematic, agile, enterprise
--parallel Parallel execution Boolean
--delegate Sub-agent coordination Boolean

Workflow Command Flags (/sc:workflow)

Flag Purpose Values
--strategy Workflow approach systematic, agile, enterprise
--depth Analysis depth shallow, normal, deep
--parallel Parallel coordination Boolean

Troubleshoot Command Flags (/sc:troubleshoot)

Flag Purpose Values
--type Issue category bug, build, performance, deployment
--trace Include trace analysis Boolean
--fix Apply fixes Boolean

Cleanup Command Flags (/sc:cleanup)

Flag Purpose Values
--type Cleanup target code, imports, files, all
--safe / --aggressive Cleanup intensity Boolean
--interactive User guidance Boolean
--preview Show without executing Boolean

Estimate Command Flags (/sc:estimate)

Flag Purpose Values
--type Estimate focus time, effort, complexity
--unit Time unit hours, days, weeks
--breakdown Detailed breakdown Boolean

Index Command Flags (/sc:index)

Flag Purpose Values
--type Index target docs, api, structure, readme
--format Output format md, json, yaml

Reflect Command Flags (/sc:reflect)

Flag Purpose Values
--type Reflection scope task, session, completion
--analyze Include analysis Boolean
--validate Validate completeness Boolean

Spawn Command Flags (/sc:spawn)

Flag Purpose Values
--strategy Coordination approach sequential, parallel, adaptive
--depth Analysis depth normal, deep

Git Command Flags (/sc:git)

Flag Purpose Values
--smart-commit Generate commit message Boolean
--interactive Guided operations Boolean

Select-Tool Command Flags (/sc:select-tool)

Flag Purpose Values
--analyze Tool analysis Boolean
--explain Explain selection Boolean

Test Command Flags (/sc:test)

Flag Purpose Values
--coverage Include coverage Boolean
--type Test type unit, integration, e2e
--watch Watch mode Boolean

Advanced Control Flags

Scope and Focus

Flag Purpose Values
--scope Analysis boundary file, module, project, system
--focus Domain targeting performance, security, quality, architecture, accessibility, testing

Execution Control

Flag Purpose Values
--concurrency [n] Control parallel ops 1-15
--iterations [n] Improvement cycles 1-10
--all-mcp Enable all MCP servers Boolean
--no-mcp Native tools only Boolean
--frontend-verify UI testing, frontend debugging, layout validation Enable Playwright + Chrome DevTools + Serena

System Flags (SuperClaude Installation)

Flag Purpose Values
--verbose / -v Verbose logging Boolean
--quiet / -q Suppress output Boolean
--dry-run Simulate operation Boolean
--force Skip checks Boolean
--yes / -y Auto-confirm Boolean
--install-dir Target directory Path
--legacy Use legacy script Boolean
--version Show version Boolean
--help Show help Boolean

Common Usage Patterns

Frontend Development

/sc:implement "responsive dashboard" --magic --c7
/sc:design component-library --type component --format code
/sc:test ui-components/ --magic --play
/sc:improve legacy-ui/ --magic --morph --validate

Backend Development

/sc:analyze api/ --focus performance --seq --think
/sc:design payment-api --type api --format spec
/sc:troubleshoot "API timeout" --type performance --trace
/sc:improve auth-service --type security --validate

Large Projects

/sc:analyze . --ultrathink --all-mcp --safe-mode
/sc:workflow enterprise-system --strategy enterprise --depth deep
/sc:cleanup . --type all --safe --interactive
/sc:estimate "migrate to microservices" --type complexity --breakdown

Quality & Maintenance

/sc:improve src/ --type quality --safe --interactive
/sc:cleanup imports --type imports --preview
/sc:reflect --type completion --validate
/sc:git commit --smart-commit

Flag Interactions

Compatible Combinations

  • --think + --c7: Analysis with documentation
  • --magic + --play: UI generation with testing
  • --serena + --morph: Project memory with transformations
  • --safe-mode + --validate: Maximum safety
  • --loop + --validate: Iterative improvement with validation

Conflicting Flags

  • --all-mcp vs individual MCP flags (use one or the other)
  • --no-mcp vs any MCP flags (--no-mcp wins)
  • --safe vs --aggressive (cleanup intensity)
  • --quiet vs --verbose (output level)

Auto-Enabling Relationships

  • --safe-mode auto-enables --uc and --validate
  • --ultrathink auto-enables all MCP servers
  • --think-hard auto-enables --seq + --c7
  • --magic triggers UI-focused agents

Troubleshooting Flags

Common Issues

  • Too many tools: Use --no-mcp to test with native tools only
  • Operation too slow: Add --uc to compress output
  • Validation blocking: Use --validate instead of --safe-mode in development
  • Context pressure: Auto-activates --token-efficient at >75% usage

Debug Flags

/sc:analyze . --verbose                      # Shows decision logic and flag activation
/sc:select-tool "operation" --explain        # Explains tool selection process
/sc:reflect --type session --analyze         # Reviews current session decisions

Quick Fixes

/sc:analyze . --help                         # Shows available flags for command
/sc:analyze . --no-mcp                       # Native execution only
/sc:cleanup . --preview                      # Shows what would be cleaned

Flag Priority Rules

  1. Safety First: --safe-mode > --validate > optimization flags
  2. Explicit Override: User flags > auto-detection
  3. Depth Hierarchy: --ultrathink > --think-hard > --think
  4. MCP Control: --no-mcp overrides all individual MCP flags
  5. Scope Precedence: system > project > module > file