{%- set lc = config.get('lifecycle', {}) -%}
{%- set stages = lc.get('stages', {}) -%}
{%- if not stages -%}
{%- set stages = {
    'demo': {
        'name': 'Prototype',
        'description': 'Rapidly validate core concepts and feasibility',
        'focus': ['Rapid iteration', 'Proof of concept', 'Core features'],
        'principles': [
            'Fail fast, adjust fast',
            'Prioritize core features, defer optimization',
            'Technical debt is acceptable but must be documented',
            'Detailed Git development iteration records',
            'Record important decisions in DECISIONS.md',
            'Establish CI/CD'
        ]
    },
    'production': {
        'name': 'Production',
        'description': 'Production-ready development, preparing for scale',
        'focus': ['Stability', 'Performance optimization', 'Maintainability'],
        'principles': [
            'Code quality first',
            'Prepare release and distribution, define target platform support',
            'Full code review before launch, establish robust code structure',
            'Complete QA product test coverage',
            'Define performance standards',
            'Unit test and code standard enforcement',
            'Finalize release platform standards'
        ]
    },
    'commercial': {
        'name': 'Commercial',
        'description': 'Market-facing, pursuing growth',
        'focus': ['User experience', 'Market adaptation', 'Extensibility', 'Plugin-based incremental development', 'Data hot-reload'],
        'principles': [
            'User feedback driven',
            'Data-driven decisions',
            'Fast market response'
        ]
    },
    'stable': {
        'name': 'Stable Operations',
        'description': 'Mature product, stable maintenance',
        'focus': ['Stability', 'Maintenance cost', 'Long-term planning'],
        'principles': [
            'Changes require caution',
            'Backward compatibility first',
            'Complete documentation'
        ]
    }
} -%}
{%- endif -%}
{%- set stage_order = ['demo', 'production', 'commercial', 'stable'] -%}
# VIII. Phase-Based Collaboration Rules

## 8.1 Project Lifecycle Phases

The project development process is divided into 4 lifecycle phases, each with different development priorities and collaboration principles. Phase information is maintained by the PM role in `docs/ROADMAP.md`, and the AI should adjust its working style based on the current phase.

### Phase Type Definitions

Project lifecycle phases evolve sequentially, each with clear definitions and rules:

{% for stage_code in stage_order -%}
{%- set stage_data = stages.get(stage_code, {}) -%}
{% if stage_data -%}
### {{ stage_data.get('name', stage_code) }} ({{ stage_code }})

**Description**: {{ stage_data.get('description', '') }}

**Phase Focus**:
{% for focus in stage_data.get('focus', []) -%}
- {{ focus }}
{% endfor %}
**Phase Principles**:
{% for principle in stage_data.get('principles', []) -%}
- {{ principle }}
{% endfor %}
{% endif -%}
{% endfor -%}
## 8.2 Phase-Based Collaboration Guidance

The AI should during collaboration:

1. **Read current phase**: At dialogue start, read `docs/ROADMAP.md` to understand which phase the project is in
2. **Apply phase rules**: Adjust working style based on the current phase's focus and principles
3. **Monitor phase changes**: When the project upgrades to a new phase, note the principle changes and adjust collaboration
4. **Phase milestones**: Track the current phase's milestone completion, assist in reaching milestones

> **Important**: For specific current phase information, see the "Current Project Lifecycle Phase" section in `docs/ROADMAP.md`.

---
