Redesign PM Agent as Self-Improvement Meta-Layer (#421)

* 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>

---------

Co-authored-by: kazuki <kazuki@kazukinoMacBook-Air.local>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
kazuki nakai
2025-10-12 17:52:10 +09:00
committed by GitHub
parent f664125ebc
commit d27c53fa1c
6 changed files with 1027 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
# SuperClaude Agents Guide 🤖
SuperClaude provides 15 domain specialist agents that Claude Code can invoke for specialized expertise.
SuperClaude provides 16 domain specialist agents that Claude Code can invoke for specialized expertise.
## 🧪 Testing Agent Activation
@@ -137,6 +137,78 @@ Task Analysis →
## The SuperClaude Agent Team 👥
### Meta-Layer Agent 🎯
### pm-agent 📚
**Expertise**: Self-improvement workflow executor that documents implementations, analyzes mistakes, and maintains knowledge base continuously
**Auto-Activation**:
- **Post-Implementation**: After any task completion requiring documentation
- **Mistake Detection**: Immediate analysis when errors or bugs occur
- **Monthly Maintenance**: Regular documentation health reviews
- **Knowledge Gap**: When patterns emerge requiring documentation
- Commands: Automatically activates after `/sc:implement`, `/sc:build`, `/sc:improve` completions
**Capabilities**:
- **Implementation Documentation**: Record new patterns, architectural decisions, edge cases discovered
- **Mistake Analysis**: Root cause analysis, prevention checklists, pattern identification
- **Pattern Recognition**: Extract success patterns, anti-patterns, best practices
- **Knowledge Maintenance**: Monthly reviews, noise reduction, duplication merging, freshness updates
- **Self-Improvement Loop**: Transform every experience into reusable knowledge
**How PM Agent Works** (Meta-Layer):
1. **Specialist Agents Complete Task**: Backend-architect implements feature
2. **PM Agent Auto-Activates**: After implementation completion
3. **Documentation**: Records patterns, decisions, edge cases in docs/
4. **Knowledge Update**: Updates CLAUDE.md if global pattern discovered
5. **Evidence Collection**: Links test results, screenshots, metrics
6. **Learning Integration**: Extracts lessons for future implementations
**Self-Improvement Workflow Examples**:
1. **Post-Implementation Documentation**:
- Scenario: Backend architect just implemented JWT authentication
- PM Agent: Analyzes implementation → Documents JWT pattern → Updates docs/authentication.md → Records security decisions → Creates evidence links
- Output: Comprehensive authentication pattern documentation for future reuse
2. **Immediate Mistake Analysis**:
- Scenario: Direct Supabase import used (Kong Gateway bypassed)
- PM Agent: Stops implementation → Root cause analysis → Documents in self-improvement-workflow.md → Creates prevention checklist → Updates CLAUDE.md
- Output: Mistake recorded with prevention strategy, won't repeat error
3. **Monthly Documentation Maintenance**:
- Scenario: Monthly review on 1st of month
- PM Agent: Reviews docs older than 6 months → Deletes unused documents → Merges duplicates → Updates version numbers → Reduces verbosity
- Output: Fresh, minimal, high-signal documentation maintained
**Integration with Task Execution**:
PM Agent operates as a **meta-layer** above specialist agents:
```
Task Flow:
1. User Request → Auto-activation selects specialist agent
2. Specialist Agent → Executes implementation (backend-architect, frontend-architect, etc.)
3. PM Agent (Auto-triggered) → Documents learnings
4. Knowledge Base → Updated with patterns, mistakes, improvements
```
**Works Best With**: All agents (documents their work, not replaces them)
**Quality Standards**:
- **Latest**: Last Verified dates on all documents
- **Minimal**: Necessary information only, no verbosity
- **Clear**: Concrete examples and copy-paste ready code
- **Practical**: Immediately applicable to real work
**Self-Improvement Loop Phases**:
- **AFTER Phase**: Primary responsibility - document implementations, update docs/, create evidence
- **MISTAKE RECOVERY**: Immediate stop, root cause analysis, documentation update
- **MAINTENANCE**: Monthly pruning, merging, freshness updates, noise reduction
**Verify**: Activates automatically after task completions requiring documentation
**Test**: Should document patterns after backend-architect implements features
**Check**: Should create prevention checklists when mistakes detected
---
### Architecture & System Design Agents 🏗️
### system-architect 🏢