* refactor: PM Agent complete independence from external MCP servers ## Summary Implement graceful degradation to ensure PM Agent operates fully without any MCP server dependencies. MCP servers now serve as optional enhancements rather than required components. ## Changes ### Responsibility Separation (NEW) - **PM Agent**: Development workflow orchestration (PDCA cycle, task management) - **mindbase**: Memory management (long-term, freshness, error learning) - **Built-in memory**: Session-internal context (volatile) ### 3-Layer Memory Architecture with Fallbacks 1. **Built-in Memory** [OPTIONAL]: Session context via MCP memory server 2. **mindbase** [OPTIONAL]: Long-term semantic search via airis-mcp-gateway 3. **Local Files** [ALWAYS]: Core functionality in docs/memory/ ### Graceful Degradation Implementation - All MCP operations marked with [ALWAYS] or [OPTIONAL] - Explicit IF/ELSE fallback logic for every MCP call - Dual storage: Always write to local files + optionally to mindbase - Smart lookup: Semantic search (if available) → Text search (always works) ### Key Fallback Strategies **Session Start**: - mindbase available: search_conversations() for semantic context - mindbase unavailable: Grep docs/memory/*.jsonl for text-based lookup **Error Detection**: - mindbase available: Semantic search for similar past errors - mindbase unavailable: Grep docs/mistakes/ + solutions_learned.jsonl **Knowledge Capture**: - Always: echo >> docs/memory/patterns_learned.jsonl (persistent) - Optional: mindbase.store() for semantic search enhancement ## Benefits - ✅ Zero external dependencies (100% functionality without MCP) - ✅ Enhanced capabilities when MCPs available (semantic search, freshness) - ✅ No functionality loss, only reduced search intelligence - ✅ Transparent degradation (no error messages, automatic fallback) ## Related Research - Serena MCP investigation: Exposes tools (not resources), memory = markdown files - mindbase superiority: PostgreSQL + pgvector > Serena memory features - Best practices alignment: /Users/kazuki/github/airis-mcp-gateway/docs/mcp-best-practices.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: add PR template and pre-commit config - Add structured PR template with Git workflow checklist - Add pre-commit hooks for secret detection and Conventional Commits - Enforce code quality gates (YAML/JSON/Markdown lint, shellcheck) NOTE: Execute pre-commit inside Docker container to avoid host pollution: docker compose exec workspace uv tool install pre-commit docker compose exec workspace pre-commit run --all-files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: update PM Agent context with token efficiency architecture - Add Layer 0 Bootstrap (150 tokens, 95% reduction) - Document Intent Classification System (5 complexity levels) - Add Progressive Loading strategy (5-layer) - Document mindbase integration incentive (38% savings) - Update with 2025-10-17 redesign details * refactor: PM Agent command with progressive loading - Replace auto-loading with User Request First philosophy - Add 5-layer progressive context loading - Implement intent classification system - Add workflow metrics collection (.jsonl) - Document graceful degradation strategy * fix: installer improvements Update installer logic for better reliability * docs: add comprehensive development documentation - Add architecture overview - Add PM Agent improvements analysis - Add parallel execution architecture - Add CLI install improvements - Add code style guide - Add project overview - Add install process analysis * docs: add research documentation Add LLM agent token efficiency research and analysis * docs: add suggested commands reference * docs: add session logs and testing documentation - Add session analysis logs - Add testing documentation * feat: migrate CLI to typer + rich for modern UX ## What Changed ### New CLI Architecture (typer + rich) - Created `superclaude/cli/` module with modern typer-based CLI - Replaced custom UI utilities with rich native features - Added type-safe command structure with automatic validation ### Commands Implemented - **install**: Interactive installation with rich UI (progress, panels) - **doctor**: System diagnostics with rich table output - **config**: API key management with format validation ### Technical Improvements - Dependencies: Added typer>=0.9.0, rich>=13.0.0, click>=8.0.0 - Entry Point: Updated pyproject.toml to use `superclaude.cli.app:cli_main` - Tests: Added comprehensive smoke tests (11 passed) ### User Experience Enhancements - Rich formatted help messages with panels and tables - Automatic input validation with retry loops - Clear error messages with actionable suggestions - Non-interactive mode support for CI/CD ## Testing ```bash uv run superclaude --help # ✓ Works uv run superclaude doctor # ✓ Rich table output uv run superclaude config show # ✓ API key management pytest tests/test_cli_smoke.py # ✓ 11 passed, 1 skipped ``` ## Migration Path - ✅ P0: Foundation complete (typer + rich + smoke tests) - 🔜 P1: Pydantic validation models (next sprint) - 🔜 P2: Enhanced error messages (next sprint) - 🔜 P3: API key retry loops (next sprint) ## Performance Impact - **Code Reduction**: Prepared for -300 lines (custom UI → rich) - **Type Safety**: Automatic validation from type hints - **Maintainability**: Framework primitives vs custom code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: consolidate documentation directories Merged claudedocs/ into docs/research/ for consistent documentation structure. Changes: - Moved all claudedocs/*.md files to docs/research/ - Updated all path references in documentation (EN/KR) - Updated RULES.md and research.md command templates - Removed claudedocs/ directory - Removed ClaudeDocs/ from .gitignore Benefits: - Single source of truth for all research reports - PEP8-compliant lowercase directory naming - Clearer documentation organization - Prevents future claudedocs/ directory creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * perf: reduce /sc:pm command output from 1652 to 15 lines - Remove 1637 lines of documentation from command file - Keep only minimal bootstrap message - 99% token reduction on command execution - Detailed specs remain in superclaude/agents/pm-agent.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * perf: split PM Agent into execution workflows and guide - Reduce pm-agent.md from 735 to 429 lines (42% reduction) - Move philosophy/examples to docs/agents/pm-agent-guide.md - Execution workflows (PDCA, file ops) stay in pm-agent.md - Guide (examples, quality standards) read once when needed Token savings: - Agent loading: ~6K → ~3.5K tokens (42% reduction) - Total with pm.md: 71% overall reduction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: consolidate PM Agent optimization and pending changes PM Agent optimization (already committed separately): - superclaude/commands/pm.md: 1652→14 lines - superclaude/agents/pm-agent.md: 735→429 lines - docs/agents/pm-agent-guide.md: new guide file Other pending changes: - setup: framework_docs, mcp, logger, remove ui.py - superclaude: __main__, cli/app, cli/commands/install - tests: test_ui updates - scripts: workflow metrics analysis tools - docs/memory: session state updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: simplify MCP installer to unified gateway with legacy mode ## Changes ### MCP Component (setup/components/mcp.py) - Simplified to single airis-mcp-gateway by default - Added legacy mode for individual official servers (sequential-thinking, context7, magic, playwright) - Dynamic prerequisites based on mode: - Default: uv + claude CLI only - Legacy: node (18+) + npm + claude CLI - Removed redundant server definitions ### CLI Integration - Added --legacy flag to setup/cli/commands/install.py - Added --legacy flag to superclaude/cli/commands/install.py - Config passes legacy_mode to component installer ## Benefits - ✅ Simpler: 1 gateway vs 9+ individual servers - ✅ Lighter: No Node.js/npm required (default mode) - ✅ Unified: All tools in one gateway (sequential-thinking, context7, magic, playwright, serena, morphllm, tavily, chrome-devtools, git, puppeteer) - ✅ Flexible: --legacy flag for official servers if needed ## Usage ```bash superclaude install # Default: airis-mcp-gateway (推奨) superclaude install --legacy # Legacy: individual official servers ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: rename CoreComponent to FrameworkDocsComponent and add PM token tracking ## Changes ### Component Renaming (setup/components/) - Renamed CoreComponent → FrameworkDocsComponent for clarity - Updated all imports in __init__.py, agents.py, commands.py, mcp_docs.py, modes.py - Better reflects the actual purpose (framework documentation files) ### PM Agent Enhancement (superclaude/commands/pm.md) - Added token usage tracking instructions - PM Agent now reports: 1. Current token usage from system warnings 2. Percentage used (e.g., "27% used" for 54K/200K) 3. Status zone: 🟢 <75% | 🟡 75-85% | 🔴 >85% - Helps prevent token exhaustion during long sessions ### UI Utilities (setup/utils/ui.py) - Added new UI utility module for installer - Provides consistent user interface components ## Benefits - ✅ Clearer component naming (FrameworkDocs vs Core) - ✅ PM Agent token awareness for efficiency - ✅ Better visual feedback with status zones 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor(pm-agent): minimize output verbosity (471→284 lines, 40% reduction) **Problem**: PM Agent generated excessive output with redundant explanations - "System Status Report" with decorative formatting - Repeated "Common Tasks" lists user already knows - Verbose session start/end protocols - Duplicate file operations documentation **Solution**: Compress without losing functionality - Session Start: Reduced to symbol-only status (🟢 branch | nM nD | token%) - Session End: Compressed to essential actions only - File Operations: Consolidated from 2 sections to 1 line reference - Self-Improvement: 5 phases → 1 unified workflow - Output Rules: Explicit constraints to prevent Claude over-explanation **Quality Preservation**: - ✅ All core functions retained (PDCA, memory, patterns, mistakes) - ✅ PARALLEL Read/Write preserved (performance critical) - ✅ Workflow unchanged (session lifecycle intact) - ✅ Added output constraints (prevents verbose generation) **Reduction Method**: - Deleted: Explanatory text, examples, redundant sections - Retained: Action definitions, file paths, core workflows - Added: Explicit output constraints to enforce minimalism **Token Impact**: 40% reduction in agent documentation size **Before**: Verbose multi-section report with task lists **After**: Single line status: 🟢 integration | 15M 17D | 36% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: consolidate MCP integration to unified gateway **Changes**: - Remove individual MCP server docs (superclaude/mcp/*.md) - Remove MCP server configs (superclaude/mcp/configs/*.json) - Delete MCP docs component (setup/components/mcp_docs.py) - Simplify installer (setup/core/installer.py) - Update components for unified gateway approach **Rationale**: - Unified gateway (airis-mcp-gateway) provides all MCP servers - Individual docs/configs no longer needed (managed centrally) - Reduces maintenance burden and file count - Simplifies installation process **Files Removed**: 17 MCP files (docs + configs) **Installer Changes**: Removed legacy MCP installation logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: update version and component metadata - Bump version (pyproject.toml, setup/__init__.py) - Update CLAUDE.md import service references - Reflect component structure changes 🤖 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>
8.1 KiB
Git Branch Integration Research: Master/Dev Divergence Resolution (2025)
Research Date: 2025-10-16 Query: Git merge strategies for integrating divergent master/dev branches with both having valuable changes Confidence Level: High (based on official Git docs + 2024-2025 best practices)
Executive Summary
When master and dev branches have diverged with independent commits on both sides, merge is the recommended strategy to integrate all changes from both branches. This preserves complete history and creates a permanent record of integration decisions.
Current Situation Analysis
- dev branch: 2 commits ahead (PM Agent refactoring work)
- master branch: 3 commits ahead (upstream merges + documentation organization)
- Status: Divergent branches requiring reconciliation
Recommended Solution: Two-Step Merge Process
# Step 1: Update dev with master's changes
git checkout dev
git merge master # Brings upstream updates into dev
# Step 2: When ready for release
git checkout master
git merge dev # Integrates PM Agent work into master
Research Findings
1. GitFlow Pattern (Industry Standard)
Source: Atlassian Git Tutorial, nvie.com Git branching model
Key Principles:
develop(ordev) = active development branchmaster(ormain) = production-ready releases- Flow direction: feature → develop → master
- Each merge to master = new production release
Release Process:
- Development work happens on
dev - When
devis stable and feature-complete → merge tomaster - Tag the merge commit on master as a release
- Continue development on
dev
2. Divergent Branch Resolution Strategies
Source: Git official docs, Git Tower, Julia Evans blog (2024)
When branches have diverged (both have unique commits), three options exist:
| Strategy | Command | Result | Best For |
|---|---|---|---|
| Merge | git merge |
Creates merge commit, preserves all history | Keeping both sets of changes (RECOMMENDED) |
| Rebase | git rebase |
Replays commits linearly, rewrites history | Clean linear history (NOT for published branches) |
| Fast-forward | git merge --ff-only |
Only succeeds if no divergence | Fails in this case |
Why Merge is Recommended Here:
- ✅ Preserves complete history from both branches
- ✅ Creates permanent record of integration decisions
- ✅ No history rewriting (safe for shared branches)
- ✅ All conflicts resolved once in merge commit
- ✅ Standard practice for GitFlow dev → master integration
3. Three-Way Merge Mechanics
Source: Git official documentation, git-scm.com Advanced Merging
How Git Merges:
- Identifies common ancestor commit (where branches diverged)
- Compares changes from both branches against ancestor
- Automatically merges non-conflicting changes
- Flags conflicts only when same lines modified differently
Conflict Resolution:
- Git adds conflict markers:
<<<<<<<,=======,>>>>>>> - Developer chooses: keep branch A, keep branch B, or combine both
- Modern tools (VS Code, IntelliJ) provide visual merge editors
- After resolution,
git add+git commitcompletes the merge
Conflict Resolution Options:
# Accept all changes from one side (use cautiously)
git merge -Xours master # Prefer current branch changes
git merge -Xtheirs master # Prefer incoming changes
# Manual resolution (recommended)
# 1. Edit files to resolve conflicts
# 2. git add <resolved-files>
# 3. git commit (creates merge commit)
4. Rebase vs Merge Trade-offs (2024 Analysis)
Source: DataCamp, Atlassian, Stack Overflow discussions
| Aspect | Merge | Rebase |
|---|---|---|
| History | Preserves exact history, shows true timeline | Linear history, rewrites commit timeline |
| Conflicts | Resolve once in single merge commit | May resolve same conflict multiple times |
| Safety | Safe for published/shared branches | Dangerous for shared branches (force push required) |
| Traceability | Merge commit shows integration point | Integration point not explicitly marked |
| CI/CD | Tests exact production commits | May test commits that never actually existed |
| Team collaboration | Works well with multiple contributors | Can cause confusion if not coordinated |
2024 Consensus:
- Use rebase for: local feature branches, keeping commits organized before sharing
- Use merge for: integrating shared branches (like dev → master), preserving collaboration history
5. Modern Tooling Impact (2024-2025)
Source: Various development tool documentation
Tools that make merge easier:
- VS Code 3-way merge editor
- IntelliJ IDEA conflict resolver
- GitKraken visual merge interface
- GitHub web-based conflict resolution
CI/CD Considerations:
- Automated testing runs on actual merge commits
- Merge commits provide clear rollback points
- Rebase can cause false test failures (testing non-existent commit states)
Actionable Recommendations
For Current Situation (dev + master diverged)
Option A: Standard GitFlow (Recommended)
# Bring master's updates into dev first
git checkout dev
git merge master -m "Merge master upstream updates into dev"
# Resolve any conflicts if they occur
# Continue development on dev
# Later, when ready for release
git checkout master
git merge dev -m "Release: Integrate PM Agent refactoring"
git tag -a v1.x.x -m "Release version 1.x.x"
Option B: Immediate Integration (if PM Agent work is ready)
# If dev's PM Agent work is production-ready now
git checkout master
git merge dev -m "Integrate PM Agent refactoring from dev"
# Resolve any conflicts
# Then sync dev with updated master
git checkout dev
git merge master
Conflict Resolution Workflow
# When conflicts occur during merge
git status # Shows conflicted files
# Edit each conflicted file:
# - Locate conflict markers (<<<<<<<, =======, >>>>>>>)
# - Keep the correct code (or combine both approaches)
# - Remove conflict markers
# - Save file
git add <resolved-file> # Stage resolution
git merge --continue # Complete the merge
Verification After Merge
# Check that both sets of changes are present
git log --graph --oneline --decorate --all
git diff HEAD~1 # Review what was integrated
# Verify functionality
make test # Run test suite
make build # Ensure build succeeds
Common Pitfalls to Avoid
❌ Don't: Use rebase on shared branches (dev, master) ✅ Do: Use merge to preserve collaboration history
❌ Don't: Force push to master/dev after rebase ✅ Do: Use standard merge commits that don't require force pushing
❌ Don't: Choose one branch and discard the other ✅ Do: Integrate both branches to keep all valuable work
❌ Don't: Resolve conflicts blindly with -Xours or -Xtheirs
✅ Do: Manually review each conflict for optimal resolution
❌ Don't: Forget to test after merging ✅ Do: Run full test suite after every merge
Sources
- Git Official Documentation: https://git-scm.com/docs/git-merge
- Atlassian Git Tutorials: Merge strategies, GitFlow workflow, Merging vs Rebasing
- Julia Evans Blog (2024): "Dealing with diverged git branches"
- DataCamp (2024): "Git Merge vs Git Rebase: Pros, Cons, and Best Practices"
- Stack Overflow: Multiple highly-voted answers on merge strategies (2024)
- Medium: Git workflow optimization articles (2024-2025)
- GraphQL Guides: Git branching strategies 2024
Conclusion
For the current situation where both dev and master have valuable commits:
- Merge master → dev to bring upstream updates into development branch
- Resolve any conflicts carefully, preserving important changes from both
- Test thoroughly on dev branch
- When ready, merge dev → master following GitFlow release process
- Tag the release on master
This approach preserves all work from both branches and follows 2024-2025 industry best practices.
Confidence: HIGH - Based on official Git documentation and consistent recommendations across multiple authoritative sources from 2024-2025.